@azure/msal-node 5.3.1 → 5.4.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 (109) hide show
  1. package/dist/cache/CacheHelpers.mjs +1 -1
  2. package/dist/cache/CacheHelpers.mjs.map +1 -1
  3. package/dist/cache/NodeStorage.mjs +1 -1
  4. package/dist/cache/NodeStorage.mjs.map +1 -1
  5. package/dist/cache/TokenCache.mjs +1 -1
  6. package/dist/cache/TokenCache.mjs.map +1 -1
  7. package/dist/cache/distributed/DistributedCachePlugin.mjs +1 -1
  8. package/dist/cache/distributed/DistributedCachePlugin.mjs.map +1 -1
  9. package/dist/cache/serializer/Deserializer.mjs +1 -1
  10. package/dist/cache/serializer/Deserializer.mjs.map +1 -1
  11. package/dist/cache/serializer/Serializer.mjs +1 -1
  12. package/dist/cache/serializer/Serializer.mjs.map +1 -1
  13. package/dist/client/BaseClient.mjs +1 -1
  14. package/dist/client/BaseClient.mjs.map +1 -1
  15. package/dist/client/ClientApplication.mjs +1 -1
  16. package/dist/client/ClientApplication.mjs.map +1 -1
  17. package/dist/client/ClientAssertion.mjs +1 -1
  18. package/dist/client/ClientAssertion.mjs.map +1 -1
  19. package/dist/client/ClientCredentialClient.mjs +1 -1
  20. package/dist/client/ClientCredentialClient.mjs.map +1 -1
  21. package/dist/client/ConfidentialClientApplication.mjs +1 -1
  22. package/dist/client/ConfidentialClientApplication.mjs.map +1 -1
  23. package/dist/client/DeviceCodeClient.mjs +1 -1
  24. package/dist/client/DeviceCodeClient.mjs.map +1 -1
  25. package/dist/client/ManagedIdentityApplication.mjs +1 -1
  26. package/dist/client/ManagedIdentityApplication.mjs.map +1 -1
  27. package/dist/client/ManagedIdentityClient.mjs +1 -1
  28. package/dist/client/ManagedIdentityClient.mjs.map +1 -1
  29. package/dist/client/ManagedIdentitySources/AppService.mjs +1 -1
  30. package/dist/client/ManagedIdentitySources/AppService.mjs.map +1 -1
  31. package/dist/client/ManagedIdentitySources/AzureArc.mjs +1 -1
  32. package/dist/client/ManagedIdentitySources/AzureArc.mjs.map +1 -1
  33. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs +1 -1
  34. package/dist/client/ManagedIdentitySources/BaseManagedIdentitySource.mjs.map +1 -1
  35. package/dist/client/ManagedIdentitySources/CloudShell.mjs +1 -1
  36. package/dist/client/ManagedIdentitySources/CloudShell.mjs.map +1 -1
  37. package/dist/client/ManagedIdentitySources/Imds.mjs +1 -1
  38. package/dist/client/ManagedIdentitySources/Imds.mjs.map +1 -1
  39. package/dist/client/ManagedIdentitySources/MachineLearning.mjs +1 -1
  40. package/dist/client/ManagedIdentitySources/MachineLearning.mjs.map +1 -1
  41. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs +1 -1
  42. package/dist/client/ManagedIdentitySources/ServiceFabric.mjs.map +1 -1
  43. package/dist/client/OnBehalfOfClient.mjs +1 -1
  44. package/dist/client/OnBehalfOfClient.mjs.map +1 -1
  45. package/dist/client/PublicClientApplication.mjs +15 -5
  46. package/dist/client/PublicClientApplication.mjs.map +1 -1
  47. package/dist/client/UserFederatedIdentityCredentialClient.mjs +1 -1
  48. package/dist/client/UserFederatedIdentityCredentialClient.mjs.map +1 -1
  49. package/dist/client/UsernamePasswordClient.mjs +1 -1
  50. package/dist/client/UsernamePasswordClient.mjs.map +1 -1
  51. package/dist/config/Configuration.mjs +1 -1
  52. package/dist/config/Configuration.mjs.map +1 -1
  53. package/dist/config/ManagedIdentityId.mjs +1 -1
  54. package/dist/config/ManagedIdentityId.mjs.map +1 -1
  55. package/dist/config/ManagedIdentityRequestParameters.mjs +1 -1
  56. package/dist/config/ManagedIdentityRequestParameters.mjs.map +1 -1
  57. package/dist/crypto/CryptoProvider.mjs +1 -1
  58. package/dist/crypto/CryptoProvider.mjs.map +1 -1
  59. package/dist/crypto/GuidGenerator.mjs +1 -1
  60. package/dist/crypto/GuidGenerator.mjs.map +1 -1
  61. package/dist/crypto/HashUtils.mjs +1 -1
  62. package/dist/crypto/HashUtils.mjs.map +1 -1
  63. package/dist/crypto/PkceGenerator.mjs +1 -1
  64. package/dist/crypto/PkceGenerator.mjs.map +1 -1
  65. package/dist/error/ClientAuthErrorCodes.mjs +1 -1
  66. package/dist/error/ManagedIdentityError.mjs +1 -1
  67. package/dist/error/ManagedIdentityError.mjs.map +1 -1
  68. package/dist/error/ManagedIdentityErrorCodes.mjs +1 -1
  69. package/dist/error/ManagedIdentityErrorCodes.mjs.map +1 -1
  70. package/dist/error/NodeAuthError.mjs +1 -1
  71. package/dist/error/NodeAuthError.mjs.map +1 -1
  72. package/dist/index.mjs +1 -1
  73. package/dist/internals.mjs +1 -1
  74. package/dist/network/HttpClient.mjs +1 -1
  75. package/dist/network/HttpClient.mjs.map +1 -1
  76. package/dist/network/HttpClientWithRetries.mjs +1 -1
  77. package/dist/network/HttpClientWithRetries.mjs.map +1 -1
  78. package/dist/network/LoopbackClient.mjs +100 -14
  79. package/dist/network/LoopbackClient.mjs.map +1 -1
  80. package/dist/packageMetadata.mjs +2 -2
  81. package/dist/protocol/Authorize.mjs +1 -1
  82. package/dist/protocol/Authorize.mjs.map +1 -1
  83. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs +1 -1
  84. package/dist/retry/DefaultManagedIdentityRetryPolicy.mjs.map +1 -1
  85. package/dist/retry/ExponentialRetryStrategy.mjs +1 -1
  86. package/dist/retry/ExponentialRetryStrategy.mjs.map +1 -1
  87. package/dist/retry/ImdsRetryPolicy.mjs +1 -1
  88. package/dist/retry/ImdsRetryPolicy.mjs.map +1 -1
  89. package/dist/retry/LinearRetryStrategy.mjs +1 -1
  90. package/dist/retry/LinearRetryStrategy.mjs.map +1 -1
  91. package/dist/utils/Constants.mjs +1 -1
  92. package/dist/utils/Constants.mjs.map +1 -1
  93. package/dist/utils/EncodingUtils.mjs +1 -1
  94. package/dist/utils/EncodingUtils.mjs.map +1 -1
  95. package/dist/utils/TimeUtils.mjs +1 -1
  96. package/dist/utils/TimeUtils.mjs.map +1 -1
  97. package/lib/msal-node.cjs +5671 -5572
  98. package/lib/msal-node.cjs.map +1 -1
  99. package/package.json +2 -2
  100. package/src/client/PublicClientApplication.ts +27 -2
  101. package/src/network/LoopbackClient.ts +133 -17
  102. package/src/packageMetadata.ts +1 -1
  103. package/src/request/InteractiveRequest.ts +6 -0
  104. package/types/client/PublicClientApplication.d.ts.map +1 -1
  105. package/types/network/LoopbackClient.d.ts +6 -0
  106. package/types/network/LoopbackClient.d.ts.map +1 -1
  107. package/types/packageMetadata.d.ts +1 -1
  108. package/types/request/InteractiveRequest.d.ts +6 -0
  109. package/types/request/InteractiveRequest.d.ts.map +1 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@azure/msal-node",
