0.3.1 • Published 1 year ago

@metrichor/epi2me-client-node v0.3.1

Weekly downloads
-
License
MPL-2.0
Repository
-
Last release
1 year ago

EPI2ME Client

This library is for performing authenticated operations with the EPI2ME GraphQL API. It is published in 2 flavours: node and web. They each provide specific networking and crypto implementations for their platforms, to better meet your requirements.

Installation

npm i @metrichor/epi2me-client-web
# OR
npm i @metrichor/epi2me-client-node

Usage

Both flavours support authentication via key/secret or JWTs. Exposed via separate client factories.

  import { create_epi2me_client } from '@metrichor/epi2me-client-node';

  const graphql = create_epi2me_client({
    client: { name: 'my platform', version: '1.0.0' },
    credentials: { key: 'my api key', secret: 'my api secret' },
  });

  async function main () {
    const { data } = await graphql.query({
      query: gql`query MyQuery {
        allWorkflowInstances {
          results {
            idWorkflowInstance
          }
        } 
      }`
    });
    console.log(data.allWorkflowInstances.results);
  }

  void main();

Client constructors return instances of ApolloClient, with their caches pre-configured. It's often easier to use the clients by wrapping them with helper functions. But this is left as an exercise for the user, to maximise compatibility with existing code.

Mock Client

In addition to the 2 authenticated clients we also provide a simple mock client for writing tests.

const client = create_mock_client(
  { name: 'example client', version: '1.0.0' },
  (op) => ({ data: { id: 42} }) // request handler
);

expect(
  await client.query({ query: gql`query CustomQuery { id }` })
).toStrictEqual(
  expect.objectContaining({ data: { id: 42 } })
);
0.2.10615829

1 year ago

0.1.10211367

1 year ago

0.2.10211410

1 year ago

0.2.10451934

1 year ago

0.1.10205514

1 year ago

0.1.10205535

1 year ago

0.3.0-10728145

1 year ago

0.3.0-10728069

1 year ago

0.2.10629429

1 year ago

0.1.10209158

1 year ago

0.2.10360724

1 year ago

0.3.1-10728753

1 year ago

0.2.10361372

1 year ago

0.2.10727548

1 year ago

0.2.10447595

1 year ago

0.2.10458868

1 year ago

0.2.10451948

1 year ago

0.2.10639339

1 year ago

0.2.10605124

1 year ago

0.3.1

1 year ago

0.2.10575529

1 year ago

0.2.10654478

1 year ago

0.1.10010284

1 year ago

0.1.10009941

1 year ago

0.1.10002387

1 year ago

0.1.10002293

1 year ago

0.1.10001360

1 year ago

0.1.10001234

1 year ago