@alagoni97/cli 0.72.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 (244) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +336 -0
  3. package/bin/dev.cmd +3 -0
  4. package/bin/dev.mjs +3 -0
  5. package/bin/run.cmd +3 -0
  6. package/bin/run.mjs +4 -0
  7. package/dist/LoggingInterface.d.ts +123 -0
  8. package/dist/LoggingInterface.js +300 -0
  9. package/dist/PersistedConfig.d.ts +46 -0
  10. package/dist/PersistedConfig.js +94 -0
  11. package/dist/browser/adapters/output.d.ts +69 -0
  12. package/dist/browser/adapters/output.js +91 -0
  13. package/dist/browser/config.d.ts +18 -0
  14. package/dist/browser/config.js +59 -0
  15. package/dist/browser/generate.d.ts +20 -0
  16. package/dist/browser/generate.js +129 -0
  17. package/dist/browser/index.d.ts +17 -0
  18. package/dist/browser/index.js +26 -0
  19. package/dist/browser/parser.d.ts +9 -0
  20. package/dist/browser/parser.js +61 -0
  21. package/dist/browser/shims/asyncapi-parser.d.ts +30 -0
  22. package/dist/browser/shims/asyncapi-parser.js +52 -0
  23. package/dist/browser/shims/fs.d.ts +190 -0
  24. package/dist/browser/shims/fs.js +188 -0
  25. package/dist/browser/shims/json-schema-ref-parser.d.ts +73 -0
  26. package/dist/browser/shims/json-schema-ref-parser.js +246 -0
  27. package/dist/browser/shims/swagger-parser.d.ts +20 -0
  28. package/dist/browser/shims/swagger-parser.js +40 -0
  29. package/dist/codegen/configurationSchemaBuilder.d.ts +15 -0
  30. package/dist/codegen/configurationSchemaBuilder.js +48 -0
  31. package/dist/codegen/configurations.d.ts +29 -0
  32. package/dist/codegen/configurations.js +260 -0
  33. package/dist/codegen/detection.d.ts +19 -0
  34. package/dist/codegen/detection.js +174 -0
  35. package/dist/codegen/errors.d.ts +111 -0
  36. package/dist/codegen/errors.js +352 -0
  37. package/dist/codegen/generators/generic/custom.d.ts +75 -0
  38. package/dist/codegen/generators/generic/custom.js +66 -0
  39. package/dist/codegen/generators/index.d.ts +14 -0
  40. package/dist/codegen/generators/index.js +42 -0
  41. package/dist/codegen/generators/typescript/channels/asyncapi.d.ts +10 -0
  42. package/dist/codegen/generators/typescript/channels/asyncapi.js +131 -0
  43. package/dist/codegen/generators/typescript/channels/index.d.ts +8 -0
  44. package/dist/codegen/generators/typescript/channels/index.js +142 -0
  45. package/dist/codegen/generators/typescript/channels/openapi.d.ts +9 -0
  46. package/dist/codegen/generators/typescript/channels/openapi.js +168 -0
  47. package/dist/codegen/generators/typescript/channels/protocols/amqp/index.d.ts +7 -0
  48. package/dist/codegen/generators/typescript/channels/protocols/amqp/index.js +149 -0
  49. package/dist/codegen/generators/typescript/channels/protocols/amqp/publishExchange.d.ts +5 -0
  50. package/dist/codegen/generators/typescript/channels/protocols/amqp/publishExchange.js +106 -0
  51. package/dist/codegen/generators/typescript/channels/protocols/amqp/publishQueue.d.ts +3 -0
  52. package/dist/codegen/generators/typescript/channels/protocols/amqp/publishQueue.js +102 -0
  53. package/dist/codegen/generators/typescript/channels/protocols/amqp/subscribeQueue.d.ts +3 -0
  54. package/dist/codegen/generators/typescript/channels/protocols/amqp/subscribeQueue.js +133 -0
  55. package/dist/codegen/generators/typescript/channels/protocols/eventsource/express.d.ts +3 -0
  56. package/dist/codegen/generators/typescript/channels/protocols/eventsource/express.js +100 -0
  57. package/dist/codegen/generators/typescript/channels/protocols/eventsource/fetch.d.ts +5 -0
  58. package/dist/codegen/generators/typescript/channels/protocols/eventsource/fetch.js +144 -0
  59. package/dist/codegen/generators/typescript/channels/protocols/eventsource/index.d.ts +6 -0
  60. package/dist/codegen/generators/typescript/channels/protocols/eventsource/index.js +132 -0
  61. package/dist/codegen/generators/typescript/channels/protocols/http/client.d.ts +10 -0
  62. package/dist/codegen/generators/typescript/channels/protocols/http/client.js +224 -0
  63. package/dist/codegen/generators/typescript/channels/protocols/http/common-types.d.ts +14 -0
  64. package/dist/codegen/generators/typescript/channels/protocols/http/common-types.js +800 -0
  65. package/dist/codegen/generators/typescript/channels/protocols/http/index.d.ts +8 -0
  66. package/dist/codegen/generators/typescript/channels/protocols/http/index.js +96 -0
  67. package/dist/codegen/generators/typescript/channels/protocols/http/security.d.ts +48 -0
  68. package/dist/codegen/generators/typescript/channels/protocols/http/security.js +491 -0
  69. package/dist/codegen/generators/typescript/channels/protocols/kafka/index.d.ts +6 -0
  70. package/dist/codegen/generators/typescript/channels/protocols/kafka/index.js +127 -0
  71. package/dist/codegen/generators/typescript/channels/protocols/kafka/publish.d.ts +3 -0
  72. package/dist/codegen/generators/typescript/channels/protocols/kafka/publish.js +108 -0
  73. package/dist/codegen/generators/typescript/channels/protocols/kafka/subscribe.d.ts +3 -0
  74. package/dist/codegen/generators/typescript/channels/protocols/kafka/subscribe.js +154 -0
  75. package/dist/codegen/generators/typescript/channels/protocols/kafka/utils.d.ts +11 -0
  76. package/dist/codegen/generators/typescript/channels/protocols/kafka/utils.js +58 -0
  77. package/dist/codegen/generators/typescript/channels/protocols/mqtt/index.d.ts +6 -0
  78. package/dist/codegen/generators/typescript/channels/protocols/mqtt/index.js +113 -0
  79. package/dist/codegen/generators/typescript/channels/protocols/mqtt/publish.d.ts +3 -0
  80. package/dist/codegen/generators/typescript/channels/protocols/mqtt/publish.js +99 -0
  81. package/dist/codegen/generators/typescript/channels/protocols/mqtt/subscribe.d.ts +3 -0
  82. package/dist/codegen/generators/typescript/channels/protocols/mqtt/subscribe.js +186 -0
  83. package/dist/codegen/generators/typescript/channels/protocols/nats/corePublish.d.ts +3 -0
  84. package/dist/codegen/generators/typescript/channels/protocols/nats/corePublish.js +90 -0
  85. package/dist/codegen/generators/typescript/channels/protocols/nats/coreReply.d.ts +3 -0
  86. package/dist/codegen/generators/typescript/channels/protocols/nats/coreReply.js +142 -0
  87. package/dist/codegen/generators/typescript/channels/protocols/nats/coreRequest.d.ts +3 -0
  88. package/dist/codegen/generators/typescript/channels/protocols/nats/coreRequest.js +100 -0
  89. package/dist/codegen/generators/typescript/channels/protocols/nats/coreSubscribe.d.ts +3 -0
  90. package/dist/codegen/generators/typescript/channels/protocols/nats/coreSubscribe.js +143 -0
  91. package/dist/codegen/generators/typescript/channels/protocols/nats/index.d.ts +11 -0
  92. package/dist/codegen/generators/typescript/channels/protocols/nats/index.js +224 -0
  93. package/dist/codegen/generators/typescript/channels/protocols/nats/jetstreamPublish.d.ts +3 -0
  94. package/dist/codegen/generators/typescript/channels/protocols/nats/jetstreamPublish.js +89 -0
  95. package/dist/codegen/generators/typescript/channels/protocols/nats/jetstreamPullSubscribe.d.ts +3 -0
  96. package/dist/codegen/generators/typescript/channels/protocols/nats/jetstreamPullSubscribe.js +146 -0
  97. package/dist/codegen/generators/typescript/channels/protocols/nats/jetstreamPushSubscription.d.ts +3 -0
  98. package/dist/codegen/generators/typescript/channels/protocols/nats/jetstreamPushSubscription.js +149 -0
  99. package/dist/codegen/generators/typescript/channels/protocols/nats/utils.d.ts +35 -0
  100. package/dist/codegen/generators/typescript/channels/protocols/nats/utils.js +120 -0
  101. package/dist/codegen/generators/typescript/channels/protocols/websocket/index.d.ts +7 -0
  102. package/dist/codegen/generators/typescript/channels/protocols/websocket/index.js +152 -0
  103. package/dist/codegen/generators/typescript/channels/protocols/websocket/publish.d.ts +3 -0
  104. package/dist/codegen/generators/typescript/channels/protocols/websocket/publish.js +64 -0
  105. package/dist/codegen/generators/typescript/channels/protocols/websocket/register.d.ts +3 -0
  106. package/dist/codegen/generators/typescript/channels/protocols/websocket/register.js +115 -0
  107. package/dist/codegen/generators/typescript/channels/protocols/websocket/subscribe.d.ts +3 -0
  108. package/dist/codegen/generators/typescript/channels/protocols/websocket/subscribe.js +151 -0
  109. package/dist/codegen/generators/typescript/channels/types.d.ts +181 -0
  110. package/dist/codegen/generators/typescript/channels/types.js +131 -0
  111. package/dist/codegen/generators/typescript/channels/utils.d.ts +64 -0
  112. package/dist/codegen/generators/typescript/channels/utils.js +163 -0
  113. package/dist/codegen/generators/typescript/client/index.d.ts +8 -0
  114. package/dist/codegen/generators/typescript/client/index.js +61 -0
  115. package/dist/codegen/generators/typescript/client/protocols/nats/corePublish.d.ts +6 -0
  116. package/dist/codegen/generators/typescript/client/protocols/nats/corePublish.js +53 -0
  117. package/dist/codegen/generators/typescript/client/protocols/nats/coreSubscribe.d.ts +6 -0
  118. package/dist/codegen/generators/typescript/client/protocols/nats/coreSubscribe.js +90 -0
  119. package/dist/codegen/generators/typescript/client/protocols/nats/jetStreamPullSubscription.d.ts +6 -0
  120. package/dist/codegen/generators/typescript/client/protocols/nats/jetStreamPullSubscription.js +83 -0
  121. package/dist/codegen/generators/typescript/client/protocols/nats/jetstreamPublish.d.ts +6 -0
  122. package/dist/codegen/generators/typescript/client/protocols/nats/jetstreamPublish.js +54 -0
  123. package/dist/codegen/generators/typescript/client/protocols/nats/jetstreamPushSubscription.d.ts +6 -0
  124. package/dist/codegen/generators/typescript/client/protocols/nats/jetstreamPushSubscription.js +82 -0
  125. package/dist/codegen/generators/typescript/client/protocols/nats.d.ts +2 -0
  126. package/dist/codegen/generators/typescript/client/protocols/nats.js +182 -0
  127. package/dist/codegen/generators/typescript/client/types.d.ts +49 -0
  128. package/dist/codegen/generators/typescript/client/types.js +37 -0
  129. package/dist/codegen/generators/typescript/headers.d.ts +54 -0
  130. package/dist/codegen/generators/typescript/headers.js +138 -0
  131. package/dist/codegen/generators/typescript/index.d.ts +7 -0
  132. package/dist/codegen/generators/typescript/index.js +38 -0
  133. package/dist/codegen/generators/typescript/models.d.ts +21761 -0
  134. package/dist/codegen/generators/typescript/models.js +64 -0
  135. package/dist/codegen/generators/typescript/parameters.d.ts +37 -0
  136. package/dist/codegen/generators/typescript/parameters.js +101 -0
  137. package/dist/codegen/generators/typescript/payloads.d.ts +73 -0
  138. package/dist/codegen/generators/typescript/payloads.js +250 -0
  139. package/dist/codegen/generators/typescript/types.d.ts +34 -0
  140. package/dist/codegen/generators/typescript/types.js +70 -0
  141. package/dist/codegen/generators/typescript/utils.d.ts +38 -0
  142. package/dist/codegen/generators/typescript/utils.js +195 -0
  143. package/dist/codegen/index.d.ts +7 -0
  144. package/dist/codegen/index.js +38 -0
  145. package/dist/codegen/inputs/asyncapi/generators/headers.d.ts +3 -0
  146. package/dist/codegen/inputs/asyncapi/generators/headers.js +41 -0
  147. package/dist/codegen/inputs/asyncapi/generators/parameters.d.ts +14 -0
  148. package/dist/codegen/inputs/asyncapi/generators/parameters.js +120 -0
  149. package/dist/codegen/inputs/asyncapi/generators/payloads.d.ts +16 -0
  150. package/dist/codegen/inputs/asyncapi/generators/payloads.js +124 -0
  151. package/dist/codegen/inputs/asyncapi/generators/types.d.ts +9 -0
  152. package/dist/codegen/inputs/asyncapi/generators/types.js +61 -0
  153. package/dist/codegen/inputs/asyncapi/index.d.ts +1 -0
  154. package/dist/codegen/inputs/asyncapi/index.js +7 -0
  155. package/dist/codegen/inputs/asyncapi/parser.d.ts +4 -0
  156. package/dist/codegen/inputs/asyncapi/parser.js +90 -0
  157. package/dist/codegen/inputs/index.d.ts +3 -0
  158. package/dist/codegen/inputs/index.js +19 -0
  159. package/dist/codegen/inputs/jsonschema/generators/index.d.ts +1 -0
  160. package/dist/codegen/inputs/jsonschema/generators/index.js +5 -0
  161. package/dist/codegen/inputs/jsonschema/generators/models.d.ts +7 -0
  162. package/dist/codegen/inputs/jsonschema/generators/models.js +26 -0
  163. package/dist/codegen/inputs/jsonschema/index.d.ts +1 -0
  164. package/dist/codegen/inputs/jsonschema/index.js +7 -0
  165. package/dist/codegen/inputs/jsonschema/parser.d.ts +31 -0
  166. package/dist/codegen/inputs/jsonschema/parser.js +128 -0
  167. package/dist/codegen/inputs/openapi/generators/headers.d.ts +3 -0
  168. package/dist/codegen/inputs/openapi/generators/headers.js +101 -0
  169. package/dist/codegen/inputs/openapi/generators/parameters.d.ts +10 -0
  170. package/dist/codegen/inputs/openapi/generators/parameters.js +852 -0
  171. package/dist/codegen/inputs/openapi/generators/payloads.d.ts +3 -0
  172. package/dist/codegen/inputs/openapi/generators/payloads.js +231 -0
  173. package/dist/codegen/inputs/openapi/generators/types.d.ts +9 -0
  174. package/dist/codegen/inputs/openapi/generators/types.js +86 -0
  175. package/dist/codegen/inputs/openapi/index.d.ts +2 -0
  176. package/dist/codegen/inputs/openapi/index.js +8 -0
  177. package/dist/codegen/inputs/openapi/parser.d.ts +4 -0
  178. package/dist/codegen/inputs/openapi/parser.js +115 -0
  179. package/dist/codegen/inputs/openapi/security.d.ts +56 -0
  180. package/dist/codegen/inputs/openapi/security.js +193 -0
  181. package/dist/codegen/modelina/index.d.ts +2 -0
  182. package/dist/codegen/modelina/index.js +20 -0
  183. package/dist/codegen/modelina/presets/index.d.ts +3 -0
  184. package/dist/codegen/modelina/presets/index.js +14 -0
  185. package/dist/codegen/modelina/presets/primitives.d.ts +34 -0
  186. package/dist/codegen/modelina/presets/primitives.js +211 -0
  187. package/dist/codegen/modelina/presets/union.d.ts +33 -0
  188. package/dist/codegen/modelina/presets/union.js +197 -0
  189. package/dist/codegen/modelina/presets/validation.d.ts +66 -0
  190. package/dist/codegen/modelina/presets/validation.js +183 -0
  191. package/dist/codegen/modelina/types.d.ts +61845 -0
  192. package/dist/codegen/modelina/types.js +412 -0
  193. package/dist/codegen/output/filesystem.d.ts +30 -0
  194. package/dist/codegen/output/filesystem.js +61 -0
  195. package/dist/codegen/output/index.d.ts +16 -0
  196. package/dist/codegen/output/index.js +57 -0
  197. package/dist/codegen/output/memory.d.ts +54 -0
  198. package/dist/codegen/output/memory.js +81 -0
  199. package/dist/codegen/output/modelina.d.ts +30 -0
  200. package/dist/codegen/output/modelina.js +30 -0
  201. package/dist/codegen/output/types.d.ts +47 -0
  202. package/dist/codegen/output/types.js +6 -0
  203. package/dist/codegen/renderer.d.ts +13 -0
  204. package/dist/codegen/renderer.js +309 -0
  205. package/dist/codegen/schemaPostProcess.d.ts +25 -0
  206. package/dist/codegen/schemaPostProcess.js +38 -0
  207. package/dist/codegen/types.d.ts +285187 -0
  208. package/dist/codegen/types.js +177 -0
  209. package/dist/codegen/utils.d.ts +126 -0
  210. package/dist/codegen/utils.js +373 -0
  211. package/dist/commands/base.d.ts +18 -0
  212. package/dist/commands/base.js +59 -0
  213. package/dist/commands/generate.d.ts +46 -0
  214. package/dist/commands/generate.js +305 -0
  215. package/dist/commands/init.d.ts +55 -0
  216. package/dist/commands/init.js +544 -0
  217. package/dist/commands/telemetry.d.ts +25 -0
  218. package/dist/commands/telemetry.js +115 -0
  219. package/dist/index.d.ts +29 -0
  220. package/dist/index.js +35 -0
  221. package/dist/telemetry/anonymize.d.ts +19 -0
  222. package/dist/telemetry/anonymize.js +73 -0
  223. package/dist/telemetry/collector.d.ts +26 -0
  224. package/dist/telemetry/collector.js +57 -0
  225. package/dist/telemetry/config.d.ts +32 -0
  226. package/dist/telemetry/config.js +97 -0
  227. package/dist/telemetry/events.d.ts +72 -0
  228. package/dist/telemetry/events.js +5 -0
  229. package/dist/telemetry/index.d.ts +46 -0
  230. package/dist/telemetry/index.js +91 -0
  231. package/dist/telemetry/notice.d.ts +8 -0
  232. package/dist/telemetry/notice.js +50 -0
  233. package/dist/telemetry/sender.d.ts +14 -0
  234. package/dist/telemetry/sender.js +125 -0
  235. package/dist/utils/gitignore.d.ts +66 -0
  236. package/dist/utils/gitignore.js +111 -0
  237. package/dist/utils/inputSource.d.ts +3 -0
  238. package/dist/utils/inputSource.js +26 -0
  239. package/dist/utils/refResolvers.d.ts +29 -0
  240. package/dist/utils/refResolvers.js +83 -0
  241. package/dist/utils/remoteFetch.d.ts +18 -0
  242. package/dist/utils/remoteFetch.js +64 -0
  243. package/oclif.manifest.json +510 -0
  244. package/package.json +155 -0
