@smartlyio/oats-runtime 7.6.1 → 7.6.2-alpha.19

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/dist/client.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import * as server from './server';
2
3
  type HasOnlyOptionalTypes<O> = Partial<O> extends O ? true : O extends void ? true : false;
3
4
  type MakeOptional<O, K extends string> = true extends HasOnlyOptionalTypes<O> ? {
package/dist/server.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import { MakeOptions, Maker, ValidationError } from './make';
2
3
  export type { RedirectStatus } from './redirect';
3
4
  export interface Response<Status extends number, ContentType, Value, Headers extends Record<string, any>> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartlyio/oats-runtime",
3
- "version": "7.6.1",
3
+ "version": "7.6.2-alpha.19+b86bab3",
4
4
  "license": "MIT",
5
5
  "description": "Runtime for Oats a Openapi3 based generator for typescript aware servers and clients",
6
6
  "private": false,
@@ -53,7 +53,7 @@
53
53
  "ts-jest": "29.1.0",
54
54
  "ts-node": "10.9.1",
55
55
  "tsconfig-paths": "4.2.0",
56
- "typescript": "4.9.5"
56
+ "typescript": "5.9.2"
57
57
  },
58
- "gitHead": "0d4af6cfd727f4079034159a083897bca2f3458b"
58
+ "gitHead": "b86bab35d9663a0a9dd12d95fdedf551c0202d96"
59
59
  }
