@apollo-deploy/tesseract 1.8.0 → 2.0.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 (194) hide show
  1. package/README.md +218 -110
  2. package/dist/adapters/csharp/index.d.ts +5 -8
  3. package/dist/adapters/csharp/index.d.ts.map +1 -1
  4. package/dist/adapters/csharp/index.js +314 -74
  5. package/dist/adapters/csharp/index.js.map +1 -1
  6. package/dist/adapters/documentation.d.ts +17 -0
  7. package/dist/adapters/documentation.d.ts.map +1 -0
  8. package/dist/adapters/documentation.js +268 -0
  9. package/dist/adapters/documentation.js.map +1 -0
  10. package/dist/adapters/go/index.d.ts +5 -8
  11. package/dist/adapters/go/index.d.ts.map +1 -1
  12. package/dist/adapters/go/index.js +197 -101
  13. package/dist/adapters/go/index.js.map +1 -1
  14. package/dist/adapters/kotlin/index.d.ts +5 -9
  15. package/dist/adapters/kotlin/index.d.ts.map +1 -1
  16. package/dist/adapters/kotlin/index.js +280 -212
  17. package/dist/adapters/kotlin/index.js.map +1 -1
  18. package/dist/adapters/php/index.d.ts +5 -15
  19. package/dist/adapters/php/index.d.ts.map +1 -1
  20. package/dist/adapters/php/index.js +362 -90
  21. package/dist/adapters/php/index.js.map +1 -1
  22. package/dist/adapters/python/index.d.ts +5 -8
  23. package/dist/adapters/python/index.d.ts.map +1 -1
  24. package/dist/adapters/python/index.js +240 -109
  25. package/dist/adapters/python/index.js.map +1 -1
  26. package/dist/adapters/ruby/index.d.ts +3 -3
  27. package/dist/adapters/ruby/index.d.ts.map +1 -1
  28. package/dist/adapters/ruby/index.js +235 -46
  29. package/dist/adapters/ruby/index.js.map +1 -1
  30. package/dist/adapters/rust/index.d.ts +5 -9
  31. package/dist/adapters/rust/index.d.ts.map +1 -1
  32. package/dist/adapters/rust/index.js +237 -169
  33. package/dist/adapters/rust/index.js.map +1 -1
  34. package/dist/adapters/shared.d.ts +7 -0
  35. package/dist/adapters/shared.d.ts.map +1 -0
  36. package/dist/adapters/shared.js +68 -0
  37. package/dist/adapters/shared.js.map +1 -0
  38. package/dist/adapters/type-utils.d.ts +13 -0
  39. package/dist/adapters/type-utils.d.ts.map +1 -0
  40. package/dist/adapters/type-utils.js +105 -0
  41. package/dist/adapters/type-utils.js.map +1 -0
  42. package/dist/adapters/types.d.ts.map +1 -1
  43. package/dist/adapters/typescript/emitter/emitSchema.d.ts +2 -2
  44. package/dist/adapters/typescript/emitter/emitSchema.js +39 -27
  45. package/dist/adapters/typescript/emitter/emitSchema.js.map +1 -1
  46. package/dist/adapters/typescript/emitter/emitTypeScriptModels.d.ts +2 -2
  47. package/dist/adapters/typescript/emitter/emitTypeScriptModels.js +15 -15
  48. package/dist/adapters/typescript/emitter/importCollector.d.ts +2 -4
  49. package/dist/adapters/typescript/emitter/importCollector.d.ts.map +1 -1
  50. package/dist/adapters/typescript/emitter/importCollector.js +40 -50
  51. package/dist/adapters/typescript/emitter/importCollector.js.map +1 -1
  52. package/dist/adapters/typescript/emitter/parsers.d.ts +1 -1
  53. package/dist/adapters/typescript/emitter/parsers.js +13 -13
  54. package/dist/adapters/typescript/emitter/typeHoister.d.ts +1 -1
  55. package/dist/adapters/typescript/emitter/typeHoister.d.ts.map +1 -1
  56. package/dist/adapters/typescript/emitter/typeHoister.js +12 -20
  57. package/dist/adapters/typescript/emitter/typeHoister.js.map +1 -1
  58. package/dist/adapters/typescript/index.d.ts +3 -3
  59. package/dist/adapters/typescript/index.d.ts.map +1 -1
  60. package/dist/adapters/typescript/index.js +148 -166
  61. package/dist/adapters/typescript/index.js.map +1 -1
  62. package/dist/adapters/typescript/shared.d.ts +2 -2
  63. package/dist/adapters/typescript/shared.js +12 -12
  64. package/dist/cli.js +50 -37
  65. package/dist/cli.js.map +1 -1
  66. package/dist/collector.d.ts +77 -3
  67. package/dist/collector.d.ts.map +1 -1
  68. package/dist/collector.js +198 -20
  69. package/dist/collector.js.map +1 -1
  70. package/dist/elysia.js +2 -2
  71. package/dist/elysia.js.map +1 -1
  72. package/dist/express.d.ts.map +1 -1
  73. package/dist/express.js.map +1 -1
  74. package/dist/fastify.d.ts +8 -9
  75. package/dist/fastify.d.ts.map +1 -1
  76. package/dist/fastify.js +105 -164
  77. package/dist/fastify.js.map +1 -1
  78. package/dist/helpers/handlebars.d.ts +7 -16
  79. package/dist/helpers/handlebars.d.ts.map +1 -1
  80. package/dist/helpers/handlebars.js +127 -177
  81. package/dist/helpers/handlebars.js.map +1 -1
  82. package/dist/hono.d.ts.map +1 -1
  83. package/dist/hono.js.map +1 -1
  84. package/dist/index.d.ts +14 -12
  85. package/dist/index.d.ts.map +1 -1
  86. package/dist/index.js +32 -30
  87. package/dist/index.js.map +1 -1
  88. package/dist/koa.d.ts.map +1 -1
  89. package/dist/koa.js.map +1 -1
  90. package/dist/nestjs.d.ts.map +1 -1
  91. package/dist/nestjs.js +41 -14
  92. package/dist/nestjs.js.map +1 -1
  93. package/dist/pipeline/enrich.d.ts +2 -13
  94. package/dist/pipeline/enrich.d.ts.map +1 -1
  95. package/dist/pipeline/enrich.js +157 -212
  96. package/dist/pipeline/enrich.js.map +1 -1
  97. package/dist/pipeline/intake.d.ts +3 -3
  98. package/dist/pipeline/intake.d.ts.map +1 -1
  99. package/dist/pipeline/intake.js +342 -238
  100. package/dist/pipeline/intake.js.map +1 -1
  101. package/dist/pipeline/write.d.ts +1 -14
  102. package/dist/pipeline/write.d.ts.map +1 -1
  103. package/dist/pipeline/write.js +73 -113
  104. package/dist/pipeline/write.js.map +1 -1
  105. package/dist/types/config.d.ts +14 -26
  106. package/dist/types/config.d.ts.map +1 -1
  107. package/dist/types/config.js +16 -12
  108. package/dist/types/config.js.map +1 -1
  109. package/dist/types/ir.d.ts +12 -8
  110. package/dist/types/ir.d.ts.map +1 -1
  111. package/dist/types/manifest.d.ts +10 -11
  112. package/dist/types/manifest.d.ts.map +1 -1
  113. package/dist/types/manifest.js +54 -14
  114. package/dist/types/manifest.js.map +1 -1
  115. package/dist/types/sdk-module.d.ts +2 -2
  116. package/dist/types/sdk-module.js +1 -1
  117. package/dist/utils/format.d.ts +1 -3
  118. package/dist/utils/format.d.ts.map +1 -1
  119. package/dist/utils/format.js +3 -10
  120. package/dist/utils/format.js.map +1 -1
  121. package/dist/utils/naming.d.ts.map +1 -1
  122. package/dist/utils/naming.js +174 -184
  123. package/dist/utils/naming.js.map +1 -1
  124. package/dist/utils/npm-token.d.ts +1 -17
  125. package/dist/utils/npm-token.d.ts.map +1 -1
  126. package/dist/utils/npm-token.js +27 -76
  127. package/dist/utils/npm-token.js.map +1 -1
  128. package/dist/utils/version.d.ts +14 -0
  129. package/dist/utils/version.d.ts.map +1 -0
  130. package/dist/utils/version.js +60 -0
  131. package/dist/utils/version.js.map +1 -0
  132. package/package.json +4 -3
  133. package/templates/csharp/client.hbs +26 -49
  134. package/templates/csharp/csproj.hbs +7 -0
  135. package/templates/csharp/domain.hbs +48 -130
  136. package/templates/csharp/errors.hbs +17 -25
  137. package/templates/csharp/readme.hbs +31 -44
  138. package/templates/csharp/transport.hbs +238 -136
  139. package/templates/csharp/types.hbs +30 -76
  140. package/templates/go/client.hbs +44 -109
  141. package/templates/go/domain.hbs +83 -25
  142. package/templates/go/go-mod.hbs +1 -4
  143. package/templates/go/readme.hbs +32 -29
  144. package/templates/go/transport.hbs +174 -173
  145. package/templates/go/types.hbs +17 -53
  146. package/templates/go/utils.hbs +3 -2
  147. package/templates/kotlin/build-gradle.hbs +1 -1
  148. package/templates/kotlin/client.hbs +18 -15
  149. package/templates/kotlin/domain.hbs +54 -51
  150. package/templates/kotlin/errors.hbs +1 -1
  151. package/templates/kotlin/readme.hbs +35 -137
  152. package/templates/kotlin/transport.hbs +140 -123
  153. package/templates/kotlin/types.hbs +30 -81
  154. package/templates/php/client.hbs +8 -46
  155. package/templates/php/composer.hbs +2 -1
  156. package/templates/php/domain.hbs +86 -117
  157. package/templates/php/errors.hbs +1 -1
  158. package/templates/php/readme.hbs +42 -49
  159. package/templates/php/transport.hbs +192 -145
  160. package/templates/php/types.hbs +63 -60
  161. package/templates/python/client.hbs +15 -2
  162. package/templates/python/domain.hbs +50 -108
  163. package/templates/python/pyproject.hbs +5 -0
  164. package/templates/python/readme.hbs +47 -30
  165. package/templates/python/resources-init.hbs +1 -1
  166. package/templates/python/transport.hbs +167 -53
  167. package/templates/python/types.hbs +22 -58
  168. package/templates/ruby/client.hbs +10 -6
  169. package/templates/ruby/domain.hbs +48 -67
  170. package/templates/ruby/errors.hbs +3 -3
  171. package/templates/ruby/gemspec.hbs +3 -10
  172. package/templates/ruby/index.hbs +3 -3
  173. package/templates/ruby/readme.hbs +33 -70
  174. package/templates/ruby/transport.hbs +129 -103
  175. package/templates/ruby/types.hbs +11 -16
  176. package/templates/ruby/version.hbs +1 -1
  177. package/templates/rust/cargo.hbs +2 -0
  178. package/templates/rust/client.hbs +10 -1
  179. package/templates/rust/domain.hbs +69 -52
  180. package/templates/rust/error.hbs +3 -1
  181. package/templates/rust/lib.hbs +4 -5
  182. package/templates/rust/readme.hbs +33 -46
  183. package/templates/rust/transport.hbs +170 -159
  184. package/templates/rust/types.hbs +34 -111
  185. package/templates/typescript/domain-class.hbs +14 -6
  186. package/templates/typescript/domain.hbs +13 -5
  187. package/templates/typescript/package-json.hbs +3 -1
  188. package/templates/typescript/readme.hbs +42 -42
  189. package/templates/typescript/transport.hbs +46 -8
  190. package/templates/typescript/types-errors.hbs +1 -1
  191. package/dist/adapters/typescript/model-emitter.d.ts +0 -13
  192. package/dist/adapters/typescript/model-emitter.d.ts.map +0 -1
  193. package/dist/adapters/typescript/model-emitter.js +0 -415
  194. package/dist/adapters/typescript/model-emitter.js.map +0 -1
