# @turnkeyid/configurator-sdk

> Ready to use vault config loader with session

Latest version **1.0.5** (published 2022-04-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @turnkeyid/configurator-sdk
pnpm add @turnkeyid/configurator-sdk
yarn add @turnkeyid/configurator-sdk
bun add @turnkeyid/configurator-sdk
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2022-04-20 |
| First published | 2022-01-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=14.17.6 |
| Dependencies | 8 |
| Unpacked size | 104.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | TurnkeyID Developers |
| Maintainers | fatihaziz, gigihiski |
| Keywords | turnkeyid, configurator, vault, config, session |

## Links

- npm: https://www.npmjs.com/package/@turnkeyid/configurator-sdk
- Repository: https://github.com/turnkey-devs/configurator-sdk
- Homepage: https://github.com/turnkey-devs
- Issues: https://github.com/turnkey-devs
- npm.io page: https://npm.io/package/@turnkeyid/configurator-sdk

## Dependencies (8)

- [nanoid](https://npm.io/package/nanoid.md) ^3.2.0
- [consola](https://npm.io/package/consola.md) ^2.15.3
- [shelljs](https://npm.io/package/shelljs.md) ^0.8.5
- [node-vault](https://npm.io/package/node-vault.md) ^0.9.21
- [moment-mini](https://npm.io/package/moment-mini.md) ^2.24.0
- [deepmerge-ts](https://npm.io/package/deepmerge-ts.md) ^4.0.3
- [serialize-error](https://npm.io/package/serialize-error.md) ^8.1.0
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.1.13

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2022-04-20
- 1.0.3 — 2022-02-13
- 1.0.2 — 2022-02-09
- 1.0.1 — 2022-01-24

## README

# Welcome to TurnkeyID Configurator SDK! 💌 👋

[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](#)
[![Author: @fatihaziz](https://img.shields.io/badge/Author-@fatihaziz-blue.svg)](#)
[![Community: TurnkeyID Devs](https://img.shields.io/badge/Community-TurnkeyID_Devs-orange.svg)](#)

> _Ready to use vault config loader with session_


### Goal
- Services can have centralized config, but local config still has control over
- Ability to fail-over and prioritize sources : *(SESSION(Non-Expired) -> VAULT -> LOCAL -> SESSION)*

### How to use
1. Install this package
   ```sh
   npm install --save @turnkeyid/configurator-sdk
   # or
   yarn add @turnkeyid/configurator-sdk
   ```
2. Create your own logger function:
   ```typescript
      // ./configs/my_service_config.ts
      export const MyServiceConfigurator = ConfiguratorSDK.create<MyServiceConfig>({
         configuratorAppRootDir: process.cwd(),  // *required, where root dir of the program lies
         configMapper: config => config,
         configName: 'MY_SERVICE_CONFIGURATOR',
         configPath: 'my_service_config',
         configuratorSettingOverride: {
            sessionStorageDir: "sessions", // path / dir relative to configuratorAppRootDir!
            localRootDir: "local_configs", // path / dir relative to configuratorAppRootDir!
         },
       })
   ```
3. Import it anywhere:
   ```typescript

      // ./index.ts
      import { MyServiceConfigurator } from './configs/my_service_config.ts'

      // remember you need to wrap await with async function
      // get all configs
      const configs = await MyServiceConfigurator.get()
      // result : MyServiceConfig[]

      // get by config id
      const configId1 = await MyServiceConfigurator.getByID(1) 
      // result : MyServiceConfig | undefined
   ```

### Change Logs
- v1.0.3:
  - Fixes:
    - Fix `sessionHistory` setting don't work
    - Fix history files pilled up uncontrollable.
- v1.0.2: 
  - Introduce README
  - **BREAKING change**, `ConfiguratorSettingsType -> ConfiguratorSetting`
  - **BREAKING change**, `configuratorAppRootDir` is required on create configurator!
  - Ability to save session version history, sessionHistory (default: true)
  - Ability to set priority config source VAULT or LOCAL (default: VAULT)
  - Performance improvement
- v1.0.1: 
  - Project initialized

### Author
👷‍♀️ **TurnkeyID Developers - Fatihaziz**
* Website: turnkey.id
* Github: [@turnkey-devs](https://github.com/turnkey-devs)
* Fatih's Github: [@fatihaziz](https://github.com/fatihaziz)

### Question
<p>
if you have any question, please contact here:
<ul>
   <li>

  [developer@turnkey.id](mailto:developer@turnkey.id)
   </li>
   <li>

  [fatih@turnkey.id](mailto:fatih@turnkey.id)
   </li>
</ul>
</p>

### Show your support

Give a ⭐️ if this project helped you!

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