@frontegg/entitlements-javascript-commons 1.0.0-alpha.2 → 1.0.0-alpha.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.
- package/dist/conditions/condition.evaluator.d.ts +6 -0
- package/dist/conditions/condition.evaluator.js +15 -0
- package/dist/conditions/condition.evaluator.js.map +1 -0
- package/dist/conditions/index.d.ts +2 -0
- package/dist/conditions/index.js +19 -0
- package/dist/conditions/index.js.map +1 -0
- package/dist/conditions/types.d.ts +7 -0
- package/dist/conditions/types.js +3 -0
- package/dist/conditions/types.js.map +1 -0
- package/dist/feature-flags/feature-flag.evaluator.d.ts +2 -0
- package/dist/feature-flags/feature-flag.evaluator.js +24 -0
- package/dist/feature-flags/feature-flag.evaluator.js.map +1 -0
- package/dist/feature-flags/index.d.ts +1 -0
- package/dist/feature-flags/index.js +18 -0
- package/dist/feature-flags/index.js.map +1 -0
- package/dist/feature-flags/types.d.ts +10 -0
- package/dist/feature-flags/types.js +3 -0
- package/dist/feature-flags/types.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/operations/boolean/index.d.ts +3 -0
- package/dist/operations/boolean/index.js +24 -0
- package/dist/operations/boolean/index.js.map +1 -0
- package/dist/operations/boolean/operations.d.ts +3 -0
- package/dist/operations/boolean/operations.js +8 -0
- package/dist/operations/boolean/operations.js.map +1 -0
- package/dist/operations/boolean/types.d.ts +3 -0
- package/dist/operations/boolean/types.js +3 -0
- package/dist/operations/boolean/types.js.map +1 -0
- package/dist/operations/components/operation.resolver.d.ts +2 -0
- package/dist/operations/components/operation.resolver.js +19 -0
- package/dist/operations/components/operation.resolver.js.map +1 -0
- package/dist/operations/date/index.d.ts +4 -0
- package/dist/operations/date/index.js +28 -0
- package/dist/operations/date/index.js.map +1 -0
- package/dist/operations/date/operations.d.ts +6 -0
- package/dist/operations/date/operations.js +22 -0
- package/dist/operations/date/operations.js.map +1 -0
- package/dist/operations/date/types.d.ts +8 -0
- package/dist/operations/date/types.js +3 -0
- package/dist/operations/date/types.js.map +1 -0
- package/dist/operations/numeric/index.d.ts +4 -0
- package/dist/operations/numeric/index.js +30 -0
- package/dist/operations/numeric/index.js.map +1 -0
- package/dist/operations/numeric/operations.d.ts +8 -0
- package/dist/operations/numeric/operations.js +28 -0
- package/dist/operations/numeric/operations.js.map +1 -0
- package/dist/operations/numeric/types.d.ts +8 -0
- package/dist/operations/numeric/types.js +3 -0
- package/dist/operations/numeric/types.js.map +1 -0
- package/dist/operations/string/index.d.ts +4 -0
- package/dist/operations/string/index.js +29 -0
- package/dist/operations/string/index.js.map +1 -0
- package/dist/operations/string/operations.d.ts +7 -0
- package/dist/operations/string/operations.js +33 -0
- package/dist/operations/string/operations.js.map +1 -0
- package/dist/operations/string/types.d.ts +7 -0
- package/dist/operations/string/types.js +3 -0
- package/dist/operations/string/types.js.map +1 -0
- package/dist/operations/types/index.d.ts +15 -0
- package/dist/operations/types/index.js +18 -0
- package/dist/operations/types/index.js.map +1 -0
- package/dist/operations/types/operation.enum.d.ts +18 -0
- package/dist/operations/types/operation.enum.js +27 -0
- package/dist/operations/types/operation.enum.js.map +1 -0
- package/dist/rules/index.d.ts +2 -0
- package/dist/rules/index.js +19 -0
- package/dist/rules/index.js.map +1 -0
- package/dist/rules/rule.evaluator.d.ts +2 -0
- package/dist/rules/rule.evaluator.js +16 -0
- package/dist/rules/rule.evaluator.js.map +1 -0
- package/dist/rules/types.d.ts +21 -0
- package/dist/rules/types.js +18 -0
- package/dist/rules/types.js.map +1 -0
- package/docs/CHANGELOG.md +4 -63
- package/package.json +1 -1
- package/src/conditions/condition.evaluator.ts +2 -2
- package/src/feature-flags/feature-flag.evaluator.ts +27 -0
- package/src/feature-flags/index.ts +1 -0
- package/src/feature-flags/tests/feature-flag.evaluator.spec.ts +176 -0
- package/src/feature-flags/types.ts +12 -0
- package/src/index.ts +1 -3
- package/src/rules/rule.evaluator.ts +1 -1
- package/src/rules/tests/rule.evaluator.spec.ts +0 -5
- package/src/rules/types.ts +1 -2
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Condition } from './types';
|
|
2
|
+
export interface CreateConditionEvaluatorPayload {
|
|
3
|
+
condition: Condition;
|
|
4
|
+
}
|
|
5
|
+
export type ConditionEvaluator = (attributes: Record<string, unknown>) => boolean;
|
|
6
|
+
export declare function createConditionEvaluator(payload: CreateConditionEvaluatorPayload): ConditionEvaluator;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createConditionEvaluator = void 0;
|
|
4
|
+
const operation_resolver_1 = require("../operations/components/operation.resolver");
|
|
5
|
+
function createConditionEvaluator(payload) {
|
|
6
|
+
const operation = (0, operation_resolver_1.useOperation)(payload.condition.op, payload.condition.value);
|
|
7
|
+
return (attributes) => {
|
|
8
|
+
const attributeKey = payload.condition.attribute;
|
|
9
|
+
const value = attributes[attributeKey];
|
|
10
|
+
const { isValid: result } = value !== undefined && operation ? operation(value) : { isValid: false };
|
|
11
|
+
return payload.condition.negate ? !result : result;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
exports.createConditionEvaluator = createConditionEvaluator;
|
|
15
|
+
//# sourceMappingURL=condition.evaluator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"condition.evaluator.js","sourceRoot":"","sources":["../../src/conditions/condition.evaluator.ts"],"names":[],"mappings":";;;AACA,oFAA2E;AAQ3E,SAAgB,wBAAwB,CAAC,OAAwC;IAC/E,MAAM,SAAS,GAAG,IAAA,iCAAY,EAAC,OAAO,CAAC,SAAS,CAAC,EAAE,EAAE,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAE9E,OAAO,CAAC,UAAmC,EAAE,EAAE;QAC7C,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC;QACjD,MAAM,KAAK,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;QACvC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,KAAK,KAAK,SAAS,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAErG,OAAO,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IACrD,CAAC,CAAC;AACJ,CAAC;AAVD,4DAUC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./condition.evaluator"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/conditions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,0CAAwB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/conditions/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.evaluateFeatureFlag = void 0;
|
|
4
|
+
const rules_1 = require("../rules");
|
|
5
|
+
function evaluateFeatureFlag(featureFlag, attributes) {
|
|
6
|
+
if (!featureFlag.on) {
|
|
7
|
+
return { treatment: featureFlag.offTreatment };
|
|
8
|
+
}
|
|
9
|
+
const treatableRule = findTreatableRule(featureFlag, attributes);
|
|
10
|
+
if (treatableRule) {
|
|
11
|
+
return { treatment: treatableRule.treatment };
|
|
12
|
+
}
|
|
13
|
+
return { treatment: featureFlag.defaultTreatment };
|
|
14
|
+
}
|
|
15
|
+
exports.evaluateFeatureFlag = evaluateFeatureFlag;
|
|
16
|
+
function findTreatableRule(featureFlag, attributes) {
|
|
17
|
+
var _a;
|
|
18
|
+
return (_a = featureFlag.rules) === null || _a === void 0 ? void 0 : _a.find((rule) => {
|
|
19
|
+
const evaluator = (0, rules_1.createRuleEvaluator)({ rule });
|
|
20
|
+
const result = evaluator(attributes);
|
|
21
|
+
return result === rules_1.RuleEvaluationResultEnum.Treatable;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=feature-flag.evaluator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-flag.evaluator.js","sourceRoot":"","sources":["../../src/feature-flags/feature-flag.evaluator.ts"],"names":[],"mappings":";;;AACA,oCAA+E;AAE/E,SAAgB,mBAAmB,CACjC,WAAwB,EACxB,UAAmC;IAEnC,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE;QACnB,OAAO,EAAE,SAAS,EAAE,WAAW,CAAC,YAAY,EAAE,CAAC;KAChD;IAED,MAAM,aAAa,GAAG,iBAAiB,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;IACjE,IAAI,aAAa,EAAE;QACjB,OAAO,EAAE,SAAS,EAAE,aAAa,CAAC,SAAS,EAAE,CAAC;KAC/C;IAED,OAAO,EAAE,SAAS,EAAE,WAAW,CAAC,gBAAgB,EAAE,CAAC;AACrD,CAAC;AAdD,kDAcC;AAED,SAAS,iBAAiB,CAAC,WAAwB,EAAE,UAAmC;;IACtF,OAAO,MAAA,WAAW,CAAC,KAAK,0CAAE,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE;QACtC,MAAM,SAAS,GAAG,IAAA,2BAAmB,EAAC,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,MAAM,MAAM,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;QAErC,OAAO,MAAM,KAAK,gCAAwB,CAAC,SAAS,CAAC;IACvD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './feature-flag.evaluator';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./feature-flag.evaluator"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/feature-flags/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2DAAyC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Rule, TreatmentEnum } from '../rules';
|
|
2
|
+
export interface FeatureFlag {
|
|
3
|
+
on: boolean;
|
|
4
|
+
offTreatment: TreatmentEnum;
|
|
5
|
+
defaultTreatment: TreatmentEnum;
|
|
6
|
+
rules?: Rule[];
|
|
7
|
+
}
|
|
8
|
+
export interface FeatureFlagEvaluationResult {
|
|
9
|
+
treatment: TreatmentEnum;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/feature-flags/types.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { evaluateFeatureFlag } from './feature-flags';
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.evaluateFeatureFlag = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
exports.evaluateFeatureFlag = evaluateFeatureFlag;
|
|
4
|
+
var feature_flags_1 = require("./feature-flags");
|
|
5
|
+
Object.defineProperty(exports, "evaluateFeatureFlag", { enumerable: true, get: function () { return feature_flags_1.evaluateFeatureFlag; } });
|
|
8
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iDAAsD;AAA7C,oHAAA,mBAAmB,OAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.BooleanOperationsMapper = void 0;
|
|
18
|
+
const types_1 = require("../types");
|
|
19
|
+
const operations_1 = require("./operations");
|
|
20
|
+
__exportStar(require("./operations"), exports);
|
|
21
|
+
exports.BooleanOperationsMapper = {
|
|
22
|
+
[types_1.OperationEnum.Is]: (value) => (0, operations_1.useIsOperation)(value),
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/operations/boolean/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oCAA2D;AAC3D,6CAA8C;AAG9C,+CAA6B;AAEhB,QAAA,uBAAuB,GAAqB;IACvD,CAAC,qBAAa,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,2BAAc,EAAC,KAAgC,CAAC;CAChF,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useIsOperation = void 0;
|
|
4
|
+
function useIsOperation(payload) {
|
|
5
|
+
return (attribute) => ({ isValid: attribute === payload.boolean });
|
|
6
|
+
}
|
|
7
|
+
exports.useIsOperation = useIsOperation;
|
|
8
|
+
//# sourceMappingURL=operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../src/operations/boolean/operations.ts"],"names":[],"mappings":";;;AAGA,SAAgB,cAAc,CAAC,OAAgC;IAC7D,OAAO,CAAC,SAAkB,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;AAC9E,CAAC;AAFD,wCAEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/operations/boolean/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useOperation = void 0;
|
|
4
|
+
const string_1 = require("../string");
|
|
5
|
+
const numeric_1 = require("../numeric");
|
|
6
|
+
const date_1 = require("../date");
|
|
7
|
+
const boolean_1 = require("../boolean");
|
|
8
|
+
const operationEnrichersMapper = {
|
|
9
|
+
...string_1.StringOperationsMapper,
|
|
10
|
+
...numeric_1.NumericOperationsMapper,
|
|
11
|
+
...date_1.DateOperationsMapper,
|
|
12
|
+
...boolean_1.BooleanOperationsMapper,
|
|
13
|
+
};
|
|
14
|
+
function useOperation(operation, value) {
|
|
15
|
+
const operationContextEnricher = operationEnrichersMapper[operation];
|
|
16
|
+
return operationContextEnricher ? operationContextEnricher(value) : undefined;
|
|
17
|
+
}
|
|
18
|
+
exports.useOperation = useOperation;
|
|
19
|
+
//# sourceMappingURL=operation.resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation.resolver.js","sourceRoot":"","sources":["../../../src/operations/components/operation.resolver.ts"],"names":[],"mappings":";;;AACA,sCAAmD;AACnD,wCAAqD;AACrD,kCAA+C;AAC/C,wCAAqD;AAErD,MAAM,wBAAwB,GAAqB;IACjD,GAAG,+BAAsB;IACzB,GAAG,iCAAuB;IAC1B,GAAG,2BAAoB;IACvB,GAAG,iCAAuB;CAC3B,CAAC;AAEF,SAAgB,YAAY,CAAC,SAAwB,EAAE,KAAqB;IAC1E,MAAM,wBAAwB,GAAG,wBAAwB,CAAC,SAAS,CAAC,CAAC;IAErE,OAAO,wBAAwB,CAAC,CAAC,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAChF,CAAC;AAJD,oCAIC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.DateOperationsMapper = void 0;
|
|
18
|
+
const types_1 = require("../types");
|
|
19
|
+
const operations_1 = require("./operations");
|
|
20
|
+
__exportStar(require("./operations"), exports);
|
|
21
|
+
__exportStar(require("./types"), exports);
|
|
22
|
+
exports.DateOperationsMapper = {
|
|
23
|
+
[types_1.OperationEnum.On]: (value) => (0, operations_1.useDateOnOperation)(value),
|
|
24
|
+
[types_1.OperationEnum.OnOrAfter]: (value) => (0, operations_1.useDateOnOrAfterOperation)(value),
|
|
25
|
+
[types_1.OperationEnum.OnOrBefore]: (value) => (0, operations_1.useDateOnOrBeforeOperation)(value),
|
|
26
|
+
[types_1.OperationEnum.BetweenDate]: (value) => (0, operations_1.useDateBetweenOperation)(value),
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/operations/date/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oCAA2D;AAC3D,6CAKsB;AAGtB,+CAA6B;AAC7B,0CAAwB;AAEX,QAAA,oBAAoB,GAAqB;IACpD,CAAC,qBAAa,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,+BAAkB,EAAC,KAAmC,CAAC;IACtF,CAAC,qBAAa,CAAC,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,sCAAyB,EAAC,KAAmC,CAAC;IACpG,CAAC,qBAAa,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,uCAA0B,EAAC,KAAmC,CAAC;IACtG,CAAC,qBAAa,CAAC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,oCAAuB,EAAC,KAAoC,CAAC;CACtG,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { OperationHandler } from '../types';
|
|
2
|
+
import { BetweenDateOperationPayload, SingleDateOperationPayload } from './types';
|
|
3
|
+
export declare function useDateOnOperation(payload: SingleDateOperationPayload): OperationHandler;
|
|
4
|
+
export declare function useDateOnOrAfterOperation(payload: SingleDateOperationPayload): OperationHandler;
|
|
5
|
+
export declare function useDateOnOrBeforeOperation(payload: SingleDateOperationPayload): OperationHandler;
|
|
6
|
+
export declare function useDateBetweenOperation(payload: BetweenDateOperationPayload): OperationHandler;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useDateBetweenOperation = exports.useDateOnOrBeforeOperation = exports.useDateOnOrAfterOperation = exports.useDateOnOperation = void 0;
|
|
4
|
+
function useDateOnOperation(payload) {
|
|
5
|
+
return (attribute) => ({ isValid: attribute.getTime() === payload.date.getTime() });
|
|
6
|
+
}
|
|
7
|
+
exports.useDateOnOperation = useDateOnOperation;
|
|
8
|
+
function useDateOnOrAfterOperation(payload) {
|
|
9
|
+
return (attribute) => ({ isValid: attribute.getTime() >= payload.date.getTime() });
|
|
10
|
+
}
|
|
11
|
+
exports.useDateOnOrAfterOperation = useDateOnOrAfterOperation;
|
|
12
|
+
function useDateOnOrBeforeOperation(payload) {
|
|
13
|
+
return (attribute) => ({ isValid: attribute.getTime() <= payload.date.getTime() });
|
|
14
|
+
}
|
|
15
|
+
exports.useDateOnOrBeforeOperation = useDateOnOrBeforeOperation;
|
|
16
|
+
function useDateBetweenOperation(payload) {
|
|
17
|
+
return (attribute) => ({
|
|
18
|
+
isValid: attribute.getTime() >= payload.start.getTime() && attribute.getTime() <= payload.end.getTime(),
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
exports.useDateBetweenOperation = useDateBetweenOperation;
|
|
22
|
+
//# sourceMappingURL=operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../src/operations/date/operations.ts"],"names":[],"mappings":";;;AAGA,SAAgB,kBAAkB,CAAC,OAAmC;IACpE,OAAO,CAAC,SAAe,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAC5F,CAAC;AAFD,gDAEC;AAED,SAAgB,yBAAyB,CAAC,OAAmC;IAC3E,OAAO,CAAC,SAAe,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAC3F,CAAC;AAFD,8DAEC;AAED,SAAgB,0BAA0B,CAAC,OAAmC;IAC5E,OAAO,CAAC,SAAe,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAC3F,CAAC;AAFD,gEAEC;AAED,SAAgB,uBAAuB,CAAC,OAAoC;IAC1E,OAAO,CAAC,SAAe,EAAE,EAAE,CAAC,CAAC;QAC3B,OAAO,EAAE,SAAS,CAAC,OAAO,EAAE,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,SAAS,CAAC,OAAO,EAAE,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE;KACxG,CAAC,CAAC;AACL,CAAC;AAJD,0DAIC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/operations/date/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.NumericOperationsMapper = void 0;
|
|
18
|
+
const types_1 = require("../types");
|
|
19
|
+
const operations_1 = require("./operations");
|
|
20
|
+
__exportStar(require("./operations"), exports);
|
|
21
|
+
__exportStar(require("./types"), exports);
|
|
22
|
+
exports.NumericOperationsMapper = {
|
|
23
|
+
[types_1.OperationEnum.Equal]: (value) => (0, operations_1.useEqualsOperation)(value),
|
|
24
|
+
[types_1.OperationEnum.GreaterThan]: (value) => (0, operations_1.useGreaterThanOperation)(value),
|
|
25
|
+
[types_1.OperationEnum.GreaterThanEqual]: (value) => (0, operations_1.useGreaterThanEqualOperation)(value),
|
|
26
|
+
[types_1.OperationEnum.LesserThan]: (value) => (0, operations_1.useLesserThanOperation)(value),
|
|
27
|
+
[types_1.OperationEnum.LesserThanEqual]: (value) => (0, operations_1.useLesserThanEqualOperation)(value),
|
|
28
|
+
[types_1.OperationEnum.BetweenNumeric]: (value) => (0, operations_1.useBetweenNumericOperation)(value),
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/operations/numeric/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oCAA2D;AAC3D,6CAOsB;AAGtB,+CAA6B;AAC7B,0CAAwB;AAEX,QAAA,uBAAuB,GAAqB;IACvD,CAAC,qBAAa,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,+BAAkB,EAAC,KAAsC,CAAC;IAC5F,CAAC,qBAAa,CAAC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,oCAAuB,EAAC,KAAsC,CAAC;IACvG,CAAC,qBAAa,CAAC,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,yCAA4B,EAAC,KAAsC,CAAC;IACjH,CAAC,qBAAa,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,mCAAsB,EAAC,KAAsC,CAAC;IACrG,CAAC,qBAAa,CAAC,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,wCAA2B,EAAC,KAAsC,CAAC;IAC/G,CAAC,qBAAa,CAAC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,uCAA0B,EAAC,KAAuC,CAAC;CAC/G,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { OperationHandler } from '../types';
|
|
2
|
+
import { BetweenNumericOperationPayload, SingleNumericOperationPayload } from './types';
|
|
3
|
+
export declare function useEqualsOperation(payload: SingleNumericOperationPayload): OperationHandler;
|
|
4
|
+
export declare function useGreaterThanOperation(payload: SingleNumericOperationPayload): OperationHandler;
|
|
5
|
+
export declare function useGreaterThanEqualOperation(payload: SingleNumericOperationPayload): OperationHandler;
|
|
6
|
+
export declare function useLesserThanOperation(payload: SingleNumericOperationPayload): OperationHandler;
|
|
7
|
+
export declare function useLesserThanEqualOperation(payload: SingleNumericOperationPayload): OperationHandler;
|
|
8
|
+
export declare function useBetweenNumericOperation(payload: BetweenNumericOperationPayload): OperationHandler;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useBetweenNumericOperation = exports.useLesserThanEqualOperation = exports.useLesserThanOperation = exports.useGreaterThanEqualOperation = exports.useGreaterThanOperation = exports.useEqualsOperation = void 0;
|
|
4
|
+
function useEqualsOperation(payload) {
|
|
5
|
+
return (attribute) => ({ isValid: attribute === payload.number });
|
|
6
|
+
}
|
|
7
|
+
exports.useEqualsOperation = useEqualsOperation;
|
|
8
|
+
function useGreaterThanOperation(payload) {
|
|
9
|
+
return (attribute) => ({ isValid: attribute > payload.number });
|
|
10
|
+
}
|
|
11
|
+
exports.useGreaterThanOperation = useGreaterThanOperation;
|
|
12
|
+
function useGreaterThanEqualOperation(payload) {
|
|
13
|
+
return (attribute) => ({ isValid: attribute >= payload.number });
|
|
14
|
+
}
|
|
15
|
+
exports.useGreaterThanEqualOperation = useGreaterThanEqualOperation;
|
|
16
|
+
function useLesserThanOperation(payload) {
|
|
17
|
+
return (attribute) => ({ isValid: attribute < payload.number });
|
|
18
|
+
}
|
|
19
|
+
exports.useLesserThanOperation = useLesserThanOperation;
|
|
20
|
+
function useLesserThanEqualOperation(payload) {
|
|
21
|
+
return (attribute) => ({ isValid: attribute <= payload.number });
|
|
22
|
+
}
|
|
23
|
+
exports.useLesserThanEqualOperation = useLesserThanEqualOperation;
|
|
24
|
+
function useBetweenNumericOperation(payload) {
|
|
25
|
+
return (attribute) => ({ isValid: attribute >= payload.start && attribute <= payload.end });
|
|
26
|
+
}
|
|
27
|
+
exports.useBetweenNumericOperation = useBetweenNumericOperation;
|
|
28
|
+
//# sourceMappingURL=operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../src/operations/numeric/operations.ts"],"names":[],"mappings":";;;AAGA,SAAgB,kBAAkB,CAAC,OAAsC;IACvE,OAAO,CAAC,SAAiB,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AAC5E,CAAC;AAFD,gDAEC;AAED,SAAgB,uBAAuB,CAAC,OAAsC;IAC5E,OAAO,CAAC,SAAiB,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AAC1E,CAAC;AAFD,0DAEC;AAED,SAAgB,4BAA4B,CAAC,OAAsC;IACjF,OAAO,CAAC,SAAiB,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AAC3E,CAAC;AAFD,oEAEC;AAED,SAAgB,sBAAsB,CAAC,OAAsC;IAC3E,OAAO,CAAC,SAAiB,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AAC1E,CAAC;AAFD,wDAEC;AAED,SAAgB,2BAA2B,CAAC,OAAsC;IAChF,OAAO,CAAC,SAAiB,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;AAC3E,CAAC;AAFD,kEAEC;AAED,SAAgB,0BAA0B,CAAC,OAAuC;IAChF,OAAO,CAAC,SAAiB,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,SAAS,IAAI,OAAO,CAAC,KAAK,IAAI,SAAS,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;AACtG,CAAC;AAFD,gEAEC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/operations/numeric/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.StringOperationsMapper = void 0;
|
|
18
|
+
const types_1 = require("../types");
|
|
19
|
+
const operations_1 = require("./operations");
|
|
20
|
+
__exportStar(require("./operations"), exports);
|
|
21
|
+
__exportStar(require("./types"), exports);
|
|
22
|
+
exports.StringOperationsMapper = {
|
|
23
|
+
[types_1.OperationEnum.StartsWith]: (value) => (0, operations_1.useStartsWithOperation)(value),
|
|
24
|
+
[types_1.OperationEnum.EndsWith]: (value) => (0, operations_1.useEndsWithOperation)(value),
|
|
25
|
+
[types_1.OperationEnum.Contains]: (value) => (0, operations_1.useContainsOperation)(value),
|
|
26
|
+
[types_1.OperationEnum.InList]: (value) => (0, operations_1.useInListOperation)(value),
|
|
27
|
+
[types_1.OperationEnum.Matches]: (value) => (0, operations_1.useMatchesOperation)(value),
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/operations/string/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oCAA2D;AAC3D,6CAMsB;AAGtB,+CAA6B;AAC7B,0CAAwB;AAEX,QAAA,sBAAsB,GAAqB;IACtD,CAAC,qBAAa,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,mCAAsB,EAAC,KAAmC,CAAC;IAClG,CAAC,qBAAa,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,iCAAoB,EAAC,KAAmC,CAAC;IAC9F,CAAC,qBAAa,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,iCAAoB,EAAC,KAAmC,CAAC;IAC9F,CAAC,qBAAa,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,+BAAkB,EAAC,KAAmC,CAAC;IAC1F,CAAC,qBAAa,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAA,gCAAmB,EAAC,KAAqC,CAAC;CAC/F,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { OperationHandler } from '../types';
|
|
2
|
+
import { ListStringOperationPayload, SingleStringOperationPayload } from './types';
|
|
3
|
+
export declare function useStartsWithOperation(payload: ListStringOperationPayload): OperationHandler;
|
|
4
|
+
export declare function useEndsWithOperation(payload: ListStringOperationPayload): OperationHandler;
|
|
5
|
+
export declare function useContainsOperation(payload: ListStringOperationPayload): OperationHandler;
|
|
6
|
+
export declare function useInListOperation(payload: ListStringOperationPayload): OperationHandler;
|
|
7
|
+
export declare function useMatchesOperation(payload: SingleStringOperationPayload): OperationHandler;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useMatchesOperation = exports.useInListOperation = exports.useContainsOperation = exports.useEndsWithOperation = exports.useStartsWithOperation = void 0;
|
|
4
|
+
function useStartsWithOperation(payload) {
|
|
5
|
+
return (attribute) => ({ isValid: payload.list.some((value) => attribute.startsWith(value)) });
|
|
6
|
+
}
|
|
7
|
+
exports.useStartsWithOperation = useStartsWithOperation;
|
|
8
|
+
function useEndsWithOperation(payload) {
|
|
9
|
+
return (attribute) => ({ isValid: payload.list.some((value) => attribute.endsWith(value)) });
|
|
10
|
+
}
|
|
11
|
+
exports.useEndsWithOperation = useEndsWithOperation;
|
|
12
|
+
function useContainsOperation(payload) {
|
|
13
|
+
return (attribute) => ({ isValid: payload.list.some((value) => attribute.includes(value)) });
|
|
14
|
+
}
|
|
15
|
+
exports.useContainsOperation = useContainsOperation;
|
|
16
|
+
function useInListOperation(payload) {
|
|
17
|
+
return (attribute) => ({ isValid: payload.list.includes(attribute) });
|
|
18
|
+
}
|
|
19
|
+
exports.useInListOperation = useInListOperation;
|
|
20
|
+
function useMatchesOperation(payload) {
|
|
21
|
+
return (attribute) => {
|
|
22
|
+
let expression;
|
|
23
|
+
try {
|
|
24
|
+
expression = new RegExp(payload.string);
|
|
25
|
+
}
|
|
26
|
+
catch (e) {
|
|
27
|
+
return { isValid: false };
|
|
28
|
+
}
|
|
29
|
+
return { isValid: expression.test(attribute) };
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
exports.useMatchesOperation = useMatchesOperation;
|
|
33
|
+
//# sourceMappingURL=operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../src/operations/string/operations.ts"],"names":[],"mappings":";;;AAGA,SAAgB,sBAAsB,CAAC,OAAmC;IACxE,OAAO,CAAC,SAAiB,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;AACzG,CAAC;AAFD,wDAEC;AAED,SAAgB,oBAAoB,CAAC,OAAmC;IACtE,OAAO,CAAC,SAAiB,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;AACvG,CAAC;AAFD,oDAEC;AAED,SAAgB,oBAAoB,CAAC,OAAmC;IACtE,OAAO,CAAC,SAAiB,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;AACvG,CAAC;AAFD,oDAEC;AAED,SAAgB,kBAAkB,CAAC,OAAmC;IACpE,OAAO,CAAC,SAAiB,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;AAChF,CAAC;AAFD,gDAEC;AAED,SAAgB,mBAAmB,CAAC,OAAqC;IACvE,OAAO,CAAC,SAAiB,EAAE,EAAE;QAC3B,IAAI,UAAkB,CAAC;QAEvB,IAAI;YACF,UAAU,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;SACzC;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;SAC3B;QAED,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;IACjD,CAAC,CAAC;AACJ,CAAC;AAZD,kDAYC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/operations/string/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { OperationEnum } from './operation.enum';
|
|
2
|
+
import { StringOperationPayload } from '../string';
|
|
3
|
+
import { NumericOperationPayload } from '../numeric';
|
|
4
|
+
import { DateOperationPayload } from '../date';
|
|
5
|
+
import { BooleanOperationPayload } from '../boolean/types';
|
|
6
|
+
export interface OperationResult {
|
|
7
|
+
isValid: boolean;
|
|
8
|
+
}
|
|
9
|
+
export type ConditionValue = StringOperationPayload | NumericOperationPayload | DateOperationPayload | BooleanOperationPayload;
|
|
10
|
+
export type OperationHandler = (attribute: any) => OperationResult;
|
|
11
|
+
export type OperationContextEnricher = (value: ConditionValue) => OperationHandler;
|
|
12
|
+
export type OperationsMapper = {
|
|
13
|
+
[key in OperationEnum]?: OperationContextEnricher;
|
|
14
|
+
};
|
|
15
|
+
export * from './operation.enum';
|