pim-import 2.81.0 → 2.82.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.reindexModels = exports.reindexModel = exports.removeSubModelObject = exports.reindexSubModels = exports.reindexSubModel = exports.removeProductObject = exports.reindexProducts = exports.reindexProduct = exports.removeSubFamilyObject = exports.reindexSubFamily = exports.reindexSubFamilies = exports.pipedreamReindex = exports.removeFamilyObject = exports.reindexFamily = exports.reindexFamilies = exports.resetIndexSettings = exports.removeAllProductModelProductRelations = exports.removeProductFromColorVariantsByProductLine = exports.setProductAutodescriptionByTopicId = exports.getProductAutodescription = exports.setProductsAutodescription = exports.generateTechSpecPdf = exports.audit = exports.getAllProductEntriesByCatalog = exports.setProductRelationships = exports.setProductsRelationships = exports.importProductByCode = exports.importFamilies = exports.importSubFamilies = exports.importSubModels = exports.importModels = exports.dailyProductsUpdate = exports.importLatestProducts = exports.importCategories = exports.importDictionaryProductSubLine = exports.importDictionaryProductLine = exports.importDictionaryIcons = exports.importDictionaryFields = exports.savePDFToS3 = exports.getFileFromS3 = exports.saveJsonToS3 = exports.uploadS3 = exports.initS3 = exports.getTopicPage = exports.getEntryByID = exports.deleteEntries = exports.deletePages = exports.initBaseEntries = exports.initContentful = exports.initPim = void 0;
4
- exports.generatePDFByUrl = exports.removeRecordsByStatus = exports.setLogPath = exports.setLogId = exports.log = exports.getStaticDailyProducts = exports.getLocalISOTime = exports.importDownloads = exports.removePostObject = exports.reindexPosts = exports.reindexPost = exports.removePressReleaseObject = exports.reindexPressReleases = exports.reindexPressRelease = exports.removePressReviewObject = exports.reindexPressReviews = exports.reindexPressReview = exports.removeStoryObject = exports.reindexStories = exports.reindexStory = exports.removeProjectObject = exports.reindexProjects = exports.reindexProject = exports.removeDownloadObject = exports.reindexDownloads = exports.reindexDownload = exports.removeModelObject = void 0;
4
+ exports.generatePDFByUrl = exports.removeRecordsByStatus = exports.setLogFilename = exports.setLogPath = exports.setLogId = exports.log = exports.getStaticDailyProducts = exports.getLocalISOTime = exports.importDownloads = exports.removePostObject = exports.reindexPosts = exports.reindexPost = exports.removePressReleaseObject = exports.reindexPressReleases = exports.reindexPressRelease = exports.removePressReviewObject = exports.reindexPressReviews = exports.reindexPressReview = exports.removeStoryObject = exports.reindexStories = exports.reindexStory = exports.removeProjectObject = exports.reindexProjects = exports.reindexProject = exports.removeDownloadObject = exports.reindexDownloads = exports.reindexDownload = exports.removeModelObject = void 0;
5
5
  var config_1 = require("./pim/config");
6
6
  Object.defineProperty(exports, "initPim", { enumerable: true, get: function () { return config_1.init; } });
7
7
  var contentful_1 = require("./libs/contentful");
@@ -106,6 +106,7 @@ var logs_1 = require("./libs/logs");
106
106
  Object.defineProperty(exports, "log", { enumerable: true, get: function () { return logs_1.log; } });
107
107
  Object.defineProperty(exports, "setLogId", { enumerable: true, get: function () { return logs_1.setLogId; } });
108
108
  Object.defineProperty(exports, "setLogPath", { enumerable: true, get: function () { return logs_1.setLogPath; } });
109
+ Object.defineProperty(exports, "setLogFilename", { enumerable: true, get: function () { return logs_1.setLogFilename; } });
109
110
  var clean_1 = require("./algolia/clean");
110
111
  Object.defineProperty(exports, "removeRecordsByStatus", { enumerable: true, get: function () { return clean_1.removeRecordsByStatus; } });
111
112
  var puppeteer_1 = require("./libs/puppeteer");
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAGA,uCAA+C;AAAtC,iGAAA,IAAI,OAAW;AACxB,gDAO2B;AANzB,4GAAA,IAAI,OAAkB;AACtB,6GAAA,eAAe,OAAA;AACf,yGAAA,WAAW,OAAA;AACX,2GAAA,aAAa,OAAA;AACb,0GAAA,YAAY,OAAA;AACZ,0GAAA,YAAY,OAAA;AAEd,gCAMmB;AALjB,4FAAA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"}
package/dist/libs/logs.js CHANGED
@@ -3,12 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.log = exports.getLogger = exports.setLogPath = exports.setLogId = exports.logStatus = void 0;
6
+ exports.log = exports.getLogger = exports.setLogFilename = exports.setLogPath = exports.setLogId = exports.logStatus = void 0;
7
7
  const winston_1 = __importDefault(require("winston"));
8
8
  const s3_streamlogger_1 = require("s3-streamlogger");
9
9
  exports.logStatus = true;
10
10
  let logId = "";
11
11
  let logPath = "";
12
+ let logFilename = "";
12
13
  let Logger = null;
