lucid-ts-sdk
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -0,1 +1,2 @@ | ||
import 'isomorphic-fetch'; | ||
/** Lucid API wrapper */ | ||
@@ -32,7 +33,9 @@ export declare class LucidAPI { | ||
* Initialize the Lucid API wrapper instance. | ||
* | ||
* Checks the Lucid API endpoint is valid and get its version. | ||
* | ||
* Checks the Lucid API endpoint authentification JSON Web Token if it was provided. | ||
* | ||
* @returns Lucid API endpoint version | ||
* @throws {Error} Instance already initialized - Invalid endpoint | ||
* @throws {Error} Instance already initialized - Invalid endpoint - Invalid JWT | ||
*/ | ||
@@ -39,0 +42,0 @@ init(): Promise<string>; |
"use strict"; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// Make fetch work with node and browser | ||
const e6p = __importStar(require("es6-promise")); | ||
e6p.polyfill(); | ||
require("isomorphic-fetch"); | ||
/** Lucid API wrapper */ | ||
@@ -31,7 +42,9 @@ class LucidAPI { | ||
* Initialize the Lucid API wrapper instance. | ||
* | ||
* Checks the Lucid API endpoint is valid and get its version. | ||
* | ||
* Checks the Lucid API endpoint authentification JSON Web Token if it was provided. | ||
* | ||
* @returns Lucid API endpoint version | ||
* @throws {Error} Instance already initialized - Invalid endpoint | ||
* @throws {Error} Instance already initialized - Invalid endpoint - Invalid JWT | ||
*/ | ||
@@ -38,0 +51,0 @@ async init() { |
{ | ||
"name": "lucid-ts-sdk", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Lucid KV TypeScript wrapper 🍬 High performance and distributed KV store accessible through an HTTP API.", | ||
@@ -25,4 +25,6 @@ "main": "lib/index.js", | ||
"build": "tsc", | ||
"docs": "rm -rf docs && typedoc --out docs src && touch docs/.nojekyll", | ||
"docs-publish": "yarn docs && gh-pages -d docs -t && rm -rf docs", | ||
"test": "echo No tests available yet", | ||
"prepare": "yarn test && yarn build" | ||
"prepublishOnly": "yarn test && yarn build" | ||
}, | ||
@@ -37,7 +39,14 @@ "homepage": "https://github.com/lucid-kv/ts-sdk#readme", | ||
}, | ||
"author": "rigwild <contact@asauvage.fr>", | ||
"author": "rigwild <me@rigwild.dev> (https://rigwild.dev/)", | ||
"license": "MIT", | ||
"dependencies": { | ||
"es6-promise": "^4.2.8", | ||
"isomorphic-fetch": "^2.2.1" | ||
}, | ||
"devDependencies": { | ||
"@types/isomorphic-fetch": "^0.0.35", | ||
"gh-pages": "^2.1.1", | ||
"typedoc": "^0.15.0", | ||
"typescript": "^3.6.4" | ||
} | ||
} |
# Lucid TypeScript SDK | ||
[![npm](https://img.shields.io/npm/v/lucid-ts-sdk?label=npm)](https://www.npmjs.com/package/lucid-ts-sdk) | ||
[![License](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://github.com/lucid-kv/ts-sdk/blob/master/LICENSE) | ||
Lucid KV TypeScript wrapper 🍬 High performance and distributed KV store accessible through an HTTP API. | ||
This packages uses [isomorphic-fetch](https://github.com/matthew-andrews/isomorphic-fetch) to make sure it works on both the browser and Node.js. | ||
## Install | ||
```sh | ||
yarn add lucid-ts-sdk | ||
``` | ||
## Usage | ||
```ts | ||
import { LucidAPI } from 'lucid-ts-sdk' | ||
const setup = async () => { | ||
// Create a Lucid API wrapper instance | ||
const Lucid = new LucidAPI('http://127.0.0.1:7020', 'your-Lucid-authentication-JSON-Web-Token') | ||
// Initialize the wrapper instance (validate endpoint and JWT) | ||
const version = await Lucid.init() | ||
console.log(version) // 0.1.2 | ||
const content = await Lucid.getKey('check-token').then(res => res.json()) | ||
console.log(content) // { code: 0, message: 'Lucid Version 0.1.2', details: null } | ||
} | ||
setup() | ||
``` | ||
## SDK API documentation | ||
https://lucid-kv.github.io/ts-sdk/ | ||
## License | ||
[The MIT License](./LICENSE) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
18914
262
38
2
4
+ Addedes6-promise@^4.2.8
+ Addedisomorphic-fetch@^2.2.1
+ Addedencoding@0.1.13(transitive)
+ Addedes6-promise@4.2.8(transitive)
+ Addediconv-lite@0.6.3(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedisomorphic-fetch@2.2.1(transitive)
+ Addednode-fetch@1.7.3(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedwhatwg-fetch@3.6.20(transitive)