@solana/rpc-subscriptions-spec
Advanced tools
Comparing version 2.0.0-canary-20241011161636 to 2.0.0-canary-20241011164625
import { Callable } from '@solana/rpc-spec-types'; | ||
import { RpcSubscriptionsRequest } from './rpc-subscriptions-request'; | ||
export type RpcSubscriptionsApiConfig = Readonly<{ | ||
parametersTransformer?: <T extends unknown[]>(params: T, notificationName: string) => unknown[]; | ||
responseTransformer?: <T>(response: unknown, notificationName: string) => T; | ||
subscribeNotificationNameTransformer?: (notificationName: string) => string; | ||
unsubscribeNotificationNameTransformer?: (notificationName: string) => string; | ||
import { DataPublisher } from '@solana/subscribable'; | ||
import { RpcSubscriptionsChannel } from './rpc-subscriptions-channel'; | ||
import { RpcSubscriptionsTransportDataEvents } from './rpc-subscriptions-transport'; | ||
export type RpcSubscriptionsApiConfig<TApiMethods extends RpcSubscriptionsApiMethods> = Readonly<{ | ||
getSubscriptionConfigurationHash?: (details: Readonly<{ | ||
notificationName: string; | ||
params: unknown; | ||
}>) => string | undefined; | ||
planExecutor: RpcSubscriptionsPlanExecutor<ReturnType<TApiMethods[keyof TApiMethods]>>; | ||
}>; | ||
type RpcSubscriptionsPlanExecutor<TNotification> = (config: Readonly<{ | ||
channel: RpcSubscriptionsChannel<unknown, unknown>; | ||
notificationName: string; | ||
params?: unknown[]; | ||
signal: AbortSignal; | ||
}>) => Promise<DataPublisher<RpcSubscriptionsTransportDataEvents<TNotification>>>; | ||
export type RpcSubscriptionsPlan<TNotification> = Readonly<{ | ||
/** | ||
* This method may be called with a newly-opened channel or a pre-established channel. | ||
*/ | ||
executeSubscriptionPlan: (config: Readonly<{ | ||
channel: RpcSubscriptionsChannel<unknown, unknown>; | ||
signal: AbortSignal; | ||
}>) => Promise<DataPublisher<RpcSubscriptionsTransportDataEvents<TNotification>>>; | ||
/** | ||
* This hash uniquely identifies the configuration of a subscription. It is typically used by | ||
* consumers of this API to deduplicate multiple subscriptions for the same notification. | ||
*/ | ||
subscriptionConfigurationHash: string | undefined; | ||
}>; | ||
export type RpcSubscriptionsApi<TRpcSubscriptionMethods> = { | ||
[MethodName in keyof TRpcSubscriptionMethods]: RpcSubscriptionsReturnTypeMapper<TRpcSubscriptionMethods[MethodName]>; | ||
}; | ||
type RpcSubscriptionsReturnTypeMapper<TRpcMethod> = TRpcMethod extends Callable ? (...rawParams: unknown[]) => RpcSubscriptionsRequest<ReturnType<TRpcMethod>> : never; | ||
type RpcSubscriptionsReturnTypeMapper<TRpcMethod> = TRpcMethod extends Callable ? (...rawParams: unknown[]) => RpcSubscriptionsPlan<ReturnType<TRpcMethod>> : never; | ||
type RpcSubscriptionsApiMethod = (...args: any) => any; | ||
@@ -17,4 +40,4 @@ export interface RpcSubscriptionsApiMethods { | ||
} | ||
export declare function createRpcSubscriptionsApi<TRpcSubscriptionsApiMethods extends RpcSubscriptionsApiMethods>(config?: RpcSubscriptionsApiConfig): RpcSubscriptionsApi<TRpcSubscriptionsApiMethods>; | ||
export declare function createRpcSubscriptionsApi<TRpcSubscriptionsApiMethods extends RpcSubscriptionsApiMethods>(config: RpcSubscriptionsApiConfig<TRpcSubscriptionsApiMethods>): RpcSubscriptionsApi<TRpcSubscriptionsApiMethods>; | ||
export {}; | ||
//# sourceMappingURL=rpc-subscriptions-api.d.ts.map |
@@ -1,11 +0,15 @@ | ||
type RpcSubscriptionsTransportConfig = Readonly<{ | ||
payload: unknown; | ||
import { SolanaError } from '@solana/errors'; | ||
import { DataPublisher } from '@solana/subscribable'; | ||
import { RpcSubscriptionsPlan } from './rpc-subscriptions-api'; | ||
export type RpcSubscriptionsTransportDataEvents<TNotification> = { | ||
error: SolanaError; | ||
notification: TNotification; | ||
}; | ||
interface RpcSubscriptionsTransportConfig<TNotification> extends RpcSubscriptionsPlan<TNotification> { | ||
signal: AbortSignal; | ||
}>; | ||
} | ||
export interface RpcSubscriptionsTransport { | ||
(config: RpcSubscriptionsTransportConfig): Promise<Readonly<AsyncIterable<unknown> & { | ||
send_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: (payload: unknown) => Promise<void>; | ||
}>>; | ||
<TNotification>(config: RpcSubscriptionsTransportConfig<TNotification>): Promise<DataPublisher<RpcSubscriptionsTransportDataEvents<TNotification>>>; | ||
} | ||
export {}; | ||
//# sourceMappingURL=rpc-subscriptions-transport.d.ts.map |
@@ -5,5 +5,5 @@ import { Callable, Flatten, OverloadImplementations, UnionToIntersection } from '@solana/rpc-spec-types'; | ||
import { RpcSubscriptionsTransport } from './rpc-subscriptions-transport'; | ||
export type RpcSubscriptionsConfig<TRpcMethods, TRpcSubscriptionsTransport extends RpcSubscriptionsTransport> = Readonly<{ | ||
export type RpcSubscriptionsConfig<TRpcMethods> = Readonly<{ | ||
api: RpcSubscriptionsApi<TRpcMethods>; | ||
transport: TRpcSubscriptionsTransport; | ||
transport: RpcSubscriptionsTransport; | ||
}>; | ||
@@ -17,4 +17,4 @@ export type RpcSubscriptions<TRpcSubscriptionsMethods> = { | ||
type PendingRpcSubscriptionsRequestReturnTypeMapper<TSubscriptionMethodImplementation> = TSubscriptionMethodImplementation extends Callable ? (...args: Parameters<TSubscriptionMethodImplementation>) => PendingRpcSubscriptionsRequest<ReturnType<TSubscriptionMethodImplementation>> : never; | ||
export declare function createSubscriptionRpc<TRpcSubscriptionsApiMethods, TRpcSubscriptionsTransport extends RpcSubscriptionsTransport>(rpcConfig: RpcSubscriptionsConfig<TRpcSubscriptionsApiMethods, TRpcSubscriptionsTransport>): RpcSubscriptions<TRpcSubscriptionsApiMethods>; | ||
export declare function createSubscriptionRpc<TRpcSubscriptionsApiMethods>(rpcConfig: RpcSubscriptionsConfig<TRpcSubscriptionsApiMethods>): RpcSubscriptions<TRpcSubscriptionsApiMethods>; | ||
export {}; | ||
//# sourceMappingURL=rpc-subscriptions.d.ts.map |
{ | ||
"name": "@solana/rpc-subscriptions-spec", | ||
"version": "2.0.0-canary-20241011161636", | ||
"version": "2.0.0-canary-20241011164625", | ||
"description": "A generic implementation of JSON RPC Subscriptions using proxies", | ||
@@ -57,6 +57,6 @@ "exports": { | ||
"dependencies": { | ||
"@solana/promises": "2.0.0-canary-20241011161636", | ||
"@solana/subscribable": "2.0.0-canary-20241011161636", | ||
"@solana/rpc-spec-types": "2.0.0-canary-20241011161636", | ||
"@solana/errors": "2.0.0-canary-20241011161636" | ||
"@solana/errors": "2.0.0-canary-20241011164625", | ||
"@solana/rpc-spec-types": "2.0.0-canary-20241011164625", | ||
"@solana/promises": "2.0.0-canary-20241011164625", | ||
"@solana/subscribable": "2.0.0-canary-20241011164625" | ||
}, | ||
@@ -63,0 +63,0 @@ "peerDependencies": { |
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
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
180707
1260
+ Added@solana/errors@2.0.0-canary-20241011164625(transitive)
+ Added@solana/promises@2.0.0-canary-20241011164625(transitive)
+ Added@solana/rpc-spec-types@2.0.0-canary-20241011164625(transitive)
+ Added@solana/subscribable@2.0.0-canary-20241011164625(transitive)
- Removed@solana/errors@2.0.0-canary-20241011161636(transitive)
- Removed@solana/promises@2.0.0-canary-20241011161636(transitive)
- Removed@solana/rpc-spec-types@2.0.0-canary-20241011161636(transitive)
- Removed@solana/subscribable@2.0.0-canary-20241011161636(transitive)