13
14
  const setLogId = (id) => {
14
15
  if (logId !== id) {
@@ -25,12 +26,26 @@ const setLogPath = (path) => {
25
26
  }
26
27
  };
27
28
  exports.setLogPath = setLogPath;
29
+ const setLogFilename = (filename) => {
30
+ if (logFilename !== filename) {
31
+ filename = filename.toString();
32
+ if (!/[.]/.exec(filename)) {
33
+ filename += ".log";
34
+ }
35
+ logFilename = filename;
36
+ if (Logger) {
37
+ Logger = exports.getLogger();
38
+ }
39
+ }
40
+ };
41
+ exports.setLogFilename = setLogFilename;
28
42
  const getLogger = () => {
29
43
  const s3_stream = new s3_streamlogger_1.S3StreamLogger({
30
44
  bucket: process.env.FPI_AWS_S3_BUCKET,
31
45
  access_key_id: process.env.FPI_AWS_ACCESS_KEY,
32
46
  secret_access_key: process.env.FPI_AWS_SECRET_ACCESS_KEY,
33
47
  folder: logId ? `logs/${logPath}/` : `logs/`,
48
+ name_format: logFilename,
34
49
  });
35
50
  const transport = new winston_1.default.transports.Stream({
36
51
  stream: s3_stream,
@@ -1 +1 @@
1
- {"version":3,"file":"logs.js","sourceRoot":"","sources":["../../src/libs/logs.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA8B;AAE9B,qDAAiD;AASpC,QAAA,SAAS,GAAG,IAAI,CAAC;AAC9B,IAAI,KAAK,GAAW,EAAE,C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AC,CAAC;SAC1B;aAAM;YACL,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;SAC1B;KACF;SAAM,IAAI,iBAAS,EAAE;QACpB,IAAI,MAAM,EAAE;YACV,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,MAAM,OAAO,EAAE,CAAC,CAAC;YACrC,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;SACnC;aAAM;YACL,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;YACxB,MAAM,UAAU,GACd,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;gBACnE,GAAG;gBACH,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACpE,OAAO,CAAC,GAAG,CAAC,IAAI,UAAU,KAAK,KAAK,MAAM,OAAO,EAAE,CAAC,CAAC;SACtD;KACF;AACH,CAAC,CAAC;AA1BW,QAAA,GAAG,OA0Bd"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pim-import",
3
- "version": "2.81.0",
3
+ "version": "2.82.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "types/index.d.ts",
package/src/index.ts CHANGED
@@ -112,6 +112,6 @@ export { reindexPost, reindexPosts, removePostObject } from "./algolia/news";
112
112
  export { importDownloads } from "./downloads/import";
113
113
  export { getLocalISOTime } from "./utils";
114
114
  export { getStaticDailyProducts } from "./pim/endpoints";
115
- export { log, setLogId, setLogPath } from "./libs/logs";
115
+ export { log, setLogId, setLogPath, setLogFilename } from "./libs/logs";
116
116
  export { removeRecordsByStatus } from "./algolia/clean";
117
117
  export { generatePDFByUrl } from "./libs/puppeteer";
package/src/libs/logs.ts CHANGED
@@ -12,6 +12,7 @@ export type LogLevels =
12
12
  export const logStatus = true;
13
13
  let logId: string = "";
14
14
  let logPath: string = "";
15
+ let logFilename: string = "";
15
16
  let Logger: any = null;
16
17
 
17
18
  export const setLogId = (id: string) => {
@@ -30,12 +31,27 @@ export const setLogPath = (path: string) => {
30
31
  }
31
32
  };
32
33
 
34
+ export const setLogFilename = (filename: string) => {
35
+ if (logFilename !== filename) {
36
+ filename = filename.toString();
37
+ if (!/[.]/.exec(filename)) {
38
+ filename += ".log";
39
+ }
40
+ logFilename = filename;
41
+
42
+ if (Logger) {
43
+ Logger = getLogger();
44
+ }
45
+ }
46
+ };
47
+
33
48
  export const getLogger = () => {
34
49
  const s3_stream = new S3StreamLogger({
35
50
  bucket: process.env.FPI_AWS_S3_BUCKET,
36
51
  access_key_id: process.env.FPI_AWS_ACCESS_KEY,
37
52
  secret_access_key: process.env.FPI_AWS_SECRET_ACCESS_KEY,
38
53
  folder: logId ? `logs/${logPath}/` : `logs/`,
54
+ name_format: logFilename,
39
55
  });
40
56
 
41
57
  const transport = new winston.transports.Stream({
package/types/index.d.ts CHANGED
@@ -26,6 +26,6 @@ export { reindexPost, reindexPosts, removePostObject } from "./algolia/news";
26
26
  export { importDownloads } from "./downloads/import";
27
27
  export { getLocalISOTime } from "./utils";
28
28
  export { getStaticDailyProducts } from "./pim/endpoints";
29
- export { log, setLogId, setLogPath } from "./libs/logs";
29
+ export { log, setLogId, setLogPath, setLogFilename } from "./libs/logs";
30
30
  export { removeRecordsByStatus } from "./algolia/clean";
31
31
  export { generatePDFByUrl } from "./libs/puppeteer";
@@ -3,5 +3,6 @@ export declare type LogLevels = "VERBOSE" | "DEBUG" | "INFO" | "WARN" | "ERROR"
3
3
  export declare const logStatus = true;
4
4
  export declare const setLogId: (id: string) => void;
5
5
  export declare const setLogPath: (path: string) => void;
6
+ export declare const setLogFilename: (filename: string) => void;
6
7
  export declare const getLogger: () => winston.Logger;
7
8
  export declare const log: (message: string, level?: LogLevels) => void;