@solana/rpc-subscriptions-spec
Advanced tools
Comparing version 2.0.0-experimental.97527f4 to 2.0.0-experimental.997a7cc
@@ -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.97527f4", | ||
"version": "2.0.0-experimental.997a7cc", | ||
"description": "A generic implementation of JSON RPC Subscriptions using proxies", | ||
@@ -49,3 +49,4 @@ "exports": { | ||
"dependencies": { | ||
"@solana/rpc-spec-types": "2.0.0-experimental.97527f4" | ||
"@solana/errors": "2.0.0-experimental.997a7cc", | ||
"@solana/rpc-spec-types": "2.0.0-experimental.997a7cc" | ||
}, | ||
@@ -62,9 +63,9 @@ "bundlewatch": { | ||
"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", | ||
@@ -74,5 +75,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
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
107435
2
23
697
+ Added@solana/errors@2.0.0-experimental.997a7cc(transitive)
+ Added@solana/rpc-spec-types@2.0.0-experimental.997a7cc(transitive)
+ Addedchalk@5.4.1(transitive)
+ Addedcommander@12.1.0(transitive)
- Removed@solana/rpc-spec-types@2.0.0-experimental.97527f4(transitive)