@apollo-deploy/tesseract 0.4.3 → 0.5.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 (70) hide show
  1. package/README.md +330 -11
  2. package/dist/adapters/types.d.ts +2 -1
  3. package/dist/adapters/types.d.ts.map +1 -1
  4. package/dist/adapters/typescript/index.d.ts +2 -1
  5. package/dist/adapters/typescript/index.d.ts.map +1 -1
  6. package/dist/adapters/typescript/index.js +27 -10
  7. package/dist/adapters/typescript/index.js.map +1 -1
  8. package/dist/cli.js +19 -1
  9. package/dist/cli.js.map +1 -1
  10. package/dist/collector.d.ts +135 -0
  11. package/dist/collector.d.ts.map +1 -0
  12. package/dist/collector.js +159 -0
  13. package/dist/collector.js.map +1 -0
  14. package/dist/elysia.d.ts +65 -0
  15. package/dist/elysia.d.ts.map +1 -0
  16. package/dist/elysia.js +70 -0
  17. package/dist/elysia.js.map +1 -0
  18. package/dist/express.d.ts +74 -0
  19. package/dist/express.d.ts.map +1 -0
  20. package/dist/express.js +73 -0
  21. package/dist/express.js.map +1 -0
  22. package/dist/fastify.d.ts +135 -0
  23. package/dist/fastify.d.ts.map +1 -0
  24. package/dist/fastify.js +188 -0
  25. package/dist/fastify.js.map +1 -0
  26. package/dist/helpers/handlebars.d.ts.map +1 -1
  27. package/dist/helpers/handlebars.js +6 -2
  28. package/dist/helpers/handlebars.js.map +1 -1
  29. package/dist/hono.d.ts +65 -0
  30. package/dist/hono.d.ts.map +1 -0
  31. package/dist/hono.js +64 -0
  32. package/dist/hono.js.map +1 -0
  33. package/dist/index.d.ts +5 -0
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +4 -1
  36. package/dist/index.js.map +1 -1
  37. package/dist/koa.d.ts +69 -0
  38. package/dist/koa.d.ts.map +1 -0
  39. package/dist/koa.js +68 -0
  40. package/dist/koa.js.map +1 -0
  41. package/dist/nestjs.d.ts +107 -0
  42. package/dist/nestjs.d.ts.map +1 -0
  43. package/dist/nestjs.js +143 -0
  44. package/dist/nestjs.js.map +1 -0
  45. package/dist/pipeline/intake.d.ts.map +1 -1
  46. package/dist/pipeline/intake.js +40 -21
  47. package/dist/pipeline/intake.js.map +1 -1
  48. package/dist/pipeline/write.d.ts +1 -0
  49. package/dist/pipeline/write.d.ts.map +1 -1
  50. package/dist/pipeline/write.js +21 -3
  51. package/dist/pipeline/write.js.map +1 -1
  52. package/dist/types/config.d.ts +13 -3
  53. package/dist/types/config.d.ts.map +1 -1
  54. package/dist/types/config.js +5 -2
  55. package/dist/types/config.js.map +1 -1
  56. package/dist/types/ir.d.ts +14 -0
  57. package/dist/types/ir.d.ts.map +1 -1
  58. package/dist/types/manifest.d.ts +5 -23
  59. package/dist/types/manifest.d.ts.map +1 -1
  60. package/dist/types/manifest.js.map +1 -1
  61. package/dist/types/sdk-module.d.ts +128 -0
  62. package/dist/types/sdk-module.d.ts.map +1 -0
  63. package/dist/types/sdk-module.js +50 -0
  64. package/dist/types/sdk-module.js.map +1 -0
  65. package/package.json +63 -1
  66. package/templates/typescript/client-class.hbs +136 -0
  67. package/templates/typescript/domain-class.hbs +188 -0
  68. package/templates/typescript/domain.hbs +10 -6
  69. package/templates/typescript/index-class.hbs +68 -0
  70. package/templates/typescript/transport-sse.hbs +3 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollo-deploy/tesseract",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
4
4
  "type": "module",
5
5
  "description": "Manifest-first SDK generator — turns sdk-manifold/v1 manifests into production-ready TypeScript SDKs",