4
- "version": "5.3.1",
4
+ "version": "5.4.0",
5
5
  "author": {
6
6
  "name": "Microsoft",
7
7
  "email": "nugetaad@microsoft.com",
@@ -84,7 +84,7 @@
84
84
  "yargs": "^17.3.1"
85
85
  },
86
86
  "dependencies": {
87
- "@azure/msal-common": "16.11.0",
87
+ "@azure/msal-common": "16.11.1",
88
88
  "jsonwebtoken": "^9.0.0"
89
89
  },
90
90
  "engines": {
@@ -22,6 +22,8 @@ import {
22
22
  ServerTelemetryManager,
23
23
  AuthorizationCodePayload,
24
24
  enforceResourceParameter,
25
+ createClientConfigurationError,
26
+ ClientConfigurationErrorCodes,
25
27
  } from "@azure/msal-common/node";
26
28
  import { Configuration } from "../config/Configuration.js";
27
29
  import { ClientApplication } from "./ClientApplication.js";
@@ -158,9 +160,17 @@ export class PublicClientApplication
158
160
  errorTemplate,
159
161
  windowHandle,
160
162
  loopbackClient: customLoopbackClient,
163
+ preferredPort,
161
164
  ...remainingProperties
162
165
  } = request;
163
166
 
167
+ if (customLoopbackClient) {
168
+ this.logger.warning(
169
+ "The loopbackClient option is deprecated and will be removed in a future major version. Omit it to use the built-in loopback server, and set preferredPort when a fixed port is required.",
170
+ correlationId
171
+ );
172
+ }
173
+
164
174
  if (this.nativeBrokerPlugin) {
165
175
  const brokerRequest: NativeRequest = {
166
176
  ...remainingProperties,
@@ -197,7 +207,22 @@ export class PublicClientApplication
197
207
  await this.cryptoProvider.generatePkceCodes();
198
208
 
199
209
  const loopbackClient: ILoopbackClient =
200
- customLoopbackClient || new LoopbackClient();
210
+ customLoopbackClient || new LoopbackClient(preferredPort);
211
+
212
+ // Validate and resolve responseMode
213
+ const responseMode =
214
+ remainingProperties.responseMode ??
215
+ CommonConstants.ResponseMode.QUERY;
216
+
217
+ if (
218
+ responseMode !== CommonConstants.ResponseMode.QUERY &&
219
+ responseMode !== CommonConstants.ResponseMode.FORM_POST
220
+ ) {
221
+ throw createClientConfigurationError(
222
+ ClientConfigurationErrorCodes.invalidResponseMode,
223
+ correlationId
224
+ );
225
+ }
201
226
 
202
227
  let authCodeResponse: AuthorizeResponse = {};
203
228
  let authCodeListenerError: AuthError | null = null;
@@ -223,7 +248,7 @@ export class PublicClientApplication
223
248
  correlationId: correlationId,
224
249
  scopes: request.scopes || CommonConstants.OIDC_DEFAULT_SCOPES,
225
250
  redirectUri: redirectUri,
226
- responseMode: CommonConstants.ResponseMode.QUERY,
251
+ responseMode: responseMode,
227
252
  codeChallenge: challenge,
228
253
  codeChallengeMethod:
229
254
  CommonConstants.CodeChallengeMethodValues.S256,
@@ -15,6 +15,11 @@ import { ILoopbackClient } from "./ILoopbackClient.js";
15
15
 
16
16
  export class LoopbackClient implements ILoopbackClient {
17
17
  private server: http.Server | undefined;
18
+ private preferredPort: number | undefined;
19
+
20
+ constructor(preferredPort?: number) {
21
+ this.preferredPort = preferredPort;
22
+ }
18
23
 
19
24
  /**
20
25
  * Spins up a loopback server which returns the server response when the localhost redirectUri is hit
@@ -33,6 +38,17 @@ export class LoopbackClient implements ILoopbackClient {
33
38
  return new Promise<AuthorizeResponse>((resolve, reject) => {
34
39
  this.server = http.createServer(
35
40
  (req: http.IncomingMessage, res: http.ServerResponse) => {
41
+ const method = req.method?.toUpperCase();
42
+
43
+ // Only allow GET and POST methods
44
+ if (method !== "GET" && method !== "POST") {
45
+ res.writeHead(405, {
46
+ Allow: "GET, POST",
47
+ });
48
+ res.end("Method Not Allowed");
49
+ return;
50
+ }
51
+
36
52
  const url = req.url;
37
53
  if (!url) {
38
54
  res.end(
@@ -44,6 +60,17 @@ export class LoopbackClient implements ILoopbackClient {
44
60
  );
45
61
  return;
46
62
  } else if (url === CommonConstants.FORWARD_SLASH) {
63
+ if (method === "POST") {
64
+ this.handlePostRequest(
65
+ req,
66
+ res,
67
+ resolve,
68
+ successTemplate,
69
+ errorTemplate
70
+ );
71
+ return;
72
+ }
73
+ // GET to root — return success page (after redirect)
47
74
  res.end(
48
75
  successTemplate ||
49
76
  "Auth code was successfully acquired. You can close this window now."
@@ -51,27 +78,116 @@ export class LoopbackClient implements ILoopbackClient {
51
78
  return;
52
79
  }
53
80
 
54
- const redirectUri = this.getRedirectUri();
55
- const parsedUrl = new URL(url, redirectUri);
56
- const authCodeResponse =
57
- UrlUtils.getDeserializedResponse(parsedUrl.search) ||
58
- {};
59
- if (authCodeResponse.code) {
60
- res.writeHead(CommonConstants.HTTP_REDIRECT, {
61
- location: redirectUri,
62
- }); // Prevent auth code from being saved in the browser history
81
+ // GET with query params (existing query response_mode flow)
82
+ if (method === "GET") {
83
+ const redirectUri = this.getRedirectUri();
84
+ const parsedUrl = new URL(url, redirectUri);
85
+ const authCodeResponse =
86
+ UrlUtils.getDeserializedResponse(
87
+ parsedUrl.search
88
+ ) || {};
89
+
90
+ if (!authCodeResponse.code && !authCodeResponse.error) {
91
+ // Ignore requests without OAuth params (e.g., /favicon.ico)
92
+ res.writeHead(200);
93
+ res.end();
94
+ return;
95
+ }
96
+
97
+ if (authCodeResponse.code) {
98
+ res.writeHead(CommonConstants.HTTP_REDIRECT, {
99
+ location: redirectUri,
100
+ }); // Prevent auth code from being saved in the browser history
101
+ res.end();
102
+ }
103
+ if (authCodeResponse.error) {
104
+ res.end(
105
+ errorTemplate ||
106
+ `Error occurred: ${authCodeResponse.error}`
107
+ );
108
+ }
109
+ resolve(authCodeResponse);
110
+ } else {
111
+ // Non-root POST (no OAuth response expected here) — ignore
112
+ res.writeHead(200);
63
113
  res.end();
64
114
  }
65
- if (authCodeResponse.error) {
66
- res.end(
67
- errorTemplate ||
68
- `Error occurred: ${authCodeResponse.error}`
69
- );
70
- }
71
- resolve(authCodeResponse);
72
115
  }
73
116
  );
74
- this.server.listen(0, "127.0.0.1"); // Listen on any available port
117
+
118
+ const port = this.preferredPort || 0;
119
+ /*
120
+ * Register the error handler before listening so an immediate
121
+ * listen failure (e.g. preferredPort in use) triggers the fallback.
122
+ */
123
+ this.server.on("error", (err: NodeJS.ErrnoException) => {
124
+ if (
125
+ err.code === "EADDRINUSE" &&
126
+ this.preferredPort &&
127
+ port !== 0
128
+ ) {
129
+ // Preferred port unavailable, fall back to random port
130
+ this.server?.listen(0, "127.0.0.1");
131
+ } else {
132
+ reject(err);
133
+ }
134
+ });
135
+ this.server.listen(port, "127.0.0.1");
136
+ });
137
+ }
138
+
139
+ /**
140
+ * Handles POST requests for form_post response mode
141
+ */
142
+ private handlePostRequest(
143
+ req: http.IncomingMessage,
144
+ res: http.ServerResponse,
145
+ resolve: (value: AuthorizeResponse) => void,
146
+ successTemplate?: string,
147
+ errorTemplate?: string
148
+ ): void {
149
+ const contentType = req.headers["content-type"]?.split(";")[0]?.trim();
150
+ if (contentType !== "application/x-www-form-urlencoded") {
151
+ res.writeHead(415);
152
+ res.end("Unsupported Media Type");
153
+ return;
154
+ }
155
+
156
+ let body = "";
157
+ req.on("error", () => {
158
+ if (!res.headersSent) {
159
+ res.writeHead(400);
160
+ }
161
+ res.end();
162
+ });
163
+ req.on("data", (chunk: Buffer) => {
164
+ body += chunk.toString();
165
+ });
166
+
167
+ req.on("end", () => {
168
+ const authCodeResponse =
169
+ UrlUtils.getDeserializedResponse(`?${body}`) || {};
170
+
171
+ if (!authCodeResponse.code && !authCodeResponse.error) {
172
+ // POST without valid OAuth params — ignore
173
+ res.writeHead(200);
174
+ res.end();
175
+ return;
176
+ }
177
+
178
+ if (authCodeResponse.error) {
179
+ res.writeHead(200);
180
+ res.end(
181
+ errorTemplate || `Error occurred: ${authCodeResponse.error}`
182
+ );
183
+ } else {
184
+ res.writeHead(200);
185
+ res.end(
186
+ successTemplate ||
187
+ "Auth code was successfully acquired. You can close this window now."
188
+ );
189
+ }
190
+ resolve(authCodeResponse);
75
191
  });
76
192
  }
