@graphql-mesh/odata 1.0.0-alpha-20230523154231-8c60b52d9 → 1.0.0-alpha-20230523154841-376b13623
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/cjs/index.js +48 -61
- package/esm/index.js +48 -61
- package/package.json +9 -6
package/cjs/index.js
CHANGED
|
@@ -123,7 +123,7 @@ class ODataHandler {
|
|
|
123
123
|
const contextDataloaderName = Symbol(`${this.name}DataLoader`);
|
|
124
124
|
function getNamespaceFromTypeRef(typeRef) {
|
|
125
125
|
let namespace = '';
|
|
126
|
-
namespaces
|
|
126
|
+
namespaces?.forEach(el => {
|
|
127
127
|
if (typeRef.startsWith(el) &&
|
|
128
128
|
el.length > namespace.length && // It can be deeper namespace
|
|
129
129
|
!typeRef.replace(el + '.', '').includes('.') // Typename cannot have `.`
|
|
@@ -196,7 +196,7 @@ class ODataHandler {
|
|
|
196
196
|
}
|
|
197
197
|
const returnList = responseJson.value;
|
|
198
198
|
return returnList.map(element => {
|
|
199
|
-
if (!
|
|
199
|
+
if (!entityTypeExtensions?.entityInfo) {
|
|
200
200
|
return element;
|
|
201
201
|
}
|
|
202
202
|
const urlOfElement = new URL(urlStringWithoutSearchParams);
|
|
@@ -235,13 +235,13 @@ class ODataHandler {
|
|
|
235
235
|
else {
|
|
236
236
|
const actualReturnType = info.returnType;
|
|
237
237
|
const entityTypeExtensions = actualReturnType.extensions;
|
|
238
|
-
if (!
|
|
238
|
+
if (!entityTypeExtensions?.entityInfo) {
|
|
239
239
|
return responseJson;
|
|
240
240
|
}
|
|
241
241
|
const identifierUrl = responseJson['@odata.id'] || urlStringWithoutSearchParams;
|
|
242
242
|
const fieldMap = actualReturnType.getFields();
|
|
243
243
|
for (const fieldName in responseJson) {
|
|
244
|
-
if (entityTypeExtensions
|
|
244
|
+
if (entityTypeExtensions?.entityInfo.navigationFields.includes(fieldName)) {
|
|
245
245
|
const field = responseJson[fieldName];
|
|
246
246
|
let fieldType = fieldMap[fieldName].type;
|
|
247
247
|
if ('ofType' in fieldType) {
|
|
@@ -306,7 +306,7 @@ class ODataHandler {
|
|
|
306
306
|
try {
|
|
307
307
|
return schemaComposer.getAnyTC(typeName);
|
|
308
308
|
}
|
|
309
|
-
catch
|
|
309
|
+
catch { }
|
|
310
310
|
}
|
|
311
311
|
return null;
|
|
312
312
|
}
|
|
@@ -351,7 +351,6 @@ class ODataHandler {
|
|
|
351
351
|
}
|
|
352
352
|
const DATALOADER_FACTORIES = {
|
|
353
353
|
multipart: (context) => new dataloader_1.default(async (requests) => {
|
|
354
|
-
var _a;
|
|
355
354
|
let requestBody = '';
|
|
356
355
|
const requestBoundary = 'batch_' + Date.now();
|
|
357
356
|
for (const requestIndex in requests) {
|
|
@@ -361,7 +360,7 @@ class ODataHandler {
|
|
|
361
360
|
requestBody += `Content-Transfer-Encoding:binary\n`;
|
|
362
361
|
requestBody += `Content-ID: ${requestIndex}\n\n`;
|
|
363
362
|
requestBody += `${request.method} ${request.url} HTTP/1.1\n`;
|
|
364
|
-
|
|
363
|
+
request.headers?.forEach((value, key) => {
|
|
365
364
|
requestBody += `${key}: ${value}\n`;
|
|
366
365
|
});
|
|
367
366
|
if (request.body) {
|
|
@@ -412,12 +411,11 @@ class ODataHandler {
|
|
|
412
411
|
method: 'POST',
|
|
413
412
|
body: JSON.stringify({
|
|
414
413
|
requests: await Promise.all(requests.map(async (request, index) => {
|
|
415
|
-
var _a;
|
|
416
414
|
const id = index.toString();
|
|
417
415
|
const url = request.url.replace(endpoint, '');
|
|
418
416
|
const method = request.method;
|
|
419
417
|
const headers = {};
|
|
420
|
-
|
|
418
|
+
request.headers?.forEach((value, key) => {
|
|
421
419
|
headers[key] = value;
|
|
422
420
|
});
|
|
423
421
|
return {
|
|
@@ -448,7 +446,7 @@ class ODataHandler {
|
|
|
448
446
|
const ref = alias + '.' + name;
|
|
449
447
|
return multipleSchemas ? (0, pascal_case_1.pascalCase)(ref.split('.').join('_')) : name;
|
|
450
448
|
}
|
|
451
|
-
schemas
|
|
449
|
+
schemas?.forEach((schemaObj) => {
|
|
452
450
|
const schemaNamespace = schemaObj.attributes.Namespace;
|
|
453
451
|
namespaces.add(schemaNamespace);
|
|
454
452
|
const schemaAlias = schemaObj.attributes.Alias;
|
|
@@ -456,13 +454,11 @@ class ODataHandler {
|
|
|
456
454
|
aliasNamespaceMap.set(schemaNamespace, schemaAlias);
|
|
457
455
|
}
|
|
458
456
|
});
|
|
459
|
-
schemas
|
|
460
|
-
var _a, _b, _c;
|
|
457
|
+
schemas?.forEach((schemaObj) => {
|
|
461
458
|
const schemaNamespace = schemaObj.attributes.Namespace;
|
|
462
|
-
|
|
463
|
-
var _a;
|
|
459
|
+
schemaObj.EnumType?.forEach((enumObj) => {
|
|
464
460
|
const values = {};
|
|
465
|
-
|
|
461
|
+
enumObj.Member?.forEach((memberObj) => {
|
|
466
462
|
const key = memberObj.attributes.Name;
|
|
467
463
|
// This doesn't work.
|
|
468
464
|
// const value = memberElement.getAttribute('Value')!;
|
|
@@ -480,8 +476,7 @@ class ODataHandler {
|
|
|
480
476
|
});
|
|
481
477
|
const allTypes = (schemaObj.EntityType || []).concat(schemaObj.ComplexType || []);
|
|
482
478
|
const typesWithBaseType = allTypes.filter((typeObj) => typeObj.attributes.BaseType);
|
|
483
|
-
allTypes
|
|
484
|
-
var _a, _b, _c;
|
|
479
|
+
allTypes?.forEach((typeObj) => {
|
|
485
480
|
const entityTypeName = buildName({ schemaNamespace, name: typeObj.attributes.Name });
|
|
486
481
|
const isOpenType = typeObj.attributes.OpenType === 'true';
|
|
487
482
|
const isAbstract = typeObj.attributes.Abstract === 'true';
|
|
@@ -509,8 +504,7 @@ class ODataHandler {
|
|
|
509
504
|
name: isAbstract ? entityTypeName : `I${entityTypeName}`,
|
|
510
505
|
extensions,
|
|
511
506
|
resolveType: (root) => {
|
|
512
|
-
|
|
513
|
-
const typeRef = (_a = root['@odata.type']) === null || _a === void 0 ? void 0 : _a.replace('#', '');
|
|
507
|
+
const typeRef = root['@odata.type']?.replace('#', '');
|
|
514
508
|
if (typeRef) {
|
|
515
509
|
const typeName = getTypeNameFromRef({
|
|
516
510
|
typeRef: root['@odata.type'].replace('#', ''),
|
|
@@ -528,13 +522,13 @@ class ODataHandler {
|
|
|
528
522
|
extensions,
|
|
529
523
|
interfaces: abstractType ? [abstractType] : [],
|
|
530
524
|
});
|
|
531
|
-
abstractType
|
|
525
|
+
abstractType?.setInputTypeComposer(inputType);
|
|
532
526
|
outputType.setInputTypeComposer(inputType);
|
|
533
527
|
const propertyRefObj = typeObj.Key && typeObj.Key[0].PropertyRef[0];
|
|
534
528
|
if (propertyRefObj) {
|
|
535
529
|
extensions.entityInfo.identifierFieldName = propertyRefObj.attributes.Name;
|
|
536
530
|
}
|
|
537
|
-
|
|
531
|
+
typeObj.Property?.forEach((propertyObj) => {
|
|
538
532
|
const propertyName = propertyObj.attributes.Name;
|
|
539
533
|
extensions.entityInfo.actualFields.push(propertyName);
|
|
540
534
|
const propertyTypeRef = propertyObj.attributes.Type;
|
|
@@ -560,14 +554,14 @@ class ODataHandler {
|
|
|
560
554
|
}),
|
|
561
555
|
extensions: { propertyObj },
|
|
562
556
|
};
|
|
563
|
-
abstractType
|
|
557
|
+
abstractType?.addFields({
|
|
564
558
|
[propertyName]: field,
|
|
565
559
|
});
|
|
566
560
|
outputType.addFields({
|
|
567
561
|
[propertyName]: field,
|
|
568
562
|
});
|
|
569
563
|
});
|
|
570
|
-
|
|
564
|
+
typeObj.NavigationProperty?.forEach((navigationPropertyObj) => {
|
|
571
565
|
const navigationPropertyName = navigationPropertyObj.attributes.Name;
|
|
572
566
|
extensions.entityInfo.navigationFields.push(navigationPropertyName);
|
|
573
567
|
const navigationPropertyTypeRef = navigationPropertyObj.attributes.Type;
|
|
@@ -600,7 +594,7 @@ class ODataHandler {
|
|
|
600
594
|
addIdentifierToUrl(url, entityInfo.identifierFieldName, entityInfo.identifierFieldTypeRef, args);
|
|
601
595
|
const parsedInfoFragment = (0, graphql_parse_resolve_info_1.parseResolveInfo)(info);
|
|
602
596
|
const searchParams = this.prepareSearchParams(parsedInfoFragment, info.schema);
|
|
603
|
-
searchParams
|
|
597
|
+
searchParams?.forEach((value, key) => {
|
|
604
598
|
url.searchParams.set(key, value);
|
|
605
599
|
});
|
|
606
600
|
const urlString = getUrlString(url);
|
|
@@ -639,7 +633,7 @@ class ODataHandler {
|
|
|
639
633
|
url.href = (0, url_join_1.default)(url.href, '/' + navigationPropertyName);
|
|
640
634
|
const parsedInfoFragment = (0, graphql_parse_resolve_info_1.parseResolveInfo)(info);
|
|
641
635
|
const searchParams = this.prepareSearchParams(parsedInfoFragment, info.schema);
|
|
642
|
-
searchParams
|
|
636
|
+
searchParams?.forEach((value, key) => {
|
|
643
637
|
url.searchParams.set(key, value);
|
|
644
638
|
});
|
|
645
639
|
const urlString = getUrlString(url);
|
|
@@ -659,7 +653,7 @@ class ODataHandler {
|
|
|
659
653
|
return handleResponseText(responseText, urlString, info);
|
|
660
654
|
},
|
|
661
655
|
};
|
|
662
|
-
abstractType
|
|
656
|
+
abstractType?.addFields({
|
|
663
657
|
[navigationPropertyName]: pluralField,
|
|
664
658
|
[`${navigationPropertyName}ById`]: singularField,
|
|
665
659
|
});
|
|
@@ -687,7 +681,7 @@ class ODataHandler {
|
|
|
687
681
|
url.href = (0, url_join_1.default)(url.href, '/' + navigationPropertyName);
|
|
688
682
|
const parsedInfoFragment = (0, graphql_parse_resolve_info_1.parseResolveInfo)(info);
|
|
689
683
|
const searchParams = this.prepareSearchParams(parsedInfoFragment, info.schema);
|
|
690
|
-
searchParams
|
|
684
|
+
searchParams?.forEach((value, key) => {
|
|
691
685
|
url.searchParams.set(key, value);
|
|
692
686
|
});
|
|
693
687
|
const urlString = getUrlString(url);
|
|
@@ -707,7 +701,7 @@ class ODataHandler {
|
|
|
707
701
|
return handleResponseText(responseText, urlString, info);
|
|
708
702
|
},
|
|
709
703
|
};
|
|
710
|
-
abstractType
|
|
704
|
+
abstractType?.addFields({
|
|
711
705
|
[navigationPropertyName]: field,
|
|
712
706
|
});
|
|
713
707
|
outputType.addFields({
|
|
@@ -722,7 +716,7 @@ class ODataHandler {
|
|
|
722
716
|
type: 'JSON',
|
|
723
717
|
},
|
|
724
718
|
});
|
|
725
|
-
abstractType
|
|
719
|
+
abstractType?.addFields({
|
|
726
720
|
rest: {
|
|
727
721
|
type: 'JSON',
|
|
728
722
|
resolve: (root) => root,
|
|
@@ -736,13 +730,13 @@ class ODataHandler {
|
|
|
736
730
|
});
|
|
737
731
|
}
|
|
738
732
|
const updateInputType = inputType.clone(`${entityTypeName}UpdateInput`);
|
|
739
|
-
|
|
740
|
-
.getFieldNames()
|
|
733
|
+
updateInputType
|
|
734
|
+
.getFieldNames()
|
|
735
|
+
?.forEach(fieldName => updateInputType.makeOptional(fieldName));
|
|
741
736
|
// Types might be considered as unused implementations of interfaces so we must prevent that
|
|
742
737
|
schemaComposer.addSchemaMustHaveType(outputType);
|
|
743
738
|
});
|
|
744
739
|
const handleUnboundFunctionObj = (unboundFunctionObj) => {
|
|
745
|
-
var _a;
|
|
746
740
|
const functionName = unboundFunctionObj.attributes.Name;
|
|
747
741
|
const returnTypeRef = unboundFunctionObj.ReturnType[0].attributes.Type;
|
|
748
742
|
const returnType = getTypeNameFromRef({
|
|
@@ -765,7 +759,7 @@ class ODataHandler {
|
|
|
765
759
|
.join(', ')})`;
|
|
766
760
|
const parsedInfoFragment = (0, graphql_parse_resolve_info_1.parseResolveInfo)(info);
|
|
767
761
|
const searchParams = this.prepareSearchParams(parsedInfoFragment, info.schema);
|
|
768
|
-
searchParams
|
|
762
|
+
searchParams?.forEach((value, key) => {
|
|
769
763
|
url.searchParams.set(key, value);
|
|
770
764
|
});
|
|
771
765
|
const urlString = getUrlString(url);
|
|
@@ -786,7 +780,7 @@ class ODataHandler {
|
|
|
786
780
|
},
|
|
787
781
|
},
|
|
788
782
|
});
|
|
789
|
-
|
|
783
|
+
unboundFunctionObj.Parameter?.forEach((parameterObj) => {
|
|
790
784
|
const parameterName = parameterObj.attributes.Name;
|
|
791
785
|
const parameterTypeRef = parameterObj.attributes.Type;
|
|
792
786
|
const isRequired = parameterObj.attributes.Nullable === 'false';
|
|
@@ -803,7 +797,6 @@ class ODataHandler {
|
|
|
803
797
|
});
|
|
804
798
|
};
|
|
805
799
|
const handleBoundFunctionObj = (boundFunctionObj) => {
|
|
806
|
-
var _a, _b;
|
|
807
800
|
const functionName = boundFunctionObj.attributes.Name;
|
|
808
801
|
const functionRef = schemaNamespace + '.' + functionName;
|
|
809
802
|
const returnTypeRef = boundFunctionObj.ReturnType[0].attributes.Type;
|
|
@@ -816,10 +809,10 @@ class ODataHandler {
|
|
|
816
809
|
...commonArgs,
|
|
817
810
|
};
|
|
818
811
|
// eslint-disable-next-line prefer-const
|
|
819
|
-
let entitySetPath =
|
|
812
|
+
let entitySetPath = boundFunctionObj.attributes.EntitySetPath?.split('/')[0];
|
|
820
813
|
let field;
|
|
821
814
|
let boundEntityTypeName;
|
|
822
|
-
|
|
815
|
+
boundFunctionObj.Parameter?.forEach((parameterObj) => {
|
|
823
816
|
const parameterName = parameterObj.attributes.Name;
|
|
824
817
|
const parameterTypeRef = parameterObj.attributes.Type;
|
|
825
818
|
const isRequired = parameterObj.attributes.Nullable === 'false';
|
|
@@ -859,7 +852,7 @@ class ODataHandler {
|
|
|
859
852
|
}
|
|
860
853
|
const parsedInfoFragment = (0, graphql_parse_resolve_info_1.parseResolveInfo)(info);
|
|
861
854
|
const searchParams = this.prepareSearchParams(parsedInfoFragment, info.schema);
|
|
862
|
-
searchParams
|
|
855
|
+
searchParams?.forEach((value, key) => {
|
|
863
856
|
url.searchParams.set(key, value);
|
|
864
857
|
});
|
|
865
858
|
const urlString = getUrlString(url);
|
|
@@ -889,13 +882,12 @@ class ODataHandler {
|
|
|
889
882
|
boundEntityType.addFields({
|
|
890
883
|
[functionName]: field,
|
|
891
884
|
});
|
|
892
|
-
boundEntityOtherType
|
|
885
|
+
boundEntityOtherType?.addFields({
|
|
893
886
|
[functionName]: field,
|
|
894
887
|
});
|
|
895
888
|
};
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
if (((_a = functionObj.attributes) === null || _a === void 0 ? void 0 : _a.IsBound) === 'true') {
|
|
889
|
+
schemaObj.Function?.forEach((functionObj) => {
|
|
890
|
+
if (functionObj.attributes?.IsBound === 'true') {
|
|
899
891
|
handleBoundFunctionObj(functionObj);
|
|
900
892
|
}
|
|
901
893
|
else {
|
|
@@ -903,7 +895,6 @@ class ODataHandler {
|
|
|
903
895
|
}
|
|
904
896
|
});
|
|
905
897
|
const handleUnboundActionObj = (unboundActionObj) => {
|
|
906
|
-
var _a;
|
|
907
898
|
const actionName = unboundActionObj.attributes.Name;
|
|
908
899
|
schemaComposer.Mutation.addFields({
|
|
909
900
|
[actionName]: {
|
|
@@ -933,7 +924,7 @@ class ODataHandler {
|
|
|
933
924
|
},
|
|
934
925
|
},
|
|
935
926
|
});
|
|
936
|
-
|
|
927
|
+
unboundActionObj.Parameter?.forEach((parameterObj) => {
|
|
937
928
|
const parameterName = parameterObj.attributes.Name;
|
|
938
929
|
const parameterTypeRef = parameterObj.attributes.Type;
|
|
939
930
|
const isRequired = parameterObj.attributes.Nullable === 'false';
|
|
@@ -950,7 +941,6 @@ class ODataHandler {
|
|
|
950
941
|
});
|
|
951
942
|
};
|
|
952
943
|
const handleBoundActionObj = (boundActionObj) => {
|
|
953
|
-
var _a;
|
|
954
944
|
const actionName = boundActionObj.attributes.Name;
|
|
955
945
|
const actionRef = schemaNamespace + '.' + actionName;
|
|
956
946
|
const args = {
|
|
@@ -959,7 +949,7 @@ class ODataHandler {
|
|
|
959
949
|
let entitySetPath = boundActionObj.attributes.EntitySetPath;
|
|
960
950
|
let boundField;
|
|
961
951
|
let boundEntityTypeName;
|
|
962
|
-
|
|
952
|
+
boundActionObj.Parameter?.forEach((parameterObj) => {
|
|
963
953
|
const parameterName = parameterObj.attributes.Name;
|
|
964
954
|
const parameterTypeRef = parameterObj.attributes.Type;
|
|
965
955
|
const isRequired = parameterObj.attributes.Nullable === 'false';
|
|
@@ -1012,13 +1002,12 @@ class ODataHandler {
|
|
|
1012
1002
|
[actionName]: boundField,
|
|
1013
1003
|
});
|
|
1014
1004
|
const otherType = getTCByTypeNames(`I${boundEntityTypeName}`, `T${boundEntityTypeName}`);
|
|
1015
|
-
otherType
|
|
1005
|
+
otherType?.addFields({
|
|
1016
1006
|
[actionName]: boundField,
|
|
1017
1007
|
});
|
|
1018
1008
|
};
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
if (((_a = actionObj.attributes) === null || _a === void 0 ? void 0 : _a.IsBound) === 'true') {
|
|
1009
|
+
schemaObj.Action?.forEach((actionObj) => {
|
|
1010
|
+
if (actionObj.attributes?.IsBound === 'true') {
|
|
1022
1011
|
handleBoundActionObj(actionObj);
|
|
1023
1012
|
}
|
|
1024
1013
|
else {
|
|
@@ -1026,7 +1015,7 @@ class ODataHandler {
|
|
|
1026
1015
|
}
|
|
1027
1016
|
});
|
|
1028
1017
|
// Rearrange fields for base types and implementations
|
|
1029
|
-
typesWithBaseType
|
|
1018
|
+
typesWithBaseType?.forEach((typeObj) => {
|
|
1030
1019
|
const typeName = buildName({
|
|
1031
1020
|
schemaNamespace,
|
|
1032
1021
|
name: typeObj.attributes.Name,
|
|
@@ -1052,7 +1041,7 @@ class ODataHandler {
|
|
|
1052
1041
|
entityInfo.identifierFieldTypeRef =
|
|
1053
1042
|
baseEntityInfo.identifierFieldTypeRef || entityInfo.identifierFieldTypeRef;
|
|
1054
1043
|
entityInfo.actualFields.unshift(...baseEntityInfo.actualFields);
|
|
1055
|
-
abstractType
|
|
1044
|
+
abstractType?.addFields(baseAbstractType?.getFields());
|
|
1056
1045
|
outputType.addFields(baseOutputType.getFields());
|
|
1057
1046
|
if (baseAbstractType instanceof graphql_compose_1.InterfaceTypeComposer) {
|
|
1058
1047
|
// abstractType.addInterface(baseAbstractType.getTypeName());
|
|
@@ -1064,11 +1053,9 @@ class ODataHandler {
|
|
|
1064
1053
|
baseEventEmitterListener();
|
|
1065
1054
|
});
|
|
1066
1055
|
});
|
|
1067
|
-
schemas
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
var _a, _b;
|
|
1071
|
-
(_a = entityContainerObj.Singleton) === null || _a === void 0 ? void 0 : _a.forEach((singletonObj) => {
|
|
1056
|
+
schemas?.forEach((schemaObj) => {
|
|
1057
|
+
schemaObj.EntityContainer?.forEach((entityContainerObj) => {
|
|
1058
|
+
entityContainerObj.Singleton?.forEach((singletonObj) => {
|
|
1072
1059
|
const singletonName = singletonObj.attributes.Name;
|
|
1073
1060
|
const singletonTypeRef = singletonObj.attributes.Type;
|
|
1074
1061
|
const singletonTypeName = getTypeNameFromRef({
|
|
@@ -1087,7 +1074,7 @@ class ODataHandler {
|
|
|
1087
1074
|
url.href = (0, url_join_1.default)(url.href, '/' + singletonName);
|
|
1088
1075
|
const parsedInfoFragment = (0, graphql_parse_resolve_info_1.parseResolveInfo)(info);
|
|
1089
1076
|
const searchParams = this.prepareSearchParams(parsedInfoFragment, info.schema);
|
|
1090
|
-
searchParams
|
|
1077
|
+
searchParams?.forEach((value, key) => {
|
|
1091
1078
|
url.searchParams.set(key, value);
|
|
1092
1079
|
});
|
|
1093
1080
|
const urlString = getUrlString(url);
|
|
@@ -1109,7 +1096,7 @@ class ODataHandler {
|
|
|
1109
1096
|
},
|
|
1110
1097
|
});
|
|
1111
1098
|
});
|
|
1112
|
-
|
|
1099
|
+
entityContainerObj?.EntitySet?.forEach((entitySetObj) => {
|
|
1113
1100
|
const entitySetName = entitySetObj.attributes.Name;
|
|
1114
1101
|
const entitySetTypeRef = entitySetObj.attributes.EntityType;
|
|
1115
1102
|
const entityTypeName = getTypeNameFromRef({
|
|
@@ -1135,7 +1122,7 @@ class ODataHandler {
|
|
|
1135
1122
|
url.href = (0, url_join_1.default)(url.href, '/' + entitySetName);
|
|
1136
1123
|
const parsedInfoFragment = (0, graphql_parse_resolve_info_1.parseResolveInfo)(info);
|
|
1137
1124
|
const searchParams = this.prepareSearchParams(parsedInfoFragment, info.schema);
|
|
1138
|
-
searchParams
|
|
1125
|
+
searchParams?.forEach((value, key) => {
|
|
1139
1126
|
url.searchParams.set(key, value);
|
|
1140
1127
|
});
|
|
1141
1128
|
const urlString = getUrlString(url);
|
|
@@ -1169,7 +1156,7 @@ class ODataHandler {
|
|
|
1169
1156
|
addIdentifierToUrl(url, identifierFieldName, identifierFieldTypeRef, args);
|
|
1170
1157
|
const parsedInfoFragment = (0, graphql_parse_resolve_info_1.parseResolveInfo)(info);
|
|
1171
1158
|
const searchParams = this.prepareSearchParams(parsedInfoFragment, info.schema);
|
|
1172
|
-
searchParams
|
|
1159
|
+
searchParams?.forEach((value, key) => {
|
|
1173
1160
|
url.searchParams.set(key, value);
|
|
1174
1161
|
});
|
|
1175
1162
|
const urlString = getUrlString(url);
|
package/esm/index.js
CHANGED
|
@@ -120,7 +120,7 @@ export default class ODataHandler {
|
|
|
120
120
|
const contextDataloaderName = Symbol(`${this.name}DataLoader`);
|
|
121
121
|
function getNamespaceFromTypeRef(typeRef) {
|
|
122
122
|
let namespace = '';
|
|
123
|
-
namespaces
|
|
123
|
+
namespaces?.forEach(el => {
|
|
124
124
|
if (typeRef.startsWith(el) &&
|
|
125
125
|
el.length > namespace.length && // It can be deeper namespace
|
|
126
126
|
!typeRef.replace(el + '.', '').includes('.') // Typename cannot have `.`
|
|
@@ -193,7 +193,7 @@ export default class ODataHandler {
|
|
|
193
193
|
}
|
|
194
194
|
const returnList = responseJson.value;
|
|
195
195
|
return returnList.map(element => {
|
|
196
|
-
if (!
|
|
196
|
+
if (!entityTypeExtensions?.entityInfo) {
|
|
197
197
|
return element;
|
|
198
198
|
}
|
|
199
199
|
const urlOfElement = new URL(urlStringWithoutSearchParams);
|
|
@@ -232,13 +232,13 @@ export default class ODataHandler {
|
|
|
232
232
|
else {
|
|
233
233
|
const actualReturnType = info.returnType;
|
|
234
234
|
const entityTypeExtensions = actualReturnType.extensions;
|
|
235
|
-
if (!
|
|
235
|
+
if (!entityTypeExtensions?.entityInfo) {
|
|
236
236
|
return responseJson;
|
|
237
237
|
}
|
|
238
238
|
const identifierUrl = responseJson['@odata.id'] || urlStringWithoutSearchParams;
|
|
239
239
|
const fieldMap = actualReturnType.getFields();
|
|
240
240
|
for (const fieldName in responseJson) {
|
|
241
|
-
if (entityTypeExtensions
|
|
241
|
+
if (entityTypeExtensions?.entityInfo.navigationFields.includes(fieldName)) {
|
|
242
242
|
const field = responseJson[fieldName];
|
|
243
243
|
let fieldType = fieldMap[fieldName].type;
|
|
244
244
|
if ('ofType' in fieldType) {
|
|
@@ -303,7 +303,7 @@ export default class ODataHandler {
|
|
|
303
303
|
try {
|
|
304
304
|
return schemaComposer.getAnyTC(typeName);
|
|
305
305
|
}
|
|
306
|
-
catch
|
|
306
|
+
catch { }
|
|
307
307
|
}
|
|
308
308
|
return null;
|
|
309
309
|
}
|
|
@@ -348,7 +348,6 @@ export default class ODataHandler {
|
|
|
348
348
|
}
|
|
349
349
|
const DATALOADER_FACTORIES = {
|
|
350
350
|
multipart: (context) => new DataLoader(async (requests) => {
|
|
351
|
-
var _a;
|
|
352
351
|
let requestBody = '';
|
|
353
352
|
const requestBoundary = 'batch_' + Date.now();
|
|
354
353
|
for (const requestIndex in requests) {
|
|
@@ -358,7 +357,7 @@ export default class ODataHandler {
|
|
|
358
357
|
requestBody += `Content-Transfer-Encoding:binary\n`;
|
|
359
358
|
requestBody += `Content-ID: ${requestIndex}\n\n`;
|
|
360
359
|
requestBody += `${request.method} ${request.url} HTTP/1.1\n`;
|
|
361
|
-
|
|
360
|
+
request.headers?.forEach((value, key) => {
|
|
362
361
|
requestBody += `${key}: ${value}\n`;
|
|
363
362
|
});
|
|
364
363
|
if (request.body) {
|
|
@@ -409,12 +408,11 @@ export default class ODataHandler {
|
|
|
409
408
|
method: 'POST',
|
|
410
409
|
body: JSON.stringify({
|
|
411
410
|
requests: await Promise.all(requests.map(async (request, index) => {
|
|
412
|
-
var _a;
|
|
413
411
|
const id = index.toString();
|
|
414
412
|
const url = request.url.replace(endpoint, '');
|
|
415
413
|
const method = request.method;
|
|
416
414
|
const headers = {};
|
|
417
|
-
|
|
415
|
+
request.headers?.forEach((value, key) => {
|
|
418
416
|
headers[key] = value;
|
|
419
417
|
});
|
|
420
418
|
return {
|
|
@@ -445,7 +443,7 @@ export default class ODataHandler {
|
|
|
445
443
|
const ref = alias + '.' + name;
|
|
446
444
|
return multipleSchemas ? pascalCase(ref.split('.').join('_')) : name;
|
|
447
445
|
}
|
|
448
|
-
schemas
|
|
446
|
+
schemas?.forEach((schemaObj) => {
|
|
449
447
|
const schemaNamespace = schemaObj.attributes.Namespace;
|
|
450
448
|
namespaces.add(schemaNamespace);
|
|
451
449
|
const schemaAlias = schemaObj.attributes.Alias;
|
|
@@ -453,13 +451,11 @@ export default class ODataHandler {
|
|
|
453
451
|
aliasNamespaceMap.set(schemaNamespace, schemaAlias);
|
|
454
452
|
}
|
|
455
453
|
});
|
|
456
|
-
schemas
|
|
457
|
-
var _a, _b, _c;
|
|
454
|
+
schemas?.forEach((schemaObj) => {
|
|
458
455
|
const schemaNamespace = schemaObj.attributes.Namespace;
|
|
459
|
-
|
|
460
|
-
var _a;
|
|
456
|
+
schemaObj.EnumType?.forEach((enumObj) => {
|
|
461
457
|
const values = {};
|
|
462
|
-
|
|
458
|
+
enumObj.Member?.forEach((memberObj) => {
|
|
463
459
|
const key = memberObj.attributes.Name;
|
|
464
460
|
// This doesn't work.
|
|
465
461
|
// const value = memberElement.getAttribute('Value')!;
|
|
@@ -477,8 +473,7 @@ export default class ODataHandler {
|
|
|
477
473
|
});
|
|
478
474
|
const allTypes = (schemaObj.EntityType || []).concat(schemaObj.ComplexType || []);
|
|
479
475
|
const typesWithBaseType = allTypes.filter((typeObj) => typeObj.attributes.BaseType);
|
|
480
|
-
allTypes
|
|
481
|
-
var _a, _b, _c;
|
|
476
|
+
allTypes?.forEach((typeObj) => {
|
|
482
477
|
const entityTypeName = buildName({ schemaNamespace, name: typeObj.attributes.Name });
|
|
483
478
|
const isOpenType = typeObj.attributes.OpenType === 'true';
|
|
484
479
|
const isAbstract = typeObj.attributes.Abstract === 'true';
|
|
@@ -506,8 +501,7 @@ export default class ODataHandler {
|
|
|
506
501
|
name: isAbstract ? entityTypeName : `I${entityTypeName}`,
|
|
507
502
|
extensions,
|
|
508
503
|
resolveType: (root) => {
|
|
509
|
-
|
|
510
|
-
const typeRef = (_a = root['@odata.type']) === null || _a === void 0 ? void 0 : _a.replace('#', '');
|
|
504
|
+
const typeRef = root['@odata.type']?.replace('#', '');
|
|
511
505
|
if (typeRef) {
|
|
512
506
|
const typeName = getTypeNameFromRef({
|
|
513
507
|
typeRef: root['@odata.type'].replace('#', ''),
|
|
@@ -525,13 +519,13 @@ export default class ODataHandler {
|
|
|
525
519
|
extensions,
|
|
526
520
|
interfaces: abstractType ? [abstractType] : [],
|
|
527
521
|
});
|
|
528
|
-
abstractType
|
|
522
|
+
abstractType?.setInputTypeComposer(inputType);
|
|
529
523
|
outputType.setInputTypeComposer(inputType);
|
|
530
524
|
const propertyRefObj = typeObj.Key && typeObj.Key[0].PropertyRef[0];
|
|
531
525
|
if (propertyRefObj) {
|
|
532
526
|
extensions.entityInfo.identifierFieldName = propertyRefObj.attributes.Name;
|
|
533
527
|
}
|
|
534
|
-
|
|
528
|
+
typeObj.Property?.forEach((propertyObj) => {
|
|
535
529
|
const propertyName = propertyObj.attributes.Name;
|
|
536
530
|
extensions.entityInfo.actualFields.push(propertyName);
|
|
537
531
|
const propertyTypeRef = propertyObj.attributes.Type;
|
|
@@ -557,14 +551,14 @@ export default class ODataHandler {
|
|
|
557
551
|
}),
|
|
558
552
|
extensions: { propertyObj },
|
|
559
553
|
};
|
|
560
|
-
abstractType
|
|
554
|
+
abstractType?.addFields({
|
|
561
555
|
[propertyName]: field,
|
|
562
556
|
});
|
|
563
557
|
outputType.addFields({
|
|
564
558
|
[propertyName]: field,
|
|
565
559
|
});
|
|
566
560
|
});
|
|
567
|
-
|
|
561
|
+
typeObj.NavigationProperty?.forEach((navigationPropertyObj) => {
|
|
568
562
|
const navigationPropertyName = navigationPropertyObj.attributes.Name;
|
|
569
563
|
extensions.entityInfo.navigationFields.push(navigationPropertyName);
|
|
570
564
|
const navigationPropertyTypeRef = navigationPropertyObj.attributes.Type;
|
|
@@ -597,7 +591,7 @@ export default class ODataHandler {
|
|
|
597
591
|
addIdentifierToUrl(url, entityInfo.identifierFieldName, entityInfo.identifierFieldTypeRef, args);
|
|
598
592
|
const parsedInfoFragment = parseResolveInfo(info);
|
|
599
593
|
const searchParams = this.prepareSearchParams(parsedInfoFragment, info.schema);
|
|
600
|
-
searchParams
|
|
594
|
+
searchParams?.forEach((value, key) => {
|
|
601
595
|
url.searchParams.set(key, value);
|
|
602
596
|
});
|
|
603
597
|
const urlString = getUrlString(url);
|
|
@@ -636,7 +630,7 @@ export default class ODataHandler {
|
|
|
636
630
|
url.href = urljoin(url.href, '/' + navigationPropertyName);
|
|
637
631
|
const parsedInfoFragment = parseResolveInfo(info);
|
|
638
632
|
const searchParams = this.prepareSearchParams(parsedInfoFragment, info.schema);
|
|
639
|
-
searchParams
|
|
633
|
+
searchParams?.forEach((value, key) => {
|
|
640
634
|
url.searchParams.set(key, value);
|
|
641
635
|
});
|
|
642
636
|
const urlString = getUrlString(url);
|
|
@@ -656,7 +650,7 @@ export default class ODataHandler {
|
|
|
656
650
|
return handleResponseText(responseText, urlString, info);
|
|
657
651
|
},
|
|
658
652
|
};
|
|
659
|
-
abstractType
|
|
653
|
+
abstractType?.addFields({
|
|
660
654
|
[navigationPropertyName]: pluralField,
|
|
661
655
|
[`${navigationPropertyName}ById`]: singularField,
|
|
662
656
|
});
|
|
@@ -684,7 +678,7 @@ export default class ODataHandler {
|
|
|
684
678
|
url.href = urljoin(url.href, '/' + navigationPropertyName);
|
|
685
679
|
const parsedInfoFragment = parseResolveInfo(info);
|
|
686
680
|
const searchParams = this.prepareSearchParams(parsedInfoFragment, info.schema);
|
|
687
|
-
searchParams
|
|
681
|
+
searchParams?.forEach((value, key) => {
|
|
688
682
|
url.searchParams.set(key, value);
|
|
689
683
|
});
|
|
690
684
|
const urlString = getUrlString(url);
|
|
@@ -704,7 +698,7 @@ export default class ODataHandler {
|
|
|
704
698
|
return handleResponseText(responseText, urlString, info);
|
|
705
699
|
},
|
|
706
700
|
};
|
|
707
|
-
abstractType
|
|
701
|
+
abstractType?.addFields({
|
|
708
702
|
[navigationPropertyName]: field,
|
|
709
703
|
});
|
|
710
704
|
outputType.addFields({
|
|
@@ -719,7 +713,7 @@ export default class ODataHandler {
|
|
|
719
713
|
type: 'JSON',
|
|
720
714
|
},
|
|
721
715
|
});
|
|
722
|
-
abstractType
|
|
716
|
+
abstractType?.addFields({
|
|
723
717
|
rest: {
|
|
724
718
|
type: 'JSON',
|
|
725
719
|
resolve: (root) => root,
|
|
@@ -733,13 +727,13 @@ export default class ODataHandler {
|
|
|
733
727
|
});
|
|
734
728
|
}
|
|
735
729
|
const updateInputType = inputType.clone(`${entityTypeName}UpdateInput`);
|
|
736
|
-
|
|
737
|
-
.getFieldNames()
|
|
730
|
+
updateInputType
|
|
731
|
+
.getFieldNames()
|
|
732
|
+
?.forEach(fieldName => updateInputType.makeOptional(fieldName));
|
|
738
733
|
// Types might be considered as unused implementations of interfaces so we must prevent that
|
|
739
734
|
schemaComposer.addSchemaMustHaveType(outputType);
|
|
740
735
|
});
|
|
741
736
|
const handleUnboundFunctionObj = (unboundFunctionObj) => {
|
|
742
|
-
var _a;
|
|
743
737
|
const functionName = unboundFunctionObj.attributes.Name;
|
|
744
738
|
const returnTypeRef = unboundFunctionObj.ReturnType[0].attributes.Type;
|
|
745
739
|
const returnType = getTypeNameFromRef({
|
|
@@ -762,7 +756,7 @@ export default class ODataHandler {
|
|
|
762
756
|
.join(', ')})`;
|
|
763
757
|
const parsedInfoFragment = parseResolveInfo(info);
|
|
764
758
|
const searchParams = this.prepareSearchParams(parsedInfoFragment, info.schema);
|
|
765
|
-
searchParams
|
|
759
|
+
searchParams?.forEach((value, key) => {
|
|
766
760
|
url.searchParams.set(key, value);
|
|
767
761
|
});
|
|
768
762
|
const urlString = getUrlString(url);
|
|
@@ -783,7 +777,7 @@ export default class ODataHandler {
|
|
|
783
777
|
},
|
|
784
778
|
},
|
|
785
779
|
});
|
|
786
|
-
|
|
780
|
+
unboundFunctionObj.Parameter?.forEach((parameterObj) => {
|
|
787
781
|
const parameterName = parameterObj.attributes.Name;
|
|
788
782
|
const parameterTypeRef = parameterObj.attributes.Type;
|
|
789
783
|
const isRequired = parameterObj.attributes.Nullable === 'false';
|
|
@@ -800,7 +794,6 @@ export default class ODataHandler {
|
|
|
800
794
|
});
|
|
801
795
|
};
|
|
802
796
|
const handleBoundFunctionObj = (boundFunctionObj) => {
|
|
803
|
-
var _a, _b;
|
|
804
797
|
const functionName = boundFunctionObj.attributes.Name;
|
|
805
798
|
const functionRef = schemaNamespace + '.' + functionName;
|
|
806
799
|
const returnTypeRef = boundFunctionObj.ReturnType[0].attributes.Type;
|
|
@@ -813,10 +806,10 @@ export default class ODataHandler {
|
|
|
813
806
|
...commonArgs,
|
|
814
807
|
};
|
|
815
808
|
// eslint-disable-next-line prefer-const
|
|
816
|
-
let entitySetPath =
|
|
809
|
+
let entitySetPath = boundFunctionObj.attributes.EntitySetPath?.split('/')[0];
|
|
817
810
|
let field;
|
|
818
811
|
let boundEntityTypeName;
|
|
819
|
-
|
|
812
|
+
boundFunctionObj.Parameter?.forEach((parameterObj) => {
|
|
820
813
|
const parameterName = parameterObj.attributes.Name;
|
|
821
814
|
const parameterTypeRef = parameterObj.attributes.Type;
|
|
822
815
|
const isRequired = parameterObj.attributes.Nullable === 'false';
|
|
@@ -856,7 +849,7 @@ export default class ODataHandler {
|
|
|
856
849
|
}
|
|
857
850
|
const parsedInfoFragment = parseResolveInfo(info);
|
|
858
851
|
const searchParams = this.prepareSearchParams(parsedInfoFragment, info.schema);
|
|
859
|
-
searchParams
|
|
852
|
+
searchParams?.forEach((value, key) => {
|
|
860
853
|
url.searchParams.set(key, value);
|
|
861
854
|
});
|
|
862
855
|
const urlString = getUrlString(url);
|
|
@@ -886,13 +879,12 @@ export default class ODataHandler {
|
|
|
886
879
|
boundEntityType.addFields({
|
|
887
880
|
[functionName]: field,
|
|
888
881
|
});
|
|
889
|
-
boundEntityOtherType
|
|
882
|
+
boundEntityOtherType?.addFields({
|
|
890
883
|
[functionName]: field,
|
|
891
884
|
});
|
|
892
885
|
};
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
if (((_a = functionObj.attributes) === null || _a === void 0 ? void 0 : _a.IsBound) === 'true') {
|
|
886
|
+
schemaObj.Function?.forEach((functionObj) => {
|
|
887
|
+
if (functionObj.attributes?.IsBound === 'true') {
|
|
896
888
|
handleBoundFunctionObj(functionObj);
|
|
897
889
|
}
|
|
898
890
|
else {
|
|
@@ -900,7 +892,6 @@ export default class ODataHandler {
|
|
|
900
892
|
}
|
|
901
893
|
});
|
|
902
894
|
const handleUnboundActionObj = (unboundActionObj) => {
|
|
903
|
-
var _a;
|
|
904
895
|
const actionName = unboundActionObj.attributes.Name;
|
|
905
896
|
schemaComposer.Mutation.addFields({
|
|
906
897
|
[actionName]: {
|
|
@@ -930,7 +921,7 @@ export default class ODataHandler {
|
|
|
930
921
|
},
|
|
931
922
|
},
|
|
932
923
|
});
|
|
933
|
-
|
|
924
|
+
unboundActionObj.Parameter?.forEach((parameterObj) => {
|
|
934
925
|
const parameterName = parameterObj.attributes.Name;
|
|
935
926
|
const parameterTypeRef = parameterObj.attributes.Type;
|
|
936
927
|
const isRequired = parameterObj.attributes.Nullable === 'false';
|
|
@@ -947,7 +938,6 @@ export default class ODataHandler {
|
|
|
947
938
|
});
|
|
948
939
|
};
|
|
949
940
|
const handleBoundActionObj = (boundActionObj) => {
|
|
950
|
-
var _a;
|
|
951
941
|
const actionName = boundActionObj.attributes.Name;
|
|
952
942
|
const actionRef = schemaNamespace + '.' + actionName;
|
|
953
943
|
const args = {
|
|
@@ -956,7 +946,7 @@ export default class ODataHandler {
|
|
|
956
946
|
let entitySetPath = boundActionObj.attributes.EntitySetPath;
|
|
957
947
|
let boundField;
|
|
958
948
|
let boundEntityTypeName;
|
|
959
|
-
|
|
949
|
+
boundActionObj.Parameter?.forEach((parameterObj) => {
|
|
960
950
|
const parameterName = parameterObj.attributes.Name;
|
|
961
951
|
const parameterTypeRef = parameterObj.attributes.Type;
|
|
962
952
|
const isRequired = parameterObj.attributes.Nullable === 'false';
|
|
@@ -1009,13 +999,12 @@ export default class ODataHandler {
|
|
|
1009
999
|
[actionName]: boundField,
|
|
1010
1000
|
});
|
|
1011
1001
|
const otherType = getTCByTypeNames(`I${boundEntityTypeName}`, `T${boundEntityTypeName}`);
|
|
1012
|
-
otherType
|
|
1002
|
+
otherType?.addFields({
|
|
1013
1003
|
[actionName]: boundField,
|
|
1014
1004
|
});
|
|
1015
1005
|
};
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
if (((_a = actionObj.attributes) === null || _a === void 0 ? void 0 : _a.IsBound) === 'true') {
|
|
1006
|
+
schemaObj.Action?.forEach((actionObj) => {
|
|
1007
|
+
if (actionObj.attributes?.IsBound === 'true') {
|
|
1019
1008
|
handleBoundActionObj(actionObj);
|
|
1020
1009
|
}
|
|
1021
1010
|
else {
|
|
@@ -1023,7 +1012,7 @@ export default class ODataHandler {
|
|
|
1023
1012
|
}
|
|
1024
1013
|
});
|
|
1025
1014
|
// Rearrange fields for base types and implementations
|
|
1026
|
-
typesWithBaseType
|
|
1015
|
+
typesWithBaseType?.forEach((typeObj) => {
|
|
1027
1016
|
const typeName = buildName({
|
|
1028
1017
|
schemaNamespace,
|
|
1029
1018
|
name: typeObj.attributes.Name,
|
|
@@ -1049,7 +1038,7 @@ export default class ODataHandler {
|
|
|
1049
1038
|
entityInfo.identifierFieldTypeRef =
|
|
1050
1039
|
baseEntityInfo.identifierFieldTypeRef || entityInfo.identifierFieldTypeRef;
|
|
1051
1040
|
entityInfo.actualFields.unshift(...baseEntityInfo.actualFields);
|
|
1052
|
-
abstractType
|
|
1041
|
+
abstractType?.addFields(baseAbstractType?.getFields());
|
|
1053
1042
|
outputType.addFields(baseOutputType.getFields());
|
|
1054
1043
|
if (baseAbstractType instanceof InterfaceTypeComposer) {
|
|
1055
1044
|
// abstractType.addInterface(baseAbstractType.getTypeName());
|
|
@@ -1061,11 +1050,9 @@ export default class ODataHandler {
|
|
|
1061
1050
|
baseEventEmitterListener();
|
|
1062
1051
|
});
|
|
1063
1052
|
});
|
|
1064
|
-
schemas
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
var _a, _b;
|
|
1068
|
-
(_a = entityContainerObj.Singleton) === null || _a === void 0 ? void 0 : _a.forEach((singletonObj) => {
|
|
1053
|
+
schemas?.forEach((schemaObj) => {
|
|
1054
|
+
schemaObj.EntityContainer?.forEach((entityContainerObj) => {
|
|
1055
|
+
entityContainerObj.Singleton?.forEach((singletonObj) => {
|
|
1069
1056
|
const singletonName = singletonObj.attributes.Name;
|
|
1070
1057
|
const singletonTypeRef = singletonObj.attributes.Type;
|
|
1071
1058
|
const singletonTypeName = getTypeNameFromRef({
|
|
@@ -1084,7 +1071,7 @@ export default class ODataHandler {
|
|
|
1084
1071
|
url.href = urljoin(url.href, '/' + singletonName);
|
|
1085
1072
|
const parsedInfoFragment = parseResolveInfo(info);
|
|
1086
1073
|
const searchParams = this.prepareSearchParams(parsedInfoFragment, info.schema);
|
|
1087
|
-
searchParams
|
|
1074
|
+
searchParams?.forEach((value, key) => {
|
|
1088
1075
|
url.searchParams.set(key, value);
|
|
1089
1076
|
});
|
|
1090
1077
|
const urlString = getUrlString(url);
|
|
@@ -1106,7 +1093,7 @@ export default class ODataHandler {
|
|
|
1106
1093
|
},
|
|
1107
1094
|
});
|
|
1108
1095
|
});
|
|
1109
|
-
|
|
1096
|
+
entityContainerObj?.EntitySet?.forEach((entitySetObj) => {
|
|
1110
1097
|
const entitySetName = entitySetObj.attributes.Name;
|
|
1111
1098
|
const entitySetTypeRef = entitySetObj.attributes.EntityType;
|
|
1112
1099
|
const entityTypeName = getTypeNameFromRef({
|
|
@@ -1132,7 +1119,7 @@ export default class ODataHandler {
|
|
|
1132
1119
|
url.href = urljoin(url.href, '/' + entitySetName);
|
|
1133
1120
|
const parsedInfoFragment = parseResolveInfo(info);
|
|
1134
1121
|
const searchParams = this.prepareSearchParams(parsedInfoFragment, info.schema);
|
|
1135
|
-
searchParams
|
|
1122
|
+
searchParams?.forEach((value, key) => {
|
|
1136
1123
|
url.searchParams.set(key, value);
|
|
1137
1124
|
});
|
|
1138
1125
|
const urlString = getUrlString(url);
|
|
@@ -1166,7 +1153,7 @@ export default class ODataHandler {
|
|
|
1166
1153
|
addIdentifierToUrl(url, identifierFieldName, identifierFieldTypeRef, args);
|
|
1167
1154
|
const parsedInfoFragment = parseResolveInfo(info);
|
|
1168
1155
|
const searchParams = this.prepareSearchParams(parsedInfoFragment, info.schema);
|
|
1169
|
-
searchParams
|
|
1156
|
+
searchParams?.forEach((value, key) => {
|
|
1170
1157
|
url.searchParams.set(key, value);
|
|
1171
1158
|
});
|
|
1172
1159
|
const urlString = getUrlString(url);
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-mesh/odata",
|
|
3
|
-
"version": "1.0.0-alpha-
|
|
3
|
+
"version": "1.0.0-alpha-20230523154841-376b13623",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@graphql-mesh/cross-helpers": "0.4.0-alpha-
|
|
7
|
-
"@graphql-mesh/store": "1.0.0-alpha-
|
|
8
|
-
"@graphql-mesh/types": "1.0.0-alpha-
|
|
9
|
-
"@graphql-mesh/utils": "1.0.0-alpha-
|
|
6
|
+
"@graphql-mesh/cross-helpers": "0.4.0-alpha-20230523154841-376b13623",
|
|
7
|
+
"@graphql-mesh/store": "1.0.0-alpha-20230523154841-376b13623",
|
|
8
|
+
"@graphql-mesh/types": "1.0.0-alpha-20230523154841-376b13623",
|
|
9
|
+
"@graphql-mesh/utils": "1.0.0-alpha-20230523154841-376b13623",
|
|
10
10
|
"@graphql-tools/utils": "^9.2.1 || ^10.0.0",
|
|
11
11
|
"graphql": "*",
|
|
12
12
|
"tslib": "^2.4.0"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@graphql-mesh/string-interpolation": "0.5.0-alpha-
|
|
15
|
+
"@graphql-mesh/string-interpolation": "0.5.0-alpha-20230523154841-376b13623",
|
|
16
16
|
"@graphql-tools/delegate": "^10.0.0",
|
|
17
17
|
"@whatwg-node/fetch": "^0.8.3",
|
|
18
18
|
"dataloader": "^2.2.2",
|
|
@@ -30,6 +30,9 @@
|
|
|
30
30
|
"directory": "packages/handlers/odata"
|
|
31
31
|
},
|
|
32
32
|
"license": "MIT",
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=16.0.0"
|
|
35
|
+
},
|
|
33
36
|
"main": "cjs/index.js",
|
|
34
37
|
"module": "esm/index.js",
|
|
35
38
|
"typings": "typings/index.d.ts",
|