{"version":3,"file":"graphql-ws-CEVFP_3C.js","sources":["../../node_modules/graphql-ws/lib/utils.mjs","../../node_modules/graphql-ws/lib/common.mjs","../../node_modules/graphql-ws/lib/client.mjs"],"sourcesContent":["/** @private */\nexport function extendedTypeof(val) {\n if (val === null) {\n return 'null';\n }\n if (Array.isArray(val)) {\n return 'array';\n }\n return typeof val;\n}\n/** @private */\nexport function isObject(val) {\n return extendedTypeof(val) === 'object';\n}\n/** @private */\nexport function isAsyncIterable(val) {\n return typeof Object(val)[Symbol.asyncIterator] === 'function';\n}\n/** @private */\nexport function isAsyncGenerator(val) {\n return (isObject(val) &&\n typeof Object(val)[Symbol.asyncIterator] === 'function' &&\n typeof val.return === 'function'\n // for lazy ones, we only need the return anyway\n // typeof val.throw === 'function' &&\n // typeof val.next === 'function'\n );\n}\n/** @private */\nexport function areGraphQLErrors(obj) {\n return (Array.isArray(obj) &&\n // must be at least one error\n obj.length > 0 &&\n // error has at least a message\n obj.every((ob) => 'message' in ob));\n}\n/**\n * Limits the WebSocket close event reason to not exceed a length of one frame.\n * Reference: https://datatracker.ietf.org/doc/html/rfc6455#section-5.2.\n *\n * @private\n */\nexport function limitCloseReason(reason, whenTooLong) {\n return reason.length < 124 ? reason : whenTooLong;\n}\n","/**\n *\n * common\n *\n */\nimport { areGraphQLErrors, extendedTypeof, isObject } from './utils.mjs';\n/**\n * The WebSocket sub-protocol used for the [GraphQL over WebSocket Protocol](https://github.com/graphql/graphql-over-http/blob/main/rfcs/GraphQLOverWebSocket.md).\n *\n * @category Common\n */\nexport const GRAPHQL_TRANSPORT_WS_PROTOCOL = 'graphql-transport-ws';\n/**\n * The deprecated subprotocol used by [subscriptions-transport-ws](https://github.com/apollographql/subscriptions-transport-ws).\n *\n * @private\n */\nexport const DEPRECATED_GRAPHQL_WS_PROTOCOL = 'graphql-ws';\n/**\n * `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).\n *\n * @category Common\n */\nexport var CloseCode;\n(function (CloseCode) {\n CloseCode[CloseCode[\"InternalServerError\"] = 4500] = \"InternalServerError\";\n CloseCode[CloseCode[\"InternalClientError\"] = 4005] = \"InternalClientError\";\n CloseCode[CloseCode[\"BadRequest\"] = 4400] = \"BadRequest\";\n CloseCode[CloseCode[\"BadResponse\"] = 4004] = \"BadResponse\";\n /** Tried subscribing before connect ack */\n CloseCode[CloseCode[\"Unauthorized\"] = 4401] = \"Unauthorized\";\n CloseCode[CloseCode[\"Forbidden\"] = 4403] = \"Forbidden\";\n CloseCode[CloseCode[\"SubprotocolNotAcceptable\"] = 4406] = \"SubprotocolNotAcceptable\";\n CloseCode[CloseCode[\"ConnectionInitialisationTimeout\"] = 4408] = \"ConnectionInitialisationTimeout\";\n CloseCode[CloseCode[\"ConnectionAcknowledgementTimeout\"] = 4504] = \"ConnectionAcknowledgementTimeout\";\n /** Subscriber distinction is very important */\n CloseCode[CloseCode[\"SubscriberAlreadyExists\"] = 4409] = \"SubscriberAlreadyExists\";\n CloseCode[CloseCode[\"TooManyInitialisationRequests\"] = 4429] = \"TooManyInitialisationRequests\";\n})(CloseCode || (CloseCode = {}));\n/**\n * Types of messages allowed to be sent by the client/server over the WS protocol.\n *\n * @category Common\n */\nexport var MessageType;\n(function (MessageType) {\n MessageType[\"ConnectionInit\"] = \"connection_init\";\n MessageType[\"ConnectionAck\"] = \"connection_ack\";\n MessageType[\"Ping\"] = \"ping\";\n MessageType[\"Pong\"] = \"pong\";\n MessageType[\"Subscribe\"] = \"subscribe\";\n MessageType[\"Next\"] = \"next\";\n MessageType[\"Error\"] = \"error\";\n MessageType[\"Complete\"] = \"complete\";\n})(MessageType || (MessageType = {}));\n/**\n * Validates the message against the GraphQL over WebSocket Protocol.\n *\n * Invalid messages will throw descriptive errors.\n *\n * @category Common\n */\nexport function validateMessage(val) {\n if (!isObject(val)) {\n throw new Error(`Message is expected to be an object, but got ${extendedTypeof(val)}`);\n }\n if (!val.type) {\n throw new Error(`Message is missing the 'type' property`);\n }\n if (typeof val.type !== 'string') {\n throw new Error(`Message is expects the 'type' property to be a string, but got ${extendedTypeof(val.type)}`);\n }\n switch (val.type) {\n case MessageType.ConnectionInit:\n case MessageType.ConnectionAck:\n case MessageType.Ping:\n case MessageType.Pong: {\n if (val.payload != null && !isObject(val.payload)) {\n throw new Error(`\"${val.type}\" message expects the 'payload' property to be an object or nullish or missing, but got \"${val.payload}\"`);\n }\n break;\n }\n case MessageType.Subscribe: {\n if (typeof val.id !== 'string') {\n throw new Error(`\"${val.type}\" message expects the 'id' property to be a string, but got ${extendedTypeof(val.id)}`);\n }\n if (!val.id) {\n throw new Error(`\"${val.type}\" message requires a non-empty 'id' property`);\n }\n if (!isObject(val.payload)) {\n throw new Error(`\"${val.type}\" message expects the 'payload' property to be an object, but got ${extendedTypeof(val.payload)}`);\n }\n if (typeof val.payload.query !== 'string') {\n throw new Error(`\"${val.type}\" message payload expects the 'query' property to be a string, but got ${extendedTypeof(val.payload.query)}`);\n }\n if (val.payload.variables != null && !isObject(val.payload.variables)) {\n 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)}`);\n }\n if (val.payload.operationName != null &&\n extendedTypeof(val.payload.operationName) !== 'string') {\n 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)}`);\n }\n if (val.payload.extensions != null && !isObject(val.payload.extensions)) {\n 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)}`);\n }\n break;\n }\n case MessageType.Next: {\n if (typeof val.id !== 'string') {\n throw new Error(`\"${val.type}\" message expects the 'id' property to be a string, but got ${extendedTypeof(val.id)}`);\n }\n if (!val.id) {\n throw new Error(`\"${val.type}\" message requires a non-empty 'id' property`);\n }\n if (!isObject(val.payload)) {\n throw new Error(`\"${val.type}\" message expects the 'payload' property to be an object, but got ${extendedTypeof(val.payload)}`);\n }\n break;\n }\n case MessageType.Error: {\n if (typeof val.id !== 'string') {\n throw new Error(`\"${val.type}\" message expects the 'id' property to be a string, but got ${extendedTypeof(val.id)}`);\n }\n if (!val.id) {\n throw new Error(`\"${val.type}\" message requires a non-empty 'id' property`);\n }\n if (!areGraphQLErrors(val.payload)) {\n throw new Error(`\"${val.type}\" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(val.payload)}`);\n }\n break;\n }\n case MessageType.Complete: {\n if (typeof val.id !== 'string') {\n throw new Error(`\"${val.type}\" message expects the 'id' property to be a string, but got ${extendedTypeof(val.id)}`);\n }\n if (!val.id) {\n throw new Error(`\"${val.type}\" message requires a non-empty 'id' property`);\n }\n break;\n }\n default:\n throw new Error(`Invalid message 'type' property \"${val.type}\"`);\n }\n return val;\n}\n/**\n * Checks if the provided value is a valid GraphQL over WebSocket message.\n *\n * @deprecated Use `validateMessage` instead.\n *\n * @category Common\n */\nexport function isMessage(val) {\n try {\n validateMessage(val);\n return true;\n }\n catch (_a) {\n return false;\n }\n}\n/**\n * Parses the raw websocket message data to a valid message.\n *\n * @category Common\n */\nexport function parseMessage(data, reviver) {\n return validateMessage(typeof data === 'string' ? JSON.parse(data, reviver) : data);\n}\n/**\n * Stringifies a valid message ready to be sent through the socket.\n *\n * @category Common\n */\nexport function stringifyMessage(msg, replacer) {\n validateMessage(msg);\n return JSON.stringify(msg, replacer);\n}\n","/**\n *\n * client\n *\n */\nvar __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }\nvar __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n 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); }); }; }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n};\nimport { GRAPHQL_TRANSPORT_WS_PROTOCOL, CloseCode, MessageType, parseMessage, stringifyMessage, } from './common.mjs';\nimport { isObject, limitCloseReason } from './utils.mjs';\n/** This file is the entry point for browsers, re-export common elements. */\nexport * from './common.mjs';\n/**\n * Creates a disposable GraphQL over WebSocket client.\n *\n * @category Client\n */\nexport function createClient(options) {\n const { url, connectionParams, lazy = true, onNonLazyError = console.error, lazyCloseTimeout: lazyCloseTimeoutMs = 0, keepAlive = 0, disablePong, connectionAckWaitTimeout = 0, retryAttempts = 5, retryWait = async function randomisedExponentialBackoff(retries) {\n let retryDelay = 1000; // start with 1s delay\n for (let i = 0; i < retries; i++) {\n retryDelay *= 2;\n }\n await new Promise((resolve) => setTimeout(resolve, retryDelay +\n // add random timeout from 300ms to 3s\n Math.floor(Math.random() * (3000 - 300) + 300)));\n }, shouldRetry = isLikeCloseEvent, isFatalConnectionProblem, on, webSocketImpl, \n /**\n * Generates a v4 UUID to be used as the ID using `Math`\n * as the random number generator. Supply your own generator\n * in case you need more uniqueness.\n *\n * Reference: https://gist.github.com/jed/982883\n */\n generateID = function generateUUID() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (c) => {\n const r = (Math.random() * 16) | 0, v = c == 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n }, jsonMessageReplacer: replacer, jsonMessageReviver: reviver, } = options;\n let ws;\n if (webSocketImpl) {\n if (!isWebSocket(webSocketImpl)) {\n throw new Error('Invalid WebSocket implementation provided');\n }\n ws = webSocketImpl;\n }\n else if (typeof WebSocket !== 'undefined') {\n ws = WebSocket;\n }\n else if (typeof global !== 'undefined') {\n ws =\n global.WebSocket ||\n // @ts-expect-error: Support more browsers\n global.MozWebSocket;\n }\n else if (typeof window !== 'undefined') {\n ws =\n window.WebSocket ||\n // @ts-expect-error: Support more browsers\n window.MozWebSocket;\n }\n if (!ws)\n throw new Error(\"WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`\");\n const WebSocketImpl = ws;\n // websocket status emitter, subscriptions are handled differently\n const emitter = (() => {\n const message = (() => {\n const listeners = {};\n return {\n on(id, listener) {\n listeners[id] = listener;\n return () => {\n delete listeners[id];\n };\n },\n emit(message) {\n var _a;\n if ('id' in message)\n (_a = listeners[message.id]) === null || _a === void 0 ? void 0 : _a.call(listeners, message);\n },\n };\n })();\n const listeners = {\n connecting: (on === null || on === void 0 ? void 0 : on.connecting) ? [on.connecting] : [],\n opened: (on === null || on === void 0 ? void 0 : on.opened) ? [on.opened] : [],\n connected: (on === null || on === void 0 ? void 0 : on.connected) ? [on.connected] : [],\n ping: (on === null || on === void 0 ? void 0 : on.ping) ? [on.ping] : [],\n pong: (on === null || on === void 0 ? void 0 : on.pong) ? [on.pong] : [],\n message: (on === null || on === void 0 ? void 0 : on.message) ? [message.emit, on.message] : [message.emit],\n closed: (on === null || on === void 0 ? void 0 : on.closed) ? [on.closed] : [],\n error: (on === null || on === void 0 ? void 0 : on.error) ? [on.error] : [],\n };\n return {\n onMessage: message.on,\n on(event, listener) {\n const l = listeners[event];\n l.push(listener);\n return () => {\n l.splice(l.indexOf(listener), 1);\n };\n },\n emit(event, ...args) {\n // we copy the listeners so that unlistens dont \"pull the rug under our feet\"\n for (const listener of [...listeners[event]]) {\n // @ts-expect-error: The args should fit\n listener(...args);\n }\n },\n };\n })();\n // invokes the callback either when an error or closed event is emitted,\n // first one that gets called prevails, other emissions are ignored\n function errorOrClosed(cb) {\n const listening = [\n // errors are fatal and more critical than close events, throw them first\n emitter.on('error', (err) => {\n listening.forEach((unlisten) => unlisten());\n cb(err);\n }),\n // closes can be graceful and not fatal, throw them second (if error didnt throw)\n emitter.on('closed', (event) => {\n listening.forEach((unlisten) => unlisten());\n cb(event);\n }),\n ];\n }\n let connecting, locks = 0, lazyCloseTimeout, retrying = false, retries = 0, disposed = false;\n async function connect() {\n // clear the lazy close timeout immediatelly so that close gets debounced\n // see: https://github.com/enisdenjo/graphql-ws/issues/388\n clearTimeout(lazyCloseTimeout);\n const [socket, throwOnClose] = await (connecting !== null && connecting !== void 0 ? connecting : (connecting = new Promise((connected, denied) => (async () => {\n if (retrying) {\n await retryWait(retries);\n // subscriptions might complete while waiting for retry\n if (!locks) {\n connecting = undefined;\n return denied({ code: 1000, reason: 'All Subscriptions Gone' });\n }\n retries++;\n }\n emitter.emit('connecting', retrying);\n const socket = new WebSocketImpl(typeof url === 'function' ? await url() : url, GRAPHQL_TRANSPORT_WS_PROTOCOL);\n let connectionAckTimeout, queuedPing;\n function enqueuePing() {\n if (isFinite(keepAlive) && keepAlive > 0) {\n clearTimeout(queuedPing); // in case where a pong was received before a ping (this is valid behaviour)\n queuedPing = setTimeout(() => {\n if (socket.readyState === WebSocketImpl.OPEN) {\n socket.send(stringifyMessage({ type: MessageType.Ping }));\n emitter.emit('ping', false, undefined);\n }\n }, keepAlive);\n }\n }\n errorOrClosed((errOrEvent) => {\n connecting = undefined;\n clearTimeout(connectionAckTimeout);\n clearTimeout(queuedPing);\n denied(errOrEvent);\n if (errOrEvent instanceof TerminatedCloseEvent) {\n socket.close(4499, 'Terminated'); // close event is artificial and emitted manually, see `Client.terminate()` below\n socket.onerror = null;\n socket.onclose = null;\n }\n });\n socket.onerror = (err) => emitter.emit('error', err);\n socket.onclose = (event) => emitter.emit('closed', event);\n socket.onopen = async () => {\n try {\n emitter.emit('opened', socket);\n const payload = typeof connectionParams === 'function'\n ? await connectionParams()\n : connectionParams;\n // connectionParams might take too long causing the server to kick off the client\n // the necessary error/close event is already reported - simply stop execution\n if (socket.readyState !== WebSocketImpl.OPEN)\n return;\n socket.send(stringifyMessage(payload\n ? {\n type: MessageType.ConnectionInit,\n payload,\n }\n : {\n type: MessageType.ConnectionInit,\n // payload is completely absent if not provided\n }, replacer));\n if (isFinite(connectionAckWaitTimeout) &&\n connectionAckWaitTimeout > 0) {\n connectionAckTimeout = setTimeout(() => {\n socket.close(CloseCode.ConnectionAcknowledgementTimeout, 'Connection acknowledgement timeout');\n }, connectionAckWaitTimeout);\n }\n enqueuePing(); // enqueue ping (noop if disabled)\n }\n catch (err) {\n emitter.emit('error', err);\n socket.close(CloseCode.InternalClientError, limitCloseReason(err instanceof Error ? err.message : new Error(err).message, 'Internal client error'));\n }\n };\n let acknowledged = false;\n socket.onmessage = ({ data }) => {\n try {\n const message = parseMessage(data, reviver);\n emitter.emit('message', message);\n if (message.type === 'ping' || message.type === 'pong') {\n emitter.emit(message.type, true, message.payload); // received\n if (message.type === 'pong') {\n enqueuePing(); // enqueue next ping (noop if disabled)\n }\n else if (!disablePong) {\n // respond with pong on ping\n socket.send(stringifyMessage(message.payload\n ? {\n type: MessageType.Pong,\n payload: message.payload,\n }\n : {\n type: MessageType.Pong,\n // payload is completely absent if not provided\n }));\n emitter.emit('pong', false, message.payload);\n }\n return; // ping and pongs can be received whenever\n }\n if (acknowledged)\n return; // already connected and acknowledged\n if (message.type !== MessageType.ConnectionAck)\n throw new Error(`First message cannot be of type ${message.type}`);\n clearTimeout(connectionAckTimeout);\n acknowledged = true;\n emitter.emit('connected', socket, message.payload, retrying); // connected = socket opened + acknowledged\n retrying = false; // future lazy connects are not retries\n retries = 0; // reset the retries on connect\n connected([\n socket,\n new Promise((_, reject) => errorOrClosed(reject)),\n ]);\n }\n catch (err) {\n socket.onmessage = null; // stop reading messages as soon as reading breaks once\n emitter.emit('error', err);\n socket.close(CloseCode.BadResponse, limitCloseReason(err instanceof Error ? err.message : new Error(err).message, 'Bad response'));\n }\n };\n })())));\n // if the provided socket is in a closing state, wait for the throw on close\n if (socket.readyState === WebSocketImpl.CLOSING)\n await throwOnClose;\n let release = () => {\n // releases this connection\n };\n const released = new Promise((resolve) => (release = resolve));\n return [\n socket,\n release,\n Promise.race([\n // wait for\n released.then(() => {\n if (!locks) {\n // and if no more locks are present, complete the connection\n const complete = () => socket.close(1000, 'Normal Closure');\n if (isFinite(lazyCloseTimeoutMs) && lazyCloseTimeoutMs > 0) {\n // if the keepalive is set, allow for the specified calmdown time and\n // then complete if the socket is still open.\n lazyCloseTimeout = setTimeout(() => {\n if (socket.readyState === WebSocketImpl.OPEN)\n complete();\n }, lazyCloseTimeoutMs);\n }\n else {\n // otherwise complete immediately\n complete();\n }\n }\n }),\n // or\n throwOnClose,\n ]),\n ];\n }\n /**\n * Checks the `connect` problem and evaluates if the client should retry.\n */\n function shouldRetryConnectOrThrow(errOrCloseEvent) {\n // some close codes are worth reporting immediately\n if (isLikeCloseEvent(errOrCloseEvent) &&\n (isFatalInternalCloseCode(errOrCloseEvent.code) ||\n [\n CloseCode.InternalServerError,\n CloseCode.InternalClientError,\n CloseCode.BadRequest,\n CloseCode.BadResponse,\n CloseCode.Unauthorized,\n // CloseCode.Forbidden, might grant access out after retry\n CloseCode.SubprotocolNotAcceptable,\n // CloseCode.ConnectionInitialisationTimeout, might not time out after retry\n // CloseCode.ConnectionAcknowledgementTimeout, might not time out after retry\n CloseCode.SubscriberAlreadyExists,\n CloseCode.TooManyInitialisationRequests,\n // 4499, // Terminated, probably because the socket froze, we want to retry\n ].includes(errOrCloseEvent.code)))\n throw errOrCloseEvent;\n // client was disposed, no retries should proceed regardless\n if (disposed)\n return false;\n // normal closure (possibly all subscriptions have completed)\n // if no locks were acquired in the meantime, shouldnt try again\n if (isLikeCloseEvent(errOrCloseEvent) && errOrCloseEvent.code === 1000)\n return locks > 0;\n // retries are not allowed or we tried to many times, report error\n if (!retryAttempts || retries >= retryAttempts)\n throw errOrCloseEvent;\n // throw non-retryable connection problems\n if (!shouldRetry(errOrCloseEvent))\n throw errOrCloseEvent;\n // @deprecated throw fatal connection problems immediately\n if (isFatalConnectionProblem === null || isFatalConnectionProblem === void 0 ? void 0 : isFatalConnectionProblem(errOrCloseEvent))\n throw errOrCloseEvent;\n // looks good, start retrying\n return (retrying = true);\n }\n // in non-lazy (hot?) mode always hold one connection lock to persist the socket\n if (!lazy) {\n (async () => {\n locks++;\n for (;;) {\n try {\n const [, , throwOnClose] = await connect();\n await throwOnClose; // will always throw because releaser is not used\n }\n catch (errOrCloseEvent) {\n try {\n if (!shouldRetryConnectOrThrow(errOrCloseEvent))\n return;\n }\n catch (errOrCloseEvent) {\n // report thrown error, no further retries\n return onNonLazyError === null || onNonLazyError === void 0 ? void 0 : onNonLazyError(errOrCloseEvent);\n }\n }\n }\n })();\n }\n function subscribe(payload, sink) {\n const id = generateID(payload);\n let done = false, errored = false, releaser = () => {\n // for handling completions before connect\n locks--;\n done = true;\n };\n (async () => {\n locks++;\n for (;;) {\n try {\n const [socket, release, waitForReleaseOrThrowOnClose] = await connect();\n // if done while waiting for connect, release the connection lock right away\n if (done)\n return release();\n const unlisten = emitter.onMessage(id, (message) => {\n switch (message.type) {\n case MessageType.Next: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any -- payload will fit type\n sink.next(message.payload);\n return;\n }\n case MessageType.Error: {\n (errored = true), (done = true);\n sink.error(message.payload);\n releaser();\n return;\n }\n case MessageType.Complete: {\n done = true;\n releaser(); // release completes the sink\n return;\n }\n }\n });\n socket.send(stringifyMessage({\n id,\n type: MessageType.Subscribe,\n payload,\n }, replacer));\n releaser = () => {\n if (!done && socket.readyState === WebSocketImpl.OPEN)\n // if not completed already and socket is open, send complete message to server on release\n socket.send(stringifyMessage({\n id,\n type: MessageType.Complete,\n }, replacer));\n locks--;\n done = true;\n release();\n };\n // either the releaser will be called, connection completed and\n // the promise resolved or the socket closed and the promise rejected.\n // whatever happens though, we want to stop listening for messages\n await waitForReleaseOrThrowOnClose.finally(unlisten);\n return; // completed, shouldnt try again\n }\n catch (errOrCloseEvent) {\n if (!shouldRetryConnectOrThrow(errOrCloseEvent))\n return;\n }\n }\n })()\n .then(() => {\n // delivering either an error or a complete terminates the sequence\n if (!errored)\n sink.complete();\n }) // resolves on release or normal closure\n .catch((err) => {\n sink.error(err);\n }); // rejects on close events and errors\n return () => {\n // dispose only of active subscriptions\n if (!done)\n releaser();\n };\n }\n return {\n on: emitter.on,\n subscribe,\n iterate(request) {\n const pending = [];\n const deferred = {\n done: false,\n error: null,\n resolve: () => {\n // noop\n },\n };\n const dispose = subscribe(request, {\n next(val) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n pending.push(val);\n deferred.resolve();\n },\n error(err) {\n deferred.done = true;\n deferred.error = err;\n deferred.resolve();\n },\n complete() {\n deferred.done = true;\n deferred.resolve();\n },\n });\n const iterator = (function iterator() {\n return __asyncGenerator(this, arguments, function* iterator_1() {\n for (;;) {\n if (!pending.length) {\n // only wait if there are no pending messages available\n yield __await(new Promise((resolve) => (deferred.resolve = resolve)));\n }\n // first flush\n while (pending.length) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n yield yield __await(pending.shift());\n }\n // then error\n if (deferred.error) {\n throw deferred.error;\n }\n // or complete\n if (deferred.done) {\n return yield __await(void 0);\n }\n }\n });\n })();\n iterator.throw = async (err) => {\n if (!deferred.done) {\n deferred.done = true;\n deferred.error = err;\n deferred.resolve();\n }\n return { done: true, value: undefined };\n };\n iterator.return = async () => {\n dispose();\n return { done: true, value: undefined };\n };\n return iterator;\n },\n async dispose() {\n disposed = true;\n if (connecting) {\n // if there is a connection, close it\n const [socket] = await connecting;\n socket.close(1000, 'Normal Closure');\n }\n },\n terminate() {\n if (connecting) {\n // only if there is a connection\n emitter.emit('closed', new TerminatedCloseEvent());\n }\n },\n };\n}\n/**\n * A syntetic close event `4499: Terminated` is issued to the current to immediately\n * close the connection without waiting for the one coming from `WebSocket.onclose`.\n *\n * Terminating is not considered fatal and a connection retry will occur as expected.\n *\n * Useful in cases where the WebSocket is stuck and not emitting any events;\n * can happen on iOS Safari, see: https://github.com/enisdenjo/graphql-ws/discussions/290.\n */\nexport class TerminatedCloseEvent extends Error {\n constructor() {\n super(...arguments);\n this.name = 'TerminatedCloseEvent';\n this.message = '4499: Terminated';\n this.code = 4499;\n this.reason = 'Terminated';\n this.wasClean = false;\n }\n}\nfunction isLikeCloseEvent(val) {\n return isObject(val) && 'code' in val && 'reason' in val;\n}\nfunction isFatalInternalCloseCode(code) {\n if ([\n 1000,\n 1001,\n 1006,\n 1005,\n 1012,\n 1013,\n 1014, // Bad Gateway\n ].includes(code))\n return false;\n // all other internal errors are fatal\n return code >= 1000 && code <= 1999;\n}\nfunction isWebSocket(val) {\n return (typeof val === 'function' &&\n 'constructor' in val &&\n 'CLOSED' in val &&\n 'CLOSING' in val &&\n 'CONNECTING' in val &&\n 'OPEN' in val);\n}\n"],"names":["extendedTypeof","val","Array","isArray","isObject","limitCloseReason","reason","whenTooLong","length","CloseCode","MessageType","validateMessage","Error","type","ConnectionInit","ConnectionAck","Ping","Pong","payload","Subscribe","id","query","variables","operationName","extensions","Next","obj","every","ob","JSON","stringify","Complete","stringifyMessage","msg","replacer","__await","v","this","__asyncGenerator","thisArg","_arguments","generator","Symbol","asyncIterator","TypeError","i","g","apply","q","verb","n","Promise","a","b","push","resume","r","value","resolve","then","fulfill","reject","settle","e","f","shift","createClient","options","url","connectionParams","lazy","onNonLazyError","console","error","lazyCloseTimeout","lazyCloseTimeoutMs","keepAlive","disablePong","connectionAckWaitTimeout","retryAttempts","retryWait","async","retries","retryDelay","setTimeout","Math","floor","random","shouldRetry","isLikeCloseEvent","isFatalConnectionProblem","on","webSocketImpl","generateID","replace","c","toString","jsonMessageReplacer","jsonMessageReviver","reviver","ws","WebSocket","global","MozWebSocket","window","WebSocketImpl","emitter","message","listeners","listener","emit","_a","call","connecting","opened","connected","ping","pong","closed","onMessage","event","l","splice","indexOf","args","errorOrClosed","cb","listening","err","forEach","unlisten","locks","retrying","disposed","connect","clearTimeout","socket","throwOnClose","denied","code","connectionAckTimeout","queuedPing","enqueuePing","isFinite","readyState","OPEN","send","errOrEvent","TerminatedCloseEvent","close","onerror","onclose","onopen","ConnectionAcknowledgementTimeout","InternalClientError","acknowledged","onmessage","data","parse","parseMessage","_","BadResponse","CLOSING","release","released","race","complete","shouldRetryConnectOrThrow","errOrCloseEvent","includes","InternalServerError","BadRequest","Unauthorized","SubprotocolNotAcceptable","SubscriberAlreadyExists","TooManyInitialisationRequests","subscribe","sink","done","errored","releaser","waitForReleaseOrThrowOnClose","next","finally","catch","iterate","request","pending","deferred","dispose","iterator","arguments","throw","return","terminate","constructor","super","name","wasClean"],"mappings":"AACO,SAASA,EAAeC,GAC3B,OAAY,OAARA,EACO,OAEPC,MAAMC,QAAQF,GACP,eAEGA,CAClB,CAEO,SAASG,EAASH,GACd,MAAwB,WAAxBD,EAAeC,EAC1B,CA6BO,SAASI,EAAiBC,EAAQC,GAC9B,OAAAD,EAAOE,OAAS,IAAMF,EAASC,CAC1C,CCrBO,IAAIE,EACAA,EAoBAC,EACAA,EAiBJ,SAASC,EAAgBV,GACxB,IAACG,EAASH,GACV,MAAM,IAAIW,MAAM,gDAAgDZ,EAAeC,MAE/E,IAACA,EAAIY,KACC,MAAA,IAAID,MAAM,0CAEhB,GAAoB,iBAAbX,EAAIY,KACX,MAAM,IAAID,MAAM,kEAAkEZ,EAAeC,EAAIY,SAEzG,OAAQZ,EAAIY,MACR,KAAKH,EAAYI,eACjB,KAAKJ,EAAYK,cACjB,KAAKL,EAAYM,KACjB,KAAKN,EAAYO,KACb,GAAmB,MAAfhB,EAAIiB,UAAoBd,EAASH,EAAIiB,SAC/B,MAAA,IAAIN,MAAM,IAAIX,EAAIY,gGAAgGZ,EAAIiB,YAEhI,MAEJ,KAAKR,EAAYS,UACT,GAAkB,iBAAXlB,EAAImB,GACL,MAAA,IAAIR,MAAM,IAAIX,EAAIY,mEAAmEb,EAAeC,EAAImB,OAE9G,IAAC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