package/k DELETED
@@ -1,132 +0,0 @@
1
-
2
- import { Buffer } from 'buffer';
3
- import { NamedTypeDefinition, ObjectType, Type } from './reflection-type';
4
- export declare class MakeError extends Error {
5
- readonly errors: ValidationError[];
6
- readonly name = "MakeError";
7
- constructor(errors: ValidationError[]);
8
- }
9
- export interface ErrorGroup {
10
- groupMessage: string;
11
- errors: ValidationError[];
12
- }
13
- export interface ValidationError {
14
- path: Path;
15
- error: string | ErrorGroup;
16
- }
17
- type Path = ReadonlyArray<string>;
18
- export declare function validationErrorPrinter(error: ValidationError, indentation?: number): string;
19
- export declare class Make<V> {
20
- static ok<V>(value: V): Make<V>;
21
- static error<V>(errors: ValidationError[]): Make<V>;
22
- readonly errors: ValidationError[];
23
- private readonly value;
24
- private constructor();
25
- isError(): boolean;
26
- isSuccess(): boolean;
27
- success(handler?: (e: this) => V): V;
28
- group(groupMessage: string): Make<null>;
29
- errorPath(path: string): Make<null>;
30
- map<R>(fn: (value: V) => R): Make<R>;
31
- }
32
- export interface MakeOptions {
33
- /**
34
- * if 'true' merge types between successive '.make' calls for the object
35
- * RECOMMEND not to set this unless you have thought things through
36
- */
37
- mergeTypes?: boolean;
38
- unknownField?: 'drop' | 'fail';
39
- /**
40
- * If enabled, "number" ans "integer" schemas will accept strings and try to parse them.
41
- */
42
- parseNumericStrings?: boolean;
43
- /**
44
- * If enabled, "boolean" schemas will accept strings and try to parse them.
45
- */
46
- parseBooleanStrings?: boolean;
47
- /**
48
- * If enabled, "array" schema will convert any non-array value to an array with a single element.
49
- * Useful for supporting arrays in query parameters
50
- * (if query parameter is not repeated, it will not be an array on server side).
51
- */
52
- allowConvertForArrayType?: boolean;
53
- /** If true convert property names from network to ts format while parsing objects */
54
- convertFromNetwork?: boolean;
55
- }
56
- export type Maker<Shape, V> = (value: Shape, opts?: MakeOptions) => Make<V>;
57
- export declare function registerFormat(format: string, maker: Maker<any, undefined>): void;
58
- export declare function makeString(format?: string, pattern?: string, minLength?: number, maxLength?: number): Maker<any, string>;
59
- export declare function makeNumber(min?: number, max?: number): Maker<unknown, number>;
60
- export declare function makeInteger(min?: number, max?: number): Maker<unknown, number>;
61
- declare function checkAny(value: any, opts?: MakeOptions): Make<any>;
62
- export declare function makeAny(): typeof checkAny;
63
- declare function checkVoid(value: any): Make<any>;
64
- export declare function makeVoid(): typeof checkVoid;
65
- export declare function makeEnum<T>(...args: T[]): (value: T) => Make<T>;
66
- export declare function makeOptional(maker: any): {
67
- optional: any;
68
- };
69
- export declare function makeBoolean(): Maker<unknown, boolean>;
70
- export declare function makeArray(maker: any, minSize?: number, maxSize?: number): Maker<unknown, unknown[]>;
71
- export declare function makeOneOf(...options: any[]): (value: any, opts?: MakeOptions) => any;
72
- export declare function makeAllOf(...all: Maker<any, any>[]): (value: any, opts?: MakeOptions) => Make<any>;
73
- export declare function makeObject<P extends {
74
- [key: string]: Maker<any, any> | {
75
- optional: Maker<any, any>;
76
- };
77
- }>(props: P, additionalProp?: Maker<any, any> | undefined, comparisorOrder?: string[], type?: ObjectType): (value: any, opts?: MakeOptions) => Make<any>;
78
- export type Binary = File | Buffer | FormBinary;
79
- export declare class FormBinary {
80
- readonly binary: Binary;
81
- readonly options?: string | {
82
- [key: string]: string;
83
- } | undefined;
84
- constructor(binary: Binary, options?: string | {
85
- [key: string]: string;
86
- } | undefined);
87
- }
88
- export declare class File {
89
- readonly path: string;
90
- readonly size: number;
91
- readonly name?: string | undefined;
92
- private brand;
93
- constructor(path: string, size: number, name?: string | undefined);
94
- }
95
- declare function checkBinary(value: any): Make<any>;
96
- export declare function makeBinary(): typeof checkBinary;
97
- export declare function makeNullable(maker: any): (value: any, opts?: MakeOptions) => any;
98
- export declare function fromReflection(type: Type): Maker<any, any>;
99
- export declare function createMaker<Shape, Type>(fun: () => any): (value: Shape, opts?: MakeOptions) => Make<Type>;
100
- export declare function createMakerWith<Shape, Type>(constructor: new (v: Shape, opts?: MakeOptions) => Type): Maker<Shape, Type>;
101
- /**
102
- * Merge multiple mappings into one set of mappings
103
- *
104
- * Throw error if there are duplicate koys
105
- * @deprecated
106
- */
107
- export declare function mergeMappings(...mappings: readonly {
108
- [key: string]: Maker<any, any>;
109
- }[]): {
110
- [key: string]: Maker<any, any>;
111
- };
112
- export declare function extractDiscriminatorKeys(discriminatorField: string, typeObjectRef: Type): string[];
113
- /** @deprecated */
114
- export declare function extractDiscriminatorValueMap(discriminatorField: string, typeObject: NamedTypeDefinition<any>): {
115
- [key: string]: Maker<any, any>;
116
- };
117
- /**
118
- * Make oneOf with the discriminator support
119
- *
120
- * Will use given mapping to find correct maker. If optional importedTypes are provided, will extract
121
- * extra mapping keys from them.
122
- *
123
- * @deprecated
124
- *
125
- * @param discriminatorField Field to use as discriminator
126
- * @param mapping Mappings that we should use to determine target makers
127
- * @param importedTypes Optional types where we should extract enum values for makers
128
- */
129
- export declare function makeOneOfWithDiscriminator(discriminatorField: string, mapping: {
130
- [key: string]: Maker<any, any>;
131
- }, importedTypes?: readonly any[]): (value: any, opts?: MakeOptions) => Make<any>;
132
- export {};
package/kk DELETED
@@ -1,131 +0,0 @@
1
- import { Buffer } from 'buffer';
2
- import { NamedTypeDefinition, ObjectType, Type } from './reflection-type';
3
- export declare class MakeError extends Error {
4
- readonly errors: ValidationError[];
5
- readonly name = "MakeError";
6
- constructor(errors: ValidationError[]);
7
- }
8
- export interface ErrorGroup {
9
- groupMessage: string;
10
- errors: ValidationError[];
11
- }
12
- export interface ValidationError {
13
- path: Path;
14
- error: string | ErrorGroup;
15
- }
16
- type Path = ReadonlyArray<string>;
17
- export declare function validationErrorPrinter(error: ValidationError, indentation?: number): string;
18
- export declare class Make<V> {
19
- static ok<V>(value: V): Make<V>;
20
- static error<V>(errors: ValidationError[]): Make<V>;
21
- readonly errors: ValidationError[];
22
- private readonly value;
23
- private constructor();
24
- isError(): boolean;
25
- isSuccess(): boolean;
26
- success(handler?: (e: this) => V): V;
27
- group(groupMessage: string): Make<null>;
28
- errorPath(path: string): Make<null>;
29
- map<R>(fn: (value: V) => R): Make<R>;
30
- }
31
- export interface MakeOptions {
32
- /**
33
- * if 'true' merge types between successive '.make' calls for the object
34
- * RECOMMEND not to set this unless you have thought things through
35
- */
36
- mergeTypes?: boolean;
37
- unknownField?: 'drop' | 'fail';
38
- /**
39
- * If enabled, "number" ans "integer" schemas will accept strings and try to parse them.
40
- */
41
- parseNumericStrings?: boolean;
42
- /**
43
- * If enabled, "boolean" schemas will accept strings and try to parse them.
44
- */
45
- parseBooleanStrings?: boolean;
46
- /**
47
- * If enabled, "array" schema will convert any non-array value to an array with a single element.
48
- * Useful for supporting arrays in query parameters
49
- * (if query parameter is not repeated, it will not be an array on server side).
50
- */
51
- allowConvertForArrayType?: boolean;
52
- /** If true convert property names from network to ts format while parsing objects */
53
- convertFromNetwork?: boolean;
54
- }
55
- export type Maker<Shape, V> = (value: Shape, opts?: MakeOptions) => Make<V>;
56
- export declare function registerFormat(format: string, maker: Maker<any, undefined>): void;
57
- export declare function makeString(format?: string, pattern?: string, minLength?: number, maxLength?: number): Maker<any, string>;
58
- export declare function makeNumber(min?: number, max?: number): Maker<unknown, number>;
59
- export declare function makeInteger(min?: number, max?: number): Maker<unknown, number>;
60
- declare function checkAny(value: any, opts?: MakeOptions): Make<any>;
61
- export declare function makeAny(): typeof checkAny;
62
- declare function checkVoid(value: any): Make<any>;
63
- export declare function makeVoid(): typeof checkVoid;
64
- export declare function makeEnum<T>(...args: T[]): (value: T) => Make<T>;
65
- export declare function makeOptional(maker: any): {
66
- optional: any;
67
- };
68
- export declare function makeBoolean(): Maker<unknown, boolean>;
69
- export declare function makeArray(maker: any, minSize?: number, maxSize?: number): Maker<unknown, unknown[]>;
70
- export declare function makeOneOf(...options: any[]): (value: any, opts?: MakeOptions) => any;
71
- export declare function makeAllOf(...all: Maker<any, any>[]): (value: any, opts?: MakeOptions) => Make<any>;
72
- export declare function makeObject<P extends {
73
- [key: string]: Maker<any, any> | {
74
- optional: Maker<any, any>;
75
- };
76
- }>(props: P, additionalProp?: Maker<any, any> | undefined, comparisorOrder?: string[], type?: ObjectType): (value: any, opts?: MakeOptions) => Make<any>;
77
- export type Binary = File | Buffer | FormBinary;
78
- export declare class FormBinary {
79
- readonly binary: Binary;
80
- readonly options?: string | {
81
- [key: string]: string;
82
- } | undefined;
83
- constructor(binary: Binary, options?: string | {
84
- [key: string]: string;
85
- } | undefined);
86
- }
87
- export declare class File {
88
- readonly path: string;
89
- readonly size: number;
90
- readonly name?: string | undefined;
91
- private brand;
92
- constructor(path: string, size: number, name?: string | undefined);
93
- }
94
- declare function checkBinary(value: any): Make<any>;
95
- export declare function makeBinary(): typeof checkBinary;
96
- export declare function makeNullable(maker: any): (value: any, opts?: MakeOptions) => any;
97
- export declare function fromReflection(type: Type): Maker<any, any>;
98
- export declare function createMaker<Shape, Type>(fun: () => any): (value: Shape, opts?: MakeOptions) => Make<Type>;
99
- export declare function createMakerWith<Shape, Type>(constructor: new (v: Shape, opts?: MakeOptions) => Type): Maker<Shape, Type>;
100
- /**
101
- * Merge multiple mappings into one set of mappings
102
- *
103
- * Throw error if there are duplicate koys
104
- * @deprecated
105
- */
106
- export declare function mergeMappings(...mappings: readonly {
107
- [key: string]: Maker<any, any>;
108
- }[]): {
109
- [key: string]: Maker<any, any>;
110
- };
111
- export declare function extractDiscriminatorKeys(discriminatorField: string, typeObjectRef: Type): string[];
112
- /** @deprecated */
113
- export declare function extractDiscriminatorValueMap(discriminatorField: string, typeObject: NamedTypeDefinition<any>): {
114
- [key: string]: Maker<any, any>;
115
- };
116
- /**
117
- * Make oneOf with the discriminator support
118
- *
119
- * Will use given mapping to find correct maker. If optional importedTypes are provided, will extract
120
- * extra mapping keys from them.
121
- *
122
- * @deprecated
123
- *
124
- * @param discriminatorField Field to use as discriminator
125
- * @param mapping Mappings that we should use to determine target makers
126
- * @param importedTypes Optional types where we should extract enum values for makers
127
- */
128
- export declare function makeOneOfWithDiscriminator(discriminatorField: string, mapping: {
129
- [key: string]: Maker<any, any>;
130
- }, importedTypes?: readonly any[]): (value: any, opts?: MakeOptions) => Make<any>;
131
- export {};
package/t DELETED
@@ -1,130 +0,0 @@
1
- import { NamedTypeDefinition, ObjectType, Type } from './reflection-type';
2
- export declare class MakeError extends Error {
3
- readonly errors: ValidationError[];
4
- readonly name = "MakeError";
5
- constructor(errors: ValidationError[]);
6
- }
7
- export interface ErrorGroup {
8
- groupMessage: string;
9
- errors: ValidationError[];
10
- }
11
- export interface ValidationError {
12
- path: Path;
13
- error: string | ErrorGroup;
14
- }
15
- type Path = ReadonlyArray<string>;
16
- export declare function validationErrorPrinter(error: ValidationError, indentation?: number): string;
17
- export declare class Make<V> {
18
- static ok<V>(value: V): Make<V>;
19
- static error<V>(errors: ValidationError[]): Make<V>;
20
- readonly errors: ValidationError[];
21
- private readonly value;
22
- private constructor();
23
- isError(): boolean;
24
- isSuccess(): boolean;
25
- success(handler?: (e: this) => V): V;
26
- group(groupMessage: string): Make<null>;
27
- errorPath(path: string): Make<null>;
28
- map<R>(fn: (value: V) => R): Make<R>;
29
- }
30
- export interface MakeOptions {
31
- /**
32
- * if 'true' merge types between successive '.make' calls for the object
33
- * RECOMMEND not to set this unless you have thought things through
34
- */
35
- mergeTypes?: boolean;
36
- unknownField?: 'drop' | 'fail';
37
- /**
38
- * If enabled, "number" ans "integer" schemas will accept strings and try to parse them.
39
- */
40
- parseNumericStrings?: boolean;
41
- /**
42
- * If enabled, "boolean" schemas will accept strings and try to parse them.
43
- */
44
- parseBooleanStrings?: boolean;
45
- /**
46
- * If enabled, "array" schema will convert any non-array value to an array with a single element.
47
- * Useful for supporting arrays in query parameters
48
- * (if query parameter is not repeated, it will not be an array on server side).
49
- */
50
- allowConvertForArrayType?: boolean;
51
- /** If true convert property names from network to ts format while parsing objects */
52
- convertFromNetwork?: boolean;
53
- }
54
- export type Maker<Shape, V> = (value: Shape, opts?: MakeOptions) => Make<V>;
55
- export declare function registerFormat(format: string, maker: Maker<any, undefined>): void;
56
- export declare function makeString(format?: string, pattern?: string, minLength?: number, maxLength?: number): Maker<any, string>;
57
- export declare function makeNumber(min?: number, max?: number): Maker<unknown, number>;
58
- export declare function makeInteger(min?: number, max?: number): Maker<unknown, number>;
59
- declare function checkAny(value: any, opts?: MakeOptions): Make<any>;
60
- export declare function makeAny(): typeof checkAny;
61
- declare function checkVoid(value: any): Make<any>;
62
- export declare function makeVoid(): typeof checkVoid;
63
- export declare function makeEnum<T>(...args: T[]): (value: T) => Make<T>;
64
- export declare function makeOptional(maker: any): {
65
- optional: any;
66
- };
67
- export declare function makeBoolean(): Maker<unknown, boolean>;
68
- export declare function makeArray(maker: any, minSize?: number, maxSize?: number): Maker<unknown, unknown[]>;
69
- export declare function makeOneOf(...options: any[]): (value: any, opts?: MakeOptions) => any;
70
- export declare function makeAllOf(...all: Maker<any, any>[]): (value: any, opts?: MakeOptions) => Make<any>;
71
- export declare function makeObject<P extends {
72
- [key: string]: Maker<any, any> | {
73
- optional: Maker<any, any>;
74
- };
75
- }>(props: P, additionalProp?: Maker<any, any> | undefined, comparisorOrder?: string[], type?: ObjectType): (value: any, opts?: MakeOptions) => Make<any>;
76
- export type Binary = File | Buffer | FormBinary;
77
- export declare class FormBinary {
78
- readonly binary: Binary;
79
- readonly options?: string | {
80
- [key: string]: string;
81
- } | undefined;
82
- constructor(binary: Binary, options?: string | {
83
- [key: string]: string;
84
- } | undefined);
85
- }
86
- export declare class File {
87
- readonly path: string;
88
- readonly size: number;
89
- readonly name?: string | undefined;
90
- private brand;
91
- constructor(path: string, size: number, name?: string | undefined);
92
- }
93
- declare function checkBinary(value: any): Make<any>;
94
- export declare function makeBinary(): typeof checkBinary;
95
- export declare function makeNullable(maker: any): (value: any, opts?: MakeOptions) => any;
96
- export declare function fromReflection(type: Type): Maker<any, any>;
97
- export declare function createMaker<Shape, Type>(fun: () => any): (value: Shape, opts?: MakeOptions) => Make<Type>;
98
- export declare function createMakerWith<Shape, Type>(constructor: new (v: Shape, opts?: MakeOptions) => Type): Maker<Shape, Type>;
99
- /**
100
- * Merge multiple mappings into one set of mappings
101
- *
102
- * Throw error if there are duplicate koys
103
- * @deprecated
104
- */
105
- export declare function mergeMappings(...mappings: readonly {
106
- [key: string]: Maker<any, any>;
107
- }[]): {
108
- [key: string]: Maker<any, any>;
109
- };
110
- export declare function extractDiscriminatorKeys(discriminatorField: string, typeObjectRef: Type): string[];
111
- /** @deprecated */
112
- export declare function extractDiscriminatorValueMap(discriminatorField: string, typeObject: NamedTypeDefinition<any>): {
113
- [key: string]: Maker<any, any>;
114
- };
115
- /**
116
- * Make oneOf with the discriminator support
117
- *
118
- * Will use given mapping to find correct maker. If optional importedTypes are provided, will extract
119
- * extra mapping keys from them.
120
- *
121
- * @deprecated
122
- *
123
- * @param discriminatorField Field to use as discriminator
124
- * @param mapping Mappings that we should use to determine target makers
125
- * @param importedTypes Optional types where we should extract enum values for makers
126
- */
127
- export declare function makeOneOfWithDiscriminator(discriminatorField: string, mapping: {
128
- [key: string]: Maker<any, any>;
129
- }, importedTypes?: readonly any[]): (value: any, opts?: MakeOptions) => Make<any>;
130
- export {};