@queue-it/fastly 3.6.0 → 4.4.3

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 (39) hide show
  1. package/README.md +156 -58
  2. package/package.json +23 -16
  3. package/src/contextProvider.ts +175 -0
  4. package/src/fastlyCryptoProvider.ts +8 -0
  5. package/src/helper.ts +11 -0
  6. package/{assembly/sdk → src}/helpers/crypto.ts +338 -340
  7. package/src/index.ts +3 -0
  8. package/src/integrationConfigProvider.ts +199 -0
  9. package/src/requestResponseHandler.ts +200 -0
  10. package/README-INTERNAL.md +0 -21
  11. package/asconfig.json +0 -17
  12. package/assembly/__tests__/CustomerIntegrationDecodingHandler.spec.ts +0 -1086
  13. package/assembly/__tests__/IntegrationConfigHelpersTest.spec.ts +0 -574
  14. package/assembly/__tests__/KnownUserTest.spec.ts +0 -1894
  15. package/assembly/__tests__/Mocks.ts +0 -321
  16. package/assembly/__tests__/QueueParameterHelper.spec.ts +0 -59
  17. package/assembly/__tests__/UserInQueueService.spec.ts +0 -418
  18. package/assembly/__tests__/UserInQueueStateCookieRepository.spec.ts +0 -337
  19. package/assembly/__tests__/as-pect.config.js +0 -57
  20. package/assembly/__tests__/as-pect.d.ts +0 -1
  21. package/assembly/contextProvider.ts +0 -123
  22. package/assembly/helper.ts +0 -23
  23. package/assembly/index.ts +0 -10
  24. package/assembly/integrationConfigProvider.ts +0 -32
  25. package/assembly/requestResponseHandler.ts +0 -92
  26. package/assembly/sdk/HttpContextProvider.ts +0 -24
  27. package/assembly/sdk/IntegrationConfig/CustomerIntegrationDecodingHandler.ts +0 -198
  28. package/assembly/sdk/IntegrationConfig/IntegrationConfigHelpers.ts +0 -232
  29. package/assembly/sdk/IntegrationConfig/IntegrationConfigModel.ts +0 -93
  30. package/assembly/sdk/KnownUser.ts +0 -396
  31. package/assembly/sdk/Models.ts +0 -105
  32. package/assembly/sdk/QueueITHelpers.ts +0 -263
  33. package/assembly/sdk/UserInQueueService.ts +0 -245
  34. package/assembly/sdk/UserInQueueStateCookieRepository.ts +0 -189
  35. package/assembly/sdk/helpers/Date.ts +0 -194
  36. package/assembly/sdk/helpers/Uri.ts +0 -308
  37. package/assembly/tsconfig.json +0 -6
  38. package/index.js +0 -5
  39. package/pipelines/ci.yaml +0 -28
