- Fix
onRequestStart
andonRequestEnd
were not being triggered when request used default middleware
- Add
onRequestStart
andonRequestEnd
events to help with certain logging scenarios. - Add
getActiveSessionCount
andgetMaxSessionCount
methods to allow inspecting how full the session store is.
- BREAKING CHANGE: makes use of the new
unknown
type in TypeScript. If you're using TypeScript, you must be on at least version 3 to use this version of Bicycle.
- Add
server.getNetworkLayer
API that allows you to get a network layer that can be passed directly to the client, for use when the client and server are actually both running in the same node.js process.
- Support configuring memory cache size via
sessionStoreSize
or setting theBICYCLE_SESSION_STORE_SIZE
environment variable. It still defaults to 100.
- Use new opaque types module and fix handling of opaque types on latest version of typescipt
- Breaking Change: You now have to explicitly use
unsafeCast
andextract
methods to cast too and from opaque types if you use them within your application.
- Fix bug that prevented a session being restored
- Improve error message for
set
mutations using un-typed schemas
- BREAKING: Change the protocol used on the wire
- BREAKING: Change the store API
- Fix issue where a failed network response could lead to clients getting out of sync.
- BREAKING: Take all client options as part of the object
- Automatically detect
BICYCLE_SERVER_PREPARATION
as a global variable if set.
- Pass the
res
as the second argument togetContext
functions. This makes it simpler to handle session state (login, logout etc.) as part of a bicycle request. - Remove the
dispose
method from context objects. - Add a new "function" approach for transactions in sessions. To use:
function getContext(req, res) {
return async fn => {
const ctx = new Context();
try {
return await fn();
} finally {
ctx.dispose();
}
};
}
- Only show timing to the nearest millisecond, but still use nanoseconds in the background
- Add an optimisation that helps avoid querying the same data twice
- Time to the nanosecond when
--monitor-bicycle-performance
is passed
- Pass
fieldName
as part of query context forresolve
field methods.
- Fix
isCached
which sometimes incorrectly reported values as being cached, leading to them never loading.
- Cast
undefined
fields tonull
. We useundefined
to represent "not yet loaded".
- Expose
QueryCacheResult
interface onclient
module
- Inspect queries when an invalid query happens in merge in development.
- Fix broken publish
- Optimistic values are now strings. They still get replaced once the true values are discovered.
- Optimistic handlers are now given a mutable Cache Object. This means they always have the same API wheather they are typed (using ts-bicycle) or not.
- Fix broken queries (I forgot to run the tests)
- Fix server side rendering with typescript
- Fix one broken overload of server renderer
- All server methods can have getContext return a Promise for context, as well as returning the context directly. This lets you setup database connections asynchronously, before returning a context.
- Moved some of the typed helpers and added some new ones
- Pass context to ID getter
- Add helpers for typed code
- Preserve const enums for non typescript consumers
Convert to typescript
- Scalars
validate
method now has to return a boolean indicating whether the value is valid, and requires a "baseType". - Scalars can no longer have
parse
andvalidate
. - The cache format, used by optimistic updaters, is now
{[typeName: string]: {[id: string]: Node}}
where it used to be{[typeName + ':' + id]: Node}
. This is to allow for strongly typed bicycle caches. - Void and Null are now treated as different, distinct values.
- The empty object is no longer cast to undefined for mutation arguments
createServerRenderer
now expects agetContext
argument and then takesRequest
instead ofContext
- You can optionally add an
auth
property to each mutation/field. It is called with the same arguments asresolve
and returnstrue
,false
(or a Promise fortrue
orfalse
) to idicate whether the current context is authorized to perform that action. - Args do not have to be objects, you an direclty use e.g.
number
now.
- Replace server side API with something a bit more Object Orientated. You now
construct a
BicycleServer
api. There is no longer a separateloadSchema
function. This saves repeatedly needing to passschem
to everything. - Add the ability to log at the beginning and end of queries and mutations. It will also pause to wait for any promises returned by the logging functions, which allows you to use them for cache invalidation.