0.0.10 • Published 6 months ago

@dozerjs/dozer v0.0.10

Weekly downloads
-
License
-
Repository
github
Last release
6 months ago

Overview

This repository is a typescript wrapper over gRPC APIs that are automatically generated when you run Dozer.

Installation

yarn add @dozerjs/dozer

Instance

  const client = new DozerClient();
  const endpoint = client.getEndpoint('flights');

Methods

Count()

Count query returns number of records in particular source.

  const count = await endpoint.count();

Query(query = string | null)

Query method is used to fetch records from cache. Reference to gRPC method is here

  const [fields, records] = await endpoint.query();

Also, client supports query parameter, which allows to filter, sort and paginate. More about you can find here

import { Order } from "@dozerjs/dozer";

const query = {
    orderBy: {
        start: Order.ASC
    }
}

const [fields, records] = await endpoint.query(query);

OnEvent(eventType: EventType = EventType.ALL)

Other available option is to use events streams method onEvent. It connects to the gRPC stream and sends changes to the client. This method has eventType parameter, which is used to determine what type of changes will be streamed. Available options are ALL, INSERT_ONLY, UPDATE_ONLY, DELETE_ONLY.

import { EventType, DozerEndpointEvent, DozerFilter } from "@dozerjs/dozer";

const filter: DozerFilter | null = null;

endpoints.onEvent((evt: DozerEndpointEvent) => {
  console.log(evt.data);
  console.log(evt.fields);
  console.log(evt.primaryIndexKeys);
  console.log(evt.operation);
  console.log(evt.mapper);
}, EventType.INSERT_ONLY, filter);
0.0.10

6 months ago

0.0.8-beta.6

8 months ago

0.0.7-beta.6

8 months ago

0.0.8-beta.5

8 months ago

0.0.7-beta.4

9 months ago

0.0.8-beta.7

8 months ago

0.0.7-beta.5

8 months ago

0.0.8-beta.2

8 months ago

0.0.7-beta.2

9 months ago

0.0.8-beta.1

8 months ago

0.0.7-beta.3

9 months ago

0.0.8-beta.4

8 months ago

0.0.7-beta.0

9 months ago

0.0.8-beta.3

8 months ago

0.0.7-beta.1

9 months ago

0.0.9

7 months ago

0.0.8

8 months ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago