# @asutov/nagan-types

> Nagan document types

Latest version **1.0.31** (published 2019-07-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install @asutov/nagan-types
pnpm add @asutov/nagan-types
yarn add @asutov/nagan-types
bun add @asutov/nagan-types
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.31 |
| Published | 2019-07-10 |
| First published | 2019-05-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 45.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Aleksey Sutov |
| Maintainers | asutov |

## Links

- npm: https://www.npmjs.com/package/@asutov/nagan-types
- Repository: https://github.com/flamenkito/nagan-types
- Homepage: https://github.com/flamenkito/nagan-types#readme
- Issues: https://github.com/flamenkito/nagan-types/issues
- npm.io page: https://npm.io/package/@asutov/nagan-types

## Dependencies (3)

- [serializr](https://npm.io/package/serializr.md) ^1.5.1
- [typescript](https://npm.io/package/typescript.md) ^3.4.5
- [@types/leaflet](https://npm.io/package/@types/leaflet.md) ^1.4.4

## Recent versions

- 1.0.31 (latest) — 2019-07-10
- 1.0.30 — 2019-07-08
- 1.0.29 — 2019-07-02
- 1.0.28 — 2019-06-27
- 1.0.27 — 2019-06-11
- 1.0.26 — 2019-06-11
- 1.0.25 — 2019-06-11
- 1.0.24 — 2019-06-11
- 1.0.23 — 2019-06-07
- 1.0.22 — 2019-06-07
- 1.0.21 — 2019-06-05
- 1.0.20 — 2019-06-03
- 1.0.19 — 2019-06-01
- 1.0.18 — 2019-05-29
- 1.0.17 — 2019-05-22
- … 16 more at https://npm.io/package/@asutov/nagan-types/versions

## README

### Type Document

```ts
interface TypeDocument {
  _id: string;
  _rev: string;
  type: string;
}
```

## Services Collection

{{couchdb}}/services

### Service document

```ts
interface Last {
  timestamp: number;
  state: string;
}

interface Center {
  lat: number;
  lng: number;
}

interface ServiceDocument extends TypeDocument {
  type: 'service';
  center?: Center;
  state: string;
  lasts: Last[];
}
```

## Access Collection

{{couchdb}}/Access

### Elements Document

```ts
interface Element {
  selector: string;
  script: string;
  icon: string;
  name: string;
  description: string;
}
```

```ts
interface ElementsDocument extends TypeDocument {
  type: 'elements';
  elements: Element[];
}
```

### Layer Document

```ts
interface LayerDocument extends TypeDocument {
  type: 'layer';
  enabled: boolean;
  name: string;
  description: string;
  icon: string;
}
```

### Map Document

```ts
interface MapDocument extends TypeDocument {
  type: 'map';
  mapType: 'leaflet' | 'image';
  enabled: boolean;
  name: string;
  description: string;
  icon: string;
  availableLayerIds: string[];
  widgets: Widget[];
}
```

```ts
interface LeafletMapDocument extends MapDocument {
  mapType: 'leaflet';
  options: {
    center: Center;
    zoom: number;
  };
}
```

```ts
interface ImageMapDocument extends MapDocument {
  mapType: 'image';
  options: {
    image: string;
  };
}
```

```ts
interface Widget {
  id: string;
  layerId: string;
  locked: boolean;
  selector: string;
  style: Object;
  options: Object;
  center?: Center | (subs: ServiceDocument[]) => Center,
  mapper?: (subs: ServiceDocument[]) => any,
  subscriptions: string[]
}
```

## Users

{{couchdb}}/\_users

### User Document

```ts
interface UserDocument extends TypeDocument {
  type: 'user';
  name: string;
  roles: string[];
  allowedInstances: number;
  description: string;
  avatar: string;
  access: Access;
}
```

```ts
interface Access {
  state: string;
  defaultMap: string;
  maps: string[];
  layers: string[];
  services: string[];
}
```

---
_Source: https://npm.io/package/@asutov/nagan-types · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