77
193
 
@@ -1,3 +1,3 @@
1
1
  /* eslint-disable header/header */
2
2
  export const name = "@azure/msal-node";
3
- export const version = "5.3.1";
3
+ export const version = "5.4.0";
@@ -35,6 +35,12 @@ export type InteractiveRequest = Partial<
35
35
  windowHandle?: Buffer; // Relevant only to brokered requests
36
36
  /**
37
37
  * Custom implementation for a loopback server to listen for authorization code response.
38
+ * @deprecated Omit this property to use MSAL's built-in loopback server; set `preferredPort` when a fixed port is required. This property will be removed in a future major version.
38
39
  */
39
40
  loopbackClient?: ILoopbackClient;
41
+ /**
42
+ * Preferred port for the loopback server to listen on. If the port is unavailable, a random port will be used.
43
+ * Use this instead of a custom loopbackClient when you need a fixed port for redirect URI registration.
44
+ */
45
+ preferredPort?: number;
40
46
  };
@@ -1 +1 @@
1
- {"version":3,"file":"PublicClientApplication.d.ts","sourceRoot":"","sources":["../../src/client/PublicClientApplication.ts"],"names":[],"mappings":"AAUA,OAAO,EACH,oBAAoB,EAMpB,WAAW,EAKX,wBAAwB,EAE3B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC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IAAI,CAAC;IAKvC;;;;OAIG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAkBrD;;;OAGG;IACG,cAAc,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAY9C;;;;;OAKG;YACW,kBAAkB;CA2CnC"}
@@ -2,6 +2,8 @@ import { AuthorizeResponse } from "@azure/msal-common/node";
2
2
  import { ILoopbackClient } from "./ILoopbackClient.js";