@@ -1,396 +0,0 @@
1
- import {UserInQueueService} from './UserInQueueService'
2
- import {UserInQueueStateCookieRepository} from './UserInQueueStateCookieRepository'
3
- import {IDateTimeProvider, IHttpContextProvider} from './HttpContextProvider'
4
- import {
5
- CancelEventConfig,
6
- QueueEventConfig,
7
- KnownUserException,
8
- RequestValidationResult,
9
- ActionTypes,
10
- ValidationResult
11
- } from './Models'
12
- import {Utils, ConnectorDiagnostics, DateTimeProvider} from './QueueITHelpers'
13
- import * as IntegrationConfig from './IntegrationConfig/IntegrationConfigModel'
14
- import * as IntegrationConfigHelpers from './IntegrationConfig/IntegrationConfigHelpers'
15
- import {CustomerIntegrationDecodingHandler} from "./IntegrationConfig/CustomerIntegrationDecodingHandler";
16
- import {toISOString} from './helpers/Date'
17
-
18
- export class KnownUser {
19
- public static readonly QueueITTokenKey: string = "queueittoken";
20
- public static readonly QueueITDebugKey: string = "queueitdebug";
21
- public static readonly QueueITAjaxHeaderKey: string = "x-queueit-ajaxpageurl";
22
-
23
- static UserInQueueService: UserInQueueService | null = null;
24
-
25
- private static getUserInQueueService(
26
- httpContextProvider: IHttpContextProvider): UserInQueueService {
27
- if (this.UserInQueueService == null) {
28
- return new UserInQueueService(new UserInQueueStateCookieRepository(httpContextProvider));
29
- }
30
- return this.UserInQueueService!;
31
- }
32
-
33
- private static isQueueAjaxCall(
34
- httpContextProvider: IHttpContextProvider): bool {
35
- const ajaxHeader = httpContextProvider.getHttpRequest().getHeader(this.QueueITAjaxHeaderKey);
36
- return ajaxHeader != '';
37
- }
38
-
39
- private static generateTargetUrl(
40
- originalTargetUrl: string,
41
- httpContextProvider: IHttpContextProvider): string {
42
- return !this.isQueueAjaxCall(httpContextProvider) ?
43
- originalTargetUrl :
44
- Utils.decodeUrl(httpContextProvider.getHttpRequest().getHeader(this.QueueITAjaxHeaderKey));
45
- }
46
-
47
- private static logExtraRequestDetails(
48
- debugEntries: Map<string, string>,
49
- httpContextProvider: IHttpContextProvider,
50
- dateTimeProvider: IDateTimeProvider): void {
51
- const date = dateTimeProvider.getCurrentTime(); //new Date(Date.now());
52
- debugEntries.set("ServerUtcTime", toISOString(date).split('.')[0] + "Z");
53
- debugEntries.set("RequestIP", httpContextProvider.getHttpRequest().getUserHostAddress());
54
- debugEntries.set("RequestHttpHeader_Via", httpContextProvider.getHttpRequest().getHeader("Via"));
55
- debugEntries.set("RequestHttpHeader_Forwarded", httpContextProvider.getHttpRequest().getHeader("Forwarded"));
56
- debugEntries.set("RequestHttpHeader_XForwardedFor", httpContextProvider.getHttpRequest().getHeader("X-Forwarded-For"));
57
- debugEntries.set("RequestHttpHeader_XForwardedHost", httpContextProvider.getHttpRequest().getHeader("X-Forwarded-Host"));
58
- debugEntries.set("RequestHttpHeader_XForwardedProto", httpContextProvider.getHttpRequest().getHeader("X-Forwarded-Proto"));
59
- }
60
-
61
- private static setDebugCookie(
62
- debugEntries: Map<string, string>,
63
- httpContextProvider: IHttpContextProvider): void {
64
- let cookieValue = "";
65
- let entryKeys = debugEntries.keys();
66
- for (let i = 0; i < entryKeys.length; i++) {
67
- let key: string = entryKeys[i];
68
- cookieValue += key + "=" + debugEntries.get(key) + "|";
69
- }
70
-
71
- if (cookieValue.lastIndexOf("|") == cookieValue.length - 1) {
72
- cookieValue = cookieValue.substring(0, cookieValue.length - 1);
73
- }
74
-
75
- if (cookieValue == "")
76
- return;
77
-
78
- httpContextProvider.getHttpResponse().setCookie(
79
- this.QueueITDebugKey,
80
- cookieValue,
81
- "",
82
- Utils.getCurrentTime() + 20 * 60); // now + 20 mins
83
- }
84
-
85
- private static _resolveQueueRequestByLocalConfig(
86
- targetUrl: string,
87
- queueitToken: string,
88
- queueConfig: QueueEventConfig | null,
89
- customerId: string,
90
- secretKey: string,
91
- httpContextProvider: IHttpContextProvider,
92
- dateTimeProvider: IDateTimeProvider,
93
- debugEntries: Map<string, string>,
94
- isDebug: bool): ValidationResult {
95
-
96
- if (isDebug) {
97
- debugEntries.set("SdkVersion", UserInQueueService.SDK_VERSION);
98
- debugEntries.set("TargetUrl", targetUrl);
99
- debugEntries.set("QueueitToken", queueitToken);
100
- debugEntries.set("OriginalUrl", httpContextProvider.getHttpRequest().getAbsoluteUri());
101
- debugEntries.set("QueueConfig", queueConfig != null ? queueConfig.getString() : "NULL");
102
-
103
- this.logExtraRequestDetails(debugEntries, httpContextProvider, dateTimeProvider);
104
- }
105
-
106
- if (customerId == "")
107
- return new ValidationResult(null, new KnownUserException("customerId can not be null or empty."));
108
- if (secretKey == "")
109
- return new ValidationResult(null, new KnownUserException("secretKey can not be null or empty."));
110
- if (queueConfig == null)
111
- return new ValidationResult(null, new KnownUserException("queueConfig can not be null."));
112
- if (queueConfig.eventId == "")
113
- return new ValidationResult(null, new KnownUserException("queueConfig.eventId can not be null or empty."));
114
- if (queueConfig.queueDomain == "")
115
- return new ValidationResult(null, new KnownUserException("queueConfig.queueDomain can not be null or empty."));
116
- if (queueConfig.cookieValidityMinute <= 0)
117
- return new ValidationResult(null, new KnownUserException("queueConfig.cookieValidityMinute should be integer greater than 0."));
118
-
119
- const userInQueueService = this.getUserInQueueService(httpContextProvider);
120
- const result = userInQueueService.validateQueueRequest(targetUrl, queueitToken, queueConfig, customerId, secretKey);
121
- if (result != null && result.first != null) {
122
- result.first!.isAjaxResult = this.isQueueAjaxCall(httpContextProvider);
123
- }
124
-
125
- return result;
126
- }
127
-
128
- private static _cancelRequestByLocalConfig(
129
- targetUrl: string,
130
- queueitToken: string,
131
- cancelConfig: CancelEventConfig | null,
132
- customerId: string,
133
- secretKey: string,
134
- httpContextProvider: IHttpContextProvider,
135
- dateTimeProvider: IDateTimeProvider,
136
- debugEntries: Map<string, string>,
137
- isDebug: bool): ValidationResult {
138
-
139
- targetUrl = this.generateTargetUrl(targetUrl, httpContextProvider);
140
-
141
- if (isDebug) {
142
- debugEntries.set("SdkVersion", UserInQueueService.SDK_VERSION);
143
- debugEntries.set("TargetUrl", targetUrl);
144
- debugEntries.set("QueueitToken", queueitToken);
145
- debugEntries.set("CancelConfig", cancelConfig != null ? cancelConfig.getString() : "NULL");
146
- debugEntries.set("OriginalUrl", httpContextProvider.getHttpRequest().getAbsoluteUri());
147
-
148
- this.logExtraRequestDetails(debugEntries, httpContextProvider, dateTimeProvider);
149
- }
150
-
151
- if (targetUrl == '')
152
- return new ValidationResult(null, new KnownUserException("targetUrl can not be null or empty."));
153
- if (customerId == '')
154
- return new ValidationResult(null, new KnownUserException("customerId can not be null or empty."));
155
- if (secretKey == '')
156
- return new ValidationResult(null, new KnownUserException("secretKey can not be null or empty."));
157
- if (cancelConfig == null)
158
- return new ValidationResult(null, new KnownUserException("cancelConfig can not be null."));
159
- if (cancelConfig.eventId == '')
160
- return new ValidationResult(null, new KnownUserException("cancelConfig.eventId can not be null or empty."));
161
- if (cancelConfig.queueDomain == '')
162
- return new ValidationResult(null, new KnownUserException("cancelConfig.queueDomain can not be null or empty."));
163
-
164
- const userInQueueService = this.getUserInQueueService(httpContextProvider);
165
- const result = userInQueueService.validateCancelRequest(targetUrl, cancelConfig, customerId, secretKey);
166
- if (result.first != null) {
167
- result.first!.isAjaxResult = this.isQueueAjaxCall(httpContextProvider);
168
- }
169
-
170
- return result;
171
- }
172
-
173
- private static handleQueueAction(
174
- currentUrlWithoutQueueITToken: string, queueitToken: string,
175
- customerIntegrationInfo: IntegrationConfig.CustomerIntegration, customerId: string,
176
- secretKey: string,
177
- matchedConfig: IntegrationConfig.IntegrationConfigModel,
178
- httpContextProvider: IHttpContextProvider,
179
- dateTimeProvider: IDateTimeProvider,
180
- debugEntries: Map<string, string>,
181
- isDebug: bool): ValidationResult {
182
- let targetUrl: string;
183
-
184
- if (matchedConfig.RedirectLogic == "ForcedTargetUrl") {
185
- targetUrl = matchedConfig.ForcedTargetUrl;
186
- } else if (matchedConfig.RedirectLogic == "EventTargetUrl") {
187
- targetUrl = "";
188
- } else {
189
- targetUrl = this.generateTargetUrl(currentUrlWithoutQueueITToken, httpContextProvider);
190
- }
191
-
192
- const queueEventConfig = new QueueEventConfig(
193
- matchedConfig.EventId,
194
- matchedConfig.LayoutName,
195
- matchedConfig.Culture,
196
- matchedConfig.QueueDomain,
197
- matchedConfig.ExtendCookieValidity,
198
- matchedConfig.CookieValidityMinute,
199
- matchedConfig.CookieDomain,
200
- customerIntegrationInfo.Version,
201
- matchedConfig.Name
202
- );
203
-
204
- return this._resolveQueueRequestByLocalConfig(targetUrl, queueitToken, queueEventConfig, customerId, secretKey, httpContextProvider, dateTimeProvider, debugEntries, isDebug);
205
- }
206
-
207
- private static handleCancelAction(
208
- currentUrlWithoutQueueITToken: string, queueitToken: string,
209
- customerIntegrationInfo: IntegrationConfig.CustomerIntegration, customerId: string,
210
- secretKey: string,
211
- matchedConfig: IntegrationConfig.IntegrationConfigModel,
212
- httpContextProvider: IHttpContextProvider,
213
- dateTimeProvider: IDateTimeProvider,
214
- debugEntries: Map<string, string>,
215
- isDebug: bool): ValidationResult {
216
- const cancelEventConfig = new CancelEventConfig(
217
- matchedConfig.EventId,
218
- matchedConfig.QueueDomain,
219
- matchedConfig.CookieDomain,
220
- customerIntegrationInfo.Version,
221
- matchedConfig.Name
222
- );
223
-
224
- const targetUrl = this.generateTargetUrl(currentUrlWithoutQueueITToken, httpContextProvider);
225
- return this._cancelRequestByLocalConfig(targetUrl, queueitToken, cancelEventConfig, customerId, secretKey, httpContextProvider, dateTimeProvider, debugEntries, isDebug);
226
- }
227
-
228
- private static handleIgnoreAction(
229
- httpContextProvider: IHttpContextProvider,
230
- actionName: string): ValidationResult {
231
- const userInQueueService = this.getUserInQueueService(httpContextProvider);
232
- const result = userInQueueService.getIgnoreResult(actionName);
233
- result.isAjaxResult = this.isQueueAjaxCall(httpContextProvider);
234
- return new ValidationResult(result, null);
235
- }
236
-
237
- public static extendQueueCookie(
238
- eventId: string,
239
- cookieValidityMinute: i64,
240
- cookieDomain: string,
241
- secretKey: string,
242
- httpContextProvider: IHttpContextProvider): KnownUserException | null {
243
- if (eventId == "") {
244
- return new KnownUserException("eventId can not be null or empty.");
245
- }
246
- if (secretKey == "") {
247
- return new KnownUserException("secretKey can not be null or empty.");
248
- }
249
- if (cookieValidityMinute <= 0) {
250
- return new KnownUserException("cookieValidityMinute should be integer greater than 0.");
251
- }
252
-
253
- const userInQueueService = this.getUserInQueueService(httpContextProvider);
254
- userInQueueService.extendQueueCookie(eventId, cookieValidityMinute, cookieDomain, secretKey);
255
- return null;
256
- }
257
-
258
- public static resolveQueueRequestByLocalConfig(
259
- targetUrl: string,
260
- queueitToken: string,
261
- queueConfig: QueueEventConfig | null,
262
- customerId: string,
263
- secretKey: string,
264
- httpContextProvider: IHttpContextProvider,
265
- dateTimeProvider: IDateTimeProvider | null = null): ValidationResult {
266
- if (dateTimeProvider == null) dateTimeProvider = new DateTimeProvider();
267
- const debugEntries = new Map<string, string>();
268
- const connectorDiagnostics = ConnectorDiagnostics.verify(customerId, secretKey, queueitToken);
269
-
270
- if (connectorDiagnostics.hasError) {
271
- return new ValidationResult(connectorDiagnostics.validationResult, null);
272
- }
273
-
274
- targetUrl = this.generateTargetUrl(targetUrl, httpContextProvider);
275
- const result = this._resolveQueueRequestByLocalConfig(targetUrl, queueitToken, queueConfig, customerId, secretKey, httpContextProvider, dateTimeProvider, debugEntries, connectorDiagnostics.isEnabled);
276
- if (result != null && result.second != null) {
277
- if (connectorDiagnostics.isEnabled) {
278
- debugEntries.set("Exception", result.second!.message);
279
- }
280
- }
281
- this.setDebugCookie(debugEntries, httpContextProvider);
282
- return result;
283
- }
284
-
285
- private static handleException(diagnostics: ConnectorDiagnostics,
286
- debugEntries: Map<string, string>,
287
- ex: KnownUserException,
288
- httpContext: IHttpContextProvider): void {
289
- if (diagnostics.isEnabled) debugEntries.set('Exception', ex.message);
290
- this.setDebugCookie(debugEntries, httpContext);
291
- }
292
-
293
- public static validateRequestByIntegrationConfig(
294
- currentUrlWithoutQueueITToken: string,
295
- queueitToken: string,
296
- integrationsConfigString: string,
297
- customerId: string,
298
- secretKey: string,
299
- httpContextProvider: IHttpContextProvider,
300
- dateTimeProvider: IDateTimeProvider | null = null): ValidationResult {
301
- if (dateTimeProvider == null) dateTimeProvider = new DateTimeProvider();
302
-
303
- const debugEntries = new Map<string, string>();
304
-
305
- const connectorDiagnostics = ConnectorDiagnostics.verify(customerId, secretKey, queueitToken);
306
- if (connectorDiagnostics.hasError) {
307
- return new ValidationResult(connectorDiagnostics.validationResult, null);
308
- }
309
- if (connectorDiagnostics.isEnabled) {
310
- debugEntries.set("SdkVersion", UserInQueueService.SDK_VERSION);
311
- debugEntries.set("PureUrl", currentUrlWithoutQueueITToken);
312
- debugEntries.set("QueueitToken", queueitToken);
313
- debugEntries.set("OriginalUrl", httpContextProvider.getHttpRequest().getAbsoluteUri());
314
-
315
- this.logExtraRequestDetails(debugEntries, httpContextProvider, dateTimeProvider);
316
- }
317
-
318
- const customerIntegrationInfo = CustomerIntegrationDecodingHandler.deserialize(integrationsConfigString);
319
-
320
- if (connectorDiagnostics.isEnabled) {
321
- debugEntries.set('ConfigVersion', customerIntegrationInfo && customerIntegrationInfo.Version != 0 ? customerIntegrationInfo.Version.toString() : "NULL");
322
- }
323
-
324
- if (currentUrlWithoutQueueITToken == '') {
325
- const ex = new KnownUserException("currentUrlWithoutQueueITToken can not be null or empty.");
326
- this.handleException(connectorDiagnostics, debugEntries, ex, httpContextProvider);
327
- return new ValidationResult(null, ex);
328
- }
329
- if (customerIntegrationInfo == null || customerIntegrationInfo.Version == 0) {
330
- const ex = new KnownUserException("integrationsConfigString can not be null or empty.");
331
- this.handleException(connectorDiagnostics, debugEntries, ex, httpContextProvider);
332
- return new ValidationResult(null, ex);
333
- }
334
-
335
- const configEvaluator = new IntegrationConfigHelpers.IntegrationEvaluator();
336
-
337
- const configMatchResult = configEvaluator.getMatchedIntegrationConfig(
338
- customerIntegrationInfo,
339
- currentUrlWithoutQueueITToken,
340
- httpContextProvider.getHttpRequest());
341
-
342
- if (connectorDiagnostics.isEnabled) {
343
- debugEntries.set('MatchedConfig', configMatchResult != null && configMatchResult.first != null ?
344
- configMatchResult.first!.Name
345
- : "NULL");
346
- }
347
- if (configMatchResult == null || configMatchResult.second != null) {
348
- this.setDebugCookie(debugEntries, httpContextProvider);
349
- return new ValidationResult(new RequestValidationResult("", "", "", "", "", ""), null);
350
- }
351
- const matchedConfig = configMatchResult.first!;
352
- let result: ValidationResult
353
-
354
- if (matchedConfig.ActionType == ActionTypes.QueueAction) {
355
- result = this.handleQueueAction(currentUrlWithoutQueueITToken, queueitToken, customerIntegrationInfo,
356
- customerId, secretKey, matchedConfig, httpContextProvider, dateTimeProvider, debugEntries, connectorDiagnostics.isEnabled);
357
- } else if (matchedConfig.ActionType == ActionTypes.CancelAction) {
358
- result = this.handleCancelAction(currentUrlWithoutQueueITToken, queueitToken, customerIntegrationInfo,
359
- customerId, secretKey, matchedConfig, httpContextProvider, dateTimeProvider, debugEntries, connectorDiagnostics.isEnabled);
360
- } else {
361
- result = this.handleIgnoreAction(httpContextProvider, matchedConfig.Name);
362
- }
363
- if (result.second != null && connectorDiagnostics.isEnabled) {
364
- debugEntries.set('Exception', result.second!.message);
365
- }
366
-
367
- this.setDebugCookie(debugEntries, httpContextProvider);
368
- return result;
369
- }
370
-
371
- public static cancelRequestByLocalConfig(
372
- targetUrl: string,
373
- queueitToken: string,
374
- cancelConfig: CancelEventConfig | null,
375
- customerId: string,
376
- secretKey: string,
377
- httpContextProvider: IHttpContextProvider,
378
- dateTimeProvider: IDateTimeProvider | null = null): ValidationResult {
379
- if (dateTimeProvider == null) dateTimeProvider = new DateTimeProvider();
380
- const debugEntries = new Map<string, string>();
381
- const connectorDiagnostics = ConnectorDiagnostics.verify(customerId, secretKey, queueitToken);
382
-
383
- if (connectorDiagnostics.hasError)
384
- return new ValidationResult(connectorDiagnostics.validationResult, null);
385
-
386
- const result = this._cancelRequestByLocalConfig(
387
- targetUrl, queueitToken, cancelConfig, customerId, secretKey, httpContextProvider, dateTimeProvider, debugEntries, connectorDiagnostics.isEnabled);
388
- if (result.second != null && connectorDiagnostics.isEnabled) {
389
- debugEntries.set('Exception', result.second!.message);
390
- }
391
- this.setDebugCookie(debugEntries, httpContextProvider);
392
-
393
- return result;
394
- }
395
- }
396
-
@@ -1,105 +0,0 @@
1
- import {Utils} from './QueueITHelpers';
2
-
3
- export class Tuple<T1, T2> {
4
- first: T1
5
- second: T2
6
-
7
- constructor(first: T1, second: T2) {
8
- this.first = first;
9
- this.second = second;
10
- }
11
- }
12
-
13
- export class ValidationResult extends Tuple<RequestValidationResult | null, KnownUserException | null> {
14
-
15
- }
16
-
17
- export class QueueEventConfig {
18
- constructor(
19
- public eventId: string,
20
- public layoutName: string,
21
- public culture: string,
22
- public queueDomain: string,
23
- public extendCookieValidity: bool,
24
- public cookieValidityMinute: i64,
25
- public cookieDomain: string,
26
- public version: i64,
27
- public actionName: string = 'unspecified') {
28
- }
29
-
30
- getString(): string {
31
- return "EventId:" + this.eventId +
32
- "&Version:" + this.version.toString() +
33
- "&ActionName:" + this.actionName +
34
- "&QueueDomain:" + this.queueDomain +
35
- "&CookieDomain:" + this.cookieDomain +
36
- "&ExtendCookieValidity:" + this.extendCookieValidity.toString() +
37
- "&CookieValidityMinute:" + this.cookieValidityMinute.toString() +
38
- "&LayoutName:" + this.layoutName +
39
- "&Culture:" + this.culture;
40
- }
41
- }
42
-
43
- export class CancelEventConfig {
44
- constructor(public eventId: string,
45
- public queueDomain: string,
46
- public cookieDomain: string,
47
- public version: i64,
48
- public actionName: string = 'unspecified') {
49
- }
50
-
51
- getString(): string {
52
- return "EventId:" + this.eventId +
53
- "&Version:" + this.version.toString() +
54
- "&QueueDomain:" + this.queueDomain +
55
- "&CookieDomain:" + this.cookieDomain +
56
- "&ActionName:" + this.actionName;
57
- }
58
- }
59
-
60
- export class RequestValidationResult {
61
- constructor(
62
- public actionType: string,
63
- public eventId: string,
64
- public queueId: string,
65
- public redirectUrl: string,
66
- public redirectType: string,
67
- public actionName: string = 'unspecified'
68
- ) {
69
- }
70
-
71
- public isAjaxResult: bool;
72
-
73
- public doRedirect(): bool {
74
- return this.redirectUrl.length > 0;
75
- }
76
-
77
- public getAjaxQueueRedirectHeaderKey(): string {
78
- return "x-queueit-redirect";
79
- }
80
-
81
- public getAjaxRedirectUrl(): string {
82
- if (this.redirectUrl.length > 0) {
83
- return Utils.encodeUrl(this.redirectUrl);
84
- }
85
- return "";
86
- }
87
- }
88
-
89
- export class KnownUserException {
90
- constructor(public message: string) {
91
- }
92
- }
93
-
94
- export class ActionTypes {
95
- public static readonly QueueAction: string = "Queue";
96
- public static readonly CancelAction: string = "Cancel";
97
- public static readonly IgnoreAction: string = "Ignore";
98
- }
99
-
100
-
101
- export class KeyValuePair {
102
- constructor(public key: string, public value: string) {
103
- }
104
-
105
- }