@queue-it/fastly 1.0.4 → 2.0.0-beta.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.
@@ -1,232 +1,230 @@
1
- import * as IntegrationModels from './IntegrationConfigModel'
2
- import {KnownUserException} from '../Models'
3
- import {IHttpRequest} from '../HttpContextProvider'
4
- //@ts-ignore
5
- import {URL} from '@fastly/as-url';
6
-
7
- export interface IIntegrationEvaluator {
8
- getMatchedIntegrationConfig(
9
- customerIntegration: IntegrationModels.CustomerIntegration,
10
- currentPageUrl: string,
11
- request: IHttpRequest): IntegrationModels.IntegrationConfigModelResult | null;
12
- }
13
-
14
- export class IntegrationEvaluator implements IIntegrationEvaluator {
15
- public getMatchedIntegrationConfig(
16
- customerIntegration: IntegrationModels.CustomerIntegration,
17
- currentPageUrl: string,
18
- request: IHttpRequest | null): IntegrationModels.IntegrationConfigModelResult | null {
19
-
20
- if (request == null)
21
- return new IntegrationModels.IntegrationConfigModelResult(null, new KnownUserException("request is null"));
22
-
23
- if (customerIntegration == null)
24
- return new IntegrationModels.IntegrationConfigModelResult(null, new KnownUserException("customerIntegration is null"));
25
-
26
- for (let i = 0; i < customerIntegration.Integrations.length; i++) {
27
- let integration = customerIntegration.Integrations[i];
28
- for (let t = 0; t < integration.Triggers.length; t++) {
29
- let trigger = integration.Triggers[t];
30
- if (this.evaluateTrigger(trigger, currentPageUrl, request)) {
31
- return new IntegrationModels.IntegrationConfigModelResult(integration, null);
32
- }
33
- }
34
- }
35
- return null;
36
- }
37
-
38
- private evaluateTrigger(trigger: IntegrationModels.TriggerModel, currentPageUrl: string, request: IHttpRequest): bool {
39
- if (trigger.LogicalOperator == IntegrationModels.LogicalOperatorType.Or) {
40
- for (let i = 0; i < trigger.TriggerParts.length; i++) {
41
- let part = trigger.TriggerParts[i];
42
- if (this.evaluateTriggerPart(part, currentPageUrl, request))
43
- return true;
44
- }
45
- return false;
46
- } else {
47
- for (let i = 0; i < trigger.TriggerParts.length; i++) {
48
- let part = trigger.TriggerParts[i];
49
- let matched = this.evaluateTriggerPart(part, currentPageUrl, request);
50
- if (!matched)
51
- return false;
52
- }
53
- return true;
54
- }
55
- }
56
-
57
- private evaluateTriggerPart(triggerPart: IntegrationModels.TriggerPart, currentPageUrl: string, request: IHttpRequest): bool {
58
- if (triggerPart.ValidatorType == IntegrationModels.ValidatorType.UrlValidator) {
59
- return UrlValidatorHelper.evaluate(triggerPart, currentPageUrl);
60
- } else if (triggerPart.ValidatorType == IntegrationModels.ValidatorType.CookieValidator) {
61
- return CookieValidatorHelper.evaluate(triggerPart, request);
62
- } else if (triggerPart.ValidatorType == IntegrationModels.ValidatorType.UserAgentValidator) {
63
- return UserAgentValidatorHelper.evaluate(triggerPart, request.getUserAgent());
64
- } else if (triggerPart.ValidatorType == IntegrationModels.ValidatorType.HttpHeaderValidator) {
65
- return HttpHeaderValidatorHelper.evaluate(triggerPart, request.getHeader(triggerPart.HttpHeaderName));
66
- } else if (triggerPart.ValidatorType == IntegrationModels.ValidatorType.RequestBodyValidator) {
67
- return RequestBodyValidatorHelper.evaluate(triggerPart, request.getRequestBodyAsString());
68
- } else {
69
- return false;
70
- }
71
- }
72
- }
73
-
74
- export class UrlValidatorHelper {
75
- public static evaluate(triggerPart: IntegrationModels.TriggerPart, url: string): bool {
76
- let urlpart = this.getUrlPart(triggerPart, url);
77
- return ComparisonOperatorHelper.evaluate(
78
- triggerPart.Operator,
79
- triggerPart.IsNegative,
80
- triggerPart.IsIgnoreCase,
81
- urlpart,
82
- triggerPart.ValueToCompare,
83
- triggerPart.ValuesToCompare);
84
- }
85
-
86
- private static getUrlPart(triggerPart: IntegrationModels.TriggerPart, url: string): string {
87
- if (triggerPart.UrlPart == IntegrationModels.UrlPartType.PagePath) {
88
- return this.getPathFromUrl(url);
89
- } else if (triggerPart.UrlPart == IntegrationModels.UrlPartType.PageUrl) {
90
- return url;
91
- } else if (triggerPart.UrlPart == IntegrationModels.UrlPartType.HostName) {
92
- return this.getHostNameFromUrl(url);
93
- } else {
94
- return "";
95
- }
96
- }
97
-
98
- public static getHostNameFromUrl(url: string): string {
99
- let urlx = new URL(url);
100
- return urlx.host;
101
- }
102
-
103
- public static getPathFromUrl(url: string): string {
104
- let urlx = new URL(url);
105
- return urlx.pathname;
106
- }
107
- }
108
-
109
- export class CookieValidatorHelper {
110
- public static evaluate(triggerPart: IntegrationModels.TriggerPart, request: IHttpRequest): bool {
111
- return ComparisonOperatorHelper.evaluate(triggerPart.Operator,
112
- triggerPart.IsNegative,
113
- triggerPart.IsIgnoreCase,
114
- this.getCookie(triggerPart.CookieName, request),
115
- triggerPart.ValueToCompare,
116
- triggerPart.ValuesToCompare);
117
- }
118
-
119
- private static getCookie(cookieName: string, request: IHttpRequest): string {
120
- return request.getCookieValue(cookieName);
121
- }
122
- }
123
-
124
- export class UserAgentValidatorHelper {
125
- public static evaluate(triggerPart: IntegrationModels.TriggerPart, userAgent: string): bool {
126
-
127
- return ComparisonOperatorHelper.evaluate(triggerPart.Operator,
128
- triggerPart.IsNegative,
129
- triggerPart.IsIgnoreCase,
130
- userAgent,
131
- triggerPart.ValueToCompare,
132
- triggerPart.ValuesToCompare);
133
- }
134
- }
135
-
136
- export class RequestBodyValidatorHelper {
137
- public static evaluate(triggerPart: IntegrationModels.TriggerPart, bodyString: string): bool {
138
-
139
- return ComparisonOperatorHelper.evaluate(triggerPart.Operator,
140
- triggerPart.IsNegative,
141
- triggerPart.IsIgnoreCase,
142
- bodyString,
143
- triggerPart.ValueToCompare,
144
- triggerPart.ValuesToCompare);
145
- }
146
- }
147
-
148
- export class HttpHeaderValidatorHelper {
149
- public static evaluate(triggerPart: IntegrationModels.TriggerPart, headerValue: string): bool {
150
- return ComparisonOperatorHelper.evaluate(triggerPart.Operator,
151
- triggerPart.IsNegative,
152
- triggerPart.IsIgnoreCase,
153
- headerValue,
154
- triggerPart.ValueToCompare,
155
- triggerPart.ValuesToCompare);
156
- }
157
- }
158
-
159
- export class ComparisonOperatorHelper {
160
- public static evaluate(opt: string,
161
- isNegative: bool,
162
- isIgnoreCase: bool,
163
- value: string,
164
- valueToCompare: string,
165
- valuesToCompare: Array<string> | null): bool {
166
- if (valuesToCompare == null) {
167
- valuesToCompare = new Array<string>();
168
- }
169
- if (opt == IntegrationModels.ComparisonOperatorType.EqualS) {
170
- return ComparisonOperatorHelper.equalS(value, valueToCompare, isNegative, isIgnoreCase);
171
- } else if (opt == IntegrationModels.ComparisonOperatorType.Contains) {
172
- return ComparisonOperatorHelper.contains(value, valueToCompare, isNegative, isIgnoreCase);
173
- } else if (opt == IntegrationModels.ComparisonOperatorType.EqualsAny) {
174
- return ComparisonOperatorHelper.equalsAny(value, valuesToCompare, isNegative, isIgnoreCase);
175
- } else if (opt == IntegrationModels.ComparisonOperatorType.ContainsAny) {
176
- return ComparisonOperatorHelper.containsAny(value, valuesToCompare, isNegative, isIgnoreCase);
177
- } else {
178
- return false;
179
- }
180
- }
181
-
182
- private static contains(value: string, valueToCompare: string, isNegative: bool, ignoreCase: bool): bool {
183
- if (valueToCompare == "*" && value != "")
184
- return true;
185
-
186
- let evaluation = false;
187
-
188
- if (ignoreCase)
189
- evaluation = value.toUpperCase().indexOf(valueToCompare.toUpperCase()) != -1;
190
- else
191
- evaluation = value.indexOf(valueToCompare) != -1;
192
-
193
- if (isNegative)
194
- return !evaluation;
195
- else
196
- return evaluation;
197
- }
198
-
199
- private static equalS(value: string, valueToCompare: string, isNegative: bool, ignoreCase: bool): bool {
200
- let evaluation = false;
201
-
202
- if (ignoreCase)
203
- evaluation = value.toUpperCase() == valueToCompare.toUpperCase();
204
- else
205
- evaluation = value == valueToCompare;
206
-
207
- if (isNegative)
208
- return !evaluation;
209
- else
210
- return evaluation;
211
- }
212
-
213
- private static equalsAny(value: string, valuesToCompare: Array<string>, isNegative: bool, isIgnoreCase: bool): bool {
214
- for (let i = 0; i < valuesToCompare.length; i++) {
215
- let valueToCompare = valuesToCompare[i];
216
- if (ComparisonOperatorHelper.equalS(value, valueToCompare, false, isIgnoreCase))
217
- return !isNegative;
218
- }
219
-
220
- return isNegative;
221
- }
222
-
223
- private static containsAny(value: string, valuesToCompare: Array<string>, isNegative: bool, isIgnoreCase: bool): bool {
224
- for (let i = 0; i < valuesToCompare.length; i++) {
225
- let valueToCompare = valuesToCompare[i];
226
- if (ComparisonOperatorHelper.contains(value, valueToCompare, false, isIgnoreCase))
227
- return !isNegative;
228
- }
229
-
230
- return isNegative;
231
- }
232
- }
1
+ import * as IntegrationModels from './IntegrationConfigModel'
2
+ import {KnownUserException} from '../Models'
3
+ import {IHttpRequest} from '../HttpContextProvider'
4
+
5
+ export interface IIntegrationEvaluator {
6
+ getMatchedIntegrationConfig(
7
+ customerIntegration: IntegrationModels.CustomerIntegration,
8
+ currentPageUrl: string,
9
+ request: IHttpRequest): IntegrationModels.IntegrationConfigModelResult | null;
10
+ }
11
+
12
+ export class IntegrationEvaluator implements IIntegrationEvaluator {
13
+ public getMatchedIntegrationConfig(
14
+ customerIntegration: IntegrationModels.CustomerIntegration,
15
+ currentPageUrl: string,
16
+ request: IHttpRequest | null): IntegrationModels.IntegrationConfigModelResult | null {
17
+
18
+ if (request == null)
19
+ return new IntegrationModels.IntegrationConfigModelResult(null, new KnownUserException("request is null"));
20
+
21
+ if (customerIntegration == null)
22
+ return new IntegrationModels.IntegrationConfigModelResult(null, new KnownUserException("customerIntegration is null"));
23
+
24
+ for (let i = 0; i < customerIntegration.Integrations.length; i++) {
25
+ let integration = customerIntegration.Integrations[i];
26
+ for (let t = 0; t < integration.Triggers.length; t++) {
27
+ let trigger = integration.Triggers[t];
28
+ if (this.evaluateTrigger(trigger, currentPageUrl, request)) {
29
+ return new IntegrationModels.IntegrationConfigModelResult(integration, null);
30
+ }
31
+ }
32
+ }
33
+ return null;
34
+ }
35
+
36
+ private evaluateTrigger(trigger: IntegrationModels.TriggerModel, currentPageUrl: string, request: IHttpRequest): boolean {
37
+ if (trigger.LogicalOperator == IntegrationModels.LogicalOperatorType.Or) {
38
+ for (let i = 0; i < trigger.TriggerParts.length; i++) {
39
+ let part = trigger.TriggerParts[i];
40
+ if (this.evaluateTriggerPart(part, currentPageUrl, request))
41
+ return true;
42
+ }
43
+ return false;
44
+ } else {
45
+ for (let i = 0; i < trigger.TriggerParts.length; i++) {
46
+ let part = trigger.TriggerParts[i];
47
+ let matched = this.evaluateTriggerPart(part, currentPageUrl, request);
48
+ if (!matched)
49
+ return false;
50
+ }
51
+ return true;
52
+ }
53
+ }
54
+
55
+ private evaluateTriggerPart(triggerPart: IntegrationModels.TriggerPart, currentPageUrl: string, request: IHttpRequest): boolean {
56
+ if (triggerPart.ValidatorType == IntegrationModels.ValidatorType.UrlValidator) {
57
+ return UrlValidatorHelper.evaluate(triggerPart, currentPageUrl);
58
+ } else if (triggerPart.ValidatorType == IntegrationModels.ValidatorType.CookieValidator) {
59
+ return CookieValidatorHelper.evaluate(triggerPart, request);
60
+ } else if (triggerPart.ValidatorType == IntegrationModels.ValidatorType.UserAgentValidator) {
61
+ return UserAgentValidatorHelper.evaluate(triggerPart, request.getUserAgent());
62
+ } else if (triggerPart.ValidatorType == IntegrationModels.ValidatorType.HttpHeaderValidator) {
63
+ return HttpHeaderValidatorHelper.evaluate(triggerPart, request.getHeader(triggerPart.HttpHeaderName));
64
+ } else if (triggerPart.ValidatorType == IntegrationModels.ValidatorType.RequestBodyValidator) {
65
+ return RequestBodyValidatorHelper.evaluate(triggerPart, request.getRequestBodyAsString());
66
+ } else {
67
+ return false;
68
+ }
69
+ }
70
+ }
71
+
72
+ export class UrlValidatorHelper {
73
+ public static evaluate(triggerPart: IntegrationModels.TriggerPart, url: string): boolean {
74
+ let urlpart = this.getUrlPart(triggerPart, url);
75
+ return ComparisonOperatorHelper.evaluate(
76
+ triggerPart.Operator,
77
+ triggerPart.IsNegative,
78
+ triggerPart.IsIgnoreCase,
79
+ urlpart,
80
+ triggerPart.ValueToCompare,
81
+ triggerPart.ValuesToCompare);
82
+ }
83
+
84
+ private static getUrlPart(triggerPart: IntegrationModels.TriggerPart, url: string): string {
85
+ if (triggerPart.UrlPart == IntegrationModels.UrlPartType.PagePath) {
86
+ return this.getPathFromUrl(url);
87
+ } else if (triggerPart.UrlPart == IntegrationModels.UrlPartType.PageUrl) {
88
+ return url;
89
+ } else if (triggerPart.UrlPart == IntegrationModels.UrlPartType.HostName) {
90
+ return this.getHostNameFromUrl(url);
91
+ } else {
92
+ return "";
93
+ }
94
+ }
95
+
96
+ public static getHostNameFromUrl(url: string): string {
97
+ let urlx = new URL(url);
98
+ return urlx.host;
99
+ }
100
+
101
+ public static getPathFromUrl(url: string): string {
102
+ let urlx = new URL(url);
103
+ return urlx.pathname;
104
+ }
105
+ }
106
+
107
+ export class CookieValidatorHelper {
108
+ public static evaluate(triggerPart: IntegrationModels.TriggerPart, request: IHttpRequest): boolean {
109
+ return ComparisonOperatorHelper.evaluate(triggerPart.Operator,
110
+ triggerPart.IsNegative,
111
+ triggerPart.IsIgnoreCase,
112
+ this.getCookie(triggerPart.CookieName, request),
113
+ triggerPart.ValueToCompare,
114
+ triggerPart.ValuesToCompare);
115
+ }
116
+
117
+ private static getCookie(cookieName: string, request: IHttpRequest): string {
118
+ return request.getCookieValue(cookieName);
119
+ }
120
+ }
121
+
122
+ export class UserAgentValidatorHelper {
123
+ public static evaluate(triggerPart: IntegrationModels.TriggerPart, userAgent: string): boolean {
124
+
125
+ return ComparisonOperatorHelper.evaluate(triggerPart.Operator,
126
+ triggerPart.IsNegative,
127
+ triggerPart.IsIgnoreCase,
128
+ userAgent,
129
+ triggerPart.ValueToCompare,
130
+ triggerPart.ValuesToCompare);
131
+ }
132
+ }
133
+
134
+ export class RequestBodyValidatorHelper {
135
+ public static evaluate(triggerPart: IntegrationModels.TriggerPart, bodyString: string): boolean {
136
+
137
+ return ComparisonOperatorHelper.evaluate(triggerPart.Operator,
138
+ triggerPart.IsNegative,
139
+ triggerPart.IsIgnoreCase,
140
+ bodyString,
141
+ triggerPart.ValueToCompare,
142
+ triggerPart.ValuesToCompare);
143
+ }
144
+ }
145
+
146
+ export class HttpHeaderValidatorHelper {
147
+ public static evaluate(triggerPart: IntegrationModels.TriggerPart, headerValue: string): boolean {
148
+ return ComparisonOperatorHelper.evaluate(triggerPart.Operator,
149
+ triggerPart.IsNegative,
150
+ triggerPart.IsIgnoreCase,
151
+ headerValue,
152
+ triggerPart.ValueToCompare,
153
+ triggerPart.ValuesToCompare);
154
+ }
155
+ }
156
+
157
+ export class ComparisonOperatorHelper {
158
+ public static evaluate(opt: string,
159
+ isNegative: boolean,
160
+ isIgnoreCase: boolean,
161
+ value: string,
162
+ valueToCompare: string,
163
+ valuesToCompare: Array<string> | null): boolean {
164
+ if (valuesToCompare == null) {
165
+ valuesToCompare = new Array<string>();
166
+ }
167
+ if (opt == IntegrationModels.ComparisonOperatorType.EqualS) {
168
+ return ComparisonOperatorHelper.equalS(value, valueToCompare, isNegative, isIgnoreCase);
169
+ } else if (opt == IntegrationModels.ComparisonOperatorType.Contains) {
170
+ return ComparisonOperatorHelper.contains(value, valueToCompare, isNegative, isIgnoreCase);
171
+ } else if (opt == IntegrationModels.ComparisonOperatorType.EqualsAny) {
172
+ return ComparisonOperatorHelper.equalsAny(value, valuesToCompare, isNegative, isIgnoreCase);
173
+ } else if (opt == IntegrationModels.ComparisonOperatorType.ContainsAny) {
174
+ return ComparisonOperatorHelper.containsAny(value, valuesToCompare, isNegative, isIgnoreCase);
175
+ } else {
176
+ return false;
177
+ }
178
+ }
179
+
180
+ private static contains(value: string, valueToCompare: string, isNegative: boolean, ignoreCase: boolean): boolean {
181
+ if (valueToCompare == "*" && value != "")
182
+ return true;
183
+
184
+ let evaluation = false;
185
+
186
+ if (ignoreCase)
187
+ evaluation = value.toUpperCase().indexOf(valueToCompare.toUpperCase()) != -1;
188
+ else
189
+ evaluation = value.indexOf(valueToCompare) != -1;
190
+
191
+ if (isNegative)
192
+ return !evaluation;
193
+ else
194
+ return evaluation;
195
+ }
196
+
197
+ private static equalS(value: string, valueToCompare: string, isNegative: boolean, ignoreCase: boolean): boolean {
198
+ let evaluation = false;
199
+
200
+ if (ignoreCase)
201
+ evaluation = value.toUpperCase() == valueToCompare.toUpperCase();
202
+ else
203
+ evaluation = value == valueToCompare;
204
+
205
+ if (isNegative)
206
+ return !evaluation;
207
+ else
208
+ return evaluation;
209
+ }
210
+
211
+ private static equalsAny(value: string, valuesToCompare: Array<string>, isNegative: boolean, isIgnoreCase: boolean): boolean {
212
+ for (let i = 0; i < valuesToCompare.length; i++) {
213
+ let valueToCompare = valuesToCompare[i];
214
+ if (ComparisonOperatorHelper.equalS(value, valueToCompare, false, isIgnoreCase))
215
+ return !isNegative;
216
+ }
217
+
218
+ return isNegative;
219
+ }
220
+
221
+ private static containsAny(value: string, valuesToCompare: Array<string>, isNegative: boolean, isIgnoreCase: boolean): boolean {
222
+ for (let i = 0; i < valuesToCompare.length; i++) {
223
+ let valueToCompare = valuesToCompare[i];
224
+ if (ComparisonOperatorHelper.contains(value, valueToCompare, false, isIgnoreCase))
225
+ return !isNegative;
226
+ }
227
+
228
+ return isNegative;
229
+ }
230
+ }
@@ -1,93 +1,93 @@
1
- import {KnownUserException, Tuple} from "../Models";
2
-
3
- export class IntegrationConfigModelResult extends Tuple<IntegrationConfigModel | null, KnownUserException | null> {
4
- }
5
-
6
- export class IntegrationConfigModel {
7
- Name: string = "";
8
- EventId: string = "";
9
- CookieDomain: string = "";
10
- LayoutName: string = "";
11
- Culture: string = "";
12
- ExtendCookieValidity: bool = false;
13
- CookieValidityMinute: i64 = 0;
14
- QueueDomain: string = "";
15
- RedirectLogic: string = "";
16
- ForcedTargetUrl: string = "";
17
- ActionType: string = "";
18
- Triggers: Array<TriggerModel>;
19
-
20
- constructor() {
21
- this.Triggers = new Array<TriggerModel>();
22
- }
23
- }
24
-
25
- export class CustomerIntegration {
26
- Integrations: Array<IntegrationConfigModel>;
27
- Version: i64;
28
- Description: string;
29
-
30
- constructor() {
31
- this.Integrations = new Array<IntegrationConfigModel>();
32
- this.Version = 0;
33
- this.Description = "";
34
- }
35
- }
36
-
37
- export class TriggerPart {
38
- ValidatorType: string = "";
39
- Operator: string = "";
40
- ValueToCompare: string = "";
41
- ValuesToCompare: Array<string>;
42
- IsNegative: bool = false;
43
- IsIgnoreCase: bool = false;
44
- UrlPart: string = ""; // UrlValidator
45
- CookieName: string = ""; // CookieValidator
46
- HttpHeaderName: string = ""; // HttpHeaderValidator
47
-
48
- constructor() {
49
- this.ValuesToCompare = new Array<string>();
50
- }
51
- }
52
-
53
- export class TriggerModel {
54
- constructor() {
55
- this.TriggerParts = new Array<TriggerPart>();
56
- this.LogicalOperator = "";
57
- }
58
-
59
- TriggerParts: Array<TriggerPart>;
60
- LogicalOperator: string;
61
- }
62
-
63
- export class ValidatorType {
64
- public static readonly UrlValidator: string = "UrlValidator";
65
- public static readonly CookieValidator: string = "CookieValidator";
66
- public static readonly UserAgentValidator: string = "UserAgentValidator";
67
- public static readonly HttpHeaderValidator: string = "HttpHeaderValidator";
68
- public static readonly RequestBodyValidator: string = "RequestBodyValidator";
69
- }
70
-
71
- export class UrlPartType {
72
- static readonly HostName: string = "HostName";
73
- static readonly PagePath: string = "PagePath";
74
- static readonly PageUrl: string = "PageUrl";
75
- }
76
-
77
- export class ComparisonOperatorType {
78
- static readonly EqualS: string = "Equals";
79
- static readonly Contains: string = "Contains";
80
- static readonly EqualsAny: string = "EqualsAny";
81
- static readonly ContainsAny: string = "ContainsAny";
82
- }
83
-
84
- export class LogicalOperatorType {
85
- public static readonly Or: string = "Or";
86
- public static readonly And: string = "And";
87
- }
88
-
89
- export class ActionType {
90
- public static readonly IgnoreAction: string = "Ignore";
91
- public static readonly CancelAction: string = "Cancel";
92
- public static readonly QueueAction: string = "Queue";
93
- }
1
+ import {KnownUserException, Tuple} from "../Models";
2
+
3
+ export class IntegrationConfigModelResult extends Tuple<IntegrationConfigModel | null, KnownUserException | null> {
4
+ }
5
+
6
+ export class IntegrationConfigModel {
7
+ Name: string = "";
8
+ EventId: string = "";
9
+ CookieDomain: string = "";
10
+ LayoutName: string = "";
11
+ Culture: string = "";
12
+ ExtendCookieValidity: boolean = false;
13
+ CookieValidityMinute: number = 0;
14
+ QueueDomain: string = "";
15
+ RedirectLogic: string = "";
16
+ ForcedTargetUrl: string = "";
17
+ ActionType: string = "";
18
+ Triggers: Array<TriggerModel>;
19
+
20
+ constructor() {
21
+ this.Triggers = new Array<TriggerModel>();
22
+ }
23
+ }
24
+
25
+ export class CustomerIntegration {
26
+ Integrations: Array<IntegrationConfigModel>;
27
+ Version: number;
28
+ Description: string;
29
+
30
+ constructor() {
31
+ this.Integrations = new Array<IntegrationConfigModel>();
32
+ this.Version = 0;
33
+ this.Description = "";
34
+ }
35
+ }
36
+
37
+ export class TriggerPart {
38
+ ValidatorType: string = "";
39
+ Operator: string = "";
40
+ ValueToCompare: string = "";
41
+ ValuesToCompare: Array<string>;
42
+ IsNegative: boolean = false;
43
+ IsIgnoreCase: boolean = false;
44
+ UrlPart: string = ""; // UrlValidator
45
+ CookieName: string = ""; // CookieValidator
46
+ HttpHeaderName: string = ""; // HttpHeaderValidator
47
+
48
+ constructor() {
49
+ this.ValuesToCompare = new Array<string>();
50
+ }
51
+ }
52
+
53
+ export class TriggerModel {
54
+ constructor() {
55
+ this.TriggerParts = new Array<TriggerPart>();
56
+ this.LogicalOperator = "";
57
+ }
58
+
59
+ TriggerParts: Array<TriggerPart>;
60
+ LogicalOperator: string;
61
+ }
62
+
63
+ export class ValidatorType {
64
+ public static readonly UrlValidator: string = "UrlValidator";
65
+ public static readonly CookieValidator: string = "CookieValidator";
66
+ public static readonly UserAgentValidator: string = "UserAgentValidator";
67
+ public static readonly HttpHeaderValidator: string = "HttpHeaderValidator";
68
+ public static readonly RequestBodyValidator: string = "RequestBodyValidator";
69
+ }
70
+
71
+ export class UrlPartType {
72
+ static readonly HostName: string = "HostName";
73
+ static readonly PagePath: string = "PagePath";
74
+ static readonly PageUrl: string = "PageUrl";
75
+ }
76
+
77
+ export class ComparisonOperatorType {
78
+ static readonly EqualS: string = "Equals";
79
+ static readonly Contains: string = "Contains";
80
+ static readonly EqualsAny: string = "EqualsAny";
81
+ static readonly ContainsAny: string = "ContainsAny";
82
+ }
83
+
84
+ export class LogicalOperatorType {
85
+ public static readonly Or: string = "Or";
86
+ public static readonly And: string = "And";
87
+ }
88
+
89
+ export class ActionType {
90
+ public static readonly IgnoreAction: string = "Ignore";
91
+ public static readonly CancelAction: string = "Cancel";
92
+ public static readonly QueueAction: string = "Queue";
93
+ }