@geekmidas/schema 10.0.0-alpha.2 → 10.0.0-alpha.21
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/conversion.cjs +106 -8
- package/dist/conversion.cjs.map +1 -0
- package/dist/conversion.d.cts +37 -2
- package/dist/conversion.d.cts.map +1 -0
- package/dist/conversion.d.mts +37 -2
- package/dist/conversion.d.mts.map +1 -0
- package/dist/conversion.mjs +99 -2
- package/dist/conversion.mjs.map +1 -0
- package/dist/index.cjs +4 -4
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +3 -4
- package/dist/openapi.cjs +56 -3
- package/dist/openapi.cjs.map +1 -0
- package/dist/openapi.d.cts +27 -2
- package/dist/openapi.d.cts.map +1 -0
- package/dist/openapi.d.mts +27 -2
- package/dist/openapi.d.mts.map +1 -0
- package/dist/openapi.mjs +54 -2
- package/dist/openapi.mjs.map +1 -0
- package/dist/parser.cjs +3 -3
- package/dist/parser.cjs.map +1 -1
- package/dist/parser.d.cts +3 -8
- package/dist/parser.d.cts.map +1 -1
- package/dist/parser.d.mts +3 -8
- package/dist/parser.d.mts.map +1 -1
- package/dist/parser.mjs +2 -2
- package/dist/parser.mjs.map +1 -1
- package/dist/types.d.cts +22 -2
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +22 -2
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +1 -0
- package/package.json +10 -7
- package/dist/conversion-CIBtqJkS.mjs +0 -106
- package/dist/conversion-CIBtqJkS.mjs.map +0 -1
- package/dist/conversion-Cf9R-jGc.cjs +0 -148
- package/dist/conversion-Cf9R-jGc.cjs.map +0 -1
- package/dist/conversion-JY1Wixil.d.cts +0 -39
- package/dist/conversion-JY1Wixil.d.cts.map +0 -1
- package/dist/conversion-e4k9rTxy.d.mts +0 -39
- package/dist/conversion-e4k9rTxy.d.mts.map +0 -1
- package/dist/openapi-Aeb_1e9T.d.cts +0 -28
- package/dist/openapi-Aeb_1e9T.d.cts.map +0 -1
- package/dist/openapi-DH5yCqKh.mjs +0 -46
- package/dist/openapi-DH5yCqKh.mjs.map +0 -1
- package/dist/openapi-DVvLYx-8.cjs +0 -58
- package/dist/openapi-DVvLYx-8.cjs.map +0 -1
- package/dist/openapi-Dxc4FuMP.d.mts +0 -28
- package/dist/openapi-Dxc4FuMP.d.mts.map +0 -1
- package/dist/types-Bm3VhqVE.d.cts +0 -26
- package/dist/types-Bm3VhqVE.d.cts.map +0 -1
- package/dist/types-xm7EGhin.d.mts +0 -26
- package/dist/types-xm7EGhin.d.mts.map +0 -1
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
//#region src/openapi.ts
|
|
2
|
-
function createComponentCollector() {
|
|
3
|
-
const schemas = {};
|
|
4
|
-
return {
|
|
5
|
-
schemas,
|
|
6
|
-
addSchema(id, schema) {
|
|
7
|
-
schemas[id] = schema;
|
|
8
|
-
},
|
|
9
|
-
getReference(id) {
|
|
10
|
-
return { $ref: `#/components/schemas/${id}` };
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Builds OpenAPI 3.1 schema from an array of endpoints.
|
|
16
|
-
*
|
|
17
|
-
* Note: This function requires endpoints with toOpenApi3Route method.
|
|
18
|
-
* The actual implementation is in @geekmidas/constructs to avoid circular dependencies.
|
|
19
|
-
*/
|
|
20
|
-
async function buildOpenApiSchema(endpoints, options = {}) {
|
|
21
|
-
const { title = "API", version = "1.0.0", description } = options;
|
|
22
|
-
const paths = {};
|
|
23
|
-
const componentCollector = createComponentCollector();
|
|
24
|
-
for (const endpoint of endpoints) {
|
|
25
|
-
const route = await endpoint.toOpenApi3Route(componentCollector);
|
|
26
|
-
for (const [path, methods] of Object.entries(route)) {
|
|
27
|
-
if (!paths[path]) paths[path] = {};
|
|
28
|
-
Object.assign(paths[path], methods);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
const doc = {
|
|
32
|
-
openapi: "3.0.0",
|
|
33
|
-
info: {
|
|
34
|
-
title,
|
|
35
|
-
version,
|
|
36
|
-
...description && { description }
|
|
37
|
-
},
|
|
38
|
-
paths
|
|
39
|
-
};
|
|
40
|
-
if (Object.keys(componentCollector.schemas).length > 0) doc.components = { schemas: componentCollector.schemas };
|
|
41
|
-
return doc;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
//#endregion
|
|
45
|
-
export { buildOpenApiSchema, createComponentCollector };
|
|
46
|
-
//# sourceMappingURL=openapi-DH5yCqKh.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openapi-DH5yCqKh.mjs","names":["schemas: Record<string, OpenAPIV3_1.SchemaObject>","id: string","schema: OpenAPIV3_1.SchemaObject","endpoints: Array<{\n\t\ttoOpenApi3Route(collector?: ComponentCollector): Promise<any>;\n\t}>","options: OpenApiSchemaOptions","paths: OpenAPIV3_1.PathsObject","doc: OpenAPIV3_1.Document"],"sources":["../src/openapi.ts"],"sourcesContent":["import type { OpenAPIV3_1 } from 'openapi-types';\n\nexport interface OpenApiSchemaOptions {\n\ttitle?: string;\n\tversion?: string;\n\tdescription?: string;\n}\n\nexport interface ComponentCollector {\n\tschemas: Record<string, OpenAPIV3_1.SchemaObject>;\n\taddSchema(id: string, schema: OpenAPIV3_1.SchemaObject): void;\n\tgetReference(id: string): OpenAPIV3_1.ReferenceObject;\n}\n\nexport function createComponentCollector(): ComponentCollector {\n\tconst schemas: Record<string, OpenAPIV3_1.SchemaObject> = {};\n\n\treturn {\n\t\tschemas,\n\t\taddSchema(id: string, schema: OpenAPIV3_1.SchemaObject) {\n\t\t\tschemas[id] = schema;\n\t\t},\n\t\tgetReference(id: string): OpenAPIV3_1.ReferenceObject {\n\t\t\treturn { $ref: `#/components/schemas/${id}` };\n\t\t},\n\t};\n}\n\n/**\n * Builds OpenAPI 3.1 schema from an array of endpoints.\n *\n * Note: This function requires endpoints with toOpenApi3Route method.\n * The actual implementation is in @geekmidas/constructs to avoid circular dependencies.\n */\nexport async function buildOpenApiSchema(\n\tendpoints: Array<{\n\t\ttoOpenApi3Route(collector?: ComponentCollector): Promise<any>;\n\t}>,\n\toptions: OpenApiSchemaOptions = {},\n): Promise<OpenAPIV3_1.Document> {\n\tconst { title = 'API', version = '1.0.0', description } = options;\n\tconst paths: OpenAPIV3_1.PathsObject = {};\n\tconst componentCollector = createComponentCollector();\n\n\tfor (const endpoint of endpoints) {\n\t\tconst route = await endpoint.toOpenApi3Route(componentCollector);\n\n\t\t// Merge the route into the paths object\n\t\tfor (const [path, methods] of Object.entries(route)) {\n\t\t\tif (!paths[path]) {\n\t\t\t\tpaths[path] = {};\n\t\t\t}\n\t\t\tObject.assign(paths[path], methods);\n\t\t}\n\t}\n\n\tconst doc: OpenAPIV3_1.Document = {\n\t\topenapi: '3.0.0',\n\t\tinfo: {\n\t\t\ttitle,\n\t\t\tversion,\n\t\t\t...(description && { description }),\n\t\t},\n\t\tpaths,\n\t};\n\n\t// Add components if any schemas were collected\n\tif (Object.keys(componentCollector.schemas).length > 0) {\n\t\tdoc.components = {\n\t\t\tschemas: componentCollector.schemas,\n\t\t};\n\t}\n\n\treturn doc;\n}\n"],"mappings":";AAcA,SAAgB,2BAA+C;CAC9D,MAAMA,UAAoD,CAAE;AAE5D,QAAO;EACN;EACA,UAAUC,IAAYC,QAAkC;AACvD,WAAQ,MAAM;EACd;EACD,aAAaD,IAAyC;AACrD,UAAO,EAAE,OAAO,uBAAuB,GAAG,EAAG;EAC7C;CACD;AACD;;;;;;;AAQD,eAAsB,mBACrBE,WAGAC,UAAgC,CAAE,GACF;CAChC,MAAM,EAAE,QAAQ,OAAO,UAAU,SAAS,aAAa,GAAG;CAC1D,MAAMC,QAAiC,CAAE;CACzC,MAAM,qBAAqB,0BAA0B;AAErD,MAAK,MAAM,YAAY,WAAW;EACjC,MAAM,QAAQ,MAAM,SAAS,gBAAgB,mBAAmB;AAGhE,OAAK,MAAM,CAAC,MAAM,QAAQ,IAAI,OAAO,QAAQ,MAAM,EAAE;AACpD,QAAK,MAAM,MACV,OAAM,QAAQ,CAAE;AAEjB,UAAO,OAAO,MAAM,OAAO,QAAQ;EACnC;CACD;CAED,MAAMC,MAA4B;EACjC,SAAS;EACT,MAAM;GACL;GACA;GACA,GAAI,eAAe,EAAE,YAAa;EAClC;EACD;CACA;AAGD,KAAI,OAAO,KAAK,mBAAmB,QAAQ,CAAC,SAAS,EACpD,KAAI,aAAa,EAChB,SAAS,mBAAmB,QAC5B;AAGF,QAAO;AACP"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
//#region src/openapi.ts
|
|
3
|
-
function createComponentCollector() {
|
|
4
|
-
const schemas = {};
|
|
5
|
-
return {
|
|
6
|
-
schemas,
|
|
7
|
-
addSchema(id, schema) {
|
|
8
|
-
schemas[id] = schema;
|
|
9
|
-
},
|
|
10
|
-
getReference(id) {
|
|
11
|
-
return { $ref: `#/components/schemas/${id}` };
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Builds OpenAPI 3.1 schema from an array of endpoints.
|
|
17
|
-
*
|
|
18
|
-
* Note: This function requires endpoints with toOpenApi3Route method.
|
|
19
|
-
* The actual implementation is in @geekmidas/constructs to avoid circular dependencies.
|
|
20
|
-
*/
|
|
21
|
-
async function buildOpenApiSchema(endpoints, options = {}) {
|
|
22
|
-
const { title = "API", version = "1.0.0", description } = options;
|
|
23
|
-
const paths = {};
|
|
24
|
-
const componentCollector = createComponentCollector();
|
|
25
|
-
for (const endpoint of endpoints) {
|
|
26
|
-
const route = await endpoint.toOpenApi3Route(componentCollector);
|
|
27
|
-
for (const [path, methods] of Object.entries(route)) {
|
|
28
|
-
if (!paths[path]) paths[path] = {};
|
|
29
|
-
Object.assign(paths[path], methods);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
const doc = {
|
|
33
|
-
openapi: "3.0.0",
|
|
34
|
-
info: {
|
|
35
|
-
title,
|
|
36
|
-
version,
|
|
37
|
-
...description && { description }
|
|
38
|
-
},
|
|
39
|
-
paths
|
|
40
|
-
};
|
|
41
|
-
if (Object.keys(componentCollector.schemas).length > 0) doc.components = { schemas: componentCollector.schemas };
|
|
42
|
-
return doc;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
//#endregion
|
|
46
|
-
Object.defineProperty(exports, 'buildOpenApiSchema', {
|
|
47
|
-
enumerable: true,
|
|
48
|
-
get: function () {
|
|
49
|
-
return buildOpenApiSchema;
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
Object.defineProperty(exports, 'createComponentCollector', {
|
|
53
|
-
enumerable: true,
|
|
54
|
-
get: function () {
|
|
55
|
-
return createComponentCollector;
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
//# sourceMappingURL=openapi-DVvLYx-8.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openapi-DVvLYx-8.cjs","names":["schemas: Record<string, OpenAPIV3_1.SchemaObject>","id: string","schema: OpenAPIV3_1.SchemaObject","endpoints: Array<{\n\t\ttoOpenApi3Route(collector?: ComponentCollector): Promise<any>;\n\t}>","options: OpenApiSchemaOptions","paths: OpenAPIV3_1.PathsObject","doc: OpenAPIV3_1.Document"],"sources":["../src/openapi.ts"],"sourcesContent":["import type { OpenAPIV3_1 } from 'openapi-types';\n\nexport interface OpenApiSchemaOptions {\n\ttitle?: string;\n\tversion?: string;\n\tdescription?: string;\n}\n\nexport interface ComponentCollector {\n\tschemas: Record<string, OpenAPIV3_1.SchemaObject>;\n\taddSchema(id: string, schema: OpenAPIV3_1.SchemaObject): void;\n\tgetReference(id: string): OpenAPIV3_1.ReferenceObject;\n}\n\nexport function createComponentCollector(): ComponentCollector {\n\tconst schemas: Record<string, OpenAPIV3_1.SchemaObject> = {};\n\n\treturn {\n\t\tschemas,\n\t\taddSchema(id: string, schema: OpenAPIV3_1.SchemaObject) {\n\t\t\tschemas[id] = schema;\n\t\t},\n\t\tgetReference(id: string): OpenAPIV3_1.ReferenceObject {\n\t\t\treturn { $ref: `#/components/schemas/${id}` };\n\t\t},\n\t};\n}\n\n/**\n * Builds OpenAPI 3.1 schema from an array of endpoints.\n *\n * Note: This function requires endpoints with toOpenApi3Route method.\n * The actual implementation is in @geekmidas/constructs to avoid circular dependencies.\n */\nexport async function buildOpenApiSchema(\n\tendpoints: Array<{\n\t\ttoOpenApi3Route(collector?: ComponentCollector): Promise<any>;\n\t}>,\n\toptions: OpenApiSchemaOptions = {},\n): Promise<OpenAPIV3_1.Document> {\n\tconst { title = 'API', version = '1.0.0', description } = options;\n\tconst paths: OpenAPIV3_1.PathsObject = {};\n\tconst componentCollector = createComponentCollector();\n\n\tfor (const endpoint of endpoints) {\n\t\tconst route = await endpoint.toOpenApi3Route(componentCollector);\n\n\t\t// Merge the route into the paths object\n\t\tfor (const [path, methods] of Object.entries(route)) {\n\t\t\tif (!paths[path]) {\n\t\t\t\tpaths[path] = {};\n\t\t\t}\n\t\t\tObject.assign(paths[path], methods);\n\t\t}\n\t}\n\n\tconst doc: OpenAPIV3_1.Document = {\n\t\topenapi: '3.0.0',\n\t\tinfo: {\n\t\t\ttitle,\n\t\t\tversion,\n\t\t\t...(description && { description }),\n\t\t},\n\t\tpaths,\n\t};\n\n\t// Add components if any schemas were collected\n\tif (Object.keys(componentCollector.schemas).length > 0) {\n\t\tdoc.components = {\n\t\t\tschemas: componentCollector.schemas,\n\t\t};\n\t}\n\n\treturn doc;\n}\n"],"mappings":";;AAcA,SAAgB,2BAA+C;CAC9D,MAAMA,UAAoD,CAAE;AAE5D,QAAO;EACN;EACA,UAAUC,IAAYC,QAAkC;AACvD,WAAQ,MAAM;EACd;EACD,aAAaD,IAAyC;AACrD,UAAO,EAAE,OAAO,uBAAuB,GAAG,EAAG;EAC7C;CACD;AACD;;;;;;;AAQD,eAAsB,mBACrBE,WAGAC,UAAgC,CAAE,GACF;CAChC,MAAM,EAAE,QAAQ,OAAO,UAAU,SAAS,aAAa,GAAG;CAC1D,MAAMC,QAAiC,CAAE;CACzC,MAAM,qBAAqB,0BAA0B;AAErD,MAAK,MAAM,YAAY,WAAW;EACjC,MAAM,QAAQ,MAAM,SAAS,gBAAgB,mBAAmB;AAGhE,OAAK,MAAM,CAAC,MAAM,QAAQ,IAAI,OAAO,QAAQ,MAAM,EAAE;AACpD,QAAK,MAAM,MACV,OAAM,QAAQ,CAAE;AAEjB,UAAO,OAAO,MAAM,OAAO,QAAQ;EACnC;CACD;CAED,MAAMC,MAA4B;EACjC,SAAS;EACT,MAAM;GACL;GACA;GACA,GAAI,eAAe,EAAE,YAAa;EAClC;EACD;CACA;AAGD,KAAI,OAAO,KAAK,mBAAmB,QAAQ,CAAC,SAAS,EACpD,KAAI,aAAa,EAChB,SAAS,mBAAmB,QAC5B;AAGF,QAAO;AACP"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { OpenAPIV3_1 } from "openapi-types";
|
|
2
|
-
|
|
3
|
-
//#region src/openapi.d.ts
|
|
4
|
-
interface OpenApiSchemaOptions {
|
|
5
|
-
title?: string;
|
|
6
|
-
version?: string;
|
|
7
|
-
description?: string;
|
|
8
|
-
}
|
|
9
|
-
interface ComponentCollector {
|
|
10
|
-
schemas: Record<string, OpenAPIV3_1.SchemaObject>;
|
|
11
|
-
addSchema(id: string, schema: OpenAPIV3_1.SchemaObject): void;
|
|
12
|
-
getReference(id: string): OpenAPIV3_1.ReferenceObject;
|
|
13
|
-
}
|
|
14
|
-
declare function createComponentCollector(): ComponentCollector;
|
|
15
|
-
/**
|
|
16
|
-
* Builds OpenAPI 3.1 schema from an array of endpoints.
|
|
17
|
-
*
|
|
18
|
-
* Note: This function requires endpoints with toOpenApi3Route method.
|
|
19
|
-
* The actual implementation is in @geekmidas/constructs to avoid circular dependencies.
|
|
20
|
-
*/
|
|
21
|
-
declare function buildOpenApiSchema(endpoints: Array<{
|
|
22
|
-
toOpenApi3Route(collector?: ComponentCollector): Promise<any>;
|
|
23
|
-
}>, options?: OpenApiSchemaOptions): Promise<OpenAPIV3_1.Document>;
|
|
24
|
-
//# sourceMappingURL=openapi.d.ts.map
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
|
-
export { ComponentCollector, OpenApiSchemaOptions, buildOpenApiSchema, createComponentCollector };
|
|
28
|
-
//# sourceMappingURL=openapi-Dxc4FuMP.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openapi-Dxc4FuMP.d.mts","names":[],"sources":["../src/openapi.ts"],"sourcesContent":[],"mappings":";;;UAEiB,oBAAA;;EAAA,OAAA,CAAA,EAAA,MAAA;EAMA,WAAA,CAAA,EAAA,MAAA;;AACQ,UADR,kBAAA,CACoB;EAAY,OAAvC,EAAA,MAAA,CAAA,MAAA,EAAe,WAAA,CAAY,YAA3B,CAAA;EAAM,SACe,CAAA,EAAA,EAAA,MAAY,EAAA,MAAA,EAAZ,WAAA,CAAY,YAAA,CAAA,EAAA,IAAA;EAAY,YAC5B,CAAA,EAAY,EAAA,MAAA,CAAA,EAAZ,WAAA,CAAY,eAAA;AAAe;AAGtC,iBAAA,wBAAA,CAAA,CAA4B,EAAA,kBAAkB;AAoB9D;;;;;;AAKW,iBALW,kBAAA,CAKC,SAAA,EAJX,KAIW,CAAA;EAAQ,eAA5B,CAAA,SAAA,CAAA,EAH2B,kBAG3B,CAAA,EAHgD,OAGhD,CAAA,GAAA,CAAA;AAAO,CAAA,CAAA,EAAA,OAAA,CAAA,EADA,oBACA,CAAA,EAAP,OAAO,CAAC,WAAA,CAAY,QAAb,CAAA"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
2
|
-
|
|
3
|
-
//#region src/types.d.ts
|
|
4
|
-
type InferStandardSchema<T> = T extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<T> : never;
|
|
5
|
-
/**
|
|
6
|
-
* The *input* type a Standard Schema accepts (before any transform/coercion),
|
|
7
|
-
* as opposed to {@link InferStandardSchema} which is the output type.
|
|
8
|
-
*
|
|
9
|
-
* Use this for the value a producer must HAND TO the schema (e.g. an endpoint
|
|
10
|
-
* handler's return that will be parsed by its output schema): the schema may
|
|
11
|
-
* coerce it (a `Date` → an ISO `string`, a default applied, etc.), so the
|
|
12
|
-
* producer should be allowed to supply the looser input type while consumers
|
|
13
|
-
* still see the narrower output type.
|
|
14
|
-
*/
|
|
15
|
-
type InferStandardSchemaInput<T> = T extends StandardSchemaV1 ? StandardSchemaV1.InferInput<T> : never;
|
|
16
|
-
type ComposableStandardSchema = StandardSchemaV1 | {
|
|
17
|
-
[key: string]: StandardSchemaV1 | undefined;
|
|
18
|
-
};
|
|
19
|
-
type InferComposableStandardSchema<T> = T extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<T> : T extends {
|
|
20
|
-
[key: string]: StandardSchemaV1 | undefined;
|
|
21
|
-
} ? { [K in keyof T as T[K] extends StandardSchemaV1 ? K : never]: T[K] extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<T[K]> : never } : {};
|
|
22
|
-
//# sourceMappingURL=types.d.ts.map
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
export { ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema, InferStandardSchemaInput };
|
|
26
|
-
//# sourceMappingURL=types-Bm3VhqVE.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types-Bm3VhqVE.d.cts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;KAEY,yBAAyB,UAAU,mBAC5C,gBAAA,CAAiB,YAAY;;AADhC;;;;;;AAC+B;AAa/B;;AAA0C,KAA9B,wBAA8B,CAAA,CAAA,CAAA,GAAA,CAAA,SAAU,gBAAV,GACvC,gBAAA,CAAiB,UADsB,CACX,CADW,CAAA,GAAA,KAAA;AAAU,KAIxC,wBAAA,GACT,gBALiD,GAAA;EAAgB,CAAA,GACrC,EAAA,MAAA,CAAA,EAMb,gBANa,GAAA,SAAA;CAAC;AAAF,KASlB,6BATkB,CAAA,CAAA,CAAA,GASiB,CATjB,SAS2B,gBAT3B,GAU3B,gBAAA,CAAiB,WAVU,CAUE,CAVF,CAAA,GAW3B,CAX2B,SAAA;EAGlB,CAAA,GAAA,EAAA,MAAA,CAAA,EAQkB,gBARM,GAAA,SAAA;CAAA,GAAA,QACjC,MASa,CATb,IASkB,CATlB,CASoB,CATpB,CAAA,SAS+B,gBAT/B,GAUI,CAVJ,GAAA,KAAA,GAWY,CAXZ,CAWc,CAXd,CAAA,SAWyB,gBAXzB,GAYI,gBAAA,CAAiB,WAZrB,CAYiC,CAZjC,CAYmC,CAZnC,CAAA,CAAA,GAAA,KAAA,EAAgB,GAAA,CAAA,CAAA;AAEe"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
2
|
-
|
|
3
|
-
//#region src/types.d.ts
|
|
4
|
-
type InferStandardSchema<T> = T extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<T> : never;
|
|
5
|
-
/**
|
|
6
|
-
* The *input* type a Standard Schema accepts (before any transform/coercion),
|
|
7
|
-
* as opposed to {@link InferStandardSchema} which is the output type.
|
|
8
|
-
*
|
|
9
|
-
* Use this for the value a producer must HAND TO the schema (e.g. an endpoint
|
|
10
|
-
* handler's return that will be parsed by its output schema): the schema may
|
|
11
|
-
* coerce it (a `Date` → an ISO `string`, a default applied, etc.), so the
|
|
12
|
-
* producer should be allowed to supply the looser input type while consumers
|
|
13
|
-
* still see the narrower output type.
|
|
14
|
-
*/
|
|
15
|
-
type InferStandardSchemaInput<T> = T extends StandardSchemaV1 ? StandardSchemaV1.InferInput<T> : never;
|
|
16
|
-
type ComposableStandardSchema = StandardSchemaV1 | {
|
|
17
|
-
[key: string]: StandardSchemaV1 | undefined;
|
|
18
|
-
};
|
|
19
|
-
type InferComposableStandardSchema<T> = T extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<T> : T extends {
|
|
20
|
-
[key: string]: StandardSchemaV1 | undefined;
|
|
21
|
-
} ? { [K in keyof T as T[K] extends StandardSchemaV1 ? K : never]: T[K] extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<T[K]> : never } : {};
|
|
22
|
-
//# sourceMappingURL=types.d.ts.map
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
export { ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema, InferStandardSchemaInput };
|
|
26
|
-
//# sourceMappingURL=types-xm7EGhin.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types-xm7EGhin.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;KAEY,yBAAyB,UAAU,mBAC5C,gBAAA,CAAiB,YAAY;;AADhC;;;;;;AAC+B;AAa/B;;AAA0C,KAA9B,wBAA8B,CAAA,CAAA,CAAA,GAAA,CAAA,SAAU,gBAAV,GACvC,gBAAA,CAAiB,UADsB,CACX,CADW,CAAA,GAAA,KAAA;AAAU,KAIxC,wBAAA,GACT,gBALiD,GAAA;EAAgB,CAAA,GACrC,EAAA,MAAA,CAAA,EAMb,gBANa,GAAA,SAAA;CAAC;AAAF,KASlB,6BATkB,CAAA,CAAA,CAAA,GASiB,CATjB,SAS2B,gBAT3B,GAU3B,gBAAA,CAAiB,WAVU,CAUE,CAVF,CAAA,GAW3B,CAX2B,SAAA;EAGlB,CAAA,GAAA,EAAA,MAAA,CAAA,EAQkB,gBARM,GAAA,SAAA;CAAA,GAAA,QACjC,MASa,CATb,IASkB,CATlB,CASoB,CATpB,CAAA,SAS+B,gBAT/B,GAUI,CAVJ,GAAA,KAAA,GAWY,CAXZ,CAWc,CAXd,CAAA,SAWyB,gBAXzB,GAYI,gBAAA,CAAiB,WAZrB,CAYiC,CAZjC,CAYmC,CAZnC,CAAA,CAAA,GAAA,KAAA,EAAgB,GAAA,CAAA,CAAA;AAEe"}
|