@enonic/nextjs-adapter 3.2.2 → 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 +41 -22
- 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 +8 -8
- 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 -75
- 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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetchContentPathsForLocale.js","sourceRoot":"","sources":["../src/guillotine/fetchContentPathsForLocale.ts"],"names":[],"mappings":";;;;;;;;;AAGA,OAAO,EAAC,sBAAsB,EAAC,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAC,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAGlD,MAAM,UAAgB,0BAA0B;yDAC5C,IAAY,EACZ,MAAqB,EACrB,QAAgB,sBAAsB,EACtC,KAAK,GAAG,GAAG;QAEX,MAAM,aAAa,GAAG,gBAAgB,CAAC;YACnC,WAAW,EAAE,IAAI;YACjB,MAAM,EAAE,MAAM,CAAC,MAAM;SACxB,CAAC,CAAC;QACH,MAAM,IAAI,GAAuB;YAC7B,KAAK;YACL,SAAS,EAAE;gBACP,IAAI;gBACJ,SAAS,EAAE,WAAW,MAAM,CAAC,IAAI,IAAI;gBACrC,KAAK;aACR;SACJ,CAAC;QACF,OAAO,eAAe,CAAoB,aAAa,EAAE,MAAM,EAAE,EAAC,IAAI,EAAC,CAAC,CAAC,IAAI,CAAC,CAC1E,OAAyB,EAC3B,EAAE;YACA,OAAO,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CACtC,IAAuB,EACvB,KAAU,EACZ,EAAE;;gBACA,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,KAAK,CAAA,MAAA,KAAK,CAAC,IAAI,0CAAE,KAAK,EAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACnF,MAAM,WAAW,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;gBACpD,IAAI,CAAC,IAAI,CAAC;oBACN,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC;oBACnC,MAAM,EAAE,MAAM,CAAC,MAAM;iBACxB,CAAC,CAAC;gBACH,OAAO,IAAI,CAAC;YAChB,CAAC,EAAE,EAAE,CAAC,CAAC;QACX,CAAC,CAAC,CAAC;IACP,CAAC;CAAA"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { FetchOptions, GuillotineResponseJson, LocaleMapping } from '../types';
|
|
2
|
-
/** Generic fetch */
|
|
3
|
-
export declare function fetchFromApi<Data = Record<string, unknown>>(apiUrl: string, mapping: LocaleMapping, options?: FetchOptions): Promise<GuillotineResponseJson>;
|
|
@@ -1,76 +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
|
-
/** Generic fetch */
|
|
11
|
-
export function fetchFromApi(apiUrl, mapping, options) {
|
|
12
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
13
|
-
const opts = {
|
|
14
|
-
method: (options === null || options === void 0 ? void 0 : options.method) || 'POST',
|
|
15
|
-
body: (options === null || options === void 0 ? void 0 : options.body) ? JSON.stringify(options === null || options === void 0 ? void 0 : options.body) : null,
|
|
16
|
-
headers: mergeHeaders(mapping, options === null || options === void 0 ? void 0 : options.headers),
|
|
17
|
-
next: options === null || options === void 0 ? void 0 : options.next,
|
|
18
|
-
cache: options === null || options === void 0 ? void 0 : options.cache,
|
|
19
|
-
};
|
|
20
|
-
let res;
|
|
21
|
-
try {
|
|
22
|
-
res = yield fetch(apiUrl, opts);
|
|
23
|
-
}
|
|
24
|
-
catch (e) {
|
|
25
|
-
console.warn(apiUrl, e);
|
|
26
|
-
throw new Error(JSON.stringify({
|
|
27
|
-
code: 'API',
|
|
28
|
-
message: e.message,
|
|
29
|
-
}));
|
|
30
|
-
}
|
|
31
|
-
if (!res.ok) {
|
|
32
|
-
throw new Error(JSON.stringify({
|
|
33
|
-
code: res.status,
|
|
34
|
-
message: `Data fetching failed (message: '${yield res.text()}')`,
|
|
35
|
-
}));
|
|
36
|
-
}
|
|
37
|
-
let json;
|
|
38
|
-
try {
|
|
39
|
-
json = yield res.json();
|
|
40
|
-
}
|
|
41
|
-
catch (e) {
|
|
42
|
-
throw new Error(JSON.stringify({
|
|
43
|
-
code: 500,
|
|
44
|
-
message: `API call completed but with non-JSON data: ${JSON.stringify(yield res.text())}`,
|
|
45
|
-
}));
|
|
46
|
-
}
|
|
47
|
-
if (!json) {
|
|
48
|
-
throw new Error(JSON.stringify({
|
|
49
|
-
code: 500,
|
|
50
|
-
message: `API call completed but with unexpectedly empty data: ${JSON.stringify(yield res.text())}`,
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
53
|
-
if (Array.isArray(json)) {
|
|
54
|
-
throw new Error(JSON.stringify({
|
|
55
|
-
code: 500,
|
|
56
|
-
message: `API call completed but with unexpected array data: ${JSON.stringify(json)}`,
|
|
57
|
-
}));
|
|
58
|
-
}
|
|
59
|
-
return json;
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
function mergeHeaders(mapping, headers) {
|
|
63
|
-
const newHeaders = new Headers({
|
|
64
|
-
'Accept': 'application/json',
|
|
65
|
-
'Content-Type': 'application/json',
|
|
66
|
-
});
|
|
67
|
-
if (headers) {
|
|
68
|
-
Object.keys(headers).forEach((headersKey) => {
|
|
69
|
-
newHeaders.set(headersKey, headers[headersKey]);
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
// append last to make sure it is not overwritten
|
|
73
|
-
newHeaders.set('X-Guillotine-SiteKey', mapping.site);
|
|
74
|
-
return newHeaders;
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=fetchFromApi.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetchFromApi.js","sourceRoot":"","sources":["../src/guillotine/fetchFromApi.ts"],"names":[],"mappings":";;;;;;;;;AAEA,oBAAoB;AACpB,MAAM,UAAgB,YAAY,CAC9B,MAAc,EACd,OAAsB,EACtB,OAAsB;;QAGtB,MAAM,IAAI,GAAG;YACT,MAAM,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,KAAI,MAAM;YACjC,IAAI,EAAE,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,EAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAC,CA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R,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;gBAC3B,IAAI,EAAE,GAAG;gBACT,OAAO,EAAE,wDAAwD,IAAI,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,EAAE;aACtG,CAAC,CAAC,CAAC;QACR,CAAC;QAED,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;gBAC3B,IAAI,EAAE,GAAG;gBACT,OAAO,EAAE,sDAAsD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE;aACxF,CAAC,CAAC,CAAC;QACR,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CAAA;AAED,SAAS,YAAY,CAAC,OAAsB,EAAE,OAAqB;IAC/D,MAAM,UAAU,GAAG,IAAI,OAAO,CAAC;QAC3B,QAAQ,EAAE,kBAAkB;QAC5B,cAAc,EAAE,kBAAkB;KACrC,CAAC,CAAC;IACH,IAAI,OAAO,EAAE,CAAC;QACV,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;YACxC,UAAU,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACP,CAAC;IACD,iDAAiD;IACjD,UAAU,CAAC,GAAG,CAAC,sBAAsB,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACrD,OAAO,UAAU,CAAC;AACtB,CAAC"}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import type { FetchOptions, GuillotineResult, LocaleMapping } from '../types';
|
|
2
|
-
/** Guillotine-specialized fetch, using the generic fetch above */
|
|
3
|
-
export declare function fetchGuillotine<Data = Record<string, unknown>>(contentApiUrl: string, mapping: LocaleMapping, options?: FetchOptions): Promise<GuillotineResult>;
|
|
@@ -1,75 +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 gqlmin from 'gqlmin';
|
|
11
|
-
import { fetchFromApi } from './fetchFromApi';
|
|
12
|
-
const XP_ERROR_PATTERN = '/_/error/';
|
|
13
|
-
/** Guillotine-specialized fetch, using the generic fetch above */
|
|
14
|
-
export function fetchGuillotine(contentApiUrl, mapping, options) {
|
|
15
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
var _a;
|
|
17
|
-
const body = options === null || options === void 0 ? void 0 : options.body;
|
|
18
|
-
const path = (_a = body === null || body === void 0 ? void 0 : body.variables) === null || _a === void 0 ? void 0 : _a.path;
|
|
19
|
-
if (typeof body.query !== 'string' || !body.query.trim()) {
|
|
20
|
-
return {
|
|
21
|
-
error: {
|
|
22
|
-
code: '400',
|
|
23
|
-
message: `Invalid or missing query. JSON.stringify(query) = ${JSON.stringify(body.query)}`,
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
// special case for not sending XP generated error paths to guillotine
|
|
29
|
-
const pathArr = path === null || path === void 0 ? void 0 : path.split(XP_ERROR_PATTERN);
|
|
30
|
-
if ((pathArr === null || pathArr === void 0 ? void 0 : pathArr.length) === 2) {
|
|
31
|
-
return {
|
|
32
|
-
error: {
|
|
33
|
-
code: pathArr[1],
|
|
34
|
-
message: `XP error URL detected`,
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
// Minify the query to avoid hitting 200k space limit
|
|
40
|
-
body.query = gqlmin(body.query);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
const pathMessage = path ? JSON.stringify(path) : '';
|
|
44
|
-
return yield fetchFromApi(contentApiUrl, mapping, options)
|
|
45
|
-
.then(json => {
|
|
46
|
-
let errors = json.errors; // fetchFromApi ensures json is an object
|
|
47
|
-
if (errors) {
|
|
48
|
-
if (!Array.isArray(errors)) {
|
|
49
|
-
errors = [errors];
|
|
50
|
-
}
|
|
51
|
-
console.error(`${errors.length} error(s) when fetching data from: ${contentApiUrl}`);
|
|
52
|
-
errors.forEach(error => {
|
|
53
|
-
console.error(error);
|
|
54
|
-
});
|
|
55
|
-
return {
|
|
56
|
-
error: {
|
|
57
|
-
code: '500',
|
|
58
|
-
message: `Server responded with ${errors.length} error(s), probably from guillotine - see log.`,
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
return json.data;
|
|
63
|
-
})
|
|
64
|
-
.catch((err) => {
|
|
65
|
-
console.warn(`Client-side error when trying to fetch data ${pathMessage}`, err);
|
|
66
|
-
try {
|
|
67
|
-
return { error: JSON.parse(err.message) };
|
|
68
|
-
}
|
|
69
|
-
catch (e2) {
|
|
70
|
-
return { error: { code: 'Client-side error', message: err.message } };
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=fetchGuillotine.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetchGuillotine.js","sourceRoot":"","sources":["../src/guillotine/fetchGuillotine.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAE5C,MAAM,gBAAgB,GAA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MAAM,GAAU,IAAI,CAAC,MAAM,CAAC,CAAC,yCAAyC;YAE1E,IAAI,MAAM,EAAE,CAAC;gBACT,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;oBACzB,MAAM,GAAG,CAAC,MAAM,CAAC,CAAC;gBACtB,CAAC;gBACD,OAAO,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,sCAAsC,aAAa,EAAE,CAAC,CAAC;gBACrF,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;oBACnB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACzB,CAAC,CAAC,CAAC;gBAEH,OAAO;oBACH,KAAK,EAAE;wBACH,IAAI,EAAE,KAAK;wBACX,OAAO,EAAE,yBAAyB,MAAM,CAAC,MAAM,gDAAgD;qBAClG;iBACJ,CAAC;YACN,CAAC;YAED,OAAO,IAAI,CAAC,IAAI,CAAC;QACrB,CAAC,CAAC;aACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACX,OAAO,CAAC,IAAI,CAAC,+CAA+C,WAAW,EAAE,EAAE,GAAG,CAAC,CAAC;YAChF,IAAI,CAAC;gBACD,OAAO,EAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,EAAC,CAAC;YAC5C,CAAC;YAAC,OAAO,EAAE,EAAE,CAAC;gBACV,OAAO,EAAC,KAAK,EAAE,EAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAC,EAAC,CAAC;YACtE,CAAC;QACL,CAAC,CAAC,CAAC;IACX,CAAC;CAAA"}
|
|
@@ -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 { getMetaQuery, pageFragmentQuery } from './getMetaData';
|
|
11
|
-
import { fetchGuillotine } from './fetchGuillotine';
|
|
12
|
-
export const fetchMetaData = (contentApiUrl, xpContentPath, mapping, headers) => __awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
-
var _a;
|
|
14
|
-
const body = {
|
|
15
|
-
query: getMetaQuery(pageFragmentQuery()),
|
|
16
|
-
variables: {
|
|
17
|
-
path: xpContentPath,
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
const metaResult = yield fetchGuillotine(contentApiUrl, mapping, {
|
|
21
|
-
body,
|
|
22
|
-
headers,
|
|
23
|
-
});
|
|
24
|
-
if (metaResult.error) {
|
|
25
|
-
return metaResult;
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
return {
|
|
29
|
-
meta: (_a = metaResult === null || metaResult === void 0 ? void 0 : metaResult.guillotine) === null || _a === void 0 ? void 0 : _a.get,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
//# sourceMappingURL=fetchMetaData.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"fetchMetaData.js","sourceRoot":"","sources":["../src/guillotine/fetchMetaData.ts"],"names":[],"mappings":";;;;;;;;;AAGA,OAAO,EAAC,YAAY,EAAE,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAGlD,MAAM,CAAC,MAAM,aAAa,GAAG,CACzB,aAAqB,EACrB,aAAqB,EACrB,OAAsB,EACtB,OAAkC,EACf,EAAE;;IACrB,MAAM,IAAI,GAAuB;QAC7B,KAAK,EAAE,YAAY,CAAC,iBAAiB,EAAE,CAAC;QACxC,SAAS,EAAE;YACP,IAAI,EAAE,aAAa;SACtB;KACJ,CAAC;IACF,MAAM,UAAU,GAAG,MAAM,eAAe,CAAa,aAAa,EAAE,OAAO,EAAE;QACzE,IAAI;QACJ,OAAO;KACV,CAAC,CAAC;IACH,IAAI,UAAU,CAAC,KAAK,EAAE,CAAC;QACnB,OAAO,UAAU,CAAC;IACtB,CAAC;SAAM,CAAC;QACJ,OAAO;YACH,IAAI,EAAE,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,UAAU,0CAAE,GAAG;SACpC,CAAC;IACN,CAAC;AACL,CAAC,CAAA,CAAC"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/** Checks a site-relative contentPath as a slash-delimited string or a string array, and returns a pure site-relative path string (no double slashes, starts with a slash, does not end with one). */
|
|
2
|
-
export declare const getCleanContentPathArrayOrThrow400: (contentPath: string | string[] | undefined) => string;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/** Checks a site-relative contentPath as a slash-delimited string or a string array, and returns a pure site-relative path string (no double slashes, starts with a slash, does not end with one). */
|
|
2
|
-
export const getCleanContentPathArrayOrThrow400 = (contentPath) => {
|
|
3
|
-
if (contentPath === undefined) {
|
|
4
|
-
return '';
|
|
5
|
-
}
|
|
6
|
-
const isArray = Array.isArray(contentPath);
|
|
7
|
-
if (!isArray) {
|
|
8
|
-
if (typeof contentPath !== 'string') {
|
|
9
|
-
throw Error(JSON.stringify({
|
|
10
|
-
code: 400,
|
|
11
|
-
message: `Unexpected target content _path: contentPath must be a string or pure string array (contentPath=${JSON.stringify(contentPath)})`,
|
|
12
|
-
}));
|
|
13
|
-
}
|
|
14
|
-
return contentPath;
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
return (contentPath).join('/');
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=getCleanContentPathArrayOrThrow400.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCleanContentPathArrayOrThrow400.js","sourceRoot":"","sources":["../src/guillotine/getCleanContentPathArrayOrThrow400.ts"],"names":[],"mappings":"AAAA,sMAAsM;AACtM,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,WAA0C,EAAU,EAAE;IACrG,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC5B,OAAO,EAAE,CAAC;IACd,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAE3C,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE,CAAC;YAClC,MAAM,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;gBACvB,IAAI,EAAE,GAAG;gBACT,OAAO,EAAE,mGAAmG,IAAI,CAAC,SAAS,CACtH,WAAW,CAAC,GAAG;aACtB,CAAC,CAAC,CAAC;QACR,CAAC;QAED,OAAO,WAAW,CAAC;IAEvB,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getComponentConfig.js","sourceRoot":"","sources":["../src/guillotine/getComponentConfig.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,kBAAkB,CAAC,GAAmB;IAClD,MAAM,OAAO,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrC,OAAO,OAAO,IAAI,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AACvE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getContentAndComponentPaths: (requestPath: string) => string[];
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const COMPONENT_PATH_KEY = /\/?_\/component/; // first slash is optional for root components
|
|
2
|
-
export const getContentAndComponentPaths = (requestPath) => {
|
|
3
|
-
let contentPath, componentPath;
|
|
4
|
-
if (COMPONENT_PATH_KEY.test(requestPath)) {
|
|
5
|
-
[contentPath, componentPath] = requestPath.split(COMPONENT_PATH_KEY);
|
|
6
|
-
}
|
|
7
|
-
else {
|
|
8
|
-
contentPath = requestPath;
|
|
9
|
-
}
|
|
10
|
-
return [contentPath, componentPath];
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=getContentAndComponentPaths.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getContentAndComponentPaths.js","sourceRoot":"","sources":["../src/guillotine/getContentAndComponentPaths.ts"],"names":[],"mappings":"AAAA,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,CAAG,8CAA8C;AAE9F,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,WAAmB,EAAY,EAAE;IACzE,IAAI,WAAW,EAAE,aAAa,CAAC;IAC/B,IAAI,kBAAkB,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;QACvC,CAAC,WAAW,EAAE,aAAa,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACzE,CAAC;SAAM,CAAC;QACJ,WAAW,GAAG,WAAW,CAAC;IAC9B,CAAC;IACD,OAAO,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;AACxC,CAAC,CAAC"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { ComponentRegistry } from '../common/ComponentRegistry';
|
|
2
|
-
import { configQuery } from './metadata/configQuery';
|
|
3
|
-
import { richTextQuery } from './metadata/richTextQuery';
|
|
4
|
-
import { indent } from '../utils/indent';
|
|
5
|
-
const partConfigQuery = () => {
|
|
6
|
-
return configQuery(ComponentRegistry.getParts());
|
|
7
|
-
};
|
|
8
|
-
const layoutConfigQuery = () => {
|
|
9
|
-
return configQuery(ComponentRegistry.getLayouts());
|
|
10
|
-
};
|
|
11
|
-
const pageConfigQuery = () => {
|
|
12
|
-
return configQuery(ComponentRegistry.getPages());
|
|
13
|
-
};
|
|
14
|
-
/*
|
|
15
|
-
IMPORTANT: make sure to transform your queries into functions too when using this function inside them !!!
|
|
16
|
-
*/
|
|
17
|
-
const componentsQuery = () => `type
|
|
18
|
-
path
|
|
19
|
-
page {
|
|
20
|
-
descriptor
|
|
21
|
-
${indent(pageConfigQuery(), 4)}
|
|
22
|
-
template {
|
|
23
|
-
_path
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
layout {
|
|
27
|
-
descriptor
|
|
28
|
-
${indent(layoutConfigQuery(), 4)}
|
|
29
|
-
}
|
|
30
|
-
text {
|
|
31
|
-
${indent(richTextQuery('value'), 4)}
|
|
32
|
-
}
|
|
33
|
-
part {
|
|
34
|
-
descriptor
|
|
35
|
-
${indent(partConfigQuery(), 4)}
|
|
36
|
-
}
|
|
37
|
-
image {
|
|
38
|
-
caption
|
|
39
|
-
image {
|
|
40
|
-
imageUrl (type:absolute, scale: "width-768")
|
|
41
|
-
}
|
|
42
|
-
}`;
|
|
43
|
-
// THIS QUERY DOES NOT SUPPORT NESTED FRAGMENTS
|
|
44
|
-
export const pageFragmentQuery = () => `components(resolveFragment: false, resolveTemplate: true) {
|
|
45
|
-
fragment {
|
|
46
|
-
id
|
|
47
|
-
fragment {
|
|
48
|
-
components {
|
|
49
|
-
${indent(componentsQuery(), 16)}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
${indent(componentsQuery(), 4)}
|
|
54
|
-
}`;
|
|
55
|
-
export function getMetaQuery(pageFragment) {
|
|
56
|
-
return `query($path:ID!) {
|
|
57
|
-
guillotine {
|
|
58
|
-
get(key:$path) {
|
|
59
|
-
_id
|
|
60
|
-
_path
|
|
61
|
-
type
|
|
62
|
-
${indent(pageFrag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AAe,EAAE,EAAC,CAAC,CAAC;EAC3B,CAAC;AAEH,MAAM,UAAU,YAAY,CAAC,YAAqB;IAC9C,OAAO;;;;;;EAMT,MAAM,CAAC,YAAY,IAAI,EAAE,EAAE,EAAE,CAAC;;;EAG9B,CAAC;AACH,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { XP_COMPONENT_TYPE } from '../common/constants';
|
|
2
|
-
import { prefixFragmentCmpPath } from './prefixFragmentCmpPath';
|
|
3
|
-
export function getParentRegion(source, contentType, cmpPath, components = [], createMissing) {
|
|
4
|
-
let currentTree = source;
|
|
5
|
-
let currentRegion;
|
|
6
|
-
let parentPath = '';
|
|
7
|
-
for (let i = 0; i < cmpPath.length; i++) {
|
|
8
|
-
const pathFragment = cmpPath[i];
|
|
9
|
-
const regionName = pathFragment.region;
|
|
10
|
-
parentPath += `/${pathFragment.region}/${pathFragment.index}`;
|
|
11
|
-
currentRegion = currentTree[regionName];
|
|
12
|
-
if (!currentRegion) {
|
|
13
|
-
if (createMissing) {
|
|
14
|
-
currentRegion = {
|
|
15
|
-
name: regionName,
|
|
16
|
-
components: [],
|
|
17
|
-
};
|
|
18
|
-
currentTree[regionName] = currentRegion;
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
throw new Error(`Region [${regionName}] was not found`);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
if (i < cmpPath.length - 1) {
|
|
25
|
-
// look for layouts inside if this is not the last path fragment
|
|
26
|
-
const layout = components.find((cmp) => {
|
|
27
|
-
return cmp.type === XP_COMPONENT_TYPE.LAYOUT && prefixFragmentCmpPath(contentType, cmp.path) === parentPath;
|
|
28
|
-
});
|
|
29
|
-
if (!layout) {
|
|
30
|
-
throw new Error(`Layout [${parentPath}] not found among components, but needed for component [${JSON.stringify(cmpPath, null, 2)}]`);
|
|
31
|
-
}
|
|
32
|
-
if (!layout.regions) {
|
|
33
|
-
layout.regions = {};
|
|
34
|
-
}
|
|
35
|
-
currentTree = layout.regions;
|
|
36
|
-
}
|
|
37
|
-
} // for
|
|
38
|
-
return currentRegion;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=getParentRegion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getParentRegion.js","sourceRoot":"","sources":["../src/guillotine/getParentRegion.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAG9D,MAAM,UAAU,eAAe,CAC3B,MAAkB,EAClB,WAAmB,EACnB,OAAuB,EACvB,aAA8B,EAAE,EAChC,aAAyB;IAEzB,IAAI,WAAW,GAAe,MAAM,CAAC;IACrC,IAAI,aAAqC,CAAC;IAC1C,IAAI,UAAU,GAAG,EAAE,CAAC;IAEpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QAChC,MAAM,UAAU,GAAG,YAAY,CAAC,MAAM,CAAC;QACvC,UAAU,IAAI,IAAI,YAAY,CAAC,MAAM,IAAI,YAAY,CAAC,KAAK,EAAE,CAAC;QAC9D,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;QAExC,IAAI,CAAC,aAAa,EAAE,CAAC;YACjB,IAAI,aAAa,EAAE,CAAC;gBAChB,aAAa,GAAG;oBACZ,IAAI,EAAE,UAAU;oBAChB,UAAU,EAAE,EAAE;iBACjB,CAAC;gBACF,WAAW,CAAC,UAAU,CAAC,GAAG,aAAa,CAAC;YAC5C,CAAC;iBAAM,CAAC;gBACJ,MAAM,IAAI,KAAK,CAAC,WAAW,UAAU,iBAAiB,CAAC,CAAC;YAC5D,CAAC;QACL,CAAC;QAED,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACzB,gEAAgE;YAEhE,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,GAAkB,EAAE,EAAE;gBAClD,OAAO,GAAG,CAAC,IAAI,KAAK,iBAAiB,CAAC,MAAM,IAAI,qBAAqB,CAAC,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC;YAChH,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,MAAM,EAAE,CAAC;gBACV,MAAM,IAAI,KAAK,CAAC,WAAW,UAAU,2DAA2D,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;YACzI,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBAClB,MAAM,CAAC,OAAO,GAAG,EAAE,CAAC;YACxB,CAAC;YACD,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC;QACjC,CAAC;IACL,CAAC,CAAC,MAAM;IAER,OAAO,aAAa,CAAC;AACzB,CAAC"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import type { Context, QueryAndVariables, SelectedQueryMaybeVariablesFunc } from '../types';
|
|
2
|
-
export declare function getQueryAndVariables(type: string, path: string, context: Context, selectedQuery?: SelectedQueryMaybeVariablesFunc, config?: any): QueryAndVariables | undefined;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export function getQueryAndVariables(type, path, context, selectedQuery, config) {
|
|
2
|
-
let query, getVariables;
|
|
3
|
-
if (typeof selectedQuery === 'string' || typeof selectedQuery === 'function') {
|
|
4
|
-
query = selectedQuery;
|
|
5
|
-
}
|
|
6
|
-
else if (Array.isArray(selectedQuery)) {
|
|
7
|
-
query = selectedQuery[0];
|
|
8
|
-
getVariables = selectedQuery[1];
|
|
9
|
-
}
|
|
10
|
-
else if (typeof selectedQuery === 'object') {
|
|
11
|
-
query = selectedQuery.query;
|
|
12
|
-
getVariables = selectedQuery.variables;
|
|
13
|
-
}
|
|
14
|
-
if (getVariables && typeof getVariables !== 'function') {
|
|
15
|
-
throw Error(`getVariables for content type ${type} should be a function, not: ${typeof getVariables}`);
|
|
16
|
-
}
|
|
17
|
-
if (query && typeof query !== 'string' && typeof query !== 'function') {
|
|
18
|
-
throw Error(`Query for content type ${type} should be a string or function, not: ${typeof query}`);
|
|
19
|
-
}
|
|
20
|
-
if (typeof query === 'function') {
|
|
21
|
-
query = query(path, context, config);
|
|
22
|
-
}
|
|
23
|
-
if (query) {
|
|
24
|
-
return {
|
|
25
|
-
query,
|
|
26
|
-
variables: getVariables ? getVariables(path, context, config) : {
|
|
27
|
-
path,
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
//# sourceMappingURL=getQueryAndVariables.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getQueryAndVariables.js","sourceRoot":"","sources":["../src/guillotine/getQueryAndVariables.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,oBAAoB,CAChC,IAAY,EACZ,IAAY,EACZ,OAAgB,EAChB,aAA+C,EAC/C,MAAY;IAGZ,IAAI,KAAK,EAAE,YAAY,CAAC;IAExB,IACI,OAAO,aAAa,KAAK,QAAQ,IAAI,OAAO,aAAa,KAAK,UAAU,EAC1E,CAAC;QACC,KAAK,GAAG,aAAa,CAAC;IAE1B,CAAC;SAAM,IAAI,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC;QACtC,KAAK,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;QACzB,YAAY,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;IAEpC,CAAC;SAAM,IAAI,OAAO,aAAa,KAAK,QAAQ,EAAE,CAAC;QAC3C,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC;QAC5B,YAAY,GAAG,aAAa,CAAC,SAAS,CAAC;IAC3C,CAAC;IAED,IAAI,YAAY,IAAI,OAAO,YAAY,KAAK,UAAU,EAAE,CAAC;QACrD,MAAM,KAAK,CAAC,iCAAiC,IAAI,+BAA+B,OAAO,YAAY,EAAE,CAAC,CAAC;IAC3G,CAAC;IAED,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;QACpE,MAAM,KAAK,CAAC,0BAA0B,IAAI,yCAAyC,OAAO,KAAK,EAAE,CAAC,CAAC;IACvG,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,UAAU,EAAE,CAAC;QAC9B,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,KAAK,EAAE,CAAC;QACR,OAAO;YACH,KAAK;YACL,SAAS,EAAE,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;gBAC5D,IAAI;aACP;SACJ,CAAC;IACN,CAAC;AACL,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { sanitizeGraphqlName } from '../../utils/sanitizeGraphqlName';
|
|
2
|
-
export const configQuery = (list, includeAppName = true, canUseConfigAsJson = true) => {
|
|
3
|
-
const hasQueryList = (list === null || list === void 0 ? void 0 : list.filter(([key, def]) => def.configQuery)) || [];
|
|
4
|
-
if (hasQueryList.length === 0) {
|
|
5
|
-
return canUseConfigAsJson ? 'configAsJson' : '';
|
|
6
|
-
}
|
|
7
|
-
const configsByApp = {};
|
|
8
|
-
hasQueryList
|
|
9
|
-
.forEach((entry) => {
|
|
10
|
-
const nameParts = entry[0].split(':');
|
|
11
|
-
if (nameParts.length === 2) {
|
|
12
|
-
const sanitizedAppName = sanitizeGraphqlName(nameParts[0]);
|
|
13
|
-
let existingConfigs = configsByApp[sanitizedAppName];
|
|
14
|
-
if (!existingConfigs) {
|
|
15
|
-
existingConfigs = [];
|
|
16
|
-
configsByApp[sanitizedAppName] = existingConfigs;
|
|
17
|
-
}
|
|
18
|
-
existingConfigs.push(`${sanitizeGraphqlName(nameParts[1])}${entry[1].configQuery}`);
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
// Still query for configAsJson if at least one item has no configQuery defined
|
|
22
|
-
const configAsJsonQuery = canUseConfigAsJson && hasQueryList.length < list.length ? 'configAsJson' : '';
|
|
23
|
-
if (!includeAppName) {
|
|
24
|
-
return `${configAsJsonQuery}
|
|
25
|
-
config {
|
|
26
|
-
${Object.values(configsByApp).reduce((arr, curr) => arr.concat(curr), []).join('\n')}
|
|
27
|
-
}`;
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
return `${configAsJsonQuery}
|
|
31
|
-
config {
|
|
32
|
-
${Object.entries(configsByApp).map(entry => entry[0] + '{\n' + entry[1].join('\n') + '\n}')}
|
|
33
|
-
}`;
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
//# sourceMappingURL=configQuery.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configQuery.js","sourceRoot":"","sources":["../../src/guillotine/metadata/configQuery.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,mBAAmB,EAAC,MAAM,iCAAiC,CAAC;AAGpE,MAAM,CAAC,MAAM,WAAW,GAAG,CACvB,IAAqC,EACrC,cAAc,GAAG,IAAI,EACrB,kBAAkB,GAAG,IAAI,EACnB,EAAE;IACR,MAAM,YAAY,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,WAAW,CAAC,KAAI,EAAE,CAAC;IACzE,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,kBAAkB,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC;IACpD,CAAC;IAED,MAAM,YAAY,GAA4B,EAAE,CAAC;IACjD,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CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;kBAC7F,CAAC;IACf,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const richTextQuery: (fieldName: string) => string;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { ComponentRegistry } from '../../common/ComponentRegistry';
|
|
2
|
-
import { configQuery } from './configQuery';
|
|
3
|
-
import { indent } from '../../utils/indent';
|
|
4
|
-
const macroConfigQuery = () => {
|
|
5
|
-
return configQuery(ComponentRegistry.getMacros(), false, false);
|
|
6
|
-
};
|
|
7
|
-
export const richTextQuery = (fieldName) => {
|
|
8
|
-
return `${fieldName}(processHtml:{type:absolute, imageWidths:[400, 800, 1200], imageSizes:"(max-width: 400px) 400px, (max-width: 800px) 800px, 1200px"}) {
|
|
9
|
-
processedHtml
|
|
10
|
-
macros {
|
|
11
|
-
ref
|
|
12
|
-
name
|
|
13
|
-
descriptor
|
|
14
|
-
${indent(macroConfigQuery(), 8)}
|
|
15
|
-
}
|
|
16
|
-
links {
|
|
17
|
-
ref
|
|
18
|
-
uri
|
|
19
|
-
content {
|
|
20
|
-
_id
|
|
21
|
-
}
|
|
22
|
-
media {
|
|
23
|
-
content {
|
|
24
|
-
_id
|
|
25
|
-
... on media_Image {
|
|
26
|
-
mediaUrl(type: absolute)
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
intent
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
images {
|
|
33
|
-
ref
|
|
34
|
-
image {
|
|
35
|
-
_id
|
|
36
|
-
... on media_Image {
|
|
37
|
-
imageUrl(scale: "width(768)", type:absolute)
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
style {
|
|
41
|
-
name
|
|
42
|
-
aspectRatio
|
|
43
|
-
filter
|
|
44
|
-
}
|
|
45
|
-
}}`;
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=richTextQuery.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"richTextQuery.js","sourceRoot":"","sources":["../../src/guillotine/metadata/richTextQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,EAAC,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAC;AAG1C,MAAM,gBAAgB,GAAG,GAAW,EAAE;IAClC,OAAO,WAAW,CAAC,iBAAiB,CAAC,SAAS,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AACpE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,SAAiB,EAAE,EAAE;IAC/C,OAAO,GAAG,SAAS;;;;;;UAMb,MAAM,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BhC,CAAC;AACR,CAAC,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { FRAGMENT_CONTENTTYPE_NAME, FRAGMENT_DEFAULT_REGION_NAME, } from '../common/constants';
|
|
2
|
-
export function parseComponentPath(contentType, path) {
|
|
3
|
-
const matches = [];
|
|
4
|
-
let match;
|
|
5
|
-
const myRegexp = /(?:(\w+)\/(\d+))+/g;
|
|
6
|
-
while ((match = myRegexp.exec(path)) !== null) {
|
|
7
|
-
matches.push({
|
|
8
|
-
region: match[1],
|
|
9
|
-
index: +match[2],
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
if (contentType === FRAGMENT_CONTENTTYPE_NAME) {
|
|
13
|
-
// there is no main region in fragment content and the root component has '/' path
|
|
14
|
-
// prepend FRAGMENT_DEFAULT_REGION_NAME to path to conform to page structure
|
|
15
|
-
matches.unshift({
|
|
16
|
-
region: FRAGMENT_DEFAULT_REGION_NAME,
|
|
17
|
-
index: 0,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return matches;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=parseComponentPath.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parseComponentPath.js","sourceRoot":"","sources":["../src/guillotine/parseComponentPath.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,yBAAyB,EACzB,4BAA4B,GAC/B,MAAM,qBAAqB,CAAC;AAG7B,MAAM,UAAU,kBAAkB,CAAC,WAAmB,EAAE,IAAY;IAChE,MAAM,OAAO,GAAmB,EAAE,CAAC;IACnC,IAAI,KAAK,CAAC;IACV,MAAM,QAAQ,GAAG,oBAAoB,CAAC;IACtC,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC5C,OAAO,CAAC,IAAI,CAAC;YACT,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;YAChB,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;SACnB,CAAC,CAAC;IACP,CAAC;IACD,IAAI,WAAW,KAAK,yBAAyB,EAAE,CAAC;QAC5C,kFAAkF;QAClF,4EAA4E;QAC5E,OAAO,CAAC,OAAO,CAAC;YACZ,MAAM,EAAE,4BAA4B;YACpC,KAAK,EAAE,CAAC;SACX,CAAC,CAAC;IACP,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function prefixFragmentCmpPath(contentType: string, path: string): string;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { FRAGMENT_CONTENTTYPE_NAME, FRAGMENT_DEFAULT_REGION_NAME } from '../common/constants';
|
|
2
|
-
export function prefixFragmentCmpPath(contentType, path) {
|
|
3
|
-
if (contentType !== FRAGMENT_CONTENTTYPE_NAME) {
|
|
4
|
-
return path;
|
|
5
|
-
}
|
|
6
|
-
else {
|
|
7
|
-
// prepend FRAGMENT_DEFAULT_REGION_NAME to path to conform to page structure
|
|
8
|
-
// so that component with path '/' becomes /FRAGMENT_DEFAULT_REGION_NAME/0
|
|
9
|
-
// path /left/1 becomes /FRAGMENT_DEFAULT_REGION_NAME/0/left/1
|
|
10
|
-
return `/${FRAGMENT_DEFAULT_REGION_NAME}/0${path === '/' ? '' : path}`;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=prefixFragmentCmpPath.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prefixFragmentCmpPath.js","sourceRoot":"","sources":["../src/guillotine/prefixFragmentCmpPath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,yBAAyB,EAAE,4BAA4B,EAAC,MAAM,qBAAqB,CAAC;AAG5F,MAAM,UAAU,qBAAqB,CAAC,WAAmB,EAAE,IAAY;IACnE,IAAI,WAAW,KAAK,yBAAyB,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC;IAChB,CAAC;SAAM,CAAC;QACJ,4EAA4E;QAC5E,0EAA0E;QAC1E,8DAA8D;QAC9D,OAAO,IAAI,4BAA4B,KAAK,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC3E,CAAC;AACL,CAAC"}
|