@json-to-office/jto 0.5.3 → 0.7.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.
Files changed (24) hide show
  1. package/dist/cli.js +34 -10
  2. package/dist/cli.js.map +1 -1
  3. package/dist/client/assets/{HomePage-DJlT2M9Q.js → HomePage-5f3HNqyO.js} +3 -3
  4. package/dist/client/assets/{HomePage-DJlT2M9Q.js.map → HomePage-5f3HNqyO.js.map} +1 -1
  5. package/dist/client/assets/{JsonEditorPage-CUlhCM3Z.js → JsonEditorPage-C-MqODVJ.js} +3 -3
  6. package/dist/client/assets/{JsonEditorPage-CUlhCM3Z.js.map → JsonEditorPage-C-MqODVJ.js.map} +1 -1
  7. package/dist/client/assets/{MonacoPluginProvider-BT8Rmjt0.js → MonacoPluginProvider-DGH9IJWW.js} +3 -3
  8. package/dist/client/assets/{MonacoPluginProvider-BT8Rmjt0.js.map → MonacoPluginProvider-DGH9IJWW.js.map} +1 -1
  9. package/dist/client/assets/{button-DMYqGwZJ.js → button-6lzkhC2g.js} +2 -2
  10. package/dist/client/assets/{button-DMYqGwZJ.js.map → button-6lzkhC2g.js.map} +1 -1
  11. package/dist/client/assets/{editor-Cjfikke2.js → editor-BW0GiZPm.js} +2 -2
  12. package/dist/client/assets/{editor-Cjfikke2.js.map → editor-BW0GiZPm.js.map} +1 -1
  13. package/dist/client/assets/{editor-monaco-json-CmHmtw8m.js → editor-monaco-json-15fGSTnt.js} +2 -2
  14. package/dist/client/assets/{editor-monaco-json-CmHmtw8m.js.map → editor-monaco-json-15fGSTnt.js.map} +1 -1
  15. package/dist/client/assets/index-DcPXTvEZ.js +3 -0
  16. package/dist/client/assets/index-DcPXTvEZ.js.map +1 -0
  17. package/dist/client/assets/{preview-CqOfvXmU.js → preview-DqEl98dA.js} +2 -2
  18. package/dist/client/assets/{preview-CqOfvXmU.js.map → preview-DqEl98dA.js.map} +1 -1
  19. package/dist/client/index.html +1 -1
  20. package/dist/index.js +33 -9
  21. package/dist/index.js.map +1 -1
  22. package/package.json +6 -6
  23. package/dist/client/assets/index-CyWrP8_G.js +0 -3
  24. package/dist/client/assets/index-CyWrP8_G.js.map +0 -1
package/dist/cli.js CHANGED
@@ -3405,6 +3405,18 @@ import chalk9 from "chalk";
3405
3405
  init_esm_shims();
3406
3406
  import * as path2 from "path";
3407
3407
  import * as fs from "fs";
