@solana/rpc-subscriptions-transport-websocket
Advanced tools
Comparing version 2.0.0-experimental.c32f08b to 2.0.0-experimental.c732fad
@@ -0,1 +1,3 @@ | ||
import { SolanaError, SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_FAILED_TO_CONNECT, SOLANA_ERROR__INVARIANT_VIOLATION__WEBSOCKET_MESSAGE_ITERATOR_STATE_MISSING, SOLANA_ERROR__INVARIANT_VIOLATION__WEBSOCKET_MESSAGE_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE, SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_CONNECTION_CLOSED, SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_CLOSED_BEFORE_MESSAGE_BUFFERED } from '@solana/errors'; | ||
// ../build-scripts/env-shim.ts | ||
@@ -47,4 +49,5 @@ var __DEV__ = /* @__PURE__ */ (() => process["env"].NODE_ENV === "development")(); | ||
reject( | ||
// TODO: Coded error | ||
new Error("WebSocket failed to connect", { cause: ev }) | ||
new SolanaError(SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_FAILED_TO_CONNECT, { | ||
errorEvent: ev | ||
}) | ||
); | ||
@@ -74,4 +77,5 @@ } | ||
reject2( | ||
// TODO: Coded error | ||
new Error("WebSocket was closed before payload could be sent") | ||
new SolanaError( | ||
SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_CLOSED_BEFORE_MESSAGE_BUFFERED | ||
) | ||
); | ||
@@ -99,7 +103,9 @@ }; | ||
if (!state) { | ||
throw new Error("Invariant: WebSocket message iterator is missing state storage"); | ||
throw new SolanaError( | ||
SOLANA_ERROR__INVARIANT_VIOLATION__WEBSOCKET_MESSAGE_ITERATOR_STATE_MISSING | ||
); | ||
} | ||
if (state.__hasPolled) { | ||
throw new Error( | ||
"Invariant: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise" | ||
throw new SolanaError( | ||
SOLANA_ERROR__INVARIANT_VIOLATION__WEBSOCKET_MESSAGE_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE | ||
); | ||
@@ -124,3 +130,8 @@ } | ||
} else { | ||
throw new Error("WebSocket connection closed", { cause: e2 }); | ||
throw new SolanaError( | ||
SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_CONNECTION_CLOSED, | ||
{ | ||
cause: e2 | ||
} | ||
); | ||
} | ||
@@ -127,0 +138,0 @@ } |
@@ -0,1 +1,3 @@ | ||
import { SolanaError, SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_FAILED_TO_CONNECT, SOLANA_ERROR__INVARIANT_VIOLATION__WEBSOCKET_MESSAGE_ITERATOR_STATE_MISSING, SOLANA_ERROR__INVARIANT_VIOLATION__WEBSOCKET_MESSAGE_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE, SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_CONNECTION_CLOSED, SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_CLOSED_BEFORE_MESSAGE_BUFFERED } from '@solana/errors'; | ||
// ../build-scripts/env-shim.ts | ||
@@ -47,4 +49,5 @@ var __DEV__ = /* @__PURE__ */ (() => process["env"].NODE_ENV === "development")(); | ||
reject( | ||
// TODO: Coded error | ||
new Error("WebSocket failed to connect", { cause: ev }) | ||
new SolanaError(SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_FAILED_TO_CONNECT, { | ||
errorEvent: ev | ||
}) | ||
); | ||
@@ -74,4 +77,5 @@ } | ||
reject2( | ||
// TODO: Coded error | ||
new Error("WebSocket was closed before payload could be sent") | ||
new SolanaError( | ||
SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_CLOSED_BEFORE_MESSAGE_BUFFERED | ||
) | ||
); | ||
@@ -99,7 +103,9 @@ }; | ||
if (!state) { | ||
throw new Error("Invariant: WebSocket message iterator is missing state storage"); | ||
throw new SolanaError( | ||
SOLANA_ERROR__INVARIANT_VIOLATION__WEBSOCKET_MESSAGE_ITERATOR_STATE_MISSING | ||
); | ||
} | ||
if (state.__hasPolled) { | ||
throw new Error( | ||
"Invariant: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise" | ||
throw new SolanaError( | ||
SOLANA_ERROR__INVARIANT_VIOLATION__WEBSOCKET_MESSAGE_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE | ||
); | ||
@@ -124,3 +130,8 @@ } | ||
} else { | ||
throw new Error("WebSocket connection closed", { cause: e2 }); | ||
throw new SolanaError( | ||
SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_CONNECTION_CLOSED, | ||
{ | ||
cause: e2 | ||
} | ||
); | ||
} | ||
@@ -127,0 +138,0 @@ } |
@@ -0,1 +1,2 @@ | ||
import { SolanaError, SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_FAILED_TO_CONNECT, SOLANA_ERROR__INVARIANT_VIOLATION__WEBSOCKET_MESSAGE_ITERATOR_STATE_MISSING, SOLANA_ERROR__INVARIANT_VIOLATION__WEBSOCKET_MESSAGE_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE, SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_CONNECTION_CLOSED, SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_CLOSED_BEFORE_MESSAGE_BUFFERED } from '@solana/errors'; | ||
import e from 'ws'; | ||
@@ -47,4 +48,5 @@ | ||
reject( | ||
// TODO: Coded error | ||
new Error("WebSocket failed to connect", { cause: ev }) | ||
new SolanaError(SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_FAILED_TO_CONNECT, { | ||
errorEvent: ev | ||
}) | ||
); | ||
@@ -74,4 +76,5 @@ } | ||
reject2( | ||
// TODO: Coded error | ||
new Error("WebSocket was closed before payload could be sent") | ||
new SolanaError( | ||
SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_CLOSED_BEFORE_MESSAGE_BUFFERED | ||
) | ||
); | ||
@@ -99,7 +102,9 @@ }; | ||
if (!state) { | ||
throw new Error("Invariant: WebSocket message iterator is missing state storage"); | ||
throw new SolanaError( | ||
SOLANA_ERROR__INVARIANT_VIOLATION__WEBSOCKET_MESSAGE_ITERATOR_STATE_MISSING | ||
); | ||
} | ||
if (state.__hasPolled) { | ||
throw new Error( | ||
"Invariant: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise" | ||
throw new SolanaError( | ||
SOLANA_ERROR__INVARIANT_VIOLATION__WEBSOCKET_MESSAGE_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE | ||
); | ||
@@ -124,3 +129,8 @@ } | ||
} else { | ||
throw new Error("WebSocket connection closed", { cause: e2 }); | ||
throw new SolanaError( | ||
SOLANA_ERROR__RPC_SUBSCRIPTIONS__TRANSPORT_CONNECTION_CLOSED, | ||
{ | ||
cause: e2 | ||
} | ||
); | ||
} | ||
@@ -127,0 +137,0 @@ } |
{ | ||
"name": "@solana/rpc-subscriptions-transport-websocket", | ||
"version": "2.0.0-experimental.c32f08b", | ||
"version": "2.0.0-experimental.c732fad", | ||
"description": "An RPC Subscriptions transport that uses WebSockets", | ||
@@ -49,3 +49,4 @@ "exports": { | ||
"dependencies": { | ||
"@solana/rpc-subscriptions-spec": "2.0.0-experimental.c32f08b" | ||
"@solana/rpc-subscriptions-spec": "2.0.0-experimental.c732fad", | ||
"@solana/errors": "2.0.0-experimental.c732fad" | ||
}, | ||
@@ -65,9 +66,9 @@ "peerDependencies": { | ||
"compile:js": "tsup --config build-scripts/tsup.config.package.ts", | ||
"compile:typedefs": "tsc -p ./tsconfig.declarations.json && node node_modules/@solana/build-scripts/add-js-extension-to-types.mjs", | ||
"dev": "jest -c node_modules/@solana/test-config/jest-dev.config.ts --rootDir . --watch", | ||
"compile:typedefs": "tsc -p ./tsconfig.declarations.json && node ../../node_modules/@solana/build-scripts/add-js-extension-to-types.mjs", | ||
"dev": "jest -c ../../node_modules/@solana/test-config/jest-dev.config.ts --rootDir . --watch", | ||
"publish-impl": "npm view $npm_package_name@$npm_package_version > /dev/null 2>&1 || pnpm publish --tag experimental --access public --no-git-checks", | ||
"publish-packages": "pnpm prepublishOnly && pnpm publish-impl", | ||
"style:fix": "pnpm eslint --fix src/* && pnpm prettier -w src/* package.json", | ||
"test:lint": "jest -c node_modules/@solana/test-config/jest-lint.config.ts --rootDir . --silent", | ||
"test:prettier": "jest -c node_modules/@solana/test-config/jest-prettier.config.ts --rootDir . --silent", | ||
"test:lint": "jest -c ../../node_modules/@solana/test-config/jest-lint.config.ts --rootDir . --silent", | ||
"test:prettier": "jest -c ../../node_modules/@solana/test-config/jest-prettier.config.ts --rootDir . --silent", | ||
"test:treeshakability:browser": "agadoo dist/index.browser.js", | ||
@@ -77,5 +78,5 @@ "test:treeshakability:native": "agadoo dist/index.native.js", | ||
"test:typecheck": "tsc --noEmit", | ||
"test:unit:browser": "jest -c node_modules/@solana/test-config/jest-unit.config.browser.ts --rootDir . --silent", | ||
"test:unit:node": "jest -c node_modules/@solana/test-config/jest-unit.config.node.ts --rootDir . --silent" | ||
"test:unit:browser": "jest -c ../../node_modules/@solana/test-config/jest-unit.config.browser.ts --rootDir . --silent", | ||
"test:unit:node": "jest -c ../../node_modules/@solana/test-config/jest-unit.config.node.ts --rootDir . --silent" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
122347
1127
3
+ Added@solana/errors@2.0.0-experimental.c732fad(transitive)
+ Added@solana/rpc-spec-types@2.0.0-experimental.c732fad(transitive)
+ Added@solana/rpc-subscriptions-spec@2.0.0-experimental.c732fad(transitive)
+ Addedchalk@5.4.1(transitive)
+ Addedcommander@12.1.0(transitive)
- Removed@solana/rpc-spec-types@2.0.0-experimental.c32f08b(transitive)
- Removed@solana/rpc-subscriptions-spec@2.0.0-experimental.c32f08b(transitive)
Updated@solana/rpc-subscriptions-spec@2.0.0-experimental.c732fad