@inizioevoke/veeva-astroclm-core 1.4.6 → 1.4.7

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.
@@ -31,6 +31,15 @@ export default async function ({ config, deployDir, buildName, fieldsOnly = fals
31
31
  headers.push(a.header);
32
32
  }
33
33
  });
34
+ if (config.replaceHeaders) {
35
+ const keys = Object.keys(config.replaceHeaders);
36
+ for (const key of keys) {
37
+ const i = headers.findIndex(h => h === key);
38
+ if (i > -1) {
39
+ headers[i] = config.replaceHeaders[key];
40
+ }
41
+ }
42
+ }
34
43
  const presentation = config.presentation;
35
44
  for (const [key, header] of Object.entries(BINDER_PRES_HEADERS)) {
36
45
  if (presentation[key]) {
@@ -44,11 +53,11 @@ export default async function ({ config, deployDir, buildName, fieldsOnly = fals
44
53
  }
45
54
  const rows = [headers];
46
55
  rows.push(createPresentationRow(headers, config, additional?.presentation));
56
+ const shared = createSharedRow(headers, config, additional?.shared);
57
+ shared && rows.push(shared);
47
58
  for (let i = 0; i < config.presentation.slides.length; i++) {
48
59
  rows.push(createSlideRow(headers, config, config.presentation.slides[i], additional?.slides));
49
60
  }
50
- const shared = createSharedRow(headers, config, additional?.shared);
51
- shared && rows.push(shared);
52
61
  await writeFile(join(deployDir, `_${config.presentation.presentationId}_${buildName}.csv`), rows.map((r) => { return r.join(','); }).join('\n'), { encoding: 'utf8' });
53
62
  }
54
63
  function filterAdditionalFields(config, additionalFields) {
@@ -55,6 +55,7 @@ export interface IVeevaConfig {
55
55
  dimensions: { width: number, height: number };
56
56
  slideSettings?: IVeevaClmSlideSettings; // legacy support
57
57
  thumbnails?: IThumbnailSettings | IScreenshotSettings | IScreenshotSettings[];
58
+ replaceHeaders?: Record<string, string>;
58
59
 
59
60
  presentation: IVeevaConfigPresentation & {
60
61
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inizioevoke/veeva-astroclm-core",
3
- "version": "1.4.6",
3
+ "version": "1.4.7",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "",
@@ -3,6 +3,7 @@ import { join } from 'node:path';
3
3
  import type { IVeevaConfig, IVeevaConfigSlide, Actions, IVeevaClmBinderFields } from '../types';
4
4
  import logger from '../lib/logger.js';
5
5
  import { pathToSlideZip } from '../lib/utils.js';
6
+ import console from 'node:console';
6
7
 
7
8
  export interface AdditionalField {
8
9
  header: string;
@@ -53,6 +54,16 @@ export default async function({ config, deployDir, buildName, fieldsOnly = false
53
54
  headers.push(a.header);
54
55
  }
55
56
  });
57
+
58
+ if (config.replaceHeaders) {
59
+ const keys = Object.keys(config.replaceHeaders) as (keyof typeof config.replaceHeaders)[];
60
+ for (const key of keys) {
61
+ const i = headers.findIndex(h => h === key);
62
+ if (i > -1) {
63
+ headers[i] = config.replaceHeaders[key];
64
+ }
65
+ }
66
+ }
56
67
  const presentation = config.presentation;
57
68
 
58
69
  for (const [key, header] of Object.entries(BINDER_PRES_HEADERS)) {
@@ -68,11 +79,13 @@ export default async function({ config, deployDir, buildName, fieldsOnly = false
68
79
 
69
80
  const rows: string[][] = [headers];
70
81
  rows.push(createPresentationRow(headers, config, additional?.presentation));
82
+
83
+ const shared = createSharedRow(headers, config, additional?.shared);
84
+ shared && rows.push(shared);
85
+
71
86
  for (let i=0; i<config.presentation.slides.length; i++) {
72
87
  rows.push(createSlideRow(headers, config, config.presentation.slides[i], additional?.slides));
73
88
  }
74
- const shared = createSharedRow(headers, config, additional?.shared);
75
- shared && rows.push(shared);
76
89
 
77
90
  await writeFile(join(deployDir, `_${config.presentation.presentationId}_${buildName}.csv`), rows.map((r)=>{return r.join(',');}).join('\n'), { encoding: 'utf8' });
78
91
  }
@@ -55,6 +55,7 @@ export interface IVeevaConfig {
55
55
  dimensions: { width: number, height: number };
56
56
  slideSettings?: IVeevaClmSlideSettings; // legacy support
57
57
  thumbnails?: IThumbnailSettings | IScreenshotSettings | IScreenshotSettings[];
58
+ replaceHeaders?: Record<string, string>;
58
59
 
59
60
  presentation: IVeevaConfigPresentation & {
60
61
  name: string;