Add parentKeySelector
This commit is contained in:
Родитель
a593a9f104
Коммит
265af782a3
|
@ -61,9 +61,7 @@ const requestContract = createRequestContract({
|
|||
uriFactoryFn: urlDecorator(odataUrlFactory),
|
||||
headerFactoryFn: headerDecorator(odataHeaderFactory),
|
||||
payloadFactoryFn: payloadDecorator(odataPayloadFactory),
|
||||
|
||||
// TODO: figure out how to do parentKey
|
||||
parentKeySelector: variables => variables.locator.descriptor.<%- parentKey %>
|
||||
parentKeySelector: variables => variables.locator.descriptor.<%- parentKey %>,
|
||||
});
|
||||
|
||||
const responseContract = createResponseContract({
|
||||
|
|
|
@ -54,6 +54,7 @@ const requestContract = createRequestContract({
|
|||
fetchPolicy: networkPolicy,
|
||||
uriFactoryFn: urlDecorator(odataUrlFactory),
|
||||
headerFactoryFn: headerDecorator(odataHeaderFactory),
|
||||
parentKeySelector: variables => variables.locator.descriptor.<%- parentKey %>,
|
||||
});
|
||||
|
||||
const responseContract = createResponseContract({
|
||||
|
|
|
@ -61,6 +61,7 @@ const requestContract = createRequestContract({
|
|||
uriFactoryFn: urlDecorator(odataUrlFactory),
|
||||
headerFactoryFn: headerDecorator(odataHeaderFactory),
|
||||
payloadFactoryFn: payloadDecorator(odataPayloadFactory),
|
||||
parentKeySelector: variables => variables.locator.descriptor.<%- parentKey %>,
|
||||
});
|
||||
|
||||
const responseContract = createResponseContract({
|
||||
|
|
|
@ -54,6 +54,7 @@ const requestContract = createRequestContract({
|
|||
fetchPolicy: networkPolicy,
|
||||
uriFactoryFn: urlDecorator(odataUrlFactory),
|
||||
headerFactoryFn: headerDecorator(odataHeaderFactory),
|
||||
parentKeySelector: variables => variables.locator.descriptor.<%- parentKey %>,
|
||||
});
|
||||
|
||||
const responseContract = createResponseContract({
|
||||
|
|
|
@ -54,6 +54,7 @@ const requestContract = createRequestContract({
|
|||
fetchPolicy: networkPolicy,
|
||||
uriFactoryFn: urlDecorator(odataUrlFactory),
|
||||
headerFactoryFn: headerDecorator(odataHeaderFactory),
|
||||
parentKeySelector: variables => variables.locator.descriptor.<%- parentKey %>,
|
||||
});
|
||||
|
||||
const responseContract = createResponseContract({
|
||||
|
|
|
@ -61,6 +61,7 @@ const requestContract = createRequestContract({
|
|||
uriFactoryFn: urlDecorator(odataUrlFactory),
|
||||
headerFactoryFn: headerDecorator(odataHeaderFactory),
|
||||
payloadFactoryFn: payloadDecorator(odataPayloadFactory),
|
||||
parentKeySelector: variables => variables.locator.descriptor.<%- parentKey %>,
|
||||
});
|
||||
|
||||
const responseContract = createResponseContract({
|
||||
|
|
|
@ -54,6 +54,7 @@ const requestContract = createRequestContract({
|
|||
fetchPolicy: networkPolicy,
|
||||
uriFactoryFn: urlDecorator(odataUrlFactory),
|
||||
headerFactoryFn: headerDecorator(odataHeaderFactory),
|
||||
parentKeySelector: variables => variables.locator.descriptor.<%- parentKey %>,
|
||||
});
|
||||
|
||||
const responseContract = createResponseContract({
|
||||
|
|
|
@ -61,6 +61,7 @@ const responseContract = createResponseContract({
|
|||
responseType: responseTypes.ENTITY,
|
||||
keySelector: keySelectorDecorator(r => r.<%= key %>),
|
||||
processorFn: processorDecorator(r => r),
|
||||
parentKeySelector: variables => variables.locator.descriptor.<%- parentKey %>,
|
||||
});
|
||||
|
||||
export const fetchSpec = createSpec(
|
||||
|
|
|
@ -61,6 +61,7 @@ const requestContract = createRequestContract({
|
|||
uriFactoryFn: urlDecorator(odataUrlFactory),
|
||||
headerFactoryFn: headerDecorator(odataHeaderFactory),
|
||||
payloadFactoryFn: payloadDecorator(odataPayloadFactory),
|
||||
parentKeySelector: variables => variables.locator.descriptor.<%- parentKey %>,
|
||||
});
|
||||
|
||||
const responseContract = createResponseContract({
|
||||
|
|
|
@ -26,6 +26,10 @@ function composeSharedContext(metadata, scope, aliasHashMap) {
|
|||
const odataUriSegments = odataCallUriFactory(visitedSchemas, rootSchema, aliasHashMap, isColl);
|
||||
const descriptorList = generateDescriptorList(visitedSchemas, aliasHashMap, isColl);
|
||||
|
||||
// note that for action/function, the "parent" is the _last_
|
||||
// element of the descriptor list
|
||||
const parentKey = descriptorList[descriptorList.length - 1];
|
||||
|
||||
const { ReturnType } = rootSchema.schema;
|
||||
let responseType = 'responseTypes.ENTITY';
|
||||
let key = 'r => r';
|
||||
|
@ -62,6 +66,7 @@ function composeSharedContext(metadata, scope, aliasHashMap) {
|
|||
key,
|
||||
responseType,
|
||||
processor,
|
||||
parentKey,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,10 @@ function composeSharedContext(metadata, scope, aliasHashMap) {
|
|||
const descriptorList = generateDescriptorList(visitedSchemas, aliasHashMap, true);
|
||||
const { $$ODataExtension } = rootSchema.schema;
|
||||
|
||||
const parentKey = descriptorList.length > 1
|
||||
? descriptorList[descriptorList.length - 2]
|
||||
: descriptorList[0];
|
||||
|
||||
return {
|
||||
edmLocation,
|
||||
envLocation,
|
||||
|
@ -30,6 +34,7 @@ function composeSharedContext(metadata, scope, aliasHashMap) {
|
|||
descriptorList,
|
||||
odataUriSegments,
|
||||
key: $$ODataExtension.Key[0],
|
||||
parentKey,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,10 @@ function composeSharedContext(metadata, scope, aliasHashMap) {
|
|||
const descriptorList = generateDescriptorList(visitedSchemas, aliasHashMap, false);
|
||||
const { $$ODataExtension } = rootSchema.schema;
|
||||
|
||||
const parentKey = descriptorList.length > 1
|
||||
? descriptorList[descriptorList.length - 2]
|
||||
: descriptorList[0];
|
||||
|
||||
return {
|
||||
edmLocation,
|
||||
envLocation,
|
||||
|
@ -30,6 +34,7 @@ function composeSharedContext(metadata, scope, aliasHashMap) {
|
|||
descriptorList,
|
||||
odataUriSegments,
|
||||
key: $$ODataExtension.Key[0],
|
||||
parentKey,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче