@kaapi/validator-valibot 0.0.17 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ReqRefDefaults, ReqRef, KaapiServerRoute, HandlerDecorations, Lifecycle, Server } from '@kaapi/kaapi';
1
+ import type { ReqRefDefaults, ReqRef, KaapiServerRoute, HandlerDecorations, Lifecycle, Server, MergeRefs } from '@kaapi/kaapi';
2
2
  import type { Config, InferIssue, InferOutput, ObjectEntriesAsync } from 'valibot';
3
3
  export type NonEmptyValibotSchema = ObjectEntriesAsync[string];
4
4
  export type ValibotSchema = NonEmptyValibotSchema | undefined | null;
@@ -14,12 +14,12 @@ export type ValidatorValibotSchema = {
14
14
  };
15
15
  export type ValibotlessReqRefDefaults = Omit<ReqRefDefaults, 'Query' | 'Headers' | 'Params' | 'Payload'>;
16
16
  export type ValibotlessReqRef = Omit<ReqRef, 'Query' | 'Headers' | 'Params' | 'Payload'>;
17
- export type output<T> = T extends NonEmptyValibotSchema ? InferOutput<T> : unknown;
17
+ export type output<T, D = unknown> = T extends NonEmptyValibotSchema ? InferOutput<T> : D;
18
18
  export interface ValidatorValibotReqRef<RS extends ValidatorValibotSchema = ValidatorValibotSchema> {
19
- Query: output<RS['query']>;
20
- Headers: output<RS['headers']>;
21
- Params: output<RS['params']>;
22
- Payload: output<RS['payload']>;
19
+ Query: output<RS['query'], MergeRefs<ValibotlessReqRefDefaults>['Query']>;
20
+ Headers: output<RS['headers'], MergeRefs<ValibotlessReqRefDefaults>['Headers']>;
21
+ Params: output<RS['params'], MergeRefs<ValibotlessReqRefDefaults>['Params']>;
22
+ Payload: output<RS['payload'], MergeRefs<ValibotlessReqRefDefaults>['Payload']>;
23
23
  }
24
24
  export type ValidatorValibot = <V extends ValidatorValibotSchema>(schema: V) => {
25
25
  route<R extends ValibotlessReqRef = ValibotlessReqRefDefaults>(serverRoute: KaapiServerRoute<ValidatorValibotReqRef<V> & R>, handler?: HandlerDecorations | Lifecycle.Method<ValidatorValibotReqRef<V> & R, Lifecycle.ReturnValue<ValidatorValibotReqRef<V> & R>>): Server;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaapi/validator-valibot",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
4
4
  "private": false,
5
5
  "description": "Valibot-powered request validation and documentation plugin for Kaapi.",
6
6
  "main": "lib/index.js",
@@ -10,12 +10,13 @@
10
10
  "default": "./lib/index.js"
11
11
  }
12
12
  },
13
- "scripts": {
14
- "lint": "eslint .",
15
- "build": "tsc && node ./scripts/buildDT.mjs",
16
- "test": "kaukau --require ts-node/register --config kaukau.config.mjs",
17
- "coverage": "c8 npm test"
18
- },
13
+ "keywords": [
14
+ "kaapi",
15
+ "hapi",
16
+ "valibot",
17
+ "typescript",
18
+ "validation"
19
+ ],
19
20
  "author": "demingongo",
20
21
  "repository": {
21
22
  "type": "git",
@@ -25,15 +26,21 @@
25
26
  "license": "MIT",
26
27
  "dependencies": {
27
28
  "@hapi/boom": "^10.0.1",
28
- "@kaapi/kaapi": "workspace:^",
29
29
  "@novice1/api-doc-generator": "^1.0.2",
30
30
  "@valibot/to-json-schema": "^1.3.0",
31
- "tslib": "^2.8.1"
31
+ "tslib": "^2.8.1",
32
+ "@kaapi/kaapi": "^0.0.18"
32
33
  },
33
34
  "peerDependencies": {
34
35
  "valibot": "^1.1.0"
35
36
  },
36
37
  "devDependencies": {
37
38
  "@types/mocha": "^10.0.10"
39
+ },
40
+ "scripts": {
41
+ "lint": "eslint .",
42
+ "build": "tsc && node ./scripts/buildDT.mjs",
43
+ "test": "kaukau --require ts-node/register --config kaukau.config.mjs",
44
+ "coverage": "c8 npm test"
38
45
  }
39
- }
46
+ }