-
Deprecated
op
field ofRamOp
, usefamily
andaction
fields instead. -
Exposed
./client/graphql-stream-client
module so that customized GraphQL Stream Client can be constructed. -
Added
family
andaction
toRamOp
type.
- Fixed problem on dfuse Community Edition when using
authentication: false
.
- Added a dependency bump from dependabot that was missed when doing the 0.3.8 release.
-
Added a default authentication endpoint for the dfuse Community Edition.
-
Removed the api key prefix validation.
-
Improved error notification for GraphQL stream when the server rejects a message that is too big. Now, the stream will received an error and will close instead of staying alive while the socket is down.
- Fixed race condition when starting to start new streams (WebSocket or GraphQL over WebSocket) while the socket is currently disconnecting but not fully disconnected.
- Added
autoDisconnectSocket
option (on standard WebSocket streaming client) to add the possibility to prevent automatic disconnection of socket when no more stream are active in the client. This was already available for GraphQL over WebSocket but not for standard WebSocket stream.
- Added
authentication
option tocreateDfuseClient
so it's much easier to disable authentication on the client instance. Use this when connecting to a dfuse for EOSIO local instance or to a dfuse Community Edition.
- Improved the
DfuseApiError
returned from HTTP call when the body is not JSON.
- Made the deprecation notice about
network
shortcut option even clearer.
- Fixed issue where API error returned by external entities that are actually proxyed via dfuse API
where truncated because assumed to be standard dfuse API error. This was the case for example
when using
client.apiRequest
for EOSIO Chain API calls.
- Removed
worbli
support and make it clear it's not supported by dfuse anymore. - Removed
jungle
support and make it clear it's not supported by dfuse anymore. - Deprecated shortcut endpoint value for
DfuseClientOptions
(when using for examplecreateDfuseClient
). This means that possibility to pass onlymainnet
orkylin
will be removed in a future version (in0.4.0
) and should be replaced by the fully qualified name, somainnet
should be converted tomainnet.eos.dfuse.io
andkylin
tokylin.eos.dfuse.io
.
- Added client instance id generated stream id.
- Added the ability to run the client without authentication. By passing the
authURL
option asnull://....
it will not retrieve a authentication token. Especially useful when running dfuse for EOSIO
- Enhance
Abi
exported types (subtypes were not exported before).
- Fix
StateKeyAccountsResponse
typeaccount_names
field name which was incorrectly namedaccounts
before which was not in-sync with server definition.
- Do not try to reconnect when WebSocket error is 1009 (message too big).
-
Exposed an internal method for internal (i.e. dfuse) consumption.
-
Deprecated
OutboundMessage
message factory functions:getHeadInfoMessage
,getTableRowsMessage
,getActionTracesMessage
andgetTransactionLifecycleMessage
. They will be removed in future releases.
- Fixed
stream.join()
implementation for GraphQL stream when impossible to re-connect. - Improvements to debug output related to received Socket messages.
- Fixed bad validation of
apiKey
field, it's now handlesundefined
andnull
values.
- Fix a bug where a GraphQL stream could re-connect with an expired token, you are invited to update to this version.
- Added a
dfuse-trace:
debug namespace so by default,dfuse:*
can be put on for debugging purposes without generating tons of messages.
-
Fixed avoid polluting the global scope example now that we added a second stream client interface.
-
Removed usage of
finally
call on Promise to get back support for Node.js < 10.x.
-
Official 0.3.0 release.
-
Fixed socket trying to re-connect when disconnection was asked directly by the client.
-
The cursor is sent empty when not present in GraphQL stream. Still possible to pass your own.
- Fixed some
@ts-ignore
that would cause library consumer to choke on compiling.
- Moved
@types/debug
fromdevDependencies
to a plaindependencies
instead.
-
The second parameter of streaming
OnMessage
handler for both WebSocket and GraphQL is the fullStream
object. Previously it was a different type namedmarker
but this was not the clearest way. This is a backward compatible move, the old interface was a subset of theStream
interface.By doing this, it is also possible to close the stream straight within the message handler via
stream.close()
call.
-
Added
terminal
property onerror
message received by theOnGraphqlStreamMessage
so consumer can determine if this is a fatal error and the stream is now terminated or if it's a resolver error and more data will come in. -
Added
autoDisconnectSocket
option to add the possibility to prevent automatic disconnection of socket when no more stream are active in the client. -
Fixed
GraphqlStreamClient.unregisterStream
not correctly resolving thestream.join()
Promise. -
A
1005
WebSocket close code is now considered to be an abnormal closure and will trigger a re-connection.1005
is a close message without any reason. The spec is unclear if normal closing of the connection can use both1000
and1005
. However, since we control the backend, we will now assume that a1005
is an abnormal condition and dfuse WebSocket handling will always send a correct1000
code for a normal ending of the socket connection. -
A GraphQL stream will now auto restart when an error message has been received from the backend.
-
Improved TypeScript typings on
graphql
to ensure automatic inference can be done when usingquery/mutation
via HTTP over any operation in streaming mode. -
The streaming
onMessage
handler forgraphql
now receives a second argumentmarker
than can has a methodmark
to easily mark the stream at cursor location within the message handler directly. -
The streaming
onMessage
handler forstreamXXX
calls now receives a second argumentmarker
than can has a methodmark
to easily mark the stream at cursor location within the message handler directly.
-
The
graphql()
method types has changed so TypeScript can automatically infers the actual return type. There is now two signatures possible forgraphql
.The request/response version:
graphql<T = any>( document: string | GraphqlDocument, options?: { variables?: GraphqlVariables operationType?: Exclude<GraphqlOperationType, "subscription"> } ): Promise<GraphqlResponse<T>>
This version is used for
Query
orMutation
going only and by using this signature, you are telling us to use the HTTP transport layer. This signature always returns aPromise<GraphqlResponse<T>>
and doesn't accept any listener.The streaming version:
graphql<T = any>( document: string | GraphqlDocument, onMessage: OnGraphqlStreamMessage<T>, options?: { variables?: GraphqlVariables operationType?: GraphqlOperationType } ): Promise<Stream>
This version can be used with all operation types and by using this signature, you are telling us to use the WebSocket transport layer. This always returns a
Promise<Stream>
and is now similar to other streaming method in the client.To upgrade, change all you streaming calls from:
graphql(` <document> `, { onMessage: (...) => { <handler> }, variables: { ... } })
To
graphql(` <document> `, (...) => { <handler> }, { variables: { ... } })
The
query
ormutation
calls remains the same, but you might need to fix typings of those since we now return aGraphqlResponse<T>
instance of a plainT
type.You can then remove any
as Promise<...>
typecast you might had before to help TypeScript infer the right type.
-
Added support for GraphQL directly in the library. The client has now a
graphql(...)
method. All document operation type are supported: Query, Mutation & Subscription. For now, you must provide the document as astring
value. You can use thegql
string literal, but you must send it as a string to the client for now. See GraphQL - Use 'gql' tag & Typings example about how to do just that.Note Passing directly a
gql
will be supported on the next iteration of the release candidate. -
It's now possible to
join
an existingStream
object. After receiving a stream, you can now doawait stream.join()
to wait until theStream
completes. A stream completes when:- It's
close
method has been called by the client. - The server sent the completion message completing the stream.
- The server sent an irrecoverable error terminating the stream.
- It's
-
Added support for
GET /v0/state/table/row
(stateTableRow
) endpoint. -
Added support for
symbol
andsymbol_code
as validkey_type
for easier conversion of values. -
Now using
POST
version forstateTablesForScopes
andstateTableForAccounts
.
-
(Light) The
SocketOptions#onInvalidMessage
has been removed completely. Since now all messages are forwarded, this was now useless. Note thatping
and otherkeep alive
are still trapped by the library and you will never receive them directly anymore. -
(Light) The
SocketListenerMessage
type now being more loose, all messages are forwarded to it, so it could be possible to receive messages that you did not receive before. This trickles down to theOnStreamMessage
listener of Stream API. Ensures that you validate thetype
field and only consume messages that are of interest to you.But in reality, this has really low impact as the protocol did not change and as such, no new messages can arrive for now.
-
(Light) The
SocketListenerMessage
type is has been loosen, now acceptingunknown
instead ofInboundMessage
. -
(Light) The
Socket#send
method type has been loosen, now acceptingunknown
instead ofOutboundMessage
.
- Deprecated
ConnectOptions
(renamed toSocketConnectOptions
in a different file now also).
- Fixed typings for
stateTableForScopes
andstateTableForAccounts
that was not correct according to dfuse REST API.
- Fixed typings for
StateTableScopesResponse
that was not correct according to dfuse REST API.
- Bumped development dependencies.
- Typo in example file (thanks @marcuswin).
- Added support for
Worbli
network straight in the library.
-
Improves WebSocket streaming reference examples to better show the message flow.
-
Fixed basic streaming examples that were not behaving as expected due to a bug.
-
Added a
release
method on all interfaces used by theDfuseClient
so a release of some hold handles can be performed. -
Added
endpoints
getter onDfuseClient
to reduce code required when using Apollo Link.
- Added a check to ensure the API key provided to
createDfuseClient
is actually a valid API key. A specialized message being displayed to those using an API token instead.
-
Renamed
ActionTraceData
DbOp
toActionTraceDbOp
. This fixes a problem whereDbOp
type from library was always theTableDeltaData
one since they were conflicting having the same name. This rename is not a breaking change since it was impossible to import the type. -
Fix
ActionTraceData
dbops
field definition which was incorrectly usingTableDeltaData
DbOp
definition while not being the same at all.Warning Requires some modification steps (resolving new compilation errors for some usage of the library's types). See From '@dfuse/[email protected]' to '@dfuse/[email protected]' section in migration guide.
-
Removed duplicated
DbOp
definition which was wrong anyway.
- Deprecated
RAMOP
(renamed toRamOp
). - Deprecated
DBOp
(renamed toDbOp
).
-
Fixed typing mismatch between dfuse WebSocket API JSON output and our own type definitions.
Warning Requires some modification steps (resolving new compilation errors for some usage of the library's types). See From '@dfuse/[email protected]' to '@dfuse/[email protected]' section in migration guide.
-
Added support for
GET /v0/block_id/by_time
endpoint. -
Added possibility to get a valid API token straight from the dfuse Client instance. This enables consumer of our GraphQL API to delegate API key management logic to
@dfuse/client
library.
-
Fixed dfuse Search API
blockCount
default value that was larger than a Uint32 value being the biggest value accepted by dfuse API. -
Added support for
GET /v0/transactions/:id
endpoint. -
Added
matchingActionTraces
helper to easily extract a the matching action traces out of aSearchTransactionRow
when performing a search query through dfuse REST API search endpoint. -
Added
flattenActionTraces
helper to easily extract action traces from aTransactionLifecycle
object (useful to find matching action for action index used by dfuse API). -
Fixed a bunch of typing errors between actual
nodeos
JSON output and our own type definitions as well against dfuse API directly. Warning Requires some modification steps (resolving new compilation errors for some usage of the library's types). See From '@dfuse/[email protected]' to '@dfuse/[email protected]' section in migration guide.
-
Removed
socket
public property fromStreamClient
interface to reduce coupling. -
It's now possible to add custom headers when using
DfuseClient.apiRequest
method (same on underlyingHttpClient
interface). -
Now exposing
dfuseClient.apiRequest
as a public method of theDfuseClient
interface. -
Fixed UMD build that was not minified anymore due to an oversight.
-
Fixed UMD build that incorrectly had
require(...)
clauses and that could be picked for transformation by some bundler tool. -
The function
isExpiredOrNearExpiration
has been renamed toisApiTokenExpired
to better reflect the intention of the method. -
Changed default reconnect delay value from
5s
to2.5s
. -
Added a
Stream.onPostRestart
callback that can be used to act after a successful stream restart, see [./examples/advanced/never-miss-a-beat.ts] for usage. -
Fixed a bug where re-connect was not connected back if an error occurred in the reconnect itself.
-
Added a
OnDiskApiTokenStore
to store the token under~/.dfuse/<sha256-api-key>/token.json
file using theFileApiTokenStore
and make it the default in a Node.js environment. -
Added a
FileApiTokenStore
to store the token info under a given file (can be used only in a Node.js environment). -
Added
LocalStorageApiTokenStore
implementation and make it the default in a Browser environment. -
Now distributing an
es5
andumd
build in addition to the old previouscommonjs
build (now underdist/lib
). -
Added
dynamicMessageDispatcher
helper to easily create anOnStreamMessage
that dispatches to correct handler based on the message's type. -
Streams now auto-restart at last marked block if present or at provided value upon socket re-connection.
-
Add full support for marking the stream at the right location.
-
Renamed the library to
@dfuse/client
. -
Major overhaul of the full API of the library to become a full dfuse Client library, read the
MIGRATION.md
guide for more details on how to go from@dfuse/eosws-js
to the full blown@dfuse/client
.
- The
unlisten
function of aStream
(has returned byregisterStream
), has been renamed toclose
. Simply rename the method to upgrade.
- Fixed a bug where
onClose
event was not notified anymore when if error occurred before closing WebSocket.
- Fixed a bug where
onClose
event was not notified on closing of the WebSocket connection.
- Added an option to specify the amount of time in milliseconds between each keep alive messages.
- Passing socket event to
onError
andonClose
event handlers. - Added
trace_id
to error type.
- Added possibility to pass undocumented options.
- Fixed
with_progress
accepting anumber
and not aboolean
.
- Updated multi contracts example to use the new
accounts
parameter. - Updated library to support new version of
get_action_traces
(addedaccounts
,receivers
andaction_names
).
Those are deprecation notices, they are still available in the current pre-release major version
(0.11.x
in this case). You are welcome to upgrade right now however.
- Renamed
GetActionTracesMessageData#account
toGetActionTracesMessageData#accounts
. - Renamed
GetActionTracesMessageData#receiver
toGetActionTracesMessageData#receivers
. - Renamed
GetActionTracesMessageData#action_name
toGetActionTracesMessageData#action_names
.
- Fix back to back connect()
- Reverted
Fix client connection flow
, this was preventing examples from running correctly.
- Fixed version
- Fix DBOp interface
- Fix client connection flow
- Update examples
- Fixed README to read
getTransactionLifecycle
in the API section.
- Renamed
EoswsClient.getTransaction
toEoswsClient.getTransactionLifecycle
. - Renamed
getTransactionMessage
togetTransactionLifecycleMessage
. - Renamed
OutboundMessageType.TRANSACTION
toOutboundMessageType.TRANSACTION_LIFECYCLE
.
- Removed all previous code, everything has been replaced by a proper
EoswsClient
object.
The previous package was mostly released on name eosws
. The package has been migrated to
our dfuse
branding instead, so first, you will need to update that.
yarn remove eosws
yarn add @dfuse/eosws-js
or using NPM:
npm uninstall --save @dfuse/eosws-js
npm install --save @dfuse/eosws-js
Instead of:
import { get_actions, parse_actions } from 'eoswjs'
const endpoint = 'mainnet.eos.dfuse.io'
const origin = 'https://example.com'
const token = '<Paste your API token here>'
const ws = new WebSocket(`wss://${endpoint}/v1/stream?token=${token}`, { origin })
ws.onopen = () => {
ws.send(get_actions({ accounts: 'eosio.token', action_names: 'transfer' }))
}
ws.onmessage = (message) => {
const actions = parse_actions(message.data)
if (actions) {
const { from, to, quantity, memo } = actions.data.trace.act.data
console.log(from, to, quantity, memo)
}
}
You should replace with:
import { EoswsClient, createEoswsSocket, InboundMessageType } from '@dfuse/eosws-js'
const endpoint = 'mainnet.eos.dfuse.io'
const token = '<Paste your API token here>'
const client = new EoswsClient(createEoswsSocket(() =>
new WebSocket(`wss://${endpoint}/v1/stream?token=${token}`, { origin: 'https://example.com' })))
client.connect().then(() => {
client
.getActionTraces({ accounts: 'eosio.token', action_names: 'transfer' })
.onMessage((message) => {
if (message.type === InboundMessageType.ACTION_TRACE) {
const { from, to, quantity, memo } = message.data.trace.act.data
console.log(from, to, quantity, memo)
}
})
})
This functionality has been removed completely, you will need to make the checking by "hand":
onMessage = (message) => {
if (message.type === 'action_trace') {
console.log('Action trace, do something useful.')
}
}
If you only want to create messages, the functionality is still available. Instead of doing:
import { get_actions } from 'eoswjs'
// ... WebSocket stuff here
ws.send(get_actions({ accounts: 'eosio.token', action_names: 'transfer' }))
Do this instead:
import { getActionTracesMessage } from '@dfuse/eosws-js'
ws.send(getActionTracesMessage({ accounts: 'eosio.token', action_names: 'transfer' }))
Here the list of available message constructors:
getActionTracesMessage
getTableRowsMessage
getTransactionLifecycleMessage
Note Those constructors are not documented yet as part of the API and might be removed in the future, this has not been decided yet. Refer to the src/message/outbound.ts file for available parameters for each constructors.
- Added a proper
EoswsSocket
that automatically re-connects on abnormal closing. - Added a proper
EoswsClient
to wrap all operations correctly. - Overhaul of examples and supporting documentation.
- On
get_actions
&get_table_deltas
only has two params (data parameters & optional parameters) both as defined as Objects. - On
get_actions
,receiver
is now optional and defaults to the same value asaccount
. - The
get_table_deltas
request was renamed toget_table_rows
.