3408
+ function buildServicesFromEnv() {
3409
+ const serverUrl = process.env.HIGHCHARTS_SERVER_URL;
3410
+ const apiKey = process.env.HIGHCHARTS_API_KEY;
3411
+ const apiKeyHeader = process.env.HIGHCHARTS_API_KEY_HEADER ?? "x-api-key";
3412
+ if (!serverUrl && !apiKey) return void 0;
3413
+ return {
3414
+ highcharts: {
3415
+ serverUrl,
3416
+ ...apiKey && { headers: { [apiKeyHeader]: apiKey } }
3417
+ }
3418
+ };
3419
+ }
3408
3420
  var DocxFormatAdapter = class {
3409
3421
  name = "docx";
3410
3422
  extension = ".docx";
@@ -3414,21 +3426,25 @@ var DocxFormatAdapter = class {
3414
3426
  const core = await import("@json-to-office/core-docx");
3415
3427
  const docDefinition = typeof json === "string" ? JSON.parse(json) : json;
3416
3428
  const customThemes = await this.loadCustomThemes(options);
3429
+ const services = buildServicesFromEnv();
3417
3430
  return await core.generateBufferFromJson(docDefinition, {
3418
- customThemes
3431
+ customThemes,
3432
+ services
3419
3433
  });
3420
3434
  }
3421
3435
  async createGenerator(plugins, options) {
3422
3436
  const core = await import("@json-to-office/core-docx");
3423
3437
  const hasPlugins = plugins.length > 0;
3424
3438
  const pluginNames = plugins.map((p) => p.name);
3439
+ const services = buildServicesFromEnv();
3425
3440
  if (!hasPlugins) {
3426
3441
  return {
3427
3442
  generateBuffer: async (document) => {
3428
3443
  const docDefinition = typeof document === "string" ? JSON.parse(document) : document;
3429
3444
  const customThemes2 = await this.loadCustomThemes(options);
3430
3445
  return await core.generateBufferFromJson(docDefinition, {
3431
- customThemes: customThemes2
3446
+ customThemes: customThemes2,
3447
+ services
3432
3448
  });
3433
3449
  },
3434
3450
  hasPlugins: false,
@@ -3440,7 +3456,8 @@ var DocxFormatAdapter = class {
3440
3456
  let generator = core.createDocumentGenerator({
3441
3457
  theme,
3442
3458
  customThemes,
3443
- debug: process.env.DEBUG === "true"
3459
+ debug: process.env.DEBUG === "true",
3460
+ services
3444
3461
  });
3445
3462
  for (const plugin of plugins) {
3446
3463
  generator = generator.addComponent(plugin);
@@ -3625,21 +3642,25 @@ var PptxFormatAdapter = class {
3625
3642
  const core = await import("@json-to-office/core-pptx");
3626
3643
  const docDefinition = typeof json === "string" ? JSON.parse(json) : json;
3627
3644
  const customThemes = await this.loadCustomThemes(options);
3645
+ const services = buildServicesFromEnv();
3628
3646
  return await core.generateBufferFromJson(docDefinition, {
3629
- customThemes
3647
+ customThemes,
3648
+ services
3630
3649
  });
3631
3650
  }
3632
3651
  async createGenerator(plugins, options) {
3633
3652
  const core = await import("@json-to-office/core-pptx");
3634
3653
  const hasPlugins = plugins.length > 0;
3635
3654
  const pluginNames = plugins.map((p) => p.name);
3655
+ const services = buildServicesFromEnv();
3636
3656
  if (!hasPlugins) {
3637
3657
  return {
3638
3658
  generateBuffer: async (document) => {
3639
3659
  const docDefinition = typeof document === "string" ? JSON.parse(document) : document;
3640
3660
  const customThemes2 = await this.loadCustomThemes(options);
3641
3661
  return await core.generateBufferFromJson(docDefinition, {
3642
- customThemes: customThemes2
3662
+ customThemes: customThemes2,
3663
+ services
3643
3664
  });
3644
3665
  },
3645
3666
  hasPlugins: false,
@@ -3651,7 +3672,8 @@ var PptxFormatAdapter = class {
3651
3672
  let generator = core.createPresentationGenerator({
3652
3673
  theme,
3653
3674
  customThemes,
3654
- debug: process.env.DEBUG === "true"
3675
+ debug: process.env.DEBUG === "true",
3676
+ services
3655
3677
  });
3656
3678
  for (const plugin of plugins) {
3657
3679
  generator = generator.addComponent(plugin);
@@ -4914,7 +4936,11 @@ var SchemaGenerator = class {
4914
4936
  paths.push(outputPath);
4915
4937
  } else {
4916
4938
  const outputPath = path11.join(componentsDir, `${type}.schema.ts`);
4917
- await this.typeboxExporter.exportComponentSchema(type, schema, outputPath);
4939
+ await this.typeboxExporter.exportComponentSchema(
4940
+ type,
4941
+ schema,
4942
+ outputPath
4943
+ );
4918
4944
  paths.push(outputPath);
4919
4945
  }
4920
4946
  }
@@ -4959,8 +4985,6 @@ var SchemaGenerator = class {
4959
4985
  image: shared.ImagePropsSchema,
4960
4986
  statistic: shared.StatisticPropsSchema,
4961
4987
  table: shared.TablePropsSchema,
4962
- header: shared.HeaderPropsSchema,
4963
- footer: shared.FooterPropsSchema,
4964
4988
  list: shared.ListPropsSchema
4965
4989
  };
4966
4990
  } else {
@@ -5854,7 +5878,7 @@ ${chalk8.cyan("Health:")} ${url}/health
5854
5878
  }
5855
5879
 
5856
5880
  // src/cli.ts
5857
- var PACKAGE_VERSION = true ? "0.5.3" : "dev-mode";
5881
+ var PACKAGE_VERSION = true ? "0.7.0" : "dev-mode";
5858
5882
  function registerFormatCommands(parent, adapter) {
5859
5883
  parent.addCommand(createGenerateCommand(adapter));
5860
5884
  parent.addCommand(createValidateCommand(adapter));