@blazedpath/commons 0.1.0 → 0.2.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/README.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Publish
4
4
 
5
+ Login:
6
+
7
+ ```sh
8
+ npm login
9
+ ```
10
+
11
+ Publish:
12
+
5
13
  ```sh
6
14
  npm publish
7
15
  ```
package/blz-base/index.js CHANGED
@@ -535,7 +535,7 @@ module.exports = {
535
535
  },
536
536
  transform: async function (callContext, transformationName, source, writer) {
537
537
  let transformation = _metadata[transformationName];
538
- let transformationExecutor = require('../sources/' + transformation.sourceFileName);
538
+ let transformationExecutor = require(Path.join(_metadata.appPath,'../sources/', transformation.sourceFileName));
539
539
  if (source) {
540
540
  if (source._blz_reader) { // reader
541
541
  let reader = source;
@@ -578,7 +578,7 @@ module.exports = {
578
578
  writer: function (callContext, functionName, extraArgs) {
579
579
  let fn
580
580
  try {
581
- fn = require('../sources/' + module.exports.ensureDashedFormat(functionName) + '.js')
581
+ fn = require(Path.join(_metadata.appPath,'../sources/', module.exports.ensureDashedFormat(functionName) + '.js'))
582
582
  }
583
583
  catch (err) {
584
584
  throw this.error('InvalidFunction', { functionName: functionName });
@@ -741,7 +741,7 @@ module.exports = {
741
741
  internalCall: async function (callContext, functionName, args) {
742
742
  let fn = null;
743
743
  try {
744
- fn = require('../sources/' + module.exports.ensureDashedFormat(functionName) + '.js')
744
+ fn = require(Path.join(_metadata.appPath,'../sources/', module.exports.ensureDashedFormat(functionName) + '.js'))
745
745
  }
746
746
  catch (err) {
747
747
  throw this.error('InvalidFunction', { functionName: functionName });
@@ -35,7 +35,7 @@
35
35
  "addMonths": "%1$s + %2$s * INTERVAL '1 MONTH'",
36
36
  "addSeconds": "%1$s + %2$s * INTERVAL '1 SECOND'",
37
37
  "addYears": "%1$s + %2$s * INTERVAL '1 YEAR'",
38
- "date": "TO_TIMESTAMP('%1$s-%2$s-%3$s 0:0:0', 'YYYY-MM-DD HH24:MI:SS')",
38
+ "date": "TO_DATE('%1$s-%2$s-%3$s', 'YYYY-MM-DD')",
39
39
  "dateDiff": "DATE_PART('day', (%1$s) - (%2$s))",
40
40
  "datetime": "TO_TIMESTAMP('%1$s-%2$s-%3$s %4$s:%5$s:%6$s', 'YYYY-MM-DD HH24:MI:SS')",
41
41
  "datetimeDiff": "(((DATE_PART('day', %1$s - %2$s) * 24 + DATE_PART('hour', %1$s - %2$s)) * 60 + DATE_PART('minute', %1$s - %2$s)) * 60 + DATE_PART('second', %1$s - %2$s)) * 1000",
@@ -98,8 +98,6 @@ permissions:
98
98
  enable: false
99
99
  - path: customer-message
100
100
  enable: false
101
- - path: /debtor/**
102
- enable: false
103
101
  - path: /debtor-account-stage/**
104
102
  enable: false
105
103
  - path: debtor-account-stage
@@ -110,6 +108,8 @@ permissions:
110
108
  enable: false
111
109
  - path: /debtors/**
112
110
  enable: false
111
+ - path: /debtor/**
112
+ enable: false
113
113
  - path: /dim-messages/**
114
114
  enable: false
115
115
  - path: /dim-messages-entity/**
@@ -462,20 +462,20 @@ permissions:
462
462
 
463
463
  # region Consumer Costumer Widgets Rules
464
464
  # Filters (Alphabetic Order List, this rule will be disabled in all roles always)
465
- - path: /debtors/**
465
+ - path: /debtor/**
466
466
  actions: filters_AlphabeticOrderList
467
467
  enable: false
468
468
 
469
469
  # Body - 360 Cards
470
- - path: /debtors/**
470
+ - path: /debtor/**
471
471
  actions: cc_depositAccountCard
472
472
  enable: false
473
473
 
474
- - path: /debtors/**
474
+ - path: /debtor/**
475
475
  actions: cc_creditDisputeCard
476
476
  enable: false
477
477
 
478
- - path: /debtors/**
478
+ - path: /debtor/**
479
479
  actions: cc_settlementDiscountCard
480
480
  enable: false
481
481
 
@@ -563,18 +563,48 @@ permissions:
563
563
  # region Business Customer
564
564
 
565
565
  # Body - 360 Cards
566
- - path: /debtors/**
566
+ - path: /debtor/**
567
567
  actions: bc_depositAccountCard
568
568
  enable: false
569
569
 
570
- - path: /debtors/**
570
+ - path: /debtor/**
571
571
  actions: bc_creditDisputeCard
572
572
  enable: false
573
573
 
574
- - path: /debtors/**
574
+ - path: /debtor/**
575
575
  actions: bc_settlementDiscountCard
576
576
  enable: false
577
577
 
578
+ - path: /debtor/**
579
+ actions: cc_cancelPaymentArrangement
580
+ enable: false
581
+
582
+ - path: /debtor/**
583
+ actions: cc_rejectDispute
584
+ enable: false
585
+
586
+ - path: /debtor/**
587
+ actions: cc_resolveDispute
588
+ enable: false
589
+
590
+ - path: /debtor/**
591
+ actions: cc_updateExemption
592
+ enable: false
593
+
594
+ - path: /debtor/**
595
+ actions: cc_editOldTrustee
596
+ enable: false
597
+
598
+ - path: /debtor/**
599
+ actions: cc_editNewTrustee
600
+ enable: false
601
+
602
+ # Dunning debtor option
603
+
604
+ - path: /debtor/**
605
+ actions: dunning_CreateFinancingAgreement,dunming_ReallocateTransaction
606
+ enable: false
607
+
578
608
  # Dunning screen
579
609
  - path: /dunning/**
580
610
  actions: bc_dunningSuspendAccount
@@ -705,23 +735,27 @@ permissions:
705
735
  # Home Rules
706
736
  - name: agent_home
707
737
  rules:
708
- - path: /collection-home
738
+ - path: /collection-home
709
739
  domain: agent
740
+ # Agent View Only
741
+ - name: agent_viewOnly
742
+ rules:
743
+ - path: /colm/**
744
+ - path: /debtors
745
+ domain: agent
710
746
  # Consumer Costumer Rules
711
747
  - name: agent_consumer_costumer
748
+ extends:
749
+ - agent_viewOnly
712
750
  rules:
713
751
  - path: consumer-debtor
714
752
  - path: /debtors
715
753
  - path: /debtor/**
716
754
  domain: agent
717
- - name: agent_viewOnly
718
- rules:
719
- - path: /colm/**
720
- domain: agent
721
755
  # 360 View
722
756
  - name: agent_consumer_costumer_360View_settlementDiscountCard
723
757
  rules:
724
- - path: /debtors/**
758
+ - path: /debtor/**
725
759
  actions: cc_settlementDiscountCard
726
760
  enable: true
727
761
  domain: agent
@@ -793,17 +827,71 @@ permissions:
793
827
  rules:
794
828
  - path: organization-debtor
795
829
  - path: /debtors
796
- - path: /debtor/**
830
+ # - path: /debtor/**
797
831
  domain: agent
798
832
 
799
833
  # 360 View
800
834
  - name: agent_business_costumer_360View_settlementDiscountCard
801
835
  rules:
802
- - path: /debtors/**
836
+ - path: /debtor/**
803
837
  actions: bc_settlementDiscountCard
804
838
  enable: true
805
839
  domain: agent
806
840
 
841
+ - name: agent_business_costumer_360View_cancelPaymentArrangement
842
+ rules:
843
+ - path: /debtor/**
844
+ actions: cc_cancelPaymentArrangement
845
+ enable: true
846
+ domain: agent
847
+
848
+ - name: agent_business_costumer_360View_resolveDispute
849
+ rules:
850
+ - path: /debtor/**
851
+ actions: cc_cc_resolveDispute
852
+ enable: true
853
+ domain: agent
854
+
855
+ - name: agent_business_costumer_360View_rejectDispute
856
+ rules:
857
+ - path: /debtor/**
858
+ actions: cc_rejectDispute
859
+ enable: true
860
+ domain: agent
861
+
862
+
863
+ - name: agent_business_costumer_360View_updateExemption
864
+ rules:
865
+ - path: /debtor/**
866
+ actions: cc_updateExemption
867
+ enable: true
868
+ domain: agent
869
+
870
+ - name: agent_business_costumer_360View_editNewTrustee
871
+ rules:
872
+ - path: /debtor/**
873
+ actions: cc_editNewTrustee
874
+ enable: true
875
+ domain: agent
876
+
877
+ - name: agent_business_costumer_360View_cc_editOldTrustee
878
+ rules:
879
+ - path: /debtor/**
880
+ actions: cc_editOldTrustee
881
+ enable: true
882
+ domain: agent
883
+
884
+ - name: agent_business_costumer_360View_dunning_CreateFinancingAgreement
885
+ rules:
886
+ - path: /debtor/**
887
+ actions: dunning_CreateFinancingAgreement
888
+ domain: agent
889
+ - name: agent_business_costumer_360View_dunming_ReallocateTransaction
890
+ rules:
891
+ - path: /debtor/**
892
+ actions: dunming_ReallocateTransaction
893
+ domain: agent
894
+
807
895
  # Dunning screen
808
896
  - name: agent_business_costumer_dunning_SuspendAccountCard
809
897
  rules:
@@ -950,6 +1038,8 @@ permissions:
950
1038
  actions: GET
951
1039
  - path: /api/ms-operation-scheduler/**
952
1040
  actions: GET
1041
+ - path: /api/ms-placement/**
1042
+ actions: GET
953
1043
  - path: /api/bkr-ext/**
954
1044
  actions: GET
955
1045
  domain: agent
@@ -1001,6 +1091,7 @@ roles:
1001
1091
  - name: Collections.ViewOnly
1002
1092
  permissions:
1003
1093
  - agent_home
1094
+ - agent_viewOnly
1004
1095
  - agent_consumer_costumer
1005
1096
  - agent_business_costumer
1006
1097
  - agent_viewonly_portal_apis
@@ -1011,6 +1102,14 @@ roles:
1011
1102
  - agent_task_management
1012
1103
  - agent_entry_process
1013
1104
  - agent_portal_apis
1105
+ - agent_business_costumer_360View_cancelPaymentArrangement
1106
+ - agent_business_costumer_360View_resolveDispute
1107
+ - agent_business_costumer_360View_rejectDispute
1108
+ - agent_business_costumer_360View_updateExemption
1109
+ - agent_business_costumer_360View_editOldTrustee
1110
+ - agent_business_costumer_360View_editNewTrustee
1111
+ - agent_business_costumer_360View_dunning_CreateFinancingAgreement
1112
+ - agent_business_costumer_360View_dunming_ReallocateTransaction
1014
1113
  - name: Collections.FinanceBV
1015
1114
  extends:
1016
1115
  - Collections.ViewOnly
@@ -42,7 +42,7 @@ describe('SecureUrlService', () => {
42
42
  } catch (error) {
43
43
  expect(error.message).toBe('The token has expired.');
44
44
  expect(error.name).toBe('SecureUrlError');
45
- expect(error.code).toBe(408); // o el campo que uses para el código
45
+ expect(error.code).toBe(410); // o el campo que uses para el código
46
46
  }
47
47
  })
48
48
 
@@ -64,7 +64,7 @@ describe('SecureUrlService', () => {
64
64
  } catch (error) {
65
65
  expect(error.message).toBe('The token has expired.');
66
66
  expect(error.name).toBe('SecureUrlError');
67
- expect(error.code).toBe(408); // o el campo que uses para el código
67
+ expect(error.code).toBe(410); // o el campo que uses para el código
68
68
  }
69
69
  })
70
70
 
@@ -42,9 +42,9 @@
42
42
  - path: ~/blazedapth/blz/blz-builder/burners/web-frontend/sources/startup/index.js
43
43
  - path: ~/blazedapth/blz/blz-suite/backend/servers/web-frontend/index.js
44
44
  - Se modifica Blz.setSecurityRule por BlzSecurity.setSecurityRule
45
- - path: ~/blazedapth/blz/blz-shared/js-generator/commands/set-security-rule.js
45
+ - path: ~/blazedapth/blz/blz-commons/js-generator/commands/set-security-rule.js
46
46
  - Se modifica Blz.clearSecurityRules por BlzSecurity.clearSecurityRules
47
- - path: ~/blazedapth/blz/blz-shared/js-generator/commands/reset-security-rules.js
47
+ - path: ~/blazedapth/blz/blz-commons/js-generator/commands/reset-security-rules.js
48
48
  - Se agrega BlzSecurity en Blz_controls_RouteResolver
49
49
  - path: ~/blazedapth/blz/blz-ui/assets/js/blz-wrappers/Blz_controls_RouteResolver.js
50
50
 
@@ -71,5 +71,5 @@ grunt prod-prod
71
71
  - Documentation
72
72
  - [security rules and options](https://docs-blz.bsn-dev.beesion.team/#/doc/security-rules-and-options)
73
73
  - Demo
74
- - [DemoAuth](~/blazedapth/blz/blz-shared/essentials/solutions/DemoAuth)
74
+ - [DemoAuth](~/blazedapth/blz/blz-commons/essentials/solutions/DemoAuth)
75
75
 
@@ -17,19 +17,26 @@ async function getAuthorizationService(configPath) {
17
17
 
18
18
  ;(async () => {
19
19
 
20
-
20
+ let result= null
21
21
 
22
22
  const authorizationService = await getAuthorizationService('../__test__/AuthorizationKpn.yaml')
23
-
23
+
24
24
  // expect('[{"path":"/api/ms-financing-setting/fnc-catalog","actions":"*","enable":true}]').toStrictEqual(result)
25
25
 
26
26
  // console.log(authorizationService.getFrontendSecurityRules(["Configuration.Admin"],["config"] ))
27
27
  // console.log(JSON.stringify(authorizationService.getFrontendSecurityRules(['Configuration.Admin'],['agent'] )))
28
- const result = authorizationService.checkAuthorize('/ep-manual-credit/undefined', null, ['Configuration.Admin'], ['agent'])
28
+ // let result = authorizationService.checkAuthorize('/ep-manual-credit/undefined', null, ['Configuration.Admin'], ['agent'])
29
+ // console.log(result)
30
+ // result = authorizationService.checkAuthorize('/ep-manual-credit/undefined', null, ['Collections.Admin','Collections.Finance','Configuration.Admin'], ['agent'])
31
+ // console.log(result)
32
+ result = authorizationService.checkAuthorize('/debtor/102592', 'dunning_CreateFinancingAgreement', ['Collections.ViewOnly'], ['agent'])
29
33
  console.log(result)
30
- result = authorizationService.checkAuthorize('/ep-manual-credit/undefined', null, ['Collections.Admin','Collections.Finance','Configuration.Admin'], ['agent'])
34
+ result = authorizationService.checkAuthorize('/debtor/102592', 'dunning_CreateFinancingAgreement', ['Configuration.Admin'], ['agent'])
31
35
  console.log(result)
32
36
 
37
+ // no debe tener acceso ViewOnly Financiamiento
38
+ //
39
+
33
40
 
34
41
 
35
42
 
@@ -594,12 +594,13 @@ class HapiServerAzureAd {
594
594
 
595
595
  // Register the @hapi/cookie plugin
596
596
  await server.register(hapiCookie);
597
-
597
+
598
+ const hapiCookiePassword = process.env.blz_hapiCookiePassword || 'supersecretpasswordmustbeatleast32characterslong';
598
599
  // Define the cookie-based auth strategy
599
600
  server.auth.strategy('cookieAuth', 'cookie', {
600
601
  cookie: {
601
602
  name: 'sid', // Primary session cookie
602
- password: 'supersecretpasswordmustbeatleast32characterslong', // Encryption key
603
+ password: hapiCookiePassword, // Encryption key
603
604
  isSecure: true, // Should be true in production
604
605
  isHttpOnly: true, // Prevents client-side JavaScript access
605
606
  isSameSite: 'Lax', // Protects against CSRF
@@ -59,13 +59,10 @@ class HapiServerKeycloak {
59
59
  this.securityService = null;
60
60
  this.securityUrlCookieKey = null;
61
61
  }
62
+
62
63
  async generateGuid() {
63
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
64
- const r = Math.random() * 16 | 0;
65
- const v = (c === 'x') ? r : (r & 0x3 | 0x8);
66
- return v.toString(16);
67
- });
68
- }
64
+ return crypto.randomUUID();
65
+ }
69
66
 
70
67
  async connect(_securityService, hapiServer, config) {
71
68
  contextConfig = config
@@ -630,11 +627,12 @@ class HapiServerKeycloak {
630
627
  // Register the @hapi/cookie plugin
631
628
  await server.register(hapiCookie);
632
629
 
630
+ const hapiCookiePassword = process.env.blz_hapiCookiePassword || 'supersecretpasswordmustbeatleast32characterslong';
633
631
  // Define the cookie-based auth strategy
634
632
  server.auth.strategy('cookieAuth', 'cookie', {
635
633
  cookie: {
636
634
  name: 'sid', // Primary session cookie
637
- password: 'supersecretpasswordmustbeatleast32characterslong', // Encryption key
635
+ password: hapiCookiePassword, // Encryption key
638
636
  isSecure: true, // Should be true in production
639
637
  isHttpOnly: true, // Prevents client-side JavaScript access
640
638
  isSameSite: 'Lax', // Protects against CSRF
@@ -736,11 +736,12 @@ class HapiServer {
736
736
  // Register the @hapi/cookie plugin
737
737
  await server.register(hapiCookie);
738
738
 
739
+ const hapiCookiePassword = process.env.blz_hapiCookiePassword || 'supersecretpasswordmustbeatleast32characterslong';
739
740
  // Define the cookie-based auth strategy
740
741
  server.auth.strategy('cookieAuth', 'cookie', {
741
742
  cookie: {
742
743
  name: 'sid', // Primary session cookie
743
- password: 'supersecretpasswordmustbeatleast32characterslong', // Encryption key
744
+ password: hapiCookiePassword, // Encryption key
744
745
  isSecure: true, // Should be true in production
745
746
  isHttpOnly: true, // Prevents client-side JavaScript access
746
747
  isSameSite: 'Lax', // Protects against CSRF
@@ -41,8 +41,7 @@ module.exports = class SecureUrlService {
41
41
  const path = url.split('?')[0];
42
42
  const session_key = isBase64(_session_key)?atob(_session_key):_session_key
43
43
  const key = `${session_key}${btoa(decodeURIComponent(path))}`;
44
- const getNow = () => Function('"use strict";return (' + atob("bmV3IERhdGUoKS5nZXRUaW1lKCk=") + ')')();
45
- const token = CryptoJS.AES.encrypt((getNow()).toString(), key).toString();
44
+ const token = CryptoJS.AES.encrypt((Date.now()).toString(), key).toString();
46
45
  return encodeURIComponent(token);
47
46
  }
48
47
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazedpath/commons",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "commos library for blazedpath applications",
5
5
  "main": "index.js",
6
6
  "types": "dist/index.d.ts",