3
3
  export declare class LoopbackClient implements ILoopbackClient {
4
4
  private server;
5
+ private preferredPort;
6
+ constructor(preferredPort?: number);
5
7
  /**
6
8
  * Spins up a loopback server which returns the server response when the localhost redirectUri is hit
7
9
  * @param successTemplate
@@ -9,6 +11,10 @@ export declare class LoopbackClient implements ILoopbackClient {
9
11
  * @returns
10
12
  */
11
13
  listenForAuthCode(successTemplate?: string, errorTemplate?: string): Promise<AuthorizeResponse>;
14
+ /**
15
+ * Handles POST requests for form_post response mode
16
+ */
17
+ private handlePostRequest;
12
18
  /**
13
19
  * Get the port that the loopback server is running on
14
20
  * @returns
@@ -1 +1 @@
1
- {"version":3,"file":"LoopbackClient.d.ts","sourceRoot":"","sources":["../../src/network/LoopbackClient.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,iBAAiB,EAGpB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,qBAAa,cAAe,YAAW,eAAe;IAClD,OAAO,CAAC,MAAM,CAA0B;IAExC;;;;;OAKG;IACG,iBAAiB,CACnB,eAAe,CAAC,EAAE,MAAM,EACxB,aAAa,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,iBAAiB,CAAC;IAkD7B;;;OAGG;IACH,cAAc,IAAI,MAAM;IAgBxB;;OAEG;IACH,WAAW,IAAI,IAAI;CAetB"}
1
+ {"version":3,"file":"LoopbackClient.d.ts","sourceRoot":"","sources":["../../src/network/LoopbackClient.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,iBAAiB,EAGpB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,qBAAa,cAAe,YAAW,eAAe;IAClD,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,aAAa,CAAqB;gBAE9B,aAAa,CAAC,EAAE,MAAM;IAIlC;;;;;OAKG;IACG,iBAAiB,CACnB,eAAe,CAAC,EAAE,MAAM,EACxB,aAAa,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,iBAAiB,CAAC;IA0G7B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAoDzB;;;OAGG;IACH,cAAc,IAAI,MAAM;IAgBxB;;OAEG;IACH,WAAW,IAAI,IAAI;CAetB"}
@@ -1,3 +1,3 @@
1
1
  export declare const name = "@azure/msal-node";
2
- export declare const version = "5.3.1";
2
+ export declare const version = "5.4.0";
3
3
  //# sourceMappingURL=packageMetadata.d.ts.map
@@ -29,7 +29,13 @@ export type InteractiveRequest = Partial<Omit<CommonAuthorizationUrlRequest, "sc
29
29
  windowHandle?: Buffer;
30
30
  /**
31
31
  * Custom implementation for a loopback server to listen for authorization code response.
32
+ * @deprecated Omit this property to use MSAL's built-in loopback server; set `preferredPort` when a fixed port is required. This property will be removed in a future major version.
32
33
  */
33
34
  loopbackClient?: ILoopbackClient;
35
+ /**
36
+ * Preferred port for the loopback server to listen on. If the port is unavailable, a random port will be used.
37
+ * Use this instead of a custom loopbackClient when you need a fixed port for redirect URI registration.
38
+ */
39
+ preferredPort?: number;
34
40
  };
35
41
  //# sourceMappingURL=InteractiveRequest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InteractiveRequest.d.ts","sourceRoot":"","sources":["../../src/request/InteractiveRequest.ts"],"names":[],"mappings":";;AAKA,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,CACpC,IAAI,CAAC,6BAA6B,EAAE,QAAQ,GAAG,cAAc,CAAC,CACjE,GAAG;IACA;;OAEG;IACH,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,cAAc,CAAC,EAAE,eAAe,CAAC;CACpC,CAAC"}
1
+ {"version":3,"file":"InteractiveRequest.d.ts","sourceRoot":"","sources":["../../src/request/InteractiveRequest.ts"],"names":[],"mappings":";;AAKA,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,CACpC,IAAI,CAAC,6BAA6B,EAAE,QAAQ,GAAG,cAAc,CAAC,CACjE,GAAG;IACA;;OAEG;IACH,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C;;OAEG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,cAAc,CAAC,EAAE,eAAe,CAAC;IACjC;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC"}