@temporary-name/server 1.9.3-alpha.e2d8d164da72fb570c2b14a4fa956c80f9e33cdc → 1.9.3-alpha.edd373b82156a10608d43b19a44b75ae72e72de7
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/adapters/aws-lambda/index.d.mts +4 -6
- package/dist/adapters/aws-lambda/index.d.ts +4 -6
- package/dist/adapters/aws-lambda/index.mjs +4 -4
- package/dist/adapters/fetch/index.d.mts +8 -86
- package/dist/adapters/fetch/index.d.ts +8 -86
- package/dist/adapters/fetch/index.mjs +16 -155
- package/dist/adapters/node/index.d.mts +8 -63
- package/dist/adapters/node/index.d.ts +8 -63
- package/dist/adapters/node/index.mjs +14 -120
- package/dist/adapters/standard/index.d.mts +10 -7
- package/dist/adapters/standard/index.d.ts +10 -7
- package/dist/adapters/standard/index.mjs +4 -4
- package/dist/helpers/index.mjs +3 -29
- package/dist/index.d.mts +376 -242
- package/dist/index.d.ts +376 -242
- package/dist/index.mjs +482 -359
- package/dist/openapi/index.d.mts +18 -53
- package/dist/openapi/index.d.ts +18 -53
- package/dist/openapi/index.mjs +337 -347
- package/dist/shared/server.BCY45g2x.mjs +160 -0
- package/dist/shared/server.BETu17rq.mjs +319 -0
- package/dist/shared/server.B_oW_rPl.mjs +525 -0
- package/dist/shared/server.C1RJffw4.mjs +30 -0
- package/dist/shared/server.CQIFwyhc.mjs +40 -0
- package/dist/shared/server.CjPiuQYH.d.mts +51 -0
- package/dist/shared/server.CjPiuQYH.d.ts +51 -0
- package/dist/shared/server.Cq7SBLD5.mjs +403 -0
- package/dist/shared/server.DGH2Bq4t.d.mts +41 -0
- package/dist/shared/server.nQoUObAJ.d.ts +41 -0
- package/dist/shared/server.zsKBRxsz.d.mts +388 -0
- package/dist/shared/server.zsKBRxsz.d.ts +388 -0
- package/package.json +10 -28
- package/dist/plugins/index.d.mts +0 -160
- package/dist/plugins/index.d.ts +0 -160
- package/dist/plugins/index.mjs +0 -288
- package/dist/shared/server.B93y_8tj.d.mts +0 -23
- package/dist/shared/server.BYYf0Wn6.mjs +0 -202
- package/dist/shared/server.C3RuMHWl.d.mts +0 -192
- package/dist/shared/server.C3RuMHWl.d.ts +0 -192
- package/dist/shared/server.CT1xhSmE.d.mts +0 -56
- package/dist/shared/server.CqTex_jI.mjs +0 -265
- package/dist/shared/server.D_fags8X.d.ts +0 -23
- package/dist/shared/server.Kxw442A9.mjs +0 -247
- package/dist/shared/server.cjcgLdr1.d.ts +0 -56
package/dist/openapi/index.d.mts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
1
|
+
import { Contract } from '@temporary-name/server';
|
|
2
|
+
import { OpenAPI, Promisable, Value, HTTPPath, HTTPMethod } from '@temporary-name/shared';
|
|
3
|
+
export { OpenAPI } from '@temporary-name/shared';
|
|
4
|
+
import { Z as ZodToJsonSchemaConverterOptions } from '../shared/server.CjPiuQYH.mjs';
|
|
5
|
+
import { d as AnySchema, b as Contract$1, a9 as TraverseContractProcedureCallbackOptions, Z as ContractRouter, _ as AnyRouter } from '../shared/server.zsKBRxsz.mjs';
|
|
5
6
|
import { JSONSchema } from '@temporary-name/interop/json-schema-typed/draft-2020-12';
|
|
6
7
|
export { JSONSchema, ContentEncoding as JSONSchemaContentEncoding, Format as JSONSchemaFormat, TypeName as JSONSchemaTypeName } from '@temporary-name/interop/json-schema-typed/draft-2020-12';
|
|
8
|
+
import '@temporary-name/server/openapi';
|
|
9
|
+
import '@temporary-name/zod';
|
|
7
10
|
|
|
8
|
-
type OverrideOperationValue = Partial<OpenAPI.OperationObject> | ((current: OpenAPI.OperationObject, procedure:
|
|
11
|
+
type OverrideOperationValue = Partial<OpenAPI.OperationObject> | ((current: OpenAPI.OperationObject, procedure: Contract) => OpenAPI.OperationObject);
|
|
9
12
|
/**
|
|
10
13
|
* Customize The Operation Object by proxy an error map item or a middleware.
|
|
11
14
|
*
|
|
@@ -13,7 +16,7 @@ type OverrideOperationValue = Partial<OpenAPI.OperationObject> | ((current: Open
|
|
|
13
16
|
*/
|
|
14
17
|
declare function customOpenAPIOperation<T extends object>(o: T, extend: OverrideOperationValue): T;
|
|
15
18
|
declare function getCustomOpenAPIOperation(o: object): OverrideOperationValue | undefined;
|
|
16
|
-
declare function applyCustomOpenAPIOperation(operation: OpenAPI.OperationObject, contract:
|
|
19
|
+
declare function applyCustomOpenAPIOperation(operation: OpenAPI.OperationObject, contract: Contract): OpenAPI.OperationObject;
|
|
17
20
|
|
|
18
21
|
/**
|
|
19
22
|
* @internal
|
|
@@ -54,29 +57,18 @@ interface SchemaConvertOptions {
|
|
|
54
57
|
*/
|
|
55
58
|
minStructureDepthForRef?: number;
|
|
56
59
|
}
|
|
57
|
-
|
|
58
|
-
convert(schema: AnySchema | undefined, options: SchemaConvertOptions): Promisable<[required: boolean, jsonSchema: JSONSchema]>;
|
|
59
|
-
}
|
|
60
|
-
interface ConditionalSchemaConverter extends SchemaConverter {
|
|
61
|
-
condition(schema: AnySchema | undefined, options: SchemaConvertOptions): Promisable<boolean>;
|
|
62
|
-
}
|
|
63
|
-
declare class CompositeSchemaConverter implements SchemaConverter {
|
|
64
|
-
private readonly converters;
|
|
65
|
-
constructor(converters: readonly ConditionalSchemaConverter[]);
|
|
66
|
-
convert(schema: AnySchema | undefined, options: SchemaConvertOptions): Promise<[required: boolean, jsonSchema: JSONSchema]>;
|
|
67
|
-
}
|
|
60
|
+
type SchemaConverter = (schemas: AnySchema | undefined, options: SchemaConvertOptions) => Promisable<[required: boolean, jsonSchema: JSONSchema]>;
|
|
68
61
|
|
|
69
|
-
interface
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
interface OpenAPIGeneratorGenerateOptions extends Partial<Omit<OpenAPI.Document, 'openapi'>> {
|
|
62
|
+
interface OpenAPIGeneratorGenerateOptions {
|
|
63
|
+
spec?: Partial<Omit<OpenAPI.Document, 'openapi'>>;
|
|
64
|
+
schemaConverter?: ZodToJsonSchemaConverterOptions | SchemaConverter;
|
|
73
65
|
/**
|
|
74
66
|
* Exclude procedures from the OpenAPI specification.
|
|
75
67
|
*
|
|
76
68
|
* @deprecated Use `filter` option instead.
|
|
77
69
|
* @default () => false
|
|
78
70
|
*/
|
|
79
|
-
exclude?: (procedure:
|
|
71
|
+
exclude?: (procedure: Contract$1, path: readonly string[]) => boolean;
|
|
80
72
|
/**
|
|
81
73
|
* Filter procedures. Return `false` to exclude a procedure from the OpenAPI specification.
|
|
82
74
|
*
|
|
@@ -116,21 +108,11 @@ interface OpenAPIGeneratorGenerateOptions extends Partial<Omit<OpenAPI.Document,
|
|
|
116
108
|
}>;
|
|
117
109
|
}
|
|
118
110
|
/**
|
|
119
|
-
*
|
|
111
|
+
* Generates OpenAPI specifications from oRPC routers/contracts.
|
|
120
112
|
*
|
|
121
113
|
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification OpenAPI Specification Docs}
|
|
122
114
|
*/
|
|
123
|
-
declare
|
|
124
|
-
#private;
|
|
125
|
-
private readonly converter;
|
|
126
|
-
constructor(options?: OpenAPIGeneratorOptions);
|
|
127
|
-
/**
|
|
128
|
-
* Generates OpenAPI specifications from oRPC routers/contracts.
|
|
129
|
-
*
|
|
130
|
-
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification OpenAPI Specification Docs}
|
|
131
|
-
*/
|
|
132
|
-
generate(router: AnyContractRouter | AnyRouter, options?: OpenAPIGeneratorGenerateOptions): Promise<OpenAPI.Document>;
|
|
133
|
-
}
|
|
115
|
+
declare function generateOpenApiSpec(router: ContractRouter | AnyRouter, options?: OpenAPIGeneratorGenerateOptions): Promise<OpenAPI.Document>;
|
|
134
116
|
|
|
135
117
|
/**
|
|
136
118
|
* @internal
|
|
@@ -162,23 +144,6 @@ declare function checkParamsSchema(schema: ObjectSchema, params: string[]): bool
|
|
|
162
144
|
declare function toOpenAPISchema(schema: JSONSchema): OpenAPI.SchemaObject & object;
|
|
163
145
|
declare function resolveOpenAPIJsonSchemaRef(doc: OpenAPI.Document, schema: JSONSchema): JSONSchema;
|
|
164
146
|
|
|
165
|
-
type JsonifiedValue<T> = T extends string ? T : T extends number ? T : T extends boolean ? T : T extends null ? T : T extends undefined ? T : T extends Array<unknown> ? JsonifiedArray<T> : T extends Record<string, unknown> ? {
|
|
166
|
-
[K in keyof T]: JsonifiedValue<T[K]>;
|
|
167
|
-
} : T extends Date ? string : T extends bigint ? string : T extends File ? File : T extends Blob ? Blob : T extends RegExp ? string : T extends URL ? string : T extends Map<infer K, infer V> ? JsonifiedArray<[K, V][]> : T extends Set<infer U> ? JsonifiedArray<U[]> : T extends AsyncIteratorObject<infer U, infer V> ? AsyncIteratorObject<JsonifiedValue<U>, JsonifiedValue<V>> : unknown;
|
|
168
|
-
type JsonifiedArray<T extends Array<unknown>> = T extends readonly [] ? [] : T extends readonly [infer U, ...infer V] ? [
|
|
169
|
-
U extends undefined ? null : JsonifiedValue<U>,
|
|
170
|
-
...JsonifiedArray<V>
|
|
171
|
-
] : T extends Array<infer U> ? Array<JsonifiedValue<U>> : unknown;
|
|
172
|
-
/**
|
|
173
|
-
* Convert types that JSON not support to corresponding json types
|
|
174
|
-
*
|
|
175
|
-
* @see {@link https://orpc.unnoq.com/docs/openapi/client/openapi-link OpenAPI Link Docs}
|
|
176
|
-
*/
|
|
177
|
-
type JsonifiedClient<T extends NestedClient<any>> = T extends Client<infer UClientContext, infer UInput, infer UOutput, infer UError> ? Client<UClientContext, UInput, JsonifiedValue<UOutput>, UError extends ORPCError<infer UCode, infer UData> ? ORPCError<UCode, JsonifiedValue<UData>> : UError> : {
|
|
178
|
-
[K in keyof T]: T[K] extends NestedClient<any> ? JsonifiedClient<T[K]> : T[K];
|
|
179
|
-
};
|
|
180
|
-
declare function createJsonifiedRouterClient<T extends AnyRouter, TClientContext extends ClientContext>(router: Lazyable<T | undefined>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<InferRouterInitialContext<T>, Schema<unknown, unknown>, ErrorMap, Meta, TClientContext>>): JsonifiedClient<RouterClient<T, TClientContext>>;
|
|
181
|
-
|
|
182
147
|
/**
|
|
183
148
|
*@internal
|
|
184
149
|
*/
|
|
@@ -216,5 +181,5 @@ declare const oo: {
|
|
|
216
181
|
spec: typeof customOpenAPIOperation;
|
|
217
182
|
};
|
|
218
183
|
|
|
219
|
-
export {
|
|
220
|
-
export type {
|
|
184
|
+
export { LOGIC_KEYWORDS, applyCustomOpenAPIOperation, applySchemaOptionality, checkParamsSchema, customOpenAPIOperation, expandArrayableSchema, expandUnionSchema, filterSchemaBranches, generateOpenApiSpec, getCustomOpenAPIOperation, isAnySchema, isFileSchema, isObjectSchema, isPrimitiveSchema, oo, resolveOpenAPIJsonSchemaRef, separateObjectSchema, toOpenAPIContent, toOpenAPIEventIteratorContent, toOpenAPIMethod, toOpenAPIParameters, toOpenAPIPath, toOpenAPISchema };
|
|
185
|
+
export type { FileSchema, ObjectSchema, OpenAPIGeneratorGenerateOptions, OverrideOperationValue, SchemaConvertOptions, SchemaConverter, SchemaConverterComponent };
|
package/dist/openapi/index.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
1
|
+
import { Contract } from '@temporary-name/server';
|
|
2
|
+
import { OpenAPI, Promisable, Value, HTTPPath, HTTPMethod } from '@temporary-name/shared';
|
|
3
|
+
export { OpenAPI } from '@temporary-name/shared';
|
|
4
|
+
import { Z as ZodToJsonSchemaConverterOptions } from '../shared/server.CjPiuQYH.js';
|
|
5
|
+
import { d as AnySchema, b as Contract$1, a9 as TraverseContractProcedureCallbackOptions, Z as ContractRouter, _ as AnyRouter } from '../shared/server.zsKBRxsz.js';
|
|
5
6
|
import { JSONSchema } from '@temporary-name/interop/json-schema-typed/draft-2020-12';
|
|
6
7
|
export { JSONSchema, ContentEncoding as JSONSchemaContentEncoding, Format as JSONSchemaFormat, TypeName as JSONSchemaTypeName } from '@temporary-name/interop/json-schema-typed/draft-2020-12';
|
|
8
|
+
import '@temporary-name/server/openapi';
|
|
9
|
+
import '@temporary-name/zod';
|
|
7
10
|
|
|
8
|
-
type OverrideOperationValue = Partial<OpenAPI.OperationObject> | ((current: OpenAPI.OperationObject, procedure:
|
|
11
|
+
type OverrideOperationValue = Partial<OpenAPI.OperationObject> | ((current: OpenAPI.OperationObject, procedure: Contract) => OpenAPI.OperationObject);
|
|
9
12
|
/**
|
|
10
13
|
* Customize The Operation Object by proxy an error map item or a middleware.
|
|
11
14
|
*
|
|
@@ -13,7 +16,7 @@ type OverrideOperationValue = Partial<OpenAPI.OperationObject> | ((current: Open
|
|
|
13
16
|
*/
|
|
14
17
|
declare function customOpenAPIOperation<T extends object>(o: T, extend: OverrideOperationValue): T;
|
|
15
18
|
declare function getCustomOpenAPIOperation(o: object): OverrideOperationValue | undefined;
|
|
16
|
-
declare function applyCustomOpenAPIOperation(operation: OpenAPI.OperationObject, contract:
|
|
19
|
+
declare function applyCustomOpenAPIOperation(operation: OpenAPI.OperationObject, contract: Contract): OpenAPI.OperationObject;
|
|
17
20
|
|
|
18
21
|
/**
|
|
19
22
|
* @internal
|
|
@@ -54,29 +57,18 @@ interface SchemaConvertOptions {
|
|
|
54
57
|
*/
|
|
55
58
|
minStructureDepthForRef?: number;
|
|
56
59
|
}
|
|
57
|
-
|
|
58
|
-
convert(schema: AnySchema | undefined, options: SchemaConvertOptions): Promisable<[required: boolean, jsonSchema: JSONSchema]>;
|
|
59
|
-
}
|
|
60
|
-
interface ConditionalSchemaConverter extends SchemaConverter {
|
|
61
|
-
condition(schema: AnySchema | undefined, options: SchemaConvertOptions): Promisable<boolean>;
|
|
62
|
-
}
|
|
63
|
-
declare class CompositeSchemaConverter implements SchemaConverter {
|
|
64
|
-
private readonly converters;
|
|
65
|
-
constructor(converters: readonly ConditionalSchemaConverter[]);
|
|
66
|
-
convert(schema: AnySchema | undefined, options: SchemaConvertOptions): Promise<[required: boolean, jsonSchema: JSONSchema]>;
|
|
67
|
-
}
|
|
60
|
+
type SchemaConverter = (schemas: AnySchema | undefined, options: SchemaConvertOptions) => Promisable<[required: boolean, jsonSchema: JSONSchema]>;
|
|
68
61
|
|
|
69
|
-
interface
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
interface OpenAPIGeneratorGenerateOptions extends Partial<Omit<OpenAPI.Document, 'openapi'>> {
|
|
62
|
+
interface OpenAPIGeneratorGenerateOptions {
|
|
63
|
+
spec?: Partial<Omit<OpenAPI.Document, 'openapi'>>;
|
|
64
|
+
schemaConverter?: ZodToJsonSchemaConverterOptions | SchemaConverter;
|
|
73
65
|
/**
|
|
74
66
|
* Exclude procedures from the OpenAPI specification.
|
|
75
67
|
*
|
|
76
68
|
* @deprecated Use `filter` option instead.
|
|
77
69
|
* @default () => false
|
|
78
70
|
*/
|
|
79
|
-
exclude?: (procedure:
|
|
71
|
+
exclude?: (procedure: Contract$1, path: readonly string[]) => boolean;
|
|
80
72
|
/**
|
|
81
73
|
* Filter procedures. Return `false` to exclude a procedure from the OpenAPI specification.
|
|
82
74
|
*
|
|
@@ -116,21 +108,11 @@ interface OpenAPIGeneratorGenerateOptions extends Partial<Omit<OpenAPI.Document,
|
|
|
116
108
|
}>;
|
|
117
109
|
}
|
|
118
110
|
/**
|
|
119
|
-
*
|
|
111
|
+
* Generates OpenAPI specifications from oRPC routers/contracts.
|
|
120
112
|
*
|
|
121
113
|
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification OpenAPI Specification Docs}
|
|
122
114
|
*/
|
|
123
|
-
declare
|
|
124
|
-
#private;
|
|
125
|
-
private readonly converter;
|
|
126
|
-
constructor(options?: OpenAPIGeneratorOptions);
|
|
127
|
-
/**
|
|
128
|
-
* Generates OpenAPI specifications from oRPC routers/contracts.
|
|
129
|
-
*
|
|
130
|
-
* @see {@link https://orpc.unnoq.com/docs/openapi/openapi-specification OpenAPI Specification Docs}
|
|
131
|
-
*/
|
|
132
|
-
generate(router: AnyContractRouter | AnyRouter, options?: OpenAPIGeneratorGenerateOptions): Promise<OpenAPI.Document>;
|
|
133
|
-
}
|
|
115
|
+
declare function generateOpenApiSpec(router: ContractRouter | AnyRouter, options?: OpenAPIGeneratorGenerateOptions): Promise<OpenAPI.Document>;
|
|
134
116
|
|
|
135
117
|
/**
|
|
136
118
|
* @internal
|
|
@@ -162,23 +144,6 @@ declare function checkParamsSchema(schema: ObjectSchema, params: string[]): bool
|
|
|
162
144
|
declare function toOpenAPISchema(schema: JSONSchema): OpenAPI.SchemaObject & object;
|
|
163
145
|
declare function resolveOpenAPIJsonSchemaRef(doc: OpenAPI.Document, schema: JSONSchema): JSONSchema;
|
|
164
146
|
|
|
165
|
-
type JsonifiedValue<T> = T extends string ? T : T extends number ? T : T extends boolean ? T : T extends null ? T : T extends undefined ? T : T extends Array<unknown> ? JsonifiedArray<T> : T extends Record<string, unknown> ? {
|
|
166
|
-
[K in keyof T]: JsonifiedValue<T[K]>;
|
|
167
|
-
} : T extends Date ? string : T extends bigint ? string : T extends File ? File : T extends Blob ? Blob : T extends RegExp ? string : T extends URL ? string : T extends Map<infer K, infer V> ? JsonifiedArray<[K, V][]> : T extends Set<infer U> ? JsonifiedArray<U[]> : T extends AsyncIteratorObject<infer U, infer V> ? AsyncIteratorObject<JsonifiedValue<U>, JsonifiedValue<V>> : unknown;
|
|
168
|
-
type JsonifiedArray<T extends Array<unknown>> = T extends readonly [] ? [] : T extends readonly [infer U, ...infer V] ? [
|
|
169
|
-
U extends undefined ? null : JsonifiedValue<U>,
|
|
170
|
-
...JsonifiedArray<V>
|
|
171
|
-
] : T extends Array<infer U> ? Array<JsonifiedValue<U>> : unknown;
|
|
172
|
-
/**
|
|
173
|
-
* Convert types that JSON not support to corresponding json types
|
|
174
|
-
*
|
|
175
|
-
* @see {@link https://orpc.unnoq.com/docs/openapi/client/openapi-link OpenAPI Link Docs}
|
|
176
|
-
*/
|
|
177
|
-
type JsonifiedClient<T extends NestedClient<any>> = T extends Client<infer UClientContext, infer UInput, infer UOutput, infer UError> ? Client<UClientContext, UInput, JsonifiedValue<UOutput>, UError extends ORPCError<infer UCode, infer UData> ? ORPCError<UCode, JsonifiedValue<UData>> : UError> : {
|
|
178
|
-
[K in keyof T]: T[K] extends NestedClient<any> ? JsonifiedClient<T[K]> : T[K];
|
|
179
|
-
};
|
|
180
|
-
declare function createJsonifiedRouterClient<T extends AnyRouter, TClientContext extends ClientContext>(router: Lazyable<T | undefined>, ...rest: MaybeOptionalOptions<CreateProcedureClientOptions<InferRouterInitialContext<T>, Schema<unknown, unknown>, ErrorMap, Meta, TClientContext>>): JsonifiedClient<RouterClient<T, TClientContext>>;
|
|
181
|
-
|
|
182
147
|
/**
|
|
183
148
|
*@internal
|
|
184
149
|
*/
|
|
@@ -216,5 +181,5 @@ declare const oo: {
|
|
|
216
181
|
spec: typeof customOpenAPIOperation;
|
|
217
182
|
};
|
|
218
183
|
|
|
219
|
-
export {
|
|
220
|
-
export type {
|
|
184
|
+
export { LOGIC_KEYWORDS, applyCustomOpenAPIOperation, applySchemaOptionality, checkParamsSchema, customOpenAPIOperation, expandArrayableSchema, expandUnionSchema, filterSchemaBranches, generateOpenApiSpec, getCustomOpenAPIOperation, isAnySchema, isFileSchema, isObjectSchema, isPrimitiveSchema, oo, resolveOpenAPIJsonSchemaRef, separateObjectSchema, toOpenAPIContent, toOpenAPIEventIteratorContent, toOpenAPIMethod, toOpenAPIParameters, toOpenAPIPath, toOpenAPISchema };
|
|
185
|
+
export type { FileSchema, ObjectSchema, OpenAPIGeneratorGenerateOptions, OverrideOperationValue, SchemaConvertOptions, SchemaConverter, SchemaConverterComponent };
|