https://github.com/taskworld/ghkv
A key-value store for your CI/CD workflows, backed by GitHub API.
https://github.com/taskworld/ghkv
Last synced: 3 months ago
JSON representation
A key-value store for your CI/CD workflows, backed by GitHub API.
- Host: GitHub
- URL: https://github.com/taskworld/ghkv
- Owner: taskworld
- Created: 2020-05-26T04:58:40.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-01-22T12:19:11.000Z (about 4 years ago)
- Last Synced: 2025-01-09T23:53:32.984Z (about 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 155 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ghkv
A key-value store for your CI/CD workflows. Backed by GitHub API.
## API
```js
const { GhkvDataStore } = require('ghkv')
```
### `const store = new GhkvDataStore(options)`
- `options.accessToken` An access token used to access the GitHub API
- `options.owner` Owner of the repository
- `options.repo` Repository name
- `options.branch` Branch used to store data, defaults to the default branch
### `const doc = store.doc(key)`
Retrieves a reference to the document by key.
### `doc.get(): Promise`
Retrieves the current document data.
### `doc.update(updater, options)`
Updates the document.
- `updater: (data: T | undefined) => T`
This function should return an updated document, given the original document.
Note that it may be called more than once in case of a conflict due to concurrent updates.
- `options.message` (Optional) The commit message.
### `doc.set(data, options)`
Updates the document.
- `data` Data to set. In case of concurrent updates, last write wins.
- `options.message` (Optional) The commit message.