package/README.md CHANGED
@@ -26,22 +26,36 @@ This reads your manifest and produces a complete npm-ready TypeScript SDK in `./
26
26
 
27
27
  Generate an SDK from a static manifest file.
28
28
 
29
- | Flag | Required | Description |
30
- |------|----------|-------------|
31
- | `-i, --input <path>` | Yes | Path to the `sdk-manifold/v1` manifest JSON file |
32
- | `-o, --output <dir>` | Yes | Output directory for the generated SDK |
33
- | `-l, --language <lang>` | No | Target language: `typescript` (default), `python`, `ruby`, `php`, `go`, `rust`, `kotlin`, `csharp` |
34
- | `-n, --name <name>` | No | Override the npm package name |
35
- | `--package-version <version>` | No | Override the generated package version |
36
- | `--client-name <name>` | No | Override the generated client class name |
37
- | `--base-url <url>` | No | Override the default base URL |
38
- | `--sdk-style <style>` | No | `functional` (default) or `class` (Resend-style `new MySDK('key')`) |
39
- | `--client-type <type>` | No | `internal` (full options, default) or `public` (auth key only, baseUrl baked in) |
40
- | `--dry-run` | No | Preview changes without writing files |
41
- | `--check` | No | Exit non-zero if generated output is out of date |
29
+ | Flag | Required | Description |
30
+ | ----------------------------- | -------- | -------------------------------------------------------------------------------------------------- |
31
+ | `-i, --input <path>` | Yes | Path to the `sdk-manifold/v1` manifest JSON file |
32
+ | `-o, --output <dir>` | Yes | Output directory for the generated SDK |
33
+ | `-l, --language <lang>` | No | Target language: `typescript` (default), `python`, `ruby`, `php`, `go`, `rust`, `kotlin`, `csharp` |
34
+ | `-n, --name <name>` | No | Override the npm package name |
35
+ | `--package-version <version>` | No | Override the generated package version |
36
+ | `--version-bump <type>` | No | Automatic bump type: `patch` (default), `minor`, or `major` |
37
+ | `--client-name <name>` | No | Override the generated client class name |
38
+ | `--base-url <url>` | No | Override the default base URL |
39
+ | `--sdk-style <style>` | No | `functional` (default) or `class` (Resend-style `new MySDK('key')`) |
40
+ | `--client-type <type>` | No | `internal` (full options, default) or `public` (auth key only, baseUrl baked in) |
41
+ | `--dry-run` | No | Preview changes without writing files |
42
+ | `--check` | No | Exit non-zero if generated output is out of date |
42
43
 
43
44
  `--dry-run` and `--check` are mutually exclusive.
44
45
 
46
+ ### Versioning
47
+
48
+ When `packageVersion` is omitted, Tesseract applies `versionBump` to the current package version. TypeScript checks npm first and falls back to `info.version`; other adapters use `info.version`. The default bump is `patch`.
49
+
50
+ Patch and minor components use decimal carry instead of double digits:
51
+
52
+ - `0.0.9` + patch → `0.1.0`
53
+ - `0.9.9` + patch → `1.0.0`
54
+ - `2.9.4` + minor → `3.0.0`
55
+ - `2.8.7` + major → `3.0.0`
56
+
57
+ Set the policy with `--version-bump`, `versionBump` in generator/collector config, or `info.versionBump` in a static manifest. An explicit `packageVersion` always wins.
58
+
45
59
  ### `tesseract run`
46
60
 
47
61
  Boot an instrumented Fastify app with `TESSERACT_GENERATE=1` to collect annotated routes at runtime and generate an SDK without a static manifest file.
@@ -56,16 +70,16 @@ The app must register `tesseractPlugin` from `@apollo-deploy/tesseract/fastify`.
56
70
 
57
71
  Tesseract ships adapters for multiple target languages. Pass `-l <lang>` to `tesseract generate`, set `language` in `CollectorOptions`, or use `additionalTargets` to emit multiple languages in a single run.
58
72
 
59
- | Language | Value | Output |
60
- |----------|-------|--------|
61
- | TypeScript | `typescript` | npm-ready package with Axios transport |
62
- | Python | `python` | pip-ready package |
63
- | Ruby | `ruby` | gem-ready package |
64
- | PHP | `php` | Composer package |
65
- | Go | `go` | Go module |
66
- | Rust | `rust` | Cargo crate |
67
- | Kotlin | `kotlin` | Gradle project with Ktor + kotlinx.serialization |
68
- | C# | `csharp` | NuGet package |
73
+ | Language | Value | Output |
74
+ | ---------- | ------------ | ------------------------------------------------ |
75
+ | TypeScript | `typescript` | npm-ready package with Axios transport |
76
+ | Python | `python` | pip-ready package |
77
+ | Ruby | `ruby` | gem-ready package |
78
+ | PHP | `php` | Composer package |
79
+ | Go | `go` | Go module |
80
+ | Rust | `rust` | Cargo crate |
81
+ | Kotlin | `kotlin` | Gradle project with Ktor + kotlinx.serialization |
82
+ | C# | `csharp` | NuGet package |
69
83
 
70
84
  ### Multiple targets in one run
71
85
 
@@ -73,8 +87,12 @@ Use `additionalTargets` on any collector or the Fastify plugin to emit multiple
73
87
 
74
88
  ```ts
