@legalplace/lplogic 2.1.5 → 2.3.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.
package/.gitlab-ci.yml CHANGED
@@ -1,17 +1,28 @@
1
- image: node:11-alpine
1
+ image: 148253454541.dkr.ecr.eu-west-1.amazonaws.com/deploydock:node20
2
2
 
3
3
 
4
4
  stages:
5
5
  - deploy
6
+ - build
6
7
 
7
8
  before_script:
8
9
  - export PATH=$PATH:./node_modules/.bin/
10
+ - echo -e "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
11
+
9
12
 
10
13
  variables:
11
14
  DOCKER_DRIVER: overlay2
12
15
 
16
+ build:
17
+ stage: build
18
+ script:
19
+ - export PATH=$PATH:./node_modules/.bin/
20
+ - yarn install
21
+ - yarn build
22
+ except:
23
+ - master # Excludes the master branch
24
+
13
25
  publish:
14
- image: node:11-alpine
15
26
  stage: deploy
16
27
  except:
17
28
  variables:
@@ -25,4 +36,4 @@ publish:
25
36
  environment:
26
37
  name: development
27
38
  only:
28
- - master
39
+ - master
package/CHANGELOG.md ADDED
@@ -0,0 +1,25 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
+
5
+ ## [2.3.0](https://git.legalplace.eu/legalplace/lplogic/compare/v2.2.0...v2.3.0) (2024-01-09)
6
+
7
+
8
+ ### Features
9
+
10
+ * adding new job build for non master branches ([95e101f](https://git.legalplace.eu/legalplace/lplogic/commit/95e101fe9a9199b06557731d7b753a3d067c82dc))
11
+ * adding new stage ([f3446a4](https://git.legalplace.eu/legalplace/lplogic/commit/f3446a441c640e7c88559ac8a4e92c3d990a08f3))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * add build files ([a54b21a](https://git.legalplace.eu/legalplace/lplogic/commit/a54b21a1177396622ccce8f2c98cee9d348bcdc7))
17
+ * update package.json ([116d9c2](https://git.legalplace.eu/legalplace/lplogic/commit/116d9c24bdecdce09cea4ca15017f8c6e6fef8be))
18
+ * update version node from 11 to 18 ([5570198](https://git.legalplace.eu/legalplace/lplogic/commit/5570198c2c75aba1c3d1b993823a95c0eb6ab157))
19
+
20
+ ## [2.2.0](https://git.legalplace.eu/legalplace/lplogic/compare/v2.0.1...v2.2.0) (2024-01-09)
21
+
22
+
23
+ ### Features
24
+
25
+ * adding new operator regex-match ([d6e31b3](https://git.legalplace.eu/legalplace/lplogic/commit/d6e31b3393fbddf4e79b9181acefda099aff5e0e))
package/dist/LpLogic.js CHANGED
@@ -104,8 +104,9 @@ json_logic_js_1.default.add_operation("not-selected", function (values, comparat
104
104
  var filter = reducedValue.filter(function (_value) { return _value === true; });
105
105
  return reducedValue.length === filter.length;
106
106
  });
107
- json_logic_js_1.default.add_operation("not-selected-ip", function (values) {
108
- var filter = values.filter(function (_value) { return _value !== true; });
107
+ json_logic_js_1.default.add_operation("not-selected-ip", function (values, comparator, parents) {
108
+ var reducedValue = reduceValues(values, parents, function (value, parent) { return (parent && !value) || !parent; });
109
+ var filter = reducedValue.filter(function (_value) { return _value === true; });
109
110
  return values.length === filter.length;
110
111
  });
111
112
  json_logic_js_1.default.add_operation("has-one", function (values, comparator, parents) {
@@ -201,5 +202,29 @@ var notLike = function (values, comparator, parents) {
201
202
  return reducedValues.length === filter.length;
202
203
  };
203
204
  json_logic_js_1.default.add_operation("not-like", notLike);
205
+ var regexMatch = function (values, comparator, parents) {
206
+ var reducedValues = reduceValues(values, parents, function (value, parent) {
207
+ var cleanValue = typeof value === "number" ? value.toString() : value.trim();
208
+ var regex;
209
+ if (typeof comparator === 'string') {
210
+ try {
211
+ regex = new RegExp(comparator);
212
+ }
213
+ catch (error) {
214
+ return false;
215
+ }
216
+ }
217
+ else {
218
+ if (!(comparator instanceof RegExp)) {
219
+ return false;
220
+ }
221
+ regex = comparator;
222
+ }
223
+ return regex.test(cleanValue) && parent;
224
+ });
225
+ var filter = reducedValues.filter(function (value) { return value === true; });
226
+ return reducedValues.length === filter.length;
227
+ };
228
+ json_logic_js_1.default.add_operation("regex-match", regexMatch);
204
229
  var LpLogic = json_logic_js_1.default.apply;
205
230
  exports.default = LpLogic;
package/dist/Parser.js CHANGED
@@ -14,7 +14,7 @@ var Parser = (function () {
14
14
  return this.logic;
15
15
  };
16
16
  Parser.prototype.validateCondition = function (condition) {
17
- var result = jsonschema_1.validate(condition, condition_v1_schema_1.default);
17
+ var result = (0, jsonschema_1.validate)(condition, condition_v1_schema_1.default);
18
18
  if (result.errors.length > 0) {
19
19
  throw new Error(JSON.stringify(condition) + " is not a valid condition");
20
20
  }
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Parser = void 0;
6
7
  var LpLogic_1 = __importDefault(require("./LpLogic"));
7
8
  var Parser_1 = __importDefault(require("./Parser"));
8
9
  exports.Parser = Parser_1.default;
package/package.json CHANGED
@@ -1,37 +1,47 @@
1
1
  {
2
2
  "name": "@legalplace/lplogic",
3
- "version": "2.1.5",
3
+ "version": "2.3.0",
4
4
  "description": "LegalPlace LpLogic",
5
5
  "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
6
  "scripts": {
8
7
  "test": "npx jest",
9
- "build": "npx tsc"
8
+ "build": "npx tsc",
9
+ "release": "standard-version -a --no-verify"
10
10
  },
11
11
  "outDir": "./dist",
12
12
  "author": "Moncef Hammou <moncef@legalplace.fr>",
13
13
  "license": "ISC",
14
+ "dependencies": {
15
+ "@legalplace/models-v3-types": "5.1.24",
16
+ "@legalplace/json-logic-js": "^1.2.3",
17
+ "jsonschema": "^1.2.4"
18
+ },
14
19
  "devDependencies": {
15
20
  "@babel/core": "^7.7.2",
16
21
  "@babel/preset-typescript": "^7.7.2",
17
- "@legalplace/models-v3-types": "^3.4.0",
18
- "@types/jest": "^24.0.15",
19
- "@types/node": "^12.6.1",
22
+ "@types/node": "^12.12.6",
20
23
  "@typescript-eslint/eslint-plugin": "^2.6.1",
21
24
  "@typescript-eslint/parser": "^2.6.1",
22
25
  "airbnb-standard": "^1.0.0",
23
26
  "eslint": "^6.6.0",
24
27
  "eslint-config-airbnb-base": "^14.0.0",
25
- "eslint-config-prettier": "^6.5.0",
26
28
  "eslint-plugin-import": "^2.18.2",
27
- "eslint-plugin-prettier": "^3.1.1",
28
- "jest": "^24.8.0",
29
- "prettier": "1.19.1",
30
- "ts-jest": "^24.0.2",
31
- "typescript": "^3.7.2"
29
+ "typescript": "4.4.3",
30
+ "semantic-release": "^17.1.1",
31
+ "husky": "^4.2.5",
32
+ "@commitlint/cli": "^9.0.1",
33
+ "@commitlint/config-conventional": "^9.0.1",
34
+ "standard-version": "^8.0.0"
32
35
  },
33
- "dependencies": {
34
- "@legalplace/json-logic-js": "^1.2.3",
35
- "jsonschema": "^1.2.4"
36
+ "husky": {
37
+ "hooks": {
38
+ "pre-commit": "CI=true",
39
+ "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
40
+ }
41
+ },
42
+ "commitlint": {
43
+ "extends": [
44
+ "@commitlint/config-conventional"
45
+ ]
36
46
  }
37
47
  }