pim-import 4.30.2 → 4.30.4
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/algolia/clean.js +10 -10
- package/dist/algolia/clean.js.map +1 -1
- package/dist/algolia/config.js +9 -9
- package/dist/algolia/config.js.map +1 -1
- package/dist/algolia/downloads.js +41 -41
- package/dist/algolia/downloads.js.map +1 -1
- package/dist/algolia/families.js +69 -69
- package/dist/algolia/families.js.map +1 -1
- package/dist/algolia/models.js +48 -48
- package/dist/algolia/models.js.map +1 -1
- package/dist/algolia/news.js +39 -39
- package/dist/algolia/news.js.map +1 -1
- package/dist/algolia/pressRelease.js +36 -36
- package/dist/algolia/pressRelease.js.map +1 -1
- package/dist/algolia/pressReview.js +34 -34
- package/dist/algolia/pressReview.js.map +1 -1
- package/dist/algolia/products.js +83 -83
- package/dist/algolia/products.js.map +1 -1
- package/dist/algolia/projects.js +43 -43
- package/dist/algolia/projects.js.map +1 -1
- package/dist/algolia/stories.js +52 -52
- package/dist/algolia/stories.js.map +1 -1
- package/dist/algolia/subFamilies.js +76 -76
- package/dist/algolia/subFamilies.js.map +1 -1
- package/dist/algolia/subModels.js +47 -47
- package/dist/algolia/subModels.js.map +1 -1
- package/dist/downloads/classes/manageEntry.js +3 -3
- package/dist/downloads/classes/manageEntry.js.map +1 -1
- package/dist/downloads/import.js +27 -27
- package/dist/downloads/import.js.map +1 -1
- package/dist/libs/contentful-cda.js +34 -34
- package/dist/libs/contentful-cda.js.map +1 -1
- package/dist/libs/contentful.js +131 -130
- package/dist/libs/contentful.js.map +1 -1
- package/dist/libs/imgix.js +23 -23
- package/dist/libs/imgix.js.map +1 -1
- package/dist/libs/logs.js +4 -4
- package/dist/libs/logs.js.map +1 -1
- package/dist/libs/pdf.js +5 -5
- package/dist/libs/pdf.js.map +1 -1
- package/dist/libs/s3.js +28 -28
- package/dist/libs/s3.js.map +1 -1
- package/dist/libs/sentry.js +6 -2
- package/dist/libs/sentry.js.map +1 -1
- package/dist/pim/config.js +3 -3
- package/dist/pim/config.js.map +1 -1
- package/dist/pim/endpoints.js +39 -39
- package/dist/pim/endpoints.js.map +1 -1
- package/dist/pim/methods/bulkPublish.js +10 -10
- package/dist/pim/methods/bulkPublish.js.map +1 -1
- package/dist/pim/methods/catalogs.js +62 -62
- package/dist/pim/methods/catalogs.js.map +1 -1
- package/dist/pim/methods/designers.js +19 -19
- package/dist/pim/methods/designers.js.map +1 -1
- package/dist/pim/methods/dictionary.js +66 -66
- package/dist/pim/methods/dictionary.js.map +1 -1
- package/dist/pim/methods/families.js +37 -37
- package/dist/pim/methods/families.js.map +1 -1
- package/dist/pim/methods/latestProducts.js +7 -7
- package/dist/pim/methods/latestProducts.js.map +1 -1
- package/dist/pim/methods/models.js +47 -47
- package/dist/pim/methods/models.js.map +1 -1
- package/dist/pim/methods/pages/catalogs.js +6 -6
- package/dist/pim/methods/pages/catalogs.js.map +1 -1
- package/dist/pim/methods/pages/families.js +7 -7
- package/dist/pim/methods/pages/families.js.map +1 -1
- package/dist/pim/methods/pages/subfamilies.js +11 -11
- package/dist/pim/methods/pages/subfamilies.js.map +1 -1
- package/dist/pim/methods/products.js +448 -415
- package/dist/pim/methods/products.js.map +1 -1
- package/dist/pim/methods/subfamilies.js +107 -107
- package/dist/pim/methods/subfamilies.js.map +1 -1
- package/dist/pim/methods/submodels.js +37 -37
- package/dist/pim/methods/submodels.js.map +1 -1
- package/dist/pim/request.js +2 -2
- package/dist/pim/request.js.map +1 -1
- package/dist/utils.js +23 -23
- package/dist/utils.js.map +1 -1
- package/package.json +4 -4
- package/src/downloads/import.ts +1 -1
- package/src/libs/contentful.ts +8 -7
- package/src/libs/s3.ts +2 -2
- package/src/pim/endpoints.ts +8 -8
- package/src/pim/methods/bulkPublish.ts +1 -1
- package/src/pim/methods/dictionary.ts +1 -1
- package/src/pim/methods/families.ts +1 -1
- package/src/pim/methods/products.ts +40 -9
- package/types/algolia/clean.d.ts +1 -1
- package/types/algolia/config.d.ts +1 -1
- package/types/algolia/downloads.d.ts +1 -1
- package/types/algolia/families.d.ts +3 -3
- package/types/algolia/models.d.ts +1 -1
- package/types/algolia/news.d.ts +1 -1
- package/types/algolia/pressRelease.d.ts +1 -1
- package/types/algolia/pressReview.d.ts +1 -1
- package/types/algolia/products.d.ts +2 -2
- package/types/algolia/projects.d.ts +1 -1
- package/types/algolia/stories.d.ts +1 -1
- package/types/algolia/subFamilies.d.ts +1 -1
- package/types/algolia/subModels.d.ts +1 -1
- package/types/libs/contentful-cda.d.ts +2 -2
- package/types/libs/contentful.d.ts +10 -10
- package/types/libs/logs.d.ts +1 -1
- package/types/libs/pdf.d.ts +1 -1
- package/types/libs/s3.d.ts +1 -1
- package/types/pim/config.d.ts +1 -1
- package/types/pim/endpoints.d.ts +3 -3
- package/types/pim/methods/designers.d.ts +1 -1
- package/types/pim/methods/products.d.ts +3 -3
- package/types/resources/Audit.d.ts +1 -1
- package/types/types.d.ts +21 -21
- package/types/utils.d.ts +1 -1
|
@@ -97,7 +97,7 @@ import { setHideInRegionField } from "./products";
|
|
|
97
97
|
// );
|
|
98
98
|
// try {
|
|
99
99
|
// componentSubFamilyPages = await componentSubFamilyPages.publish();
|
|
100
|
-
// } catch (err) {
|
|
100
|
+
// } catch (err: any) {
|
|
101
101
|
// log(`Cannot publish entry.`);
|
|
102
102
|
// log(err);
|
|
103
103
|
// }
|
|
@@ -299,7 +299,7 @@ const isTermsToAdd = async (
|
|
|
299
299
|
if (productEntry.isPublished()) {
|
|
300
300
|
try {
|
|
301
301
|
productEntry = await productEntry.publish();
|
|
302
|
-
} catch (err) {
|
|
302
|
+
} catch (err: any) {
|
|
303
303
|
log(`Cannot publish entry.`);
|
|
304
304
|
log(err);
|
|
305
305
|
}
|
|
@@ -1497,7 +1497,7 @@ export const setProductRelationships = async (
|
|
|
1497
1497
|
try {
|
|
1498
1498
|
productEntry = await productEntry.publish();
|
|
1499
1499
|
log(`Published ${code} product`);
|
|
1500
|
-
} catch (err) {
|
|
1500
|
+
} catch (err: any) {
|
|
1501
1501
|
log(`Cannot publish entry.`);
|
|
1502
1502
|
log(err);
|
|
1503
1503
|
}
|
|
@@ -1754,6 +1754,15 @@ const productAudit = async (
|
|
|
1754
1754
|
audit.what === "REMOVE_PRODUCT_RELATIONS" &&
|
|
1755
1755
|
!productEntry.isArchived()
|
|
1756
1756
|
) {
|
|
1757
|
+
if (productEntry.isUpdated()) {
|
|
1758
|
+
try {
|
|
1759
|
+
log(`Publish existing changes of entry ${productEntry.sys.id}.`);
|
|
1760
|
+
productEntry = await productEntry.publish();
|
|
1761
|
+
} catch (err: any) {
|
|
1762
|
+
log(`Cannot publish changes of entry ${productEntry.sys.id}.`);
|
|
1763
|
+
log(err);
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1757
1766
|
for (const item of audit?.catalogs) {
|
|
1758
1767
|
if (!item?.where) {
|
|
1759
1768
|
log(
|
|
@@ -1769,6 +1778,7 @@ const productAudit = async (
|
|
|
1769
1778
|
item.catalogCode,
|
|
1770
1779
|
true
|
|
1771
1780
|
);
|
|
1781
|
+
log(`edit catalogs`);
|
|
1772
1782
|
edit = true;
|
|
1773
1783
|
}
|
|
1774
1784
|
if (item?.categoryCode) {
|
|
@@ -1780,6 +1790,7 @@ const productAudit = async (
|
|
|
1780
1790
|
item.categoryCode,
|
|
1781
1791
|
true
|
|
1782
1792
|
);
|
|
1793
|
+
log(`edit ${categoriesFieldKey}`);
|
|
1783
1794
|
edit = true;
|
|
1784
1795
|
}
|
|
1785
1796
|
if (item?.subfamilyCode) {
|
|
@@ -1791,6 +1802,7 @@ const productAudit = async (
|
|
|
1791
1802
|
item.subfamilyCode,
|
|
1792
1803
|
true
|
|
1793
1804
|
);
|
|
1805
|
+
log(`edit ${subFamiliesFieldKey}`);
|
|
1794
1806
|
edit = true;
|
|
1795
1807
|
}
|
|
1796
1808
|
if (item?.models) {
|
|
@@ -1801,6 +1813,7 @@ const productAudit = async (
|
|
|
1801
1813
|
item.models,
|
|
1802
1814
|
true
|
|
1803
1815
|
);
|
|
1816
|
+
log(`edit ${modelsFieldKey}`);
|
|
1804
1817
|
edit = true;
|
|
1805
1818
|
}
|
|
1806
1819
|
if (item?.subModels) {
|
|
@@ -1812,6 +1825,7 @@ const productAudit = async (
|
|
|
1812
1825
|
item.subModels,
|
|
1813
1826
|
true
|
|
1814
1827
|
);
|
|
1828
|
+
log(`edit ${subModelsFieldKey}`);
|
|
1815
1829
|
edit = true;
|
|
1816
1830
|
}
|
|
1817
1831
|
|
|
@@ -1838,11 +1852,13 @@ const productAudit = async (
|
|
|
1838
1852
|
codes
|
|
1839
1853
|
);
|
|
1840
1854
|
|
|
1841
|
-
|
|
1842
|
-
lengthBefore !==
|
|
1855
|
+
const lengthAfter =
|
|
1843
1856
|
productEntry.fields?.[fieldKey]?.[defaultEnvironmentLocaleCode]
|
|
1844
|
-
.length
|
|
1845
|
-
) {
|
|
1857
|
+
.length;
|
|
1858
|
+
if (lengthBefore !== lengthAfter) {
|
|
1859
|
+
log(
|
|
1860
|
+
`edit field ${fieldKey} lengthBefore: ${lengthBefore} lengthAfter: ${lengthAfter}`
|
|
1861
|
+
);
|
|
1846
1862
|
edit = true;
|
|
1847
1863
|
} else {
|
|
1848
1864
|
log(`No valid ${objectFieldsRelationKey} to remove found`);
|
|
@@ -1872,6 +1888,7 @@ const productAudit = async (
|
|
|
1872
1888
|
lengthBefore !==
|
|
1873
1889
|
productEntry.fields?.designer?.[defaultEnvironmentLocaleCode].length
|
|
1874
1890
|
) {
|
|
1891
|
+
log(`edit designer`);
|
|
1875
1892
|
edit = true;
|
|
1876
1893
|
} else {
|
|
1877
1894
|
log(`No valid designer to remove found`);
|
|
@@ -1885,7 +1902,21 @@ const productAudit = async (
|
|
|
1885
1902
|
"lastPimSyncDate",
|
|
1886
1903
|
getLocalISOTime()
|
|
1887
1904
|
);
|
|
1888
|
-
|
|
1905
|
+
try {
|
|
1906
|
+
log(`update ${productEntry.sys.id}`);
|
|
1907
|
+
productEntry = await productEntry.update();
|
|
1908
|
+
if (productEntry.isPublished()) {
|
|
1909
|
+
try {
|
|
1910
|
+
productEntry = await productEntry.publish();
|
|
1911
|
+
} catch (err: any) {
|
|
1912
|
+
log(`Cannot publish entry ${productEntry.sys.id}.`);
|
|
1913
|
+
log(err);
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
} catch (err: any) {
|
|
1917
|
+
log(`Cannot update entry ${productEntry.sys.id}.`);
|
|
1918
|
+
log(err);
|
|
1919
|
+
}
|
|
1889
1920
|
} else {
|
|
1890
1921
|
log(`No valid editable criteria found`);
|
|
1891
1922
|
console.log(productEntry.sys.id, "audit", audit);
|
|
@@ -2434,7 +2465,7 @@ export const generateTechSpecPdf = async (
|
|
|
2434
2465
|
if (topicProduct.isPublished()) {
|
|
2435
2466
|
try {
|
|
2436
2467
|
topicProduct = await topicProduct.publish();
|
|
2437
|
-
} catch (err) {
|
|
2468
|
+
} catch (err: any) {
|
|
2438
2469
|
log(`Cannot publish entry.`);
|
|
2439
2470
|
log(err);
|
|
2440
2471
|
}
|
|
@@ -3101,7 +3132,7 @@ export const populateDestinations = async (offset: number, limit: number) => {
|
|
|
3101
3132
|
if (productEntry.isPublished()) {
|
|
3102
3133
|
try {
|
|
3103
3134
|
productEntry = await productEntry.publish();
|
|
3104
|
-
} catch (err) {
|
|
3135
|
+
} catch (err: any) {
|
|
3105
3136
|
log(`Cannot publish entry.`);
|
|
3106
3137
|
log(err);
|
|
3107
3138
|
}
|
package/types/algolia/clean.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AvailableCatalogs, AvailableEntryStatus } from "../types";
|
|
2
2
|
import { AvailableIndicesKey } from "./config";
|
|
3
|
-
export declare const removeRecordsByStatus: (indexKey: AvailableIndicesKey, offset?: number, limit?: number, status?: AvailableEntryStatus, catalogCode?: AvailableCatalogs
|
|
3
|
+
export declare const removeRecordsByStatus: (indexKey: AvailableIndicesKey, offset?: number, limit?: number, status?: AvailableEntryStatus, catalogCode?: AvailableCatalogs) => Promise<false | {
|
|
4
4
|
objectIds: string[];
|
|
5
5
|
offset: number;
|
|
6
6
|
limit: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type AvailableIndicesKey = "products" | "families" | "subFamilies" | "subModels" | "models" | "downloads" | "projects" | "stories" | "pressReviews" | "pressRelease" | "news";
|
|
2
2
|
export declare const getClient: () => import("algoliasearch").SearchClient;
|
|
3
3
|
export declare const getIndicesSettings: () => {
|
|
4
4
|
products: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CfLocalizedEntryField, TopicDetailsResponse, WrapperImageFields } from "../types";
|
|
2
|
-
export
|
|
2
|
+
export type AlgoliaDownloadRecord = {
|
|
3
3
|
objectID: string;
|
|
4
4
|
name?: CfLocalizedEntryField;
|
|
5
5
|
thumbnailImgix?: WrapperImageFields | {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CfLocalizedEntryField, TopicDetailsResponse, TopicProductFieldsResponse, WrapperImageFields, AvailableCatalogs } from "../types";
|
|
2
|
-
export
|
|
2
|
+
export type pageResponse = {
|
|
3
3
|
slugs: {};
|
|
4
4
|
type: string;
|
|
5
5
|
details?: {};
|
|
6
6
|
} | null;
|
|
7
|
-
export
|
|
7
|
+
export type AlgoliaFamilyRecord = {
|
|
8
8
|
objectID: string;
|
|
9
9
|
names: CfLocalizedEntryField;
|
|
10
10
|
code: string;
|
|
@@ -20,7 +20,7 @@ export declare type AlgoliaFamilyRecord = {
|
|
|
20
20
|
destinations?: string[];
|
|
21
21
|
lastSyncDate: string;
|
|
22
22
|
};
|
|
23
|
-
export declare const reindexFamilies: (offset?: number, limit?: number, catalogCode?: AvailableCatalogs
|
|
23
|
+
export declare const reindexFamilies: (offset?: number, limit?: number, catalogCode?: AvailableCatalogs) => Promise<{
|
|
24
24
|
savedObjectIDs: string[];
|
|
25
25
|
deletedObjectIDs: string[];
|
|
26
26
|
objects: Readonly<Record<string, any>>[];
|
|
@@ -21,7 +21,7 @@ export declare const reindexModel: (topicModelId: string) => Promise<{
|
|
|
21
21
|
destinations?: string[] | undefined;
|
|
22
22
|
taskID: number;
|
|
23
23
|
}>;
|
|
24
|
-
export declare const reindexModels: (offset?: number, limit?: number, catalogCode?: AvailableCatalogs
|
|
24
|
+
export declare const reindexModels: (offset?: number, limit?: number, catalogCode?: AvailableCatalogs) => Promise<{
|
|
25
25
|
savedObjectIDs: string[];
|
|
26
26
|
deletedObjectIDs: string[];
|
|
27
27
|
objects: Readonly<Record<string, any>>[];
|
package/types/algolia/news.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CfLocalizedEntryField, TopicDetailsResponse, WrapperImageFields, AlgoliaObjectFilter } from "../types";
|
|
2
|
-
export
|
|
2
|
+
export type AlgoliaProductRecord = {
|
|
3
3
|
objectID: string;
|
|
4
4
|
name?: string;
|
|
5
5
|
names?: CfLocalizedEntryField;
|
|
@@ -69,7 +69,7 @@ export declare const reindexProduct: (topicProductId: string, generatePdf?: bool
|
|
|
69
69
|
lastSyncDate?: string | undefined;
|
|
70
70
|
taskID: number;
|
|
71
71
|
}>;
|
|
72
|
-
export declare const reindexProducts: (filterKey: string, filterValue: string, offset?: number, limit?: number, lastPimSyncDateGte?: string
|
|
72
|
+
export declare const reindexProducts: (filterKey: string, filterValue: string, offset?: number, limit?: number, lastPimSyncDateGte?: string, generatePdf?: boolean, filters?: AlgoliaObjectFilter[]) => Promise<{
|
|
73
73
|
savedObjectIDs: string[];
|
|
74
74
|
deletedObjectIDs: string[];
|
|
75
75
|
objects: Readonly<Record<string, any>>[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AvailableCatalogs } from "../types";
|
|
2
|
-
export declare const reindexSubFamilies: (offset?: number, limit?: number, catalogCode?: AvailableCatalogs
|
|
2
|
+
export declare const reindexSubFamilies: (offset?: number, limit?: number, catalogCode?: AvailableCatalogs) => Promise<{
|
|
3
3
|
savedObjectIDs: string[];
|
|
4
4
|
deletedObjectIDs: string[];
|
|
5
5
|
objects: Readonly<Record<string, any>>[];
|
|
@@ -17,7 +17,7 @@ export declare const reindexSubModel: (topicSubModelId: string) => Promise<{
|
|
|
17
17
|
lastSyncDate?: string | undefined;
|
|
18
18
|
taskID: number;
|
|
19
19
|
}>;
|
|
20
|
-
export declare const reindexSubModels: (offset?: number, limit?: number, catalogCode?: AvailableCatalogs
|
|
20
|
+
export declare const reindexSubModels: (offset?: number, limit?: number, catalogCode?: AvailableCatalogs) => Promise<{
|
|
21
21
|
savedObjectIDs: string[];
|
|
22
22
|
deletedObjectIDs: string[];
|
|
23
23
|
objects: Readonly<Record<string, any>>[];
|
|
@@ -4,8 +4,8 @@ import { TopicDetailsResponse, AssetPropFieldsWithoutLocaleKey, OtherFilters } f
|
|
|
4
4
|
export declare const getClient: () => Promise<any>;
|
|
5
5
|
export declare const getEnvironmentDefaultLocale: () => Promise<Locale>;
|
|
6
6
|
export declare const getEnvironmentDefaultLocaleCode: () => Promise<string>;
|
|
7
|
-
export declare const getEntryByID: (entryID: string, contentTypeId: string, select?: string
|
|
8
|
-
export declare const getAllEntries: (contentType: string, select?: string
|
|
7
|
+
export declare const getEntryByID: (entryID: string, contentTypeId: string, select?: string) => Promise<Entry>;
|
|
8
|
+
export declare const getAllEntries: (contentType: string, select?: string, filterKey?: string, filterValue?: string, limit?: number, otherFilters?: OtherFilters[], include?: number) => Promise<Entry[]>;
|
|
9
9
|
export declare const getAssetDetails: (assetId: string) => Promise<AssetPropFieldsWithoutLocaleKey>;
|
|
10
10
|
export declare const getEntryImageDetails: (entry: Entry, fieldKey: string) => Promise<string>;
|
|
11
11
|
export declare const getTopicDetails: (topicEntry: Entry, fieldKey: string, contentType: string, showRelatedEntities?: boolean, isCatalogEntry?: boolean, skipPageSlugs?: boolean) => Promise<TopicDetailsResponse[]>;
|
|
@@ -2,7 +2,7 @@ import type { Entry, CreateEntryProps, EntryProps } from "contentful-management/
|
|
|
2
2
|
import type { QueryOptions } from "contentful-management/dist/typings/common-types";
|
|
3
3
|
import { Environment, Locale, CreateAssetProps } from "contentful-management/types";
|
|
4
4
|
import { ContentfulLocale, AvailableCatalogs, TopicDetailsResponse, AssetPropFields, OtherFilters, WrapperImageFields } from "../types";
|
|
5
|
-
export
|
|
5
|
+
export type Config = {
|
|
6
6
|
accessToken: string;
|
|
7
7
|
spaceId: string;
|
|
8
8
|
environmentId: string;
|
|
@@ -13,7 +13,7 @@ export declare let defaultEnvironmentLocale: Locale;
|
|
|
13
13
|
export declare let defaultEnvironmentLocaleCode: string;
|
|
14
14
|
export declare const cfLocales: ContentfulLocale[];
|
|
15
15
|
export declare const checkConfig: (skipInit?: boolean) => boolean;
|
|
16
|
-
export declare const init: (opts?: Config
|
|
16
|
+
export declare const init: (opts?: Config) => void;
|
|
17
17
|
export declare const getConfig: () => Config;
|
|
18
18
|
export declare const getEnvironment: () => Promise<Environment>;
|
|
19
19
|
export declare const getEnvironmentDefaultLocale: () => Promise<Locale>;
|
|
@@ -22,13 +22,13 @@ export declare const getEnvironmentDefaultLocaleCode: () => Promise<string>;
|
|
|
22
22
|
export declare const uploadFile: (asset: CreateAssetProps) => Promise<any>;
|
|
23
23
|
export declare const createEntryWithId: (contentTypeId: string, id: string, data: CreateEntryProps, publish?: boolean) => Promise<Entry>;
|
|
24
24
|
export declare const updateEntry: (itemEntry: Entry, data: CreateEntryProps, publish?: boolean) => Promise<Entry>;
|
|
25
|
-
export declare const getEntryByCode: (code: string, contentTypeId: string, select?: string
|
|
26
|
-
export declare const getAllEntriesByCodes: (codes: string[], contentTypeId: string, select?: string
|
|
27
|
-
export declare const getAllEntries: (contentType: string, select?: string
|
|
28
|
-
export declare const getEntryByID: (entryID: string, contentTypeId: string, select?: string
|
|
25
|
+
export declare const getEntryByCode: (code: string, contentTypeId: string, select?: string) => Promise<Entry>;
|
|
26
|
+
export declare const getAllEntriesByCodes: (codes: string[], contentTypeId: string, select?: string, filter?: string, otherFilters?: OtherFilters[]) => Promise<Entry[]>;
|
|
27
|
+
export declare const getAllEntries: (contentType: string, select?: string, filterKey?: string, filterValue?: string, limit?: number) => Promise<Entry[]>;
|
|
28
|
+
export declare const getEntryByID: (entryID: string, contentTypeId: string, select?: string, locale?: string) => Promise<Entry>;
|
|
29
29
|
export declare const initBaseEntries: () => Promise<boolean>;
|
|
30
|
-
export declare const getDefaultProfessionalPageContentData: (pageContentEntry: Entry, pageContentData: CreateEntryProps) => Promise<CreateEntryProps
|
|
31
|
-
export declare const deleteAllEntries: (contentType: string, catalogCode?: AvailableCatalogs
|
|
30
|
+
export declare const getDefaultProfessionalPageContentData: (pageContentEntry: Entry, pageContentData: CreateEntryProps) => Promise<CreateEntryProps>;
|
|
31
|
+
export declare const deleteAllEntries: (contentType: string, catalogCode?: AvailableCatalogs) => Promise<{
|
|
32
32
|
deleted: number;
|
|
33
33
|
total: number;
|
|
34
34
|
}>;
|
|
@@ -40,14 +40,14 @@ export declare const deletePages: (types: string[], limit?: number) => Promise<{
|
|
|
40
40
|
deleted: number;
|
|
41
41
|
total: number;
|
|
42
42
|
}>;
|
|
43
|
-
export declare const deleteEntries: (contentType: string, catalogCode?: AvailableCatalogs
|
|
43
|
+
export declare const deleteEntries: (contentType: string, catalogCode?: AvailableCatalogs, limit?: number) => Promise<{
|
|
44
44
|
deleted: number;
|
|
45
45
|
total: number;
|
|
46
46
|
}>;
|
|
47
47
|
export declare const addToRelationFields: (entry: Entry | any, fieldKey: string, entrySysIdValue: string, manyReferences?: boolean, resetOldValues?: boolean, linkType?: "Asset" | "Entry") => Promise<Entry>;
|
|
48
48
|
export declare const removeFromRelationFields: (entry: Entry | any, fieldKey: string, entrySysIdValue: string, manyReferences?: boolean) => Promise<any>;
|
|
49
49
|
export declare const removeFromFieldObject: (entry: Entry | any, fieldKey: string, entrySysIdValues: string | string[]) => Promise<any>;
|
|
50
|
-
export declare const addFieldValue: (entry: Entry | any, fieldKey: string, fieldValue: any, manyReferences?: boolean, locale?: string
|
|
50
|
+
export declare const addFieldValue: (entry: Entry | any, fieldKey: string, fieldValue: any, manyReferences?: boolean, locale?: string) => Promise<any>;
|
|
51
51
|
export declare const getTopicDetails: (topicEntry: Entry, fieldKey: string, contentType: string, showRelatedEntities?: boolean, isCatalogEntry?: boolean, skipPageSlugs?: boolean) => Promise<TopicDetailsResponse[]>;
|
|
52
52
|
export declare const getAssetDetails: (assetId: string) => Promise<AssetPropFields>;
|
|
53
53
|
export declare const getEntryImageDetails: (entry: Entry, fieldKey: string) => Promise<string>;
|
package/types/libs/logs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import winston from "winston";
|
|
2
|
-
export
|
|
2
|
+
export type LogLevels = "VERBOSE" | "DEBUG" | "INFO" | "WARN" | "ERROR" | "SILLY" | "HTTP";
|
|
3
3
|
export declare const logStatus = true;
|
|
4
4
|
export declare let serverUtils: any;
|
|
5
5
|
export declare const setLogId: (id: string) => void;
|
package/types/libs/pdf.d.ts
CHANGED
|
@@ -13,5 +13,5 @@ interface PDFHeaderAndFooter {
|
|
|
13
13
|
header?: HeaderColumns;
|
|
14
14
|
footer?: FooterColumns;
|
|
15
15
|
}
|
|
16
|
-
export declare const generatePDFByUrl: (url: string, fileName?: string, contents?: PDFHeaderAndFooter
|
|
16
|
+
export declare const generatePDFByUrl: (url: string, fileName?: string, contents?: PDFHeaderAndFooter) => Promise<any>;
|
|
17
17
|
export {};
|
package/types/libs/s3.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ interface Config extends AWSConfig {
|
|
|
11
11
|
export declare let config: Config;
|
|
12
12
|
export declare let s3: AWS.S3;
|
|
13
13
|
export declare const checkConfig: (skipInit?: boolean) => void;
|
|
14
|
-
export declare const init: (opts?: Config
|
|
14
|
+
export declare const init: (opts?: Config) => void;
|
|
15
15
|
export declare const listObjects: (prefix?: string) => Promise<import("aws-sdk/lib/request").PromiseResult<AWS.S3.ListObjectsV2Output, AWS.AWSError>>;
|
|
16
16
|
export declare const upload: (url: string, fileName?: string, path?: string, metaData?: any) => Promise<AWS.S3.ManagedUpload.SendData>;
|
|
17
17
|
export declare const getFileFromS3: (path: string, returnUrl?: boolean) => Promise<any>;
|
package/types/pim/config.d.ts
CHANGED
|
@@ -9,5 +9,5 @@ export declare const defaultConfig: Readonly<Config>;
|
|
|
9
9
|
export declare let config: Config;
|
|
10
10
|
export declare const resetConfig: () => void;
|
|
11
11
|
export declare const checkConfig: (skipInit?: boolean) => void;
|
|
12
|
-
export declare const init: (providedConfig?: Config
|
|
12
|
+
export declare const init: (providedConfig?: Config) => void;
|
|
13
13
|
export declare const getConfig: () => Readonly<Config>;
|
package/types/pim/endpoints.d.ts
CHANGED
|
@@ -5,16 +5,16 @@ import { CollectionModels } from "../resources/CollectionModels";
|
|
|
5
5
|
import { CollectionSubModels } from "../resources/CollectionSubModels";
|
|
6
6
|
import { CollectionSubFamilies } from "../resources/CollectionSubFamilies";
|
|
7
7
|
import { FamilyDetails } from "../resources/FamilyDetails";
|
|
8
|
-
|
|
8
|
+
type AvailableOtherCatalogDataEndpoint = "models" | "submodels" | "subfamilies";
|
|
9
9
|
export declare const getPimDomain: () => string;
|
|
10
|
-
export declare const getCatalogTaxonomiesHierarchy: (catalogCode: AvailableCatalogs, jsonFile?: null
|
|
10
|
+
export declare const getCatalogTaxonomiesHierarchy: (catalogCode: AvailableCatalogs, jsonFile?: null) => Promise<CatalogDetails>;
|
|
11
11
|
export declare const getDictionary: () => Promise<any>;
|
|
12
12
|
export declare const getAllProducts: (lastModified?: string | null, catalogCode?: AvailableCatalogs | null) => Promise<any>;
|
|
13
13
|
export declare const getLatestProducts: (catalogCode: AvailableCatalogs, lastModified: string, offset?: number, limit?: number, lastModifiedTo?: string) => Promise<any>;
|
|
14
14
|
export declare const getProductDetails: (code: string) => Promise<any>;
|
|
15
15
|
export declare const getAudit: (lastModified?: string) => Promise<Audit[]>;
|
|
16
16
|
export declare const getStaticDailyProducts: (catalogCode: AvailableCatalogs, day: string, saveToS3?: boolean) => Promise<any>;
|
|
17
|
-
|
|
17
|
+
type AvailableOtherCatalogCollection = CollectionModels | CollectionSubModels | CollectionSubFamilies;
|
|
18
18
|
export declare const getOtherCatalogData: <T extends AvailableOtherCatalogCollection>(endpoint: AvailableOtherCatalogDataEndpoint, offset?: number, limit?: number) => Promise<T>;
|
|
19
19
|
export declare const getFamilies: () => Promise<FamilyDetails[]>;
|
|
20
20
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Entry, CreateEntryProps } from "contentful-management/dist/typings/entities/entry";
|
|
2
2
|
import { GenericData } from "../../resources/ProductDetails";
|
|
3
|
-
export declare const getDesignerData: (designer: GenericData) => Promise<CreateEntryProps
|
|
3
|
+
export declare const getDesignerData: (designer: GenericData) => Promise<CreateEntryProps>;
|
|
4
4
|
export declare const addDesignerData: (data: any, designer: GenericData, manyReferences?: boolean) => Promise<any>;
|
|
5
5
|
export declare const importDesigner: (designer: GenericData, skipUpdate?: boolean) => Promise<Entry>;
|
|
6
6
|
export declare const importDesigners: () => Promise<void>;
|
|
@@ -2,13 +2,13 @@ import { ProductDetails } from "../../resources/ProductDetails";
|
|
|
2
2
|
import { AvailableCatalogs } from "../../types";
|
|
3
3
|
import type { Entry, CreateEntryProps } from "contentful-management/dist/typings/entities/entry";
|
|
4
4
|
import { KeyValueMap } from "contentful-management/dist/typings/common-types";
|
|
5
|
-
export
|
|
6
|
-
export
|
|
5
|
+
export type AvailableProductStatus = "To be review" | "Published" | "Unpublished";
|
|
6
|
+
export type AvailableRelationFieldKeys = "accessories" | "accessoryOf" | "bulbOf" | "sparepartOf" | "bulbs" | "spareparts";
|
|
7
7
|
export declare const setHideInRegionField: (destinations: string[], pageData: CreateEntryProps) => Promise<KeyValueMap>;
|
|
8
8
|
export declare const certificationFields: string[];
|
|
9
9
|
export declare const excludeCertificationFieldsKeys: string[];
|
|
10
10
|
export declare const getProductPageIdByCode: (productCode: string) => string;
|
|
11
|
-
export declare const importProduct: (productDetails: ProductDetails, catalog: AvailableCatalogs, familyCodeIn?: string[]
|
|
11
|
+
export declare const importProduct: (productDetails: ProductDetails, catalog: AvailableCatalogs, familyCodeIn?: string[], subFamilyCodeIn?: string[]) => Promise<boolean>;
|
|
12
12
|
export declare const setProductRelationships: (code: string, fieldKey?: AvailableRelationFieldKeys | null) => Promise<void>;
|
|
13
13
|
export declare const setProductsRelationships: (catalog: AvailableCatalogs, lastModified: string, fieldKey: AvailableRelationFieldKeys | null, offset?: number, limit?: number, s3FilePath?: string) => Promise<{
|
|
14
14
|
offset: number;
|
package/types/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
1
|
+
export type AvailableCatalogs = "ARCHITECTURAL" | "OUTDOOR" | "DECORATIVE";
|
|
2
|
+
export type AvailableEntryStatus = "Published" | "Changed" | "Draft" | "Archived";
|
|
3
|
+
export type NonEmptyArray<T> = [T, ...T[]];
|
|
4
|
+
export type ObjectPartial = Partial<Record<string, any>>;
|
|
5
5
|
export type { Config as ContentfulConfig } from "./libs/contentful";
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
6
|
+
export type PimLocale = "en" | "en_US" | "it" | "es" | "de" | "fr" | "sv" | "no" | "da" | "ru";
|
|
7
|
+
export type ContentfulLocale = "en" | "en-US" | "it" | "es" | "de" | "fr";
|
|
8
|
+
export type PimValues = {
|
|
9
9
|
value_en: string;
|
|
10
10
|
value_en_US?: string | null;
|
|
11
11
|
value_it: string | null;
|
|
@@ -17,7 +17,7 @@ export declare type PimValues = {
|
|
|
17
17
|
value_da: string | null;
|
|
18
18
|
value_ru: string | null;
|
|
19
19
|
};
|
|
20
|
-
export
|
|
20
|
+
export type PimDescription = {
|
|
21
21
|
description_en: string;
|
|
22
22
|
description_en_US?: string | null;
|
|
23
23
|
description_it: string | null;
|
|
@@ -29,7 +29,7 @@ export declare type PimDescription = {
|
|
|
29
29
|
description_da: string | null;
|
|
30
30
|
description_ru: string | null;
|
|
31
31
|
};
|
|
32
|
-
export
|
|
32
|
+
export type PimProductDescription = {
|
|
33
33
|
description1_en: string;
|
|
34
34
|
description1_en_US?: string | null;
|
|
35
35
|
description1_it: string | null;
|
|
@@ -41,7 +41,7 @@ export declare type PimProductDescription = {
|
|
|
41
41
|
description1_da: string | null;
|
|
42
42
|
description1_ru: string | null;
|
|
43
43
|
};
|
|
44
|
-
export
|
|
44
|
+
export type PimProductExcerpt = {
|
|
45
45
|
description2_en: string;
|
|
46
46
|
description2_en_US?: string | null;
|
|
47
47
|
description2_it: string | null;
|
|
@@ -53,28 +53,28 @@ export declare type PimProductExcerpt = {
|
|
|
53
53
|
description2_da: string | null;
|
|
54
54
|
description2_ru: string | null;
|
|
55
55
|
};
|
|
56
|
-
export
|
|
56
|
+
export type CfSys = {
|
|
57
57
|
sys: {
|
|
58
58
|
type: string;
|
|
59
59
|
linkType: string;
|
|
60
60
|
id: string;
|
|
61
61
|
};
|
|
62
62
|
};
|
|
63
|
-
export
|
|
63
|
+
export type PaginationResults = {
|
|
64
64
|
offset: number;
|
|
65
65
|
limit: number;
|
|
66
66
|
completed: boolean;
|
|
67
67
|
s3FilePath?: string;
|
|
68
68
|
total?: number;
|
|
69
69
|
};
|
|
70
|
-
export
|
|
71
|
-
export
|
|
70
|
+
export type CfLocalizedEntryField = Partial<Record<ContentfulLocale, string | null>>;
|
|
71
|
+
export type TopicDetailsResponse = {
|
|
72
72
|
names: CfLocalizedEntryField;
|
|
73
73
|
code: string;
|
|
74
74
|
slugs?: {};
|
|
75
75
|
details?: {};
|
|
76
76
|
};
|
|
77
|
-
export
|
|
77
|
+
export type ProductFieldsRequiredData = {
|
|
78
78
|
key: string;
|
|
79
79
|
parent: string;
|
|
80
80
|
icon: boolean;
|
|
@@ -87,7 +87,7 @@ export interface AlgoliaPaginateRecords extends PaginationResults {
|
|
|
87
87
|
export interface AlgoliaPaginateObjectIds extends PaginationResults {
|
|
88
88
|
objectIds: string[];
|
|
89
89
|
}
|
|
90
|
-
export
|
|
90
|
+
export type AssetPropFields = {
|
|
91
91
|
title: {
|
|
92
92
|
[key: string]: string;
|
|
93
93
|
};
|
|
@@ -105,7 +105,7 @@ export declare type AssetPropFields = {
|
|
|
105
105
|
};
|
|
106
106
|
};
|
|
107
107
|
};
|
|
108
|
-
export
|
|
108
|
+
export type AssetPropFieldsWithoutLocaleKey = {
|
|
109
109
|
title: {
|
|
110
110
|
[key: string]: string;
|
|
111
111
|
};
|
|
@@ -121,7 +121,7 @@ export declare type AssetPropFieldsWithoutLocaleKey = {
|
|
|
121
121
|
uploadFrom?: Record<string, any>;
|
|
122
122
|
};
|
|
123
123
|
};
|
|
124
|
-
export
|
|
124
|
+
export type TopicProductFieldsResponse = {
|
|
125
125
|
names: CfLocalizedEntryField;
|
|
126
126
|
code: string;
|
|
127
127
|
slugs: {};
|
|
@@ -144,7 +144,7 @@ interface ImgixDataImageDetails {
|
|
|
144
144
|
width: number;
|
|
145
145
|
height: number;
|
|
146
146
|
}
|
|
147
|
-
export
|
|
147
|
+
export type WrapperImageFields = {
|
|
148
148
|
internalName: string;
|
|
149
149
|
imgixData: ImgixData;
|
|
150
150
|
altText: CfLocalizedEntryField;
|
|
@@ -185,8 +185,8 @@ export interface ImgixAttributes {
|
|
|
185
185
|
warning_spoof: number;
|
|
186
186
|
warning_violence: number;
|
|
187
187
|
}
|
|
188
|
-
export
|
|
189
|
-
export
|
|
188
|
+
export type RequiredImgixAttributes = Pick<ImgixAttributes, "origin_path" | "file_size" | "media_width" | "media_height" | "content_type" | "name">;
|
|
189
|
+
export type AlgoliaObjectFilter = {
|
|
190
190
|
key: string;
|
|
191
191
|
value: string;
|
|
192
192
|
};
|
package/types/utils.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const doChunk: (list: string[], size: number) => any[][];
|
|
|
15
15
|
export declare const getLocalISOTime: () => string;
|
|
16
16
|
export declare const capitalizeFirstLetter: (text: string) => string;
|
|
17
17
|
export declare const keysToLowerCase: (obj: any, includeNestedKeys?: boolean) => any;
|
|
18
|
-
export declare const addProductFieldValueCodesByPimDetails: (pimDetails: any, productFields: any, fieldKey: string, fieldParentKey?: string
|
|
18
|
+
export declare const addProductFieldValueCodesByPimDetails: (pimDetails: any, productFields: any, fieldKey: string, fieldParentKey?: string, customKey?: string, mergeValues?: boolean, keepKey?: boolean) => string[];
|
|
19
19
|
export declare const replaceAll: (original: string, from: string, to: string) => string;
|
|
20
20
|
export declare const getAllTranslations: (values: any) => Promise<any>;
|
|
21
21
|
export declare const truncateString: (string: string, limit: number) => string;
|