@litehex/node-vault
Advanced tools
Comparing version 0.1.0-alpha.3 to 0.1.0-alpha.4
@@ -17,4 +17,7 @@ import { RequestInit as RequestInit$1 } from 'undici'; | ||
type ValidatedResponse<T extends RequestSchema> = T['response'] extends z.ZodRecord<any> ? Record<string, unknown> : T['response'] extends z.ZodObject<any> ? z.infer<T['response']> : unknown; | ||
type CommandArgs<Schema extends RequestSchema> = (Schema['searchParams'] extends z.ZodObject<any> ? z.infer<Schema['searchParams']> : {}) & (Schema['body'] extends z.ZodAny ? Record<string, string | number | boolean | null> : Schema['body'] extends z.ZodObject<any> ? z.infer<Schema['body']> : {}) & (Schema['path'] extends z.ZodObject<any> ? z.infer<Schema['path']> : {}); | ||
type CommandArgs<Schema extends RequestSchema> = (Schema['searchParams'] extends z.ZodObject<any> ? z.infer<Schema['searchParams']> : {}) & (Schema['body'] extends z.ZodAny ? Record<string, Serializable> : Schema['body'] extends z.ZodObject<any> ? z.infer<Schema['body']> : {}) & (Schema['path'] extends z.ZodObject<any> ? z.infer<Schema['path']> : {}); | ||
type CommandFn<Schema extends RequestSchema> = (args?: CommandArgs<Schema>, options?: Omit<RequestInit, 'url'>) => Promise<ValidatedResponse<Schema>>; | ||
type Serializable = string | number | boolean | null | Serializable[] | { | ||
[key: string]: Serializable; | ||
}; | ||
@@ -137,2 +140,2 @@ type CommandInit<Schema extends RequestSchema> = { | ||
export { Client, type ClientOptions, type CommandArgs, type CommandFn, type RequestInit, type RequestSchema, type ValidatedResponse, generateCommand }; | ||
export { Client, type ClientOptions, type CommandArgs, type CommandFn, type RequestInit, type RequestSchema, type Serializable, type ValidatedResponse, generateCommand }; |
{ | ||
"name": "@litehex/node-vault", | ||
"version": "0.1.0-alpha.3", | ||
"version": "0.1.0-alpha.4", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "Node.js client for the HashiCorp's Vault API", |
@@ -13,3 +13,3 @@ # node-vault | ||
```js | ||
```ts | ||
import { Client } from '@litehex/node-vault'; | ||
@@ -35,6 +35,6 @@ | ||
```js | ||
```ts | ||
vc.write({ path: 'secret/hello', data: { foo: 'bar' } }).then(() => { | ||
vc.read({ path: 'secret/hello' }).then(({ data }) => { | ||
console.log(data); // { value: 'world' } | ||
console.log(data); // { foo: 'bar' } | ||
}); | ||
@@ -54,3 +54,3 @@ }); | ||
```js | ||
```ts | ||
import { Client } from '@litehex/node-vault'; | ||
@@ -64,3 +64,3 @@ import { ProxyAgent } from 'undici'; | ||
request: { | ||
agent: agent, | ||
dispatcher: agent, | ||
headers: { | ||
@@ -73,4 +73,8 @@ 'X-Custom-Header': 'value' | ||
### Credits | ||
This project is inspired by [kr1sp1n/node-vault](https://github.com/kr1sp1n/node-vault), and thanks to the contributors for their efforts. | ||
### License | ||
This project is licensed under the GPLv3 License - see the [LICENSE](LICENSE) file for details |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
61525
593
76