@ir-kit/openapi-ts-typia 0.1.0

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.
Files changed (51) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +136 -0
  3. package/dist/api.d.ts +22 -0
  4. package/dist/api.d.ts.map +1 -0
  5. package/dist/api.js +24 -0
  6. package/dist/api.js.map +1 -0
  7. package/dist/config.d.ts +9 -0
  8. package/dist/config.d.ts.map +1 -0
  9. package/dist/config.js +55 -0
  10. package/dist/config.js.map +1 -0
  11. package/dist/index.d.ts +5 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +4 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/orpc/index.d.ts +14 -0
  16. package/dist/orpc/index.d.ts.map +1 -0
  17. package/dist/orpc/index.js +63 -0
  18. package/dist/orpc/index.js.map +1 -0
  19. package/dist/plugin.d.ts +3 -0
  20. package/dist/plugin.d.ts.map +1 -0
  21. package/dist/plugin.js +3 -0
  22. package/dist/plugin.js.map +1 -0
  23. package/dist/shared/emit.d.ts +59 -0
  24. package/dist/shared/emit.d.ts.map +1 -0
  25. package/dist/shared/emit.js +91 -0
  26. package/dist/shared/emit.js.map +1 -0
  27. package/dist/shared/operation.d.ts +11 -0
  28. package/dist/shared/operation.d.ts.map +1 -0
  29. package/dist/shared/operation.js +72 -0
  30. package/dist/shared/operation.js.map +1 -0
  31. package/dist/shared/type-transformer.d.ts +12 -0
  32. package/dist/shared/type-transformer.d.ts.map +1 -0
  33. package/dist/shared/type-transformer.js +169 -0
  34. package/dist/shared/type-transformer.js.map +1 -0
  35. package/dist/shared/typia-tags.generated.d.ts +99 -0
  36. package/dist/shared/typia-tags.generated.d.ts.map +1 -0
  37. package/dist/shared/typia-tags.generated.js +134 -0
  38. package/dist/shared/typia-tags.generated.js.map +1 -0
  39. package/dist/types.d.ts +123 -0
  40. package/dist/types.d.ts.map +1 -0
  41. package/dist/types.js +2 -0
  42. package/dist/types.js.map +1 -0
  43. package/dist/v1/api.d.ts +10 -0
  44. package/dist/v1/api.d.ts.map +1 -0
  45. package/dist/v1/api.js +46 -0
  46. package/dist/v1/api.js.map +1 -0
  47. package/dist/v1/plugin.d.ts +3 -0
  48. package/dist/v1/plugin.d.ts.map +1 -0
  49. package/dist/v1/plugin.js +146 -0
  50. package/dist/v1/plugin.js.map +1 -0
  51. package/package.json +92 -0
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Ahmed Rowaihi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,136 @@
1
+ # @ir-kit/openapi-ts-typia
2
+
3
+ Typia plugin for [@hey-api/openapi-ts](https://heyapi.dev/). Emits
4
+ [typia](https://typia.io/) Standard Schema validators + JSON Schema
5
+ companions for OpenAPI operations.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pnpm add -d @ir-kit/openapi-ts-typia @hey-api/openapi-ts
11
+ pnpm add typia @standard-schema/spec
12
+ ```
13
+
14
+ `@standard-schema/spec` is already a runtime dep of typia; pnpm's
15
+ strict mode hides transitives, so generated code's
16
+ `import type { StandardSchemaV1 } from '@standard-schema/spec'`
17
+ requires the user to list it as a direct install.
18
+
19
+ Typia's compiler transform is required at build time — install
20
+ `@ryoppippi/unplugin-typia` for your bundler (Vite, Webpack, tsdown,
21
+ etc.).
22
+
23
+ ## Usage
24
+
25
+ ```typescript
26
+ import { defineConfig } from '@hey-api/openapi-ts';
27
+ import {
28
+ defineConfig as defineTypiaConfig,
29
+ typiaTypeTransformer,
30
+ } from '@ir-kit/openapi-ts-typia';
31
+
32
+ export default defineConfig({
33
+ input: 'openapi.json',
34
+ output: { path: './src/generated' },
35
+ plugins: [
36
+ '@hey-api/typescript',
37
+ {
38
+ name: '@hey-api/transformers',
39
+ typeTransformers: [typiaTypeTransformer],
40
+ },
41
+ defineTypiaConfig(),
42
+ ],
43
+ });
44
+ ```
45
+
46
+ `typiaTypeTransformer` annotates generated TypeScript types with typia
47
+ constraint tags (`MinLength<N>`, `Format<"email">`, etc.) derived from
48
+ OpenAPI validation keywords.
49
+
50
+ ## Generated output
51
+
52
+ For each operation, one Standard Schema validator and (when
53
+ `jsonSchema: true`) one JSON Schema companion:
54
+
55
+ ```ts
56
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
57
+ import { createValidate, type IValidation, json } from 'typia';
58
+ import type { GetUserData, GetUserResponse } from './types.gen';
59
+
60
+ const typiaSchemas = json.schemas<[
61
+ Omit<GetUserData, 'url' | 'path'> & { params: GetUserData['path'] },
62
+ GetUserResponse,
63
+ ]>();
64
+
65
+ export const tGetUserData:
66
+ StandardSchemaV1<
67
+ Omit<GetUserData, 'url' | 'path'> & { params: GetUserData['path'] },
68
+ Omit<GetUserData, 'url' | 'path'> & { params: GetUserData['path'] }
69
+ > &
70
+ ((input: unknown) => IValidation<Omit<GetUserData, 'url' | 'path'> & { params: GetUserData['path'] }>) =
71
+ createValidate<Omit<GetUserData, 'url' | 'path'> & { params: GetUserData['path'] }>();
72
+
73
+ export const tGetUserDataJsonSchema = typiaSchemas.schemas[0];
74
+
75
+ export const tGetUserResponse:
76
+ StandardSchemaV1<GetUserResponse, GetUserResponse> &
77
+ ((input: unknown) => IValidation<GetUserResponse>) =
78
+ createValidate<GetUserResponse>();
79
+ export const tGetUserResponseJsonSchema = typiaSchemas.schemas[1];
80
+ ```
81
+
82
+ - `typia.json.schemas<[T1, T2, ...]>()` is called once per output file;
83
+ typia deduplicates `$ref`-ed components across the tuple.
84
+ - Request input is reshaped: `path` → `params` to match the standard
85
+ validator API's default layer mapping (same shape oRPC's
86
+ `inputStructure: 'detailed'` expects).
87
+ - Error responses (4xx/5xx) get per-status validators:
88
+ `t{{op}}ResponseError400`, etc.
89
+
90
+ ## Configuration
91
+
92
+ ```ts
93
+ defineTypiaConfig({
94
+ case: 'camelCase', // naming case for validators (default)
95
+ comments: true, // JSDoc from OpenAPI summary/description
96
+ jsonSchema: true, // emit JSON Schema companions
97
+ requests: {
98
+ enabled: true,
99
+ name: 't{{name}}Data',
100
+ jsonName: 't{{name}}DataJsonSchema',
101
+ },
102
+ responses: {
103
+ enabled: true,
104
+ name: 't{{name}}Response',
105
+ jsonName: 't{{name}}ResponseJsonSchema',
106
+ },
107
+ })
108
+ ```
109
+
110
+ ## Drift detection
111
+
112
+ Typia's tag namespace is type-only — it can't be enumerated at
113
+ runtime. This plugin ships a generated mirror at
114
+ `shared/typia-tags.generated.ts` produced by
115
+ `scripts/sync-tags.ts`. Run after bumping typia:
116
+
117
+ ```bash
118
+ pnpm sync-tags
119
+ ```
120
+
121
+ The generator walks typia's `.d.ts` files via the TypeScript compiler
122
+ API to extract tag names + `Format.Value` + `Type<V>`'s constraint —
123
+ no hand-maintained mapping tables.
124
+
125
+ A compile-time coverage gate flags any new typia tag that isn't
126
+ explicitly handled or skipped.
127
+
128
+ ## Requirements
129
+
130
+ - `@hey-api/openapi-ts` >= 0.95.0
131
+ - `@hey-api/typescript` plugin configured
132
+ - `@hey-api/transformers` plugin configured with
133
+ `typeTransformers: [typiaTypeTransformer]`
134
+ - `typia` + `@standard-schema/spec` installed at runtime
135
+ - Typia compiler transform configured (via `@ryoppippi/unplugin-typia`
136
+ or equivalent)
package/dist/api.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ import type { Symbol } from "@hey-api/codegen-core";
2
+ import type { $ } from "@hey-api/openapi-ts";
3
+ import type { IR, RequestSchemaContext } from "@hey-api/shared";
4
+ import type { TypiaPlugin } from "./types";
5
+ export interface ValidatorArgs {
6
+ operation: IR.OperationObject;
7
+ plugin: TypiaPlugin["Instance"];
8
+ }
9
+ export type IApi = {
10
+ createRequestSchema: (ctx: RequestSchemaContext<TypiaPlugin["Instance"]>) => Symbol | undefined;
11
+ createRequestValidator: (args: RequestSchemaContext<TypiaPlugin["Instance"]>) => ReturnType<typeof $.func> | undefined;
12
+ createResponseValidator: (args: ValidatorArgs) => ReturnType<typeof $.func> | undefined;
13
+ /** Returns the JSON Schema companion symbol for an operation (twin of the validator). */
14
+ getJsonSchemaSymbol: (plugin: TypiaPlugin["Instance"], operation: IR.OperationObject, role: "data" | "response") => Symbol | undefined;
15
+ };
16
+ export declare class Api implements IApi {
17
+ createRequestSchema(ctx: RequestSchemaContext<TypiaPlugin["Instance"]>): Symbol | undefined;
18
+ createRequestValidator(args: RequestSchemaContext<TypiaPlugin["Instance"]>): ReturnType<typeof $.func> | undefined;
19
+ createResponseValidator(args: ValidatorArgs): ReturnType<typeof $.func> | undefined;
20
+ getJsonSchemaSymbol(plugin: TypiaPlugin["Instance"], operation: IR.OperationObject, role: "data" | "response"): Symbol | undefined;
21
+ }
22
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAu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B,UAAU,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,SAAS;IAKxC,mBAAmB,CACjB,MAAM,EAAE,WAAW,CAAC,UAAU,CAAC,EAC/B,SAAS,EAAE,EAAE,CAAC,eAAe,EAC7B,IAAI,EAAE,MAAM,GAAG,UAAU,GACxB,MAAM,GAAG,SAAS;CAItB"}
package/dist/api.js ADDED
@@ -0,0 +1,24 @@
1
+ import { createRequestSchemaV1, createRequestValidatorV1, createResponseValidatorV1, getJsonSchemaSymbolV1, } from "./v1/api";
2
+ export class Api {
3
+ createRequestSchema(ctx) {
4
+ if (!ctx.plugin.config.requests.enabled)
5
+ return;
6
+ return createRequestSchemaV1(ctx);
7
+ }
8
+ createRequestValidator(args) {
9
+ if (!args.plugin.config.requests.enabled)
10
+ return;
11
+ return createRequestValidatorV1(args);
12
+ }
13
+ createResponseValidator(args) {
14
+ if (!args.plugin.config.responses.enabled)
15
+ return;
16
+ return createResponseValidatorV1(args);
17
+ }
18
+ getJsonSchemaSymbol(plugin, operation, role) {
19
+ if (!plugin.config.jsonSchema)
20
+ return;
21
+ return getJsonSchemaSymbolV1(plugin, operation, role);
22
+ }
23
+ }
24
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAyBlB,MAAM,OAAO,GAAG;IACd,mBAAmB,CACjB,GAAkD;QAElD,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO;YAAE,OAAO;QAChD,OAAO,qBAAqB,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;IAED,sBAAsB,CACpB,IAAmD;QAEnD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO;YAAE,OAAO;QACjD,OAAO,wBAAwB,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAED,uBAAuB,CACrB,IAAmB;QAEnB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO;YAAE,OAAO;QAClD,OAAO,yBAAyB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAED,mBAAmB,CACjB,MAA+B,EAC/B,SAA6B,EAC7B,IAAyB;QAEzB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU;YAAE,OAAO;QACtC,OAAO,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IACxD,CAAC;CACF"}
@@ -0,0 +1,9 @@
1
+ import type { TypiaPlugin } from "./types";
2
+ export declare const defaultConfig: TypiaPlugin["Config"];
3
+ /**
4
+ * Type helper for Typia plugin, returns {@link Plugin.Config} object
5
+ */
6
+ export declare const defineConfig: (userConfig?: Omit<import("./types").UserConfig, "name"> | undefined) => Omit<import("@hey-api/shared").Plugin.Config<import("@hey-api/shared").Plugin.Types<import("./types").UserConfig, import("./types").Config, import("./api").IApi>>, "name"> & {
7
+ name: any;
8
+ };
9
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,QAAQ,CA+C/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY;;CAAoC,CAAC"}
package/dist/config.js ADDED
@@ -0,0 +1,55 @@
1
+ import { definePluginConfig, mappers } from "@hey-api/shared";
2
+ import { Api } from "./api";
3
+ import { handler } from "./plugin";
4
+ export const defaultConfig = {
5
+ api: new Api(),
6
+ config: {
7
+ case: "camelCase",
8
+ comments: true,
9
+ includeInEntry: false,
10
+ jsonSchema: true,
11
+ requests: {
12
+ case: "camelCase",
13
+ enabled: true,
14
+ jsonName: "t{{name}}DataJsonSchema",
15
+ name: "t{{name}}Data",
16
+ },
17
+ responses: {
18
+ case: "camelCase",
19
+ enabled: true,
20
+ jsonName: "t{{name}}ResponseJsonSchema",
21
+ name: "t{{name}}Response",
22
+ },
23
+ },
24
+ dependencies: ["@hey-api/transformers", "@hey-api/typescript"],
25
+ handler,
26
+ name: "@ir-kit/openapi-ts-typia",
27
+ resolveConfig: (plugin, context) => {
28
+ plugin.config.requests = context.valueToObject({
29
+ defaultValue: {
30
+ case: plugin.config.case ?? "camelCase",
31
+ enabled: true,
32
+ jsonName: "t{{name}}DataJsonSchema",
33
+ name: "t{{name}}Data",
34
+ },
35
+ mappers,
36
+ value: plugin.config.requests,
37
+ });
38
+ plugin.config.responses = context.valueToObject({
39
+ defaultValue: {
40
+ case: plugin.config.case ?? "camelCase",
41
+ enabled: true,
42
+ jsonName: "t{{name}}ResponseJsonSchema",
43
+ name: "t{{name}}Response",
44
+ },
45
+ mappers,
46
+ value: plugin.config.responses,
47
+ });
48
+ },
49
+ tags: ["validator"],
50
+ };
51
+ /**
52
+ * Type helper for Typia plugin, returns {@link Plugin.Config} object
53
+ */
54
+ export const defineConfig = definePluginConfig(defaultConfig);
55
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGnC,MAAM,CAAC,MAAM,aAAa,GAA0B;IAClD,GAAG,EAAE,IAAI,GAAG,EAAE;IACd,MAAM,EAAE;QACN,IAAI,EAAE,WAAW;QACjB,QAAQ,EAAE,IAAI;QACd,cAAc,EAAE,KAAK;QACrB,UAAU,EAAE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export { typiaTypeTransformer } from "./shared/type-transformer";
4
+ export type { TypiaPlugin } from "./types";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAC;AAEjB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import "./types";
2
+ export { defaultConfig, defineConfig } from "./config";
3
+ export { typiaTypeTransformer } from "./shared/type-transformer";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAC;AAEjB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { ConditionalSchemaConverter } from "@orpc/openapi";
2
+ declare const COMPONENTS_EXPORT_NAME = "typiaJsonComponents";
3
+ interface TypiaJsonComponents {
4
+ readonly schemas?: Readonly<Record<string, unknown>>;
5
+ }
6
+ export type TypiaGeneratedModule = Readonly<Record<string, unknown>> & {
7
+ readonly [COMPONENTS_EXPORT_NAME]?: TypiaJsonComponents;
8
+ };
9
+ export interface CreateTypiaSchemaConverterOptions {
10
+ readonly twinSuffix?: string;
11
+ }
12
+ export declare function createTypiaSchemaConverter(generatedModule: TypiaGeneratedModule, options?: CreateTypiaSchemaConverterOptions): ConditionalSchemaConverter;
13
+ export {};
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/orpc/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,0BAA0B,EAG3B,MAAM,eAAe,CAAC;AAGvB,QAAA,MAAM,sBAAsB,wBAAwB,CAAC;AAGrD,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACtD;AAED,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG;IACrE,QAAQ,CAAC,CAAC,sBAAsB,CAAC,CAAC,EAAE,mBAAmB,CAAC;CACzD,CAAC;AAEF,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,oBAAoB,EACrC,OAAO,GAAE,iCAAsC,GAC9C,0BAA0B,CAuC5B"}
@@ -0,0 +1,63 @@
1
+ const TWIN_SUFFIX = "JsonSchema";
2
+ const COMPONENTS_EXPORT_NAME = "typiaJsonComponents";
3
+ const REF_PREFIX = "#/components/schemas/";
4
+ export function createTypiaSchemaConverter(generatedModule, options = {}) {
5
+ const twinSuffix = options.twinSuffix ?? TWIN_SUFFIX;
6
+ const componentSchemas = (generatedModule[COMPONENTS_EXPORT_NAME]?.schemas ??
7
+ {});
8
+ // SmartCoercionPlugin's coercer doesn't forward a components map,
9
+ // so $refs must be inlined at build time.
10
+ const twinByValidator = new WeakMap();
11
+ for (const [key, value] of Object.entries(generatedModule)) {
12
+ if (key.endsWith(twinSuffix))
13
+ continue;
14
+ if (typeof value !== "function")
15
+ continue;
16
+ const twin = generatedModule[`${key}${twinSuffix}`];
17
+ if (twin === undefined)
18
+ continue;
19
+ twinByValidator.set(value, inlineRefs(twin, componentSchemas));
20
+ }
21
+ return {
22
+ condition(schema, _options) {
23
+ return isTypiaValidator(schema) && twinByValidator.has(schema);
24
+ },
25
+ convert(schema, _options) {
26
+ const twin = twinByValidator.get(schema);
27
+ if (twin === undefined) {
28
+ throw new Error("createTypiaSchemaConverter: missing JSON schema twin for validator");
29
+ }
30
+ return [true, twin];
31
+ },
32
+ };
33
+ }
34
+ function isTypiaValidator(schema) {
35
+ if (schema === null)
36
+ return false;
37
+ if (typeof schema !== "object" && typeof schema !== "function")
38
+ return false;
39
+ const std = schema["~standard"];
40
+ return std?.vendor === "typia";
41
+ }
42
+ function inlineRefs(node, components, seen = new Set()) {
43
+ if (Array.isArray(node))
44
+ return node.map((item) => inlineRefs(item, components, seen));
45
+ if (node === null || typeof node !== "object")
46
+ return node;
47
+ const obj = node;
48
+ const ref = obj.$ref;
49
+ if (typeof ref === "string" && ref.startsWith(REF_PREFIX)) {
50
+ const name = ref.slice(REF_PREFIX.length);
51
+ if (seen.has(name))
52
+ return { ...obj };
53
+ const target = components[name];
54
+ if (target === undefined)
55
+ return { ...obj };
56
+ return inlineRefs(target, components, new Set(seen).add(name));
57
+ }
58
+ const out = {};
59
+ for (const [k, v] of Object.entries(obj))
60
+ out[k] = inlineRefs(v, components, seen);
61
+ return out;
62
+ }
63
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/orpc/index.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,GAAG,YAAY,CAAC;AACjC,MAAM,sBAAsB,GAAG,qBAAqB,CAAC;AACrD,MAAM,UAAU,GAAG,uBAAuB,CAAC;AAc3C,MAAM,UAAU,0BAA0B,CACxC,eAAqC,EACrC,UAA6C,EAAE;IAE/C,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,WAAW,CAAC;IACrD,MAAM,gBAAgB,GAAG,CAAC,eAAe,CAAC,sBAAsB,CAAC,EAAE,OAAO;QACxE,EAAE,CAA4B,CAAC;IAEjC,kEAAkE;IAClE,0CAA0C;IAC1C,MAAM,eAAe,GAAG,IAAI,OAAO,EAAsB,CAAC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appingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG3C,eAAO,MAAM,OAAO,EAAE,WAAW,CAAC,SAAS,CAA6B,CAAC"}
package/dist/plugin.js ADDED
@@ -0,0 +1,3 @@
1
+ import { handlerV1 } from "./v1/plugin";
2
+ export const handler = (args) => handlerV1(args);
3
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,CAAC,MAAM,OAAO,GAA2B,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,59 @@
1
+ import type { Symbol } from "@hey-api/codegen-core";
2
+ import { type Casing, type NameTransformer } from "@hey-api/shared";
3
+ import type { TypiaPlugin } from "../types";
4
+ import type { RequestInputType } from "./operation";
5
+ interface RegisterSymbolArgs {
6
+ meta: {
7
+ resource: "definition" | "operation";
8
+ resourceId: string;
9
+ role: string;
10
+ tags?: ReadonlyArray<string>;
11
+ };
12
+ naming: {
13
+ case: Casing;
14
+ name: NameTransformer;
15
+ };
16
+ namingAnchor: string;
17
+ plugin: TypiaPlugin["Instance"];
18
+ }
19
+ /** Registers a symbol; caller owns node emission (bulk JSON index correlation). */
20
+ export declare function registerTypiaSymbol({ meta, naming, namingAnchor, plugin, }: RegisterSymbolArgs): Symbol;
21
+ interface EmitValidatorArgs {
22
+ comment?: ReadonlyArray<string>;
23
+ plugin: TypiaPlugin["Instance"];
24
+ symbol: Symbol;
25
+ typeExpr: RequestInputType;
26
+ }
27
+ /**
28
+ * Emits `export const <name>: StandardSchemaV1<T, T> & ((input) => IValidation<T>) = createValidate<T>()`.
29
+ * Explicit annotation keeps `tsc --declaration` from leaking transitive types.
30
+ */
31
+ export declare function emitValidator({ comment, plugin, symbol, typeExpr, }: EmitValidatorArgs): void;
32
+ interface EmitBulkJsonSchemasArgs {
33
+ plugin: TypiaPlugin["Instance"];
34
+ typeExprs: ReadonlyArray<RequestInputType>;
35
+ }
36
+ /** Emits `const __typiaSchemas = typia.json.schemas<[...]>()`; tuple order drives twin indexing. */
37
+ export declare function emitBulkJsonSchemas({ plugin, typeExprs, }: EmitBulkJsonSchemasArgs): Symbol;
38
+ interface EmitJsonSchemaTwinArgs {
39
+ bulkSymbol: Symbol;
40
+ index: number;
41
+ plugin: TypiaPlugin["Instance"];
42
+ symbol: Symbol;
43
+ }
44
+ /**
45
+ * Emits `export const <name> = typiaSchemas.schemas[i]`.
46
+ */
47
+ export declare function emitJsonSchemaTwin({ bulkSymbol, index, plugin, symbol, }: EmitJsonSchemaTwinArgs): void;
48
+ interface EmitJsonComponentsArgs {
49
+ bulkSymbol: Symbol;
50
+ plugin: TypiaPlugin["Instance"];
51
+ }
52
+ /**
53
+ * Emits `export const typiaJsonComponents = typiaSchemas.components;` so
54
+ * consumers (e.g. an oRPC SmartCoercion converter) can resolve `$ref`s that
55
+ * typia's JSON schemas point into `#/components/schemas/...`.
56
+ */
57
+ export declare function emitJsonComponents({ bulkSymbol, plugin, }: EmitJsonComponentsArgs): Symbol;
58
+ export {};
59
+ //# sourceMappingURL=emit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../src/shared/emit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAEL,KAAK,MAAM,EACX,KAAK,eAAe,EACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;A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;AACH,wBAAgB,kBAAkB,CAAC,EACjC,UAAU,EACV,KAAK,EACL,MAAM,EACN,MAAM,GACP,EAAE,sBAAsB,GAAG,IAAI,CAG/B;AAED,UAAU,sBAAsB;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC;CACjC;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,UAAU,EACV,MAAM,GACP,EAAE,sBAAsB,GAAG,MAAM,CAoBjC"}
@@ -0,0 +1,91 @@
1
+ import { $ } from "@hey-api/openapi-ts";
2
+ import { buildSymbolIn, } from "@hey-api/shared";
3
+ const BULK_SCHEMAS_NAME = "typiaSchemas";
4
+ /** Registers a symbol; caller owns node emission (bulk JSON index correlation). */
5
+ export function registerTypiaSymbol({ meta, naming, namingAnchor, plugin, }) {
6
+ return plugin.registerSymbol(buildSymbolIn({
7
+ meta: {
8
+ category: "schema",
9
+ tool: "@ir-kit/openapi-ts-typia",
10
+ ...meta,
11
+ },
12
+ name: namingAnchor,
13
+ naming,
14
+ plugin,
15
+ schema: {},
16
+ }));
17
+ }
18
+ /**
19
+ * Emits `export const <name>: StandardSchemaV1<T, T> & ((input) => IValidation<T>) = createValidate<T>()`.
20
+ * Explicit annotation keeps `tsc --declaration` from leaking transitive types.
21
+ */
22
+ export function emitValidator({ comment, plugin, symbol, typeExpr, }) {
23
+ const createValidate = plugin.external("typia.createValidate");
24
+ const iValidation = plugin.external("typia.IValidation");
25
+ const standardSchema = plugin.external("@standard-schema/spec.StandardSchemaV1");
26
+ const callable = $.type
27
+ .func()
28
+ .param("input", (p) => p.type($.type("unknown")))
29
+ .returns($.type(iValidation).generic(typeExpr));
30
+ const annotation = $.type.and($.type(standardSchema).generic(typeExpr).generic(typeExpr), callable);
31
+ plugin.node($.const(symbol)
32
+ .export()
33
+ .$if(comment, (c, v) => c.doc(v))
34
+ .type(annotation)
35
+ .assign($(createValidate).call().generic(typeExpr)));
36
+ }
37
+ /** Emits `const __typiaSchemas = typia.json.schemas<[...]>()`; tuple order drives twin indexing. */
38
+ export function emitBulkJsonSchemas({ plugin, typeExprs, }) {
39
+ const json = plugin.external("typia.json");
40
+ const symbol = plugin.registerSymbol(buildSymbolIn({
41
+ meta: {
42
+ category: "schema",
43
+ resource: "definition",
44
+ resourceId: BULK_SCHEMAS_NAME,
45
+ role: "bulk-json",
46
+ tool: "@ir-kit/openapi-ts-typia",
47
+ },
48
+ name: BULK_SCHEMAS_NAME,
49
+ naming: { case: "camelCase", name: BULK_SCHEMAS_NAME },
50
+ plugin,
51
+ schema: {},
52
+ }));
53
+ const value = $(json)
54
+ .attr("schemas")
55
+ .call()
56
+ .generic($.type.tuple(...typeExprs));
57
+ plugin.node($.const(symbol).export().assign(value));
58
+ return symbol;
59
+ }
60
+ /**
61
+ * Emits `export const <name> = typiaSchemas.schemas[i]`.
62
+ */
63
+ export function emitJsonSchemaTwin({ bulkSymbol, index, plugin, symbol, }) {
64
+ const value = $(bulkSymbol).attr("schemas").attr(index).computed();
65
+ plugin.node($.const(symbol).export().assign(value));
66
+ }
67
+ /**
68
+ * Emits `export const typiaJsonComponents = typiaSchemas.components;` so
69
+ * consumers (e.g. an oRPC SmartCoercion converter) can resolve `$ref`s that
70
+ * typia's JSON schemas point into `#/components/schemas/...`.
71
+ */
72
+ export function emitJsonComponents({ bulkSymbol, plugin, }) {
73
+ const name = "typiaJsonComponents";
74
+ const symbol = plugin.registerSymbol(buildSymbolIn({
75
+ meta: {
76
+ category: "schema",
77
+ resource: "definition",
78
+ resourceId: name,
79
+ role: "components",
80
+ tool: "@ir-kit/openapi-ts-typia",
81
+ },
82
+ name,
83
+ naming: { case: "camelCase", name },
84
+ plugin,
85
+ schema: {},
86
+ }));
87
+ const value = $(bulkSymbol).attr("components");
88
+ plugin.node($.const(symbol).export().assign(value));
89
+ return symbol;
90
+ }
91
+ //# sourceMappingURL=emit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"emit.js","sour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C,CAAC;IACpD,OAAO,MAAM,CAAC;AAChB,CAAC;AASD;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,EACjC,UAAU,EACV,KAAK,EACL,MAAM,EACN,MAAM,GACiB;IACvB,MAAM,KAAK,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC;IACnE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACtD,CAAC;AAOD;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,EACjC,UAAU,EACV,MAAM,GACiB;IACvB,MAAM,IAAI,GAAG,qBAAqB,CAAC;IACnC,MAAM,MAAM,GAAG,MAAM,CAAC,cAAc,CAClC,aAAa,CAAC;QACZ,IAAI,EAAE;YACJ,QAAQ,EAAE,QAAQ;YAClB,QAAQ,EAAE,YAAY;YACtB,UAAU,EAAE,IAAI;YAChB,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,0BAA0B;SACjC;QACD,IAAI;QACJ,MAAM,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE;QACnC,MAAM;QACN,MAAM,EAAE,EAAE;KACX,CAAC,CACH,CAAC;IACF,MAAM,KAAK,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAC/C,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACpD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { Symbol } from "@hey-api/codegen-core";
2
+ import { type MaybeTsDsl, type TypeTsDsl } from "@hey-api/openapi-ts";
3
+ import type { IR } from "@hey-api/shared";
4
+ import ts from "typescript";
5
+ import type { TypiaPlugin } from "../types";
6
+ export type RequestInputType = MaybeTsDsl<TypeTsDsl<ts.TypeNode>>;
7
+ export declare function queryDataTypeSymbol(plugin: TypiaPlugin["Instance"], operation: IR.OperationObject): Symbol | undefined;
8
+ export declare function queryResponseTypeSymbol(plugin: TypiaPlugin["Instance"], operation: IR.OperationObject): Symbol | undefined;
9
+ export declare function queryErrorsTypeSymbol(plugin: TypiaPlugin["Instance"], operation: IR.OperationObject): Symbol | undefined;
10
+ export declare function buildRequestInputType(dataSymbol: Symbol): RequestInputType;
11
+ //# sourceMappingURL=operation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../src/shared/operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAK,KAAK,UAAU,EAAS,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;AAuDlE,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,WAAW,CAAC,UAAU,CAAC,EAC/B,SAAS,EAAE,EAAE,CAAC,eAAe,GAC5B,MAAM,GAAG,SAAS,CAQpB;AAED,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,WAAW,CAAC,UAAU,CAAC,EAC/B,SAAS,EAAE,EAAE,CAAC,eAAe,GAC5B,MAAM,GAAG,SAAS,CAQpB;AAED,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,WAAW,CAAC,UAAU,CAAC,EAC/B,SAAS,EAAE,EAAE,CAAC,eAAe,GAC5B,MAAM,GAAG,SAAS,CAQpB;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,CAuB1E"}