perimeterx-js-core 0.15.0 → 0.15.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.
|
@@ -154,17 +154,18 @@ var EnforcerBase = /** @class */ (function () {
|
|
|
154
154
|
case 3:
|
|
155
155
|
_a.sent();
|
|
156
156
|
return [2 /*return*/, result.response ? this.convertToRes.apply(this, __spreadArray([result.response], args, false)) : null];
|
|
157
|
-
case 4:
|
|
158
|
-
this.preserveContext.apply(this, __spreadArray([context], args, false));
|
|
159
|
-
return [4 /*yield*/, this.enforceFlow.execute(context)];
|
|
157
|
+
case 4: return [4 /*yield*/, this.preserveContext.apply(this, __spreadArray([context], args, false))];
|
|
160
158
|
case 5:
|
|
159
|
+
_a.sent();
|
|
160
|
+
return [4 /*yield*/, this.enforceFlow.execute(context)];
|
|
161
|
+
case 6:
|
|
161
162
|
result = _a.sent();
|
|
162
|
-
if (!result.done) return [3 /*break*/,
|
|
163
|
+
if (!result.done) return [3 /*break*/, 8];
|
|
163
164
|
return [4 /*yield*/, this.endEnforcerFlow.execute(context)];
|
|
164
|
-
case
|
|
165
|
+
case 7:
|
|
165
166
|
_a.sent();
|
|
166
167
|
return [2 /*return*/, result.response ? this.convertToRes.apply(this, __spreadArray([result.response], args, false)) : null];
|
|
167
|
-
case
|
|
168
|
+
case 8: return [2 /*return*/, null];
|
|
168
169
|
}
|
|
169
170
|
});
|
|
170
171
|
});
|
|
@@ -13,4 +13,4 @@ exports.PUSH_DATA_HMAC_HEADER_NAME = 'x-px-pushdata';
|
|
|
13
13
|
exports.PUSH_DATA_FEATURE_HEADER_NAME = 'x-px-feature';
|
|
14
14
|
exports.EMAIL_ADDRESS_REGEX = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/;
|
|
15
15
|
exports.URL_REGEX = /^(https?\:)\/\/(([^@\s:]+):?([^@\s]*)@)?(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/;
|
|
16
|
-
exports.CORE_MODULE_VERSION = 'JS Core 0.15.
|
|
16
|
+
exports.CORE_MODULE_VERSION = 'JS Core 0.15.1';
|
|
@@ -75,7 +75,7 @@ export class EnforcerBase {
|
|
|
75
75
|
await this.endEnforcerFlow.execute(context);
|
|
76
76
|
return result.response ? this.convertToRes(result.response, ...args) : null;
|
|
77
77
|
}
|
|
78
|
-
this.preserveContext(context, ...args);
|
|
78
|
+
await this.preserveContext(context, ...args);
|
|
79
79
|
result = await this.enforceFlow.execute(context);
|
|
80
80
|
if (result.done) {
|
|
81
81
|
await this.endEnforcerFlow.execute(context);
|
|
@@ -10,4 +10,4 @@ export const PUSH_DATA_HMAC_HEADER_NAME = 'x-px-pushdata';
|
|
|
10
10
|
export const PUSH_DATA_FEATURE_HEADER_NAME = 'x-px-feature';
|
|
11
11
|
export const EMAIL_ADDRESS_REGEX = /^[a-zA-Z0-9_+&*-]+(?:\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,7}$/;
|
|
12
12
|
export const URL_REGEX = /^(https?\:)\/\/(([^@\s:]+):?([^@\s]*)@)?(([^:\/?#]*)(?:\:([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/;
|
|
13
|
-
export const CORE_MODULE_VERSION = 'JS Core 0.15.
|
|
13
|
+
export const CORE_MODULE_VERSION = 'JS Core 0.15.1';
|
|
@@ -8,6 +8,7 @@ import { Products } from '../products';
|
|
|
8
8
|
import { IActivityClient } from '../activities';
|
|
9
9
|
import { IEnforcer } from './IEnforcer';
|
|
10
10
|
import { EnforcerBaseOptions, EnforcerOptionsType } from './options';
|
|
11
|
+
import { AsyncOrSync } from 'ts-essentials';
|
|
11
12
|
export declare abstract class EnforcerBase<TokenV extends TokenVersion, Req, Res, EnforceArgs extends any[], PostEnforceArgs extends any[]> implements IEnforcer<EnforceArgs, PostEnforceArgs, Promise<null | Res>, Promise<void>> {
|
|
12
13
|
protected readonly config: IConfiguration<Req, Res>;
|
|
13
14
|
protected readonly filterFlow: IPhase<Req, Res>;
|
|
@@ -21,7 +22,7 @@ export declare abstract class EnforcerBase<TokenV extends TokenVersion, Req, Res
|
|
|
21
22
|
* @returns IContext - The context for the request.
|
|
22
23
|
* @protected
|
|
23
24
|
*/
|
|
24
|
-
protected abstract constructContext(...args: EnforceArgs): IContext<Req, Res
|
|
25
|
+
protected abstract constructContext(...args: EnforceArgs): AsyncOrSync<IContext<Req, Res>>;
|
|
25
26
|
/**
|
|
26
27
|
* Saves the provided context for future use in the postEnforce function.
|
|
27
28
|
* @param context - The IContext that should be saved
|
|
@@ -29,7 +30,7 @@ export declare abstract class EnforcerBase<TokenV extends TokenVersion, Req, Res
|
|
|
29
30
|
* @returns void
|
|
30
31
|
* @protected
|
|
31
32
|
*/
|
|
32
|
-
protected abstract preserveContext(context: IContext<Req, Res>, ...args: EnforceArgs): void
|
|
33
|
+
protected abstract preserveContext(context: IContext<Req, Res>, ...args: EnforceArgs): AsyncOrSync<void>;
|
|
33
34
|
/**
|
|
34
35
|
* A function that retrieves the already generated context for use in the postEnforce function.
|
|
35
36
|
* @param args - The PostEnforce args required to enforce the incoming request.
|
|
@@ -10,4 +10,4 @@ export declare const PUSH_DATA_HMAC_HEADER_NAME = "x-px-pushdata";
|
|
|
10
10
|
export declare const PUSH_DATA_FEATURE_HEADER_NAME = "x-px-feature";
|
|
11
11
|
export declare const EMAIL_ADDRESS_REGEX: RegExp;
|
|
12
12
|
export declare const URL_REGEX: RegExp;
|
|
13
|
-
export declare const CORE_MODULE_VERSION = "JS Core 0.15.
|
|
13
|
+
export declare const CORE_MODULE_VERSION = "JS Core 0.15.1";
|