75
89
  const collector = new SDKCollector({
76
- info: { title: 'My API', version: '1.0.0', baseUrl: 'https://api.example.com' },
77
- output: './sdk/typescript', // primary — TypeScript
90
+ info: {
91
+ title: 'My API',
92
+ version: '1.0.0',
93
+ baseUrl: 'https://api.example.com',
94
+ },
95
+ output: './sdk/typescript', // primary — TypeScript
78
96
  additionalTargets: [
79
97
  { language: 'kotlin', output: './sdk/java' },
80
98
  { language: 'python', output: './sdk/python', packageName: 'my-api' },
@@ -84,6 +102,39 @@ const collector = new SDKCollector({
84
102
 
85
103
  Each additional target inherits `clientType`, `packageName`, `packageVersion`, and `sdkStyle` from the primary options unless overridden per-target.
86
104
 
105
+ Non-TypeScript additional targets automatically expand registered Zod / `$defs` types into local models (they cannot import a TypeScript `schemaPackage`). TypeScript additional targets inherit `schemaPackage` and re-export those types instead of regenerating them.
106
+
107
+ ## Generated SDK structure
108
+
109
+ Every adapter emits a compact package overview and a separate reference tree:
110
+
111
+ ```text
112
+ README.md
113
+ docs/
114
+ ├── README.md # documentation index
115
+ ├── types.md # generated models, enums, unions, and aliases
116
+ └── domains/
117
+ ├── users.md # operations for one API domain
118
+ └── billing.md
119
+ ```
120
+
121
+ The root README contains installation, quick start, reliability configuration, error handling, and links into the reference. Domain pages document HTTP paths, parameters by location, request bodies, response types, deprecations, streaming behavior, and links to generated source.
122
+
123
+ ### Generated transport reliability
124
+
125
+ Generated transports share the same baseline behavior across all target languages:
126
+
127
+ - Bounded request timeouts and cancellation where the language supports it
128
+ - Structured errors with status, code, message, and request ID
129
+ - Retries for transient network failures and HTTP `408`, `425`, `429`, `500`, `502`, `503`, and `504`
130
+ - Exponential backoff with jitter and `Retry-After` support
131
+ - Automatic retries for idempotent methods only
132
+ - `POST` and `PATCH` retries only when explicitly enabled or an `X-Idempotency-Key` is supplied
133
+ - Default headers and a generated SDK user agent where the runtime permits it
134
+ - Explicit client cleanup for transports that own sockets or connection pools
135
+
136
+ The exact option names follow each target language's conventions and are shown in the generated README.
137
+
87
138
  ## Input: The Manifest
88
139
 
89
140
  Tesseract consumes a `BackendManifest` JSON file with `$schema: "sdk-manifold/v1"`:
@@ -94,6 +145,7 @@ Tesseract consumes a `BackendManifest` JSON file with `$schema: "sdk-manifold/v1
94
145
  "info": {
95
146
  "title": "My API",
96
147
  "version": "1.0.0",
148
+ "versionBump": "patch",
97
149
  "description": "An example API",
98
150
  "baseUrl": "https://api.example.com"
99
151
  },
@@ -129,7 +181,7 @@ Tesseract consumes a `BackendManifest` JSON file with `$schema: "sdk-manifold/v1
129
181
 
130
182
  ### Key Manifest Fields
131
183
 
132
- - **`info`** — Title, version, description, and base URL for the API
184
+ - **`info`** — Title, version, optional `versionBump`, description, and base URL for the API
133
185
  - **`domains`** — Groups of routes organized by domain, each with a prefix, stability level (`stable` / `experimental` / `internal`), and route definitions. `internal`-stability domains are excluded from public SDK builds.
134
186
  - **`definitions`** — JSON Schema definitions for shared types
135
187
  - **`schemaPackage`** _(optional)_ — An external npm package to import types from instead of generating them
@@ -147,14 +199,14 @@ Each route in a domain can specify:
147
199
 
148
200
  Tesseract ships adapters for every major Node.js API framework. Each adapter is a separate subpath export so you only pull in what you use.
149
201
 
150
- | Framework | Import |
151
- |-----------|--------|
152
- | **Fastify** | `@apollo-deploy/tesseract/fastify` |
153
- | **Express** | `@apollo-deploy/tesseract/express` |
154
- | **Hono** | `@apollo-deploy/tesseract/hono` |
155
- | **Koa** | `@apollo-deploy/tesseract/koa` |
156
- | **Elysia** | `@apollo-deploy/tesseract/elysia` |
157
- | **NestJS** | `@apollo-deploy/tesseract/nestjs` |
202
+ | Framework | Import |
203
+ | --------------------------- | --------------------------------------------------------- |
204
+ | **Fastify** | `@apollo-deploy/tesseract/fastify` |
205
+ | **Express** | `@apollo-deploy/tesseract/express` |
206
+ | **Hono** | `@apollo-deploy/tesseract/hono` |
207
+ | **Koa** | `@apollo-deploy/tesseract/koa` |
208
+ | **Elysia** | `@apollo-deploy/tesseract/elysia` |
209
+ | **NestJS** | `@apollo-deploy/tesseract/nestjs` |
158
210
  | **Generic / any framework** | `import { SDKCollector } from '@apollo-deploy/tesseract'` |
159
211
 
160
212
  All adapters share the same `CollectorOptions` interface, which means `language` and `additionalTargets` work identically across every framework.
@@ -170,12 +222,14 @@ The Fastify adapter hooks into `onRoute` to collect routes automatically at boot
170
222
  import { tesseractPlugin } from '@apollo-deploy/tesseract/fastify';
171
223
 
172
224
  app.register(tesseractPlugin, {
173
- info: { title: 'My API', version: '1.0.0', baseUrl: 'https://api.example.com' },
225
+ info: {
226
+ title: 'My API',
227
+ version: '1.0.0',
228
+ baseUrl: 'https://api.example.com',
229
+ },
174
230
  output: './packages/api-sdk',
175
231
  // Generate a Kotlin SDK alongside the primary TypeScript one:
176
- additionalTargets: [
177
- { language: 'kotlin', output: './sdk/java' },
178
- ],
232
+ additionalTargets: [{ language: 'kotlin', output: './sdk/java' }],
179
233
  // Optional: import types from a shared package instead of regenerating them
180
234
  schemaPackage: { name: '@my-org/schemas', version: '^2.0.0' },
181
235
  sdkStyle: 'functional', // or 'class'
@@ -188,10 +242,14 @@ The plugin is a complete no-op unless `TESSERACT_GENERATE=1` is set, so it is sa
188
242
  Add `sdk` as a top-level option on each route (sibling to `schema`):
189
243
 
190
244
  ```ts
191
- fastify.get('/:id', {
192
- schema: { response: { 200: UserSchema } },
193
- sdk: { methodName: 'getUser' },
194
- }, handler);
245
+ fastify.get(
246
+ '/:id',
247
+ {
248
+ schema: { response: { 200: UserSchema } },
249
+ sdk: { methodName: 'getUser' },
250
+ },
251
+ handler,
252
+ );
195
253
  ```
196
254
 
197
255
  Use `sdkDomain()` to name the domain and set a description:
@@ -203,10 +261,14 @@ import { sdkDomain } from '@apollo-deploy/tesseract/fastify';
203
261
  export default fp(async (fastify) => {
204
262
  sdkDomain(fastify, { domain: 'users', description: 'User management' });
205
263
 
206
- fastify.get('/:id', {
207
- schema: { response: { 200: UserSchema } },
208
- sdk: { methodName: 'getUser' },
209
- }, handler);
264
+ fastify.get(
265
+ '/:id',
266
+ {
267
+ schema: { response: { 200: UserSchema } },
268
+ sdk: { methodName: 'getUser' },
269
+ },
270
+ handler,
271
+ );
210
272
  });
211
273
  ```
212
274
 
@@ -224,6 +286,7 @@ export class UsersPlugin {
224
286
  ```
225
287
 
226
288
  **Trigger:**
289
+
227
290
  ```bash
228
291
  tesseract run dist/app.js
229
292
  # or
@@ -240,21 +303,29 @@ import { ExpressSDKCollector } from '@apollo-deploy/tesseract/express';
240
303
 
241
304
  const app = express();
242
305
  const collector = new ExpressSDKCollector({
243
- info: { title: 'My API', version: '1.0.0', baseUrl: 'https://api.example.com' },
306
+ info: {
307
+ title: 'My API',
308
+ version: '1.0.0',
309
+ baseUrl: 'https://api.example.com',
310
+ },
244
311
  output: './packages/api-sdk',
245
- additionalTargets: [
246
- { language: 'kotlin', output: './sdk/java' },
247
- ],
312
+ additionalTargets: [{ language: 'kotlin', output: './sdk/java' }],
248
313
  });
249
314
 
250
315
  collector.domain('/users', { domain: 'users', description: 'User management' });
251
316
 
252
- app.get('/users/:id',
253
- collector.expressRoute('/users/:id', 'GET', { sdk: { methodName: 'getUser' } }),
317
+ app.get(
318
+ '/users/:id',
319
+ collector.expressRoute('/users/:id', 'GET', {
320
+ sdk: { methodName: 'getUser' },
321
+ }),
254
322
  getUserHandler,
255
323
  );
256
- app.post('/users',
257
- collector.expressRoute('/users', 'POST', { sdk: { methodName: 'createUser' } }),
324
+ app.post(
325
+ '/users',
326
+ collector.expressRoute('/users', 'POST', {
327
+ sdk: { methodName: 'createUser' },
328
+ }),
258
329
  createUserHandler,
259
330
  );
260
331
 
@@ -276,14 +347,21 @@ import { HonoSDKCollector } from '@apollo-deploy/tesseract/hono';
276
347
 
277
348
  const app = new Hono();
278
349
  const collector = new HonoSDKCollector({
279
- info: { title: 'My API', version: '1.0.0', baseUrl: 'https://api.example.com' },
350
+ info: {
351
+ title: 'My API',
352
+ version: '1.0.0',
353
+ baseUrl: 'https://api.example.com',
354
+ },
280
355
  output: './packages/api-sdk',
281
356
  });
282
357
 
283
358
  collector.domain('/users', { domain: 'users', description: 'User management' });
284
359
 
285
- app.get('/users/:id',
286
- collector.honoMiddleware('/users/:id', 'GET', { sdk: { methodName: 'getUser' } }),
360
+ app.get(
361
+ '/users/:id',
362
+ collector.honoMiddleware('/users/:id', 'GET', {
363
+ sdk: { methodName: 'getUser' },
364
+ }),
287
365
  (c) => c.json(getUser(c.req.param('id'))),
288
366
  );
289
367
 
@@ -306,14 +384,21 @@ import { KoaSDKCollector } from '@apollo-deploy/tesseract/koa';
306
384
  const app = new Koa();
307
385
  const router = new Router();
308
386
  const collector = new KoaSDKCollector({
309
- info: { title: 'My API', version: '1.0.0', baseUrl: 'https://api.example.com' },
387
+ info: {
388
+ title: 'My API',
389
+ version: '1.0.0',
390
+ baseUrl: 'https://api.example.com',
391
+ },
310
392
  output: './packages/api-sdk',
311
393
  });
312
394
 
313
395
  collector.domain('/users', { domain: 'users', description: 'User management' });
314
396
 
315
- router.get('/users/:id',
316
- collector.koaMiddleware('/users/:id', 'GET', { sdk: { methodName: 'getUser' } }),
397
+ router.get(
398
+ '/users/:id',
399
+ collector.koaMiddleware('/users/:id', 'GET', {
400
+ sdk: { methodName: 'getUser' },
401
+ }),
317
402
  getUserHandler,
318
403
  );
319
404
 
@@ -335,7 +420,11 @@ import { Elysia } from 'elysia';
335
420
  import { tesseractPlugin } from '@apollo-deploy/tesseract/elysia';
336
421
 
337
422
  const { plugin, collector } = tesseractPlugin({
338
- info: { title: 'My API', version: '1.0.0', baseUrl: 'https://api.example.com' },
423
+ info: {
424
+ title: 'My API',
425
+ version: '1.0.0',
426
+ baseUrl: 'https://api.example.com',
427
+ },
339
428
  output: './packages/api-sdk',
340
429
  });
341
430
 
@@ -382,7 +471,10 @@ export class UsersController {
382
471
  // main.ts
383
472
  import { NestFactory } from '@nestjs/core';
384
473
  import { AppModule } from './app.module';
385
- import { SDKCollector, collectFromNestControllers } from '@apollo-deploy/tesseract/nestjs';
474
+ import {
475
+ SDKCollector,
476
+ collectFromNestControllers,
477
+ } from '@apollo-deploy/tesseract/nestjs';
386
478
  import { UsersController } from './users/users.controller';
387
479
 
388
480
  async function bootstrap() {
@@ -391,11 +483,13 @@ async function bootstrap() {
391
483
 
392
484
  if (process.env.TESSERACT_GENERATE) {
393
485
  const collector = new SDKCollector({
394
- info: { title: 'My API', version: '1.0.0', baseUrl: 'https://api.example.com' },
486
+ info: {
487
+ title: 'My API',
488
+ version: '1.0.0',
489
+ baseUrl: 'https://api.example.com',
490
+ },
395
491
  output: './packages/api-sdk',
396
- additionalTargets: [
397
- { language: 'kotlin', output: './sdk/java' },
398
- ],
492
+ additionalTargets: [{ language: 'kotlin', output: './sdk/java' }],
399
493
  });
400
494
  collectFromNestControllers([UsersController], collector);
401
495
  await collector.generate();
@@ -422,7 +516,11 @@ Use `SDKCollector` directly from the main package with any HTTP framework:
422
516
  import { SDKCollector } from '@apollo-deploy/tesseract';
423
517
 
424
518
  const collector = new SDKCollector({
425
- info: { title: 'My API', version: '1.0.0', baseUrl: 'https://api.example.com' },
519
+ info: {
520
+ title: 'My API',
521
+ version: '1.0.0',
522
+ baseUrl: 'https://api.example.com',
523
+ },
426
524
  output: './packages/api-sdk',
427
525
  additionalTargets: [
428
526
  { language: 'kotlin', output: './sdk/java' },
@@ -521,14 +619,18 @@ const client = createMyApiClient({
521
619
  apiKey: 'sk_...',
522
620
  timeoutMs: 10000,
523
621
  retries: { attempts: 3, backoffMs: 500, jitter: true },
524
- plugins: [{
525
- name: 'logger',
526
- beforeRequest(config) {
527
- console.log('→', config.method, config.url);
622
+ plugins: [
623
+ {
624
+ name: 'logger',
625
+ beforeRequest(config) {
626
+ console.log('→', config.method, config.url);
627
+ },
528
628
  },
529
- }],
629
+ ],
530
630
  onError({ method, url, error, attempt, willRetry }) {
531
- console.error(`${method} ${url} failed (attempt ${attempt}, retry: ${willRetry})`);
631
+ console.error(
632
+ `${method} ${url} failed (attempt ${attempt}, retry: ${willRetry})`,
633
+ );
532
634
  },
533
635
  });
534
636
 
@@ -581,7 +683,7 @@ await generate({
581
683
  output: './sdk',
582
684
  language: 'kotlin',
583
685
  packageName: '@my-org/api-sdk',
584
- packageVersion: '1.2.3',
686
+ versionBump: 'minor',
585
687
  });
586
688
  ```
587
689
 
@@ -591,7 +693,9 @@ You can also pass a pre-parsed manifest object:
591
693
  import { generate } from '@apollo-deploy/tesseract';
592
694
  import type { BackendManifest } from '@apollo-deploy/tesseract';
593
695
 
594
- const manifest: BackendManifest = { /* ... */ };
696
+ const manifest: BackendManifest = {
697
+ /* ... */
698
+ };
595
699
 
596
700
  await generate({ manifest, output: './sdk', language: 'kotlin' });
597
701
  ```
@@ -600,49 +704,53 @@ await generate({ manifest, output: './sdk', language: 'kotlin' });
600
704
 
601
705
  Either `input` or `manifest` must be provided.
602
706
 
603
- | Option | Type | Description |
604
- |--------|------|-------------|
605
- | `input` | `string?` | Path to the manifest file. Required if `manifest` is not provided. |
606
- | `manifest` | `BackendManifest?` | Pre-parsed manifest object. Alternative to `input`. |
607
- | `output` | `string` | Output directory |
608
- | `language` | `TargetLanguage?` | Target language (default: `typescript`). One of: `typescript`, `python`, `ruby`, `php`, `go`, `rust`, `kotlin`, `csharp` |
609
- | `packageName` | `string?` | Override npm/package name |
610
- | `packageVersion` | `string?` | Override generated package version; defaults to `info.version` from the manifest |
611
- | `clientName` | `string?` | Override client class name |
612
- | `baseUrl` | `string?` | Override default base URL |
613
- | `sdkStyle` | `'functional' \| 'class'?` | `functional` (default) generates a `createMyClient(config)` factory; `class` generates a Resend-style `new MySDK('api_key', options?)` class |
614
- | `clientType` | `'internal' \| 'public'?` | `internal` (default) exposes full config options; `public` accepts only an auth key with `baseUrl` baked in |
615
- | `environments` | `{ name: string; baseUrl: string }[]?` | Named environment presets |
616
- | `dryRun` | `boolean?` | Transform only, no file I/O |
617
- | `check` | `boolean?` | Compare output without writing |
618
- | `prettier` | `boolean?` | Toggle formatting (default: `true`) |
707
+ | Option | Type | Description |
708
+ | ---------------- | -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
709
+ | `input` | `string?` | Path to the manifest file. Required if `manifest` is not provided. |
710
+ | `manifest` | `BackendManifest?` | Pre-parsed manifest object. Alternative to `input`. |
711
+ | `output` | `string` | Output directory |
712
+ | `language` | `TargetLanguage?` | Target language (default: `typescript`). One of: `typescript`, `python`, `ruby`, `php`, `go`, `rust`, `kotlin`, `csharp` |
713
+ | `packageName` | `string?` | Override npm/package name |
714
+ | `packageVersion` | `string?` | Exact generated package version override |
715
+ | `versionBump` | `'patch' \| 'minor' \| 'major'?` | Automatic bump when `packageVersion` is omitted; defaults to `patch` |
716
+ | `clientName` | `string?` | Override client class name |
717
+ | `baseUrl` | `string?` | Override default base URL |
718
+ | `sdkStyle` | `'functional' \| 'class'?` | `functional` (default) generates a `createMyClient(config)` factory; `class` generates a Resend-style `new MySDK('api_key', options?)` class |
719
+ | `clientType` | `'internal' \| 'public'?` | `internal` (default) exposes full config options; `public` accepts only an auth key with `baseUrl` baked in |
720
+ | `environments` | `{ name: string; baseUrl: string }[]?` | Named environment presets |
721
+ | `dryRun` | `boolean?` | Transform only, no file I/O |
722
+ | `check` | `boolean?` | Compare output without writing |
723
+ | `prettier` | `boolean?` | Toggle formatting (default: `true`) |
619
724
 
620
725
  ### `CollectorOptions`
621
726
 
622
727
  Shared by all framework adapters and `SDKCollector`. Extends the programmatic API config with `additionalTargets`.
623
728
 
624
- | Option | Type | Description |
625
- |--------|------|-------------|
626
- | `info` | `object` | API metadata: `title`, `version`, `baseUrl?`, `description?` |
627
- | `output` | `string` | Primary output directory |
628
- | `language` | `TargetLanguage?` | Primary target language (default: `typescript`) |
629
- | `additionalTargets` | `AdditionalTarget[]?` | Extra languages to emit alongside the primary output |
630
- | `schemaPackage` | `object?` | External type package: `name`, `version?`, `importPath?` |
631
- | `sdkStyle` | `'functional' \| 'class'?` | SDK style |
632
- | `clientType` | `'internal' \| 'public'?` | Client type |
633
- | `packageName` | `string?` | Override package name |
634
- | `packageVersion` | `string?` | Override package version |
729
+ | Option | Type | Description |
730
+ | ------------------- | -------------------------------- | ------------------------------------------------------------ |
731
+ | `info` | `object` | API metadata: `title`, `version`, `baseUrl?`, `description?` |
732
+ | `output` | `string` | Primary output directory |
733
+ | `language` | `TargetLanguage?` | Primary target language (default: `typescript`) |
734
+ | `additionalTargets` | `AdditionalTarget[]?` | Extra languages to emit alongside the primary output |
735
+ | `schemaPackage` | `object?` | External type package: `name`, `version?`, `importPath?` |
736
+ | `sdkStyle` | `'functional' \| 'class'?` | SDK style |
737
+ | `clientType` | `'internal' \| 'public'?` | Client type |
738
+ | `packageName` | `string?` | Override package name |
739
+ | `packageVersion` | `string?` | Exact package version override |
740
+ | `versionBump` | `'patch' \| 'minor' \| 'major'?` | Automatic bump policy; defaults to `patch` |
635
741
 
636
742
  Each `AdditionalTarget` entry:
637
743
 
638
- | Field | Type | Description |
639
- |-------|------|-------------|
640
- | `language` | `TargetLanguage` | Required. Target language for this output |
641
- | `output` | `string` | Required. Output directory |
642
- | `packageName` | `string?` | Overrides primary `packageName` for this target |
643
- | `packageVersion` | `string?` | Overrides primary `packageVersion` for this target |
644
- | `clientType` | `'internal' \| 'public'?` | Overrides primary `clientType` for this target |
645
- | `sdkStyle` | `'functional' \| 'class'?` | Overrides primary `sdkStyle` for this target |
744
+ | Field | Type | Description |
745
+ | ---------------- | -------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
746
+ | `language` | `TargetLanguage` | Required. Target language for this output |
747
+ | `output` | `string` | Required. Output directory |
748
+ | `packageName` | `string?` | Overrides primary `packageName` for this target |
749
+ | `packageVersion` | `string?` | Overrides primary `packageVersion` for this target |
750
+ | `versionBump` | `'patch' \| 'minor' \| 'major'?` | Overrides primary `versionBump` for this target |
751
+ | `clientType` | `'internal' \| 'public'?` | Overrides primary `clientType` for this target |
752
+ | `sdkStyle` | `'functional' \| 'class'?` | Overrides primary `sdkStyle` for this target |
753
+ | `schemaPackage` | `object \| null?` | Override schema package. Non-TS languages default to expanding types inline (`null`). Pass an object to force external imports, or `null` explicitly. |
646
754
 
647
755
  ## Requirements
648
756
 
@@ -1,12 +1,9 @@
1
- /**
2
- * C# (dotnet) language adapter.
3
- * Generates an idiomatic C# SDK targeting net8.0 with System.Text.Json.
4
- */
5
- import type { EnrichedSDKIR } from "../../types/ir.js";
6
- import type { LanguageAdapter, EmitResult } from "../types.js";
7
- import type { ResolvedConfig } from "../../types/config.js";
1
+ /** C# language adapter targeting .NET 8. */
2
+ import type { EnrichedSDKIR } from '../../types/ir.js';
3
+ import type { ResolvedConfig } from '../../types/config.js';
4
+ import type { EmitResult, LanguageAdapter } from '../types.js';
8
5
  export declare class CSharpAdapter implements LanguageAdapter {
9
6
  readonly language = "csharp";
10
- emit(enriched: EnrichedSDKIR, outputDir: string, config?: ResolvedConfig): Promise<EmitResult>;
7
+ emit(enriched: EnrichedSDKIR, _outputDir: string, config?: ResolvedConfig): Promise<EmitResult>;
11
8
  }
12
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/csharp/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAU5D,qBAAa,aAAc,YAAW,eAAe;IACnD,QAAQ,CAAC,QAAQ,YAAY;IAEvB,IAAI,CACR,QAAQ,EAAE,aAAa,EACvB,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,cAAc,GACtB,OAAO,CAAC,UAAU,CAAC;CAsHvB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/adapters/csharp/index.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAK5C,OAAO,KAAK,EACV,aAAa,EAId,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAuU/D,qBAAa,aAAc,YAAW,eAAe;IACnD,QAAQ,CAAC,QAAQ,YAAY;IAEvB,IAAI,CACR,QAAQ,EAAE,aAAa,EACvB,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,cAAc,GACtB,OAAO,CAAC,UAAU,CAAC;CAsGvB"}