diff --git a/.github/workflows/node.yaml b/.github/workflows/node.yaml index 2cf8a93e..d1165b1a 100644 --- a/.github/workflows/node.yaml +++ b/.github/workflows/node.yaml @@ -19,6 +19,11 @@ on: - 'test-data/**' - '.github/workflows/node.yaml' pull_request: + paths: + - 'bindings/nodejs/**' + - 'core/**' + - 'test-data/**' + - '.github/workflows/node.yaml' jobs: build: diff --git a/.github/workflows/python.yaml b/.github/workflows/python.yaml index 4dfe2a86..1f23b644 100644 --- a/.github/workflows/python.yaml +++ b/.github/workflows/python.yaml @@ -14,6 +14,11 @@ on: - 'test-data/**' - '.github/workflows/python.yaml' pull_request: + paths: + - 'bindings/python/**' + - 'core/**' + - 'test-data/**' + - '.github/workflows/python.yaml' permissions: contents: read diff --git a/.github/workflows/rust.yaml b/.github/workflows/rust.yaml index 2d06c07d..18485c43 100644 --- a/.github/workflows/rust.yaml +++ b/.github/workflows/rust.yaml @@ -5,6 +5,12 @@ permissions: on: pull_request: + paths-ignore: + - 'bindings/**' + - '.github/workflows/python.yaml' + - '.github/workflows/python-version-bump.yaml' + - '.github/workflows/node.yaml' + - '.github/workflows/node-version-bump.yaml' push: branches: - master @@ -125,4 +131,4 @@ jobs: run: cd ../vm && cargo publish - name: Publish Engine - run: cd ../engine && cargo publish \ No newline at end of file + run: cd ../engine && cargo publish diff --git a/test-data/credit-analysis.json b/test-data/credit-analysis.json index ffee204d..2f8fe2ac 100644 --- a/test-data/credit-analysis.json +++ b/test-data/credit-analysis.json @@ -1,327 +1,324 @@ { - "contentType": "application/vnd.gorules.decision", - "content": { - "edges": [ - { - "id": "3e749d7f-97d5-45c9-917f-20ae877c3bde", - "type": "edge", - "sourceId": "4e7e6bb9-f128-41e7-8cc5-b9d79670b96a", - "targetId": "abaaa033-5516-440c-b211-35f1d616ad9f" - }, - { - "id": "d00252c1-9a54-4599-940c-c9c1c3bb6800", - "type": "edge", - "sourceId": "4e7e6bb9-f128-41e7-8cc5-b9d79670b96a", - "targetId": "46fbad36-4bbe-44ac-833f-d30e0d37d8d7" - }, - { - "id": "f5be27b5-4eea-40f4-abce-31081a0caf65", - "type": "edge", - "sourceId": "4e7e6bb9-f128-41e7-8cc5-b9d79670b96a", - "targetId": "d6925cde-b3c9-4b7f-8652-7380dacea6a4" - }, - { - "id": "ae341e14-2d25-4941-a42f-eb587c17f9f5", - "type": "edge", - "sourceId": "abaaa033-5516-440c-b211-35f1d616ad9f", - "targetId": "95aa8f3c-f371-4e48-beb3-0b5775d2a814" - }, - { - "id": "3000e420-4846-4f86-8ed2-f595d204672e", - "type": "edge", - "sourceId": "46fbad36-4bbe-44ac-833f-d30e0d37d8d7", - "targetId": "95aa8f3c-f371-4e48-beb3-0b5775d2a814" - }, - { - "id": "638c35a9-eef7-4d90-bf1e-58ba10734d98", - "type": "edge", - "sourceId": "d6925cde-b3c9-4b7f-8652-7380dacea6a4", - "targetId": "95aa8f3c-f371-4e48-beb3-0b5775d2a814" - }, - { - "id": "30f2247a-140c-40f3-8160-a4e61d56da8e", - "type": "edge", - "sourceId": "af6cdac4-2019-4a0f-9715-2ecfb27e0bfc", - "targetId": "86ce04c9-b4dd-4513-ae2b-7f585ceb224a" - }, - { - "id": "822d2eeb-5a9e-4670-b181-4af0ed6dd9b9", - "type": "edge", - "sourceId": "86ce04c9-b4dd-4513-ae2b-7f585ceb224a", - "targetId": "95aa8f3c-f371-4e48-beb3-0b5775d2a814" - }, - { - "id": "61cc8c10-57c2-411d-a88c-90176ebb8593", - "type": "edge", - "sourceId": "d6925cde-b3c9-4b7f-8652-7380dacea6a4", - "targetId": "af6cdac4-2019-4a0f-9715-2ecfb27e0bfc" - }, - { - "id": "2011fc65-fd8c-421f-8123-d1fb5f1accb3", - "type": "edge", - "sourceId": "46fbad36-4bbe-44ac-833f-d30e0d37d8d7", - "targetId": "af6cdac4-2019-4a0f-9715-2ecfb27e0bfc" - }, - { - "id": "d65fb53d-0fef-47ff-aeac-b8cbac5af7be", - "type": "edge", - "sourceId": "abaaa033-5516-440c-b211-35f1d616ad9f", - "targetId": "af6cdac4-2019-4a0f-9715-2ecfb27e0bfc" + "edges": [ + { + "id": "3e749d7f-97d5-45c9-917f-20ae877c3bde", + "type": "edge", + "sourceId": "4e7e6bb9-f128-41e7-8cc5-b9d79670b96a", + "targetId": "abaaa033-5516-440c-b211-35f1d616ad9f" + }, + { + "id": "d00252c1-9a54-4599-940c-c9c1c3bb6800", + "type": "edge", + "sourceId": "4e7e6bb9-f128-41e7-8cc5-b9d79670b96a", + "targetId": "46fbad36-4bbe-44ac-833f-d30e0d37d8d7" + }, + { + "id": "f5be27b5-4eea-40f4-abce-31081a0caf65", + "type": "edge", + "sourceId": "4e7e6bb9-f128-41e7-8cc5-b9d79670b96a", + "targetId": "d6925cde-b3c9-4b7f-8652-7380dacea6a4" + }, + { + "id": "ae341e14-2d25-4941-a42f-eb587c17f9f5", + "type": "edge", + "sourceId": "abaaa033-5516-440c-b211-35f1d616ad9f", + "targetId": "95aa8f3c-f371-4e48-beb3-0b5775d2a814" + }, + { + "id": "3000e420-4846-4f86-8ed2-f595d204672e", + "type": "edge", + "sourceId": "46fbad36-4bbe-44ac-833f-d30e0d37d8d7", + "targetId": "95aa8f3c-f371-4e48-beb3-0b5775d2a814" + }, + { + "id": "638c35a9-eef7-4d90-bf1e-58ba10734d98", + "type": "edge", + "sourceId": "d6925cde-b3c9-4b7f-8652-7380dacea6a4", + "targetId": "95aa8f3c-f371-4e48-beb3-0b5775d2a814" + }, + { + "id": "30f2247a-140c-40f3-8160-a4e61d56da8e", + "type": "edge", + "sourceId": "af6cdac4-2019-4a0f-9715-2ecfb27e0bfc", + "targetId": "86ce04c9-b4dd-4513-ae2b-7f585ceb224a" + }, + { + "id": "822d2eeb-5a9e-4670-b181-4af0ed6dd9b9", + "type": "edge", + "sourceId": "86ce04c9-b4dd-4513-ae2b-7f585ceb224a", + "targetId": "95aa8f3c-f371-4e48-beb3-0b5775d2a814" + }, + { + "id": "61cc8c10-57c2-411d-a88c-90176ebb8593", + "type": "edge", + "sourceId": "d6925cde-b3c9-4b7f-8652-7380dacea6a4", + "targetId": "af6cdac4-2019-4a0f-9715-2ecfb27e0bfc" + }, + { + "id": "2011fc65-fd8c-421f-8123-d1fb5f1accb3", + "type": "edge", + "sourceId": "46fbad36-4bbe-44ac-833f-d30e0d37d8d7", + "targetId": "af6cdac4-2019-4a0f-9715-2ecfb27e0bfc" + }, + { + "id": "d65fb53d-0fef-47ff-aeac-b8cbac5af7be", + "type": "edge", + "sourceId": "abaaa033-5516-440c-b211-35f1d616ad9f", + "targetId": "af6cdac4-2019-4a0f-9715-2ecfb27e0bfc" + } + ], + "nodes": [ + { + "id": "4e7e6bb9-f128-41e7-8cc5-b9d79670b96a", + "name": "Request", + "type": "inputNode", + "position": { + "x": 70, + "y": 160 } - ], - "nodes": [ - { - "id": "4e7e6bb9-f128-41e7-8cc5-b9d79670b96a", - "name": "Request", - "type": "inputNode", - "position": { - "x": 70, - "y": 160 - } + }, + { + "id": "d6925cde-b3c9-4b7f-8652-7380dacea6a4", + "name": "Company Type", + "type": "decisionTableNode", + "content": { + "rules": [ + { + "_id": "D8T0xuyYLC", + "Yi49Ln4-V_": "\"green\"", + "nd30YgUKve": "\"INC\",\"LTD\",\"LLC\"" + }, + { + "_id": "Ewgtm_21qr", + "Yi49Ln4-V_": "\"amber\"", + "nd30YgUKve": "" + } + ], + "inputs": [ + { + "id": "nd30YgUKve", + "name": "Company Type", + "type": "expression", + "field": "company.type" + } + ], + "outputs": [ + { + "id": "Yi49Ln4-V_", + "name": "Flag CompanyType", + "type": "expression", + "field": "flag.companyType" + } + ], + "hitPolicy": "first" }, - { - "id": "d6925cde-b3c9-4b7f-8652-7380dacea6a4", - "name": "Company Type", - "type": "decisionTableNode", - "content": { - "rules": [ - { - "_id": "D8T0xuyYLC", - "Yi49Ln4-V_": "\"green\"", - "nd30YgUKve": "\"INC\",\"LTD\",\"LLC\"" - }, - { - "_id": "Ewgtm_21qr", - "Yi49Ln4-V_": "\"amber\"", - "nd30YgUKve": "" - } - ], - "inputs": [ - { - "id": "nd30YgUKve", - "name": "Company Type", - "type": "expression", - "field": "company.type" - } - ], - "outputs": [ - { - "id": "Yi49Ln4-V_", - "name": "Flag CompanyType", - "type": "expression", - "field": "flag.companyType" - } - ], - "hitPolicy": "first" - }, - "position": { - "x": 380, - "y": 270 - } - }, - { - "id": "46fbad36-4bbe-44ac-833f-d30e0d37d8d7", - "name": "Turnover", - "type": "decisionTableNode", - "content": { - "rules": [ - { - "_id": "fJxWqBVUNk", - "6xj5CMIFv9": "> 1_000_000", - "rrW6s3l7vU": "\"green\"" - }, - { - "_id": "lqBoqkvWHA", - "6xj5CMIFv9": "[200_000..1_000_000]", - "rrW6s3l7vU": "\"amber\"" - }, - { - "_id": "YO3K4Q1iuU", - "6xj5CMIFv9": "< 200_000", - "rrW6s3l7vU": "\"red\"" - }, - { - "_id": "SY7uwJEPqS", - "6xj5CMIFv9": "", - "rrW6s3l7vU": "\"red\"" - } - ], - "inputs": [ - { - "id": "6xj5CMIFv9", - "name": "Turnover (LY)", - "type": "expression", - "field": "company.turnover" - } - ], - "outputs": [ - { - "id": "rrW6s3l7vU", - "name": "Flag Turnover", - "type": "expression", - "field": "flag.turnover" - } - ], - "hitPolicy": "first" - }, - "position": { - "x": 380, - "y": 160 - } - }, - { - "id": "abaaa033-5516-440c-b211-35f1d616ad9f", - "name": "Country", - "type": "decisionTableNode", - "content": { - "rules": [ - { - "_id": "TOi2qECISd", - "I493u7jDPg": "\"green\"", - "bGOSakKon0": "", - "z87lDk-Xar": "\"US\",\"IE\",\"GB\",\"CA\"" - }, - { - "_id": "aGPqCdh2tU", - "I493u7jDPg": "\"amber\"", - "bGOSakKon0": "true", - "z87lDk-Xar": "" - }, - { - "_id": "VYiuLkrLWb", - "I493u7jDPg": "\"red\"", - "bGOSakKon0": "", - "z87lDk-Xar": "" - } - ], - "inputs": [ - { - "id": "z87lDk-Xar", - "name": "Company Country", - "type": "expression", - "field": "company.country" - }, - { - "id": "bGOSakKon0", - "name": "Company IsEU", - "type": "expression", - "field": "company.isEu" - } - ], - "outputs": [ - { - "id": "I493u7jDPg", - "name": "Flag Country", - "type": "expression", - "field": "flag.country" - } - ], - "hitPolicy": "first" - }, - "position": { - "x": 380, - "y": 50 - } - }, - { - "id": "af6cdac4-2019-4a0f-9715-2ecfb27e0bfc", - "name": "Overall Mapper", - "type": "functionNode", - "content": "/**\n* @param {import('gorules').Input} input\n* @param {{\n* moment: import('dayjs')\n* env: Record\n* }} helpers\n*/\nconst handler = (input, { moment, env }) => {\n const count = (flag) => Object.values(input?.flag || {}).reduce((acc, curr) => {\n if (curr === flag) return acc + 1;\n return acc;\n }, 0);\n\n return {\n critical: count('critical'),\n red: count('red'),\n amber: count('amber'),\n green: count('green')\n };\n}", - "position": { - "x": 630, - "y": 270 - } - }, - { - "id": "86ce04c9-b4dd-4513-ae2b-7f585ceb224a", - "name": "Overall", - "type": "decisionTableNode", - "content": { - "rules": [ - { - "_id": "P0RQ3NFWfc", - "AczIUwvClr": "", - "KsBwLhAedP": "> 0", - "QJttqyV2FB": "", - "ek5q9WgLL9": "\"red\"", - "iFQl1CKB5S": "" - }, - { - "_id": "UGrT2iHE61", - "AczIUwvClr": "> 0", - "KsBwLhAedP": "", - "QJttqyV2FB": "", - "ek5q9WgLL9": "\"red\"", - "iFQl1CKB5S": "" - }, - { - "_id": "SBBO_aWujh", - "AczIUwvClr": "", - "KsBwLhAedP": "", - "QJttqyV2FB": "> 1", - "ek5q9WgLL9": "\"amber\"", - "iFQl1CKB5S": "" - }, - { - "_id": "N2jO9BnXHY", - "AczIUwvClr": "", - "KsBwLhAedP": "", - "QJttqyV2FB": "", - "ek5q9WgLL9": "\"green\"", - "iFQl1CKB5S": "" - } - ], - "inputs": [ - { - "id": "AczIUwvClr", - "name": "Red", - "type": "expression", - "field": "red" - }, - { - "id": "QJttqyV2FB", - "name": "Amber", - "type": "expression", - "field": "amber" - }, - { - "id": "iFQl1CKB5S", - "name": "Green", - "type": "expression", - "field": "green" - }, - { - "id": "KsBwLhAedP", - "name": "Critical", - "type": "expression", - "field": "critical" - } - ], - "outputs": [ - { - "id": "ek5q9WgLL9", - "name": "Overall", - "type": "expression", - "field": "overall" - } - ], - "hitPolicy": "first" - }, - "position": { - "x": 880, - "y": 270 - } - }, - { - "id": "95aa8f3c-f371-4e48-beb3-0b5775d2a814", - "name": "Response", - "type": "outputNode", - "position": { - "x": 1120, - "y": 160 - } + "position": { + "x": 380, + "y": 270 } - ] - } -} \ No newline at end of file + }, + { + "id": "46fbad36-4bbe-44ac-833f-d30e0d37d8d7", + "name": "Turnover", + "type": "decisionTableNode", + "content": { + "rules": [ + { + "_id": "fJxWqBVUNk", + "6xj5CMIFv9": "> 1_000_000", + "rrW6s3l7vU": "\"green\"" + }, + { + "_id": "lqBoqkvWHA", + "6xj5CMIFv9": "[200_000..1_000_000]", + "rrW6s3l7vU": "\"amber\"" + }, + { + "_id": "YO3K4Q1iuU", + "6xj5CMIFv9": "< 200_000", + "rrW6s3l7vU": "\"red\"" + }, + { + "_id": "SY7uwJEPqS", + "6xj5CMIFv9": "", + "rrW6s3l7vU": "\"red\"" + } + ], + "inputs": [ + { + "id": "6xj5CMIFv9", + "name": "Turnover (LY)", + "type": "expression", + "field": "company.turnover" + } + ], + "outputs": [ + { + "id": "rrW6s3l7vU", + "name": "Flag Turnover", + "type": "expression", + "field": "flag.turnover" + } + ], + "hitPolicy": "first" + }, + "position": { + "x": 380, + "y": 160 + } + }, + { + "id": "abaaa033-5516-440c-b211-35f1d616ad9f", + "name": "Country", + "type": "decisionTableNode", + "content": { + "rules": [ + { + "_id": "TOi2qECISd", + "I493u7jDPg": "\"green\"", + "bGOSakKon0": "", + "z87lDk-Xar": "\"US\",\"IE\",\"GB\",\"CA\"" + }, + { + "_id": "aGPqCdh2tU", + "I493u7jDPg": "\"amber\"", + "bGOSakKon0": "true", + "z87lDk-Xar": "" + }, + { + "_id": "VYiuLkrLWb", + "I493u7jDPg": "\"red\"", + "bGOSakKon0": "", + "z87lDk-Xar": "" + } + ], + "inputs": [ + { + "id": "z87lDk-Xar", + "name": "Company Country", + "type": "expression", + "field": "company.country" + }, + { + "id": "bGOSakKon0", + "name": "Company IsEU", + "type": "expression", + "field": "company.isEu" + } + ], + "outputs": [ + { + "id": "I493u7jDPg", + "name": "Flag Country", + "type": "expression", + "field": "flag.country" + } + ], + "hitPolicy": "first" + }, + "position": { + "x": 380, + "y": 50 + } + }, + { + "id": "af6cdac4-2019-4a0f-9715-2ecfb27e0bfc", + "name": "Overall Mapper", + "type": "functionNode", + "content": "/**\n* @param {import('gorules').Input} input\n* @param {{\n* moment: import('dayjs')\n* env: Record\n* }} helpers\n*/\nconst handler = (input, { moment, env }) => {\n const count = (flag) => Object.values(input?.flag || {}).reduce((acc, curr) => {\n if (curr === flag) return acc + 1;\n return acc;\n }, 0);\n\n return {\n critical: count('critical'),\n red: count('red'),\n amber: count('amber'),\n green: count('green')\n };\n}", + "position": { + "x": 630, + "y": 270 + } + }, + { + "id": "86ce04c9-b4dd-4513-ae2b-7f585ceb224a", + "name": "Overall", + "type": "decisionTableNode", + "content": { + "rules": [ + { + "_id": "P0RQ3NFWfc", + "AczIUwvClr": "", + "KsBwLhAedP": "> 0", + "QJttqyV2FB": "", + "ek5q9WgLL9": "\"red\"", + "iFQl1CKB5S": "" + }, + { + "_id": "UGrT2iHE61", + "AczIUwvClr": "> 0", + "KsBwLhAedP": "", + "QJttqyV2FB": "", + "ek5q9WgLL9": "\"red\"", + "iFQl1CKB5S": "" + }, + { + "_id": "SBBO_aWujh", + "AczIUwvClr": "", + "KsBwLhAedP": "", + "QJttqyV2FB": "> 1", + "ek5q9WgLL9": "\"amber\"", + "iFQl1CKB5S": "" + }, + { + "_id": "N2jO9BnXHY", + "AczIUwvClr": "", + "KsBwLhAedP": "", + "QJttqyV2FB": "", + "ek5q9WgLL9": "\"green\"", + "iFQl1CKB5S": "" + } + ], + "inputs": [ + { + "id": "AczIUwvClr", + "name": "Red", + "type": "expression", + "field": "red" + }, + { + "id": "QJttqyV2FB", + "name": "Amber", + "type": "expression", + "field": "amber" + }, + { + "id": "iFQl1CKB5S", + "name": "Green", + "type": "expression", + "field": "green" + }, + { + "id": "KsBwLhAedP", + "name": "Critical", + "type": "expression", + "field": "critical" + } + ], + "outputs": [ + { + "id": "ek5q9WgLL9", + "name": "Overall", + "type": "expression", + "field": "overall" + } + ], + "hitPolicy": "first" + }, + "position": { + "x": 880, + "y": 270 + } + }, + { + "id": "95aa8f3c-f371-4e48-beb3-0b5775d2a814", + "name": "Response", + "type": "outputNode", + "position": { + "x": 1120, + "y": 160 + } + } + ] +}