-
Deprecated
opfield ofRamOp, usefamilyandactionfields instead. -
Exposed
./client/graphql-stream-clientmodule so that customized GraphQL Stream Client can be constructed. -
Added
familyandactiontoRamOptype.
- 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
autoDisconnectSocketoption (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
authenticationoption tocreateDfuseClientso 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
DfuseApiErrorreturned from HTTP call when the body is not JSON.
- Made the deprecation notice about
networkshortcut 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.apiRequestfor EOSIO Chain API calls.
- Removed
worblisupport and make it clear it's not supported by dfuse anymore. - Removed
junglesupport 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 onlymainnetorkylinwill be removed in a future version (in0.4.0) and should be replaced by the fully qualified name, somainnetshould be converted tomainnet.eos.dfuse.ioandkylintokylin.eos.dfuse.io.
- Added client instance id generated stream id.
- Added the ability to run the client without authentication. By passing the
authURLoption asnull://....it will not retrieve a authentication token. Especially useful when running dfuse for EOSIO
- Enhance
Abiexported types (subtypes were not exported before).
- Fix
StateKeyAccountsResponsetypeaccount_namesfield name which was incorrectly namedaccountsbefore 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
OutboundMessagemessage factory functions:getHeadInfoMessage,getTableRowsMessage,getActionTracesMessageandgetTransactionLifecycleMessage. 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
apiKeyfield, it's now handlesundefinedandnullvalues.
- 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
finallycall 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-ignorethat would cause library consumer to choke on compiling.
- Moved
@types/debugfromdevDependenciesto a plaindependenciesinstead.
-
The second parameter of streaming
OnMessagehandler for both WebSocket and GraphQL is the fullStreamobject. Previously it was a different type namedmarkerbut this was not the clearest way. This is a backward compatible move, the old interface was a subset of theStreaminterface.By doing this, it is also possible to close the stream straight within the message handler via
stream.close()call.
-
Added
terminalproperty onerrormessage received by theOnGraphqlStreamMessageso 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
autoDisconnectSocketoption to add the possibility to prevent automatic disconnection of socket when no more stream are active in the client. -
Fixed
GraphqlStreamClient.unregisterStreamnot correctly resolving thestream.join()Promise. -
A
1005WebSocket close code is now considered to be an abnormal closure and will trigger a re-connection.1005is a close message without any reason. The spec is unclear if normal closing of the connection can use both1000and1005. However, since we control the backend, we will now assume that a1005is an abnormal condition and dfuse WebSocket handling will always send a correct1000code 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
graphqlto ensure automatic inference can be done when usingquery/mutationvia HTTP over any operation in streaming mode. -
The streaming
onMessagehandler forgraphqlnow receives a second argumentmarkerthan can has a methodmarkto easily mark the stream at cursor location within the message handler directly. -
The streaming
onMessagehandler forstreamXXXcalls now receives a second argumentmarkerthan can has a methodmarkto 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
QueryorMutationgoing 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
queryormutationcalls remains the same, but you might need to fix typings of those since we now return aGraphqlResponse<T>instance of a plainTtype.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 astringvalue. You can use thegqlstring 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
gqlwill be supported on the next iteration of the release candidate. -
It's now possible to
joinan existingStreamobject. After receiving a stream, you can now doawait stream.join()to wait until theStreamcompletes. A stream completes when:- It's
closemethod 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
symbolandsymbol_codeas validkey_typefor easier conversion of values. -
Now using
POSTversion forstateTablesForScopesandstateTableForAccounts.
-
(Light) The
SocketOptions#onInvalidMessagehas been removed completely. Since now all messages are forwarded, this was now useless. Note thatpingand otherkeep aliveare still trapped by the library and you will never receive them directly anymore. -
(Light) The
SocketListenerMessagetype 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 theOnStreamMessagelistener of Stream API. Ensures that you validate thetypefield 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
SocketListenerMessagetype is has been loosen, now acceptingunknowninstead ofInboundMessage. -
(Light) The
Socket#sendmethod type has been loosen, now acceptingunknowninstead ofOutboundMessage.
- Deprecated
ConnectOptions(renamed toSocketConnectOptionsin a different file now also).
- Fixed typings for
stateTableForScopesandstateTableForAccountsthat was not correct according to dfuse REST API.
- Fixed typings for
StateTableScopesResponsethat was not correct according to dfuse REST API.
- Bumped development dependencies.
- Typo in example file (thanks @marcuswin).
- Added support for
Worblinetwork 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
releasemethod on all interfaces used by theDfuseClientso a release of some hold handles can be performed. -
Added
endpointsgetter onDfuseClientto reduce code required when using Apollo Link.
- Added a check to ensure the API key provided to
createDfuseClientis actually a valid API key. A specialized message being displayed to those using an API token instead.
-
Renamed
ActionTraceDataDbOptoActionTraceDbOp. This fixes a problem whereDbOptype from library was always theTableDeltaDataone since they were conflicting having the same name. This rename is not a breaking change since it was impossible to import the type. -
Fix
ActionTraceDatadbopsfield definition which was incorrectly usingTableDeltaDataDbOpdefinition 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
DbOpdefinition 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_timeendpoint. -
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/clientlibrary.
-
Fixed dfuse Search API
blockCountdefault value that was larger than a Uint32 value being the biggest value accepted by dfuse API. -
Added support for
GET /v0/transactions/:idendpoint. -
Added
matchingActionTraceshelper to easily extract a the matching action traces out of aSearchTransactionRowwhen performing a search query through dfuse REST API search endpoint. -
Added
flattenActionTraceshelper to easily extract action traces from aTransactionLifecycleobject (useful to find matching action for action index used by dfuse API). -
Fixed a bunch of typing errors between actual
nodeosJSON 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
socketpublic property fromStreamClientinterface to reduce coupling. -
It's now possible to add custom headers when using
DfuseClient.apiRequestmethod (same on underlyingHttpClientinterface). -
Now exposing
dfuseClient.apiRequestas a public method of theDfuseClientinterface. -
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
isExpiredOrNearExpirationhas been renamed toisApiTokenExpiredto better reflect the intention of the method. -
Changed default reconnect delay value from
5sto2.5s. -
Added a
Stream.onPostRestartcallback 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
OnDiskApiTokenStoreto store the token under~/.dfuse/<sha256-api-key>/token.jsonfile using theFileApiTokenStoreand make it the default in a Node.js environment. -
Added a
FileApiTokenStoreto store the token info under a given file (can be used only in a Node.js environment). -
Added
LocalStorageApiTokenStoreimplementation and make it the default in a Browser environment. -
Now distributing an
es5andumdbuild in addition to the old previouscommonjsbuild (now underdist/lib). -
Added
dynamicMessageDispatcherhelper to easily create anOnStreamMessagethat 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.mdguide for more details on how to go from@dfuse/eosws-jsto the full blown@dfuse/client.
- The
unlistenfunction of aStream(has returned byregisterStream), has been renamed toclose. Simply rename the method to upgrade.
- Fixed a bug where
onCloseevent was not notified anymore when if error occurred before closing WebSocket.
- Fixed a bug where
onCloseevent 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
onErrorandonCloseevent handlers. - Added
trace_idto error type.
- Added possibility to pass undocumented options.
- Fixed
with_progressaccepting anumberand not aboolean.
- Updated multi contracts example to use the new
accountsparameter. - Updated library to support new version of
get_action_traces(addedaccounts,receiversandaction_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#accounttoGetActionTracesMessageData#accounts. - Renamed
GetActionTracesMessageData#receivertoGetActionTracesMessageData#receivers. - Renamed
GetActionTracesMessageData#action_nametoGetActionTracesMessageData#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
getTransactionLifecyclein the API section.
- Renamed
EoswsClient.getTransactiontoEoswsClient.getTransactionLifecycle. - Renamed
getTransactionMessagetogetTransactionLifecycleMessage. - Renamed
OutboundMessageType.TRANSACTIONtoOutboundMessageType.TRANSACTION_LIFECYCLE.
- Removed all previous code, everything has been replaced by a proper
EoswsClientobject.
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:
getActionTracesMessagegetTableRowsMessagegetTransactionLifecycleMessage
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
EoswsSocketthat automatically re-connects on abnormal closing. - Added a proper
EoswsClientto wrap all operations correctly. - Overhaul of examples and supporting documentation.
- On
get_actions&get_table_deltasonly has two params (data parameters & optional parameters) both as defined as Objects. - On
get_actions,receiveris now optional and defaults to the same value asaccount. - The
get_table_deltasrequest was renamed toget_table_rows.