@bright.global/arboretum-sdk 0.0.8 → 0.1.0-rc.0
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 +13 -13
- package/dist/es6/impl/data/page-entries.js +1 -0
- package/dist/es6/impl/sitemap/adapters/page-entry-adapter.js +6 -8
- package/dist/es6/impl/sitemap/adapters/to-arboretum-page-adapter.test.js +6 -0
- package/dist/es6/impl/sitemap/adapters/to-arboretum-page-with-missing-data-adapter.js +2 -1
- package/dist/es6/impl/sitemap/helpers/__mocks__/mocked-localized-sitemap.js +59 -58
- package/dist/es6/impl/sitemap/helpers/build-localized-sitemap.js +56 -12
- package/dist/es6/impl/sitemap/helpers/build-localized-sitemap.test.js +34 -34
- package/dist/impl/arboretum-client.impl.js +13 -13
- package/dist/impl/data/page-entries.js +1 -0
- package/dist/impl/sitemap/adapters/page-entry-adapter.js +5 -7
- package/dist/impl/sitemap/adapters/to-arboretum-page-adapter.test.js +6 -0
- package/dist/impl/sitemap/adapters/to-arboretum-page-with-missing-data-adapter.js +2 -1
- package/dist/impl/sitemap/helpers/__mocks__/mocked-localized-sitemap.js +59 -58
- package/dist/impl/sitemap/helpers/build-localized-sitemap.js +52 -8
- package/dist/impl/sitemap/helpers/build-localized-sitemap.test.js +30 -30
- package/dist/types/arboretum-client.d.ts +6 -3
- package/dist/types/impl/arboretum-client.impl.d.ts +1 -0
- package/dist/types/impl/sitemap/adapters/page-entry-adapter.d.ts +4 -4
- package/dist/types/impl/sitemap/adapters/to-arboretum-page-with-missing-data-adapter.d.ts +3 -3
- package/dist/types/impl/sitemap/helpers/__mocks__/mocked-localized-sitemap.d.ts +1 -1
- package/dist/types/impl/sitemap/helpers/build-localized-sitemap.d.ts +5 -5
- package/package.json +1 -1
|
@@ -4,6 +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
|
+
sitemapRepresentation?: "parent-to-children" | "child-to-parent";
|
|
7
8
|
includeEntryStatus?: boolean;
|
|
8
9
|
};
|
|
9
10
|
export type ArboretumClientContentfulConfigOptionsT = {
|
|
@@ -12,6 +13,7 @@ export type ArboretumClientContentfulConfigOptionsT = {
|
|
|
12
13
|
slugFieldId: string;
|
|
13
14
|
titleFieldId?: string;
|
|
14
15
|
childPagesFieldId?: string;
|
|
16
|
+
parentPageFieldId?: string;
|
|
15
17
|
};
|
|
16
18
|
};
|
|
17
19
|
redirectContentType?: {
|
|
@@ -59,7 +61,7 @@ export type ArboretumClientConfigFromCdaT = {
|
|
|
59
61
|
client: ContentfulClientApi;
|
|
60
62
|
options: ArboretumClientContentfulConfigOptionsT;
|
|
61
63
|
};
|
|
62
|
-
options?: Pick<ArboretumClientOptions, "data" | "eagerly">;
|
|
64
|
+
options?: Pick<ArboretumClientOptions, "data" | "eagerly" | "sitemapRepresentation">;
|
|
63
65
|
};
|
|
64
66
|
export type CreateClientParams = {
|
|
65
67
|
space: string;
|
|
@@ -76,7 +78,7 @@ export type ArboretumClientConfigFromCdaParamsT = {
|
|
|
76
78
|
contentful: Omit<CreateClientParams, "host"> & {
|
|
77
79
|
options: ArboretumClientContentfulConfigOptionsT;
|
|
78
80
|
};
|
|
79
|
-
options?: Pick<ArboretumClientOptions, "data" | "eagerly">;
|
|
81
|
+
options?: Pick<ArboretumClientOptions, "data" | "eagerly" | "sitemapRepresentation">;
|
|
80
82
|
};
|
|
81
83
|
export type ArboretumClientConfigT = ArboretumClientConfigFromCmaT | ArboretumClientConfigFromCdaT | ArboretumClientConfigFromCdaParamsT;
|
|
82
84
|
type ArboretumPageBaseT = {
|
|
@@ -96,6 +98,7 @@ export type ArboretumAliasT = ArboretumPageBaseT & {
|
|
|
96
98
|
};
|
|
97
99
|
export type ArboretumPageT = ArboretumPageBaseT & {
|
|
98
100
|
type: "page";
|
|
101
|
+
contentTypeId: string;
|
|
99
102
|
slug: string;
|
|
100
103
|
totalDirectChildrenCount: number;
|
|
101
104
|
children?: Array<ArboretumPageNodeT>;
|
|
@@ -106,7 +109,7 @@ export type OptionsT = {
|
|
|
106
109
|
withChildren?: boolean;
|
|
107
110
|
withAncestors?: boolean;
|
|
108
111
|
};
|
|
109
|
-
export type ArboretumClientOptionsT = Pick<ArboretumClientContentfulConfigOptionsT, "pageContentTypes" | "redirectContentType"> & Pick<ArboretumClientOptions, "includeEntryStatus">;
|
|
112
|
+
export type ArboretumClientOptionsT = Pick<ArboretumClientContentfulConfigOptionsT, "pageContentTypes" | "redirectContentType"> & Pick<ArboretumClientOptions, "includeEntryStatus" | "sitemapRepresentation">;
|
|
110
113
|
export type ArboretumClientT = {
|
|
111
114
|
homePage: (localeCode: string, options?: OptionsT) => Either<string, ArboretumPageT>;
|
|
112
115
|
pageByPath: (path: string, options?: OptionsT) => Either<string, ArboretumPageNodeT>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PageT } from
|
|
2
|
-
import { ContentTypeT, EntryT, LocaleT } from
|
|
3
|
-
import { SitemapDataT } from
|
|
4
|
-
export declare const pageEntryAdapter: (data: Pick<SitemapDataT,
|
|
1
|
+
import { PageT } from "../../arboretum-client.impl";
|
|
2
|
+
import { ContentTypeT, EntryT, LocaleT } from "../../../clients/contentful-client/contentful-client";
|
|
3
|
+
import { SitemapDataT } from "../../data/sitemap-data";
|
|
4
|
+
export declare const pageEntryAdapter: (data: Pick<SitemapDataT, "locales" | "defaultLocaleCode" | "pages">, slugField: ContentTypeT["fields"][number], titleField: ContentTypeT["fields"][number] | undefined, childrenRefs: PageT["childPages"], locale: LocaleT, parent: (NonNullable<PageT["parent"]> & {
|
|
5
5
|
path: string;
|
|
6
6
|
}) | undefined, entry: EntryT) => PageT | undefined;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ArboretumPageT } from
|
|
2
|
-
import { PageT } from
|
|
3
|
-
export declare const toArboretumPageWithMissingData: (localeCode: string) => (page: PageT, ancestors: ArboretumPageT[
|
|
1
|
+
import { ArboretumPageT } from "../../../arboretum-client";
|
|
2
|
+
import { PageT } from "../../arboretum-client.impl";
|
|
3
|
+
export declare const toArboretumPageWithMissingData: (localeCode: string) => (page: PageT, ancestors: ArboretumPageT["ancestors"], children: ArboretumPageT["children"]) => ArboretumPageT;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LocalizedSitemapT, PageT, RedirectT } from
|
|
1
|
+
import { LocalizedSitemapT, PageT, RedirectT } from "../../../arboretum-client.impl";
|
|
2
2
|
export declare const mockedRoot: PageT;
|
|
3
3
|
export declare const mockedPage1: PageT;
|
|
4
4
|
export declare const mockedPage1_1: PageT;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Either } from
|
|
2
|
-
import { ArboretumClientCtx, LocalizedSitemapT } from
|
|
3
|
-
import { LocaleT } from
|
|
4
|
-
export declare const buildLocalizedSitemap: (data: Pick<ArboretumClientCtx[
|
|
5
|
-
export declare const localizedSitemapFromCacheOrBuildEff: (ctx: Pick<ArboretumClientCtx,
|
|
1
|
+
import { Either } from "../../../utils/fp-utils";
|
|
2
|
+
import { ArboretumClientCtx, LocalizedSitemapT } from "../../arboretum-client.impl";
|
|
3
|
+
import { LocaleT } from "../../../clients/contentful-client/contentful-client";
|
|
4
|
+
export declare const buildLocalizedSitemap: (data: Pick<ArboretumClientCtx["data"], "homePagesByTagId" | "pages" | "contentTypes" | "defaultLocaleCode" | "locales" | "redirects">, options: ArboretumClientCtx["options"], pageHomeTagId: ArboretumClientCtx["pageHomeTagId"], locale: LocaleT) => Either<string, LocalizedSitemapT>;
|
|
5
|
+
export declare const localizedSitemapFromCacheOrBuildEff: (ctx: Pick<ArboretumClientCtx, "options" | "data" | "pageHomeTagId" | "sitemap">, locale: LocaleT) => Either<string, LocalizedSitemapT>;
|