@c-rex/utils 0.1.20 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cookies.js +96 -3
- package/dist/cookies.js.map +1 -1
- package/dist/cookies.mjs +96 -3
- package/dist/cookies.mjs.map +1 -1
- package/dist/directoryNodes.d.mts +192 -1
- package/dist/directoryNodes.d.ts +192 -1
- package/dist/directoryNodes.js +225 -27
- package/dist/directoryNodes.js.map +1 -1
- package/dist/directoryNodes.mjs +224 -27
- package/dist/directoryNodes.mjs.map +1 -1
- package/dist/index.d.mts +24 -3
- package/dist/index.d.ts +24 -3
- package/dist/index.js +251 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +233 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +62 -60
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AvailableVersionsInterface, TreeOfContent, RenditionModel, LanguageAndCountries, LiteralModel, ObjectRefModel } from '@c-rex/interfaces';
|
|
2
2
|
import { ClassValue } from 'clsx';
|
|
3
3
|
import { QueryParams, DocumentsType, articleInfoItemType, ResultTypes } from '@c-rex/types';
|
|
4
|
+
import { Metadata } from 'next';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Retrieves the country code associated with a given language code.
|
|
@@ -9,7 +10,10 @@ import { QueryParams, DocumentsType, articleInfoItemType, ResultTypes } from '@c
|
|
|
9
10
|
*/
|
|
10
11
|
declare const getCountryCodeByLang: (lang: string) => string;
|
|
11
12
|
declare const formatDateToLocale: (date: string, locale: string) => string;
|
|
12
|
-
declare const createAvailableVersionList: (versions:
|
|
13
|
+
declare const createAvailableVersionList: (versions: Array<{
|
|
14
|
+
shortId?: string;
|
|
15
|
+
languages?: string[] | null;
|
|
16
|
+
}>, linkPattern: string, activeShortId: string) => AvailableVersionsInterface[];
|
|
13
17
|
declare const replacePathParams: (endpointTemplate: string, pathParams: Record<string, string>) => string;
|
|
14
18
|
declare const processDataToLabelValuePairs: (data: Record<string, any>, excludeKeys?: string[]) => {
|
|
15
19
|
label: string;
|
|
@@ -60,6 +64,10 @@ declare const getFileRenditions: ({ renditions }: {
|
|
|
60
64
|
*/
|
|
61
65
|
declare const call: <T>(method: string, params?: any) => Promise<T>;
|
|
62
66
|
|
|
67
|
+
declare const normalizeLanguageCode: (value: string) => string;
|
|
68
|
+
declare const sortAndDeduplicateLanguages: (languages: Array<string | null | undefined>) => string[];
|
|
69
|
+
declare const resolvePreferredLanguage: (languages: string[] | null | undefined, uiLanguage: string) => string | undefined;
|
|
70
|
+
declare const extractCountryCodeFromLanguage: (language: string) => string;
|
|
63
71
|
declare const transformLanguageData: (data: {
|
|
64
72
|
value: string;
|
|
65
73
|
score: number;
|
|
@@ -70,7 +78,20 @@ declare const isLanguage: (label: string) => boolean;
|
|
|
70
78
|
declare const filteredItems: (items: articleInfoItemType[]) => articleInfoItemType[];
|
|
71
79
|
declare const getType: (classObj?: ObjectRefModel) => ResultTypes;
|
|
72
80
|
declare const getTitle: (titles?: LiteralModel[] | null, labels?: LiteralModel[] | null) => string;
|
|
81
|
+
declare const getLabelByLang: (labels?: LiteralModel[] | null, lang?: string) => string;
|
|
73
82
|
declare const getLanguage: (languages?: string[] | null) => string;
|
|
74
83
|
declare const getVersions: (versionOf?: ObjectRefModel) => string[];
|
|
75
84
|
|
|
76
|
-
|
|
85
|
+
type HtmlMetaTag = {
|
|
86
|
+
name: string;
|
|
87
|
+
content: string;
|
|
88
|
+
};
|
|
89
|
+
type ParsedHtmlContent = {
|
|
90
|
+
articleHtml: string;
|
|
91
|
+
metaTags: HtmlMetaTag[];
|
|
92
|
+
};
|
|
93
|
+
declare const parseHtmlContent: (html: string) => ParsedHtmlContent;
|
|
94
|
+
declare const getHtmlRenditionViewUrl: (renditions: RenditionModel[] | null | undefined, htmlFormats?: string[]) => string | undefined;
|
|
95
|
+
declare const metaTagsToMetadata: (metaTags: HtmlMetaTag[]) => Pick<Metadata, "description" | "keywords" | "other">;
|
|
96
|
+
|
|
97
|
+
export { type HtmlMetaTag, type ParsedHtmlContent, call, cn, createAvailableVersionList, createParams, extractCountryCodeFromLanguage, filteredItems, formatDateToLocale, generateBreadcrumbItems, generateQueryParams, getCountryCodeByLang, getFileRenditions, getHtmlRenditionViewUrl, getLabelByLang, getLanguage, getTitle, getType, getVersions, isDate, isLanguage, metaTagsToMetadata, normalizeLanguageCode, parseHtmlContent, processDataToLabelValuePairs, replacePathParams, resolvePreferredLanguage, sortAndDeduplicateLanguages, transformLanguageData };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AvailableVersionsInterface, TreeOfContent, RenditionModel, LanguageAndCountries, LiteralModel, ObjectRefModel } from '@c-rex/interfaces';
|
|
2
2
|
import { ClassValue } from 'clsx';
|
|
3
3
|
import { QueryParams, DocumentsType, articleInfoItemType, ResultTypes } from '@c-rex/types';
|
|
4
|
+
import { Metadata } from 'next';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Retrieves the country code associated with a given language code.
|
|
@@ -9,7 +10,10 @@ import { QueryParams, DocumentsType, articleInfoItemType, ResultTypes } from '@c
|
|
|
9
10
|
*/
|
|
10
11
|
declare const getCountryCodeByLang: (lang: string) => string;
|
|
11
12
|
declare const formatDateToLocale: (date: string, locale: string) => string;
|
|
12
|
-
declare const createAvailableVersionList: (versions:
|
|
13
|
+
declare const createAvailableVersionList: (versions: Array<{
|
|
14
|
+
shortId?: string;
|
|
15
|
+
languages?: string[] | null;
|
|
16
|
+
}>, linkPattern: string, activeShortId: string) => AvailableVersionsInterface[];
|
|
13
17
|
declare const replacePathParams: (endpointTemplate: string, pathParams: Record<string, string>) => string;
|
|
14
18
|
declare const processDataToLabelValuePairs: (data: Record<string, any>, excludeKeys?: string[]) => {
|
|
15
19
|
label: string;
|
|
@@ -60,6 +64,10 @@ declare const getFileRenditions: ({ renditions }: {
|
|
|
60
64
|
*/
|
|
61
65
|
declare const call: <T>(method: string, params?: any) => Promise<T>;
|
|
62
66
|
|
|
67
|
+
declare const normalizeLanguageCode: (value: string) => string;
|
|
68
|
+
declare const sortAndDeduplicateLanguages: (languages: Array<string | null | undefined>) => string[];
|
|
69
|
+
declare const resolvePreferredLanguage: (languages: string[] | null | undefined, uiLanguage: string) => string | undefined;
|
|
70
|
+
declare const extractCountryCodeFromLanguage: (language: string) => string;
|
|
63
71
|
declare const transformLanguageData: (data: {
|
|
64
72
|
value: string;
|
|
65
73
|
score: number;
|
|
@@ -70,7 +78,20 @@ declare const isLanguage: (label: string) => boolean;
|
|
|
70
78
|
declare const filteredItems: (items: articleInfoItemType[]) => articleInfoItemType[];
|
|
71
79
|
declare const getType: (classObj?: ObjectRefModel) => ResultTypes;
|
|
72
80
|
declare const getTitle: (titles?: LiteralModel[] | null, labels?: LiteralModel[] | null) => string;
|
|
81
|
+
declare const getLabelByLang: (labels?: LiteralModel[] | null, lang?: string) => string;
|
|
73
82
|
declare const getLanguage: (languages?: string[] | null) => string;
|
|
74
83
|
declare const getVersions: (versionOf?: ObjectRefModel) => string[];
|
|
75
84
|
|
|
76
|
-
|
|
85
|
+
type HtmlMetaTag = {
|
|
86
|
+
name: string;
|
|
87
|
+
content: string;
|
|
88
|
+
};
|
|
89
|
+
type ParsedHtmlContent = {
|
|
90
|
+
articleHtml: string;
|
|
91
|
+
metaTags: HtmlMetaTag[];
|
|
92
|
+
};
|
|
93
|
+
declare const parseHtmlContent: (html: string) => ParsedHtmlContent;
|
|
94
|
+
declare const getHtmlRenditionViewUrl: (renditions: RenditionModel[] | null | undefined, htmlFormats?: string[]) => string | undefined;
|
|
95
|
+
declare const metaTagsToMetadata: (metaTags: HtmlMetaTag[]) => Pick<Metadata, "description" | "keywords" | "other">;
|
|
96
|
+
|
|
97
|
+
export { type HtmlMetaTag, type ParsedHtmlContent, call, cn, createAvailableVersionList, createParams, extractCountryCodeFromLanguage, filteredItems, formatDateToLocale, generateBreadcrumbItems, generateQueryParams, getCountryCodeByLang, getFileRenditions, getHtmlRenditionViewUrl, getLabelByLang, getLanguage, getTitle, getType, getVersions, isDate, isLanguage, metaTagsToMetadata, normalizeLanguageCode, parseHtmlContent, processDataToLabelValuePairs, replacePathParams, resolvePreferredLanguage, sortAndDeduplicateLanguages, transformLanguageData };
|