@yousolution/node-red-contrib-you-sap-service-layer 0.0.6 → 0.1.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.
@@ -19,7 +19,7 @@ describe('support library', () => {
19
19
  const node = {
20
20
  context: () => {
21
21
  return {
22
- flow: {
22
+ global: {
23
23
  get: (param) => {
24
24
  if (param == '_YOU_SapServiceLayer_1.host') {
25
25
  return 'host';
@@ -96,7 +96,7 @@ describe('support library', () => {
96
96
  const node = {
97
97
  context: () => {
98
98
  return {
99
- flow: {
99
+ global: {
100
100
  get: (param) => {
101
101
  if (param == '_YOU_SapServiceLayer_1.host') {
102
102
  return 'host';
@@ -163,7 +163,7 @@ describe('support library', () => {
163
163
  const node = {
164
164
  context: () => {
165
165
  return {
166
- flow: {
166
+ global: {
167
167
  get: (param) => {
168
168
  if (param == '_YOU_SapServiceLayer_1.host') {
169
169
  return 'host';
@@ -211,7 +211,7 @@ describe('support library', () => {
211
211
  const node = {
212
212
  context: () => {
213
213
  return {
214
- flow: {
214
+ global: {
215
215
  get: (param) => {
216
216
  if (param == '_YOU_SapServiceLayer_1.host') {
217
217
  return 'host';
@@ -262,7 +262,7 @@ describe('support library', () => {
262
262
  const node = {
263
263
  context: () => {
264
264
  return {
265
- flow: {
265
+ global: {
266
266
  get: (param) => {
267
267
  if (param == '_YOU_SapServiceLayer_1.host') {
268
268
  return 'host';
@@ -312,7 +312,7 @@ describe('support library', () => {
312
312
  const node = {
313
313
  context: () => {
314
314
  return {
315
- flow: {
315
+ global: {
316
316
  get: (param) => {
317
317
  if (param == '_YOU_SapServiceLayer_1.host') {
318
318
  return 'host';
@@ -364,7 +364,7 @@ describe('support library', () => {
364
364
  const node = {
365
365
  context: () => {
366
366
  return {
367
- flow: {
367
+ global: {
368
368
  get: (param) => {
369
369
  if (param == '_YOU_SapServiceLayer_1.host') {
370
370
  return 'host';
@@ -405,7 +405,7 @@ describe('support library', () => {
405
405
  const node = {
406
406
  context: () => {
407
407
  return {
408
- flow: {
408
+ global: {
409
409
  get: (param) => {
410
410
  if (param == '_YOU_SapServiceLayer_1.host') {
411
411
  return 'host';
@@ -457,7 +457,7 @@ describe('support library', () => {
457
457
  const node = {
458
458
  context: () => {
459
459
  return {
460
- flow: {
460
+ global: {
461
461
  get: (param) => {
462
462
  if (param == '_YOU_SapServiceLayer_1.host') {
463
463
  return 'host';
@@ -498,7 +498,7 @@ describe('support library', () => {
498
498
  const node = {
499
499
  context: () => {
500
500
  return {
501
- flow: {
501
+ global: {
502
502
  get: (param) => {
503
503
  if (param == '_YOU_SapServiceLayer_1.host') {
504
504
  return 'host';
@@ -559,7 +559,7 @@ describe('support library', () => {
559
559
  const node = {
560
560
  context: () => {
561
561
  return {
562
- flow: {
562
+ global: {
563
563
  get: (param) => {
564
564
  if (param == '_YOU_SapServiceLayer_1.host') {
565
565
  return 'host';
@@ -609,7 +609,7 @@ describe('support library', () => {
609
609
  const node = {
610
610
  context: () => {
611
611
  return {
612
- flow: {
612
+ global: {
613
613
  get: (param) => {
614
614
  if (param == '_YOU_SapServiceLayer_1.host') {
615
615
  return 'host';
@@ -661,7 +661,7 @@ describe('support library', () => {
661
661
  const node = {
662
662
  context: () => {
663
663
  return {
664
- flow: {
664
+ global: {
665
665
  get: (param) => {
666
666
  if (param == '_YOU_SapServiceLayer_1.host') {
667
667
  return 'host';
@@ -713,7 +713,7 @@ describe('support library', () => {
713
713
  const node = {
714
714
  context: () => {
715
715
  return {
716
- flow: {
716
+ global: {
717
717
  get: (param) => {
718
718
  if (param == '_YOU_SapServiceLayer_1.host') {
719
719
  return 'host';
@@ -755,7 +755,7 @@ describe('support library', () => {
755
755
  const node = {
756
756
  context: () => {
757
757
  return {
758
- flow: {
758
+ global: {
759
759
  get: (param) => {
760
760
  if (param == '_YOU_SapServiceLayer_1.host') {
761
761
  return 'host';
@@ -797,7 +797,7 @@ describe('support library', () => {
797
797
  const node = {
798
798
  context: () => {
799
799
  return {
800
- flow: {
800
+ global: {
801
801
  get: (param) => {
802
802
  if (param == '_YOU_SapServiceLayer_1.host') {
803
803
  return 'host';
@@ -835,11 +835,216 @@ describe('support library', () => {
835
835
  }).to.throw('Missing method');
836
836
  });
837
837
 
838
+ it('should generate a correct request with SQLQuery create query', () => {
839
+ const node = {
840
+ context: () => {
841
+ return {
842
+ global: {
843
+ get: (param) => {
844
+ if (param == '_YOU_SapServiceLayer_1.host') {
845
+ return 'host';
846
+ }
847
+ if (param == '_YOU_SapServiceLayer_1.port') {
848
+ return 'port';
849
+ }
850
+ if (param == '_YOU_SapServiceLayer_1.version') {
851
+ return 'version';
852
+ }
853
+ if (param == '_YOU_SapServiceLayer_1.headers') {
854
+ return ['header:1', 'header:2'];
855
+ }
856
+ },
857
+ },
858
+ };
859
+ },
860
+ };
861
+
862
+ const msg = {
863
+ _YOU_SapServiceLayer: {
864
+ idAuth: 1,
865
+ },
866
+ entityId: 3,
867
+ };
868
+ let config = {
869
+ sqlCode: 'sqlCode',
870
+ sqlName: 'sqlName',
871
+ sqlText: 'sqlText',
872
+ };
873
+ const options = { method: 'POST', hasRawQuery: false, hasEntityId: false, isCreateSQLQuery: true };
874
+ const expectedValue = {
875
+ axiosOptions: {
876
+ headers: {
877
+ Cookie: 'header:1;header:2',
878
+ },
879
+ method: 'POST',
880
+ rejectUnauthorized: false,
881
+ url: 'https://host:port/b1s/version/SQLQueries',
882
+ withCredentials: true,
883
+ },
884
+ idAuthNode: 1,
885
+ };
886
+
887
+ should.deepEqual(Support.generateRequest(node, msg, config, options), expectedValue);
888
+ });
889
+
890
+ it('should generate a correct request with SQLQuery execute query without params', () => {
891
+ const node = {
892
+ context: () => {
893
+ return {
894
+ global: {
895
+ get: (param) => {
896
+ if (param == '_YOU_SapServiceLayer_1.host') {
897
+ return 'host';
898
+ }
899
+ if (param == '_YOU_SapServiceLayer_1.port') {
900
+ return 'port';
901
+ }
902
+ if (param == '_YOU_SapServiceLayer_1.version') {
903
+ return 'version';
904
+ }
905
+ if (param == '_YOU_SapServiceLayer_1.headers') {
906
+ return ['header:1', 'header:2'];
907
+ }
908
+ },
909
+ },
910
+ };
911
+ },
912
+ };
913
+
914
+ const msg = {
915
+ _YOU_SapServiceLayer: {
916
+ idAuth: 1,
917
+ },
918
+ entityId: 3,
919
+ sqlCode: 'queryCode',
920
+ };
921
+ let config = {
922
+ sqlCode: 'sqlCode',
923
+ };
924
+ const options = { method: 'POST', hasRawQuery: false, hasEntityId: false, isSQLQuery: true };
925
+ const expectedValue = {
926
+ axiosOptions: {
927
+ headers: {
928
+ Cookie: 'header:1;header:2',
929
+ },
930
+ method: 'POST',
931
+ rejectUnauthorized: false,
932
+ url: `https://host:port/b1s/version/SQLQueries('queryCode')/List`,
933
+ withCredentials: true,
934
+ },
935
+ idAuthNode: 1,
936
+ };
937
+
938
+ should.deepEqual(Support.generateRequest(node, msg, config, options), expectedValue);
939
+ });
940
+
941
+ it('should generate a correct request with SQLQuery execute query with params', () => {
942
+ const node = {
943
+ context: () => {
944
+ return {
945
+ global: {
946
+ get: (param) => {
947
+ if (param == '_YOU_SapServiceLayer_1.host') {
948
+ return 'host';
949
+ }
950
+ if (param == '_YOU_SapServiceLayer_1.port') {
951
+ return 'port';
952
+ }
953
+ if (param == '_YOU_SapServiceLayer_1.version') {
954
+ return 'version';
955
+ }
956
+ if (param == '_YOU_SapServiceLayer_1.headers') {
957
+ return ['header:1', 'header:2'];
958
+ }
959
+ },
960
+ },
961
+ };
962
+ },
963
+ };
964
+
965
+ const msg = {
966
+ _YOU_SapServiceLayer: {
967
+ idAuth: 1,
968
+ },
969
+ entityId: 3,
970
+ sqlCode: 'queryCode',
971
+ };
972
+ let config = {
973
+ sqlCode: 'sqlCode',
974
+ };
975
+ const options = { method: 'POST', hasRawQuery: false, hasEntityId: false, isSQLQuery: true };
976
+ const expectedValue = {
977
+ axiosOptions: {
978
+ headers: {
979
+ Cookie: 'header:1;header:2',
980
+ },
981
+ method: 'POST',
982
+ rejectUnauthorized: false,
983
+ url: `https://host:port/b1s/version/SQLQueries('queryCode')/List`,
984
+ withCredentials: true,
985
+ },
986
+ idAuthNode: 1,
987
+ };
988
+
989
+ should.deepEqual(Support.generateRequest(node, msg, config, options), expectedValue);
990
+ });
991
+
992
+ it('should generate a correct request with SQLQuery execute query with nextLink', () => {
993
+ const node = {
994
+ context: () => {
995
+ return {
996
+ global: {
997
+ get: (param) => {
998
+ if (param == '_YOU_SapServiceLayer_1.host') {
999
+ return 'host';
1000
+ }
1001
+ if (param == '_YOU_SapServiceLayer_1.port') {
1002
+ return 'port';
1003
+ }
1004
+ if (param == '_YOU_SapServiceLayer_1.version') {
1005
+ return 'version';
1006
+ }
1007
+ if (param == '_YOU_SapServiceLayer_1.headers') {
1008
+ return ['header:1', 'header:2'];
1009
+ }
1010
+ },
1011
+ },
1012
+ };
1013
+ },
1014
+ };
1015
+
1016
+ const msg = {
1017
+ _YOU_SapServiceLayer: {
1018
+ idAuth: 1,
1019
+ },
1020
+ entityId: 3,
1021
+ sqlCode: 'queryCode',
1022
+ };
1023
+ let config = {
1024
+ sqlCode: 'sqlCode',
1025
+ };
1026
+ const options = { method: 'POST', hasRawQuery: false, hasEntityId: false, isSQLQuery: true };
1027
+ const expectedValue = {
1028
+ axiosOptions: {
1029
+ headers: {
1030
+ Cookie: 'header:1;header:2',
1031
+ },
1032
+ method: 'POST',
1033
+ rejectUnauthorized: false,
1034
+ url: `https://host:port/b1s/version/SQLQueries('queryCode')/List`,
1035
+ withCredentials: true,
1036
+ },
1037
+ idAuthNode: 1,
1038
+ };
1039
+
1040
+ should.deepEqual(Support.generateRequest(node, msg, config, options), expectedValue);
1041
+ });
1042
+
838
1043
  it('should have error missing object', () => {
839
1044
  const node = {
840
1045
  context: () => {
841
1046
  return {
842
- flow: {
1047
+ global: {
843
1048
  get: (param) => {
844
1049
  if (param == '_YOU_SapServiceLayer_1.host') {
845
1050
  return 'host';
@@ -876,7 +1081,7 @@ describe('support library', () => {
876
1081
  const node = {
877
1082
  context: () => {
878
1083
  return {
879
- flow: {
1084
+ global: {
880
1085
  get: (param) => {},
881
1086
  },
882
1087
  };
@@ -898,7 +1103,7 @@ describe('support library', () => {
898
1103
  const node = {
899
1104
  context: () => {
900
1105
  return {
901
- flow: {
1106
+ global: {
902
1107
  get: (param) => {
903
1108
  if (param == '_YOU_SapServiceLayer_1.host') {
904
1109
  return 'host';
@@ -942,7 +1147,7 @@ describe('support library', () => {
942
1147
  const node = {
943
1148
  context: () => {
944
1149
  return {
945
- flow: {
1150
+ global: {
946
1151
  get: (param) => {
947
1152
  if (param == '_YOU_SapServiceLayer_1.host') {
948
1153
  return 'host';
@@ -984,7 +1189,7 @@ describe('support library', () => {
984
1189
  const node = {
985
1190
  context: () => {
986
1191
  return {
987
- flow: {
1192
+ global: {
988
1193
  get: (param) => {
989
1194
  if (param == '_YOU_SapServiceLayer_1.host') {
990
1195
  return 'host';
@@ -1042,7 +1247,7 @@ describe('support library', () => {
1042
1247
  const node = {
1043
1248
  context: () => {
1044
1249
  return {
1045
- flow: {
1250
+ global: {
1046
1251
  get: (param) => {
1047
1252
  if (param == '_YOU_SapServiceLayer_1.host') {
1048
1253
  return 'host';
@@ -1091,7 +1296,7 @@ describe('support library', () => {
1091
1296
  send: () => {},
1092
1297
  context: () => {
1093
1298
  return {
1094
- flow: {
1299
+ global: {
1095
1300
  get: (param) => {
1096
1301
  if (param == '_YOU_SapServiceLayer_1.host') {
1097
1302
  return 'host';
@@ -1149,7 +1354,7 @@ describe('support library', () => {
1149
1354
  send: () => {},
1150
1355
  context: () => {
1151
1356
  return {
1152
- flow: {
1357
+ global: {
1153
1358
  get: (param) => {
1154
1359
  if (param == '_YOU_SapServiceLayer_1.host') {
1155
1360
  return 'host';
package/data/package.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "name": "node-red-project",
3
- "description": "A Node-RED Project",
4
- "version": "0.0.1",
5
- "private": true,
6
- "dependencies": {
7
- "@types/node-red": "^1.1.1",
8
- "@yousolution/node-red-contrib-you-sap-service-layer": "file:yousolution-node-red-contrib-you-sap-service-layer-0.0.4.tgz",
9
- "@yousolution/node-red-contrib-you-yousolution.cloud": "0.0.1",
10
- "faker": "^6.6.6",
11
- "node-red-contrib-sse-client": "~0.2.2",
12
- "node-red-node-email": "~1.14.0"
13
- }
14
- }