6
6
  "bin": {
@@ -12,6 +12,30 @@
12
12
  ".": {
13
13
  "import": "./dist/index.js",
14
14
  "types": "./dist/index.d.ts"
15
+ },
16
+ "./fastify": {
17
+ "import": "./dist/fastify.js",
18
+ "types": "./dist/fastify.d.ts"
19
+ },
20
+ "./express": {
21
+ "import": "./dist/express.js",
22
+ "types": "./dist/express.d.ts"
23
+ },
24
+ "./hono": {
25
+ "import": "./dist/hono.js",
26
+ "types": "./dist/hono.d.ts"
27
+ },
28
+ "./koa": {
29
+ "import": "./dist/koa.js",
30
+ "types": "./dist/koa.d.ts"
31
+ },
32
+ "./elysia": {
33
+ "import": "./dist/elysia.js",
34
+ "types": "./dist/elysia.d.ts"
35
+ },
36
+ "./nestjs": {
37
+ "import": "./dist/nestjs.js",
38
+ "types": "./dist/nestjs.d.ts"
15
39
  }
16
40
  },
17
41
  "files": [
@@ -47,12 +71,50 @@
47
71
  "dependencies": {
48
72
  "change-case": "^5.4.4",
49
73
  "commander": "^12.1.0",
74
+ "fastify-plugin": "^5.1.0",
50
75
  "handlebars": "^4.7.8",
51
76
  "prettier": "^3.3.0",
52
77
  "ts-morph": "^27.0.2"
53
78
  },
79
+ "peerDependencies": {
80
+ "fastify": ">=4",
81
+ "express": ">=4",
82
+ "hono": ">=4",
83
+ "koa": ">=2",
84
+ "@koa/router": ">=12",
85
+ "elysia": ">=1",
86
+ "@nestjs/common": ">=9",
87
+ "@nestjs/core": ">=9"
88
+ },
89
+ "peerDependenciesMeta": {
90
+ "fastify": {
91
+ "optional": true
92
+ },
93
+ "express": {
94
+ "optional": true
95
+ },
96
+ "hono": {
97
+ "optional": true
98
+ },
99
+ "koa": {
100
+ "optional": true
101
+ },
102
+ "@koa/router": {
103
+ "optional": true
104
+ },
105
+ "elysia": {
106
+ "optional": true
107
+ },
108
+ "@nestjs/common": {
109
+ "optional": true
110
+ },
111
+ "@nestjs/core": {
112
+ "optional": true
113
+ }
114
+ },
54
115
  "devDependencies": {
55
116
  "@types/node": "^20.14.0",
117
+ "fastify": "^5.8.5",
56
118
  "typescript": "^5.5.0"
57
119
  }
58
120
  }
