@websolutespa/bom-mixer-store 3.0.0 → 3.0.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/api/api.ts","../src/cache/cache.service.ts","../src/decorators/category.ts","../src/decorators/consts.ts","../src/decorators/href.ts","../src/decorators/localizable.ts","../src/decorators/menu.ts","../src/decorators/nav.ts","../src/decorators/optimize.ts","../src/decorators/relation.ts","../src/decorators/schema.ts","../src/local/local.api.ts","../src/mock/mock.api.ts","../src/remote/remote.api.ts","../src/store/store.ts","../src/store/store.api.ts"],"sourcesContent":[],"mappings":";;;;KAEY,iBAAA,GAAoB;iBAEhB,yBAAA,CAAA,GAA6B;iBAO7B,0BAAA,kBAA4C;AAT5D;;;iBCAsB,uCAAuC,QAAQ,mBAAmB,QAAQ;;;;iBCC1E;aAAyC,aAAa;;EFDhE,QAAA,CAAA,EEC2F,UFD1E,GECuF,SFDpF;AAEhC,CAAA,CAAA,CAAA,KAAgB,EEDwH,MFCxH,EAAA,IAAA,EEDsI,CFCtI,EAAA,MAA6B,CAAJ,EEDwH,WFCpH,CAAA,EEDuI,OFCvI,CED+I,CFC/I,GAAiB,CEDmI,CFCnI,GAAA;EAO9C,QAAA,EERiM,SFQjM;;iBEOM,8BAA8B,eAAe,qBAAqB,eAAe,cAAa,cAAmB,SAAS,KAAK;YAAgB;ADhBrK,CAAA,CAAA,CAAA,EAAsB,CAAA;AAAS,iBCmCT,gBDnCS,CAAA,UAAA;EAAA,QAAsC,CAAA,ECoC5C,UDpC4C,GCoC/B,SDpC+B;CAAC,GAAA;EAAF,QAA4B,CAAA,ECoC/B,UDpC+B,GCoClB,SDpCkB;CAAC,CAAA,CAAA,UAAT,ECsC1E,SDtC0E,EAAA,EAAA,MAAA,ECuC9E,MDvC8E,EAAA,EAAA,IAAA,ECwChF,CDxCgF,EAAA,MAAA,ECyC9E,WDzC8E,GAA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":3,"file":"index.d.ts","names":[],"sources":["../src/api/api.ts","../src/cache/cache.service.ts","../src/decorators/category.ts","../src/decorators/consts.ts","../src/decorators/href.ts","../src/decorators/localizable.ts","../src/decorators/menu.ts","../src/decorators/nav.ts","../src/decorators/optimize.ts","../src/decorators/relation.ts","../src/decorators/schema.ts","../src/local/local.api.ts","../src/mock/mock.api.ts","../src/remote/remote.api.ts","../src/store/store.ts","../src/store/store.api.ts"],"sourcesContent":[],"mappings":";;;;KAEY,iBAAA,GAAoB;iBAEhB,yBAAA,CAAA,GAA6B;iBAO7B,0BAAA,kBAA4C;AAT5D;;;iBCAsB,uCAAuC,QAAQ,mBAAmB,QAAQ;;;;iBCC1E;aAAyC,aAAa;;EFDhE,QAAA,CAAA,EEC2F,UFD1E,GECuF,SFDpF;AAEhC,CAAA,CAAA,CAAA,KAAgB,EEDwH,MFCxH,EAAA,IAAA,EEDsI,CFCtI,EAAA,MAA6B,CAAJ,EEDwH,WFCpH,CAAA,EEDuI,OFCvI,CED+I,CFC9H,GAAA,CEDmI,CFCnI,GAAA;EAO9C,QAAA,EERiM,SFQjM;;iBEOM,8BAA8B,eAAe,qBAAqB,eAAe,cAAa,cAAmB,SAAS,KAAK;YAAgB;ADhBrK,CAAA,CAAA,CAAA,EAAsB,CAAA;AAAS,iBCmCT,gBDnCS,CAAA,UAAA;EAAA,QAAsC,CAAA,ECoC5C,UDpC4C,GCoC/B,SDpC+B;CAAC,GAAA;EAAF,QAA4B,CAAA,ECoC/B,UDpC+B,GCoClB,SDpCkB;CAAC,CAAA,CAAA,UAAT,ECsC1E,SDtC0E,EAAA,EAAA,MAAA,ECuC9E,MDvC8E,EAAA,EAAA,IAAA,ECwChF,CDxCgF,EAAA,MAAA,ECyC9E,WDzC8E,GAAA,SAAA,EAAA,KAAA,EAAA,MAAA,CAAA,EC2CrF,OD3CqF,CC2C7E,CD3C6E,CAAA;AAAO;;;cEDlF,aAAA;;;;iBCCS,wBAAwB,UAAU,gBAAgB,cAAc,YA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STATIC_COLLECTIONS, StoreStrategy, buildStrategy, collectCategory_, decorateCategories_, decorateCategory_, decorateHref_, decorateHrefs_, decorateLocalizable_, decorateLocalizables_, decorateMenu_, decorateMenus_, decorateNav_, decorateNavs_, decorateRelation_, decorateRelations_, decorateSchema_, decorateSchemas_, fromCache, getLocalApiRequestOptions, getLocalApiUrl, getRemoteApiRequestOptions, getRemoteApiUrl, localApiDelete, localApiFetch, localApiGet, localApiPatch, localApiPost, localApiPut, mockApiDelete, mockApiFetch, mockApiGet, mockApiPatch, mockApiPost, mockApiPut, nextPhase, optimizeMany_, optimizeOne_, remoteApiDelete, remoteApiFetch, remoteApiGet, remoteApiPatch, remoteApiPost, remoteApiPut, staticCollections, storeApiDelete, storeApiGet, storeApiPatch, storeApiPost, storeApiPut, storeCacheDuration, storeStrategy } from "./src-fjNC1rqq.js";
1
+ import { BuildStrategy, COLLECTIONS, DEFAULT_DEPTH, KNOWN_COLLECTIONS, MAX_INT, MOCK_COLLECTIONS, NextPhase, STATIC_COLLECTIONS, StoreStrategy, buildStrategy, collectCategory_, decorateCategories_, decorateCategory_, decorateHref_, decorateHrefs_, decorateLocalizable_, decorateLocalizables_, decorateMenu_, decorateMenus_, decorateNav_, decorateNavs_, decorateRelation_, decorateRelations_, decorateSchema_, decorateSchemas_, fromCache, getLocalApiRequestOptions, getLocalApiUrl, getRemoteApiRequestOptions, getRemoteApiUrl, localApiDelete, localApiFetch, localApiGet, localApiPatch, localApiPost, localApiPut, mockApiDelete, mockApiFetch, mockApiGet, mockApiPatch, mockApiPost, mockApiPut, nextPhase, optimizeMany_, optimizeOne_, remoteApiDelete, remoteApiFetch, remoteApiGet, remoteApiPatch, remoteApiPost, remoteApiPut, staticCollections, storeApiDelete, storeApiGet, storeApiPatch, storeApiPost, storeApiPut, storeCacheDuration, storeStrategy } from "./src-bMn1KJCJ.js";
2
2
 
3
3
  export { BuildStrategy, COLLECTIONS, DEFAULT_DEPTH, KNOWN_COLLECTIONS, MAX_INT, MOCK_COLLECTIONS, NextPhase, STATIC_COLLECTIONS, StoreStrategy, buildStrategy, collectCategory_, decorateCategories_, decorateCategory_, decorateHref_, decorateHrefs_, decorateLocalizable_, decorateLocalizables_, decorateMenu_, decorateMenus_, decorateNav_, decorateNavs_, decorateRelation_, decorateRelations_, decorateSchema_, decorateSchemas_, fromCache, getLocalApiRequestOptions, getLocalApiUrl, getRemoteApiRequestOptions, getRemoteApiUrl, localApiDelete, localApiFetch, localApiGet, localApiPatch, localApiPost, localApiPut, mockApiDelete, mockApiFetch, mockApiGet, mockApiPatch, mockApiPost, mockApiPut, nextPhase, optimizeMany_, optimizeOne_, remoteApiDelete, remoteApiFetch, remoteApiGet, remoteApiPatch, remoteApiPost, remoteApiPut, staticCollections, storeApiDelete, storeApiGet, storeApiPatch, storeApiPost, storeApiPut, storeCacheDuration, storeStrategy };
