@bright.global/arboretum-sdk 0.1.0-rc.5 → 0.1.0-rc.7
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/sitemap/adapters/redirect-entry-adapter.js +1 -1
- package/dist/es6/impl/sitemap/helpers/build-localized-sitemap.js +1 -1
- package/dist/impl/arboretum-client.impl.js +1 -1
- package/dist/impl/sitemap/adapters/redirect-entry-adapter.js +1 -1
- package/dist/impl/sitemap/helpers/build-localized-sitemap.js +1 -1
- package/dist/types/arboretum-client.d.ts +4 -4
- package/package.json +1 -1
|
@@ -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
|
|
@@ -12,7 +12,7 @@ export var redirectEntryAdapter = function (data, pageField, pathField, typeFiel
|
|
|
12
12
|
return pageSysId && path && (type === "redirect" || type === "alias")
|
|
13
13
|
? {
|
|
14
14
|
page: { sys: { id: pageSysId } },
|
|
15
|
-
path: parent.path + path,
|
|
15
|
+
path: parent.path + (path.startsWith("/") ? path : "/".concat(path)),
|
|
16
16
|
title: title || undefined,
|
|
17
17
|
metadata: entry.metadata,
|
|
18
18
|
type: type,
|
|
@@ -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
|
|
@@ -15,7 +15,7 @@ var redirectEntryAdapter = function (data, pageField, pathField, typeField, titl
|
|
|
15
15
|
return pageSysId && path && (type === "redirect" || type === "alias")
|
|
16
16
|
? {
|
|
17
17
|
page: { sys: { id: pageSysId } },
|
|
18
|
-
path: parent.path + path,
|
|
18
|
+
path: parent.path + (path.startsWith("/") ? path : "/".concat(path)),
|
|
19
19
|
title: title || undefined,
|
|
20
20
|
metadata: entry.metadata,
|
|
21
21
|
type: type,
|
|
@@ -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>;
|