@inizioevoke/veeva-astroclm-core 1.4.7 → 1.4.8
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/tasks/create-csv.d.ts +2 -1
- package/dist/tasks/create-csv.js +10 -10
- package/dist/tasks/deploy.d.ts +2 -1
- package/dist/tasks/deploy.js +2 -2
- package/dist/types/config.d.ts +0 -1
- package/package.json +1 -1
- package/src/tasks/create-csv.ts +12 -10
- package/src/tasks/deploy.ts +3 -2
- package/src/types/config.d.ts +0 -1
|
@@ -15,6 +15,7 @@ interface Params {
|
|
|
15
15
|
buildName: string;
|
|
16
16
|
fieldsOnly?: boolean;
|
|
17
17
|
additionalFields?: AdditionalFields;
|
|
18
|
+
replaceHeaders?: Record<string, string>;
|
|
18
19
|
}
|
|
19
|
-
export default function ({ config, deployDir, buildName, fieldsOnly, additionalFields }: Params): Promise<void>;
|
|
20
|
+
export default function ({ config, deployDir, buildName, fieldsOnly, additionalFields, replaceHeaders }: Params): Promise<void>;
|
|
20
21
|
export {};
|
package/dist/tasks/create-csv.js
CHANGED
|
@@ -2,7 +2,7 @@ import { writeFile } from 'node:fs/promises';
|
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import logger from '../lib/logger.js';
|
|
4
4
|
import { pathToSlideZip } from '../lib/utils.js';
|
|
5
|
-
export default async function ({ config, deployDir, buildName, fieldsOnly = false, additionalFields }) {
|
|
5
|
+
export default async function ({ config, deployDir, buildName, fieldsOnly = false, additionalFields, replaceHeaders }) {
|
|
6
6
|
logger.info('Creating multichannel loader CSV');
|
|
7
7
|
const headers = [...(fieldsOnly ? CSV_HEADERS_FIELDS_ONLY : CSV_HEADERS)];
|
|
8
8
|
const additional = filterAdditionalFields(config, additionalFields);
|
|
@@ -31,15 +31,6 @@ 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
|
-
}
|
|
43
34
|
const presentation = config.presentation;
|
|
44
35
|
for (const [key, header] of Object.entries(BINDER_PRES_HEADERS)) {
|
|
45
36
|
if (presentation[key]) {
|
|
@@ -58,6 +49,15 @@ export default async function ({ config, deployDir, buildName, fieldsOnly = fals
|
|
|
58
49
|
for (let i = 0; i < config.presentation.slides.length; i++) {
|
|
59
50
|
rows.push(createSlideRow(headers, config, config.presentation.slides[i], additional?.slides));
|
|
60
51
|
}
|
|
52
|
+
if (replaceHeaders) {
|
|
53
|
+
const keys = Object.keys(replaceHeaders);
|
|
54
|
+
for (const key of keys) {
|
|
55
|
+
const i = headers.findIndex(h => h === key);
|
|
56
|
+
if (i > -1) {
|
|
57
|
+
headers[i] = replaceHeaders[key];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
61
|
await writeFile(join(deployDir, `_${config.presentation.presentationId}_${buildName}.csv`), rows.map((r) => { return r.join(','); }).join('\n'), { encoding: 'utf8' });
|
|
62
62
|
}
|
|
63
63
|
function filterAdditionalFields(config, additionalFields) {
|
package/dist/tasks/deploy.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ interface Opts {
|
|
|
7
7
|
csvOnly?: boolean;
|
|
8
8
|
serverPort?: number;
|
|
9
9
|
additionalCsvFields?: AdditionalFields;
|
|
10
|
+
replaceHeaders?: Record<string, string>;
|
|
10
11
|
}
|
|
11
|
-
export default function ({ root, config, env, csvOnly, serverPort, additionalCsvFields }: Opts): Promise<void>;
|
|
12
|
+
export default function ({ root, config, env, csvOnly, serverPort, additionalCsvFields, replaceHeaders }: Opts): Promise<void>;
|
|
12
13
|
export {};
|
package/dist/tasks/deploy.js
CHANGED
|
@@ -14,7 +14,7 @@ const argv = parseArgv({
|
|
|
14
14
|
mode: 'string',
|
|
15
15
|
fieldsOnly: 'boolean'
|
|
16
16
|
});
|
|
17
|
-
export default async function ({ root, config, env, csvOnly = false, serverPort = 4320, additionalCsvFields }) {
|
|
17
|
+
export default async function ({ root, config, env, csvOnly = false, serverPort = 4320, additionalCsvFields, replaceHeaders }) {
|
|
18
18
|
const rootDir = root ?? process.cwd();
|
|
19
19
|
// we could import the astro config and see if the outDir was set but right now it's not necessary
|
|
20
20
|
const astroConfig = await getAstroConfig(root);
|
|
@@ -50,7 +50,7 @@ export default async function ({ root, config, env, csvOnly = false, serverPort
|
|
|
50
50
|
await server.stop();
|
|
51
51
|
await createZips({ config, deployDir });
|
|
52
52
|
}
|
|
53
|
-
await createCsv({ config, deployDir, buildName, fieldsOnly: csvOnly, additionalFields: additionalCsvFields });
|
|
53
|
+
await createCsv({ config, deployDir, buildName, fieldsOnly: csvOnly, additionalFields: additionalCsvFields, replaceHeaders });
|
|
54
54
|
}
|
|
55
55
|
async function getAstroConfig(root) {
|
|
56
56
|
let config = undefined;
|
package/dist/types/config.d.ts
CHANGED
|
@@ -55,7 +55,6 @@ 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>;
|
|
59
58
|
|
|
60
59
|
presentation: IVeevaConfigPresentation & {
|
|
61
60
|
name: string;
|
package/package.json
CHANGED
package/src/tasks/create-csv.ts
CHANGED
|
@@ -23,8 +23,9 @@ interface Params {
|
|
|
23
23
|
buildName: string;
|
|
24
24
|
fieldsOnly?: boolean;
|
|
25
25
|
additionalFields?: AdditionalFields;
|
|
26
|
+
replaceHeaders?: Record<string, string>;
|
|
26
27
|
}
|
|
27
|
-
export default async function({ config, deployDir, buildName, fieldsOnly = false, additionalFields }: Params) {
|
|
28
|
+
export default async function({ config, deployDir, buildName, fieldsOnly = false, additionalFields, replaceHeaders }: Params) {
|
|
28
29
|
logger.info('Creating multichannel loader CSV');
|
|
29
30
|
const headers: string[] = [...(fieldsOnly ? CSV_HEADERS_FIELDS_ONLY : CSV_HEADERS)];
|
|
30
31
|
|
|
@@ -55,15 +56,6 @@ export default async function({ config, deployDir, buildName, fieldsOnly = false
|
|
|
55
56
|
}
|
|
56
57
|
});
|
|
57
58
|
|
|
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
|
-
}
|
|
67
59
|
const presentation = config.presentation;
|
|
68
60
|
|
|
69
61
|
for (const [key, header] of Object.entries(BINDER_PRES_HEADERS)) {
|
|
@@ -87,6 +79,16 @@ export default async function({ config, deployDir, buildName, fieldsOnly = false
|
|
|
87
79
|
rows.push(createSlideRow(headers, config, config.presentation.slides[i], additional?.slides));
|
|
88
80
|
}
|
|
89
81
|
|
|
82
|
+
if (replaceHeaders) {
|
|
83
|
+
const keys = Object.keys(replaceHeaders) as (keyof typeof replaceHeaders)[];
|
|
84
|
+
for (const key of keys) {
|
|
85
|
+
const i = headers.findIndex(h => h === key);
|
|
86
|
+
if (i > -1) {
|
|
87
|
+
headers[i] = replaceHeaders[key];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
90
92
|
await writeFile(join(deployDir, `_${config.presentation.presentationId}_${buildName}.csv`), rows.map((r)=>{return r.join(',');}).join('\n'), { encoding: 'utf8' });
|
|
91
93
|
}
|
|
92
94
|
|
package/src/tasks/deploy.ts
CHANGED
|
@@ -28,8 +28,9 @@ interface Opts {
|
|
|
28
28
|
csvOnly?: boolean;
|
|
29
29
|
serverPort?: number;
|
|
30
30
|
additionalCsvFields?: AdditionalFields;
|
|
31
|
+
replaceHeaders?: Record<string, string>;
|
|
31
32
|
}
|
|
32
|
-
export default async function({ root, config, env, csvOnly = false, serverPort = 4320, additionalCsvFields }: Opts) {
|
|
33
|
+
export default async function({ root, config, env, csvOnly = false, serverPort = 4320, additionalCsvFields, replaceHeaders }: Opts) {
|
|
33
34
|
const rootDir = root ?? process.cwd();
|
|
34
35
|
// we could import the astro config and see if the outDir was set but right now it's not necessary
|
|
35
36
|
const astroConfig = await getAstroConfig(root);
|
|
@@ -71,7 +72,7 @@ export default async function({ root, config, env, csvOnly = false, serverPort =
|
|
|
71
72
|
await createZips({ config, deployDir });
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
await createCsv({ config, deployDir, buildName, fieldsOnly: csvOnly, additionalFields: additionalCsvFields })
|
|
75
|
+
await createCsv({ config, deployDir, buildName, fieldsOnly: csvOnly, additionalFields: additionalCsvFields, replaceHeaders })
|
|
75
76
|
}
|
|
76
77
|
|
|
77
78
|
|
package/src/types/config.d.ts
CHANGED
|
@@ -55,7 +55,6 @@ 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>;
|
|
59
58
|
|
|
60
59
|
presentation: IVeevaConfigPresentation & {
|
|
61
60
|
name: string;
|