@solana/rpc-subscriptions-spec
Advanced tools
Comparing version 2.0.0-experimental.26a177e to 2.0.0-experimental.27479b3
@@ -0,1 +1,2 @@ | ||
import { SolanaError, SOLANA_ERROR__RPC_SUBSCRIPTIONS_CANNOT_CREATE_SUBSCRIPTION_REQUEST, SOLANA_ERROR__RPC_SUBSCRIPTIONS_EXPECTED_SERVER_SUBSCRIPTION_ID } from '@solana/errors'; | ||
import { createRpcMessage, RpcError } from '@solana/rpc-spec-types'; | ||
@@ -17,13 +18,13 @@ | ||
return function(...rawParams) { | ||
const methodName = p.toString(); | ||
const createRpcSubscription = Reflect.get(target, methodName, receiver); | ||
const notificationName = p.toString(); | ||
const createRpcSubscription = Reflect.get(target, notificationName, receiver); | ||
if (p.toString().endsWith("Notifications") === false && !createRpcSubscription) { | ||
throw new Error( | ||
"Either the notification name must end in 'Notifications' or the API must supply a subscription creator function to map between the notification name and the subscribe/unsubscribe method names." | ||
); | ||
throw new SolanaError(SOLANA_ERROR__RPC_SUBSCRIPTIONS_CANNOT_CREATE_SUBSCRIPTION_REQUEST, { | ||
notificationName | ||
}); | ||
} | ||
const newRequest = createRpcSubscription ? createRpcSubscription(...rawParams) : { | ||
params: rawParams, | ||
subscribeMethodName: methodName.replace(/Notifications$/, "Subscribe"), | ||
unsubscribeMethodName: methodName.replace(/Notifications$/, "Unsubscribe") | ||
subscribeMethodName: notificationName.replace(/Notifications$/, "Subscribe"), | ||
unsubscribeMethodName: notificationName.replace(/Notifications$/, "Unsubscribe") | ||
}; | ||
@@ -83,3 +84,3 @@ return createPendingRpcSubscription(rpcConfig, newRequest); | ||
if (subscriptionId == null) { | ||
throw new Error("Failed to obtain a subscription id from the server"); | ||
throw new SolanaError(SOLANA_ERROR__RPC_SUBSCRIPTIONS_EXPECTED_SERVER_SUBSCRIPTION_ID); | ||
} | ||
@@ -86,0 +87,0 @@ return { |
@@ -0,1 +1,2 @@ | ||
import { SolanaError, SOLANA_ERROR__RPC_SUBSCRIPTIONS_CANNOT_CREATE_SUBSCRIPTION_REQUEST, SOLANA_ERROR__RPC_SUBSCRIPTIONS_EXPECTED_SERVER_SUBSCRIPTION_ID } from '@solana/errors'; | ||
import { createRpcMessage, RpcError } from '@solana/rpc-spec-types'; | ||
@@ -17,13 +18,13 @@ | ||
return function(...rawParams) { | ||
const methodName = p.toString(); | ||
const createRpcSubscription = Reflect.get(target, methodName, receiver); | ||
const notificationName = p.toString(); | ||
const createRpcSubscription = Reflect.get(target, notificationName, receiver); | ||
if (p.toString().endsWith("Notifications") === false && !createRpcSubscription) { | ||
throw new Error( | ||
"Either the notification name must end in 'Notifications' or the API must supply a subscription creator function to map between the notification name and the subscribe/unsubscribe method names." | ||
); | ||
throw new SolanaError(SOLANA_ERROR__RPC_SUBSCRIPTIONS_CANNOT_CREATE_SUBSCRIPTION_REQUEST, { | ||
notificationName | ||
}); | ||
} | ||
const newRequest = createRpcSubscription ? createRpcSubscription(...rawParams) : { | ||
params: rawParams, | ||
subscribeMethodName: methodName.replace(/Notifications$/, "Subscribe"), | ||
unsubscribeMethodName: methodName.replace(/Notifications$/, "Unsubscribe") | ||
subscribeMethodName: notificationName.replace(/Notifications$/, "Subscribe"), | ||
unsubscribeMethodName: notificationName.replace(/Notifications$/, "Unsubscribe") | ||
}; | ||
@@ -83,3 +84,3 @@ return createPendingRpcSubscription(rpcConfig, newRequest); | ||
if (subscriptionId == null) { | ||
throw new Error("Failed to obtain a subscription id from the server"); | ||
throw new SolanaError(SOLANA_ERROR__RPC_SUBSCRIPTIONS_EXPECTED_SERVER_SUBSCRIPTION_ID); | ||
} | ||
@@ -86,0 +87,0 @@ return { |
@@ -0,1 +1,2 @@ | ||
import { SolanaError, SOLANA_ERROR__RPC_SUBSCRIPTIONS_CANNOT_CREATE_SUBSCRIPTION_REQUEST, SOLANA_ERROR__RPC_SUBSCRIPTIONS_EXPECTED_SERVER_SUBSCRIPTION_ID } from '@solana/errors'; | ||
import { createRpcMessage, RpcError } from '@solana/rpc-spec-types'; | ||
@@ -17,13 +18,13 @@ | ||
return function(...rawParams) { | ||
const methodName = p.toString(); | ||
const createRpcSubscription = Reflect.get(target, methodName, receiver); | ||
const notificationName = p.toString(); | ||
const createRpcSubscription = Reflect.get(target, notificationName, receiver); | ||
if (p.toString().endsWith("Notifications") === false && !createRpcSubscription) { | ||
throw new Error( | ||
"Either the notification name must end in 'Notifications' or the API must supply a subscription creator function to map between the notification name and the subscribe/unsubscribe method names." | ||
); | ||
throw new SolanaError(SOLANA_ERROR__RPC_SUBSCRIPTIONS_CANNOT_CREATE_SUBSCRIPTION_REQUEST, { | ||
notificationName | ||
}); | ||
} | ||
const newRequest = createRpcSubscription ? createRpcSubscription(...rawParams) : { | ||
params: rawParams, | ||
subscribeMethodName: methodName.replace(/Notifications$/, "Subscribe"), | ||
unsubscribeMethodName: methodName.replace(/Notifications$/, "Unsubscribe") | ||
subscribeMethodName: notificationName.replace(/Notifications$/, "Subscribe"), | ||
unsubscribeMethodName: notificationName.replace(/Notifications$/, "Unsubscribe") | ||
}; | ||
@@ -83,3 +84,3 @@ return createPendingRpcSubscription(rpcConfig, newRequest); | ||
if (subscriptionId == null) { | ||
throw new Error("Failed to obtain a subscription id from the server"); | ||
throw new SolanaError(SOLANA_ERROR__RPC_SUBSCRIPTIONS_EXPECTED_SERVER_SUBSCRIPTION_ID); | ||
} | ||
@@ -86,0 +87,0 @@ return { |
{ | ||
"name": "@solana/rpc-subscriptions-spec", | ||
"version": "2.0.0-experimental.26a177e", | ||
"version": "2.0.0-experimental.27479b3", | ||
"description": "A generic implementation of JSON RPC Subscriptions using proxies", | ||
@@ -49,3 +49,4 @@ "exports": { | ||
"dependencies": { | ||
"@solana/rpc-spec-types": "2.0.0-experimental.26a177e" | ||
"@solana/errors": "2.0.0-experimental.27479b3", | ||
"@solana/rpc-spec-types": "2.0.0-experimental.27479b3" | ||
}, | ||
@@ -52,0 +53,0 @@ "bundlewatch": { |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
112192
825
2
+ Added@solana/errors@2.0.0-experimental.27479b3(transitive)
+ Added@solana/rpc-spec-types@2.0.0-experimental.27479b3(transitive)
+ Addedchalk@5.3.0(transitive)
+ Addedcommander@12.1.0(transitive)
- Removed@solana/rpc-spec-types@2.0.0-experimental.26a177e(transitive)