@apollo-deploy/tesseract 0.4.4 → 0.5.1

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 (66) 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/hono.d.ts +65 -0
  27. package/dist/hono.d.ts.map +1 -0
  28. package/dist/hono.js +64 -0
  29. package/dist/hono.js.map +1 -0
  30. package/dist/index.d.ts +5 -0
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +4 -1
  33. package/dist/index.js.map +1 -1
  34. package/dist/koa.d.ts +69 -0
  35. package/dist/koa.d.ts.map +1 -0
  36. package/dist/koa.js +68 -0
  37. package/dist/koa.js.map +1 -0
  38. package/dist/nestjs.d.ts +107 -0
  39. package/dist/nestjs.d.ts.map +1 -0
  40. package/dist/nestjs.js +143 -0
  41. package/dist/nestjs.js.map +1 -0
  42. package/dist/pipeline/intake.d.ts.map +1 -1
  43. package/dist/pipeline/intake.js +35 -21
  44. package/dist/pipeline/intake.js.map +1 -1
  45. package/dist/pipeline/write.d.ts +1 -0
  46. package/dist/pipeline/write.d.ts.map +1 -1
  47. package/dist/pipeline/write.js +21 -3
  48. package/dist/pipeline/write.js.map +1 -1
  49. package/dist/types/config.d.ts +13 -3
  50. package/dist/types/config.d.ts.map +1 -1
  51. package/dist/types/config.js +5 -2
  52. package/dist/types/config.js.map +1 -1
  53. package/dist/types/ir.d.ts +8 -0
  54. package/dist/types/ir.d.ts.map +1 -1
  55. package/dist/types/manifest.d.ts +5 -30
  56. package/dist/types/manifest.d.ts.map +1 -1
  57. package/dist/types/manifest.js.map +1 -1
  58. package/dist/types/sdk-module.d.ts +128 -0
  59. package/dist/types/sdk-module.d.ts.map +1 -0
  60. package/dist/types/sdk-module.js +50 -0
  61. package/dist/types/sdk-module.js.map +1 -0
  62. package/package.json +63 -1
  63. package/templates/typescript/client-class.hbs +136 -0
  64. package/templates/typescript/domain-class.hbs +188 -0
  65. package/templates/typescript/domain.hbs +5 -1
  66. package/templates/typescript/index-class.hbs +68 -0
@@ -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}}
@@ -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}}