@inizioevoke/veeva-astroclm-core 1.1.5 → 1.1.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.
@@ -16,7 +16,7 @@ export default function ({ veevaEnv = 'client', isTraining = false }: IVeevaConf
16
16
 
17
17
  const binderFields: IVeevaClmBinderFields = {
18
18
  // language: isEvokeBuild ? undefined : 'English',
19
- // crmOrg: isEvokeBuild ? undefined : { crmId: ['CRM_ORD_ID'] },
19
+ // crmOrg: isEvokeBuild ? undefined : { crmId: ['CRM_ORG_ID'] },
20
20
  // crmProduct: isEvokeBuild ? undefined : { id: 'VEEVA_ID_FROM_URL' },
21
21
  // crmDetailGroup: isEvokeBuild ? undefined : { id: 'VEEVA_ID_FROM_URL' },
22
22
  // detailGroup: undefined
@@ -41,6 +41,7 @@ export default async function ({ root, config, env, csvOnly = false, serverPort
41
41
  server: { host: server.host ?? 'localhost', port: server.port },
42
42
  config,
43
43
  deployDir,
44
+ root
44
45
  });
45
46
  await server.stop();
46
47
  await createZips({ deployDir });
@@ -1,6 +1,7 @@
1
1
  import type { IVeevaConfig } from "../types";
2
2
  interface Params {
3
3
  config: IVeevaConfig;
4
+ root: string;
4
5
  deployDir: string;
5
6
  server: {
6
7
  protocol?: 'http' | 'https';
@@ -8,5 +9,5 @@ interface Params {
8
9
  port: number;
9
10
  };
10
11
  }
11
- export default function ({ config, deployDir, server }: Params): Promise<void>;
12
+ export default function ({ config, root, deployDir, server }: Params): Promise<void>;
12
13
  export {};
@@ -3,7 +3,7 @@ import { join } from "node:path";
3
3
  import puppeteer from "puppeteer";
4
4
  import sharp from 'sharp';
5
5
  import logger from '../lib/logger.js';
6
- export default async function ({ config, deployDir, server }) {
6
+ export default async function ({ config, root, deployDir, server }) {
7
7
  logger.info('Generating thumbnails');
8
8
  initThumbSettings(config);
9
9
  await generateSharedThumb(config, deployDir);
@@ -17,9 +17,14 @@ export default async function ({ config, deployDir, server }) {
17
17
  isMobile: true
18
18
  });
19
19
  for (const slide of config.presentation.slides) {
20
+ if (slide.thumbnails?.thumbFile?.filepath) {
21
+ const filepath = join(root, slide.thumbnails.thumbFile.filepath);
22
+ }
23
+ if (slide.thumbnails?.posterFile?.filepath) {
24
+ }
20
25
  for (const settings of slide.thumbnails.settings) {
21
- logger.info(`Generating /${slide.path}/`);
22
- const url = `${server.protocol ?? 'http'}://${server.host}:${server.port}/${slide.path}/${settings.queryStringParams ? `?${objToQS(settings.queryStringParams)}` : ''}`;
26
+ logger.info(`Generating /${settings.path ?? slide.path}/`);
27
+ const url = `${server.protocol ?? 'http'}://${server.host}:${server.port}/${settings.path ?? slide.path}/${settings.queryStringParams ? `?${objToQS(settings.queryStringParams)}` : ''}`;
23
28
  try {
24
29
  await page.goto(url, {
25
30
  waitUntil: 'networkidle0'
@@ -44,7 +49,7 @@ export default async function ({ config, deployDir, server }) {
44
49
  quality: 80,
45
50
  effort: 10
46
51
  })).toBuffer();
47
- const fileName = typeof settings.filename == 'function' ? settings.filename(config, slide, settings) : settings.filename ?? 'thumb.png';
52
+ const fileName = typeof settings.outFile == 'function' ? settings.outFile(config, slide, settings) : settings.outFile ?? 'thumb.png';
48
53
  await writeFile(join(deployDir, slide.path, fileName), thumb);
49
54
  }
50
55
  }
@@ -52,7 +57,7 @@ export default async function ({ config, deployDir, server }) {
52
57
  await browser.close();
53
58
  }
54
59
  async function generateSharedThumb(config, deployDir) {
55
- let settings = config.thumbnails?.settings?.find(s => s.filename === 'thumb.png');
60
+ let settings = config.thumbnails?.settings?.find(s => s.outFile === 'thumb.png');
56
61
  const width = settings?.width ?? 600;
57
62
  const height = settings?.height ?? width / 4 * 3;
58
63
  const svgImage = `
@@ -101,8 +106,8 @@ function initThumbSettings(config) {
101
106
  if (!config.thumbnails.default.height) {
102
107
  config.thumbnails.default.height = config.thumbnails.default.width / 4 * 3;
103
108
  }
104
- if (!config.thumbnails.default.filename) {
105
- config.thumbnails.default.filename = 'thumb.png';
109
+ if (!config.thumbnails.default.outFile) {
110
+ config.thumbnails.default.outFile = 'thumb.png';
106
111
  }
107
112
  if (!config.thumbnails.settings) {
108
113
  config.thumbnails.settings = [];
@@ -126,7 +131,7 @@ function initThumbSettings(config) {
126
131
  switch (slide.thumbnails.strategy) {
127
132
  case 'append':
128
133
  slide.thumbnails.settings = config.thumbnails.settings.concat(slide.thumbnails.settings.map((sets) => {
129
- return { ...config.thumbnails.default, ...slide.thumbnails?.default ?? {}, ...sets };
134
+ return { ...config.thumbnails.default, ...sets }; // {...config.thumbnails!.default, ...slide.thumbnails?.default ?? {}, ...sets}
130
135
  }));
131
136
  break;
132
137
  case 'replace':
@@ -136,7 +141,7 @@ function initThumbSettings(config) {
136
141
  for (let i = 0; i < slide.thumbnails.settings.length; i++) {
137
142
  slide.thumbnails.settings[i] = {
138
143
  ...(config.thumbnails.settings[i] ?? config.thumbnails.default),
139
- ...(slide.thumbnails.default ?? {}),
144
+ // ...(slide.thumbnails.default ?? {}),
140
145
  ...slide.thumbnails.settings[i]
141
146
  };
142
147
  }
@@ -8,21 +8,31 @@ export interface IDimensions {
8
8
  }
9
9
 
10
10
  export interface IScreenshotSettings extends IDimensions {
11
- filename?: string | ThumbnailNameHandler;
12
- delay?: number;
11
+ path?: string;
13
12
  queryStringParams?: Record<string, boolean | number | string>;
13
+ delay?: number;
14
+ outFile?: string | ThumbnailNameHandler;
14
15
  outDir?: string | string[] | ThumbnailNameHandler;
15
16
  }
16
17
  export interface IThumbnailSettings {
17
- strategy?: 'append' | 'merge' | 'replace',
18
18
  default?: IScreenshotSettings;
19
19
  settings?: IScreenshotSettings[];
20
20
  }
21
+ export interface ISlideThumbnailSettings {
22
+ strategy?: 'append' | 'merge' | 'replace';
23
+ thumbFile?: IDimensions & {
24
+ filepath: string;
25
+ };
26
+ posterFile?: IDimensions & {
27
+ filepath: string;
28
+ };
29
+ settings?: IScreenshotSettings[];
30
+ }
21
31
 
22
32
  export interface IVeevaConfigSlide extends IVeevaClmSlide {
23
33
  path: string;
24
34
  enableActions?: Actions[];
25
- thumbnails?: IThumbnailSettings;
35
+ thumbnails?: ISlideThumbnailSettings;
26
36
  }
27
37
 
28
38
  export interface IVeevaConfigPresentation extends IVeevaClmPresentation {
@@ -37,7 +47,7 @@ export interface IVeevaConfigPresentation extends IVeevaClmPresentation {
37
47
  export interface IVeevaConfig {
38
48
  dimensions: { width: number, height: number };
39
49
  slideSettings?: IVeevaClmSlideSettings; // legacy support
40
- thumbnails?: Omit<IThumbnailSettings, 'strategy'>;
50
+ thumbnails?: IThumbnailSettings;
41
51
 
42
52
  presentation: IVeevaConfigPresentation & {
43
53
  name: string;
@@ -3,8 +3,8 @@ export type iOSResolution = "Default For Device" | "Scale To 1024x768" | "Scale
3
3
  export type Actions = "Swipe" | "Pinch to Exit" | "Zoom" | "Rotation Lock" | "History Buttons" | "Navigation Bar" | "Reactions";
4
4
  export type CrmTarget = 'Salesforce' | 'Vault';
5
5
 
6
- export interface VeevaIdField {
7
- id: string;
6
+ export interface VeevaIdField<T = string> {
7
+ id: T;
8
8
  }
9
9
  export interface VeevaCrmIdField<T = string> {
10
10
  crmId: T;
@@ -16,9 +16,9 @@ export interface VeevaExternalIdField {
16
16
  export interface IVeevaClmBinderFields {
17
17
  language?: 'English' & (string & {});
18
18
  crmTarget?: CrmTarget;
19
- crmOrg?: VeevaCrmIdField<string[]>;
19
+ crmOrg?: VeevaCrmIdField<string | string[]>;
20
20
  crmProduct?: VeevaIdField;
21
- crmContentGroup?: VeevaIdField | VeevaIdField[];
21
+ crmContentGroup?: VeevaIdField<string | string[]>;
22
22
  crmDetailGroup?: VeevaIdField;
23
23
  detailGroup?: string;
24
24
  expirationDate?: `${string}/${string}/${string}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inizioevoke/veeva-astroclm-core",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "",
package/postinstall.mjs CHANGED
@@ -4,7 +4,7 @@ import { fileURLToPath } from 'url';
4
4
 
5
5
  const __dirname = dirname(fileURLToPath(import.meta.url));
6
6
 
7
- // Resolve the consuming project's root (three levels up from node_modules/@inizioevoke/astro-core)
7
+ // Resolve the consuming project's root (three levels up from node_modules/@inizioevoke/veeva-astroclm-core)
8
8
  const projectRoot = join(__dirname, '..', '..', '..');
9
9
  const destDir = join(projectRoot, '.claude', 'skills');
10
10
  const src = join(__dirname, 'agents', 'claude');
@@ -16,7 +16,7 @@ export default function ({ veevaEnv = 'client', isTraining = false }: IVeevaConf
16
16
 
17
17
  const binderFields: IVeevaClmBinderFields = {
18
18
  // language: isEvokeBuild ? undefined : 'English',
19
- // crmOrg: isEvokeBuild ? undefined : { crmId: ['CRM_ORD_ID'] },
19
+ // crmOrg: isEvokeBuild ? undefined : { crmId: ['CRM_ORG_ID'] },
20
20
  // crmProduct: isEvokeBuild ? undefined : { id: 'VEEVA_ID_FROM_URL' },
21
21
  // crmDetailGroup: isEvokeBuild ? undefined : { id: 'VEEVA_ID_FROM_URL' },
22
22
  // detailGroup: undefined
@@ -58,6 +58,7 @@ export default async function({ root, config, env, csvOnly = false, serverPort =
58
58
  server: { host: server.host ?? 'localhost', port: server.port },
59
59
  config,
60
60
  deployDir,
61
+ root
61
62
  });
62
63
 
63
64
  await server.stop();
@@ -8,6 +8,7 @@ import type { IVeevaConfig } from "../types";
8
8
 
9
9
  interface Params {
10
10
  config: IVeevaConfig;
11
+ root: string;
11
12
  deployDir: string;
12
13
  server: {
13
14
  protocol?: 'http' | 'https';
@@ -16,7 +17,7 @@ interface Params {
16
17
  };
17
18
  }
18
19
 
19
- export default async function({ config, deployDir, server }: Params) {
20
+ export default async function({ config, root, deployDir, server }: Params) {
20
21
  logger.info('Generating thumbnails');
21
22
  initThumbSettings(config);
22
23
  await generateSharedThumb(config, deployDir);
@@ -32,9 +33,15 @@ export default async function({ config, deployDir, server }: Params) {
32
33
  });
33
34
 
34
35
  for (const slide of config.presentation.slides) {
36
+ if (slide.thumbnails?.thumbFile?.filepath) {
37
+ const filepath = join(root, slide.thumbnails.thumbFile.filepath);
38
+ }
39
+ if (slide.thumbnails?.posterFile?.filepath) {
40
+
41
+ }
35
42
  for (const settings of slide.thumbnails!.settings!) {
36
- logger.info(`Generating /${slide.path}/`);
37
- const url = `${server.protocol ?? 'http'}://${server.host}:${server.port}/${slide.path}/${settings.queryStringParams ? `?${objToQS(settings.queryStringParams)}` : ''}`
43
+ logger.info(`Generating /${settings.path ?? slide.path}/`);
44
+ const url = `${server.protocol ?? 'http'}://${server.host}:${server.port}/${settings.path ?? slide.path}/${settings.queryStringParams ? `?${objToQS(settings.queryStringParams)}` : ''}`
38
45
 
39
46
  try {
40
47
  await page.goto(url, {
@@ -62,7 +69,7 @@ export default async function({ config, deployDir, server }: Params) {
62
69
  })
63
70
  ).toBuffer();
64
71
 
65
- const fileName = typeof settings.filename == 'function' ? settings.filename(config, slide, settings) : settings.filename ?? 'thumb.png';
72
+ const fileName = typeof settings.outFile == 'function' ? settings.outFile(config, slide, settings) : settings.outFile ?? 'thumb.png';
66
73
  await writeFile(join(deployDir, slide.path, fileName), thumb);
67
74
  }
68
75
  }
@@ -72,7 +79,7 @@ export default async function({ config, deployDir, server }: Params) {
72
79
  }
73
80
 
74
81
  async function generateSharedThumb(config: IVeevaConfig, deployDir: string) {
75
- let settings = config.thumbnails?.settings?.find(s => s.filename === 'thumb.png');
82
+ let settings = config.thumbnails?.settings?.find(s => s.outFile === 'thumb.png');
76
83
  const width = settings?.width ?? 600;
77
84
  const height = settings?.height ?? width / 4 * 3;
78
85
  const svgImage = `
@@ -125,8 +132,8 @@ function initThumbSettings(config: IVeevaConfig) {
125
132
  if (!config.thumbnails.default.height) {
126
133
  config.thumbnails.default.height = config.thumbnails.default.width / 4 * 3;
127
134
  }
128
- if (!config.thumbnails.default.filename) {
129
- config.thumbnails.default.filename = 'thumb.png';
135
+ if (!config.thumbnails.default.outFile) {
136
+ config.thumbnails.default.outFile = 'thumb.png';
130
137
  }
131
138
  if (!config.thumbnails.settings) {
132
139
  config.thumbnails.settings = [];
@@ -150,7 +157,7 @@ function initThumbSettings(config: IVeevaConfig) {
150
157
  case 'append':
151
158
  slide.thumbnails.settings = config.thumbnails.settings.concat(
152
159
  slide.thumbnails.settings.map((sets) => {
153
- return {...config.thumbnails!.default, ...slide.thumbnails?.default ?? {}, ...sets}
160
+ return {...config.thumbnails!.default, ...sets}; // {...config.thumbnails!.default, ...slide.thumbnails?.default ?? {}, ...sets}
154
161
  })
155
162
  );
156
163
  break;
@@ -161,7 +168,7 @@ function initThumbSettings(config: IVeevaConfig) {
161
168
  for (let i=0; i<slide.thumbnails.settings.length; i++) {
162
169
  slide.thumbnails.settings[i] = {
163
170
  ...(config.thumbnails.settings[i] ?? config.thumbnails.default),
164
- ...(slide.thumbnails.default ?? {}),
171
+ // ...(slide.thumbnails.default ?? {}),
165
172
  ...slide.thumbnails.settings[i]
166
173
  };
167
174
  }
@@ -8,21 +8,31 @@ export interface IDimensions {
8
8
  }
9
9
 
10
10
  export interface IScreenshotSettings extends IDimensions {
11
- filename?: string | ThumbnailNameHandler;
12
- delay?: number;
11
+ path?: string;
13
12
  queryStringParams?: Record<string, boolean | number | string>;
13
+ delay?: number;
14
+ outFile?: string | ThumbnailNameHandler;
14
15
  outDir?: string | string[] | ThumbnailNameHandler;
15
16
  }
16
17
  export interface IThumbnailSettings {
17
- strategy?: 'append' | 'merge' | 'replace',
18
18
  default?: IScreenshotSettings;
19
19
  settings?: IScreenshotSettings[];
20
20
  }
21
+ export interface ISlideThumbnailSettings {
22
+ strategy?: 'append' | 'merge' | 'replace';
23
+ thumbFile?: IDimensions & {
24
+ filepath: string;
25
+ };
26
+ posterFile?: IDimensions & {
27
+ filepath: string;
28
+ };
29
+ settings?: IScreenshotSettings[];
30
+ }
21
31
 
22
32
  export interface IVeevaConfigSlide extends IVeevaClmSlide {
23
33
  path: string;
24
34
  enableActions?: Actions[];
25
- thumbnails?: IThumbnailSettings;
35
+ thumbnails?: ISlideThumbnailSettings;
26
36
  }
27
37
 
28
38
  export interface IVeevaConfigPresentation extends IVeevaClmPresentation {
@@ -37,7 +47,7 @@ export interface IVeevaConfigPresentation extends IVeevaClmPresentation {
37
47
  export interface IVeevaConfig {
38
48
  dimensions: { width: number, height: number };
39
49
  slideSettings?: IVeevaClmSlideSettings; // legacy support
40
- thumbnails?: Omit<IThumbnailSettings, 'strategy'>;
50
+ thumbnails?: IThumbnailSettings;
41
51
 
42
52
  presentation: IVeevaConfigPresentation & {
43
53
  name: string;
@@ -3,8 +3,8 @@ export type iOSResolution = "Default For Device" | "Scale To 1024x768" | "Scale
3
3
  export type Actions = "Swipe" | "Pinch to Exit" | "Zoom" | "Rotation Lock" | "History Buttons" | "Navigation Bar" | "Reactions";
4
4
  export type CrmTarget = 'Salesforce' | 'Vault';
5
5
 
6
- export interface VeevaIdField {
7
- id: string;
6
+ export interface VeevaIdField<T = string> {
7
+ id: T;
8
8
  }
9
9
  export interface VeevaCrmIdField<T = string> {
10
10
  crmId: T;
@@ -16,9 +16,9 @@ export interface VeevaExternalIdField {
16
16
  export interface IVeevaClmBinderFields {
17
17
  language?: 'English' & (string & {});
18
18
  crmTarget?: CrmTarget;
19
- crmOrg?: VeevaCrmIdField<string[]>;
19
+ crmOrg?: VeevaCrmIdField<string | string[]>;
20
20
  crmProduct?: VeevaIdField;
21
- crmContentGroup?: VeevaIdField | VeevaIdField[];
21
+ crmContentGroup?: VeevaIdField<string | string[]>;
22
22
  crmDetailGroup?: VeevaIdField;
23
23
  detailGroup?: string;
24
24
  expirationDate?: `${string}/${string}/${string}`;