@@ -0,0 +1,8 @@
1
+ import { TypeScriptChannelRenderedFunctionType, TypeScriptChannelsGeneratorContext } from '../../types';
2
+ import { ChannelInterface } from '@asyncapi/parser';
3
+ import { renderHttpCommonTypes } from './common-types';
4
+ import { renderHttpFetchClient } from './client';
5
+ export { renderHttpCommonTypes, renderHttpFetchClient };
6
+ export { analyzeSecuritySchemes, escapeStringForCodeGen, getApiKeyDefaults, renderOAuth2Helpers, renderOAuth2Stubs, renderSecurityTypes, type AuthTypeRequirements } from './security';
7
+ export type { SecuritySchemeOptions } from '../../types';
8
+ export declare function generatehttpChannels(context: TypeScriptChannelsGeneratorContext, channel: ChannelInterface, protocolCodeFunctions: Record<string, string[]>, externalProtocolFunctionInformation: Record<string, TypeScriptChannelRenderedFunctionType[]>, dependencies: string[]): Promise<void>;
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generatehttpChannels = exports.renderSecurityTypes = exports.renderOAuth2Stubs = exports.renderOAuth2Helpers = exports.getApiKeyDefaults = exports.escapeStringForCodeGen = exports.analyzeSecuritySchemes = exports.renderHttpFetchClient = exports.renderHttpCommonTypes = void 0;
4
+ /* eslint-disable security/detect-object-injection */
5
+ const types_1 = require("../../types");
6
+ const utils_1 = require("../../../../../utils");
7
+ const utils_2 = require("../../utils");
8
+ const asyncapi_1 = require("../../asyncapi");
9
+ const common_types_1 = require("./common-types");
10
+ Object.defineProperty(exports, "renderHttpCommonTypes", { enumerable: true, get: function () { return common_types_1.renderHttpCommonTypes; } });
11
+ const client_1 = require("./client");
12
+ Object.defineProperty(exports, "renderHttpFetchClient", { enumerable: true, get: function () { return client_1.renderHttpFetchClient; } });
13
+ // Re-export security utilities for external use
14
+ var security_1 = require("./security");
15
+ Object.defineProperty(exports, "analyzeSecuritySchemes", { enumerable: true, get: function () { return security_1.analyzeSecuritySchemes; } });
16
+ Object.defineProperty(exports, "escapeStringForCodeGen", { enumerable: true, get: function () { return security_1.escapeStringForCodeGen; } });
17
+ Object.defineProperty(exports, "getApiKeyDefaults", { enumerable: true, get: function () { return security_1.getApiKeyDefaults; } });
18
+ Object.defineProperty(exports, "renderOAuth2Helpers", { enumerable: true, get: function () { return security_1.renderOAuth2Helpers; } });
19
+ Object.defineProperty(exports, "renderOAuth2Stubs", { enumerable: true, get: function () { return security_1.renderOAuth2Stubs; } });
20
+ Object.defineProperty(exports, "renderSecurityTypes", { enumerable: true, get: function () { return security_1.renderSecurityTypes; } });
21
+ async function generatehttpChannels(context, channel, protocolCodeFunctions, externalProtocolFunctionInformation, dependencies) {
22
+ const { generator, parameter, topic } = context;
23
+ const ignoreOperation = !generator.asyncapiGenerateForOperations;
24
+ let renders = [];
25
+ const operations = channel.operations().all();
26
+ if (operations.length > 0 && !ignoreOperation) {
27
+ renders = generateForOperations(context, channel, topic, parameter);
28
+ }
29
+ // Generate common types once for the HTTP protocol (stateless check)
30
+ if (protocolCodeFunctions['http_client'].length === 0 && renders.length > 0) {
31
+ const commonTypesCode = (0, common_types_1.renderHttpCommonTypes)();
32
+ // Prepend common types to the beginning of the protocol code
33
+ protocolCodeFunctions['http_client'].unshift(commonTypesCode);
34
+ }
35
+ addRendersToExternal(renders, protocolCodeFunctions, externalProtocolFunctionInformation, dependencies, parameter);
36
+ }
37
+ exports.generatehttpChannels = generatehttpChannels;
38
+ function addRendersToExternal(renders, protocolCodeFunctions, externalProtocolFunctionInformation, dependencies, parameter) {
39
+ protocolCodeFunctions['http_client'].push(...renders.map((value) => value.code));
40
+ externalProtocolFunctionInformation['http_client'].push(...renders.map((value) => ({
41
+ functionType: value.functionType,
42
+ functionName: value.functionName,
43
+ messageType: value.messageType,
44
+ replyType: value.replyType,
45
+ parameterType: parameter?.type
46
+ })));
47
+ const renderedDependencies = renders
48
+ .map((value) => value.dependencies)
49
+ .flat(Infinity);
50
+ dependencies.push(...new Set(renderedDependencies));
51
+ }
52
+ // eslint-disable-next-line sonarjs/cognitive-complexity
53
+ function generateForOperations(context, channel, topic, parameters) {
54
+ const renders = [];
55
+ const { generator, payloads } = context;
56
+ const functionTypeMapping = generator.functionTypeMapping?.[channel.id()];
57
+ for (const operation of channel.operations().all()) {
58
+ const updatedFunctionTypeMapping = (0, asyncapi_1.getFunctionTypeMappingFromAsyncAPI)(operation) ?? functionTypeMapping;
59
+ const action = operation.action();
60
+ if ((0, asyncapi_1.shouldRenderFunctionType)(updatedFunctionTypeMapping, types_1.ChannelFunctionTypes.HTTP_CLIENT, action, generator.asyncapiReverseOperations)) {
61
+ const httpMethod = operation.bindings().get('http')?.json()['method'] ?? 'GET';
62
+ const payloadId = (0, utils_1.findOperationId)(operation, channel);
63
+ const payload = payloads.operationModels[payloadId];
64
+ const methodsWithBody = ['POST', 'PUT', 'PATCH'];
65
+ const hasBody = methodsWithBody.includes(httpMethod.toUpperCase());
66
+ const { messageModule, messageType } = (0, utils_2.getMessageTypeAndModule)(payload);
67
+ const reply = operation.reply();
68
+ if (reply) {
69
+ const replyId = (0, utils_1.findReplyId)(operation, reply, channel);
70
+ const replyMessageModel = payloads.operationModels[replyId];
71
+ if (!replyMessageModel) {
72
+ throw new Error(`Could not find payload for reply ${replyId} for channel typescript generator for HTTP`);
73
+ }
74
+ const { messageModule: replyMessageModule, messageType: replyMessageType, includesStatusCodes: replyIncludesStatusCodes } = (0, utils_2.getMessageTypeAndModule)(replyMessageModel);
75
+ if (replyMessageType === undefined) {
76
+ throw new Error(`Could not find reply message type for channel typescript generator for HTTP`);
77
+ }
78
+ const { description, deprecated } = (0, utils_1.getOperationMetadata)(operation);
79
+ renders.push((0, client_1.renderHttpFetchClient)({
80
+ subName: (0, utils_1.findNameFromOperation)(operation, channel),
81
+ requestMessageModule: hasBody ? messageModule : undefined,
82
+ requestMessageType: hasBody ? messageType : undefined,
83
+ replyMessageModule,
84
+ replyMessageType,
85
+ requestTopic: topic,
86
+ method: httpMethod.toUpperCase(),
87
+ channelParameters: parameters !== undefined ? parameters : undefined,
88
+ includesStatusCodes: replyIncludesStatusCodes,
89
+ description,
90
+ deprecated
91
+ }));
92
+ }
93
+ }
94
+ }
95
+ return renders;
96
+ }
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Security type generation for HTTP client.
3
+ * Analyzes OpenAPI security schemes and generates TypeScript auth interfaces.
4
+ */
5
+ import { SecuritySchemeOptions } from '../../types';
6
+ /**
7
+ * Escapes special characters in strings that will be interpolated into generated code.
8
+ * Prevents syntax errors when OpenAPI spec values contain quotes, backticks, or template expressions.
9
+ */
10
+ export declare function escapeStringForCodeGen(value: string | undefined): string;
11
+ /**
12
+ * Determines which auth types are needed based on security schemes.
13
+ */
14
+ export interface AuthTypeRequirements {
15
+ bearer: boolean;
16
+ basic: boolean;
17
+ apiKey: boolean;
18
+ oauth2: boolean;
19
+ apiKeySchemes: SecuritySchemeOptions[];
20
+ oauth2Schemes: SecuritySchemeOptions[];
21
+ }
22
+ /**
23
+ * Analyzes security schemes to determine which auth types are needed.
24
+ */
25
+ export declare function analyzeSecuritySchemes(schemes: SecuritySchemeOptions[] | undefined): AuthTypeRequirements;
26
+ /**
27
+ * Extracts API key defaults from schemes.
28
+ * If there's exactly one apiKey scheme, use its values; otherwise use standard defaults.
29
+ */
30
+ export declare function getApiKeyDefaults(apiKeySchemes: SecuritySchemeOptions[]): {
31
+ name: string;
32
+ in: string;
33
+ };
34
+ /**
35
+ * Generates the security configuration types based on extracted security schemes.
36
+ */
37
+ export declare function renderSecurityTypes(schemes: SecuritySchemeOptions[] | undefined, requirements?: AuthTypeRequirements): string;
38
+ /**
39
+ * Generate OAuth2 stub functions when OAuth2 is not available.
40
+ * These stubs ensure TypeScript compilation succeeds when generated code
41
+ * references OAuth2 functions, but the runtime guards prevent them from being called.
42
+ */
43
+ export declare function renderOAuth2Stubs(): string;
44
+ /**
45
+ * Generates OAuth2-specific helper functions.
46
+ * Only included when OAuth2 auth is needed.
47
+ */
48
+ export declare function renderOAuth2Helpers(): string;
@@ -0,0 +1,491 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.renderOAuth2Helpers = exports.renderOAuth2Stubs = exports.renderSecurityTypes = exports.getApiKeyDefaults = exports.analyzeSecuritySchemes = exports.escapeStringForCodeGen = void 0;
4
+ /**
5
+ * Escapes special characters in strings that will be interpolated into generated code.
6
+ * Prevents syntax errors when OpenAPI spec values contain quotes, backticks, or template expressions.
7
+ */
8
+ function escapeStringForCodeGen(value) {
9
+ if (!value) {
10
+ return '';
11
+ }
12
+ return value
13
+ .replace(/\\/g, '\\\\') // Escape backslashes first
14
+ .replace(/\n/g, '\\n') // Escape newlines
15
+ .replace(/\r/g, '\\r') // Escape carriage returns
16
+ .replace(/'/g, "\\'") // Escape single quotes
17
+ .replace(/`/g, '\\`') // Escape backticks
18
+ .replace(/\$/g, '\\$') // Escape dollar signs (prevents ${} template evaluation)
19
+ .replace(/\*\//g, '*\\/'); // Escape */ to prevent JSDoc comment injection
20
+ }
21
+ exports.escapeStringForCodeGen = escapeStringForCodeGen;
22
+ /**
23
+ * Analyzes security schemes to determine which auth types are needed.
24
+ */
25
+ function analyzeSecuritySchemes(schemes) {
26
+ // undefined or empty array = backward compatibility mode, generate all types
27
+ // This allows users to manually configure auth even if no schemes are defined
28
+ if (!schemes || schemes.length === 0) {
29
+ return {
30
+ bearer: true,
31
+ basic: true,
32
+ apiKey: true,
33
+ oauth2: true,
34
+ apiKeySchemes: [],
35
+ oauth2Schemes: []
36
+ };
37
+ }
38
+ const requirements = {
39
+ bearer: false,
40
+ basic: false,
41
+ apiKey: false,
42
+ oauth2: false,
43
+ apiKeySchemes: [],
44
+ oauth2Schemes: []
45
+ };
46
+ for (const scheme of schemes) {
47
+ switch (scheme.type) {
48
+ case 'apiKey':
49
+ requirements.apiKey = true;
50
+ requirements.apiKeySchemes.push(scheme);
51
+ break;
52
+ case 'http':
53
+ if (scheme.httpScheme === 'bearer') {
54
+ requirements.bearer = true;
55
+ }
56
+ else if (scheme.httpScheme === 'basic') {
57
+ requirements.basic = true;
58
+ }
59
+ break;
60
+ case 'oauth2':
61
+ case 'openIdConnect':
62
+ requirements.oauth2 = true;
63
+ requirements.oauth2Schemes.push(scheme);
64
+ break;
65
+ }
66
+ }
67
+ return requirements;
68
+ }
69
+ exports.analyzeSecuritySchemes = analyzeSecuritySchemes;
70
+ /**
71
+ * Generates the BearerAuth interface.
72
+ */
73
+ function renderBearerAuthInterface() {
74
+ return `/**
75
+ * Bearer token authentication configuration
76
+ */
77
+ export interface BearerAuth {
78
+ type: 'bearer';
79
+ token: string;
80
+ }`;
81
+ }
82
+ /**
83
+ * Generates the BasicAuth interface.
84
+ */
85
+ function renderBasicAuthInterface() {
86
+ return `/**
87
+ * Basic authentication configuration (username/password)
88
+ */
89
+ export interface BasicAuth {
90
+ type: 'basic';
91
+ username: string;
92
+ password: string;
93
+ }`;
94
+ }
95
+ /**
96
+ * Extracts API key defaults from schemes.
97
+ * If there's exactly one apiKey scheme, use its values; otherwise use standard defaults.
98
+ */
99
+ function getApiKeyDefaults(apiKeySchemes) {
100
+ if (apiKeySchemes.length === 1) {
101
+ return {
102
+ name: apiKeySchemes[0].apiKeyName || 'X-API-Key',
103
+ in: apiKeySchemes[0].apiKeyIn || 'header'
104
+ };
105
+ }
106
+ return {
107
+ name: 'X-API-Key',
108
+ in: 'header'
109
+ };
110
+ }
111
+ exports.getApiKeyDefaults = getApiKeyDefaults;
112
+ /**
113
+ * Generates the ApiKeyAuth interface with optional pre-populated defaults from spec.
114
+ */
115
+ function renderApiKeyAuthInterface(apiKeySchemes) {
116
+ const defaults = getApiKeyDefaults(apiKeySchemes);
117
+ // For cookie support
118
+ const inType = apiKeySchemes.some((s) => s.apiKeyIn === 'cookie')
119
+ ? "'header' | 'query' | 'cookie'"
120
+ : "'header' | 'query'";
121
+ // Escape spec values for safe interpolation into generated code
122
+ const escapedDefaultName = escapeStringForCodeGen(defaults.name);
123
+ const escapedDefaultIn = escapeStringForCodeGen(defaults.in);
124
+ return `/**
125
+ * API key authentication configuration
126
+ */
127
+ export interface ApiKeyAuth {
128
+ type: 'apiKey';
129
+ key: string;
130
+ name?: string; // Name of the API key parameter (default: '${escapedDefaultName}')
131
+ in?: ${inType}; // Where to place the API key (default: '${escapedDefaultIn}')
132
+ }`;
133
+ }
134
+ /**
135
+ * Extracts the tokenUrl from OAuth2 flows.
136
+ */
137
+ function extractTokenUrl(flows) {
138
+ return (flows.clientCredentials?.tokenUrl ||
139
+ flows.password?.tokenUrl ||
140
+ flows.authorizationCode?.tokenUrl);
141
+ }
142
+ /**
143
+ * Extracts the authorizationUrl from OAuth2 flows.
144
+ */
145
+ function extractAuthorizationUrl(flows) {
146
+ return (flows.implicit?.authorizationUrl ||
147
+ flows.authorizationCode?.authorizationUrl);
148
+ }
149
+ /**
150
+ * Collects all scopes from OAuth2 flows.
151
+ */
152
+ function collectScopes(flows) {
153
+ const allScopes = new Set();
154
+ const flowTypes = [
155
+ flows.implicit,
156
+ flows.password,
157
+ flows.clientCredentials,
158
+ flows.authorizationCode
159
+ ];
160
+ for (const flow of flowTypes) {
161
+ if (flow?.scopes) {
162
+ Object.keys(flow.scopes).forEach((s) => allScopes.add(s));
163
+ }
164
+ }
165
+ return allScopes;
166
+ }
167
+ /**
168
+ * Formats scopes into a documentation comment.
169
+ */
170
+ function formatScopesComment(scopes) {
171
+ if (scopes.size === 0) {
172
+ return '';
173
+ }
174
+ const scopeList = Array.from(scopes)
175
+ .slice(0, 3)
176
+ .map((scope) => escapeStringForCodeGen(scope))
177
+ .join(', ');
178
+ const suffix = scopes.size > 3 ? '...' : '';
179
+ return ` Available: ${scopeList}${suffix}`;
180
+ }
181
+ /**
182
+ * Extracts documentation comments from a single OAuth2 scheme.
183
+ */
184
+ function extractSchemeComments(scheme, existing) {
185
+ if (scheme.openIdConnectUrl) {
186
+ return {
187
+ ...existing,
188
+ tokenUrlComment: `OpenID Connect URL: '${escapeStringForCodeGen(scheme.openIdConnectUrl)}'`
189
+ };
190
+ }
191
+ if (!scheme.oauth2Flows) {
192
+ return existing;
193
+ }
194
+ const tokenUrl = extractTokenUrl(scheme.oauth2Flows);
195
+ const authUrl = extractAuthorizationUrl(scheme.oauth2Flows);
196
+ const allScopes = collectScopes(scheme.oauth2Flows);
197
+ return {
198
+ tokenUrlComment: tokenUrl
199
+ ? `default: '${escapeStringForCodeGen(tokenUrl)}'`
200
+ : existing.tokenUrlComment,
201
+ authorizationUrlComment: authUrl
202
+ ? ` Authorization URL: '${escapeStringForCodeGen(authUrl)}'`
203
+ : existing.authorizationUrlComment,
204
+ scopesComment: formatScopesComment(allScopes) || existing.scopesComment
205
+ };
206
+ }
207
+ /**
208
+ * Extracts documentation comments from OAuth2 schemes.
209
+ */
210
+ function extractOAuth2DocComments(oauth2Schemes) {
211
+ const initial = {
212
+ tokenUrlComment: 'required for client_credentials/password flows and token refresh',
213
+ authorizationUrlComment: '',
214
+ scopesComment: ''
215
+ };
216
+ return oauth2Schemes.reduce((acc, scheme) => extractSchemeComments(scheme, acc), initial);
217
+ }
218
+ /**
219
+ * Generates the OAuth2Auth interface with optional pre-populated values from spec.
220
+ */
221
+ function renderOAuth2AuthInterface(oauth2Schemes) {
222
+ const { tokenUrlComment, authorizationUrlComment, scopesComment } = extractOAuth2DocComments(oauth2Schemes);
223
+ const flowsInfo = authorizationUrlComment
224
+ ? `\n *${authorizationUrlComment}`
225
+ : '';
226
+ return `/**
227
+ * OAuth2 authentication configuration
228
+ *
229
+ * Supports server-side flows only:
230
+ * - client_credentials: Server-to-server authentication
231
+ * - password: Resource owner password credentials (legacy, not recommended)
232
+ * - Pre-obtained accessToken: For tokens obtained via browser-based flows
233
+ *
234
+ * For browser-based flows (implicit, authorization_code), obtain the token
235
+ * separately and pass it as accessToken.${flowsInfo}
236
+ */
237
+ export interface OAuth2Auth {
238
+ type: 'oauth2';
239
+ /** Pre-obtained access token (required if not using a server-side flow) */
240
+ accessToken?: string;
241
+ /** Refresh token for automatic token renewal on 401 */
242
+ refreshToken?: string;
243
+ /** Token endpoint URL (${tokenUrlComment}) */
244
+ tokenUrl?: string;
245
+ /** Client ID (required for flows and token refresh) */
246
+ clientId?: string;
247
+ /** Client secret (optional, depends on OAuth provider) */
248
+ clientSecret?: string;
249
+ /** Requested scopes${scopesComment} */
250
+ scopes?: string[];
251
+ /** Server-side flow type */
252
+ flow?: 'password' | 'client_credentials';
253
+ /** Username for password flow */
254
+ username?: string;
255
+ /** Password for password flow */
256
+ password?: string;
257
+ /** Callback when tokens are refreshed (for caching/persistence) */
258
+ onTokenRefresh?: (newTokens: TokenResponse) => void;
259
+ }`;
260
+ }
261
+ /**
262
+ * Generates the AuthConfig union type based on which auth types are needed.
263
+ */
264
+ function renderAuthConfigType(requirements) {
265
+ const types = [];
266
+ if (requirements.bearer) {
267
+ types.push('BearerAuth');
268
+ }
269
+ if (requirements.basic) {
270
+ types.push('BasicAuth');
271
+ }
272
+ if (requirements.apiKey) {
273
+ types.push('ApiKeyAuth');
274
+ }
275
+ if (requirements.oauth2) {
276
+ types.push('OAuth2Auth');
277
+ }
278
+ // If no types are needed (e.g., no recognized security schemes), don't generate AuthConfig
279
+ // The auth field in HttpClientContext is optional, so this is safe
280
+ if (types.length === 0) {
281
+ return '// No authentication types needed for this API\nexport type AuthConfig = never;';
282
+ }
283
+ return `/**
284
+ * Union type for all authentication methods - provides autocomplete support
285
+ */
286
+ export type AuthConfig = ${types.join(' | ')};`;
287
+ }
288
+ /**
289
+ * Generates the security configuration types based on extracted security schemes.
290
+ */
291
+ function renderSecurityTypes(schemes, requirements) {
292
+ const authRequirements = requirements ?? analyzeSecuritySchemes(schemes);
293
+ const bearerSection = authRequirements.bearer
294
+ ? `${renderBearerAuthInterface()}\n\n`
295
+ : '';
296
+ const basicSection = authRequirements.basic
297
+ ? `${renderBasicAuthInterface()}\n\n`
298
+ : '';
299
+ const apiKeySection = authRequirements.apiKey
300
+ ? `${renderApiKeyAuthInterface(authRequirements.apiKeySchemes)}\n\n`
301
+ : '';
302
+ const oauth2Section = authRequirements.oauth2
303
+ ? `${renderOAuth2AuthInterface(authRequirements.oauth2Schemes)}\n\n`
304
+ : '';
305
+ return `// ============================================================================
306
+ // Security Configuration Types - Grouped for better autocomplete
307
+ // ============================================================================
308
+
309
+ ${bearerSection}${basicSection}${apiKeySection}${oauth2Section}${renderAuthConfigType(authRequirements)}`;
310
+ }
311
+ exports.renderSecurityTypes = renderSecurityTypes;
312
+ /**
313
+ * Generate OAuth2 stub functions when OAuth2 is not available.
314
+ * These stubs ensure TypeScript compilation succeeds when generated code
315
+ * references OAuth2 functions, but the runtime guards prevent them from being called.
316
+ */
317
+ function renderOAuth2Stubs() {
318
+ return `
319
+ // OAuth2 helpers not needed for this API - provide type-safe stubs
320
+ // These are never called due to AUTH_FEATURES.oauth2 runtime guards
321
+ type OAuth2Auth = never;
322
+ function validateOAuth2Config(_auth: OAuth2Auth): void {}
323
+ async function handleOAuth2TokenFlow(
324
+ _auth: OAuth2Auth,
325
+ _originalParams: HttpRequestParams,
326
+ _makeRequest: (params: HttpRequestParams) => Promise<HttpResponse>,
327
+ _retryConfig?: RetryConfig
328
+ ): Promise<HttpResponse | null> { return null; }
329
+ async function handleTokenRefresh(
330
+ _auth: OAuth2Auth,
331
+ _originalParams: HttpRequestParams,
332
+ _makeRequest: (params: HttpRequestParams) => Promise<HttpResponse>,
333
+ _retryConfig?: RetryConfig
334
+ ): Promise<HttpResponse | null> { return null; }`;
335
+ }
336
+ exports.renderOAuth2Stubs = renderOAuth2Stubs;
337
+ /**
338
+ * Generates OAuth2-specific helper functions.
339
+ * Only included when OAuth2 auth is needed.
340
+ */
341
+ function renderOAuth2Helpers() {
342
+ return `
343
+ /**
344
+ * Validate OAuth2 configuration based on flow type
345
+ */
346
+ function validateOAuth2Config(auth: OAuth2Auth): void {
347
+ // If using a flow, validate required fields
348
+ switch (auth.flow) {
349
+ case 'client_credentials':
350
+ if (!auth.tokenUrl) throw new Error('OAuth2 Client Credentials flow requires tokenUrl');
351
+ if (!auth.clientId) throw new Error('OAuth2 Client Credentials flow requires clientId');
352
+ break;
353
+
354
+ case 'password':
355
+ if (!auth.tokenUrl) throw new Error('OAuth2 Password flow requires tokenUrl');
356
+ if (!auth.clientId) throw new Error('OAuth2 Password flow requires clientId');
357
+ if (!auth.username) throw new Error('OAuth2 Password flow requires username');
358
+ if (!auth.password) throw new Error('OAuth2 Password flow requires password');
359
+ break;
360
+
361
+ default:
362
+ // No flow specified - must have accessToken for OAuth2 to work
363
+ if (!auth.accessToken && !auth.flow) {
364
+ // This is fine - token refresh can still work if refreshToken is provided
365
+ // Or the request will just be made without auth
366
+ }
367
+ break;
368
+ }
369
+ }
370
+
371
+ /**
372
+ * Handle OAuth2 token flows (client_credentials, password)
373
+ */
374
+ async function handleOAuth2TokenFlow(
375
+ auth: OAuth2Auth,
376
+ originalParams: HttpRequestParams,
377
+ makeRequest: (params: HttpRequestParams) => Promise<HttpResponse>,
378
+ retryConfig?: RetryConfig
379
+ ): Promise<HttpResponse | null> {
380
+ if (!auth.flow || !auth.tokenUrl) return null;
381
+
382
+ const params = new URLSearchParams();
383
+
384
+ if (auth.flow === 'client_credentials') {
385
+ params.append('grant_type', 'client_credentials');
386
+ params.append('client_id', auth.clientId!);
387
+ } else if (auth.flow === 'password') {
388
+ params.append('grant_type', 'password');
389
+ params.append('username', auth.username || '');
390
+ params.append('password', auth.password || '');
391
+ params.append('client_id', auth.clientId!);
392
+ } else {
393
+ return null;
394
+ }
395
+
396
+ if (auth.clientSecret) {
397
+ params.append('client_secret', auth.clientSecret);
398
+ }
399
+ if (auth.scopes && auth.scopes.length > 0) {
400
+ params.append('scope', auth.scopes.join(' '));
401
+ }
402
+
403
+ const authHeaders: Record<string, string> = {
404
+ 'Content-Type': 'application/x-www-form-urlencoded'
405
+ };
406
+
407
+ // Use basic auth for client credentials if both client ID and secret are provided
408
+ if (auth.flow === 'client_credentials' && auth.clientId && auth.clientSecret) {
409
+ const credentials = Buffer.from(\`\${auth.clientId}:\${auth.clientSecret}\`).toString('base64');
410
+ authHeaders['Authorization'] = \`Basic \${credentials}\`;
411
+ params.delete('client_id');
412
+ params.delete('client_secret');
413
+ }
414
+
415
+ const tokenResponse = await NodeFetch.default(auth.tokenUrl, {
416
+ method: 'POST',
417
+ headers: authHeaders,
418
+ body: params.toString()
419
+ });
420
+
421
+ if (!tokenResponse.ok) {
422
+ throw new Error(\`OAuth2 token request failed: \${tokenResponse.statusText}\`);
423
+ }
424
+
425
+ const tokenData = await tokenResponse.json();
426
+ const tokens: TokenResponse = {
427
+ accessToken: tokenData.access_token,
428
+ refreshToken: tokenData.refresh_token,
429
+ expiresIn: tokenData.expires_in
430
+ };
431
+
432
+ // Notify the client about the tokens
433
+ if (auth.onTokenRefresh) {
434
+ auth.onTokenRefresh(tokens);
435
+ }
436
+
437
+ // Retry the original request with the new token
438
+ const updatedHeaders = { ...originalParams.headers };
439
+ updatedHeaders['Authorization'] = \`Bearer \${tokens.accessToken}\`;
440
+
441
+ return executeWithRetry({ ...originalParams, headers: updatedHeaders }, makeRequest, retryConfig);
442
+ }
443
+
444
+ /**
445
+ * Handle OAuth2 token refresh on 401 response
446
+ */
447
+ async function handleTokenRefresh(
448
+ auth: OAuth2Auth,
449
+ originalParams: HttpRequestParams,
450
+ makeRequest: (params: HttpRequestParams) => Promise<HttpResponse>,
451
+ retryConfig?: RetryConfig
452
+ ): Promise<HttpResponse | null> {
453
+ if (!auth.refreshToken || !auth.tokenUrl || !auth.clientId) return null;
454
+
455
+ const refreshResponse = await NodeFetch.default(auth.tokenUrl, {
456
+ method: 'POST',
457
+ headers: {
458
+ 'Content-Type': 'application/x-www-form-urlencoded'
459
+ },
460
+ body: new URLSearchParams({
461
+ grant_type: 'refresh_token',
462
+ refresh_token: auth.refreshToken,
463
+ client_id: auth.clientId,
464
+ ...(auth.clientSecret ? { client_secret: auth.clientSecret } : {})
465
+ }).toString()
466
+ });
467
+
468
+ if (!refreshResponse.ok) {
469
+ throw new Error('Unauthorized');
470
+ }
471
+
472
+ const tokenData = await refreshResponse.json();
473
+ const newTokens: TokenResponse = {
474
+ accessToken: tokenData.access_token,
475
+ refreshToken: tokenData.refresh_token || auth.refreshToken,
476
+ expiresIn: tokenData.expires_in
477
+ };
478
+
479
+ // Notify the client about the refreshed tokens
480
+ if (auth.onTokenRefresh) {
481
+ auth.onTokenRefresh(newTokens);
482
+ }
483
+
484
+ // Retry the original request with the new token
485
+ const updatedHeaders = { ...originalParams.headers };
486
+ updatedHeaders['Authorization'] = \`Bearer \${newTokens.accessToken}\`;
487
+
488
+ return executeWithRetry({ ...originalParams, headers: updatedHeaders }, makeRequest, retryConfig);
489
+ }`;
490
+ }
491
+ exports.renderOAuth2Helpers = renderOAuth2Helpers;
@@ -0,0 +1,6 @@
1
+ import { TypeScriptChannelRenderedFunctionType, TypeScriptChannelsGeneratorContext } from '../../types';
2
+ import { renderPublish } from './publish';
3
+ import { renderSubscribe } from './subscribe';
4
+ import { ChannelInterface } from '@asyncapi/parser';
5
+ export { renderPublish, renderSubscribe };
6
+ export declare function generateKafkaChannels(context: TypeScriptChannelsGeneratorContext, channel: ChannelInterface, protocolCodeFunctions: Record<string, string[]>, externalProtocolFunctionInformation: Record<string, TypeScriptChannelRenderedFunctionType[]>, dependencies: string[]): Promise<void>;