This commit is contained in:
Like Zhu 2021-07-29 11:54:36 -07:00
Родитель a593a9f104
Коммит 265af782a3
12 изменённых файлов: 24 добавлений и 3 удалений

Просмотреть файл

@ -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,
};
}