@enonic/nextjs-adapter 3.2.1 → 3.3.0-B1
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/package.json +44 -25
- package/src/baseMappings.ts +9 -9
- package/src/common/ComponentRegistry.ts +2 -5
- package/src/common/constants.ts +4 -4
- package/src/common/env.ts +1 -1
- package/src/guillotine/applyProcessors.ts +3 -7
- package/src/guillotine/buildComponentTree.ts +1 -1
- package/src/guillotine/buildErrorResponse.ts +3 -3
- package/src/guillotine/buildPage.ts +2 -2
- package/src/guillotine/collectComponentDescriptors.ts +6 -13
- package/src/guillotine/combineMultipleQueries.ts +3 -6
- package/src/guillotine/createMetaData.ts +2 -2
- package/src/guillotine/fetchContent.ts +8 -14
- package/src/guillotine/fetchContentData.ts +4 -10
- package/src/guillotine/fetchContentPathsForAllLocales.ts +3 -3
- package/src/guillotine/fetchContentPathsForLocale.ts +7 -7
- package/src/guillotine/fetchFromApi.ts +8 -8
- package/src/guillotine/fetchGuillotine.ts +22 -9
- package/src/guillotine/fetchMetaData.ts +5 -5
- package/src/guillotine/getCleanContentPathArrayOrThrow400.ts +2 -2
- package/src/guillotine/getParentRegion.ts +2 -2
- package/src/guillotine/getQueryAndVariables.ts +5 -9
- package/src/guillotine/metadata/configQuery.ts +2 -2
- package/src/guillotine/parseComponentPath.ts +4 -7
- package/src/guillotine/processComponentConfig.ts +1 -1
- package/src/guillotine/restrictComponentsToPath.ts +1 -1
- package/src/i18n/LocaleContext.tsx +3 -3
- package/src/index.ts +3 -3
- package/src/types/component.ts +1 -1
- package/src/types/componentProps.ts +4 -3
- package/src/types/guillotine.ts +1 -1
- package/src/types/index.ts +3 -3
- package/src/utils/buildGuillotineRequestHeaders.ts +4 -7
- package/src/utils/fixDoubleSlashes.ts +1 -1
- package/src/utils/getLocaleMappings.ts +1 -1
- package/src/utils/getRenderMode.ts +2 -5
- package/src/views/BaseComponent.tsx +5 -5
- package/src/views/BaseContent.tsx +1 -1
- package/src/views/BaseMacro.tsx +1 -1
- package/src/views/PropsView.tsx +1 -1
- package/src/views/RichTextView.tsx +68 -25
- package/src/views/StaticContent.tsx +1 -1
- package/baseMappings.d.ts +0 -1
- package/baseMappings.js +0 -43
- package/baseMappings.js.map +0 -1
- package/client/getClientHydratedHtml.d.ts +0 -1
- package/client/getClientHydratedHtml.jsx +0 -9
- package/client/getClientHydratedHtml.jsx.map +0 -1
- package/client.d.ts +0 -1
- package/client.js +0 -3
- package/client.js.map +0 -1
- package/common/ComponentRegistry.d.ts +0 -34
- package/common/ComponentRegistry.js +0 -121
- package/common/ComponentRegistry.js.map +0 -1
- package/common/UrlProcessor.d.ts +0 -25
- package/common/UrlProcessor.js +0 -151
- package/common/UrlProcessor.js.map +0 -1
- package/common/constants.d.ts +0 -51
- package/common/constants.js +0 -86
- package/common/constants.js.map +0 -1
- package/common/env.d.ts +0 -12
- package/common/env.js +0 -30
- package/common/env.js.map +0 -1
- package/guillotine/applyProcessors.d.ts +0 -2
- package/guillotine/applyProcessors.js +0 -33
- package/guillotine/applyProcessors.js.map +0 -1
- package/guillotine/buildComponentTree.d.ts +0 -2
- package/guillotine/buildComponentTree.js +0 -45
- package/guillotine/buildComponentTree.js.map +0 -1
- package/guillotine/buildErrorResponse.d.ts +0 -3
- package/guillotine/buildErrorResponse.js +0 -27
- package/guillotine/buildErrorResponse.js.map +0 -1
- package/guillotine/buildPage.d.ts +0 -2
- package/guillotine/buildPage.js +0 -10
- package/guillotine/buildPage.js.map +0 -1
- package/guillotine/collectComponentDescriptors.d.ts +0 -6
- package/guillotine/collectComponentDescriptors.js +0 -43
- package/guillotine/collectComponentDescriptors.js.map +0 -1
- package/guillotine/combineMultipleQueries.d.ts +0 -2
- package/guillotine/combineMultipleQueries.js +0 -58
- package/guillotine/combineMultipleQueries.js.map +0 -1
- package/guillotine/createMetaData.d.ts +0 -18
- package/guillotine/createMetaData.js +0 -45
- package/guillotine/createMetaData.js.map +0 -1
- package/guillotine/fetchContent.d.ts +0 -9
- package/guillotine/fetchContent.js +0 -222
- package/guillotine/fetchContent.js.map +0 -1
- package/guillotine/fetchContentData.d.ts +0 -2
- package/guillotine/fetchContentData.js +0 -30
- package/guillotine/fetchContentData.js.map +0 -1
- package/guillotine/fetchContentPathsForAllLocales.d.ts +0 -2
- package/guillotine/fetchContentPathsForAllLocales.js +0 -21
- package/guillotine/fetchContentPathsForAllLocales.js.map +0 -1
- package/guillotine/fetchContentPathsForLocale.d.ts +0 -2
- package/guillotine/fetchContentPathsForLocale.js +0 -41
- package/guillotine/fetchContentPathsForLocale.js.map +0 -1
- package/guillotine/fetchFromApi.d.ts +0 -3
- package/guillotine/fetchFromApi.js +0 -76
- package/guillotine/fetchFromApi.js.map +0 -1
- package/guillotine/fetchGuillotine.d.ts +0 -3
- package/guillotine/fetchGuillotine.js +0 -62
- package/guillotine/fetchGuillotine.js.map +0 -1
- package/guillotine/fetchMetaData.d.ts +0 -2
- package/guillotine/fetchMetaData.js +0 -33
- package/guillotine/fetchMetaData.js.map +0 -1
- package/guillotine/getCleanContentPathArrayOrThrow400.d.ts +0 -2
- package/guillotine/getCleanContentPathArrayOrThrow400.js +0 -20
- package/guillotine/getCleanContentPathArrayOrThrow400.js.map +0 -1
- package/guillotine/getComponentConfig.d.ts +0 -2
- package/guillotine/getComponentConfig.js +0 -5
- package/guillotine/getComponentConfig.js.map +0 -1
- package/guillotine/getContentAndComponentPaths.d.ts +0 -1
- package/guillotine/getContentAndComponentPaths.js +0 -12
- package/guillotine/getContentAndComponentPaths.js.map +0 -1
- package/guillotine/getMetaData.d.ts +0 -2
- package/guillotine/getMetaData.js +0 -67
- package/guillotine/getMetaData.js.map +0 -1
- package/guillotine/getParentRegion.d.ts +0 -2
- package/guillotine/getParentRegion.js +0 -40
- package/guillotine/getParentRegion.js.map +0 -1
- package/guillotine/getQueryAndVariables.d.ts +0 -2
- package/guillotine/getQueryAndVariables.js +0 -32
- package/guillotine/getQueryAndVariables.js.map +0 -1
- package/guillotine/metadata/configQuery.d.ts +0 -2
- package/guillotine/metadata/configQuery.js +0 -36
- package/guillotine/metadata/configQuery.js.map +0 -1
- package/guillotine/metadata/richTextQuery.d.ts +0 -1
- package/guillotine/metadata/richTextQuery.js +0 -47
- package/guillotine/metadata/richTextQuery.js.map +0 -1
- package/guillotine/parseComponentPath.d.ts +0 -2
- package/guillotine/parseComponentPath.js +0 -22
- package/guillotine/parseComponentPath.js.map +0 -1
- package/guillotine/prefixFragmentCmpPath.d.ts +0 -1
- package/guillotine/prefixFragmentCmpPath.js +0 -13
- package/guillotine/prefixFragmentCmpPath.js.map +0 -1
- package/guillotine/processComponentConfig.d.ts +0 -2
- package/guillotine/processComponentConfig.js +0 -30
- package/guillotine/processComponentConfig.js.map +0 -1
- package/guillotine/restrictComponentsToPath.d.ts +0 -2
- package/guillotine/restrictComponentsToPath.js +0 -38
- package/guillotine/restrictComponentsToPath.js.map +0 -1
- package/guillotine/validateData.d.ts +0 -2
- package/guillotine/validateData.js +0 -7
- package/guillotine/validateData.js.map +0 -1
- package/guillotine/validateNotFound.d.ts +0 -2
- package/guillotine/validateNotFound.js +0 -16
- package/guillotine/validateNotFound.js.map +0 -1
- package/guillotine/validateShortcut.d.ts +0 -2
- package/guillotine/validateShortcut.js +0 -35
- package/guillotine/validateShortcut.js.map +0 -1
- package/i18n/LocaleContext.d.ts +0 -7
- package/i18n/LocaleContext.jsx +0 -50
- package/i18n/LocaleContext.jsx.map +0 -1
- package/i18n/i18n.d.ts +0 -12
- package/i18n/i18n.js +0 -59
- package/i18n/i18n.js.map +0 -1
- package/index.d.ts +0 -14
- package/index.js +0 -14
- package/index.js.map +0 -1
- package/query/Shortcut.d.ts +0 -1
- package/query/Shortcut.js +0 -19
- package/query/Shortcut.js.map +0 -1
- package/server/getServerRenderedHtml.d.ts +0 -1
- package/server/getServerRenderedHtml.js +0 -4
- package/server/getServerRenderedHtml.js.map +0 -1
- package/server.d.ts +0 -5
- package/server.js +0 -6
- package/server.js.map +0 -1
- package/types/component.d.ts +0 -92
- package/types/component.js +0 -2
- package/types/component.js.map +0 -1
- package/types/componentProps.d.ts +0 -106
- package/types/componentProps.js +0 -2
- package/types/componentProps.js.map +0 -1
- package/types/guillotine.d.ts +0 -344
- package/types/guillotine.js +0 -2
- package/types/guillotine.js.map +0 -1
- package/types/i18n.d.ts +0 -7
- package/types/i18n.js +0 -2
- package/types/i18n.js.map +0 -1
- package/types/index.d.ts +0 -47
- package/types/index.js +0 -3
- package/types/index.js.map +0 -1
- package/types/next.d.ts +0 -6
- package/types/next.js +0 -2
- package/types/next.js.map +0 -1
- package/types/util.d.ts +0 -3
- package/types/util.js +0 -3
- package/types/util.js.map +0 -1
- package/utils/addLineNumbers.d.ts +0 -1
- package/utils/addLineNumbers.js +0 -4
- package/utils/addLineNumbers.js.map +0 -1
- package/utils/buildGuillotineRequestHeaders.d.ts +0 -7
- package/utils/buildGuillotineRequestHeaders.js +0 -16
- package/utils/buildGuillotineRequestHeaders.js.map +0 -1
- package/utils/commonChars.d.ts +0 -1
- package/utils/commonChars.js +0 -17
- package/utils/commonChars.js.map +0 -1
- package/utils/enonicLog.d.ts +0 -5
- package/utils/enonicLog.js +0 -23
- package/utils/enonicLog.js.map +0 -1
- package/utils/fixDoubleSlashes.d.ts +0 -1
- package/utils/fixDoubleSlashes.js +0 -4
- package/utils/fixDoubleSlashes.js.map +0 -1
- package/utils/getAllLocales.d.ts +0 -1
- package/utils/getAllLocales.js +0 -5
- package/utils/getAllLocales.js.map +0 -1
- package/utils/getContentApiUrl.d.ts +0 -2
- package/utils/getContentApiUrl.js +0 -15
- package/utils/getContentApiUrl.js.map +0 -1
- package/utils/getLocaleMapping.d.ts +0 -2
- package/utils/getLocaleMapping.js +0 -19
- package/utils/getLocaleMapping.js.map +0 -1
- package/utils/getLocaleMappingByLocale.d.ts +0 -2
- package/utils/getLocaleMappingByLocale.js +0 -13
- package/utils/getLocaleMappingByLocale.js.map +0 -1
- package/utils/getLocaleMappingByProjectId.d.ts +0 -2
- package/utils/getLocaleMappingByProjectId.js +0 -16
- package/utils/getLocaleMappingByProjectId.js.map +0 -1
- package/utils/getLocaleMappings.d.ts +0 -2
- package/utils/getLocaleMappings.js +0 -30
- package/utils/getLocaleMappings.js.map +0 -1
- package/utils/getRenderMode.d.ts +0 -3
- package/utils/getRenderMode.js +0 -8
- package/utils/getRenderMode.js.map +0 -1
- package/utils/getRequestLocaleInfo.d.ts +0 -6
- package/utils/getRequestLocaleInfo.js +0 -29
- package/utils/getRequestLocaleInfo.js.map +0 -1
- package/utils/getXpBaseUrl.d.ts +0 -2
- package/utils/getXpBaseUrl.js +0 -8
- package/utils/getXpBaseUrl.js.map +0 -1
- package/utils/indent.d.ts +0 -1
- package/utils/indent.js +0 -5
- package/utils/indent.js.map +0 -1
- package/utils/sanitizeGraphqlName.d.ts +0 -1
- package/utils/sanitizeGraphqlName.js +0 -12
- package/utils/sanitizeGraphqlName.js.map +0 -1
- package/views/BaseComponent.d.ts +0 -20
- package/views/BaseComponent.jsx +0 -129
- package/views/BaseComponent.jsx.map +0 -1
- package/views/BaseContent.d.ts +0 -3
- package/views/BaseContent.jsx +0 -38
- package/views/BaseContent.jsx.map +0 -1
- package/views/BaseLayout.d.ts +0 -3
- package/views/BaseLayout.jsx +0 -24
- package/views/BaseLayout.jsx.map +0 -1
- package/views/BaseMacro.d.ts +0 -6
- package/views/BaseMacro.jsx +0 -100
- package/views/BaseMacro.jsx.map +0 -1
- package/views/BasePage.d.ts +0 -3
- package/views/BasePage.jsx +0 -34
- package/views/BasePage.jsx.map +0 -1
- package/views/BasePart.d.ts +0 -3
- package/views/BasePart.jsx +0 -24
- package/views/BasePart.jsx.map +0 -1
- package/views/Empty.d.ts +0 -2
- package/views/Empty.jsx +0 -4
- package/views/Empty.jsx.map +0 -1
- package/views/Fragment.d.ts +0 -3
- package/views/Fragment.jsx +0 -30
- package/views/Fragment.jsx.map +0 -1
- package/views/MainView.d.ts +0 -3
- package/views/MainView.jsx +0 -14
- package/views/MainView.jsx.map +0 -1
- package/views/PropsView.d.ts +0 -2
- package/views/PropsView.jsx +0 -21
- package/views/PropsView.jsx.map +0 -1
- package/views/Region.d.ts +0 -6
- package/views/Region.jsx +0 -52
- package/views/Region.jsx.map +0 -1
- package/views/RichTextView.d.ts +0 -3
- package/views/RichTextView.jsx +0 -39
- package/views/RichTextView.jsx.map +0 -1
- package/views/SingleComponent.d.ts +0 -4
- package/views/SingleComponent.jsx +0 -10
- package/views/SingleComponent.jsx.map +0 -1
- package/views/StaticContent.d.ts +0 -10
- package/views/StaticContent.jsx +0 -37
- package/views/StaticContent.jsx.map +0 -1
- package/views/Text.d.ts +0 -8
- package/views/Text.jsx +0 -4
- package/views/Text.jsx.map +0 -1
- package/views/macros/DefaultMacro.d.ts +0 -3
- package/views/macros/DefaultMacro.jsx +0 -4
- package/views/macros/DefaultMacro.jsx.map +0 -1
- package/views/macros/DisableMacro.d.ts +0 -3
- package/views/macros/DisableMacro.jsx +0 -3
- package/views/macros/DisableMacro.jsx.map +0 -1
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { getComponentConfig } from './getComponentConfig';
|
|
11
|
-
const NO_PROPS_PROCESSOR = (props) => __awaiter(void 0, void 0, void 0, function* () { var _a; return (_a = yield props) !== null && _a !== void 0 ? _a : {}; });
|
|
12
|
-
export function applyProcessors(componentDescriptors, contentResults, context) {
|
|
13
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
14
|
-
let dataCounter = 0;
|
|
15
|
-
const processorPromises = componentDescriptors.map((desc) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
var _a;
|
|
17
|
-
// we're iterating component descriptors here
|
|
18
|
-
// some of them might not have provided graphql requests
|
|
19
|
-
// but we still need to run props processor for them
|
|
20
|
-
// in case they want to fetch their data from elsewhere
|
|
21
|
-
const propsProcessor = ((_a = desc.type) === null || _a === void 0 ? void 0 : _a.processor) || NO_PROPS_PROCESSOR;
|
|
22
|
-
let data;
|
|
23
|
-
if (desc.queryAndVariables) {
|
|
24
|
-
// if there is a query then there must be a result for it
|
|
25
|
-
data = contentResults.contents[dataCounter++];
|
|
26
|
-
}
|
|
27
|
-
const config = getComponentConfig(desc.component);
|
|
28
|
-
return yield propsProcessor(data, context, config);
|
|
29
|
-
}));
|
|
30
|
-
return Promise.allSettled(processorPromises);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=applyProcessors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"applyProcessors.js","sourceRoot":"","sources":["../src/guillotine/applyProcessors.ts"],"names":[],"mappings":";;;;;;;;;AAOA,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAGxD,MAAM,kBAAkB,GAAG,CAAO,KAAU,EAAE,EAAE,0DAAC,OAAA,MAAA,MAAM,KAAK,mCAAI,EAAE,CAAA,GAAA,CAAC;AAGnE,MAAM,UAAgB,eAAe,CACjC,oBAA2C,EAC3C,cAA6B,EAC7B,OAAgB;;QAGhB,IAAI,WAAW,GAAG,CAAC,CAAC;QACpB,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,GAAG,CAAC,CAAO,IAAyB,EAAE,EAAE;;YACnF,6CAA6C;YAC7C,wDAAwD;YACxD,oDAAoD;YACpD,uDAAuD;YACvD,MAAM,cAAc,GAAG,CAAA,MAAA,IAAI,CAAC,IAAI,0CAAE,SAAS,KAAI,kBAAkB,CAAC;YAClE,IAAI,IAAI,CAAC;YACT,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;gBACzB,yDAAyD;gBACzD,IAAI,GAAG,cAAc,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC;YAClD,CAAC;YAED,MAAM,MAAM,GAAG,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAClD,OAAO,MAAM,cAAc,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QACvD,CAAC,CAAA,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;IACjD,CAAC;CAAA"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { FRAGMENT_CONTENTTYPE_NAME, XP_COMPONENT_TYPE } from '../common/constants';
|
|
2
|
-
import { parseComponentPath } from './parseComponentPath';
|
|
3
|
-
import { getParentRegion } from './getParentRegion';
|
|
4
|
-
export function buildComponentTree(comps, rootComp, contentType) {
|
|
5
|
-
const rootTree = {};
|
|
6
|
-
const isFragmentType = contentType === FRAGMENT_CONTENTTYPE_NAME;
|
|
7
|
-
if (isFragmentType) {
|
|
8
|
-
rootComp.regions = rootTree;
|
|
9
|
-
}
|
|
10
|
-
(comps || []).forEach(cmp => {
|
|
11
|
-
var _a, _b, _c;
|
|
12
|
-
const cmpPath = parseComponentPath(contentType, cmp.path);
|
|
13
|
-
if (cmp.path === '/') {
|
|
14
|
-
if (cmp.type === XP_COMPONENT_TYPE.PAGE && rootComp.type === XP_COMPONENT_TYPE.PAGE) {
|
|
15
|
-
// add page values to page object
|
|
16
|
-
rootComp = Object.assign(rootComp, cmp);
|
|
17
|
-
rootComp.page.regions = rootTree;
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
else if (cmp.type === XP_COMPONENT_TYPE.LAYOUT && rootComp.type === XP_COMPONENT_TYPE.FRAGMENT) {
|
|
21
|
-
// when rendering fragment as part of the page with layout at root path
|
|
22
|
-
// remove other children from list as they will be included in layout
|
|
23
|
-
rootComp.fragment.fragment.components = [cmp];
|
|
24
|
-
cmp.regions = rootTree;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
if (cmp.type === XP_COMPONENT_TYPE.FRAGMENT) {
|
|
28
|
-
// build component subtree for fragment
|
|
29
|
-
cmp = buildComponentTree((_b = (_a = cmp.fragment) === null || _a === void 0 ? void 0 : _a.fragment) === null || _b === void 0 ? void 0 : _b.components, cmp, contentType);
|
|
30
|
-
}
|
|
31
|
-
const region = getParentRegion(rootTree, contentType, cmpPath, comps, true);
|
|
32
|
-
if (region) {
|
|
33
|
-
// getting the index of component from string like '/main/0/left/11'
|
|
34
|
-
const cmpIndex = (_c = cmpPath[cmpPath.length - 1]) === null || _c === void 0 ? void 0 : _c.index;
|
|
35
|
-
if (cmpIndex >= 0) {
|
|
36
|
-
region.components.splice(cmpIndex, 0, cmp);
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
throw Error(`Could not find [${cmp.type}] component index at ${JSON.stringify(cmpPath, null, 2)}, rendering not possible.`);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
return rootComp;
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=buildComponentTree.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildComponentTree.js","sourceRoot":"","sources":["../src/guillotine/buildComponentTree.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,yBAAyB,EAAE,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAGlD,MAAM,UAAU,kBAAkB,CAC9B,KAAsB,EACtB,QAAuB,EACvB,WAAoB;IAEpB,MAAM,QAAQ,GAAe,EAA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W,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;QAE5E,IAAI,MAAM,EAAE,CAAC;YACT,oEAAoE;YACpE,MAAM,QAAQ,GAAG,MAAA,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,0CAAE,KAAK,CAAC;YACpD,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;gBAChB,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;YAC/C,CAAC;iBAAM,CAAC;gBACJ,MAAM,KAAK,CAAC,mBAAmB,GAAG,CAAC,IAAI,wBAAwB,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,2BAA2B,CAAC,CAAC;YAChI,CAAC;QACL,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,QAAQ,CAAC;AACpB,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { FetchContentResult } from '../types';
|
|
2
|
-
import { RENDER_MODE, XP_REQUEST_TYPE } from '../common/constants';
|
|
3
|
-
export declare function buildErrorResponse(requestType: XP_REQUEST_TYPE, renderMode: RENDER_MODE, apiUrl: string, baseUrl: string, locale: string, defaultLocale: string, contentPath?: string, contentId?: string): (code?: string, message?: string) => FetchContentResult;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export function buildErrorResponse(requestType, renderMode, apiUrl, baseUrl, locale, defaultLocale, contentPath, contentId) {
|
|
2
|
-
return function (code = '500', message = 'Unknown error') {
|
|
3
|
-
return {
|
|
4
|
-
error: {
|
|
5
|
-
code,
|
|
6
|
-
message,
|
|
7
|
-
},
|
|
8
|
-
page: null,
|
|
9
|
-
common: null,
|
|
10
|
-
data: null,
|
|
11
|
-
meta: {
|
|
12
|
-
id: contentId || '',
|
|
13
|
-
type: '',
|
|
14
|
-
requestType: requestType,
|
|
15
|
-
renderMode: renderMode,
|
|
16
|
-
path: contentPath || '',
|
|
17
|
-
canRender: false,
|
|
18
|
-
catchAll: false,
|
|
19
|
-
apiUrl,
|
|
20
|
-
baseUrl,
|
|
21
|
-
locale,
|
|
22
|
-
defaultLocale,
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
//# sourceMappingURL=buildErrorResponse.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildErrorResponse.js","sourceRoot":"","sources":["../src/guillotine/buildErrorResponse.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,kBAAkB,CAAC,WAA4B,EAAE,UAAuB,EACpF,MAAc,EAAE,OAAe,EAAE,MAAc,EAAE,aAAqB,EACvC,WAAqB,EAAE,SAAkB;IAExE,OAAO,UAAU,IAAI,GAAG,KAAK,EAAE,OAAO,GAAG,eAAe;QACpD,OAAO;YACH,KAAK,EAAE;gBACH,IAAI;gBACJ,OAAO;aACV;YACD,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,IAAI;YACZ,IAAI,EAAE,IAAI;YACV,IAAI,EAAE;gBACF,EAAE,EAAE,SAAS,IAAI,EAAE;gBACnB,IAAI,EAAE,EAAE;gBACR,WAAW,EAAE,WAAW;gBACxB,UAAU,EAAE,UAAU;gBACtB,IAAI,EAAE,WAAW,IAAI,EAAE;gBACvB,SAAS,EAAE,KAAK;gBAChB,QAAQ,EAAE,KAAK;gBACf,MAAM;gBACN,OAAO;gBACP,MAAM;gBACN,aAAa;aAChB;SACJ,CAAC;IACN,CAAC,CAAC;AACN,CAAC"}
|
package/guillotine/buildPage.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { XP_COMPONENT_TYPE } from '../common/constants';
|
|
2
|
-
import { buildComponentTree } from './buildComponentTree';
|
|
3
|
-
export function buildPage(contentType, comps = []) {
|
|
4
|
-
const page = {
|
|
5
|
-
type: XP_COMPONENT_TYPE.PAGE,
|
|
6
|
-
path: '/',
|
|
7
|
-
};
|
|
8
|
-
return buildComponentTree(comps, page, contentType);
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=buildPage.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildPage.js","sourceRoot":"","sources":["../src/guillotine/buildPage.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AAGxD,MAAM,UAAU,SAAS,CAAC,WAAmB,EAAE,QAAyB,EAAE;IACtE,MAAM,IAAI,GAAkB;QACxB,IAAI,EAAE,iBAAiB,CAAC,IAAI;QAC5B,IAAI,EAAE,GAAG;KACZ,CAAC;IAEF,OAAO,kBAAkB,CAAC,KAAK,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { ComponentDescriptor, Context, PageComponent } from '../types';
|
|
2
|
-
export declare function collectComponentDescriptors({ components, xpContentPath, context, }: {
|
|
3
|
-
components: PageComponent[];
|
|
4
|
-
xpContentPath: string;
|
|
5
|
-
context: Context;
|
|
6
|
-
}): ComponentDescriptor[];
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { ComponentRegistry } from '../common/ComponentRegistry';
|
|
2
|
-
import { XP_COMPONENT_TYPE } from '../common/constants';
|
|
3
|
-
import { APP_NAME, APP_NAME_DASHED, } from '../common/env';
|
|
4
|
-
import { processComponentConfig } from './processComponentConfig';
|
|
5
|
-
import { getComponentConfig } from './getComponentConfig';
|
|
6
|
-
import { getQueryAndVariables } from './getQueryAndVariables';
|
|
7
|
-
export function collectComponentDescriptors({ components, xpContentPath, context, }) {
|
|
8
|
-
var _a, _b;
|
|
9
|
-
const descriptors = [];
|
|
10
|
-
for (const cmp of (components || [])) {
|
|
11
|
-
processComponentConfig(APP_NAME, APP_NAME_DASHED, cmp);
|
|
12
|
-
// only look for parts
|
|
13
|
-
// look for single part if it is a single component request
|
|
14
|
-
if (XP_COMPONENT_TYPE.FRAGMENT !== cmp.type) {
|
|
15
|
-
const cmpDef = ComponentRegistry.getByComponent(cmp);
|
|
16
|
-
if (cmpDef) {
|
|
17
|
-
// const partPath = `${xpContentPath}/_component${cmp.path}`;
|
|
18
|
-
const config = getComponentConfig(cmp);
|
|
19
|
-
const queryAndVariables = getQueryAndVariables(cmp.type, xpContentPath, context, cmpDef.query, config);
|
|
20
|
-
if (queryAndVariables) {
|
|
21
|
-
descriptors.push({
|
|
22
|
-
component: cmp,
|
|
23
|
-
type: cmpDef,
|
|
24
|
-
queryAndVariables: queryAndVariables,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
// look for parts inside fragments
|
|
31
|
-
const fragPartDescs = collectComponentDescriptors({
|
|
32
|
-
components: (_b = (_a = cmp.fragment) === null || _a === void 0 ? void 0 : _a.fragment) === null || _b === void 0 ? void 0 : _b.components,
|
|
33
|
-
xpContentPath,
|
|
34
|
-
context,
|
|
35
|
-
});
|
|
36
|
-
if (fragPartDescs.length) {
|
|
37
|
-
descriptors.push(...fragPartDescs);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return descriptors;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=collectComponentDescriptors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collectComponentDescriptors.js","sourceRoot":"","sources":["../src/guillotine/collectComponentDescriptors.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACH,QAAQ,EACR,eAAe,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAC,kBAAkB,E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AC;IACL,CAAC;IAED,OAAO,WAAW,CAAC;AACvB,CAAC"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
const ALIAS_PREFIX = 'request';
|
|
2
|
-
const GRAPHQL_FRAGMENTS_REGEXP = /fragment\s+.+\s+on\s+.+\s*{[\s\w{}().,:"'`]+}/;
|
|
3
|
-
const GUILLOTINE_QUERY_REGEXP = /^\s*query\s*(?:\((.*)*\))?\s*{\s*guillotine\s*{((?:.|\s)+)}\s*}\s*$/;
|
|
4
|
-
export function combineMultipleQueries(queriesWithVars) {
|
|
5
|
-
const queries = [];
|
|
6
|
-
const fragments = [];
|
|
7
|
-
const superVars = {};
|
|
8
|
-
const superParams = [];
|
|
9
|
-
queriesWithVars.forEach((componentDescriptor, index) => {
|
|
10
|
-
const queryAndVars = componentDescriptor.queryAndVariables;
|
|
11
|
-
if (!queryAndVars) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
// Extract fragments first if exist
|
|
15
|
-
let q = queryAndVars.query;
|
|
16
|
-
let match = q.match(GRAPHQL_FRAGMENTS_REGEXP);
|
|
17
|
-
if ((match === null || match === void 0 ? void 0 : match.length) === 1) {
|
|
18
|
-
// extract a fragment to put it at root level
|
|
19
|
-
fragments.push(match[0]);
|
|
20
|
-
// remove it from query because queries are going to get wrapped
|
|
21
|
-
q = q.replace(match[0], '');
|
|
22
|
-
}
|
|
23
|
-
// Extract graphql query and its params and add prefixes to exclude collisions with other queries
|
|
24
|
-
match = q.match(GUILLOTINE_QUERY_REGEXP) || ['']; // Fall back to empty string if no match
|
|
25
|
-
const args = match[1];
|
|
26
|
-
let query = match[2];
|
|
27
|
-
if (args) {
|
|
28
|
-
args.split(',').forEach(originalParamString => {
|
|
29
|
-
const [originalKey, originalVal] = originalParamString.trim().split(':');
|
|
30
|
-
const [prefixedKey, prefixedVal] = [`$${ALIAS_PREFIX}${index}_${originalKey.substr(1)}`, originalVal];
|
|
31
|
-
superParams.push(`${prefixedKey}:${prefixedVal}`);
|
|
32
|
-
// also update param references in query itself !
|
|
33
|
-
// query = query.replaceAll(originalKey, prefixedKey);
|
|
34
|
-
// replaceAll is not supported in older nodejs versions
|
|
35
|
-
const origKeyPattern = new RegExp(originalKey.replace(/\$/g, '\\$'), 'g');
|
|
36
|
-
query = query.replace(origKeyPattern, prefixedKey);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
if (query === null || query === void 0 ? void 0 : query.length) {
|
|
40
|
-
queries.push(`${ALIAS_PREFIX}${index}:guillotine {${query}}`);
|
|
41
|
-
}
|
|
42
|
-
// Update variables with the same prefixes
|
|
43
|
-
Object.entries(queryAndVars.variables || {}).forEach(entry => {
|
|
44
|
-
superVars[`${ALIAS_PREFIX}${index}_${entry[0]}`] = entry[1];
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
// Compose the super query
|
|
48
|
-
const superQuery = `query ${superParams.length ? `(${superParams.join(', ')})` : ''} {
|
|
49
|
-
${queries.join('\n')}
|
|
50
|
-
}
|
|
51
|
-
${fragments.join('\n')}
|
|
52
|
-
`;
|
|
53
|
-
return {
|
|
54
|
-
query: superQuery,
|
|
55
|
-
variables: superVars,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=combineMultipleQueries.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"combineMultipleQueries.js","sourceRoot":"","sources":["../src/guillotine/combineMultipleQueries.ts"],"names":[],"mappings":"AAMA,MAAM,YAAY,GAAG,SAAS,CAAC;AAE/B,MAAM,wBAAwB,GAAG,+CAA+C,CAAC;AAEjF,MAAM,uBAAuB,GAAG,qEAAqE,CAAC;AAGtG,MAAM,UAAU,sBAAsB,CAAC,eAAsC;IACzE,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,MAAM,SAAS,GAAuB,EAAE,CAAC;IACzC,MAAM,WAAW,GAAa,EAAE,CAAC;IAEjC,eAA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AI,WAAW,EAAE,CAAC,CAAC;gBAClD,iDAAiD;gBACjD,sDAAsD;gBACtD,uDAAuD;gBACvD,MAAM,cAAc,GAAG,IAAI,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC;gBAC1E,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,WAAW,CAAC,CAAC;YACvD,CAAC,CAAC,CAAC;QACP,CAAC;QAED,IAAI,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,MAAM,EAAE,CAAC;YAChB,OAAO,CAAC,IAAI,CAAC,GAAG,YAAY,GAAG,KAAK,gBAAgB,KAAK,GAAG,CAAC,CAAC;QAClE,CAAC;QAED,0CAA0C;QAC1C,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACzD,SAAS,CAAC,GAAG,YAAY,GAAG,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAChE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,0BAA0B;IAC1B,MAAM,UAAU,GAAG,SAAS,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;UAC7E,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;;MAEtB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC;KACrB,CAAC;IAEF,OAAO;QACH,KAAK,EAAE,UAAU;QACjB,SAAS,EAAE,SAAS;KACvB,CAAC;AACN,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { MetaData, PageComponent } from '../types';
|
|
2
|
-
import { RENDER_MODE, XP_REQUEST_TYPE } from '../common/constants';
|
|
3
|
-
export declare function createMetaData({ apiUrl, baseUrl, components, // Optional NOTE: Doesn't handle null
|
|
4
|
-
contentPath, contentType, contentId, defaultLocale, locale, pageCmp, // Optional
|
|
5
|
-
renderMode, requestedComponentPath, requestType, }: {
|
|
6
|
-
apiUrl: string;
|
|
7
|
-
baseUrl: string;
|
|
8
|
-
components?: PageComponent[];
|
|
9
|
-
contentPath: string;
|
|
10
|
-
contentId: string;
|
|
11
|
-
contentType: string;
|
|
12
|
-
defaultLocale: string;
|
|
13
|
-
locale: string;
|
|
14
|
-
pageCmp?: PageComponent;
|
|
15
|
-
renderMode: RENDER_MODE;
|
|
16
|
-
requestedComponentPath: string | undefined;
|
|
17
|
-
requestType: XP_REQUEST_TYPE;
|
|
18
|
-
}): MetaData;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { XP_REQUEST_TYPE } from '../common/constants';
|
|
2
|
-
import { ComponentRegistry } from '../common/ComponentRegistry';
|
|
3
|
-
export function createMetaData({ apiUrl, baseUrl, components = [], // Optional NOTE: Doesn't handle null
|
|
4
|
-
contentPath, contentType, contentId, defaultLocale, locale, pageCmp, // Optional
|
|
5
|
-
renderMode, requestedComponentPath, requestType, }) {
|
|
6
|
-
var _a;
|
|
7
|
-
// .meta will be visible in final rendered inline props.
|
|
8
|
-
// Only adding some .meta attributes here on certain conditions
|
|
9
|
-
// (instead of always adding them and letting them be visible as false/undefined etc)
|
|
10
|
-
const meta = {
|
|
11
|
-
apiUrl,
|
|
12
|
-
baseUrl,
|
|
13
|
-
canRender: false,
|
|
14
|
-
catchAll: false, // catchAll only refers to content type catch-all
|
|
15
|
-
defaultLocale,
|
|
16
|
-
locale,
|
|
17
|
-
id: contentId,
|
|
18
|
-
path: contentPath,
|
|
19
|
-
renderMode: renderMode,
|
|
20
|
-
requestType: requestType,
|
|
21
|
-
type: contentType,
|
|
22
|
-
};
|
|
23
|
-
if (requestedComponentPath) {
|
|
24
|
-
meta.requestedComponent = components.find(cmp => cmp.path === requestedComponentPath);
|
|
25
|
-
}
|
|
26
|
-
const pageDesc = (_a = pageCmp === null || pageCmp === void 0 ? void 0 : pageCmp.page) === null || _a === void 0 ? void 0 : _a.descriptor;
|
|
27
|
-
const typeDef = ComponentRegistry.getContentType(contentType);
|
|
28
|
-
if ((typeDef === null || typeDef === void 0 ? void 0 : typeDef.view) && !typeDef.catchAll) {
|
|
29
|
-
meta.canRender = true;
|
|
30
|
-
}
|
|
31
|
-
else if (requestType === XP_REQUEST_TYPE.COMPONENT) {
|
|
32
|
-
// always render a single component (show missing if not implemented)
|
|
33
|
-
meta.canRender = true;
|
|
34
|
-
}
|
|
35
|
-
else if (pageDesc) {
|
|
36
|
-
// always render a page if there is a descriptor (show missing if not implemented)
|
|
37
|
-
meta.canRender = true;
|
|
38
|
-
}
|
|
39
|
-
else if (typeDef === null || typeDef === void 0 ? void 0 : typeDef.view) {
|
|
40
|
-
meta.canRender = true;
|
|
41
|
-
meta.catchAll = true;
|
|
42
|
-
}
|
|
43
|
-
return meta;
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=createMetaData.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createMetaData.js","sourceRoot":"","sources":["../src/guillotine/createMetaData.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,eAAe,EAAC,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAG9D,MAAM,UAAU,cAAc,CAAC,EACI,MAAM,EACN,OAAO,EACP,UAAU,GAAG,EAAE,EAAE,qCAAqC;AACtD,WAAW,EACX,WAAW,EACX,SAAS,EACT,aAAa,EACb,MAAM,EACN,OAAO,EAAE,WAAW;AACpB,UAAU,EACV,sBAAsB,EACtB,WAAW,GAc7C;;IACG,wDAAwD;IACxD,+DAA+D;IAC/D,qFAAqF;IACrF,MAAM,IAAI,GAAa;QACnB,MAAM;QACN,OAAO;QACP,SAAS,EAAE,KAAK;QAChB,QAAQ,EAAE,KAAK,EAAE,iDAAiD;QAClE,aAAa;QACb,MAAM;QACN,EAAE,EAAE,SAAS;QACb,IAAI,EAAE,WAAW;QACjB,UAAU,EAAE,UAAU;QACtB,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;KACpB,CAAC;IAEF,IAAI,sBAAsB,EAAE,CAAC;QACzB,IAAI,CAAC,kBAAkB,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,sBAAsB,CAAC,CAAC;IAC1F,CAAC;IAED,MAAM,QAAQ,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,0CAAE,UAAU,CAAC;IAC3C,MAAM,OAAO,GAAG,iBAAiB,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IAC9D,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,KAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;QACrC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IAC1B,CAAC;SAAM,IAAI,WAAW,KAAK,eAAe,CAAC,SAAS,EAAE,CAAC;QACnD,qEAAqE;QACrE,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IAC1B,CAAC;SAAM,IAAI,QAAQ,EAAE,CAAC;QAClB,kFAAkF;QAClF,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IAC1B,CAAC;SAAM,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACzB,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { Context, FetchContentResult } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* Default fetchContent function, built with params from imports.
|
|
4
|
-
* It runs custom content-type-specific guillotine calls against an XP guillotine endpoint, returns content data, error and some meta data
|
|
5
|
-
* Sends one query to the guillotine API and asks for content type, then uses the type to select a second query and variables, which is sent to the API and fetches content data.
|
|
6
|
-
* @param context object from Next, contains .query info
|
|
7
|
-
* @returns FetchContentResult object: {data?: T, error?: {code, message}}
|
|
8
|
-
*/
|
|
9
|
-
export declare function fetchContent(context: Context): Promise<FetchContentResult>;
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
import { draftMode, headers } from 'next/headers';
|
|
11
|
-
import { ComponentRegistry } from '../common/ComponentRegistry';
|
|
12
|
-
import { PAGE_TEMPLATE_CONTENTTYPE_NAME, PAGE_TEMPLATE_FOLDER, RENDER_MODE, XP_COMPONENT_TYPE, XP_REQUEST_TYPE, } from '../common/constants';
|
|
13
|
-
import { APP_NAME, APP_NAME_DASHED, IS_DEV_MODE } from '../common/env';
|
|
14
|
-
import { getContentApiUrl } from '../utils/getContentApiUrl';
|
|
15
|
-
import { getLocaleMapping } from '../utils/getLocaleMapping';
|
|
16
|
-
import { getRenderMode } from '../utils/getRenderMode';
|
|
17
|
-
import { getXpBaseUrl } from '../utils/getXpBaseUrl';
|
|
18
|
-
import { getRequestLocaleInfo } from '../utils/getRequestLocaleInfo';
|
|
19
|
-
import { buildGuillotineRequestHeaders } from '../utils/buildGuillotineRequestHeaders';
|
|
20
|
-
import { buildPage } from './buildPage';
|
|
21
|
-
import { fetchMetaData } from './fetchMetaData';
|
|
22
|
-
import { getCleanContentPathArrayOrThrow400 } from './getCleanContentPathArrayOrThrow400';
|
|
23
|
-
import { buildErrorResponse } from './buildErrorResponse';
|
|
24
|
-
import { getContentAndComponentPaths } from './getContentAndComponentPaths';
|
|
25
|
-
import { restrictComponentsToPath } from './restrictComponentsToPath';
|
|
26
|
-
import { processComponentConfig } from './processComponentConfig';
|
|
27
|
-
import { getQueryAndVariables } from './getQueryAndVariables';
|
|
28
|
-
import { collectComponentDescriptors } from './collectComponentDescriptors';
|
|
29
|
-
import { combineMultipleQueries } from './combineMultipleQueries';
|
|
30
|
-
import { fetchContentData } from './fetchContentData';
|
|
31
|
-
import { applyProcessors } from './applyProcessors';
|
|
32
|
-
import { createMetaData } from './createMetaData';
|
|
33
|
-
/**
|
|
34
|
-
* Default fetchContent function, built with params from imports.
|
|
35
|
-
* It runs custom content-type-specific guillotine calls against an XP guillotine endpoint, returns content data, error and some meta data
|
|
36
|
-
* Sends one query to the guillotine API and asks for content type, then uses the type to select a second query and variables, which is sent to the API and fetches content data.
|
|
37
|
-
* @param context object from Next, contains .query info
|
|
38
|
-
* @returns FetchContentResult object: {data?: T, error?: {code, message}}
|
|
39
|
-
*/
|
|
40
|
-
export function fetchContent(context) {
|
|
41
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
42
|
-
var _a, _b;
|
|
43
|
-
const { locale, locales, defaultLocale } = getRequestLocaleInfo(context);
|
|
44
|
-
const { isEnabled } = yield draftMode();
|
|
45
|
-
// we only want to read headers in draft mode, because they bail out static generation
|
|
46
|
-
if (isEnabled) {
|
|
47
|
-
const allHeaders = yield headers();
|
|
48
|
-
if (!context.headers) {
|
|
49
|
-
context.headers = new Headers();
|
|
50
|
-
}
|
|
51
|
-
allHeaders.forEach((value, key) => {
|
|
52
|
-
context.headers.set(key, value);
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
const outHeaders = buildGuillotineRequestHeaders({
|
|
56
|
-
context,
|
|
57
|
-
defaultLocale,
|
|
58
|
-
locale,
|
|
59
|
-
locales,
|
|
60
|
-
});
|
|
61
|
-
const xpBaseUrl = getXpBaseUrl(context);
|
|
62
|
-
const contentApiUrl = getContentApiUrl(context);
|
|
63
|
-
const mapping = getLocaleMapping(context);
|
|
64
|
-
const renderMode = getRenderMode(context);
|
|
65
|
-
let requestType = XP_REQUEST_TYPE.TYPE;
|
|
66
|
-
const requestContentPath = getCleanContentPathArrayOrThrow400(context.contentPath);
|
|
67
|
-
try {
|
|
68
|
-
const [siteRelativeContentPath, componentPath] = getContentAndComponentPaths(requestContentPath);
|
|
69
|
-
if (componentPath) {
|
|
70
|
-
// set component request type because url contains component path
|
|
71
|
-
requestType = XP_REQUEST_TYPE.COMPONENT;
|
|
72
|
-
}
|
|
73
|
-
// ///////////// FIRST GUILLOTINE CALL FOR METADATA /////////////////
|
|
74
|
-
const metaResult = yield fetchMetaData(contentApiUrl, '${site}/' + siteRelativeContentPath, mapping, outHeaders);
|
|
75
|
-
// ///////////////////////////////////////////////////////////////////////
|
|
76
|
-
const { _id, _path, type } = metaResult.meta || {};
|
|
77
|
-
const contentPath = _path || siteRelativeContentPath;
|
|
78
|
-
const errorResponse = buildErrorResponse(requestType, renderMode, contentApiUrl, xpBaseUrl, locale, defaultLocale, requestContentPath, _id);
|
|
79
|
-
if (metaResult.error) {
|
|
80
|
-
console.error(metaResult.error);
|
|
81
|
-
return errorResponse(metaResult.error.code, metaResult.error.message);
|
|
82
|
-
}
|
|
83
|
-
if (!metaResult.meta) {
|
|
84
|
-
return errorResponse('404', 'No meta data found for content, most likely content does not exist');
|
|
85
|
-
}
|
|
86
|
-
else if (!type) {
|
|
87
|
-
return errorResponse('500', "Server responded with incomplete meta data: missing content 'type' attribute.");
|
|
88
|
-
}
|
|
89
|
-
else if (renderMode === RENDER_MODE.NEXT
|
|
90
|
-
&& !IS_DEV_MODE
|
|
91
|
-
&& (type === PAGE_TEMPLATE_CONTENTTYPE_NAME ||
|
|
92
|
-
type === PAGE_TEMPLATE_FOLDER)) {
|
|
93
|
-
return errorResponse('404', `Content type [${type}] is not accessible in ${renderMode} mode`);
|
|
94
|
-
}
|
|
95
|
-
const components = restrictComponentsToPath(type, metaResult.meta.components, componentPath);
|
|
96
|
-
if (componentPath && !components.length) {
|
|
97
|
-
// component was not found
|
|
98
|
-
return errorResponse('404', `Component ${componentPath} was not found`);
|
|
99
|
-
}
|
|
100
|
-
if (requestType !== XP_REQUEST_TYPE.COMPONENT && components.length > 0) {
|
|
101
|
-
requestType = XP_REQUEST_TYPE.PAGE;
|
|
102
|
-
}
|
|
103
|
-
// ////////////////////////////////////////////////// Content type established. Proceed to data call:
|
|
104
|
-
const allDescriptors = [];
|
|
105
|
-
// Add the content type query at all cases
|
|
106
|
-
const contentTypeDef = ComponentRegistry.getContentType(type);
|
|
107
|
-
const pageCmp = (components || []).find(cmp => cmp.type === XP_COMPONENT_TYPE.PAGE);
|
|
108
|
-
if (pageCmp) {
|
|
109
|
-
processComponentConfig(APP_NAME, APP_NAME_DASHED, pageCmp);
|
|
110
|
-
}
|
|
111
|
-
const contentQueryAndVars = getQueryAndVariables(type, contentPath, context, contentTypeDef === null || contentTypeDef === void 0 ? void 0 : contentTypeDef.query, (_a = pageCmp === null || pageCmp === void 0 ? void 0 : pageCmp.page) === null || _a === void 0 ? void 0 : _a.config);
|
|
112
|
-
if (contentQueryAndVars) {
|
|
113
|
-
allDescriptors.push({
|
|
114
|
-
type: contentTypeDef,
|
|
115
|
-
queryAndVariables: contentQueryAndVars,
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
const commonQueryAndVars = getQueryAndVariables(type, contentPath, context, ComponentRegistry.getCommonQuery(), (_b = pageCmp === null || pageCmp === void 0 ? void 0 : pageCmp.page) === null || _b === void 0 ? void 0 : _b.config);
|
|
119
|
-
if (commonQueryAndVars) {
|
|
120
|
-
allDescriptors.push({
|
|
121
|
-
type: contentTypeDef,
|
|
122
|
-
queryAndVariables: commonQueryAndVars,
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
if ((components === null || components === void 0 ? void 0 : components.length) && ComponentRegistry) {
|
|
126
|
-
for (const cmp of (components || [])) {
|
|
127
|
-
processComponentConfig(APP_NAME, APP_NAME_DASHED, cmp);
|
|
128
|
-
}
|
|
129
|
-
// Collect component queries if defined
|
|
130
|
-
const componentDescriptors = collectComponentDescriptors({
|
|
131
|
-
components,
|
|
132
|
-
xpContentPath: contentPath,
|
|
133
|
-
context,
|
|
134
|
-
});
|
|
135
|
-
if (componentDescriptors.length) {
|
|
136
|
-
allDescriptors.push(...componentDescriptors);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
const { query, variables } = combineMultipleQueries(allDescriptors);
|
|
140
|
-
if (!query.trim()) {
|
|
141
|
-
return errorResponse('400', `Missing or empty query override for content type ${type}`);
|
|
142
|
-
}
|
|
143
|
-
// /////////////// SECOND GUILLOTINE CALL FOR DATA //////////////////////
|
|
144
|
-
const contentResults = yield fetchContentData(contentApiUrl, contentPath, mapping, query, variables, outHeaders);
|
|
145
|
-
// ///////////////////////////////////////////////////////////////////////////
|
|
146
|
-
if (contentResults.error) {
|
|
147
|
-
console.error(contentResults.error);
|
|
148
|
-
return errorResponse(contentResults.error.code, contentResults.error.message);
|
|
149
|
-
}
|
|
150
|
-
// Apply processors to every component
|
|
151
|
-
const datas = yield applyProcessors(allDescriptors, contentResults, context);
|
|
152
|
-
// Unwind the data back to components
|
|
153
|
-
let contentData = null, common = null;
|
|
154
|
-
let startFrom = 0;
|
|
155
|
-
if (contentQueryAndVars) {
|
|
156
|
-
const item = datas[startFrom];
|
|
157
|
-
contentData = item.status === 'fulfilled' ? item.value : item.reason;
|
|
158
|
-
startFrom++;
|
|
159
|
-
}
|
|
160
|
-
if (commonQueryAndVars) {
|
|
161
|
-
const item = datas[startFrom];
|
|
162
|
-
common = item.status === 'fulfilled' ? item.value : item.reason;
|
|
163
|
-
startFrom++;
|
|
164
|
-
}
|
|
165
|
-
for (let i = startFrom; i < datas.length; i++) {
|
|
166
|
-
// component descriptors hold references to components
|
|
167
|
-
// that will later be used for creating page regions
|
|
168
|
-
const datum = datas[i];
|
|
169
|
-
if (datum.status === 'rejected') {
|
|
170
|
-
let reason = datum.reason;
|
|
171
|
-
if (reason instanceof Error) {
|
|
172
|
-
reason = reason.message;
|
|
173
|
-
}
|
|
174
|
-
else if (typeof reason !== 'string') {
|
|
175
|
-
reason = String(reason);
|
|
176
|
-
}
|
|
177
|
-
allDescriptors[i].component.error = reason;
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
allDescriptors[i].component.data = datum.value;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
const page = buildPage(type, components);
|
|
184
|
-
const meta = createMetaData({
|
|
185
|
-
apiUrl: contentApiUrl,
|
|
186
|
-
baseUrl: xpBaseUrl,
|
|
187
|
-
components,
|
|
188
|
-
contentPath: siteRelativeContentPath,
|
|
189
|
-
contentType: type,
|
|
190
|
-
contentId: _id,
|
|
191
|
-
defaultLocale,
|
|
192
|
-
locale,
|
|
193
|
-
pageCmp: page,
|
|
194
|
-
renderMode,
|
|
195
|
-
requestedComponentPath: componentPath,
|
|
196
|
-
requestType,
|
|
197
|
-
});
|
|
198
|
-
return {
|
|
199
|
-
data: contentData,
|
|
200
|
-
common,
|
|
201
|
-
meta,
|
|
202
|
-
page,
|
|
203
|
-
};
|
|
204
|
-
}
|
|
205
|
-
catch (e) {
|
|
206
|
-
console.error(e);
|
|
207
|
-
let error;
|
|
208
|
-
try {
|
|
209
|
-
error = JSON.parse(e.message);
|
|
210
|
-
}
|
|
211
|
-
catch (e2) {
|
|
212
|
-
error = {
|
|
213
|
-
code: 'Local',
|
|
214
|
-
message: e.message,
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
const errorResponse = buildErrorResponse(requestType, renderMode, contentApiUrl, xpBaseUrl, locale, defaultLocale, requestContentPath);
|
|
218
|
-
return errorResponse(error.code, error.message);
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
//# sourceMappingURL=fetchContent.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetchContent.js","sourceRoot":"","sources":["../src/guillotine/fetchContent.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAC,SAAS,EAAE,OAAO,EAAC,MAAM,cAAc,CAAC;AAChD,OAAO,EAAC,iBAAiB,EAAC,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EACH,8BAA8B,EAC9B,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,eAAe,GAClB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AACrE,OAAO,EAAC,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAC,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAC,YAAY,EAAC,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAC,oBAAoB,EAAC,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAC,6BAA6B,EAAC,MAAM,wCAAwC,CAAC;AAErF,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAC,kCAAkC,EAAC,MAAM,sCAAsC,CAAC;AACxF,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAC,2BAA2B,EAAC,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB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AAC,CAAC,OAAO;iBACrB,CAAC;YACN,CAAC;YACD,MAAM,aAAa,GAAG,kBAAkB,CAAC,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,kBAAkB,CAAC,CAAC;YACvI,OAAO,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACpD,CAAC;IACL,CAAC;CAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import type { ContentApiBaseBodyVariables, ContentResult, LocaleMapping, GuillotineRequestHeaders } from '../types';
|
|
2
|
-
export declare const fetchContentData: <Content = Record<string, unknown>>(contentApiUrl: string, xpContentPath: string, mapping: LocaleMapping, query: string, variables?: ContentApiBaseBodyVariables, headers?: GuillotineRequestHeaders) => Promise<ContentResult>;
|