@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.
Files changed (23) hide show
  1. package/dist/es6/impl/arboretum-client.impl.js +13 -13
  2. package/dist/es6/impl/data/page-entries.js +1 -0
  3. package/dist/es6/impl/sitemap/adapters/page-entry-adapter.js +6 -8
  4. package/dist/es6/impl/sitemap/adapters/to-arboretum-page-adapter.test.js +6 -0
  5. package/dist/es6/impl/sitemap/adapters/to-arboretum-page-with-missing-data-adapter.js +2 -1
  6. package/dist/es6/impl/sitemap/helpers/__mocks__/mocked-localized-sitemap.js +59 -58
  7. package/dist/es6/impl/sitemap/helpers/build-localized-sitemap.js +56 -12
  8. package/dist/es6/impl/sitemap/helpers/build-localized-sitemap.test.js +34 -34
  9. package/dist/impl/arboretum-client.impl.js +13 -13
  10. package/dist/impl/data/page-entries.js +1 -0
  11. package/dist/impl/sitemap/adapters/page-entry-adapter.js +5 -7
  12. package/dist/impl/sitemap/adapters/to-arboretum-page-adapter.test.js +6 -0
  13. package/dist/impl/sitemap/adapters/to-arboretum-page-with-missing-data-adapter.js +2 -1
  14. package/dist/impl/sitemap/helpers/__mocks__/mocked-localized-sitemap.js +59 -58
  15. package/dist/impl/sitemap/helpers/build-localized-sitemap.js +52 -8
  16. package/dist/impl/sitemap/helpers/build-localized-sitemap.test.js +30 -30
  17. package/dist/types/arboretum-client.d.ts +6 -3
  18. package/dist/types/impl/arboretum-client.impl.d.ts +1 -0
  19. package/dist/types/impl/sitemap/adapters/page-entry-adapter.d.ts +4 -4
  20. package/dist/types/impl/sitemap/adapters/to-arboretum-page-with-missing-data-adapter.d.ts +3 -3
  21. package/dist/types/impl/sitemap/helpers/__mocks__/mocked-localized-sitemap.d.ts +1 -1
  22. package/dist/types/impl/sitemap/helpers/build-localized-sitemap.d.ts +5 -5
  23. 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>;
@@ -16,6 +16,7 @@ export type PageT = {
16
16
  sys: {
17
17
  id: string;
18
18
  cmaOnlyStatus?: StatusT;
19
+ contentTypeId: string;
19
20
  };
20
21
  metadata?: MetadataT;
21
22
  parent: {
@@ -1,6 +1,6 @@
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'>, slugField: ContentTypeT['fields'][number], titleField: ContentTypeT['fields'][number] | undefined, childPagesField: ContentTypeT['fields'][number] | undefined, locale: LocaleT, parent: (NonNullable<PageT['parent']> & {
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 '../../../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
+ 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 '../../../arboretum-client.impl';
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 '../../../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>;
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>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bright.global/arboretum-sdk",
3
- "version": "0.0.8",
3
+ "version": "0.1.0-rc.0",
4
4
  "license": "MIT",
5
5
  "description": "The sitemap for contentful",
6
6
  "dependencies": {},