@geekmidas/schema 1.0.1 → 1.0.3

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 CHANGED
@@ -1,5 +1,28 @@
1
1
  # @geekmidas/schema
2
2
 
3
+ ## 1.0.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#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
8
+
9
+ Endpoint handlers previously had to return the output schema's _parsed_ type
10
+ (`InferStandardSchema`). When an output schema coerces its value (e.g. a `Date`
11
+ serialized to an ISO `string`, or an applied default), that forced handlers to
12
+ pre-coerce values themselves even though the schema would do it on the way out.
13
+
14
+ A new `InferStandardSchemaInput` type is added to `@geekmidas/schema`, exposing a
15
+ Standard Schema's _input_ type (`StandardSchemaV1.InferInput`). `Endpoint`'s
16
+ handler return type now uses it, so handlers may return the looser pre-coercion
17
+ input while consumers (`EndpointOutput` and the generated client) still see the
18
+ narrower parsed output type.
19
+
20
+ ## 1.0.2
21
+
22
+ ### Patch Changes
23
+
24
+ - 🐛 [`d70c6c0`](https://github.com/geekmidas/toolbox/commit/d70c6c0aeb8a79da2473ac77dbd8255a4a2f5651) Thanks [@geekmidas](https://github.com/geekmidas)! - Fix `package.json` exports so TypeScript declarations resolve correctly under NodeNext/Bundler module resolution. Each subpath export now nests `types` inside its `import`/`require` condition, pointing at the `.d.mts` and `.d.cts` files that `tsdown` actually emits (previously the exports referenced non-existent `.d.ts` files, causing type-resolution failures for consumers). Both ESM (`.mjs`) and CJS (`.cjs`) runtime entry points are preserved. Additionally, `@geekmidas/ui` had `import` paths pointing at `.js` files that were never emitted — those are corrected to `.mjs`.
25
+
3
26
  ## 1.0.1
4
27
 
5
28
  ### 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-D7ZRea_7.cjs";
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-o4dOkvCd.mjs";
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
@@ -1,4 +1,4 @@
1
- import { InferStandardSchema } from "./types-D7ZRea_7.cjs";
1
+ import { InferStandardSchema } from "./types-Bm3VhqVE.cjs";
2
2
  import { StandardSchemaV1 } from "@standard-schema/spec";
3
3
 
4
4
  //#region src/parser.d.ts
package/dist/parser.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { InferStandardSchema } from "./types-o4dOkvCd.mjs";
1
+ import { InferStandardSchema } from "./types-xm7EGhin.mjs";
2
2
  import { StandardSchemaV1 } from "@standard-schema/spec";
3
3
 
4
4
  //#region src/parser.d.ts
@@ -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-D7ZRea_7.d.cts.map
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-o4dOkvCd.d.mts.map
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-D7ZRea_7.cjs";
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-o4dOkvCd.mjs";
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
@@ -1,27 +1,47 @@
1
1
  {
2
2
  "name": "@geekmidas/schema",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
7
- "types": "./dist/index.d.ts",
8
- "import": "./dist/index.mjs",
9
- "require": "./dist/index.cjs"
7
+ "import": {
8
+ "types": "./dist/index.d.mts",
9
+ "default": "./dist/index.mjs"
10
+ },
11
+ "require": {
12
+ "types": "./dist/index.d.cts",
13
+ "default": "./dist/index.cjs"
14
+ }
10
15
  },
11
16
  "./conversion": {
12
- "types": "./dist/conversion.d.ts",
13
- "import": "./dist/conversion.mjs",
14
- "require": "./dist/conversion.cjs"
17
+ "import": {
18
+ "types": "./dist/conversion.d.mts",
19
+ "default": "./dist/conversion.mjs"
20
+ },
21
+ "require": {
22
+ "types": "./dist/conversion.d.cts",
23
+ "default": "./dist/conversion.cjs"
24
+ }
15
25
  },
16
26
  "./openapi": {
17
- "types": "./dist/openapi.d.ts",
18
- "import": "./dist/openapi.mjs",
19
- "require": "./dist/openapi.cjs"
27
+ "import": {
28
+ "types": "./dist/openapi.d.mts",
29
+ "default": "./dist/openapi.mjs"
30
+ },
31
+ "require": {
32
+ "types": "./dist/openapi.d.cts",
33
+ "default": "./dist/openapi.cjs"
34
+ }
20
35
  },
21
36
  "./parser": {
22
- "types": "./dist/parser.d.ts",
23
- "import": "./dist/parser.mjs",
24
- "require": "./dist/parser.cjs"
37
+ "import": {
38
+ "types": "./dist/parser.d.mts",
39
+ "default": "./dist/parser.mjs"
40
+ },
41
+ "require": {
42
+ "types": "./dist/parser.d.cts",
43
+ "default": "./dist/parser.cjs"
44
+ }
25
45
  }
26
46
  },
27
47
  "repository": {
package/src/index.ts CHANGED
@@ -11,4 +11,5 @@ export type {
11
11
  ComposableStandardSchema,
12
12
  InferComposableStandardSchema,
13
13
  InferStandardSchema,
14
+ InferStandardSchemaInput,
14
15
  } from './types';
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,y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