@@ -0,0 +1,136 @@
1
+ /**
2
+ * @generated
3
+ * This file was automatically generated by Tesseract.
4
+ * DO NOT MODIFY THIS FILE DIRECTLY.
5
+ */
6
+
7
+ {{#if (eq clientType "public")}}
8
+ import { createTransport, type SDKTransport } from './transport/axios.js';
9
+ {{else}}
10
+ import { createTransport, type SDKTransport, type SDKPlugin, type RequestMeta, type ResponseMeta, type ErrorMeta } from './transport/axios.js';
11
+ {{/if}}
12
+ {{#each groups}}
13
+ import { {{interfaceName}} } from './domain/{{fileName}}.js';
14
+ {{/each}}
15
+ {{#if hasWebhooks}}
16
+ import { createWebhookRegistry, type WebhookRegistry } from './webhooks/handler.js';
17
+ {{/if}}
18
+
19
+ {{#if (eq clientType "internal")}}
20
+ /**
21
+ * Configuration options for {{meta.title}}.
22
+ * Pass as the last argument to the constructor for advanced settings.
23
+ */
24
+ export interface {{meta.clientName}}Options {
25
+ /** Base URL for the API (default: '{{meta.baseUrl}}') */
26
+ baseUrl?: string;
27
+ /** Request timeout in milliseconds (default: 15000) */
28
+ timeoutMs?: number;
29
+ /** Retry configuration */
30
+ retries?: { attempts: number; backoffMs: number; jitter: boolean; maxBackoffMs?: number };
31
+ /** Custom idempotency key generator */
32
+ getIdempotencyKey?: () => string;
33
+ /** Request telemetry hook */
34
+ onRequest?: (meta: RequestMeta) => void;
35
+ /** Response telemetry hook */
36
+ onResponse?: (meta: ResponseMeta) => void;
37
+ /** Error telemetry hook */
38
+ onError?: (meta: ErrorMeta) => void;
39
+ /** Default headers sent with every request */
40
+ defaultHeaders?: Record<string, string>;
41
+ /** Ordered list of plugins applied to every request and response */
42
+ plugins?: SDKPlugin[];
43
+ }
44
+
45
+ {{/if}}
46
+ /**
47
+ * {{meta.title}} SDK client.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * import { {{meta.clientName}} } from '{{meta.packageName}}';
52
+ *
53
+ {{#if securitySchemes.length}}
54
+ {{#each securitySchemes}}
55
+ {{#if (eq type "apiKey")}}
56
+ * const client = new {{../meta.clientName}}('YOUR_{{upperCase configKey}}');
57
+ {{/if}}
58
+ {{#if (and (eq type "http") (eq scheme "bearer"))}}
59
+ * const client = new {{../meta.clientName}}('YOUR_BEARER_TOKEN');
60
+ {{/if}}
61
+ {{/each}}
62
+ {{else}}
63
+ * const client = new {{meta.clientName}}();
64
+ {{/if}}
65
+ * ```
66
+ */
67
+ export class {{meta.clientName}} {
68
+ {{#if (eq clientType "public")}}
69
+ private readonly _transport: SDKTransport;
70
+ {{else}}
71
+ /** @internal — exposed for advanced use and testing */
72
+ readonly _transport: SDKTransport;
73
+ {{/if}}
74
+
75
+ {{#each groups}}
76
+ /** {{#if description}}{{description}}{{else}}{{interfaceName}} operations{{/if}} */
77
+ readonly {{name}}: {{interfaceName}};
78
+ {{/each}}
79
+ {{#if hasWebhooks}}
80
+ /** Typed webhook event handler registry */
81
+ readonly webhooks: WebhookRegistry;
82
+ {{/if}}
83
+
84
+ constructor(
85
+ {{#if securitySchemes.length}}
86
+ {{#each securitySchemes}}
87
+ {{#if (eq type "apiKey")}}
88
+ readonly {{configKey}}: string,
89
+ {{/if}}
90
+ {{#if (and (eq type "http") (eq scheme "bearer"))}}
91
+ readonly {{configKey}}: string,
92
+ {{/if}}
93
+ {{#if (eq type "oauth2")}}
94
+ readonly {{configKey}}: string,
95
+ {{/if}}
96
+ {{#if (eq type "openIdConnect")}}
97
+ readonly {{configKey}}: string,
98
+ {{/if}}
99
+ {{/each}}
100
+ {{/if}}
101
+ {{#if (eq clientType "internal")}}
102
+ options?: {{meta.clientName}}Options,
103
+ {{/if}}
104
+ ) {
105
+ this._transport = createTransport({
106
+ {{#if (eq clientType "public")}}
107
+ baseUrl: '{{meta.baseUrl}}',
108
+ {{else}}
109
+ baseUrl: options?.baseUrl ?? '{{meta.baseUrl}}',
110
+ {{/if}}
111
+ {{#each securitySchemes}}
112
+ {{configKey}}: this.{{configKey}},
113
+ {{/each}}
114
+ {{#if (eq clientType "public")}}
115
+ timeoutMs: 15000,
116
+ retries: { attempts: 3, backoffMs: 400, jitter: true },
117
+ {{else}}
118
+ timeoutMs: options?.timeoutMs ?? 15000,
119
+ retries: options?.retries ?? { attempts: 3, backoffMs: 400, jitter: true },
120
+ getIdempotencyKey: options?.getIdempotencyKey,
121
+ onRequest: options?.onRequest,
122
+ onResponse: options?.onResponse,
123
+ onError: options?.onError,
124
+ defaultHeaders: options?.defaultHeaders,
125
+ plugins: options?.plugins,
126
+ {{/if}}
127
+ });
128
+
129
+ {{#each groups}}
130
+ this.{{name}} = new {{interfaceName}}(this._transport);
131
+ {{/each}}
132
+ {{#if hasWebhooks}}
133
+ this.webhooks = createWebhookRegistry();
134
+ {{/if}}
135
+ }
136
+ }
@@ -0,0 +1,188 @@
1
+ /**
2
+ * @generated
3
+ * This file was automatically generated by Tesseract.
4
+ * DO NOT MODIFY THIS FILE DIRECTLY.
5
+ */
6
+
7
+ import type { SDKTransport, RequestOptions } from '../transport/axios.js';
8
+ {{#if hasSSE}}
9
+ import { createSSEStream, type SSEEvent, type SSEOptions, type SSEClientConfig } from '../transport/sse.js';
10
+ {{/if}}
11
+ {{#if imports.length}}
12
+ import type {
13
+ {{#each imports}}
14
+ {{this}},
15
+ {{/each}}
16
+ } from '../types/index.js';
17
+ {{/if}}
18
+
19
+ export class {{interfaceName}} {
20
+ constructor(private readonly _transport: SDKTransport) {}
21
+
22
+ {{#if hasSSE}}
23
+ private _buildSSEClientConfig(): SSEClientConfig {
24
+ const headers: Record<string, string> = {
25
+ ...(this._transport.config.defaultHeaders ?? {}),
26
+ };
27
+ {{#each securitySchemes}}
28
+ {{#if (eq type "apiKey")}}
29
+ {{#if (eq in "header")}}
30
+ if (this._transport.config.{{configKey}}) headers['{{paramName}}'] = this._transport.config.{{configKey}}!;
31
+ {{/if}}
32
+ {{/if}}
33
+ {{#if (and (eq type "http") (eq scheme "bearer"))}}
34
+ if (this._transport.config.{{configKey}}) headers['Authorization'] = `Bearer ${ this._transport.config.{{configKey}} }`;
35
+ {{/if}}
36
+ {{#if (eq type "oauth2")}}
37
+ if (this._transport.config.{{configKey}}) headers['Authorization'] = `Bearer ${ this._transport.config.{{configKey}} }`;
38
+ {{/if}}
39
+ {{#if (eq type "openIdConnect")}}
40
+ if (this._transport.config.{{configKey}}) headers['Authorization'] = `Bearer ${ this._transport.config.{{configKey}} }`;
41
+ {{/if}}
42
+ {{/each}}
43
+ return {
44
+ headers: Object.keys(headers).length > 0 ? headers : undefined,
45
+ cookies: this._transport.config.cookies,
46
+ withCredentials: this._transport.config.withCredentials,
47
+ };
48
+ }
49
+
50
+ {{/if}}
51
+ {{#each operations}}
52
+ {{#if (isEventStream this)}}
53
+ {{#if (or summary description)}}
54
+ /** {{#if summary}}{{summary}}{{#if description}} — {{description}}{{/if}}{{else}}{{description}}{{/if}} (SSE stream) */
55
+ {{/if}}
56
+ {{name}}{{{sseMethodSignature this}}} {
57
+ const sseUrl = new URL(`{{path}}`, this._transport.config.baseUrl);
58
+ {{#if (hasQueryParams this)}}
59
+ if (query) {
60
+ {{#each queryParams}}
61
+ if (query.{{name}} !== undefined && query.{{name}} !== null) {
62
+ sseUrl.searchParams.set('{{originalName}}', String(query.{{name}}));
63
+ }
64
+ {{/each}}
65
+ }
66
+ {{else if queryType}}
67
+ if (query) {
68
+ for (const [k, v] of Object.entries(query)) {
69
+ if (v !== undefined && v !== null) sseUrl.searchParams.set(k, String(v));
70
+ }
71
+ }
72
+ {{/if}}
73
+ {{#if (or (hasRequestBody this) (needsRequestHeaders this))}}
74
+ const sseHeaders: Record<string, string> = {};
75
+ {{#if (hasRequestBody this)}}
76
+ sseHeaders['Content-Type'] = '{{requestBody.contentType}}';
77
+ {{/if}}
78
+ {{#if (and headerParams.length headerType)}}
79
+ if (headerOptions) {
80
+ {{#each headerParams}}
81
+ if (headerOptions.{{name}} !== undefined && headerOptions.{{name}} !== null) {
82
+ sseHeaders['{{originalName}}'] = String(headerOptions.{{name}});
83
+ }
84
+ {{/each}}
85
+ }
86
+ {{/if}}
87
+ {{#if cookieParams}}
88
+ if (cookies) {
89
+ const cookiePairs: string[] = [];
90
+ {{#each cookieParams}}
91
+ if (cookies.{{name}} !== undefined && cookies.{{name}} !== null) {
92
+ cookiePairs.push(`{{originalName}}=${encodeURIComponent(String(cookies.{{name}}))}`);
93
+ }
94
+ {{/each}}
95
+ if (cookiePairs.length > 0) {
96
+ sseHeaders.Cookie = cookiePairs.join('; ');
97
+ }
98
+ }
99
+ {{/if}}
100
+ {{/if}}
101
+ return createSSEStream<{{#if sseReturnType}}{{sseReturnType}}{{else}}{{{sseEventType this}}}{{/if}}>(
102
+ sseUrl.toString(),
103
+ {
104
+ method: '{{httpMethod}}',
105
+ {{#if (hasRequestBody this)}}
106
+ body: JSON.stringify(input),
107
+ {{/if}}
108
+ {{#if (or (hasRequestBody this) (needsRequestHeaders this))}}
109
+ headers: Object.keys(sseHeaders).length > 0 ? sseHeaders : undefined,
110
+ {{/if}}
111
+ },
112
+ undefined,
113
+ this._buildSSEClientConfig(),
114
+ options,
115
+ );
116
+ }
117
+
118
+ {{else}}
119
+ {{#if deprecated}}
120
+ /** @deprecated {{#if deprecationMessage}}{{deprecationMessage}}{{else if summary}}{{summary}}{{#if description}} — {{description}}{{/if}}{{else if description}}{{description}}{{/if}} */
121
+ {{else if (or summary description)}}
122
+ /** {{#if summary}}{{summary}}{{#if description}} — {{description}}{{/if}}{{else}}{{description}}{{/if}} */
123
+ {{/if}}
124
+ {{name}}{{{methodParams this}}}: Promise<{{responseType}}> {
125
+ {{#if (hasQueryParams this)}}
126
+ const params = query
127
+ ? {
128
+ {{#each queryParams}}
129
+ '{{originalName}}': query.{{name}},
130
+ {{/each}}
131
+ }
132
+ : undefined;
133
+ {{else if queryType}}
134
+ const params = query;
135
+ {{/if}}
136
+ {{#if (needsRequestHeaders this)}}
137
+ const requestHeaders: Record<string, string> = {};
138
+ {{#if (and (hasRequestBody this) (and (neq requestBody.contentType "application/json") (neq requestBody.contentType "multipart/form-data")))}}
139
+ requestHeaders['Content-Type'] = '{{requestBody.contentType}}';
140
+ {{/if}}
141
+ {{#if (and headerParams.length headerType)}}
142
+ if (headerOptions) {
143
+ {{#each headerParams}}
144
+ if (headerOptions.{{name}} !== undefined && headerOptions.{{name}} !== null) {
145
+ requestHeaders['{{originalName}}'] = String(headerOptions.{{name}});
146
+ }
147
+ {{/each}}
148
+ }
149
+ {{/if}}
150
+ {{#if cookieParams}}
151
+ if (cookies) {
152
+ const cookiePairs: string[] = [];
153
+ {{#each cookieParams}}
154
+ if (cookies.{{name}} !== undefined && cookies.{{name}} !== null) {
155
+ cookiePairs.push(`{{originalName}}=${encodeURIComponent(String(cookies.{{name}}))}`);
156
+ }
157
+ {{/each}}
158
+ if (cookiePairs.length > 0) {
159
+ requestHeaders.Cookie = cookiePairs.join('; ');
160
+ }
161
+ }
162
+ {{/if}}
163
+ {{/if}}
164
+ return this._transport.executeRequest<{{responseType}}>(
165
+ {
166
+ method: '{{httpMethod}}',
167
+ url: `{{path}}`,
168
+ {{#if (hasRequestBody this)}}
169
+ data: input,
170
+ {{/if}}
171
+ {{#if (or (hasQueryParams this) queryType)}}
172
+ params,
173
+ {{/if}}
174
+ {{#if (needsRequestHeaders this)}}
175
+ headers: Object.keys(requestHeaders).length > 0 ? requestHeaders : undefined,
176
+ {{/if}}
177
+ },
178
+ {{#if timeout}}
179
+ { timeoutMs: {{timeout}}, ...options },
180
+ {{else}}
181
+ options,
182
+ {{/if}}
183
+ );
184
+ }
185
+
186
+ {{/if}}
187
+ {{/each}}
188
+ }
@@ -25,7 +25,7 @@ export interface {{interfaceName}} {
25
25
  {{name}}{{{sseMethodSignature this}}};
26
26
  {{else}}
27
27
  {{#if deprecated}}
28
- /** @deprecated {{#if summary}}{{summary}}{{#if description}} — {{description}}{{/if}}{{else if description}}{{description}}{{/if}} */
28
+ /** @deprecated {{#if deprecationMessage}}{{deprecationMessage}}{{else if summary}}{{summary}}{{#if description}} — {{description}}{{/if}}{{else if description}}{{description}}{{/if}} */
29
29
  {{else if (or summary description)}}
30
30
  /** {{#if summary}}{{summary}}{{#if description}} — {{description}}{{/if}}{{else}}{{description}}{{/if}} */
31
31
  {{/if}}
@@ -48,13 +48,13 @@ export function {{factoryName}}(transport: SDKTransport): {{interfaceName}} {
48
48
  {{/if}}
49
49
  {{/if}}
50
50
  {{#if (and (eq type "http") (eq scheme "bearer"))}}
51
- if (transport.config.{{configKey}}) headers['Authorization'] = `Bearer ${transport.config.{{configKey}}}`;
51
+ if (transport.config.{{configKey}}) headers['Authorization'] = `Bearer ${ transport.config.{{configKey}} }`;
52
52
  {{/if}}
53
53
  {{#if (eq type "oauth2")}}
54
- if (transport.config.{{configKey}}) headers['Authorization'] = `Bearer ${transport.config.{{configKey}}}`;
54
+ if (transport.config.{{configKey}}) headers['Authorization'] = `Bearer ${ transport.config.{{configKey}} }`;
55
55
  {{/if}}
56
56
  {{#if (eq type "openIdConnect")}}
57
- if (transport.config.{{configKey}}) headers['Authorization'] = `Bearer ${transport.config.{{configKey}}}`;
57
+ if (transport.config.{{configKey}}) headers['Authorization'] = `Bearer ${ transport.config.{{configKey}} }`;
58
58
  {{/if}}
59
59
  {{/each}}
60
60
  return {
@@ -67,7 +67,7 @@ export function {{factoryName}}(transport: SDKTransport): {{interfaceName}} {
67
67
  return {
68
68
  {{#each operations}}
69
69
  {{#if (isEventStream this)}}
70
- {{name}}{{{sseMethodParams this}}}: AsyncIterable<SSEEvent<{{{sseEventType this}}}>> {
70
+ {{name}}{{{sseMethodParams this}}}: {{#if sseReturnType}}AsyncIterable<{{sseReturnType}}>{{else}}AsyncIterable<SSEEvent<{{{sseEventType this}}}>>{{/if}} {
71
71
  const sseUrl = new URL(`{{path}}`, transport.config.baseUrl);
72
72
  {{#if (hasQueryParams this)}}
73
73
  if (query) {
@@ -112,7 +112,7 @@ export function {{factoryName}}(transport: SDKTransport): {{interfaceName}} {
112
112
  }
113
113
  {{/if}}
114
114
  {{/if}}
115
- return createSSEStream<{{{sseEventType this}}}>(
115
+ return createSSEStream<{{#if sseReturnType}}{{sseReturnType}}{{else}}{{{sseEventType this}}}{{/if}}>(
116
116
  sseUrl.toString(),
117
117
  {
118
118
  method: '{{httpMethod}}',
@@ -184,7 +184,11 @@ export function {{factoryName}}(transport: SDKTransport): {{interfaceName}} {
184
184
  headers: Object.keys(requestHeaders).length > 0 ? requestHeaders : undefined,
185
185
  {{/if}}
186
186
  },
187
+ {{#if timeout}}
188
+ { timeoutMs: {{timeout}}, ...options },
189
+ {{else}}
187
190
  options,
191
+ {{/if}}
188
192
  );
189
193
  },
190
194
 
@@ -0,0 +1,68 @@
1
+ /**
2
+ * @generated
3
+ * This file was automatically generated by Tesseract.
4
+ * DO NOT MODIFY THIS FILE DIRECTLY.
5
+ */
6
+
7
+ // Client class — primary entry point
8
+ {{#if (eq clientType "internal")}}
9
+ export { {{meta.clientName}}, type {{meta.clientName}}Options } from './src/client.js';
10
+ {{else}}
11
+ export { {{meta.clientName}} } from './src/client.js';
12
+ {{/if}}
13
+
14
+ // Domain classes
15
+ {{#each groups}}
16
+ export { {{interfaceName}} } from './src/domain/{{fileName}}.js';
17
+ {{/each}}
18
+
19
+ // Error class
20
+ export { SDKError } from './src/types/errors.js';
21
+
22
+ {{#if (eq clientType "internal")}}
23
+ // Transport
24
+ export { createTransport, executeRequest } from './src/transport/axios.js';
25
+ export type {
26
+ RetryConfig,
27
+ TransportConfig,
28
+ ResolvedTransportConfig,
29
+ SDKTransport,
30
+ SDKPlugin,
31
+ RequestOptions,
32
+ RequestMeta,
33
+ ResponseMeta,
34
+ ErrorMeta,
35
+ } from './src/transport/axios.js';
36
+
37
+ {{#if hasSSE}}
38
+ // SSE (Server-Sent Events)
39
+ export { createSSEStream, parseSSEChunk, parseSSEEventData } from './src/transport/sse.js';
40
+ export type { SSEEvent, SSEOptions, SSEReconnectConfig } from './src/transport/sse.js';
41
+ {{/if}}
42
+ {{/if}}
43
+
44
+ // Common types
45
+ export type {
46
+ PaginationQuery,
47
+ PageMeta,
48
+ Page,
49
+ SuccessResponse,
50
+ MessageResponse,
51
+ ApiErrorEnvelope,
52
+ } from './src/types/common.js';
53
+
54
+ {{#if hasWebhooks}}
55
+ // Webhooks
56
+ {{#if (eq clientType "internal")}}
57
+ export { createWebhookRegistry } from './src/webhooks/handler.js';
58
+ {{/if}}
59
+ export type {
60
+ WebhookEventMap,
61
+ WebhookEventName,
62
+ WebhookHandler,
63
+ WebhookMeta,
64
+ WebhookVerifyOptions,
65
+ WebhookRegistry,
66
+ WebhookRegistryConfig,
67
+ } from './src/webhooks/handler.js';
68
+ {{/if}}
@@ -235,13 +235,13 @@ const DEFAULT_MAX_BUFFER = 5 * 1024 * 1024; // 5MB
235
235
  * }
236
236
  * ```
237
237
  */
238
- export async function* createSSEStream<T>(
238
+ export async function* createSSEStream<TEvent extends SSEEvent<unknown> = SSEEvent<Record<string, unknown>>>(
239
239
  url: string,
240
240
  init: SSERequestInit,
241
241
  reconnect?: Partial<SSEReconnectConfig>,
242
242
  clientConfig?: SSEClientConfig,
243
243
  options?: SSEOptions,
244
- ): AsyncIterable<SSEEvent<T>> {
244
+ ): AsyncIterable<TEvent> {
245
245
  const rc: SSEReconnectConfig = { ...DEFAULT_RECONNECT, ...reconnect };
246
246
  const maxBuffer = options?.maxBufferSize ?? DEFAULT_MAX_BUFFER;
247
247
  let lastEventId: string | undefined;
@@ -374,7 +374,7 @@ export async function* createSSEStream<T>(
374
374
  continue;
375
375
  }
376
376
 
377
- yield parseSSEEventData<T>(rawEvent, options?.parseData);
377
+ yield parseSSEEventData<TEvent>(rawEvent, options?.parseData) as TEvent;
378
378
  }
379
379
  }
380
380
  } finally {