@@ -441,8 +441,7 @@ async function decorateSchemas_(store, items, schema) {
441
441
  const API_URL$2 = process.env.NEXT_PUBLIC_URL === "https://" ? process.env.NEXT_PUBLIC_MOCK_FALLBACK_URL : process.env.NEXT_PUBLIC_URL;
442
442
  const API_BASE$2 = process.env.NEXT_PUBLIC_API || "/api";
443
443
  function getLocalApiUrl(pathname) {
444
- let url = `${isBrowser ? window.location.origin : API_URL$2}${API_BASE$2}${pathname}`;
445
- url = isBrowser ? url : url.replace("://localhost", "://127.0.0.1");
444
+ const url = `${isBrowser ? window.location.origin : API_URL$2}${API_BASE$2}${pathname}`;
446
445
  return url;
447
446
  }
448
447
  async function localApiFetch(pathname, options = {}, serviceOptions) {
@@ -500,8 +499,7 @@ async function localApiDelete(url, options = {}, serviceOptions) {
500
499
  const API_URL$1 = process.env.NEXT_PUBLIC_URL;
501
500
  const API_BASE$1 = process.env.NEXT_PUBLIC_API || "/api";
502
501
  function getMockApiUrl(pathname) {
503
- let url = `${API_URL$1}${API_BASE$1}/_mock${pathname}`;
504
- url = isBrowser ? url : url.replace("://localhost", "://127.0.0.1");
502
+ const url = `${API_URL$1}${API_BASE$1}/_mock${pathname}`;
505
503
  return url;
506
504
  }
507
505
  async function mockApiFetch(pathname, options = {}) {
@@ -555,8 +553,7 @@ async function mockApiDelete(url, options = {}) {
555
553
  const API_URL = process.env.STORE_URL;
556
554
  const API_BASE = process.env.STORE_API || "/api";
557
555
  function getRemoteApiUrl(pathname) {
558
- let url = `${API_URL}${API_BASE}${pathname}`;
559
- url = isBrowser ? url : url.replace("://localhost", "://127.0.0.1");
556
+ const url = `${API_URL}${API_BASE}${pathname}`;
560
557
  return url;
561
558
  }
562
559
  async function remoteApiFetch(pathname, options = {}) {
@@ -932,4 +929,4 @@ async function storeApiDelete(url, options = {}) {
932
929
 
933
930
  //#endregion
934
931
  export { BuildStrategy, COLLECTIONS, DEFAULT_DEPTH, KNOWN_COLLECTIONS, MAX_INT, MOCK_COLLECTIONS, NextPhase, STATIC_COLLECTIONS, StoreStrategy, buildStrategy, collectCategory_, decorateCategories_, decorateCategory_, decorateHref_, decorateHrefs_, decorateLocalizable_, decorateLocalizables_, decorateMenu_, decorateMenus_, decorateNav_, decorateNavs_, decorateRelation_, decorateRelations_, decorateSchema_, decorateSchemas_, fromCache, getLocalApiRequestOptions, getLocalApiUrl, getRemoteApiRequestOptions, getRemoteApiUrl, localApiDelete, localApiFetch, localApiGet, localApiPatch, localApiPost, localApiPut, mockApiDelete, mockApiFetch, mockApiGet, mockApiPatch, mockApiPost, mockApiPut, nextPhase, optimizeMany_, optimizeOne_, remoteApiDelete, remoteApiFetch, remoteApiGet, remoteApiPatch, remoteApiPost, remoteApiPut, staticCollections, storeApiDelete, storeApiGet, storeApiPatch, storeApiPost, storeApiPut, storeCacheDuration, storeStrategy };
935
- //# sourceMappingURL=src-fjNC1rqq.js.map
932
+ //# sourceMappingURL=src-bMn1KJCJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"src-bMn1KJCJ.js","names":["token?: string","CACHE_: Map<string, unknown>","callback: () => Promise<T>","key?: string","store: IStore","item: T","params: QueryParams","items: T[]","categories: ICategory[]","routes: IRoute[]","depth: number","store: IStore","item: T","params: QueryParams","items: T[]","item: B","params: QueryParams","items: B[]","decoratedItems: B[]","store: IStore","item: IUndecoratedMenu","params: { market: string, locale: string }","decoratedItem: IMenu","items: IUndecoratedMenu[]","decoratedItems: IMenu[]","items: IUndecoratedMenuItem[]","market: string","item: IUndecoratedMenuItem","undecoratedCategories: IUndecoratedMenuCategory[]","undecoratedPages: IUndecoratedMenuPage[]","item: IUndecoratedMenuCategory","category: ICategory","items: IMenuItem[]","categories: ICategory[]","routes: IRoute[]","depth: number","route: IRoute","route","childRouteItems: IMenuItem[]","item: IRoute","decoratedItem: IMenuRoute","item: IUndecoratedMenuPage","params: QueryParams","decoratedItem: IMenuPage","store: IStore","item: T","params: QueryParams","routes?: IRoute[]","items: T[]","item: unknown","navs: IUndecoratedNav[]","item: IUndecoratedNav","routes: IRoute[]","item: T","items: T[]","optimizedItems: T[]","store: IStore","item: T","params: QueryParams","items: T[]","context: {\r\n store: IStore;\r\n params: QueryParams;\r\n depth: number;\r\n}","relations: IPageResolvedRelation[]","items: ICategorized[]","store: IStore","item: T","schema: string","items: T[]","API_URL","API_BASE","pathname: string","options: ApiRequestOptions","serviceOptions?: { locale: string, market: string }","url: string","payload?: unknown","API_URL","API_BASE","pathname: string","options: ApiRequestOptions","url: string","payload: unknown","pathname: string","options: ApiRequestOptions","url: string","payload: unknown","staticCollections: StaticServiceConfig[]","nextPhase","nextPhase: NextPhase","buildStrategy","buildStrategy: BuildStrategy","storeStrategy","storeStrategy: StoreStrategy","storeCacheDuration","storeCacheDuration: number","ENV_COLLECTIONS: string[]","MOCK_COLLECTIONS: string[]","STATIC_COLLECTIONS: string[]","KNOWN_COLLECTIONS: string[]","url: string","options: ApiRequestOptions","payload: unknown"],"sources":["../src/api/api.ts","../src/cache/cache.service.ts","../src/decorators/consts.ts","../src/decorators/category.ts","../src/decorators/href.ts","../src/decorators/localizable.ts","../src/decorators/menu.ts","../src/decorators/nav.ts","../src/decorators/optimize.ts","../src/decorators/relation.ts","../src/decorators/schema.ts","../src/local/local.api.ts","../src/mock/mock.api.ts","../src/remote/remote.api.ts","../src/static/static.ts","../src/store/store.ts","../src/store/store.api.ts"],"sourcesContent":["import { FetchRequestOptions } from '@websolutespa/bom-core';\r\n\r\nexport type ApiRequestOptions = FetchRequestOptions;\r\n\r\nexport function getLocalApiRequestOptions(): ApiRequestOptions {\r\n return {\r\n headers: {\r\n },\r\n };\r\n}\r\n\r\nexport function getRemoteApiRequestOptions(token?: string): ApiRequestOptions {\r\n if (token) {\r\n // authenticated end user JWT token bearer (end_users)\r\n return {\r\n // mode: 'cors',\r\n headers: {\r\n Authorization: `JWT ${token}`,\r\n // Authorization: `Bearer ${token}`,\r\n },\r\n };\r\n } else {\r\n // guest user api key (users)\r\n return {\r\n // mode: 'cors',\r\n headers: {\r\n Authorization: `users API-Key ${process.env.STORE_API_KEY}`,\r\n },\r\n };\r\n }\r\n}\r\n","const CACHE_: Map<string, unknown> = new Map<string, unknown>();\r\n\r\nexport async function fromCache<T = unknown>(callback: () => Promise<T>, key?: string): Promise<T> {\r\n if (key && CACHE_.has(key)) {\r\n return CACHE_.get(key) as T;\r\n } else {\r\n const t = await callback();\r\n if (key) {\r\n CACHE_.set(key, t);\r\n }\r\n return t;\r\n }\r\n}\r\n","\r\nexport const DEFAULT_DEPTH = 3;\r\n","import { ICategorized, ICategory, IEquatable, IRoute, IStore, QueryParams, findRouteOfCategory, isUnresolvedCategory } from '@websolutespa/bom-core';\r\nimport { DEFAULT_DEPTH } from './consts';\r\n\r\nexport async function decorateCategory_<T extends { category?: IEquatable | ICategory } = { category?: IEquatable | ICategory }>(store: IStore, item: T, params: QueryParams = {}): Promise<T | (T & { category: ICategory })> {\r\n const depth = params.depth != null ? params.depth : DEFAULT_DEPTH;\r\n if (depth === 0) {\r\n return item;\r\n }\r\n const categories = await store.category!.findMany<ICategory>({\r\n market: params.market,\r\n locale: params.locale,\r\n depth: 0,\r\n });\r\n const routes = await store.route!.findMany<IRoute>();\r\n const decoratedItem = await collectCategory_(categories, routes, item, params, depth);\r\n return decoratedItem as T & { category: ICategory };\r\n}\r\n\r\nexport async function decorateCategories_<T extends ICategorized = ICategorized>(store: IStore, items: T[], params: QueryParams = {}): Promise<(T | (T & { category: ICategory }))[]> {\r\n const depth = params.depth != null ? params.depth : DEFAULT_DEPTH;\r\n if (depth === 0) {\r\n return items;\r\n }\r\n const categories = await store.category!.findMany<ICategory>({\r\n market: params.market,\r\n locale: params.locale,\r\n depth: 0,\r\n });\r\n const routes = await store.route!.findMany<IRoute>();\r\n const decoratedItems = [];\r\n for (const item of items) {\r\n const decoratedItem = await collectCategory_(categories, routes, item, params, depth);\r\n decoratedItems.push(decoratedItem);\r\n }\r\n return decoratedItems;\r\n}\r\n\r\nexport async function collectCategory_<\r\n T extends { category?: IEquatable | ICategory } = { category?: IEquatable | ICategory }\r\n>(\r\n categories: ICategory[],\r\n routes: IRoute[],\r\n item: T,\r\n params: QueryParams = {},\r\n depth: number\r\n): Promise<T> {\r\n if (depth === 0) {\r\n return item;\r\n }\r\n if (isUnresolvedCategory(item.category)) {\r\n const category = categories.find(x => x.id === item.category);\r\n if (category) {\r\n const route = findRouteOfCategory(routes, category.id, params.market, params.locale);\r\n if (route) {\r\n category.href = route.id;\r\n }\r\n const decoratedCategory = await collectCategory_(categories, routes, category, params, depth - 1);\r\n return { ...item, category: decoratedCategory };\r\n }\r\n }\r\n return item;\r\n}\r\n","import { IRoute, ISchema, IStore, QueryParams } from '@websolutespa/bom-core';\r\n\r\nexport async function decorateHref_<T extends ISchema = ISchema>(store: IStore, item: T, params: QueryParams = {}): Promise<T | T & { href: string | null }> {\r\n if (params.market && params.locale) {\r\n const routes = await store.route!.findMany<IRoute>({\r\n where: {\r\n market: {\r\n equals: params.market,\r\n },\r\n locale: {\r\n equals: params.locale,\r\n },\r\n schema: {\r\n equals: item.schema,\r\n },\r\n page: {\r\n equals: item.id,\r\n },\r\n },\r\n });\r\n const href = routes.length ? routes[0]!.id : null;\r\n return { ...item, href };\r\n } else {\r\n return item;\r\n }\r\n}\r\n\r\nexport async function decorateHrefs_<T extends ISchema = ISchema>(store: IStore, items: T[], params: QueryParams = {}): Promise<T[] | (T & { href: string | null })[]> {\r\n if (params.market && params.locale) {\r\n const routes = await store.route!.findMany<IRoute>({\r\n where: {\r\n market: {\r\n equals: params.market,\r\n },\r\n locale: {\r\n equals: params.locale,\r\n },\r\n },\r\n });\r\n return items.map(item => {\r\n const route = routes.find(x =>\r\n x.schema === item.schema &&\r\n x.page === item.id\r\n );\r\n const href = route ? route.id : null;\r\n return { ...item, href };\r\n });\r\n } else {\r\n return items;\r\n }\r\n}\r\n","import { QueryParams, cloneItem, localizeItem } from '@websolutespa/bom-core';\r\n\r\nexport async function decorateLocalizable_<B>(item: B, params: QueryParams = {}): Promise<B> {\r\n if (params.locale) {\r\n return localizeItem(item, params.locale);\r\n } else {\r\n return cloneItem(item);\r\n }\r\n}\r\n\r\nexport async function decorateLocalizables_<B>(items: B[], params: QueryParams = {}): Promise<B[]> {\r\n const decoratedItems: B[] = [];\r\n for (const item of items) {\r\n const decoratedItem = params.locale ?\r\n localizeItem(item, params.locale) :\r\n cloneItem(item);\r\n decoratedItems.push(decoratedItem);\r\n }\r\n return decoratedItems;\r\n}\r\n","import {\r\n ICategorized, ICategory, IMenu, IMenuCategory, IMenuGroup, IMenuItem, IMenuPage, IMenuRoute, IRoute, IStore,\r\n IUndecoratedMenu, IUndecoratedMenuCategory, IUndecoratedMenuItem, IUndecoratedMenuPage, MenuCategoryStrategy, QueryParams,\r\n asCategoryId,\r\n findCategoryInCategories,\r\n findChildCategories,\r\n findRouteOfCategory,\r\n isEquatable, isUndecoratedMenuCategory, isUndecoratedMenuPage,\r\n uuidv4\r\n} from '@websolutespa/bom-core';\r\n\r\nexport async function decorateMenu_(store: IStore, item: IUndecoratedMenu, params: { market: string, locale: string }): Promise<IMenu> {\r\n const { market, locale } = params;\r\n const items = itemsFilteredByMarket_(item.items || [], market);\r\n const decoratedItem: IMenu = {\r\n id: item.id,\r\n items: [],\r\n };\r\n const undecoratedCategories = collectUndecoratedCategories(items);\r\n const undecoratedPages = collectUndecoratedPages(items);\r\n if (\r\n undecoratedCategories.length > 0 ||\r\n undecoratedPages.length > 0\r\n ) {\r\n const routes = await store.route!.findMany<IRoute>({\r\n where: {\r\n ...(market ? { market: { equals: market } } : {}),\r\n ...(locale ? { locale: { equals: locale } } : {}),\r\n },\r\n });\r\n if (undecoratedCategories.length > 0) {\r\n const categories = await store.category!.findMany<ICategory>(params);\r\n for (const undecoratedMenuCategory of undecoratedCategories) {\r\n const decoratedMenuCategory = decorateMenuCategory_(undecoratedMenuCategory, categories, routes, market);\r\n Object.assign(undecoratedMenuCategory, decoratedMenuCategory);\r\n }\r\n }\r\n for (const undecoratedMenuPage of undecoratedPages) {\r\n const decoratedMenuPage = await decorateMenuPage_(undecoratedMenuPage, routes, store, { ...params });\r\n Object.assign(undecoratedMenuPage, decoratedMenuPage);\r\n }\r\n }\r\n decoratedItem.items = items as IMenuItem[];\r\n return decoratedItem;\r\n}\r\n\r\nexport async function decorateMenus_(store: IStore, items: IUndecoratedMenu[], params: { market: string, locale: string }): Promise<IMenu[]> {\r\n const decoratedItems: IMenu[] = [];\r\n for (const item of items) {\r\n const decoratedItem = await decorateMenu_(store, item, params);\r\n decoratedItems.push(decoratedItem);\r\n }\r\n return decoratedItems;\r\n}\r\n\r\nfunction itemsFilteredByMarket_(items: IUndecoratedMenuItem[], market: string): IUndecoratedMenuItem[] {\r\n return items.filter(x => {\r\n const hasMarket = itemHasMarket_(x, market);\r\n if (hasMarket && x.items) {\r\n x.items = itemsFilteredByMarket_(x.items || [], market);\r\n }\r\n return hasMarket;\r\n });\r\n}\r\n\r\nfunction itemHasMarket_(item: IUndecoratedMenuItem, market: string): boolean {\r\n return (Array.isArray(item.markets) && item.markets.length > 0) ? item.markets.includes(market) : true;\r\n}\r\n\r\nfunction collectUndecoratedCategories(items: IUndecoratedMenuItem[], undecoratedCategories: IUndecoratedMenuCategory[] = []): IUndecoratedMenuCategory[] {\r\n items.forEach(item => {\r\n if (isUndecoratedMenuCategory(item)) {\r\n undecoratedCategories.push(item);\r\n }\r\n if (item.items) {\r\n collectUndecoratedCategories(item.items, undecoratedCategories);\r\n }\r\n });\r\n return undecoratedCategories;\r\n}\r\n\r\nfunction collectUndecoratedPages(items: IUndecoratedMenuItem[], undecoratedPages: IUndecoratedMenuPage[] = []): IUndecoratedMenuPage[] {\r\n items.forEach(item => {\r\n if (isUndecoratedMenuPage(item)) {\r\n undecoratedPages.push(item);\r\n }\r\n if (item.items) {\r\n collectUndecoratedPages(item.items, undecoratedPages);\r\n }\r\n });\r\n return undecoratedPages;\r\n}\r\n\r\nexport const MAX_INT = 1000000000000; // 9007199254740991\r\n\r\nfunction makeCategoryMenuItem_(item: IUndecoratedMenuCategory, category: ICategory): IMenuCategory | IMenuGroup {\r\n const id = item.id || uuidv4();\r\n const title = item.title || category.title || '';\r\n const abstract = item.abstract || undefined;\r\n const customClass = item.customClass || undefined;\r\n const media = item.media || category.media;\r\n const items: IMenuItem[] = [];\r\n return category.isHidden ?\r\n {\r\n type: 'group',\r\n id,\r\n title,\r\n abstract,\r\n media,\r\n customClass,\r\n items,\r\n } : {\r\n type: 'category',\r\n category: category.id,\r\n id,\r\n href: '',\r\n title,\r\n abstract,\r\n media,\r\n customClass,\r\n items,\r\n };\r\n}\r\n\r\nfunction decorateMenuCategory_(\r\n item: IUndecoratedMenuCategory,\r\n categories: ICategory[],\r\n routes: IRoute[],\r\n market: string,\r\n depth: number = 0\r\n): IMenuItem | undefined {\r\n const strategy = item.strategy || MenuCategoryStrategy.Default;\r\n const categoryId = asCategoryId(item.category);\r\n // find category\r\n const category = categoryId ? categories.find(x => x.id === categoryId) : undefined;\r\n if (category) {\r\n const decoratedItem = makeCategoryMenuItem_(item, category);\r\n if (!category.isHidden) {\r\n const route = routes.find((route: IRoute) => route.isDefault && route.resolvedCategory === category.id);\r\n if (route) {\r\n (decoratedItem as IMenuCategory).href = route.id;\r\n if (!decoratedItem.media) {\r\n decoratedItem.media = route.media;\r\n }\r\n }\r\n }\r\n // checking for max depth recursion\r\n let maxDepth = item.maxDepth;\r\n if (typeof maxDepth === 'number') {\r\n if (depth > maxDepth) {\r\n return decoratedItem;\r\n }\r\n maxDepth--;\r\n }\r\n // search child categories\r\n const childCategories = (category.id ?\r\n categories.filter(x => asCategoryId(x.category) === category.id) : []\r\n ).filter(x => {\r\n switch (strategy) {\r\n case MenuCategoryStrategy.ExcludeHidden:\r\n return Boolean(x.isHidden) === false;\r\n case MenuCategoryStrategy.Default:\r\n return true;\r\n }\r\n });\r\n // sort child categories\r\n childCategories.sort((a, b) => {\r\n return (a.order || MAX_INT) - (b.order || MAX_INT);\r\n });\r\n // define sub strategy (!!! todo)\r\n const subStrategy = strategy;\r\n // decorate child categories\r\n const childCategoryItems = childCategories.map(c => decorateMenuCategory_({\r\n id: c.id,\r\n type: 'category',\r\n category: c.id,\r\n maxDepth,\r\n strategy: subStrategy, // dispatch sub strategy\r\n items: [],\r\n } as IUndecoratedMenuCategory, categories, routes, market, depth + 1));\r\n // find child routes\r\n const childRoutes = routes.filter((route: IRoute) => {\r\n switch (strategy) {\r\n case MenuCategoryStrategy.ExcludeHidden:\r\n return route.resolvedCategory === category.id && Boolean(route.isDefault) === false;\r\n case MenuCategoryStrategy.Default:\r\n return route.category === category.id && (category.isHidden || Boolean(route.isDefault) === false);\r\n }\r\n });\r\n // sort child routes\r\n childRoutes.sort((a, b) => {\r\n return (a.order || MAX_INT) - (b.order || MAX_INT);\r\n });\r\n // decorate child routes\r\n const childRouteItems: IMenuItem[] = childRoutes.map(x => decorateMenuRoute_(x));\r\n // filter items\r\n decoratedItem.items = [\r\n ...childCategoryItems,\r\n ...childRouteItems,\r\n ].filter(x => Boolean(x)) as IMenuItem[];\r\n return decoratedItem;\r\n }\r\n // return unresolved category as group\r\n return {\r\n id: item.id || uuidv4(),\r\n type: 'group',\r\n title: item.title || '',\r\n items: [],\r\n };\r\n}\r\n\r\nfunction decorateMenuCategoryWithHiddenSubCategories_(\r\n item: IUndecoratedMenuCategory,\r\n categories: ICategory[],\r\n routes: IRoute[],\r\n market: string,\r\n depth: number = 0\r\n): IMenuItem {\r\n const decoratedItem: IMenuCategory = {\r\n abstract: item.abstract,\r\n category: '',\r\n customClass: item.customClass,\r\n href: '',\r\n id: item.id || uuidv4(),\r\n items: [],\r\n title: '',\r\n type: item.type,\r\n };\r\n /*\r\n const categoryId = asCategoryId(item.category);\r\n const category = categoryId ? categories.find(x => x.id === categoryId) : undefined;\r\n */\r\n const category = findCategoryInCategories(categories, item.category);\r\n if (category) {\r\n // assigning category id\r\n decoratedItem.category = category.id;\r\n // assigning category title\r\n decoratedItem.title = item.title || category.title || '';\r\n // assigning current or category media\r\n decoratedItem.media = item.media || category.media;\r\n // find category's index page route\r\n const route = findRouteOfCategory(routes, category.id);\r\n if (route) {\r\n // hasLink\r\n decoratedItem.href = route.id;\r\n } else {\r\n // isGroup\r\n }\r\n // checking for max depth recursion\r\n let maxDepth = item.maxDepth;\r\n if (typeof maxDepth === 'number') {\r\n if (depth > maxDepth) {\r\n return decoratedItem;\r\n }\r\n maxDepth--;\r\n }\r\n // search child categories\r\n const childCategories = findChildCategories(categories, category.id);\r\n if (childCategories.length) {\r\n // sort child categories\r\n childCategories.sort((a, b) => {\r\n return (a.order || MAX_INT) - (b.order || MAX_INT);\r\n });\r\n decoratedItem.items = childCategories.map(c => {\r\n const menuCategory = decorateMenuCategoryWithHiddenSubCategories_({\r\n id: c.id,\r\n type: 'category',\r\n category: c.id,\r\n maxDepth,\r\n items: [],\r\n } as IUndecoratedMenuCategory, categories, routes, market, depth + 1);\r\n if (c.isHidden) {\r\n const group: IMenuGroup = {\r\n id: c.id,\r\n type: 'group',\r\n title: c.title,\r\n items: [\r\n ...(menuCategory.items || []),\r\n ],\r\n };\r\n // find child routes\r\n // const childRoutes = findRoutesOfCategory(routes, c.id, false);\r\n const childRoutes = routes.filter((route: IRoute) =>\r\n route.category === c.id &&\r\n Boolean(route.isDefault) === false\r\n );\r\n // sort child routes\r\n childRoutes.sort((a, b) => {\r\n return (a.order || MAX_INT) - (b.order || MAX_INT);\r\n });\r\n const routeLinks = childRoutes.map(x => decorateMenuRoute_(x));\r\n group.items?.push(...routeLinks);\r\n return group;\r\n } else {\r\n return decorateMenuCategoryWithHiddenSubCategories_({\r\n id: c.id,\r\n type: 'category',\r\n category: c.id,\r\n maxDepth,\r\n items: [],\r\n } as IUndecoratedMenuCategory, categories, routes, market, depth + 1);\r\n }\r\n });\r\n }\r\n // find child routes\r\n // const childRoutes = findRoutesOfCategory(routes, category.id, false);\r\n const childRoutes = routes.filter((route: IRoute) =>\r\n route.category === category.id &&\r\n Boolean(route.isDefault) === false\r\n );\r\n // console.log('childRoutes', childRoutes, category.id);\r\n // sort child routes\r\n childRoutes.sort((a, b) => {\r\n return (a.order || MAX_INT) - (b.order || MAX_INT);\r\n });\r\n decoratedItem.items = [\r\n ...(decoratedItem.items || []),\r\n ...childRoutes.map(x => decorateMenuRoute_(x)),\r\n ];\r\n\r\n }\r\n return decoratedItem;\r\n}\r\n\r\nfunction decorateMenuRoute_(\r\n item: IRoute\r\n): IMenuItem {\r\n const decoratedItem: IMenuRoute = {\r\n id: uuidv4(),\r\n type: 'route',\r\n title: item.title,\r\n href: item.id,\r\n media: item.media,\r\n page: item.page,\r\n schema: item.schema,\r\n items: [],\r\n };\r\n return decoratedItem;\r\n}\r\n\r\nasync function decorateMenuPage_(\r\n item: IUndecoratedMenuPage,\r\n routes: IRoute[],\r\n store: IStore,\r\n params: QueryParams = {}\r\n): Promise<IMenuItem> {\r\n const values = Array.isArray(item.page.value) ? item.page.value : [item.page.value];\r\n const value = values[0]!; // !!!\r\n const id = isEquatable(value) ? value : value.id;\r\n const route = routes.find(x =>\r\n x.schema === item.page.relationTo &&\r\n x.page === id\r\n );\r\n const page = await store[item.page.relationTo]!.findOne<ICategorized>(id, { ...params });\r\n const decoratedItem: IMenuPage = {\r\n id: item.id || uuidv4(),\r\n type: item.type,\r\n title: item.title || page?.title || '',\r\n abstract: item.abstract || page?.abstract || '',\r\n customClass: item.customClass,\r\n href: route?.id || '',\r\n media: page?.media,\r\n page: route?.page || '',\r\n schema: route?.schema || '',\r\n items: (item.items || []) as IMenuItem[],\r\n };\r\n return decoratedItem;\r\n}\r\n","import { IDecoratedNav, IEquatable, IRoute, ISchema, IStore, IUndecoratedNav, QueryParams, isArray, isObject, isUndecoratedNav } from '@websolutespa/bom-core';\r\n\r\nexport async function decorateNav_<T extends ISchema = ISchema>(store: IStore, item: T, params: QueryParams = {}, routes?: IRoute[]): Promise<T> {\r\n if (!routes) {\r\n routes = await store.route!.findMany<IRoute>({\r\n where: {\r\n ...(params.market ? { market: { equals: params.market } } : {}),\r\n ...(params.locale ? { locale: { equals: params.locale } } : {}),\r\n },\r\n });\r\n }\r\n const navs = collectNavs_(item);\r\n for (const nav of navs) {\r\n const decoratedNav = decorateNav__(nav, routes);\r\n Object.assign(nav, decoratedNav);\r\n // (nav as IDecoratedNav<T>).nav = decoratedNav.nav;\r\n }\r\n return item;\r\n}\r\n\r\nexport async function decorateNavs_<T extends ISchema = ISchema>(store: IStore, items: T[], params: QueryParams = {}): Promise<T[]> {\r\n const routes = await store.route!.findMany<IRoute>({\r\n where: {\r\n ...(params.market ? { market: { equals: params.market } } : {}),\r\n ...(params.locale ? { locale: { equals: params.locale } } : {}),\r\n },\r\n });\r\n for (const item of items) {\r\n await decorateNav_<T>(store, item, params, routes);\r\n }\r\n return items;\r\n}\r\n\r\n// collecting navs recursively\r\nfunction collectNavs_(item: unknown, navs: IUndecoratedNav[] = []): IUndecoratedNav[] {\r\n if (isUndecoratedNav(item)) {\r\n navs.push(item);\r\n }\r\n // console.log(item, isUndecoratedNav<T>(item));\r\n if (isArray(item)) {\r\n item.forEach(x => collectNavs_(x, navs));\r\n } else if (isObject(item)) {\r\n Object.values(item).forEach(value => {\r\n collectNavs_(value, navs);\r\n });\r\n }\r\n return navs;\r\n}\r\n\r\nfunction decorateNav__(item: IUndecoratedNav, routes: IRoute[]): IDecoratedNav {\r\n let decoratedNav = item as unknown as IDecoratedNav;\r\n if (item !== undefined) {\r\n const route = routes.find(x =>\r\n x.page === (item.page.value as unknown as IEquatable) &&\r\n x.schema === item.page.relationTo\r\n );\r\n if (route) {\r\n decoratedNav = {\r\n type: 'page',\r\n id: route.page,\r\n href: route.id,\r\n title: route.title,\r\n page: route.page,\r\n schema: route.schema,\r\n };\r\n }\r\n }\r\n return decoratedNav;\r\n}\r\n","import { ICategorized } from '@websolutespa/bom-core';\r\n\r\nexport async function optimizeOne_<T extends ICategorized = ICategorized>(item: T): Promise<T> {\r\n const validEntries = Object.entries(item).filter(([key, value]) => {\r\n switch (key) {\r\n case 'components':\r\n case 'meta':\r\n return false;\r\n /*\r\n default:\r\n if (\r\n isUnresolvedRelation(value) ||\r\n (\r\n Array.isArray(value) &&\r\n value.reduce((p, c) => p && isUnresolvedRelation(c), true)\r\n )\r\n ) {\r\n return false;\r\n }\r\n */\r\n }\r\n return true;\r\n });\r\n return Object.fromEntries(validEntries) as T;\r\n}\r\n\r\nexport async function optimizeMany_<T extends ICategorized = ICategorized>(items: T[]): Promise<T[]> {\r\n const optimizedItems: T[] = [];\r\n for (const item of items) {\r\n const optimizedItem = await optimizeOne_<T>(item);\r\n optimizedItems.push(optimizedItem);\r\n }\r\n return optimizedItems;\r\n}\r\n","import { ICategorized, IEquatable, ISchema, IStore, QueryParams, isArray, isObject, isUnresolvedRelation } from '@websolutespa/bom-core';\r\nimport { DEFAULT_DEPTH } from './consts';\r\n\r\nexport async function decorateRelation_<T extends ISchema = ISchema>(store: IStore, item: T, params: QueryParams = {}): Promise<T> {\r\n const depth = params.depth != null ? params.depth : DEFAULT_DEPTH;\r\n // console.log('decorateRelation_', depth, typeof depth);\r\n item = await collectRelations_({ store, params, depth }, item);\r\n return item;\r\n}\r\n\r\nexport async function decorateRelations_<T extends ISchema = ISchema>(store: IStore, items: T[], params: QueryParams = {}): Promise<T[]> {\r\n for (const item of items) {\r\n await decorateRelation_<T>(store, item, params);\r\n }\r\n return items;\r\n}\r\n\r\nexport type IPageResolvedRelation = {\r\n relationTo: string;\r\n value: IEquatable | IEquatable[];\r\n resolvedValue: ICategorized | ICategorized[] | null;\r\n};\r\n\r\n// collecting relations recursively\r\nasync function collectRelations_<T = any>(context: {\r\n store: IStore;\r\n params: QueryParams;\r\n depth: number;\r\n}, item: T, relations: IPageResolvedRelation[] = []): Promise<T> {\r\n if (isUnresolvedRelation(item)) {\r\n if (context.depth === 0) {\r\n return item.value as T;\r\n }\r\n // skip circular reference\r\n const index = relations.findIndex(x =>\r\n x.relationTo === item.relationTo && x.value === item.value\r\n );\r\n if (index === -1) {\r\n const isMany = Array.isArray(item.value);\r\n const values = isMany ? item.value : [item.value];\r\n let items: ICategorized[] = [];\r\n const collection = context.store[item.relationTo];\r\n if (collection) {\r\n items = await collection.findMany<ICategorized>({\r\n ...context.params,\r\n where: {\r\n id: { in: values },\r\n },\r\n depth: context.depth - 1,\r\n });\r\n } else {\r\n console.log('collectRelations_', `unknown relation \"${item.relationTo}\"`);\r\n }\r\n const resolvedValue = isMany ? items : (items.length > 0 ? items[0]! : null);\r\n // console.log('resolvedValue', resolvedValue);\r\n relations.push({\r\n ...item,\r\n resolvedValue,\r\n });\r\n return resolvedValue as T;\r\n } else {\r\n return relations[index]!.resolvedValue as T;\r\n }\r\n } else if (isArray(item)) {\r\n const items = [];\r\n for (let i = 0; i < item.length; i++) {\r\n items[i] = await collectRelations_(context, item[i], relations);\r\n }\r\n return items as T;\r\n } else if (isObject(item)) {\r\n for (const [key, value] of Object.entries(item)) {\r\n (item[key] as any) = await collectRelations_(context, value, relations);\r\n }\r\n }\r\n return item;\r\n}\r\n","import { ISchema, IStore } from '@websolutespa/bom-core';\r\n\r\nexport async function decorateSchema_<T extends ISchema = ISchema>(store: IStore, item: T, schema: string): Promise<T | T & { schema: string }> {\r\n return { ...item, schema: item.schema || schema };\r\n}\r\n\r\nexport async function decorateSchemas_<T extends ISchema = ISchema>(store: IStore, items: T[], schema: string): Promise<(T & { schema: string })[]> {\r\n return items.map(item => {\r\n return { ...item, schema: item.schema || schema };\r\n });\r\n}\r\n","import { httpFetch, isBrowser, merge } from '@websolutespa/bom-core';\r\nimport { ApiRequestOptions, getLocalApiRequestOptions } from '../api/api';\r\n\r\n/**\r\n * This methods handle api requests / responses to local api (mixer)\r\n */\r\n\r\nconst API_URL = (\r\n process.env.NEXT_PUBLIC_URL === 'https://' ?\r\n process.env.NEXT_PUBLIC_MOCK_FALLBACK_URL :\r\n process.env.NEXT_PUBLIC_URL\r\n);\r\nconst API_BASE = process.env.NEXT_PUBLIC_API || '/api';\r\n\r\nexport function getLocalApiUrl(pathname: string): string {\r\n const url = `${isBrowser ? window.location.origin : API_URL}${API_BASE}${pathname}`;\r\n // console.log('getLocalApiUrl', url);\r\n return url;\r\n}\r\n\r\nexport async function localApiFetch<T = unknown>(pathname: string, options: ApiRequestOptions = {}, serviceOptions?: { locale: string, market: string }): Promise<T> {\r\n // console.log('localApiFetch', pathname, options, serviceOptions);\r\n const url = new URL(getLocalApiUrl(pathname));\r\n if (serviceOptions) {\r\n url.searchParams.append('locale', serviceOptions.locale);\r\n url.searchParams.append('market', serviceOptions.market);\r\n }\r\n const apiOptions = merge({ ...getLocalApiRequestOptions() }, options);\r\n console.log('localApiFetch', apiOptions.method, url.href);\r\n const apiResponse = await httpFetch(url.href, apiOptions);\r\n // console.log('localApiFetch', pathname, apiResponse);\r\n return apiResponse;\r\n}\r\n\r\nexport async function localApiGet<T = unknown>(url: string, options: ApiRequestOptions = {}, serviceOptions?: { locale: string, market: string }): Promise<T> {\r\n return await localApiFetch<T>(url, { ...options, method: 'GET' }, serviceOptions);\r\n}\r\n\r\nexport async function localApiPost<T = unknown>(url: string, payload?: unknown, options: ApiRequestOptions = {}, serviceOptions?: { locale: string, market: string }): Promise<T> {\r\n return await localApiFetch<T>(url, { ...options, method: 'POST', body: payload ? JSON.stringify(payload) : undefined }, serviceOptions);\r\n}\r\n\r\nexport async function localApiPut<T = unknown>(url: string, payload?: unknown, options: ApiRequestOptions = {}, serviceOptions?: { locale: string, market: string }): Promise<T> {\r\n return await localApiFetch<T>(url, { ...options, method: 'PUT', body: payload ? JSON.stringify(payload) : undefined }, serviceOptions);\r\n}\r\n\r\nexport async function localApiPatch<T = unknown>(url: string, payload?: unknown, options: ApiRequestOptions = {}, serviceOptions?: { locale: string, market: string }): Promise<T> {\r\n return await localApiFetch<T>(url, { ...options, method: 'PATCH', body: payload ? JSON.stringify(payload) : undefined }, serviceOptions);\r\n}\r\n\r\nexport async function localApiDelete<T = unknown>(url: string, options: ApiRequestOptions = {}, serviceOptions?: { locale: string, market: string }): Promise<T> {\r\n return await localApiFetch<T>(url, { ...options, method: 'DELETE' }, serviceOptions);\r\n}\r\n","import { httpFetch, merge } from '@websolutespa/bom-core';\r\nimport { ApiRequestOptions, getLocalApiRequestOptions } from '../api/api';\r\n\r\n/**\r\n * This methods handle api requests / responses to local /api/_mock data\r\n */\r\nconst API_URL = process.env.NEXT_PUBLIC_URL;\r\nconst API_BASE = process.env.NEXT_PUBLIC_API || '/api';\r\n\r\nfunction getMockApiUrl(pathname: string): string {\r\n const url = `${API_URL}${API_BASE}/_mock${pathname}`;\r\n // console.log('getMockApiUrl', url);\r\n return url;\r\n}\r\n\r\nexport async function mockApiFetch<T = unknown>(pathname: string, options: ApiRequestOptions = {}): Promise<T> {\r\n const url = getMockApiUrl(pathname);\r\n const apiOptions = merge({ ...getLocalApiRequestOptions() }, options);\r\n console.log('mockApiFetch', apiOptions.method, url);\r\n const apiResponse = await httpFetch(url, apiOptions);\r\n return apiResponse;\r\n}\r\n\r\nexport async function mockApiGet<T = unknown>(url: string, options: ApiRequestOptions = {}): Promise<T> {\r\n return await mockApiFetch<T>(url, { ...options, method: 'GET' });\r\n}\r\n\r\nexport async function mockApiPost<T = unknown>(url: string, payload: unknown, options: ApiRequestOptions = {}): Promise<T> {\r\n return await mockApiFetch<T>(url, { ...options, method: 'POST', body: JSON.stringify(payload) });\r\n}\r\n\r\nexport async function mockApiPut<T = unknown>(url: string, payload: unknown, options: ApiRequestOptions = {}): Promise<T> {\r\n return await mockApiFetch<T>(url, { ...options, method: 'PUT', body: JSON.stringify(payload) });\r\n}\r\n\r\nexport async function mockApiPatch<T = unknown>(url: string, payload: unknown, options: ApiRequestOptions = {}): Promise<T> {\r\n return await mockApiFetch<T>(url, { ...options, method: 'PATCH', body: JSON.stringify(payload) });\r\n}\r\n\r\nexport async function mockApiDelete<T = unknown>(url: string, options: ApiRequestOptions = {}): Promise<T> {\r\n return await mockApiFetch<T>(url, { ...options, method: 'DELETE' });\r\n}\r\n","import { httpFetch, isBrowser, merge } from '@websolutespa/bom-core';\r\nimport { ApiRequestOptions, getRemoteApiRequestOptions } from '../api/api';\r\n\r\n/**\r\n * This methods handle api requests / responses to remote api (bowl or over)\r\n */\r\n\r\nconst API_URL = process.env.STORE_URL;\r\nconst API_BASE = process.env.STORE_API || '/api';\r\n\r\nexport function getRemoteApiUrl(pathname: string): string {\r\n const url = `${API_URL}${API_BASE}${pathname}`;\r\n // console.log('getRemoteApiUrl', url);\r\n return url;\r\n}\r\n\r\nexport async function remoteApiFetch<T = unknown>(pathname: string, options: ApiRequestOptions = {}): Promise<T> {\r\n if (isBrowser) {\r\n throw 'Unauthorized: remote api cannot be fetched client side';\r\n }\r\n const url = getRemoteApiUrl(pathname);\r\n const apiOptions = merge({ ...getRemoteApiRequestOptions() }, options);\r\n // console.log('remoteApiFetch', apiOptions.method, url);\r\n // console.log('remoteApiFetch', 'Authorization', apiOptions.headers?.Authorization);\r\n const apiResponse = await httpFetch(url, apiOptions);\r\n return apiResponse;\r\n}\r\n\r\nexport async function remoteApiGet<T = unknown>(url: string, options: ApiRequestOptions = {}): Promise<T> {\r\n return await remoteApiFetch<T>(url, { ...options, method: 'GET' });\r\n}\r\n\r\nexport async function remoteApiPost<T = unknown>(url: string, payload: unknown, options: ApiRequestOptions = {}): Promise<T> {\r\n return await remoteApiFetch<T>(url, { ...options, method: 'POST', body: JSON.stringify(payload) });\r\n}\r\n\r\nexport async function remoteApiPut<T = unknown>(url: string, payload: unknown, options: ApiRequestOptions = {}): Promise<T> {\r\n return await remoteApiFetch<T>(url, { ...options, method: 'PUT', body: JSON.stringify(payload) });\r\n}\r\n\r\nexport async function remoteApiPatch<T = unknown>(url: string, payload: unknown, options: ApiRequestOptions = {}): Promise<T> {\r\n return await remoteApiFetch<T>(url, { ...options, method: 'PATCH', body: JSON.stringify(payload) });\r\n}\r\n\r\nexport async function remoteApiDelete<T = unknown>(url: string, options: ApiRequestOptions = {}): Promise<T> {\r\n return await remoteApiFetch<T>(url, { ...options, method: 'DELETE' });\r\n}\r\n","import type { IEntity } from '@websolutespa/bom-core';\r\n\r\nexport type IField = {\r\n name: string,\r\n type: 'text' | 'number' | 'relationship',\r\n localized?: boolean,\r\n relationTo?: string,\r\n hasMany?: boolean,\r\n required?: boolean\r\n};\r\n\r\nexport type MapTo = Record<string, string>;\r\n\r\nexport type StaticServiceSrc<T extends IEntity = IEntity> = string | T[] | ((config: StaticServiceConfig<T>) => T[]) | ((config: StaticServiceConfig<T>) => Promise<T[]>);\r\n\r\nexport type StaticServiceConfig<T extends IEntity = IEntity> = {\r\n src: StaticServiceSrc<T>;\r\n slug: string;\r\n fields: IField[];\r\n map?: MapTo;\r\n};\r\n\r\nexport const staticCollections: StaticServiceConfig[] = [{\r\n src: 'https://actarian.github.io/cms-i18n-react/api/continent.json',\r\n slug: 'i18n_continent',\r\n fields: [\r\n {\r\n name: 'id',\r\n type: 'text',\r\n },\r\n {\r\n name: 'name',\r\n type: 'text',\r\n },\r\n ],\r\n}, {\r\n src: 'https://actarian.github.io/cms-i18n-react/api/country.json',\r\n slug: 'i18n_country',\r\n fields: [\r\n {\r\n name: 'id',\r\n type: 'text',\r\n },\r\n {\r\n name: 'name',\r\n type: 'text',\r\n localized: true,\r\n },\r\n {\r\n name: 'englishName',\r\n type: 'text',\r\n },\r\n {\r\n name: 'nativeName',\r\n type: 'text',\r\n },\r\n {\r\n name: 'alpha2Code',\r\n type: 'text',\r\n },\r\n {\r\n name: 'alpha3Code',\r\n type: 'text',\r\n },\r\n {\r\n name: 'continent',\r\n type: 'relationship',\r\n relationTo: 'i18n_continent',\r\n hasMany: false,\r\n required: true,\r\n },\r\n {\r\n name: 'subContinent',\r\n type: 'relationship',\r\n relationTo: 'i18n_sub_continent',\r\n hasMany: false,\r\n required: true,\r\n },\r\n ],\r\n}, {\r\n src: 'https://actarian.github.io/cms-i18n-react/api/countryZone.json',\r\n slug: 'i18n_country_zone',\r\n fields: [\r\n {\r\n name: 'id',\r\n type: 'text',\r\n },\r\n {\r\n name: 'name',\r\n type: 'text',\r\n },\r\n ],\r\n}, {\r\n src: 'https://actarian.github.io/cms-i18n-react/api/language.json',\r\n slug: 'i18n_country_zone',\r\n fields: [\r\n {\r\n name: 'id',\r\n type: 'text',\r\n },\r\n {\r\n name: 'name',\r\n type: 'text',\r\n localized: true,\r\n },\r\n {\r\n name: 'englishName',\r\n type: 'text',\r\n },\r\n {\r\n name: 'nativeName',\r\n type: 'text',\r\n },\r\n ],\r\n}, {\r\n src: 'https://actarian.github.io/cms-i18n-react/api/municipality.json',\r\n slug: 'i18n_municipality',\r\n fields: [\r\n {\r\n name: 'id',\r\n type: 'text',\r\n },\r\n {\r\n name: 'name',\r\n type: 'text',\r\n },\r\n {\r\n name: 'code',\r\n type: 'text',\r\n },\r\n {\r\n name: 'country',\r\n type: 'relationship',\r\n relationTo: 'i18n_country',\r\n hasMany: false,\r\n required: true,\r\n },\r\n {\r\n name: 'countryZone',\r\n type: 'relationship',\r\n relationTo: 'i18n_country_zone',\r\n hasMany: false,\r\n required: true,\r\n },\r\n {\r\n name: 'region',\r\n type: 'relationship',\r\n relationTo: 'i18n_region',\r\n hasMany: false,\r\n required: true,\r\n },\r\n {\r\n name: 'province',\r\n type: 'relationship',\r\n relationTo: 'i18n_province',\r\n hasMany: false,\r\n required: true,\r\n },\r\n ],\r\n}, {\r\n src: 'https://actarian.github.io/cms-i18n-react/api/province.json',\r\n slug: 'i18n_province',\r\n fields: [\r\n {\r\n name: 'id',\r\n type: 'text',\r\n },\r\n {\r\n name: 'name',\r\n type: 'text',\r\n },\r\n {\r\n name: 'code',\r\n type: 'text',\r\n },\r\n {\r\n name: 'country',\r\n type: 'relationship',\r\n relationTo: 'i18n_country',\r\n hasMany: false,\r\n required: true,\r\n },\r\n {\r\n name: 'countryZone',\r\n type: 'relationship',\r\n relationTo: 'i18n_country_zone',\r\n hasMany: false,\r\n required: true,\r\n },\r\n {\r\n name: 'region',\r\n type: 'relationship',\r\n relationTo: 'i18n_region',\r\n hasMany: false,\r\n required: true,\r\n },\r\n ],\r\n}, {\r\n src: 'https://actarian.github.io/cms-i18n-react/api/region.json',\r\n slug: 'i18n_region',\r\n fields: [\r\n {\r\n name: 'id',\r\n type: 'text',\r\n },\r\n {\r\n name: 'name',\r\n type: 'text',\r\n },\r\n {\r\n name: 'country',\r\n type: 'relationship',\r\n relationTo: 'i18n_country',\r\n hasMany: false,\r\n required: true,\r\n },\r\n {\r\n name: 'countryZone',\r\n type: 'relationship',\r\n relationTo: 'i18n_country_zone',\r\n hasMany: false,\r\n required: true,\r\n },\r\n ],\r\n}, {\r\n src: 'https://actarian.github.io/cms-i18n-react/api/subContinent.json',\r\n slug: 'i18n_sub_continent',\r\n fields: [\r\n {\r\n name: 'id',\r\n type: 'text',\r\n },\r\n {\r\n name: 'name',\r\n type: 'text',\r\n },\r\n {\r\n name: 'continent',\r\n type: 'relationship',\r\n relationTo: 'i18n_continent',\r\n hasMany: false,\r\n required: true,\r\n },\r\n ],\r\n}];\r\n","import { staticCollections } from '../static/static';\r\n\r\n// nextPhase\r\nexport enum NextPhase {\r\n Export = 'phase-export',\r\n ProductionBuild = 'phase-production-build',\r\n ProductionServer = 'phase-production-server',\r\n DevelopmentServer = 'phase-development-server',\r\n Test = 'phase-test',\r\n}\r\n\r\nfunction getNextPhase(): NextPhase {\r\n let nextPhase = NextPhase.Export;\r\n if (typeof process !== 'undefined' && process.env.NEXT_PHASE) {\r\n nextPhase = process.env.NEXT_PHASE as NextPhase;\r\n }\r\n return nextPhase;\r\n}\r\n\r\nexport const nextPhase: NextPhase = getNextPhase();\r\n\r\n// buildStrategy\r\nexport enum BuildStrategy {\r\n Static = 'static',\r\n Runtime = 'runtime',\r\n}\r\n\r\nfunction getBuildStrategy(): BuildStrategy {\r\n let buildStrategy = BuildStrategy.Static;\r\n if (typeof process !== 'undefined' && process.env.BUILD_STRATEGY) {\r\n buildStrategy = process.env.BUILD_STRATEGY as BuildStrategy;\r\n }\r\n return buildStrategy;\r\n}\r\n\r\nexport const buildStrategy: BuildStrategy = getBuildStrategy();\r\n\r\n// storeStrategy\r\nexport enum StoreStrategy {\r\n Local = 'local',\r\n Api = 'api',\r\n DecoratedApi = 'decoratedApi',\r\n Data = 'data',\r\n Mock = 'mock',\r\n}\r\n\r\nfunction getStoreStrategy(): StoreStrategy {\r\n let storeStrategy = StoreStrategy.Mock;\r\n if (typeof process !== 'undefined' && process.env.STORE_STRATEGY) {\r\n storeStrategy = process.env.STORE_STRATEGY as StoreStrategy;\r\n }\r\n return storeStrategy;\r\n}\r\n\r\nexport const storeStrategy: StoreStrategy = getStoreStrategy();\r\n\r\n// storeCacheDuration\r\nfunction getStoreCacheDuration(): number {\r\n let storeCacheDuration = (1 * 60 * 1000);\r\n if (typeof process !== 'undefined' && process.env.STORE_CACHE_DURATION) {\r\n storeCacheDuration = parseInt(process.env.STORE_CACHE_DURATION);\r\n }\r\n return storeCacheDuration;\r\n}\r\n\r\nexport const storeCacheDuration: number = getStoreCacheDuration();\r\n\r\n// collections\r\nconst ENV_COLLECTIONS: string[] = process.env.COLLECTIONS ? process.env.COLLECTIONS.split(',') : [];\r\nexport const MOCK_COLLECTIONS: string[] = process.env.MOCKS ? process.env.MOCKS.split(',') : [];\r\nexport const STATIC_COLLECTIONS: string[] = staticCollections.map(x => x.slug);\r\nexport const KNOWN_COLLECTIONS: string[] = [\r\n 'app',\r\n 'category',\r\n 'label',\r\n 'locale',\r\n 'market',\r\n 'menu',\r\n 'redirect',\r\n 'route',\r\n 'template',\r\n ...STATIC_COLLECTIONS,\r\n];\r\nexport const COLLECTIONS = [...ENV_COLLECTIONS, ...KNOWN_COLLECTIONS];\r\n","import { ApiRequestOptions } from '../api/api';\r\nimport { localApiFetch } from '../local/local.api';\r\nimport { remoteApiFetch } from '../remote/remote.api';\r\nimport { StoreStrategy, storeStrategy } from './store';\r\n\r\nconst storeApiFetch = storeStrategy === StoreStrategy.Mock ? localApiFetch : remoteApiFetch;\r\n\r\nexport async function storeApiGet<T = unknown>(url: string, options: ApiRequestOptions = {}): Promise<T> {\r\n return await storeApiFetch<T>(url, { ...options, method: 'GET' });\r\n}\r\n\r\nexport async function storeApiPost<T = unknown>(url: string, payload: unknown, options: ApiRequestOptions = {}): Promise<T> {\r\n return await storeApiFetch<T>(url, { ...options, method: 'POST', body: JSON.stringify(payload) });\r\n}\r\n\r\nexport async function storeApiPut<T = unknown>(url: string, payload: unknown, options: ApiRequestOptions = {}): Promise<T> {\r\n return await storeApiFetch<T>(url, { ...options, method: 'PUT', body: JSON.stringify(payload) });\r\n}\r\n\r\nexport async function storeApiPatch<T = unknown>(url: string, payload: unknown, options: ApiRequestOptions = {}): Promise<T> {\r\n return await storeApiFetch<T>(url, { ...options, method: 'PATCH', body: JSON.stringify(payload) });\r\n}\r\n\r\nexport async function storeApiDelete<T = unknown>(url: string, options: ApiRequestOptions = {}): Promise<T> {\r\n return await storeApiFetch<T>(url, { ...options, method: 'DELETE' });\r\n}\r\n"],"mappings":";;;AAIA,SAAgB,4BAA+C;AAC7D,QAAO,EACL,SAAS,CACR,EACF;AACF;AAED,SAAgB,2BAA2BA,OAAmC;AAC5E,KAAI,MAEF,QAAO,EAEL,SAAS,EACP,eAAe,CAAC,IAAI,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M;GACP;GACD;IACE,MAAM;IACN,MAAM;GACP;EACF;CACF;CAAE;EACD,KAAK;EACL,MAAM;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;GACP;GACD;IACE,MAAM;IACN,MAAM;GACP;GACD;IACE,MAAM;IACN,MAAM;GACP;GACD;IACE,MAAM;IACN,MAAM;IACN,YAAY;IACZ,SAAS;IACT,UAAU;GACX;GACD;IACE,MAAM;IACN,MAAM;IACN,YAAY;IACZ,SAAS;IACT,UAAU;GACX;GACD;IACE,MAAM;IACN,MAAM;IACN,YAAY;IACZ,SAAS;IACT,UAAU;GACX;GACD;IACE,MAAM;IACN,MAAM;IACN,YAAY;IACZ,SAAS;IACT,UAAU;GACX;EACF;CACF;CAAE;EACD,KAAK;EACL,MAAM;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;GACP;GACD;IACE,MAAM;IACN,MAAM;GACP;GACD;IACE,MAAM;IACN,MAAM;GACP;GACD;IACE,MAAM;IACN,MAAM;IACN,YAAY;IACZ,SAAS;IACT,UAAU;GACX;GACD;IACE,MAAM;IACN,MAAM;IACN,YAAY;IACZ,SAAS;IACT,UAAU;GACX;GACD;IACE,MAAM;IACN,MAAM;IACN,YAAY;IACZ,SAAS;IACT,UAAU;GACX;EACF;CACF;CAAE;EACD,KAAK;EACL,MAAM;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;GACP;GACD;IACE,MAAM;IACN,MAAM;GACP;GACD;IACE,MAAM;IACN,MAAM;IACN,YAAY;IACZ,SAAS;IACT,UAAU;GACX;GACD;IACE,MAAM;IACN,MAAM;IACN,YAAY;IACZ,SAAS;IACT,UAAU;GACX;EACF;CACF;CAAE;EACD,KAAK;EACL,MAAM;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;GACP;GACD;IACE,MAAM;IACN,MAAM;GACP;GACD;IACE,MAAM;IACN,MAAM;IACN,YAAY;IACZ,SAAS;IACT,UAAU;GACX;EACF;CACF;AAAC;;;;ACjPF,IAAY,k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ACvG,QAAO,MAAM,cAAiB,KAAK;EAAE,GAAG;EAAS,QAAQ;CAAO,EAAC;AAClE;AAED,eAAsB,aAA0BD,KAAaE,SAAkBD,UAA6B,CAAE,GAAc;AAC1H,QAAO,MAAM,cAAiB,KAAK;EAAE,GAAG;EAAS,QAAQ;EAAQ,MAAM,KAAK,UAAU,QAAQ;CAAE,EAAC;AAClG;AAED,eAAsB,YAAyBD,KAAaE,SAAkBD,UAA6B,CAAE,GAAc;AACzH,QAAO,MAAM,cAAiB,KAAK;EAAE,GAAG;EAAS,QAAQ;EAAO,MAAM,KAAK,UAAU,QAAQ;CAAE,EAAC;AACjG;AAED,eAAsB,cAA2BD,KAAaE,SAAkBD,UAA6B,CAAE,GAAc;AAC3H,QAAO,MAAM,cAAiB,KAAK;EAAE,GAAG;EAAS,QAAQ;EAAS,MAAM,KAAK,UAAU,QAAQ;CAAE,EAAC;AACnG;AAED,eAAsB,eAA4BD,KAAaC,UAA6B,CAAE,GAAc;AAC1G,QAAO,MAAM,cAAiB,KAAK;EAAE,GAAG;EAAS,QAAQ;CAAU,EAAC;AACrE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@websolutespa/bom-mixer-store",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "Mixer Store module of the BOM Repository",
5
5
  "keywords": [
6
6
  "bom",
@@ -27,18 +27,18 @@
27
27
  "mime": "^3.0.0"
28
28
  },
29
29
  "peerDependencies": {
30
- "@websolutespa/bom-core": "*",
30
+ "@websolutespa/bom-core": "^3.0.1",
31
31
  "iron-session": "8.0.4",
32
32
  "next": "16.1.6",
33
33
  "payload": "3.74.0"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@types/mime": "^3.0.1",
37
- "@websolutespa/bom-cli": "*",
38
- "@websolutespa/test": "*",
39
- "@websolutespa/tsconfig": "*",
37
+ "@websolutespa/bom-cli": "^3.0.1",
38
+ "@websolutespa/eslint-config": "^3.0.0",
39
+ "@websolutespa/test": "^3.0.1",
40
+ "@websolutespa/tsconfig": "^3.0.0",
40
41
  "eslint": "9.31.0",
41
- "@websolutespa/eslint-config": "*",
42
42
  "npm-run-all": "4.1.5",
43
43
  "typescript": "5.8.3"
44
44
  },
@@ -13,9 +13,7 @@ const API_URL = (
13
13
  const API_BASE = process.env.NEXT_PUBLIC_API || '/api';
14
14
 
15
15
  export function getLocalApiUrl(pathname: string): string {
16
- let url = `${isBrowser ? window.location.origin : API_URL}${API_BASE}${pathname}`;
17
- // !!! node 18 issue -> require('dns').setDefaultResultOrder('ipv4first');
18
- url = isBrowser ? url : url.replace('://localhost', '://127.0.0.1');
16
+ const url = `${isBrowser ? window.location.origin : API_URL}${API_BASE}${pathname}`;
19
17
  // console.log('getLocalApiUrl', url);
20
18
  return url;
21
19
  }
@@ -9,9 +9,7 @@ const API_URL = process.env.STORE_URL;
9
9
  const API_BASE = process.env.STORE_API || '/api';
10
10
 
11
11
  export function getLocalApiUrl(pathname: string): string {
12
- let url = `${API_URL}${API_BASE}${pathname}`;
13
- // !!! node 18 issue -> require('dns').setDefaultResultOrder('ipv4first');
14
- url = isBrowser ? url : url.replace('://localhost', '://127.0.0.1');
12
+ const url = `${API_URL}${API_BASE}${pathname}`;
15
13
  // console.log('getLocalApiUrl', url);
16
14
  return url;
17
15
  }
@@ -1,4 +1,4 @@
1
- import { httpFetch, isBrowser, merge } from '@websolutespa/bom-core';
1
+ import { httpFetch, merge } from '@websolutespa/bom-core';
2
2
  import { ApiRequestOptions, getLocalApiRequestOptions } from '../api/api';
3
3
 
4
4
  /**
@@ -8,9 +8,7 @@ const API_URL = process.env.NEXT_PUBLIC_URL;
8
8
  const API_BASE = process.env.NEXT_PUBLIC_API || '/api';
9
9
 
10
10
  function getMockApiUrl(pathname: string): string {
11
- let url = `${API_URL}${API_BASE}/_mock${pathname}`;
12
- // !!! node 18 issue -> require('dns').setDefaultResultOrder('ipv4first');
13
- url = isBrowser ? url : url.replace('://localhost', '://127.0.0.1');
11
+ const url = `${API_URL}${API_BASE}/_mock${pathname}`;
14
12
  // console.log('getMockApiUrl', url);
15
13
  return url;
16
14
  }
@@ -9,9 +9,7 @@ const API_URL = process.env.STORE_URL;
9
9
  const API_BASE = process.env.STORE_API || '/api';
10
10
 
11
11
  export function getRemoteApiUrl(pathname: string): string {
12
- let url = `${API_URL}${API_BASE}${pathname}`;
13
- // !!! node 18 issue -> require('dns').setDefaultResultOrder('ipv4first');
14
- url = isBrowser ? url : url.replace('://localhost', '://127.0.0.1');
12
+ const url = `${API_URL}${API_BASE}${pathname}`;
15
13
  // console.log('getRemoteApiUrl', url);
16
14
  return url;
17
15
  }
@@ -11,7 +11,7 @@ export async function getSession<T extends object = Record<string, any>>(
11
11
  response: NextResponse | NextApiResponse | ServerResponse<IncomingMessage>
12
12
  ): Promise<IronSession<T>> {
13
13
  const COOKIE_NAME = 'websolutespa-next-js';
14
- const COOKIE_PASSWORD = process.env.MIXER_SECRET as string || 'MIXER_SECRET_32_CHARS_LONG';
14
+ const COOKIE_PASSWORD = process.env.MIXER_SECRET as string || 'MIXER_SECRET_32_CHARS_LONG_12345';
15
15
  const sessionOptions: SessionOptions = {
16
16
  cookieName: COOKIE_NAME,
17
17
  // secure: true should be used in production (HTTPS) but can't be used in development (HTTP)
@@ -1 +0,0 @@
1
- {"version":3,"file":"src-fjNC1rqq.js","names":["token?: string","CACHE_: Map<string, unknown>","callback: () => Promise<T>","key?: string","store: IStore","item: T","params: QueryParams","items: T[]","categories: ICategory[]","routes: IRoute[]","depth: number","store: IStore","item: T","params: QueryParams","items: T[]","item: B","params: QueryParams","items: B[]","decoratedItems: B[]","store: IStore","item: IUndecoratedMenu","params: { market: string, locale: string }","decoratedItem: IMenu","items: IUndecoratedMenu[]","decoratedItems: IMenu[]","items: IUndecoratedMenuItem[]","market: string","item: IUndecoratedMenuItem","undecoratedCategories: IUndecoratedMenuCategory[]","undecoratedPages: IUndecoratedMenuPage[]","item: IUndecoratedMenuCategory","category: ICategory","items: IMenuItem[]","categories: ICategory[]","routes: IRoute[]","depth: number","route: IRoute","route","childRouteItems: IMenuItem[]","item: IRoute","decoratedItem: IMenuRoute","item: IUndecoratedMenuPage","params: QueryParams","decoratedItem: IMenuPage","store: IStore","item: T","params: QueryParams","routes?: IRoute[]","items: T[]","item: unknown","navs: IUndecoratedNav[]","item: IUndecoratedNav","routes: IRoute[]","item: T","items: T[]","optimizedItems: T[]","store: IStore","item: T","params: QueryParams","items: T[]","context: {\r\n store: IStore;\r\n params: QueryParams;\r\n depth: number;\r\n}","relations: IPageResolvedRelation[]","items: ICategorized[]","store: IStore","item: T","schema: string","items: T[]","API_URL","API_BASE","pathname: string","options: ApiRequestOptions","serviceOptions?: { locale: string, market: string }","url: string","payload?: unknown","API_URL","API_BASE","pathname: string","options: ApiRequestOptions","url: string","payload: unknown","pathname: string","options: ApiRequestOptions","url: string","payload: unknown","staticCollections: StaticServiceConfig[]","nextPhase","nextPhase: NextPhase","buildStrategy","buildStrategy: BuildStrategy","storeStrategy","storeStrategy: StoreStrategy","storeCacheDuration","storeCacheDuration: number","ENV_COLLECTIONS: string[]","MOCK_COLLECTIONS: string[]","STATIC_COLLECTIONS: string[]","KNOWN_COLLECTIONS: string[]","url: string","options: ApiRequestOptions","payload: unknown"],"sources":["../src/api/api.ts","../src/cache/cache.service.ts","../src/decorators/consts.ts","../src/decorators/category.ts","../src/decorators/href.ts","../src/decorators/localizable.ts","../src/decorators/menu.ts","../src/decorators/nav.ts","../src/decorators/optimize.ts","../src/decorators/relation.ts","../src/decorators/schema.ts","../src/local/local.api.ts","../src/mock/mock.api.ts","../src/remote/remote.api.ts","../src/static/static.ts","../src/store/store.ts","../src/store/store.api.ts"],"sourcesContent":["import { FetchRequestOptions } from '@websolutespa/bom-core';\r\n\r\nexport type ApiRequestOptions = FetchRequestOptions;\r\n\r\nexport function getLocalApiRequestOptions(): ApiRequestOptions {\r\n return {\r\n headers: {\r\n },\r\n };\r\n}\r\n\r\nexport function getRemoteApiRequestOptions(token?: string): ApiRequestOptions {\r\n if (token) {\r\n // authenticated end user JWT token bearer (end_users)\r\n return {\r\n // mode: 'cors',\r\n headers: {\r\n Authorization: `JWT ${token}`,\r\n // Authorization: `Bearer ${token}`,\r\n },\r\n };\r\n } else {\r\n // guest user api key (users)\r\n return {\r\n // mode: 'cors',\r\n headers: {\r\n Authorization: `users API-Key ${process.env.STORE_API_KEY}`,\r\n },\r\n };\r\n }\r\n}\r\n","const CACHE_: Map<string, unknown> = new Map<string, unknown>();\r\n\r\nexport async function fromCache<T = unknown>(callback: () => Promise<T>, key?: string): Promise<T> {\r\n if (key && CACHE_.has(key)) {\r\n return CACHE_.get(key) as T;\r\n } else {\r\n const t = await callback();\r\n if (key) {\r\n CACHE_.set(key, t);\r\n }\r\n return t;\r\n }\r\n}\r\n","\r\nexport const DEFAULT_DEPTH = 3;\r\n","import { ICategorized, ICategory, IEquatable, IRoute, IStore, QueryParams, findRouteOfCategory, isUnresolvedCategory } from '@websolutespa/bom-core';\r\nimport { DEFAULT_DEPTH } from './consts';\r\n\r\nexport async function decorateCategory_<T extends { category?: IEquatable | ICategory } = { category?: IEquatable | ICategory }>(store: IStore, item: T, params: QueryParams = {}): Promise<T | (T & { category: ICategory })> {\r\n const depth = params.depth != null ? params.depth : DEFAULT_DEPTH;\r\n if (depth === 0) {\r\n return item;\r\n }\r\n const categories = await store.category!.findMany<ICategory>({\r\n market: params.market,\r\n locale: params.locale,\r\n depth: 0,\r\n });\r\n const routes = await store.route!.findMany<IRoute>();\r\n const decoratedItem = await collectCategory_(categories, routes, item, params, depth);\r\n return decoratedItem as T & { category: ICategory };\r\n}\r\n\r\nexport async function decorateCategories_<T extends ICategorized = ICategorized>(store: IStore, items: T[], params: QueryParams = {}): Promise<(T | (T & { category: ICategory }))[]> {\r\n const depth = params.depth != null ? params.depth : DEFAULT_DEPTH;\r\n if (depth === 0) {\r\n return items;\r\n }\r\n const categories = await store.category!.findMany<ICategory>({\r\n market: params.market,\r\n locale: params.locale,\r\n depth: 0,\r\n });\r\n const routes = await store.route!.findMany<IRoute>();\r\n const decoratedItems = [];\r\n for (const item of items) {\r\n const decoratedItem = await collectCategory_(categories, routes, item, params, depth);\r\n decoratedItems.push(decoratedItem);\r\n }\r\n return decoratedItems;\r\n}\r\n\r\nexport async function collectCategory_<\r\n T extends { category?: IEquatable | ICategory } = { category?: IEquatable | ICategory }\r\n>(\r\n categories: ICategory[],\r\n routes: IRoute[],\r\n item: T,\r\n params: QueryParams = {},\r\n depth: number\r\n): Promise<T> {\r\n if (depth === 0) {\r\n return item;\r\n }\r\n if (isUnresolvedCategory(item.category)) {\r\n const category = categories.find(x => x.id === item.category);\r\n if (category) {\r\n const route = findRouteOfCategory(routes, category.id, params.market, params.locale);\r\n if (route) {\r\n category.href = route.id;\r\n }\r\n const decoratedCategory = await collectCategory_(categories, routes, category, params, depth - 1);\r\n return { ...item, category: decoratedCategory };\r\n }\r\n }\r\n return item;\r\n}\r\n","import { IRoute, ISchema, IStore, QueryParams } from '@websolutespa/bom-core';\r\n\r\nexport async function decorateHref_<T extends ISchema = ISchema>(store: IStore, item: T, params: QueryParams = {}): Promise<T | T & { href: string | null }> {\r\n if (params.market && params.locale) {\r\n const routes = await store.route!.findMany<IRoute>({\r\n where: {\r\n market: {\r\n equals: params.market,\r\n },\r\n locale: {\r\n equals: params.locale,\r\n },\r\n schema: {\r\n equals: item.schema,\r\n },\r\n page: {\r\n equals: item.id,\r\n },\r\n },\r\n });\r\n const href = routes.length ? routes[0]!.id : null;\r\n return { ...item, href };\r\n } else {\r\n return item;\r\n }\r\n}\r\n\r\nexport async function decorateHrefs_<T extends ISchema = ISchema>(store: IStore, items: T[], params: QueryParams = {}): Promise<T[] | (T & { href: string | null })[]> {\r\n if (params.market && params.locale) {\r\n const routes = await store.route!.findMany<IRoute>({\r\n where: {\r\n market: {\r\n equals: params.market,\r\n },\r\n locale: {\r\n equals: params.locale,\r\n },\r\n },\r\n });\r\n return items.map(item => {\r\n const route = routes.find(x =>\r\n x.schema === item.schema &&\r\n x.page === item.id\r\n );\r\n const href = route ? route.id : null;\r\n return { ...item, href };\r\n });\r\n } else {\r\n return items;\r\n }\r\n}\r\n","import { QueryParams, cloneItem, localizeItem } from '@websolutespa/bom-core';\r\n\r\nexport async function decorateLocalizable_<B>(item: B, params: QueryParams = {}): Promise<B> {\r\n if (params.locale) {\r\n return localizeItem(item, params.locale);\r\n } else {\r\n return cloneItem(item);\r\n }\r\n}\r\n\r\nexport async function decorateLocalizables_<B>(items: B[], params: QueryParams = {}): Promise<B[]> {\r\n const decoratedItems: B[] = [];\r\n for (const item of items) {\r\n const decoratedItem = params.locale ?\r\n localizeItem(item, params.locale) :\r\n cloneItem(item);\r\n decoratedItems.push(decoratedItem);\r\n }\r\n return decoratedItems;\r\n}\r\n","import {\r\n ICategorized, ICategory, IMenu, IMenuCategory, IMenuGroup, IMenuItem, IMenuPage, IMenuRoute, IRoute, IStore,\r\n IUndecoratedMenu, IUndecoratedMenuCategory, IUndecoratedMenuItem, IUndecoratedMenuPage, MenuCategoryStrategy, QueryParams,\r\n asCategoryId,\r\n findCategoryInCategories,\r\n findChildCategories,\r\n findRouteOfCategory,\r\n isEquatable, isUndecoratedMenuCategory, isUndecoratedMenuPage,\r\n uuidv4\r\n} from '@websolutespa/bom-core';\r\n\r\nexport async function decorateMenu_(store: IStore, item: IUndecoratedMenu, params: { market: string, locale: string }): Promise<IMenu> {\r\n const { market, locale } = params;\r\n const items = itemsFilteredByMarket_(item.items || [], market);\r\n const decoratedItem: IMenu = {\r\n id: item.id,\r\n items: [],\r\n };\r\n const undecoratedCategories = collectUndecoratedCategories(items);\r\n const undecoratedPages = collectUndecoratedPages(items);\r\n if (\r\n undecoratedCategories.length > 0 ||\r\n undecoratedPages.length > 0\r\n ) {\r\n const routes = await store.route!.findMany<IRoute>({\r\n where: {\r\n ...(market ? { market: { equals: market } } : {}),\r\n ...(locale ? { locale: { equals: locale } } : {}),\r\n },\r\n });\r\n if (undecoratedCategories.length > 0) {\r\n const categories = await store.category!.findMany<ICategory>(params);\r\n for (const undecoratedMenuCategory of undecoratedCategories) {\r\n const decoratedMenuCategory = decorateMenuCategory_(undecoratedMenuCategory, categories, routes, market);\r\n Object.assign(undecoratedMenuCategory, decoratedMenuCategory);\r\n }\r\n }\r\n for (const undecoratedMenuPage of undecoratedPages) {\r\n const decoratedMenuPage = await decorateMenuPage_(undecoratedMenuPage, routes, store, { ...params });\r\n Object.assign(undecoratedMenuPage, decoratedMenuPage);\r\n }\r\n }\r\n decoratedItem.items = items as IMenuItem[];\r\n return decoratedItem;\r\n}\r\n\r\nexport async function decorateMenus_(store: IStore, items: IUndecoratedMenu[], params: { market: string, locale: string }): Promise<IMenu[]> {\r\n const decoratedItems: IMenu[] = [];\r\n for (const item of items) {\r\n const decoratedItem = await decorateMenu_(store, item, params);\r\n decoratedItems.push(decoratedItem);\r\n }\r\n return decoratedItems;\r\n}\r\n\r\nfunction itemsFilteredByMarket_(items: IUndecoratedMenuItem[], market: string): IUndecoratedMenuItem[] {\r\n return items.filter(x => {\r\n const hasMarket = itemHasMarket_(x, market);\r\n if (hasMarket && x.items) {\r\n x.items = itemsFilteredByMarket_(x.items || [], market);\r\n }\r\n return hasMarket;\r\n });\r\n}\r\n\r\nfunction itemHasMarket_(item: IUndecoratedMenuItem, market: string): boolean {\r\n return (Array.isArray(item.markets) && item.markets.length > 0) ? item.markets.includes(market) : true;\r\n}\r\n\r\nfunction collectUndecoratedCategories(items: IUndecoratedMenuItem[], undecoratedCategories: IUndecoratedMenuCategory[] = []): IUndecoratedMenuCategory[] {\r\n items.forEach(item => {\r\n if (isUndecoratedMenuCategory(item)) {\r\n undecoratedCategories.push(item);\r\n }\r\n if (item.items) {\r\n collectUndecoratedCategories(item.items, undecoratedCategories);\r\n }\r\n });\r\n return undecoratedCategories;\r\n}\r\n\r\nfunction collectUndecoratedPages(items: IUndecoratedMenuItem[], undecoratedPages: IUndecoratedMenuPage[] = []): IUndecoratedMenuPage[] {\r\n items.forEach(item => {\r\n if (isUndecoratedMenuPage(item)) {\r\n undecoratedPages.push(item);\r\n }\r\n if (item.items) {\r\n collectUndecoratedPages(item.items, undecoratedPages);\r\n }\r\n });\r\n return undecoratedPages;\r\n}\r\n\r\nexport const MAX_INT = 1000000000000; // 9007199254740991\r\n\r\nfunction makeCategoryMenuItem_(item: IUndecoratedMenuCategory, category: ICategory): IMenuCategory | IMenuGroup {\r\n const id = item.id || uuidv4();\r\n const title = item.title || category.title || '';\r\n const abstract = item.abstract || undefined;\r\n const customClass = item.customClass || undefined;\r\n const media = item.media || category.media;\r\n const items: IMenuItem[] = [];\r\n return category.isHidden ?\r\n {\r\n type: 'group',\r\n id,\r\n title,\r\n abstract,\r\n media,\r\n customClass,\r\n items,\r\n } : {\r\n type: 'category',\r\n category: category.id,\r\n id,\r\n href: '',\r\n title,\r\n abstract,\r\n media,\r\n customClass,\r\n items,\r\n };\r\n}\r\n\r\nfunction decorateMenuCategory_(\r\n item: IUndecoratedMenuCategory,\r\n categories: ICategory[],\r\n routes: IRoute[],\r\n market: string,\r\n depth: number = 0\r\n): IMenuItem | undefined {\r\n const strategy = item.strategy || MenuCategoryStrategy.Default;\r\n const categoryId = asCategoryId(item.category);\r\n // find category\r\n const category = categoryId ? categories.find(x => x.id === categoryId) : undefined;\r\n if (category) {\r\n const decoratedItem = makeCategoryMenuItem_(item, category);\r\n if (!category.isHidden) {\r\n const route = routes.find((route: IRoute) => route.isDefault && route.resolvedCategory === category.id);\r\n if (route) {\r\n (decoratedItem as IMenuCategory).href = route.id;\r\n if (!decoratedItem.media) {\r\n decoratedItem.media = route.media;\r\n }\r\n }\r\n }\r\n // checking for max depth recursion\r\n let maxDepth = item.maxDepth;\r\n if (typeof maxDepth === 'number') {\r\n if (depth > maxDepth) {\r\n return decoratedItem;\r\n }\r\n maxDepth--;\r\n }\r\n // search child categories\r\n const childCategories = (category.id ?\r\n categories.filter(x => asCategoryId(x.category) === category.id) : []\r\n ).filter(x => {\r\n switch (strategy) {\r\n case MenuCategoryStrategy.ExcludeHidden:\r\n return Boolean(x.isHidden) === false;\r\n case MenuCategoryStrategy.Default:\r\n return true;\r\n }\r\n });\r\n // sort child categories\r\n childCategories.sort((a, b) => {\r\n return (a.order || MAX_INT) - (b.order || MAX_INT);\r\n });\r\n // define sub strategy (!!! todo)\r\n const subStrategy = strategy;\r\n // decorate child categories\r\n const childCategoryItems = childCategories.map(c => decorateMenuCategory_({\r\n id: c.id,\r\n type: 'category',\r\n category: c.id,\r\n maxDepth,\r\n strategy: subStrategy, // dispatch sub strategy\r\n items: [],\r\n } as IUndecoratedMenuCategory, categories, routes, market, depth + 1));\r\n // find child routes\r\n const childRoutes = routes.filter((route: IRoute) => {\r\n switch (strategy) {\r\n case MenuCategoryStrategy.ExcludeHidden:\r\n return route.resolvedCategory === category.id && Boolean(route.isDefault) === false;\r\n case MenuCategoryStrategy.Default:\r\n return route.category === category.id && (category.isHidden || Boolean(route.isDefault) === false);\r\n }\r\n });\r\n // sort child routes\r\n childRoutes.sort((a, b) => {\r\n return (a.order || MAX_INT) - (b.order || MAX_INT);\r\n });\r\n // decorate child routes\r\n const childRouteItems: IMenuItem[] = childRoutes.map(x => decorateMenuRoute_(x));\r\n // filter items\r\n decoratedItem.items = [\r\n ...childCategoryItems,\r\n ...childRouteItems,\r\n ].filter(x => Boolean(x)) as IMenuItem[];\r\n return decoratedItem;\r\n }\r\n // return unresolved category as group\r\n return {\r\n id: item.id || uuidv4(),\r\n type: 'group',\r\n title: item.title || '',\r\n items: [],\r\n };\r\n}\r\n\r\nfunction decorateMenuCategoryWithHiddenSubCategories_(\r\n item: IUndecoratedMenuCategory,\r\n categories: ICategory[],\r\n routes: IRoute[],\r\n market: string,\r\n depth: number = 0\r\n): IMenuItem {\r\n const decoratedItem: IMenuCategory = {\r\n abstract: item.abstract,\r\n category: '',\r\n customClass: item.customClass,\r\n href: '',\r\n id: item.id || uuidv4(),\r\n items: [],\r\n title: '',\r\n type: item.type,\r\n };\r\n /*\r\n const categoryId = asCategoryId(item.category);\r\n const category = categoryId ? categories.find(x => x.id === categoryId) : undefined;\r\n */\r\n const category = findCategoryInCategories(categories, item.category);\r\n if (category) {\r\n // assigning category id\r\n decoratedItem.category = category.id;\r\n // assigning category title\r\n decoratedItem.title = item.title || category.title || '';\r\n // assigning current or category media\r\n decoratedItem.media = item.media || category.media;\r\n // find category's index page route\r\n const route = findRouteOfCategory(routes, category.id);\r\n if (route) {\r\n // hasLink\r\n decoratedItem.href = route.id;\r\n } else {\r\n // isGroup\r\n }\r\n // checking for max depth recursion\r\n let maxDepth = item.maxDepth;\r\n if (typeof maxDepth === 'number') {\r\n if (depth > maxDepth) {\r\n return decoratedItem;\r\n }\r\n maxDepth--;\r\n }\r\n // search child categories\r\n const childCategories = findChildCategories(categories, category.id);\r\n if (childCategories.length) {\r\n // sort child categories\r\n childCategories.sort((a, b) => {\r\n return (a.order || MAX_INT) - (b.order || MAX_INT);\r\n });\r\n decoratedItem.items = childCategories.map(c => {\r\n const menuCategory = decorateMenuCategoryWithHiddenSubCategories_({\r\n id: c.id,\r\n type: 'category',\r\n category: c.id,\r\n maxDepth,\r\n items: [],\r\n } as IUndecoratedMenuCategory, categories, routes, market, depth + 1);\r\n if (c.isHidden) {\r\n const group: IMenuGroup = {\r\n id: c.id,\r\n type: 'group',\r\n title: c.title,\r\n items: [\r\n ...(menuCategory.items || []),\r\n ],\r\n };\r\n // find child routes\r\n // const childRoutes = findRoutesOfCategory(routes, c.id, false);\r\n const childRoutes = routes.filter((route: IRoute) =>\r\n route.category === c.id &&\r\n Boolean(route.isDefault) === false\r\n );\r\n // sort child routes\r\n childRoutes.sort((a, b) => {\r\n return (a.order || MAX_INT) - (b.order || MAX_INT);\r\n });\r\n const routeLinks = childRoutes.map(x => decorateMenuRoute_(x));\r\n group.items?.push(...routeLinks);\r\n return group;\r\n } else {\r\n return decorateMenuCategoryWithHiddenSubCategories_({\r\n id: c.id,\r\n type: 'category',\r\n category: c.id,\r\n maxDepth,\r\n items: [],\r\n } as IUndecoratedMenuCategory, categories, routes, market, depth + 1);\r\n }\r\n });\r\n }\r\n // find child routes\r\n // const childRoutes = findRoutesOfCategory(routes, category.id, false);\r\n const childRoutes = routes.filter((route: IRoute) =>\r\n route.category === category.id &&\r\n Boolean(route.isDefault) === false\r\n );\r\n // console.log('childRoutes', childRoutes, category.id);\r\n // sort child routes\r\n childRoutes.sort((a, b) => {\r\n return (a.order || MAX_INT) - (b.order || MAX_INT);\r\n });\r\n decoratedItem.items = [\r\n ...(decoratedItem.items || []),\r\n ...childRoutes.map(x => decorateMenuRoute_(x)),\r\n ];\r\n\r\n }\r\n return decoratedItem;\r\n}\r\n\r\nfunction decorateMenuRoute_(\r\n item: IRoute\r\n): IMenuItem {\r\n const decoratedItem: IMenuRoute = {\r\n id: uuidv4(),\r\n type: 'route',\r\n title: item.title,\r\n href: item.id,\r\n media: item.media,\r\n page: item.page,\r\n schema: item.schema,\r\n items: [],\r\n };\r\n return decoratedItem;\r\n}\r\n\r\nasync function decorateMenuPage_(\r\n item: IUndecoratedMenuPage,\r\n routes: IRoute[],\r\n store: IStore,\r\n params: QueryParams = {}\r\n): Promise<IMenuItem> {\r\n const values = Array.isArray(item.page.value) ? item.page.value : [item.page.value];\r\n const value = values[0]!; // !!!\r\n const id = isEquatable(value) ? value : value.id;\r\n const route = routes.find(x =>\r\n x.schema === item.page.relationTo &&\r\n x.page === id\r\n );\r\n const page = await store[item.page.relationTo]!.findOne<ICategorized>(id, { ...params });\r\n const decoratedItem: IMenuPage = {\r\n id: item.id || uuidv4(),\r\n type: item.type,\r\n title: item.title || page?.title || '',\r\n abstract: item.abstract || page?.abstract || '',\r\n customClass: item.customClass,\r\n href: route?.id || '',\r\n media: page?.media,\r\n page: route?.page || '',\r\n schema: route?.schema || '',\r\n items: (item.items || []) as IMenuItem[],\r\n };\r\n return decoratedItem;\r\n}\r\n","import { IDecoratedNav, IEquatable, IRoute, ISchema, IStore, IUndecoratedNav, QueryParams, isArray, isObject, isUndecoratedNav } from '@websolutespa/bom-core';\r\n\r\nexport async function decorateNav_<T extends ISchema = ISchema>(store: IStore, item: T, params: QueryParams = {}, routes?: IRoute[]): Promise<T> {\r\n if (!routes) {\r\n routes = await store.route!.findMany<IRoute>({\r\n where: {\r\n ...(params.market ? { market: { equals: params.market } } : {}),\r\n ...(params.locale ? { locale: { equals: params.locale } } : {}),\r\n },\r\n });\r\n }\r\n const navs = collectNavs_(item);\r\n for (const nav of navs) {\r\n const decoratedNav = decorateNav__(nav, routes);\r\n Object.assign(nav, decoratedNav);\r\n // (nav as IDecoratedNav<T>).nav = decoratedNav.nav;\r\n }\r\n return item;\r\n}\r\n\r\nexport async function decorateNavs_<T extends ISchema = ISchema>(store: IStore, items: T[], params: QueryParams = {}): Promise<T[]> {\r\n const routes = await store.route!.findMany<IRoute>({\r\n where: {\r\n ...(params.market ? { market: { equals: params.market } } : {}),\r\n ...(params.locale ? { locale: { equals: params.locale } } : {}),\r\n },\r\n });\r\n for (const item of items) {\r\n await decorateNav_<T>(store, item, params, routes);\r\n }\r\n return items;\r\n}\r\n\r\n// collecting navs recursively\r\nfunction collectNavs_(item: unknown, navs: IUndecoratedNav[] = []): IUndecoratedNav[] {\r\n if (isUndecoratedNav(item)) {\r\n navs.push(item);\r\n }\r\n // console.log(item, isUndecoratedNav<T>(item));\r\n if (isArray(item)) {\r\n item.forEach(x => collectNavs_(x, navs));\r\n } else if (isObject(item)) {\r\n Object.values(item).forEach(value => {\r\n collectNavs_(value, navs);\r\n });\r\n }\r\n return navs;\r\n}\r\n\r\nfunction decorateNav__(item: IUndecoratedNav, routes: IRoute[]): IDecoratedNav {\r\n let decoratedNav = item as unknown as IDecoratedNav;\r\n if (item !== undefined) {\r\n const route = routes.find(x =>\r\n x.page === (item.page.value as unknown as IEquatable) &&\r\n x.schema === item.page.relationTo\r\n );\r\n if (route) {\r\n decoratedNav = {\r\n type: 'page',\r\n id: route.page,\r\n href: route.id,\r\n title: route.title,\r\n page: route.page,\r\n schema: route.schema,\r\n };\r\n }\r\n }\r\n return decoratedNav;\r\n}\r\n","import { ICategorized } from '@websolutespa/bom-core';\r\n\r\nexport async function optimizeOne_<T extends ICategorized = ICategorized>(item: T): Promise<T> {\r\n const validEntries = Object.entries(item).filter(([key, value]) => {\r\n switch (key) {\r\n case 'components':\r\n case 'meta':\r\n return false;\r\n /*\r\n default:\r\n if (\r\n isUnresolvedRelation(value) ||\r\n (\r\n Array.isArray(value) &&\r\n value.reduce((p, c) => p && isUnresolvedRelation(c), true)\r\n )\r\n ) {\r\n return false;\r\n }\r\n */\r\n }\r\n return true;\r\n });\r\n return Object.fromEntries(validEntries) as T;\r\n}\r\n\r\nexport async function optimizeMany_<T extends ICategorized = ICategorized>(items: T[]): Promise<T[]> {\r\n const optimizedItems: T[] = [];\r\n for (const item of items) {\r\n const optimizedItem = await optimizeOne_<T>(item);\r\n optimizedItems.push(optimizedItem);\r\n }\r\n return optimizedItems;\r\n}\r\n","import { ICategorized, IEquatable, ISchema, IStore, QueryParams, isArray, isObject, isUnresolvedRelation } from '@websolutespa/bom-core';\r\nimport { DEFAULT_DEPTH } from './consts';\r\n\r\nexport async function decorateRelation_<T extends ISchema = ISchema>(store: IStore, item: T, params: QueryParams = {}): Promise<T> {\r\n const depth = params.depth != null ? params.depth : DEFAULT_DEPTH;\r\n // console.log('decorateRelation_', depth, typeof depth);\r\n item = await collectRelations_({ store, params, depth }, item);\r\n return item;\r\n}\r\n\r\nexport async function decorateRelations_<T extends ISchema = ISchema>(store: IStore, items: T[], params: QueryParams = {}): Promise<T[]> {\r\n for (const item of items) {\r\n await decorateRelation_<T>(store, item, params);\r\n }\r\n return items;\r\n}\r\n\r\nexport type IPageResolvedRelation = {\r\n relationTo: string;\r\n value: IEquatable | IEquatable[];\r\n resolvedValue: ICategorized | ICategorized[] | null;\r\n};\r\n\r\n// collecting relations recursively\r\nasync function collectRelations_<T = any>(context: {\r\n store: IStore;\r\n params: QueryParams;\r\n depth: number;\r\n}, item: T, relations: IPageResolvedRelation[] = []): Promise<T> {\r\n if (isUnresolvedRelation(item)) {\r\n if (context.depth === 0) {\r\n return item.value as T;\r\n }\r\n // skip circular reference\r\n const index = relations.findIndex(x =>\r\n x.relationTo === item.relationTo && x.value === item.value\r\n );\r\n if (index === -1) {\r\n const isMany = Array.isArray(item.value);\r\n const values = isMany ? item.value : [item.value];\r\n let items: ICategorized[] = [];\r\n const collection = context.store[item.relationTo];\r\n if (collection) {\r\n items = await collection.findMany<ICategorized>({\r\n ...context.params,\r\n where: {\r\n id: { in: values },\r\n },\r\n depth: context.depth - 1,\r\n });\r\n } else {\r\n console.log('collectRelations_', `unknown relation \"${item.relationTo}\"`);\r\n }\r\n const resolvedValue = isMany ? items : (items.length > 0 ? items[0]! : null);\r\n // console.log('resolvedValue', resolvedValue);\r\n relations.push({\r\n ...item,\r\n resolvedValue,\r\n });\r\n return resolvedValue as T;\r\n } else {\r\n return relations[index]!.resolvedValue as T;\r\n }\r\n } else if (isArray(item)) {\r\n const items = [];\r\n for (let i = 0; i < item.length; i++) {\r\n items[i] = await collectRelations_(context, item[i], relations);\r\n }\r\n return items as T;\r\n } else if (isObject(item)) {\r\n for (const [key, value] of Object.entries(item)) {\r\n (item[key] as any) = await collectRelations_(context, value, relations);\r\n }\r\n }\r\n return item;\r\n}\r\n","import { ISchema, IStore } from '@websolutespa/bom-core';\r\n\r\nexport async function decorateSchema_<T extends ISchema = ISchema>(store: IStore, item: T, schema: string): Promise<T | T & { schema: string }> {\r\n return { ...item, schema: item.schema || schema };\r\n}\r\n\r\nexport async function decorateSchemas_<T extends ISchema = ISchema>(store: IStore, items: T[], schema: string): Promise<(T & { schema: string })[]> {\r\n return items.map(item => {\r\n return { ...item, schema: item.schema || schema };\r\n });\r\n}\r\n","import { httpFetch, isBrowser, merge } from '@websolutespa/bom-core';\r\nimport { ApiRequestOptions, getLocalApiRequestOptions } from '../api/api';\r\n\r\n/**\r\n * This methods handle api requests / responses to local api (mixer)\r\n */\r\n\r\nconst API_URL = (\r\n process.env.NEXT_PUBLIC_URL === 'https://' ?\r\n process.env.NEXT_PUBLIC_MOCK_FALLBACK_URL :\r\n process.env.NEXT_PUBLIC_URL\r\n);\r\nconst API_BASE = process.env.NEXT_PUBLIC_API || '/api';\r\n\r\nexport function getLocalApiUrl(pathname: string): string {\r\n let url = `${isBrowser ? window.location.origin : API_URL}${API_BASE}${pathname}`;\r\n // !!! node 18 issue -> require('dns').setDefaultResultOrder('ipv4first');\r\n url = isBrowser ? url : url.replace('://localhost', '://127.0.0.1');\r\n // console.log('getLocalApiUrl', url);\r\n return url;\r\n}\r\n\r\nexport async function localApiFetch<T = unknown>(pathname: string, options: ApiRequestOptions = {}, serviceOptions?: { locale: string, market: string }): Promise<T> {\r\n // console.log('localApiFetch', pathname, options, serviceOptions);\r\n const url = new URL(getLocalApiUrl(pathname));\r\n if (serviceOptions) {\r\n url.searchParams.append('locale', serviceOptions.locale);\r\n url.searchParams.append('market', serviceOptions.market);\r\n }\r\n const apiOptions = merge({ ...getLocalApiRequestOptions() }, options);\r\n console.log('localApiFetch', apiOptions.method, url.href);\r\n const apiResponse = await httpFetch(url.href, apiOptions);\r\n // console.log('localApiFetch', pathname, apiResponse);\r\n return apiResponse;\r\n}\r\n\r\nexport async function localApiGet<T = unknown>(url: string, options: ApiRequestOptions = {}, serviceOptions?: { locale: string, market: string }): Promise<T> {\r\n return await localApiFetch<T>(url, { ...options, method: 'GET' }, serviceOptions);\r\n}\r\n\r\nexport async function localApiPost<T = unknown>(url: string, payload?: unknown, options: ApiRequestOptions = {}, serviceOptions?: { locale: string, market: string }): Promise<T> {\r\n return await localApiFetch<T>(url, { ...options, method: 'POST', body: payload ? JSON.stringify(payload) : undefined }, serviceOptions);\r\n}\r\n\r\nexport async function localApiPut<T = unknown>(url: string, payload?: unknown, options: ApiRequestOptions = {}, serviceOptions?: { locale: string, market: string }): Promise<T> {\r\n return await localApiFetch<T>(url, { ...options, method: 'PUT', body: payload ? JSON.stringify(payload) : undefined }, serviceOptions);\r\n}\r\n\r\nexport async function localApiPatch<T = unknown>(url: string, payload?: unknown, options: ApiRequestOptions = {}, serviceOptions?: { locale: string, market: string }): Promise<T> {\r\n return await localApiFetch<T>(url, { ...options, method: 'PATCH', body: payload ? JSON.stringify(payload) : undefined }, serviceOptions);\r\n}\r\n\r\nexport async function localApiDelete<T = unknown>(url: string, options: ApiRequestOptions = {}, serviceOptions?: { locale: string, market: string }): Promise<T> {\r\n return await localApiFetch<T>(url, { ...options, method: 'DELETE' }, serviceOptions);\r\n}\r\n","import { httpFetch, isBrowser, merge } from '@websolutespa/bom-core';\r\nimport { ApiRequestOptions, getLocalApiRequestOptions } from '../api/api';\r\n\r\n/**\r\n * This methods handle api requests / responses to local /api/_mock data\r\n */\r\nconst API_URL = process.env.NEXT_PUBLIC_URL;\r\nconst API_BASE = process.env.NEXT_PUBLIC_API || '/api';\r\n\r\nfunction getMockApiUrl(pathname: string): string {\r\n let url = `${API_URL}${API_BASE}/_mock${pathname}`;\r\n // !!! node 18 issue -> require('dns').setDefaultResultOrder('ipv4first');\r\n url = isBrowser ? url : url.replace('://localhost', '://127.0.0.1');\r\n // console.log('getMockApiUrl', url);\r\n return url;\r\n}\r\n\r\nexport async function mockApiFetch<T = unknown>(pathname: string, options: ApiRequestOptions = {}): Promise<T> {\r\n const url = getMockApiUrl(pathname);\r\n const apiOptions = merge({ ...getLocalApiRequestOptions() }, options);\r\n console.log('mockApiFetch', apiOptions.method, url);\r\n const apiResponse = await httpFetch(url, apiOptions);\r\n return apiResponse;\r\n}\r\n\r\nexport async function mockApiGet<T = unknown>(url: string, options: ApiRequestOptions = {}): Promise<T> {\r\n return await mockApiFetch<T>(url, { ...options, method: 'GET' });\r\n}\r\n\r\nexport async function mockApiPost<T = unknown>(url: string, payload: unknown, options: ApiRequestOptions = {}): Promise<T> {\r\n return await mockApiFetch<T>(url, { ...options, method: 'POST', body: JSON.stringify(payload) });\r\n}\r\n\r\nexport async function mockApiPut<T = unknown>(url: string, payload: unknown, options: ApiRequestOptions = {}): Promise<T> {\r\n return await mockApiFetch<T>(url, { ...options, method: 'PUT', body: JSON.stringify(payload) });\r\n}\r\n\r\nexport async function mockApiPatch<T = unknown>(url: string, payload: unknown, options: ApiRequestOptions = {}): Promise<T> {\r\n return await mockApiFetch<T>(url, { ...options, method: 'PATCH', body: JSON.stringify(payload) });\r\n}\r\n\r\nexport async function mockApiDelete<T = unknown>(url: string, options: ApiRequestOptions = {}): Promise<T> {\r\n return await mockApiFetch<T>(url, { ...options, method: 'DELETE' });\r\n}\r\n","import { httpFetch, isBrowser, merge } from '@websolutespa/bom-core';\r\nimport { ApiRequestOptions, getRemoteApiRequestOptions } from '../api/api';\r\n\r\n/**\r\n * This methods handle api requests / responses to remote api (bowl or over)\r\n */\r\n\r\nconst API_URL = process.env.STORE_URL;\r\nconst API_BASE = process.env.STORE_API || '/api';\r\n\r\nexport function getRemoteApiUrl(pathname: string): string {\r\n let url = `${API_URL}${API_BASE}${pathname}`;\r\n // !!! node 18 issue -> require('dns').setDefaultResultOrder('ipv4first');\r\n url = isBrowser ? url : url.replace('://localhost', '://127.0.0.1');\r\n // console.log('getRemoteApiUrl', url);\r\n return url;\r\n}\r\n\r\nexport async function remoteApiFetch<T = unknown>(pathname: string, options: ApiRequestOptions = {}): Promise<T> {\r\n if (isBrowser) {\r\n throw 'Unauthorized: remote api cannot be fetched client side';\r\n }\r\n const url = getRemoteApiUrl(pathname);\r\n const apiOptions = merge({ ...getRemoteApiRequestOptions() }, options);\r\n // console.log('remoteApiFetch', apiOptions.method, url);\r\n // console.log('remoteApiFetch', 'Authorization', apiOptions.headers?.Authorization);\r\n const apiResponse = await httpFetch(url, apiOptions);\r\n return apiResponse;\r\n}\r\n\r\nexport async function remoteApiGet<T = unknown>(url: string, options: ApiRequestOptions = {}): Promise<T> {\r\n return await remoteApiFetch<T>(url, { ...options, method: 'GET' });\r\n}\r\n\r\nexport async function remoteApiPost<T = unknown>(url: string, payload: unknown, options: ApiRequestOptions = {}): Promise<T> {\r\n return await remoteApiFetch<T>(url, { ...options, method: 'POST', body: JSON.stringify(payload) });\r\n}\r\n\r\nexport async function remoteApiPut<T = unknown>(url: string, payload: unknown, options: ApiRequestOptions = {}): Promise<T> {\r\n return await remoteApiFetch<T>(url, { ...options, method: 'PUT', body: JSON.stringify(payload) });\r\n}\r\n\r\nexport async function remoteApiPatch<T = unknown>(url: string, payload: unknown, options: ApiRequestOptions = {}): Promise<T> {\r\n return await remoteApiFetch<T>(url, { ...options, method: 'PATCH', body: JSON.stringify(payload) });\r\n}\r\n\r\nexport async function remoteApiDelete<T = unknown>(url: string, options: ApiRequestOptions = {}): Promise<T> {\r\n return await remoteApiFetch<T>(url, { ...options, method: 'DELETE' });\r\n}\r\n","import type { IEntity } from '@websolutespa/bom-core';\r\n\r\nexport type IField = {\r\n name: string,\r\n type: 'text' | 'number' | 'relationship',\r\n localized?: boolean,\r\n relationTo?: string,\r\n hasMany?: boolean,\r\n required?: boolean\r\n};\r\n\r\nexport type MapTo = Record<string, string>;\r\n\r\nexport type StaticServiceSrc<T extends IEntity = IEntity> = string | T[] | ((config: StaticServiceConfig<T>) => T[]) | ((config: StaticServiceConfig<T>) => Promise<T[]>);\r\n\r\nexport type StaticServiceConfig<T extends IEntity = IEntity> = {\r\n src: StaticServiceSrc<T>;\r\n slug: string;\r\n fields: IField[];\r\n map?: MapTo;\r\n};\r\n\r\nexport const staticCollections: StaticServiceConfig[] = [{\r\n src: 'https://actarian.github.io/cms-i18n-react/api/continent.json',\r\n slug: 'i18n_continent',\r\n fields: [\r\n {\r\n name: 'id',\r\n type: 'text',\r\n },\r\n {\r\n name: 'name',\r\n type: 'text',\r\n },\r\n ],\r\n}, {\r\n src: 'https://actarian.github.io/cms-i18n-react/api/country.json',\r\n slug: 'i18n_country',\r\n fields: [\r\n {\r\n name: 'id',\r\n type: 'text',\r\n },\r\n {\r\n name: 'name',\r\n type: 'text',\r\n localized: true,\r\n },\r\n {\r\n name: 'englishName',\r\n type: 'text',\r\n },\r\n {\r\n name: 'nativeName',\r\n type: 'text',\r\n },\r\n {\r\n name: 'alpha2Code',\r\n type: 'text',\r\n },\r\n {\r\n name: 'alpha3Code',\r\n type: 'text',\r\n },\r\n {\r\n name: 'continent',\r\n type: 'relationship',\r\n relationTo: 'i18n_continent',\r\n hasMany: false,\r\n required: true,\r\n },\r\n {\r\n name: 'subContinent',\r\n type: 'relationship',\r\n relationTo: 'i18n_sub_continent',\r\n hasMany: false,\r\n required: true,\r\n },\r\n ],\r\n}, {\r\n src: 'https://actarian.github.io/cms-i18n-react/api/countryZone.json',\r\n slug: 'i18n_country_zone',\r\n fields: [\r\n {\r\n name: 'id',\r\n type: 'text',\r\n },\r\n {\r\n name: 'name',\r\n type: 'text',\r\n },\r\n ],\r\n}, {\r\n src: 'https://actarian.github.io/cms-i18n-react/api/language.json',\r\n slug: 'i18n_country_zone',\r\n fields: [\r\n {\r\n name: 'id',\r\n type: 'text',\r\n },\r\n {\r\n name: 'name',\r\n type: 'text',\r\n localized: true,\r\n },\r\n {\r\n name: 'englishName',\r\n type: 'text',\r\n },\r\n {\r\n name: 'nativeName',\r\n type: 'text',\r\n },\r\n ],\r\n}, {\r\n src: 'https://actarian.github.io/cms-i18n-react/api/municipality.json',\r\n slug: 'i18n_municipality',\r\n fields: [\r\n {\r\n name: 'id',\r\n type: 'text',\r\n },\r\n {\r\n name: 'name',\r\n type: 'text',\r\n },\r\n {\r\n name: 'code',\r\n type: 'text',\r\n },\r\n {\r\n name: 'country',\r\n type: 'relationship',\r\n relationTo: 'i18n_country',\r\n hasMany: false,\r\n required: true,\r\n },\r\n {\r\n name: 'countryZone',\r\n type: 'relationship',\r\n relationTo: 'i18n_country_zone',\r\n hasMany: false,\r\n required: true,\r\n },\r\n {\r\n name: 'region',\r\n type: 'relationship',\r\n relationTo: 'i18n_region',\r\n hasMany: false,\r\n required: true,\r\n },\r\n {\r\n name: 'province',\r\n type: 'relationship',\r\n relationTo: 'i18n_province',\r\n hasMany: false,\r\n required: true,\r\n },\r\n ],\r\n}, {\r\n src: 'https://actarian.github.io/cms-i18n-react/api/province.json',\r\n slug: 'i18n_province',\r\n fields: [\r\n {\r\n name: 'id',\r\n type: 'text',\r\n },\r\n {\r\n name: 'name',\r\n type: 'text',\r\n },\r\n {\r\n name: 'code',\r\n type: 'text',\r\n },\r\n {\r\n name: 'country',\r\n type: 'relationship',\r\n relationTo: 'i18n_country',\r\n hasMany: false,\r\n required: true,\r\n },\r\n {\r\n name: 'countryZone',\r\n type: 'relationship',\r\n relationTo: 'i18n_country_zone',\r\n hasMany: false,\r\n required: true,\r\n },\r\n {\r\n name: 'region',\r\n type: 'relationship',\r\n relationTo: 'i18n_region',\r\n hasMany: false,\r\n required: true,\r\n },\r\n ],\r\n}, {\r\n src: 'https://actarian.github.io/cms-i18n-react/api/region.json',\r\n slug: 'i18n_region',\r\n fields: [\r\n {\r\n name: 'id',\r\n type: 'text',\r\n },\r\n {\r\n name: 'name',\r\n type: 'text',\r\n },\r\n {\r\n name: 'country',\r\n type: 'relationship',\r\n relationTo: 'i18n_country',\r\n hasMany: false,\r\n required: true,\r\n },\r\n {\r\n name: 'countryZone',\r\n type: 'relationship',\r\n relationTo: 'i18n_country_zone',\r\n hasMany: false,\r\n required: true,\r\n },\r\n ],\r\n}, {\r\n src: 'https://actarian.github.io/cms-i18n-react/api/subContinent.json',\r\n slug: 'i18n_sub_continent',\r\n fields: [\r\n {\r\n name: 'id',\r\n type: 'text',\r\n },\r\n {\r\n name: 'name',\r\n type: 'text',\r\n },\r\n {\r\n name: 'continent',\r\n type: 'relationship',\r\n relationTo: 'i18n_continent',\r\n hasMany: false,\r\n required: true,\r\n },\r\n ],\r\n}];\r\n","import { staticCollections } from '../static/static';\r\n\r\n// nextPhase\r\nexport enum NextPhase {\r\n Export = 'phase-export',\r\n ProductionBuild = 'phase-production-build',\r\n ProductionServer = 'phase-production-server',\r\n DevelopmentServer = 'phase-development-server',\r\n Test = 'phase-test',\r\n}\r\n\r\nfunction getNextPhase(): NextPhase {\r\n let nextPhase = NextPhase.Export;\r\n if (typeof process !== 'undefined' && process.env.NEXT_PHASE) {\r\n nextPhase = process.env.NEXT_PHASE as NextPhase;\r\n }\r\n return nextPhase;\r\n}\r\n\r\nexport const nextPhase: NextPhase = getNextPhase();\r\n\r\n// buildStrategy\r\nexport enum BuildStrategy {\r\n Static = 'static',\r\n Runtime = 'runtime',\r\n}\r\n\r\nfunction getBuildStrategy(): BuildStrategy {\r\n let buildStrategy = BuildStrategy.Static;\r\n if (typeof process !== 'undefined' && process.env.BUILD_STRATEGY) {\r\n buildStrategy = process.env.BUILD_STRATEGY as BuildStrategy;\r\n }\r\n return buildStrategy;\r\n}\r\n\r\nexport const buildStrategy: BuildStrategy = getBuildStrategy();\r\n\r\n// storeStrategy\r\nexport enum StoreStrategy {\r\n Local = 'local',\r\n Api = 'api',\r\n DecoratedApi = 'decoratedApi',\r\n Data = 'data',\r\n Mock = 'mock',\r\n}\r\n\r\nfunction getStoreStrategy(): StoreStrategy {\r\n let storeStrategy = StoreStrategy.Mock;\r\n if (typeof process !== 'undefined' && process.env.STORE_STRATEGY) {\r\n storeStrategy = process.env.STORE_STRATEGY as StoreStrategy;\r\n }\r\n return storeStrategy;\r\n}\r\n\r\nexport const storeStrategy: StoreStrategy = getStoreStrategy();\r\n\r\n// storeCacheDuration\r\nfunction getStoreCacheDuration(): number {\r\n let storeCacheDuration = (1 * 60 * 1000);\r\n if (typeof process !== 'undefined' && process.env.STORE_CACHE_DURATION) {\r\n storeCacheDuration = parseInt(process.env.STORE_CACHE_DURATION);\r\n }\r\n return storeCacheDuration;\r\n}\r\n\r\nexport const storeCacheDuration: number = getStoreCacheDuration();\r\n\r\n// collections\r\nconst ENV_COLLECTIONS: string[] = process.env.COLLECTIONS ? process.env.COLLECTIONS.split(',') : [];\r\nexport const MOCK_COLLECTIONS: string[] = process.env.MOCKS ? process.env.MOCKS.split(',') : [];\r\nexport const STATIC_COLLECTIONS: string[] = staticCollections.map(x => x.slug);\r\nexport const KNOWN_COLLECTIONS: string[] = [\r\n 'app',\r\n 'category',\r\n 'label',\r\n 'locale',\r\n 'market',\r\n 'menu',\r\n 'redirect',\r\n 'route',\r\n 'template',\r\n ...STATIC_COLLECTIONS,\r\n];\r\nexport const COLLECTIONS = [...ENV_COLLECTIONS, ...KNOWN_COLLECTIONS];\r\n","import { ApiRequestOptions } from '../api/api';\r\nimport { localApiFetch } from '../local/local.api';\r\nimport { remoteApiFetch } from '../remote/remote.api';\r\nimport { StoreStrategy, storeStrategy } from './store';\r\n\r\nconst storeApiFetch = storeStrategy === StoreStrategy.Mock ? localApiFetch : remoteApiFetch;\r\n\r\nexport async function storeApiGet<T = unknown>(url: string, options: ApiRequestOptions = {}): Promise<T> {\r\n return await storeApiFetch<T>(url, { ...options, method: 'GET' });\r\n}\r\n\r\nexport async function storeApiPost<T = unknown>(url: string, payload: unknown, options: ApiRequestOptions = {}): Promise<T> {\r\n return await storeApiFetch<T>(url, { ...options, method: 'POST', body: JSON.stringify(payload) });\r\n}\r\n\r\nexport async function storeApiPut<T = unknown>(url: string, payload: unknown, options: ApiRequestOptions = {}): Promise<T> {\r\n return await storeApiFetch<T>(url, { ...options, method: 'PUT', body: JSON.stringify(payload) });\r\n}\r\n\r\nexport async function storeApiPatch<T = unknown>(url: string, payload: unknown, options: ApiRequestOptions = {}): Promise<T> {\r\n return await storeApiFetch<T>(url, { ...options, method: 'PATCH', body: JSON.stringify(payload) });\r\n}\r\n\r\nexport async function storeApiDelete<T = unknown>(url: string, options: ApiRequestOptions = {}): Promise<T> {\r\n return await storeApiFetch<T>(url, { ...options, method: 'DELETE' });\r\n}\r\n"],"mappings":";;;AAIA,SAAgB,4BAA+C;AAC7D,QAAO,EACL,SAAS,CACR,EACF;AACF;AAED,SAAgB,2BAA2BA,OAAmC;AAC5E,KAAI,MAEF,QAAO,EAEL,SAAS,EACP,eAAe,CAAC,IAAI,EAAE,OAAO,CAE9B,EACF;KAGD,QAAO,EAEL,SAA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;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;GACP;GACD;IACE,MAAM;IACN,MAAM;IACN,WAAW;GACZ;GACD;IACE,MAAM;IACN,MAAM;GACP;GACD;IACE,MAAM;IACN,MAAM;GACP;EACF;CACF;CAAE;EACD,KAAK;EACL,MAAM;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;GACP;GACD;IACE,MAAM;IACN,MAAM;GACP;GACD;IACE,MAAM;IACN,MAAM;GACP;GACD;IACE,MAAM;IACN,MAAM;IACN,YAAY;IACZ,SAAS;IACT,UAAU;GACX;GACD;IACE,MAAM;IACN,MAAM;IACN,YAAY;IACZ,SAAS;IACT,UAAU;GACX;GACD;IACE,MAAM;IACN,MAAM;IACN,YAAY;IACZ,SAAS;IACT,UAAU;GACX;GACD;IACE,MAAM;IACN,MAAM;IACN,YAAY;IACZ,SAAS;IACT,UAAU;GACX;EACF;CACF;CAAE;EACD,KAAK;EACL,MAAM;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;GACP;GACD;IACE,MAAM;IACN,MAAM;GACP;GACD;IACE,MAAM;IACN,MAAM;GACP;GACD;IACE,MAAM;IACN,MAAM;IACN,YAAY;IACZ,SAAS;IACT,UAAU;GACX;GACD;IACE,MAAM;IACN,MAAM;IACN,YAAY;IACZ,SAAS;IACT,UAAU;GACX;GACD;IACE,MAAM;IACN,MAAM;IACN,YAAY;IACZ,SAAS;IACT,UAAU;GACX;EACF;CACF;CAAE;EACD,KAAK;EACL,MAAM;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;GACP;GACD;IACE,MAAM;IACN,MAAM;GACP;GACD;IACE,MAAM;IACN,MAAM;IACN,YAAY;IACZ,SAAS;IACT,UAAU;GACX;GACD;IACE,MAAM;IACN,MAAM;IACN,YAAY;IACZ,SAAS;IACT,UAAU;GACX;EACF;CACF;CAAE;EACD,KAAK;EACL,MAAM;EACN,QAAQ;GACN;IACE,MAAM;IACN,MAAM;GACP;GACD;IACE,MAAM;IAC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