Skip to content

Commit

Permalink
inhouse ajv definition (#103)
Browse files Browse the repository at this point in the history
Co-authored-by: Lars-Erik Roald <[email protected]>
  • Loading branch information
lroal and lroal authored Jun 3, 2024
1 parent f45c2b6 commit d82b90e
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
"pg-query-stream": "^3.3.2",
"rollup": "^2.52.7",
"sqlite3": "^5.0.2",
"tedious": "^18.1.0",
"tedious": "^18.2.0",
"typescript": "^5.4.5",
"vitest": "^0.34.1"
},
Expand Down
47 changes: 47 additions & 0 deletions src/ajv.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
export interface Options {
$data?: boolean;
allErrors?: boolean;
verbose?: boolean;
jsonPointers?: boolean;
uniqueItems?: boolean;
unicode?: boolean;
format?: false | string;
formats?: object;
keywords?: object;
unknownFormats?: true | string[] | 'ignore';
schemas?: Array<object> | object;
schemaId?: '$id' | 'id' | 'auto';
missingRefs?: true | 'ignore' | 'fail';
extendRefs?: true | 'ignore' | 'fail';
loadSchema?: (uri: string, cb?: (err: Error, schema: object) => void) => PromiseLike<object | boolean>;
removeAdditional?: boolean | 'all' | 'failing';
useDefaults?: boolean | 'empty' | 'shared';
coerceTypes?: boolean | 'array';
strictDefaults?: boolean | 'log';
strictKeywords?: boolean | 'log';
strictNumbers?: boolean;
async?: boolean | string;
transpile?: string | ((code: string) => string);
meta?: boolean | object;
validateSchema?: boolean | 'log';
addUsedSchema?: boolean;
inlineRefs?: boolean | number;
passContext?: boolean;
loopRequired?: number;
ownProperties?: boolean;
multipleOfPrecision?: boolean | number;
errorDataPath?: string,
messages?: boolean;
sourceCode?: boolean;
processCode?: (code: string, schema: object) => string;
cache?: object;
logger?: CustomLogger | false;
nullable?: boolean;
serialize?: ((schema: object | boolean) => any) | false;
}

export interface CustomLogger {
log(...args: any[]): any;
warn(...args: any[]): any;
error(...args: any[]): any;
}
10 changes: 5 additions & 5 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Options } from 'ajv';
import { RequestHandler } from 'express';
import { ConnectionConfiguration } from 'tedious';
import { PoolAttributes } from 'oracledb';
import { AllowedDbMap, DbMapper, MappedDbDef } from './map';
import type { Options } from './ajv';
import type { RequestHandler } from 'express';
import type { ConnectionConfiguration } from 'tedious';
import type { PoolAttributes } from 'oracledb';
import type { AllowedDbMap, DbMapper, MappedDbDef } from './map';

declare function r(config: r.Config): unknown;

Expand Down
5 changes: 3 additions & 2 deletions src/map.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Options } from 'ajv';
import type { Options } from './ajv';
import type { ConnectionConfiguration } from 'tedious';
import type { PoolAttributes } from 'oracledb';
import type { AxiosInterceptorManager, InternalAxiosRequestConfig, AxiosResponse } from 'axios';
Expand Down Expand Up @@ -1774,4 +1774,5 @@ type Increment<C extends number> = C extends 0
? 4
: C extends 4
? 5
: 0;
: 0;

0 comments on commit d82b90e

Please sign in to comment.