@bright.global/arboretum-sdk 0.1.0-rc.4 → 0.1.0-rc.6
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/dist/es6/impl/arboretum-client.impl.js +1 -1
- package/dist/es6/impl/data/page-entries.js +16 -10
- package/dist/es6/impl/data/page-entries.test.js +21 -17
- package/dist/es6/impl/data/sitemap-data.js +11 -13
- package/dist/es6/impl/sitemap/helpers/build-localized-sitemap.js +1 -1
- package/dist/impl/arboretum-client.impl.js +1 -1
- package/dist/impl/data/page-entries.js +16 -10
- package/dist/impl/data/page-entries.test.js +19 -15
- package/dist/impl/data/sitemap-data.js +5 -7
- package/dist/impl/sitemap/helpers/build-localized-sitemap.js +1 -1
- package/dist/types/arboretum-client.d.ts +4 -4
- package/dist/types/impl/data/page-entries.d.ts +5 -1
- package/dist/types/impl/data/sitemap-data.d.ts +8 -8
- package/package.json +1 -1
- package/dist/es6/impl/data/home-page.js +0 -75
- package/dist/impl/data/home-page.js +0 -79
- package/dist/types/impl/data/home-page.d.ts +0 -3
|
@@ -125,7 +125,7 @@ export var createArboretumClient = function (config) { return __awaiter(void 0,
|
|
|
125
125
|
sitemapDataCtx = {
|
|
126
126
|
preview: config.preview,
|
|
127
127
|
clientApi: clientApi,
|
|
128
|
-
options: __assign(__assign({}, options), { includeEntryStatus: includeEntryStatus,
|
|
128
|
+
options: __assign(__assign({}, options), { includeEntryStatus: includeEntryStatus, pageRelations: (_c = config.options) === null || _c === void 0 ? void 0 : _c.pageRelations }),
|
|
129
129
|
localeTagIdPrefix: localeTagIdPrefix,
|
|
130
130
|
pageHomeTagId: options.homePageTagId || pageHomeTagId,
|
|
131
131
|
contentfulClientType: config.type === "cda-client" && config.contentful.client.withAllLocales
|
|
@@ -105,7 +105,7 @@ var cmaOnlyEntriesStatusMap = function (_a, contentfulClientType, options) {
|
|
|
105
105
|
});
|
|
106
106
|
};
|
|
107
107
|
export var pageEntries = function (ctx, apiClient, cmaPreviewClientApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
108
|
-
var options, pageContentTypes, pageEntriesPromise, statusRecordPromise, _a, pageEntries, cmaOnlyStatusRecord;
|
|
108
|
+
var options, pageContentTypes, pageEntriesPromise, statusRecordPromise, _a, pageEntries, cmaOnlyStatusRecord, homePages, allPages;
|
|
109
109
|
return __generator(this, function (_b) {
|
|
110
110
|
switch (_b.label) {
|
|
111
111
|
case 0:
|
|
@@ -134,15 +134,21 @@ export var pageEntries = function (ctx, apiClient, cmaPreviewClientApi) { return
|
|
|
134
134
|
])];
|
|
135
135
|
case 1:
|
|
136
136
|
_a = __read.apply(void 0, [_b.sent(), 2]), pageEntries = _a[0], cmaOnlyStatusRecord = _a[1];
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
137
|
+
homePages = [];
|
|
138
|
+
allPages = new Map(pageEntries.flat().map(function (entry) {
|
|
139
|
+
var _a;
|
|
140
|
+
if ((_a = entry.metadata) === null || _a === void 0 ? void 0 : _a.tags.find(function (t) { return t.sys.id.startsWith(ctx.pageHomeTagId); })) {
|
|
141
|
+
homePages.push(entry);
|
|
142
|
+
}
|
|
143
|
+
var cmaOnlyStatus = ctx.contentfulClientType === "cma-client"
|
|
144
|
+
? entryStatus(entry.sys) || cmaOnlyStatusRecord.get(entry.sys.id)
|
|
145
|
+
: undefined;
|
|
146
|
+
if (cmaOnlyStatus) {
|
|
147
|
+
entry.sys = __assign(__assign({}, entry.sys), { cmaOnlyStatus: cmaOnlyStatus });
|
|
148
|
+
}
|
|
149
|
+
return [entry.sys.id, entry];
|
|
150
|
+
}));
|
|
151
|
+
return [2 /*return*/, { allPages: allPages, homePages: homePages }];
|
|
146
152
|
}
|
|
147
153
|
});
|
|
148
154
|
}); };
|
|
@@ -59,71 +59,73 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
59
59
|
}
|
|
60
60
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
61
61
|
};
|
|
62
|
-
import { mockedEntrySysId, multipleContentTypesMockedContentfulEntriesClientApi, } from
|
|
63
|
-
import { pageEntries } from
|
|
62
|
+
import { mockedEntrySysId, multipleContentTypesMockedContentfulEntriesClientApi, } from "./helpers/__mocks__/mocked-contentful-entries-client-api";
|
|
63
|
+
import { pageEntries } from "./page-entries";
|
|
64
64
|
var productTypesOptions = function (productTypesIds) {
|
|
65
65
|
var seed = {};
|
|
66
66
|
return productTypesIds.reduce(function (acc, ct) {
|
|
67
67
|
acc[ct] = {
|
|
68
|
-
slugFieldId:
|
|
68
|
+
slugFieldId: "slug",
|
|
69
69
|
};
|
|
70
70
|
return acc;
|
|
71
71
|
}, seed);
|
|
72
72
|
};
|
|
73
73
|
describe(pageEntries, function () {
|
|
74
|
-
test(
|
|
74
|
+
test("Handle case where there are no page entries", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
75
75
|
var singleTestPageContentType, testPageContentTypes, entries1, entries2;
|
|
76
76
|
return __generator(this, function (_a) {
|
|
77
77
|
switch (_a.label) {
|
|
78
78
|
case 0:
|
|
79
|
-
singleTestPageContentType = [
|
|
79
|
+
singleTestPageContentType = ["page1ContentType"];
|
|
80
80
|
testPageContentTypes = __spreadArray(__spreadArray([], __read(singleTestPageContentType), false), [
|
|
81
|
-
|
|
81
|
+
"page2ContentType",
|
|
82
82
|
], false);
|
|
83
83
|
return [4 /*yield*/, pageEntries({
|
|
84
|
-
contentfulClientType:
|
|
84
|
+
contentfulClientType: "cda-client",
|
|
85
85
|
options: {
|
|
86
86
|
pageContentTypes: productTypesOptions(singleTestPageContentType),
|
|
87
87
|
},
|
|
88
88
|
preview: false,
|
|
89
|
+
pageHomeTagId: "homePage",
|
|
89
90
|
}, multipleContentTypesMockedContentfulEntriesClientApi(singleTestPageContentType.map(function (contentType) { return ({
|
|
90
91
|
contentType: contentType,
|
|
91
92
|
total: 0,
|
|
92
93
|
}); })))];
|
|
93
94
|
case 1:
|
|
94
95
|
entries1 = _a.sent();
|
|
95
|
-
expect(entries1.size).toBe(0);
|
|
96
|
+
expect(entries1.allPages.size).toBe(0);
|
|
96
97
|
return [4 /*yield*/, pageEntries({
|
|
97
|
-
contentfulClientType:
|
|
98
|
+
contentfulClientType: "cda-client",
|
|
98
99
|
options: {
|
|
99
100
|
pageContentTypes: productTypesOptions(testPageContentTypes),
|
|
100
101
|
},
|
|
101
102
|
preview: false,
|
|
103
|
+
pageHomeTagId: "homePage",
|
|
102
104
|
}, multipleContentTypesMockedContentfulEntriesClientApi(testPageContentTypes.map(function (contentType) { return ({
|
|
103
105
|
contentType: contentType,
|
|
104
106
|
total: 0,
|
|
105
107
|
}); })))];
|
|
106
108
|
case 2:
|
|
107
109
|
entries2 = _a.sent();
|
|
108
|
-
expect(entries2.size).toBe(0);
|
|
110
|
+
expect(entries2.allPages.size).toBe(0);
|
|
109
111
|
return [2 /*return*/];
|
|
110
112
|
}
|
|
111
113
|
});
|
|
112
114
|
}); });
|
|
113
115
|
describe(pageEntries, function () {
|
|
114
|
-
test(
|
|
116
|
+
test("Handle case where there are page entries", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
115
117
|
var singleTestPageContentType, testPageContentTypes, entries1, entries1Ids, expectedEntries1Ids, entries2, entries2Ids, expectedEntries2Ids;
|
|
116
118
|
return __generator(this, function (_a) {
|
|
117
119
|
switch (_a.label) {
|
|
118
120
|
case 0:
|
|
119
121
|
singleTestPageContentType = [
|
|
120
|
-
{ contentType:
|
|
122
|
+
{ contentType: "page1ContentType", total: 101 },
|
|
121
123
|
];
|
|
122
124
|
testPageContentTypes = __spreadArray(__spreadArray([], __read(singleTestPageContentType), false), [
|
|
123
|
-
{ contentType:
|
|
125
|
+
{ contentType: "page2ContentType", total: 1001 },
|
|
124
126
|
], false);
|
|
125
127
|
return [4 /*yield*/, pageEntries({
|
|
126
|
-
contentfulClientType:
|
|
128
|
+
contentfulClientType: "cda-client",
|
|
127
129
|
options: {
|
|
128
130
|
pageContentTypes: productTypesOptions(singleTestPageContentType.map(function (_a) {
|
|
129
131
|
var contentType = _a.contentType;
|
|
@@ -131,10 +133,11 @@ describe(pageEntries, function () {
|
|
|
131
133
|
})),
|
|
132
134
|
},
|
|
133
135
|
preview: false,
|
|
136
|
+
pageHomeTagId: "homePage",
|
|
134
137
|
}, multipleContentTypesMockedContentfulEntriesClientApi(singleTestPageContentType))];
|
|
135
138
|
case 1:
|
|
136
139
|
entries1 = _a.sent();
|
|
137
|
-
entries1Ids = __spreadArray([], __read(entries1.values()), false).map(function (e) { return e.sys.id; });
|
|
140
|
+
entries1Ids = __spreadArray([], __read(entries1.allPages.values()), false).map(function (e) { return e.sys.id; });
|
|
138
141
|
expectedEntries1Ids = singleTestPageContentType.flatMap(function (_a) {
|
|
139
142
|
var total = _a.total, contentType = _a.contentType;
|
|
140
143
|
return __spreadArray([], __read(Array(total).keys()), false).map(function (_, idx) {
|
|
@@ -143,7 +146,7 @@ describe(pageEntries, function () {
|
|
|
143
146
|
});
|
|
144
147
|
expect(entries1Ids).toEqual(expectedEntries1Ids);
|
|
145
148
|
return [4 /*yield*/, pageEntries({
|
|
146
|
-
contentfulClientType:
|
|
149
|
+
contentfulClientType: "cda-client",
|
|
147
150
|
options: {
|
|
148
151
|
pageContentTypes: productTypesOptions(testPageContentTypes.map(function (_a) {
|
|
149
152
|
var contentType = _a.contentType;
|
|
@@ -151,10 +154,11 @@ describe(pageEntries, function () {
|
|
|
151
154
|
})),
|
|
152
155
|
},
|
|
153
156
|
preview: false,
|
|
157
|
+
pageHomeTagId: "homePage",
|
|
154
158
|
}, multipleContentTypesMockedContentfulEntriesClientApi(testPageContentTypes))];
|
|
155
159
|
case 2:
|
|
156
160
|
entries2 = _a.sent();
|
|
157
|
-
entries2Ids = __spreadArray([], __read(entries2.values()), false).map(function (e) { return e.sys.id; });
|
|
161
|
+
entries2Ids = __spreadArray([], __read(entries2.allPages.values()), false).map(function (e) { return e.sys.id; });
|
|
158
162
|
expectedEntries2Ids = testPageContentTypes.flatMap(function (_a) {
|
|
159
163
|
var total = _a.total, contentType = _a.contentType;
|
|
160
164
|
return __spreadArray([], __read(Array(total).keys()), false).map(function (_, idx) {
|
|
@@ -70,15 +70,14 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
70
70
|
}
|
|
71
71
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
72
72
|
};
|
|
73
|
-
import { pageEntries } from
|
|
74
|
-
import { left, right } from
|
|
75
|
-
import { contentTypes } from
|
|
76
|
-
import { locales } from
|
|
77
|
-
import {
|
|
78
|
-
import {
|
|
79
|
-
import { homePagesByTagId } from './helpers/home-pages-by-tag-id';
|
|
73
|
+
import { pageEntries } from "./page-entries";
|
|
74
|
+
import { left, right } from "../../utils/fp-utils";
|
|
75
|
+
import { contentTypes } from "./content-types";
|
|
76
|
+
import { locales } from "./locales";
|
|
77
|
+
import { redirectEntries } from "./redirect-entries";
|
|
78
|
+
import { homePagesByTagId, } from "./helpers/home-pages-by-tag-id";
|
|
80
79
|
export var sitemapData = function (ctx) { return __awaiter(void 0, void 0, void 0, function () {
|
|
81
|
-
var _a, pages, redirects, ct, l,
|
|
80
|
+
var _a, pages, redirects, ct, l, warnings, pagesByTagId;
|
|
82
81
|
return __generator(this, function (_b) {
|
|
83
82
|
switch (_b.label) {
|
|
84
83
|
case 0: return [4 /*yield*/, Promise.all([
|
|
@@ -86,20 +85,19 @@ export var sitemapData = function (ctx) { return __awaiter(void 0, void 0, void
|
|
|
86
85
|
redirectEntries(ctx),
|
|
87
86
|
contentTypes(ctx),
|
|
88
87
|
locales(ctx),
|
|
89
|
-
homePages(ctx, ctx.pageHomeTagId),
|
|
90
88
|
])];
|
|
91
89
|
case 1:
|
|
92
|
-
_a = __read.apply(void 0, [_b.sent(),
|
|
90
|
+
_a = __read.apply(void 0, [_b.sent(), 4]), pages = _a[0], redirects = _a[1], ct = _a[2], l = _a[3];
|
|
93
91
|
warnings = [];
|
|
94
92
|
ct.warnings && warnings.push.apply(warnings, __spreadArray([], __read(ct.warnings), false));
|
|
95
|
-
if (l._tag ===
|
|
93
|
+
if (l._tag === "Left") {
|
|
96
94
|
return [2 /*return*/, left([l.left])];
|
|
97
95
|
}
|
|
98
96
|
else {
|
|
99
|
-
pagesByTagId = homePagesByTagId(ctx, l.right,
|
|
97
|
+
pagesByTagId = homePagesByTagId(ctx, l.right, pages.homePages);
|
|
100
98
|
pagesByTagId.warnings && warnings.push.apply(warnings, __spreadArray([], __read(pagesByTagId.warnings), false));
|
|
101
99
|
return [2 /*return*/, right({
|
|
102
|
-
data: __assign(__assign({}, l.right), { homePagesByTagId: pagesByTagId.homePagesByTagId, contentTypes: ct.contentTypes, pages: pages, redirects: redirects }),
|
|
100
|
+
data: __assign(__assign({}, l.right), { homePagesByTagId: pagesByTagId.homePagesByTagId, contentTypes: ct.contentTypes, pages: pages.allPages, redirects: redirects }),
|
|
103
101
|
warnings: warnings.length > 0 ? warnings : undefined,
|
|
104
102
|
})];
|
|
105
103
|
}
|
|
@@ -151,7 +151,7 @@ export var buildLocalizedSitemap = function (data, options, pageHomeTagId, local
|
|
|
151
151
|
var homePageRef = (_d = (_c = (_b = (_a = homePagesByTagId === null || homePagesByTagId === void 0 ? void 0 : homePagesByTagId.get(locale.code)) === null || _a === void 0 ? void 0 : _a.get(pageHomeTagId)) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.sys) === null || _d === void 0 ? void 0 : _d.id;
|
|
152
152
|
var homePageEntry = homePageRef ? pages.get(homePageRef) : undefined;
|
|
153
153
|
if (homePageEntry) {
|
|
154
|
-
var childrenRefsByPageId = options.
|
|
154
|
+
var childrenRefsByPageId = options.pageRelations === "child-to-parent"
|
|
155
155
|
? getChildrenRefsByParentId(data, locale, options)
|
|
156
156
|
: undefined;
|
|
157
157
|
var sitemap = buildLocalizedSitemapArrRecursively(data, options, locale, undefined, childrenRefsByPageId, homePageEntry, new Map());
|
|
@@ -128,7 +128,7 @@ var createArboretumClient = function (config) { return __awaiter(void 0, void 0,
|
|
|
128
128
|
sitemapDataCtx = {
|
|
129
129
|
preview: config.preview,
|
|
130
130
|
clientApi: clientApi,
|
|
131
|
-
options: __assign(__assign({}, options), { includeEntryStatus: includeEntryStatus,
|
|
131
|
+
options: __assign(__assign({}, options), { includeEntryStatus: includeEntryStatus, pageRelations: (_c = config.options) === null || _c === void 0 ? void 0 : _c.pageRelations }),
|
|
132
132
|
localeTagIdPrefix: localeTagIdPrefix,
|
|
133
133
|
pageHomeTagId: options.homePageTagId || pageHomeTagId,
|
|
134
134
|
contentfulClientType: config.type === "cda-client" && config.contentful.client.withAllLocales
|
|
@@ -108,7 +108,7 @@ var cmaOnlyEntriesStatusMap = function (_a, contentfulClientType, options) {
|
|
|
108
108
|
});
|
|
109
109
|
};
|
|
110
110
|
var pageEntries = function (ctx, apiClient, cmaPreviewClientApi) { return __awaiter(void 0, void 0, void 0, function () {
|
|
111
|
-
var options, pageContentTypes, pageEntriesPromise, statusRecordPromise, _a, pageEntries, cmaOnlyStatusRecord;
|
|
111
|
+
var options, pageContentTypes, pageEntriesPromise, statusRecordPromise, _a, pageEntries, cmaOnlyStatusRecord, homePages, allPages;
|
|
112
112
|
return __generator(this, function (_b) {
|
|
113
113
|
switch (_b.label) {
|
|
114
114
|
case 0:
|
|
@@ -137,15 +137,21 @@ var pageEntries = function (ctx, apiClient, cmaPreviewClientApi) { return __awai
|
|
|
137
137
|
])];
|
|
138
138
|
case 1:
|
|
139
139
|
_a = __read.apply(void 0, [_b.sent(), 2]), pageEntries = _a[0], cmaOnlyStatusRecord = _a[1];
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
140
|
+
homePages = [];
|
|
141
|
+
allPages = new Map(pageEntries.flat().map(function (entry) {
|
|
142
|
+
var _a;
|
|
143
|
+
if ((_a = entry.metadata) === null || _a === void 0 ? void 0 : _a.tags.find(function (t) { return t.sys.id.startsWith(ctx.pageHomeTagId); })) {
|
|
144
|
+
homePages.push(entry);
|
|
145
|
+
}
|
|
146
|
+
var cmaOnlyStatus = ctx.contentfulClientType === "cma-client"
|
|
147
|
+
? (0, entry_status_1.entryStatus)(entry.sys) || cmaOnlyStatusRecord.get(entry.sys.id)
|
|
148
|
+
: undefined;
|
|
149
|
+
if (cmaOnlyStatus) {
|
|
150
|
+
entry.sys = __assign(__assign({}, entry.sys), { cmaOnlyStatus: cmaOnlyStatus });
|
|
151
|
+
}
|
|
152
|
+
return [entry.sys.id, entry];
|
|
153
|
+
}));
|
|
154
|
+
return [2 /*return*/, { allPages: allPages, homePages: homePages }];
|
|
149
155
|
}
|
|
150
156
|
});
|
|
151
157
|
}); };
|
|
@@ -67,65 +67,67 @@ var productTypesOptions = function (productTypesIds) {
|
|
|
67
67
|
var seed = {};
|
|
68
68
|
return productTypesIds.reduce(function (acc, ct) {
|
|
69
69
|
acc[ct] = {
|
|
70
|
-
slugFieldId:
|
|
70
|
+
slugFieldId: "slug",
|
|
71
71
|
};
|
|
72
72
|
return acc;
|
|
73
73
|
}, seed);
|
|
74
74
|
};
|
|
75
75
|
describe(page_entries_1.pageEntries, function () {
|
|
76
|
-
test(
|
|
76
|
+
test("Handle case where there are no page entries", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
77
77
|
var singleTestPageContentType, testPageContentTypes, entries1, entries2;
|
|
78
78
|
return __generator(this, function (_a) {
|
|
79
79
|
switch (_a.label) {
|
|
80
80
|
case 0:
|
|
81
|
-
singleTestPageContentType = [
|
|
81
|
+
singleTestPageContentType = ["page1ContentType"];
|
|
82
82
|
testPageContentTypes = __spreadArray(__spreadArray([], __read(singleTestPageContentType), false), [
|
|
83
|
-
|
|
83
|
+
"page2ContentType",
|
|
84
84
|
], false);
|
|
85
85
|
return [4 /*yield*/, (0, page_entries_1.pageEntries)({
|
|
86
|
-
contentfulClientType:
|
|
86
|
+
contentfulClientType: "cda-client",
|
|
87
87
|
options: {
|
|
88
88
|
pageContentTypes: productTypesOptions(singleTestPageContentType),
|
|
89
89
|
},
|
|
90
90
|
preview: false,
|
|
91
|
+
pageHomeTagId: "homePage",
|
|
91
92
|
}, (0, mocked_contentful_entries_client_api_1.multipleContentTypesMockedContentfulEntriesClientApi)(singleTestPageContentType.map(function (contentType) { return ({
|
|
92
93
|
contentType: contentType,
|
|
93
94
|
total: 0,
|
|
94
95
|
}); })))];
|
|
95
96
|
case 1:
|
|
96
97
|
entries1 = _a.sent();
|
|
97
|
-
expect(entries1.size).toBe(0);
|
|
98
|
+
expect(entries1.allPages.size).toBe(0);
|
|
98
99
|
return [4 /*yield*/, (0, page_entries_1.pageEntries)({
|
|
99
|
-
contentfulClientType:
|
|
100
|
+
contentfulClientType: "cda-client",
|
|
100
101
|
options: {
|
|
101
102
|
pageContentTypes: productTypesOptions(testPageContentTypes),
|
|
102
103
|
},
|
|
103
104
|
preview: false,
|
|
105
|
+
pageHomeTagId: "homePage",
|
|
104
106
|
}, (0, mocked_contentful_entries_client_api_1.multipleContentTypesMockedContentfulEntriesClientApi)(testPageContentTypes.map(function (contentType) { return ({
|
|
105
107
|
contentType: contentType,
|
|
106
108
|
total: 0,
|
|
107
109
|
}); })))];
|
|
108
110
|
case 2:
|
|
109
111
|
entries2 = _a.sent();
|
|
110
|
-
expect(entries2.size).toBe(0);
|
|
112
|
+
expect(entries2.allPages.size).toBe(0);
|
|
111
113
|
return [2 /*return*/];
|
|
112
114
|
}
|
|
113
115
|
});
|
|
114
116
|
}); });
|
|
115
117
|
describe(page_entries_1.pageEntries, function () {
|
|
116
|
-
test(
|
|
118
|
+
test("Handle case where there are page entries", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
117
119
|
var singleTestPageContentType, testPageContentTypes, entries1, entries1Ids, expectedEntries1Ids, entries2, entries2Ids, expectedEntries2Ids;
|
|
118
120
|
return __generator(this, function (_a) {
|
|
119
121
|
switch (_a.label) {
|
|
120
122
|
case 0:
|
|
121
123
|
singleTestPageContentType = [
|
|
122
|
-
{ contentType:
|
|
124
|
+
{ contentType: "page1ContentType", total: 101 },
|
|
123
125
|
];
|
|
124
126
|
testPageContentTypes = __spreadArray(__spreadArray([], __read(singleTestPageContentType), false), [
|
|
125
|
-
{ contentType:
|
|
127
|
+
{ contentType: "page2ContentType", total: 1001 },
|
|
126
128
|
], false);
|
|
127
129
|
return [4 /*yield*/, (0, page_entries_1.pageEntries)({
|
|
128
|
-
contentfulClientType:
|
|
130
|
+
contentfulClientType: "cda-client",
|
|
129
131
|
options: {
|
|
130
132
|
pageContentTypes: productTypesOptions(singleTestPageContentType.map(function (_a) {
|
|
131
133
|
var contentType = _a.contentType;
|
|
@@ -133,10 +135,11 @@ describe(page_entries_1.pageEntries, function () {
|
|
|
133
135
|
})),
|
|
134
136
|
},
|
|
135
137
|
preview: false,
|
|
138
|
+
pageHomeTagId: "homePage",
|
|
136
139
|
}, (0, mocked_contentful_entries_client_api_1.multipleContentTypesMockedContentfulEntriesClientApi)(singleTestPageContentType))];
|
|
137
140
|
case 1:
|
|
138
141
|
entries1 = _a.sent();
|
|
139
|
-
entries1Ids = __spreadArray([], __read(entries1.values()), false).map(function (e) { return e.sys.id; });
|
|
142
|
+
entries1Ids = __spreadArray([], __read(entries1.allPages.values()), false).map(function (e) { return e.sys.id; });
|
|
140
143
|
expectedEntries1Ids = singleTestPageContentType.flatMap(function (_a) {
|
|
141
144
|
var total = _a.total, contentType = _a.contentType;
|
|
142
145
|
return __spreadArray([], __read(Array(total).keys()), false).map(function (_, idx) {
|
|
@@ -145,7 +148,7 @@ describe(page_entries_1.pageEntries, function () {
|
|
|
145
148
|
});
|
|
146
149
|
expect(entries1Ids).toEqual(expectedEntries1Ids);
|
|
147
150
|
return [4 /*yield*/, (0, page_entries_1.pageEntries)({
|
|
148
|
-
contentfulClientType:
|
|
151
|
+
contentfulClientType: "cda-client",
|
|
149
152
|
options: {
|
|
150
153
|
pageContentTypes: productTypesOptions(testPageContentTypes.map(function (_a) {
|
|
151
154
|
var contentType = _a.contentType;
|
|
@@ -153,10 +156,11 @@ describe(page_entries_1.pageEntries, function () {
|
|
|
153
156
|
})),
|
|
154
157
|
},
|
|
155
158
|
preview: false,
|
|
159
|
+
pageHomeTagId: "homePage",
|
|
156
160
|
}, (0, mocked_contentful_entries_client_api_1.multipleContentTypesMockedContentfulEntriesClientApi)(testPageContentTypes))];
|
|
157
161
|
case 2:
|
|
158
162
|
entries2 = _a.sent();
|
|
159
|
-
entries2Ids = __spreadArray([], __read(entries2.values()), false).map(function (e) { return e.sys.id; });
|
|
163
|
+
entries2Ids = __spreadArray([], __read(entries2.allPages.values()), false).map(function (e) { return e.sys.id; });
|
|
160
164
|
expectedEntries2Ids = testPageContentTypes.flatMap(function (_a) {
|
|
161
165
|
var total = _a.total, contentType = _a.contentType;
|
|
162
166
|
return __spreadArray([], __read(Array(total).keys()), false).map(function (_, idx) {
|
|
@@ -77,11 +77,10 @@ var page_entries_1 = require("./page-entries");
|
|
|
77
77
|
var fp_utils_1 = require("../../utils/fp-utils");
|
|
78
78
|
var content_types_1 = require("./content-types");
|
|
79
79
|
var locales_1 = require("./locales");
|
|
80
|
-
var home_page_1 = require("./home-page");
|
|
81
80
|
var redirect_entries_1 = require("./redirect-entries");
|
|
82
81
|
var home_pages_by_tag_id_1 = require("./helpers/home-pages-by-tag-id");
|
|
83
82
|
var sitemapData = function (ctx) { return __awaiter(void 0, void 0, void 0, function () {
|
|
84
|
-
var _a, pages, redirects, ct, l,
|
|
83
|
+
var _a, pages, redirects, ct, l, warnings, pagesByTagId;
|
|
85
84
|
return __generator(this, function (_b) {
|
|
86
85
|
switch (_b.label) {
|
|
87
86
|
case 0: return [4 /*yield*/, Promise.all([
|
|
@@ -89,20 +88,19 @@ var sitemapData = function (ctx) { return __awaiter(void 0, void 0, void 0, func
|
|
|
89
88
|
(0, redirect_entries_1.redirectEntries)(ctx),
|
|
90
89
|
(0, content_types_1.contentTypes)(ctx),
|
|
91
90
|
(0, locales_1.locales)(ctx),
|
|
92
|
-
(0, home_page_1.homePages)(ctx, ctx.pageHomeTagId),
|
|
93
91
|
])];
|
|
94
92
|
case 1:
|
|
95
|
-
_a = __read.apply(void 0, [_b.sent(),
|
|
93
|
+
_a = __read.apply(void 0, [_b.sent(), 4]), pages = _a[0], redirects = _a[1], ct = _a[2], l = _a[3];
|
|
96
94
|
warnings = [];
|
|
97
95
|
ct.warnings && warnings.push.apply(warnings, __spreadArray([], __read(ct.warnings), false));
|
|
98
|
-
if (l._tag ===
|
|
96
|
+
if (l._tag === "Left") {
|
|
99
97
|
return [2 /*return*/, (0, fp_utils_1.left)([l.left])];
|
|
100
98
|
}
|
|
101
99
|
else {
|
|
102
|
-
pagesByTagId = (0, home_pages_by_tag_id_1.homePagesByTagId)(ctx, l.right,
|
|
100
|
+
pagesByTagId = (0, home_pages_by_tag_id_1.homePagesByTagId)(ctx, l.right, pages.homePages);
|
|
103
101
|
pagesByTagId.warnings && warnings.push.apply(warnings, __spreadArray([], __read(pagesByTagId.warnings), false));
|
|
104
102
|
return [2 /*return*/, (0, fp_utils_1.right)({
|
|
105
|
-
data: __assign(__assign({}, l.right), { homePagesByTagId: pagesByTagId.homePagesByTagId, contentTypes: ct.contentTypes, pages: pages, redirects: redirects }),
|
|
103
|
+
data: __assign(__assign({}, l.right), { homePagesByTagId: pagesByTagId.homePagesByTagId, contentTypes: ct.contentTypes, pages: pages.allPages, redirects: redirects }),
|
|
106
104
|
warnings: warnings.length > 0 ? warnings : undefined,
|
|
107
105
|
})];
|
|
108
106
|
}
|
|
@@ -155,7 +155,7 @@ var buildLocalizedSitemap = function (data, options, pageHomeTagId, locale) {
|
|
|
155
155
|
var homePageRef = (_d = (_c = (_b = (_a = homePagesByTagId === null || homePagesByTagId === void 0 ? void 0 : homePagesByTagId.get(locale.code)) === null || _a === void 0 ? void 0 : _a.get(pageHomeTagId)) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.sys) === null || _d === void 0 ? void 0 : _d.id;
|
|
156
156
|
var homePageEntry = homePageRef ? pages.get(homePageRef) : undefined;
|
|
157
157
|
if (homePageEntry) {
|
|
158
|
-
var childrenRefsByPageId = options.
|
|
158
|
+
var childrenRefsByPageId = options.pageRelations === "child-to-parent"
|
|
159
159
|
? getChildrenRefsByParentId(data, locale, options)
|
|
160
160
|
: undefined;
|
|
161
161
|
var sitemap = buildLocalizedSitemapArrRecursively(data, options, locale, undefined, childrenRefsByPageId, homePageEntry, new Map());
|
|
@@ -4,7 +4,7 @@ import { ContentTypeT, EntryT, LocaleT, StatusT, TagT } from "./clients/contentf
|
|
|
4
4
|
export type ArboretumClientOptions = {
|
|
5
5
|
data?: CachedDataT;
|
|
6
6
|
eagerly?: boolean;
|
|
7
|
-
|
|
7
|
+
pageRelations?: "parent-to-children" | "child-to-parent";
|
|
8
8
|
includeEntryStatus?: boolean;
|
|
9
9
|
};
|
|
10
10
|
export type ArboretumClientContentfulConfigOptionsT = {
|
|
@@ -62,7 +62,7 @@ export type ArboretumClientConfigFromCdaT = {
|
|
|
62
62
|
client: ContentfulClientApi;
|
|
63
63
|
options: ArboretumClientContentfulConfigOptionsT;
|
|
64
64
|
};
|
|
65
|
-
options?: Pick<ArboretumClientOptions, "data" | "eagerly" | "
|
|
65
|
+
options?: Pick<ArboretumClientOptions, "data" | "eagerly" | "pageRelations">;
|
|
66
66
|
};
|
|
67
67
|
export type CreateClientParams = {
|
|
68
68
|
space: string;
|
|
@@ -79,7 +79,7 @@ export type ArboretumClientConfigFromCdaParamsT = {
|
|
|
79
79
|
contentful: Omit<CreateClientParams, "host"> & {
|
|
80
80
|
options: ArboretumClientContentfulConfigOptionsT;
|
|
81
81
|
};
|
|
82
|
-
options?: Pick<ArboretumClientOptions, "data" | "eagerly" | "
|
|
82
|
+
options?: Pick<ArboretumClientOptions, "data" | "eagerly" | "pageRelations">;
|
|
83
83
|
};
|
|
84
84
|
export type ArboretumClientConfigT = ArboretumClientConfigFromCmaT | ArboretumClientConfigFromCdaT | ArboretumClientConfigFromCdaParamsT;
|
|
85
85
|
type ArboretumPageBaseT = {
|
|
@@ -121,7 +121,7 @@ export type OptionsT = {
|
|
|
121
121
|
withChildren?: boolean;
|
|
122
122
|
withAncestors?: boolean;
|
|
123
123
|
};
|
|
124
|
-
export type ArboretumClientOptionsT = Pick<ArboretumClientContentfulConfigOptionsT, "pageContentTypes" | "redirectContentType"> & Pick<ArboretumClientOptions, "includeEntryStatus" | "
|
|
124
|
+
export type ArboretumClientOptionsT = Pick<ArboretumClientContentfulConfigOptionsT, "pageContentTypes" | "redirectContentType"> & Pick<ArboretumClientOptions, "includeEntryStatus" | "pageRelations">;
|
|
125
125
|
export type ArboretumClientT = {
|
|
126
126
|
homePage: (localeCode: string, options?: OptionsT) => Either<string, ArboretumPageT>;
|
|
127
127
|
pageByPath: (path: string, options?: OptionsT) => Either<string, ArboretumPageNodeT>;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { ArboretumClientCtx } from "../arboretum-client.impl";
|
|
2
|
+
import { EntryT } from "../../clients/contentful-client/contentful-client";
|
|
2
3
|
import { EntriesT } from "./sitemap-data";
|
|
3
|
-
export declare const pageEntries: (ctx: Pick<ArboretumClientCtx, "options" | "contentfulClientType" | "preview">, apiClient: Pick<ArboretumClientCtx["clientApi"], "getEntries">, cmaPreviewClientApi?: Pick<NonNullable<ArboretumClientCtx["cmaPreviewClientApi"]>, "getEntries">) => Promise<
|
|
4
|
+
export declare const pageEntries: (ctx: Pick<ArboretumClientCtx, "options" | "contentfulClientType" | "preview" | "pageHomeTagId">, apiClient: Pick<ArboretumClientCtx["clientApi"], "getEntries">, cmaPreviewClientApi?: Pick<NonNullable<ArboretumClientCtx["cmaPreviewClientApi"]>, "getEntries">) => Promise<{
|
|
5
|
+
allPages: EntriesT;
|
|
6
|
+
homePages: Array<EntryT>;
|
|
7
|
+
}>;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { Either } from
|
|
2
|
-
import { ArboretumClientCtx } from
|
|
3
|
-
import { ContentTypesT } from
|
|
4
|
-
import { LocalesT } from
|
|
5
|
-
import { EntryIdT, EntryT } from
|
|
6
|
-
import { HomePagesByTagIdT } from
|
|
1
|
+
import { Either } from "../../utils/fp-utils";
|
|
2
|
+
import { ArboretumClientCtx } from "../arboretum-client.impl";
|
|
3
|
+
import { ContentTypesT } from "./content-types";
|
|
4
|
+
import { LocalesT } from "./locales";
|
|
5
|
+
import { EntryIdT, EntryT } from "../../clients/contentful-client/contentful-client";
|
|
6
|
+
import { HomePagesByTagIdT } from "./helpers/home-pages-by-tag-id";
|
|
7
7
|
export type EntriesT = Map<EntryIdT, EntryT>;
|
|
8
8
|
export type SitemapDataT = LocalesT & {
|
|
9
9
|
contentTypes: ContentTypesT;
|
|
10
10
|
pages: EntriesT;
|
|
11
11
|
redirects: Array<EntryT>;
|
|
12
|
-
homePagesByTagId: HomePagesByTagIdT[
|
|
12
|
+
homePagesByTagId: HomePagesByTagIdT["homePagesByTagId"];
|
|
13
13
|
};
|
|
14
|
-
export declare const sitemapData: (ctx: Pick<ArboretumClientCtx,
|
|
14
|
+
export declare const sitemapData: (ctx: Pick<ArboretumClientCtx, "clientApi" | "options" | "pageHomeTagId" | "localeTagIdPrefix" | "contentfulClientType" | "cmaPreviewClientApi" | "preview" | "pageTagIdPrefix">) => Promise<Either<string[], {
|
|
15
15
|
data: SitemapDataT;
|
|
16
16
|
warnings?: string[] | undefined;
|
|
17
17
|
}>>;
|
package/package.json
CHANGED
|
@@ -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
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
12
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
-
function step(op) {
|
|
15
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
-
switch (op[0]) {
|
|
20
|
-
case 0: case 1: t = op; break;
|
|
21
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
-
default:
|
|
25
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
-
if (t[2]) _.ops.pop();
|
|
30
|
-
_.trys.pop(); continue;
|
|
31
|
-
}
|
|
32
|
-
op = body.call(thisArg, _);
|
|
33
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
export var homePages = function (ctx, homePageTagId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
38
|
-
var homePages;
|
|
39
|
-
var _a;
|
|
40
|
-
return __generator(this, function (_b) {
|
|
41
|
-
switch (_b.label) {
|
|
42
|
-
case 0: return [4 /*yield*/, ctx.clientApi.getEntries((_a = {},
|
|
43
|
-
_a["metadata.tags.sys.id[in]"] = homePageTagId,
|
|
44
|
-
_a.include = 0,
|
|
45
|
-
_a.select =
|
|
46
|
-
/* For some reason select param causes errors in CMA. I'm getting the following response:
|
|
47
|
-
{
|
|
48
|
-
"status": 400,
|
|
49
|
-
"statusText": "Bad Request",
|
|
50
|
-
"message": "The query you sent was invalid. Probably a filter or ordering specification is not applicable to the type of a field.",
|
|
51
|
-
"details": {
|
|
52
|
-
"errors": [
|
|
53
|
-
{
|
|
54
|
-
"name": "select",
|
|
55
|
-
"details": "Select is only applicable when querying a collection of entities."
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
},
|
|
59
|
-
"request": {
|
|
60
|
-
"url": "/spaces/8h4rcnu50txt/environments/dacjan-test/public/entries",
|
|
61
|
-
"method": "get",
|
|
62
|
-
...
|
|
63
|
-
},
|
|
64
|
-
}*/
|
|
65
|
-
ctx.contentfulClientType === "cma-client"
|
|
66
|
-
? undefined
|
|
67
|
-
: ["sys.id", "metadata"].join(","),
|
|
68
|
-
_a.order = "sys.createdAt",
|
|
69
|
-
_a))];
|
|
70
|
-
case 1:
|
|
71
|
-
homePages = (_b.sent()).items;
|
|
72
|
-
return [2 /*return*/, homePages];
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
}); };
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.homePages = void 0;
|
|
40
|
-
var homePages = function (ctx, homePageTagId) { return __awaiter(void 0, void 0, void 0, function () {
|
|
41
|
-
var homePages;
|
|
42
|
-
var _a;
|
|
43
|
-
return __generator(this, function (_b) {
|
|
44
|
-
switch (_b.label) {
|
|
45
|
-
case 0: return [4 /*yield*/, ctx.clientApi.getEntries((_a = {},
|
|
46
|
-
_a["metadata.tags.sys.id[in]"] = homePageTagId,
|
|
47
|
-
_a.include = 0,
|
|
48
|
-
_a.select =
|
|
49
|
-
/* For some reason select param causes errors in CMA. I'm getting the following response:
|
|
50
|
-
{
|
|
51
|
-
"status": 400,
|
|
52
|
-
"statusText": "Bad Request",
|
|
53
|
-
"message": "The query you sent was invalid. Probably a filter or ordering specification is not applicable to the type of a field.",
|
|
54
|
-
"details": {
|
|
55
|
-
"errors": [
|
|
56
|
-
{
|
|
57
|
-
"name": "select",
|
|
58
|
-
"details": "Select is only applicable when querying a collection of entities."
|
|
59
|
-
}
|
|
60
|
-
]
|
|
61
|
-
},
|
|
62
|
-
"request": {
|
|
63
|
-
"url": "/spaces/8h4rcnu50txt/environments/dacjan-test/public/entries",
|
|
64
|
-
"method": "get",
|
|
65
|
-
...
|
|
66
|
-
},
|
|
67
|
-
}*/
|
|
68
|
-
ctx.contentfulClientType === "cma-client"
|
|
69
|
-
? undefined
|
|
70
|
-
: ["sys.id", "metadata"].join(","),
|
|
71
|
-
_a.order = "sys.createdAt",
|
|
72
|
-
_a))];
|
|
73
|
-
case 1:
|
|
74
|
-
homePages = (_b.sent()).items;
|
|
75
|
-
return [2 /*return*/, homePages];
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
}); };
|
|
79
|
-
exports.homePages = homePages;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { ArboretumClientCtx } from "../arboretum-client.impl";
|
|
2
|
-
import { EntryT } from "../../clients/contentful-client/contentful-client";
|
|
3
|
-
export declare const homePages: (ctx: Pick<ArboretumClientCtx, "clientApi" | "localeTagIdPrefix" | "contentfulClientType">, homePageTagId: string) => Promise<Array<EntryT>>;
|