# record-pack

> Record-pack ================

Latest version **0.1.0** (published 2017-08-20) · Apache 2.0 license · 0 weekly downloads

## Install

```sh
npm install record-pack
pnpm add record-pack
yarn add record-pack
bun add record-pack
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2017-08-20 |
| First published | 2016-03-25 |
| Weekly downloads | 0 |
| License | Apache 2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+11 in 1 direct dependencies) |
| Install scripts | no |
| Author | Will O'Brien |
| Maintainers | will-ob |

## Links

- npm: https://www.npmjs.com/package/record-pack
- npm.io page: https://npm.io/package/record-pack

## Dependencies (4)

- [lodash](https://npm.io/package/lodash.md) ^4.17.4
- [node-uuid](https://npm.io/package/node-uuid.md) ^1.4.7
- [protobufjs](https://npm.io/package/protobufjs.md) ^5.0.1
- [swarm-stamp](https://npm.io/package/swarm-stamp.md) ^1.0.14

## Recent versions

- 0.1.0 (latest) — 2017-08-20
- 0.0.5 — 2016-04-02
- 0.0.4 — 2016-03-26
- 0.0.3 — 2016-03-25
- 0.0.2 — 2016-03-25
- 0.0.1 — 2016-03-25

## README

Record-pack
================

Primitives for [record-set](https://github.com/f7ops/record-set). Transactions for conflict-free set operations.

```
var RecordPack = require('record-pack'),
    builder = new RecordPack.Builder(),
    encode = RecordPack.toString,
    decode = RecordPack.fromString;

c1 = builder.create();
  => {
       timestamp: "4BThp+a4c7dee",
       entity_id: "cf42f0ea-f026-11e5-bd3a-6c3be57bb446"
       type: 'create'
     }


u1 = builder.update(id, "a", 1)
  => {
       timestamp: '4BTsC+a4c7dee',
       entity_id: 'cf42f0ea-f026-11e5-bd3a-6c3be57bb446',
       type: 'update',
       key: 'a',
       value: 1
     }

d1 = builder.destroy(id);
  => {
       timestamp: '4BTtb+a4c7dee'
       entity_id: 'cf42f0ea-f026-11e5-bd3a-6c3be57bb446',
       type: 'destroy'
     }

encode(c1)
  => a674376cd7[...]5fd=

encode([u1, u2])
  => "a4c6754bfc736==\n4765cfffe74d836=="

encode(d1)
  => "4765cfffe74d836=="

```

Notes:

  - `timestamp` is of the lamport variety. This particular strain (from [swarm.js](http://swarmjs.github.io/articles/lamport/)) is alphanumerically sortable. No decoding of timestamp strings is required to find the total order.
  - Entity id is a randomly choosen uuid
  - Value is the lowest common denominator of all data types, a byte array. Higher-level libraries are responsible for enforcing more specific datatypes


License
-------

Copyright 2016 Will O'Brien

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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