@geekmidas/schema 1.0.2 → 1.0.4
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/CHANGELOG.md +26 -0
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/parser.d.cts +1 -1
- package/dist/parser.d.mts +1 -1
- package/dist/{types-D7ZRea_7.d.cts → types-Bm3VhqVE.d.cts} +13 -2
- package/dist/types-Bm3VhqVE.d.cts.map +1 -0
- package/dist/{types-o4dOkvCd.d.mts → types-xm7EGhin.d.mts} +13 -2
- package/dist/types-xm7EGhin.d.mts.map +1 -0
- package/dist/types.d.cts +2 -2
- package/dist/types.d.mts +2 -2
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/types.ts +14 -0
- package/dist/types-D7ZRea_7.d.cts.map +0 -1
- package/dist/types-o4dOkvCd.d.mts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @geekmidas/schema
|
|
2
2
|
|
|
3
|
+
## 1.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 🐛 [#11](https://github.com/geekmidas/toolbox/pull/11) [`40f4dc0`](https://github.com/geekmidas/toolbox/commit/40f4dc095911b2223a255029d8f776caf7781309) Thanks [@geekmidas](https://github.com/geekmidas)! - Patch release across all packages to realign published versions with the
|
|
8
|
+
registry. The previous release only published the four packages that had
|
|
9
|
+
version bumps; the remaining packages failed with "cannot publish over the
|
|
10
|
+
previously published versions" because their versions were unchanged.
|
|
11
|
+
|
|
12
|
+
## 1.0.3
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#7](https://github.com/geekmidas/toolbox/pull/7) [`e0d06b3`](https://github.com/geekmidas/toolbox/commit/e0d06b38dfd275758f7955f5754900ab78779302) Thanks [@geekmidas](https://github.com/geekmidas)! - feat(constructs): allow endpoint handlers to return the output schema's input type
|
|
17
|
+
|
|
18
|
+
Endpoint handlers previously had to return the output schema's _parsed_ type
|
|
19
|
+
(`InferStandardSchema`). When an output schema coerces its value (e.g. a `Date`
|
|
20
|
+
serialized to an ISO `string`, or an applied default), that forced handlers to
|
|
21
|
+
pre-coerce values themselves even though the schema would do it on the way out.
|
|
22
|
+
|
|
23
|
+
A new `InferStandardSchemaInput` type is added to `@geekmidas/schema`, exposing a
|
|
24
|
+
Standard Schema's _input_ type (`StandardSchemaV1.InferInput`). `Endpoint`'s
|
|
25
|
+
handler return type now uses it, so handlers may return the looser pre-coercion
|
|
26
|
+
input while consumers (`EndpointOutput` and the generated client) still see the
|
|
27
|
+
narrower parsed output type.
|
|
28
|
+
|
|
3
29
|
## 1.0.2
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { convertSchemaWithComponents, convertStandardSchemaToJsonSchema } from "./conversion-JY1Wixil.cjs";
|
|
2
2
|
import { ComponentCollector, OpenApiSchemaOptions, buildOpenApiSchema, createComponentCollector } from "./openapi-Aeb_1e9T.cjs";
|
|
3
|
-
import { ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema } from "./types-
|
|
4
|
-
export { ComponentCollector, ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema, OpenApiSchemaOptions, buildOpenApiSchema, convertSchemaWithComponents, convertStandardSchemaToJsonSchema, createComponentCollector };
|
|
3
|
+
import { ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema, InferStandardSchemaInput } from "./types-Bm3VhqVE.cjs";
|
|
4
|
+
export { ComponentCollector, ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema, InferStandardSchemaInput, OpenApiSchemaOptions, buildOpenApiSchema, convertSchemaWithComponents, convertStandardSchemaToJsonSchema, createComponentCollector };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { convertSchemaWithComponents, convertStandardSchemaToJsonSchema } from "./conversion-e4k9rTxy.mjs";
|
|
2
2
|
import { ComponentCollector, OpenApiSchemaOptions, buildOpenApiSchema, createComponentCollector } from "./openapi-Dxc4FuMP.mjs";
|
|
3
|
-
import { ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema } from "./types-
|
|
4
|
-
export { ComponentCollector, ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema, OpenApiSchemaOptions, buildOpenApiSchema, convertSchemaWithComponents, convertStandardSchemaToJsonSchema, createComponentCollector };
|
|
3
|
+
import { ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema, InferStandardSchemaInput } from "./types-xm7EGhin.mjs";
|
|
4
|
+
export { ComponentCollector, ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema, InferStandardSchemaInput, OpenApiSchemaOptions, buildOpenApiSchema, convertSchemaWithComponents, convertStandardSchemaToJsonSchema, createComponentCollector };
|
package/dist/parser.d.cts
CHANGED
package/dist/parser.d.mts
CHANGED
|
@@ -2,6 +2,17 @@ import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
|
2
2
|
|
|
3
3
|
//#region src/types.d.ts
|
|
4
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;
|
|
5
16
|
type ComposableStandardSchema = StandardSchemaV1 | {
|
|
6
17
|
[key: string]: StandardSchemaV1 | undefined;
|
|
7
18
|
};
|
|
@@ -11,5 +22,5 @@ type InferComposableStandardSchema<T> = T extends StandardSchemaV1 ? StandardSch
|
|
|
11
22
|
//# sourceMappingURL=types.d.ts.map
|
|
12
23
|
|
|
13
24
|
//#endregion
|
|
14
|
-
export { ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema };
|
|
15
|
-
//# sourceMappingURL=types-
|
|
25
|
+
export { ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema, InferStandardSchemaInput };
|
|
26
|
+
//# sourceMappingURL=types-Bm3VhqVE.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -2,6 +2,17 @@ import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
|
2
2
|
|
|
3
3
|
//#region src/types.d.ts
|
|
4
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;
|
|
5
16
|
type ComposableStandardSchema = StandardSchemaV1 | {
|
|
6
17
|
[key: string]: StandardSchemaV1 | undefined;
|
|
7
18
|
};
|
|
@@ -11,5 +22,5 @@ type InferComposableStandardSchema<T> = T extends StandardSchemaV1 ? StandardSch
|
|
|
11
22
|
//# sourceMappingURL=types.d.ts.map
|
|
12
23
|
|
|
13
24
|
//#endregion
|
|
14
|
-
export { ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema };
|
|
15
|
-
//# sourceMappingURL=types-
|
|
25
|
+
export { ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema, InferStandardSchemaInput };
|
|
26
|
+
//# sourceMappingURL=types-xm7EGhin.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
package/dist/types.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema } from "./types-
|
|
2
|
-
export { ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema };
|
|
1
|
+
import { ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema, InferStandardSchemaInput } from "./types-Bm3VhqVE.cjs";
|
|
2
|
+
export { ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema, InferStandardSchemaInput };
|
package/dist/types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema } from "./types-
|
|
2
|
-
export { ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema };
|
|
1
|
+
import { ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema, InferStandardSchemaInput } from "./types-xm7EGhin.mjs";
|
|
2
|
+
export { ComposableStandardSchema, InferComposableStandardSchema, InferStandardSchema, InferStandardSchemaInput };
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -4,6 +4,20 @@ export type InferStandardSchema<T> = T extends StandardSchemaV1
|
|
|
4
4
|
? StandardSchemaV1.InferOutput<T>
|
|
5
5
|
: never;
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* The *input* type a Standard Schema accepts (before any transform/coercion),
|
|
9
|
+
* as opposed to {@link InferStandardSchema} which is the output type.
|
|
10
|
+
*
|
|
11
|
+
* Use this for the value a producer must HAND TO the schema (e.g. an endpoint
|
|
12
|
+
* handler's return that will be parsed by its output schema): the schema may
|
|
13
|
+
* coerce it (a `Date` → an ISO `string`, a default applied, etc.), so the
|
|
14
|
+
* producer should be allowed to supply the looser input type while consumers
|
|
15
|
+
* still see the narrower output type.
|
|
16
|
+
*/
|
|
17
|
+
export type InferStandardSchemaInput<T> = T extends StandardSchemaV1
|
|
18
|
+
? StandardSchemaV1.InferInput<T>
|
|
19
|
+
: never;
|
|
20
|
+
|
|
7
21
|
export type ComposableStandardSchema =
|
|
8
22
|
| StandardSchemaV1
|
|
9
23
|
| {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types-D7ZRea_7.d.cts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;KAEY,yBAAyB,UAAU,mBAC5C,gBAAA,CAAiB,YAAY;KAGpB,wBAAA,GACT;EALS,CAAA,GAAA,EAAA,MAAA,CAAA,EAOM,gBAPa,GAAA,SAAA;CAAA;AAAM,KAUzB,6BAVyB,CAAA,CAAA,CAAA,GAUU,CAVV,SAUoB,gBAVpB,GAWlC,gBAAA,CAAiB,WAXiB,CAWL,CAXK,CAAA,GAYlC,CAZkC,SAAA;EAAC,CAAA,GAAS,EAAA,MAAA,CAAA,EAYjB,gBAZiB,GAAA,SAAA;CAAgB,GAAA,QAC5D,MAaa,CAbb,IAakB,CAblB,CAaoB,CAbH,CAAA,SAac,gBAbd,GAcb,CAda,GAAA,KAAA,GAeL,CAfK,CAeH,CAfG,CAAA,SAeQ,gBAfR,GAgBb,gBAAA,CAAiB,WAhBJ,CAgBgB,CAhBhB,CAgBkB,CAhBlB,CAAA,CAAA,GAAA,KAAA,EAAW,GAAA,CAAA,CAAA;AAG/B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types-o4dOkvCd.d.mts","names":[],"sources":["../src/types.ts"],"sourcesContent":[],"mappings":";;;KAEY,yBAAyB,UAAU,mBAC5C,gBAAA,CAAiB,YAAY;KAGpB,wBAAA,GACT;EALS,CAAA,GAAA,EAAA,MAAA,CAAA,EAOM,gBAPa,GAAA,SAAA;CAAA;AAAM,KAUzB,6BAVyB,CAAA,CAAA,CAAA,GAUU,CAVV,SAUoB,gBAVpB,GAWlC,gBAAA,CAAiB,WAXiB,CAWL,CAXK,CAAA,GAYlC,CAZkC,SAAA;EAAC,CAAA,GAAS,EAAA,MAAA,CAAA,EAYjB,gBAZiB,GAAA,SAAA;CAAgB,GAAA,QAC5D,MAaa,CAbb,IAakB,CAblB,CAaoB,CAbH,CAAA,SAac,gBAbd,GAcb,CAda,GAAA,KAAA,GAeL,CAfK,CAeH,CAfG,CAAA,SAeQ,gBAfR,GAgBb,gBAAA,CAAiB,WAhBJ,CAgBgB,CAhBhB,CAgBkB,CAhBlB,CAAA,CAAA,GAAA,KAAA,EAAW,GAAA,CAAA,CAAA;AAG/B"}
|