pict-section-form 1.0.143 → 1.0.145

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 (28) hide show
  1. package/.config/code-server/config.yaml +4 -0
  2. package/.vscode/settings.json +1 -1
  3. package/Dockerfile_LUXURYCode +31 -0
  4. package/debug/BuildHarnessTestApp.sh +1 -0
  5. package/debug/Harness.js +3 -2
  6. package/debug/PICTSection-TabularManifests.json +65 -22
  7. package/debug/Step-4-ConvertToCSV.js +3 -0
  8. package/debug/TabularManifestCSV.csv +9 -9
  9. package/debug/data/DefaultFormManifest.json +65 -22
  10. package/debug/data/MathExampleForm-Reconstituted.csv +69 -0
  11. package/debug/data/MathExampleForm.json +65 -22
  12. package/package.json +7 -4
  13. package/source/Pict-Section-Form.js +1 -0
  14. package/source/global.d.ts +8 -0
  15. package/source/services/ManifestConversionToCSV.js +653 -0
  16. package/source/services/ManifestFactory.js +24 -1
  17. package/source/views/Pict-View-Form-Metacontroller.js +3 -0
  18. package/source/views/support/Pict-View-PSF-Solver-Visualization.js +2 -1
  19. package/types/source/Pict-Section-Form.d.ts +1 -0
  20. package/types/source/providers/inputs/Pict-Provider-Input-Chart.d.ts +1 -0
  21. package/types/source/providers/inputs/Pict-Provider-Input-Chart.d.ts.map +1 -1
  22. package/types/source/services/ManifestConversionToCSV.d.ts +17 -0
  23. package/types/source/services/ManifestConversionToCSV.d.ts.map +1 -0
  24. package/types/source/services/ManifestFactory.d.ts.map +1 -1
  25. package/types/source/views/Pict-View-Form-Metacontroller.d.ts.map +1 -1
  26. package/types/source/views/support/Pict-View-PSF-Solver-Visualization.d.ts.map +1 -1
  27. package/utility/csvparser/ParseCSV-Program.js +2 -1
  28. package/utility/csvparser/ParseJSON-Command-GenerateCSV.js +116 -0
@@ -369,6 +369,21 @@ class ManifestFactory extends libFableServiceProviderBase
369
369
  tmpDescriptor.PictForm.SpreadsheetNotes = tmpRecord['Input Notes'];
370
370
  }
371
371
 
372
+ if (tmpRecord['Description'])
373
+ {
374
+ tmpDescriptor.Description = tmpRecord['Description'];
375
+ }
376
+
377
+ if (tmpRecord['Units'])
378
+ {
379
+ tmpDescriptor.PictForm.Units = tmpRecord['Units'];
380
+ }
381
+
382
+ if (tmpRecord['Tooltip'])
383
+ {
384
+ tmpDescriptor.PictForm.Tooltip = tmpRecord['Tooltip'];
385
+ }
386
+
372
387
  if ((tmpDescriptor.PictForm.InputType == 'Option') && (tmpRecord['Input Extra']))
373
388
  {
374
389
  let tmpOptionSet = [];
@@ -666,6 +681,14 @@ class ManifestFactory extends libFableServiceProviderBase
666
681
 
667
682
  if (tmpRecord.DataOnly && tmpDescriptor.PictForm)
668
683
  {
684
+ if (tmpDescriptor.PictForm.Group)
685
+ {
686
+ tmpDescriptor.FormGroup = tmpDescriptor.PictForm.Group;
687
+ }
688
+ if (tmpDescriptor.PictForm.Section)
689
+ {
690
+ tmpDescriptor.FormSection = tmpDescriptor.PictForm.Section;
691
+ }
669
692
  delete tmpDescriptor.PictForm;
670
693
  }
671
694
 
@@ -778,7 +801,7 @@ class ManifestFactory extends libFableServiceProviderBase
778
801
  // Check if there is a Form Name to be set
779
802
  if (tmpRecord['Form Name'])
780
803
  {
781
- tmpManifest.FormName = tmpRecord['Form Name'];
804
+ tmpManifest.manifest.FormName = tmpRecord['Form Name'];
782
805
  }
783
806
  if (tmpRecord['Input Hash'])
784
807
  {
@@ -280,9 +280,11 @@ class PictFormMetacontroller extends libPictViewClass
280
280
  const tmpManifest = JSON.parse(JSON.stringify(pManifest));
281
281
  for (const tmpSection of tmpManifest.Sections || [])
282
282
  {
283
+ tmpSection.OriginalHash = tmpSection.Hash;
283
284
  tmpSection.Hash = `${tmpSection.Hash}_${tmpUUID}`;
284
285
  for (const tmpGroup of tmpSection.Groups || [])
285
286
  {
287
+ tmpGroup.OriginalHash = tmpGroup.Hash;
286
288
  tmpGroup.Hash = `${tmpGroup.Hash}_${tmpUUID}`;
287
289
  }
288
290
  }
@@ -293,6 +295,7 @@ class PictFormMetacontroller extends libPictViewClass
293
295
  tmpDescriptor.DataAddress = `${tmpDescriptor.DataAddress || tmpKey}_${tmpUUID}`;
294
296
  if (tmpDescriptor.Hash)
295
297
  {
298
+ tmpDescriptor.OriginalHash = tmpDescriptor.Hash;
296
299
  tmpDescriptor.Hash = `${tmpDescriptor.Hash}_${tmpUUID}`;
297
300
  }
298
301
  if (tmpDescriptor.PictForm)
@@ -75,7 +75,7 @@ const defaultViewConfiguration = (
75
75
  Hash: "Pict-Form-RecordValueDisplayComplex",
76
76
  Template: /*html*/`
77
77
  <!-- Complex Value -->
78
- {~TBT:Record.Value:array:Pict-Form-RecordValueDisplayObject:Record:Pict-Form-RecordValueDisplayArray~}
78
+ {~TBT:Record.Value:array:Pict-Form-RecordValueDisplayArray:Record:Pict-Form-RecordValueDisplayObject~}
79
79
  `
80
80
  },
81
81
  {
@@ -88,6 +88,7 @@ const defaultViewConfiguration = (
88
88
  {
89
89
  Hash: "Pict-Form-RecordValueDisplayArray",
90
90
  Template: /*html*/`JSON Array ({~D:Record.Value.length~} items)
91
+ {~Breakpoint~}
91
92
  <!-- RAW Array
92
93
  {~DJ:Record.Value~}
93
94
  -->`
@@ -8,6 +8,7 @@ declare const _exports: {
8
8
  PictFormApplication: typeof import("./application/Pict-Application-Form.js");
9
9
  PictDynamicLayoutProvider: typeof import("./providers/Pict-Provider-DynamicLayout.js");
10
10
  ManifestFactory: typeof import("./services/ManifestFactory.js");
11
+ ManifestConversionToCSV: typeof import("./services/ManifestConversionToCSV.js");
11
12
  ExtensionViews: {
12
13
  LifecycleVisualization: typeof import("./views/support/Pict-View-PSF-LifeCycle-Visualization.js");
13
14
  DebugViewer: typeof import("./views/support/Pict-View-PSF-DebugViewer.js");
@@ -16,6 +16,7 @@ declare class CustomInputHandler extends libPictSectionInputExtension {
16
16
  defaultLabelParsingConfiguration: any;
17
17
  defaultDataParsingConfiguration: any;
18
18
  currentChartObjects: {};
19
+ currentChartDataObjects: {};
19
20
  /**
20
21
  *
21
22
  * @param {Object} pInput - The PictForm input object
@@ -1 +1 @@
1
- {"version":3,"file":"Pict-Provider-Input-Chart.d.ts","sourceRoot":"","sources":["../../../../source/providers/inputs/Pict-Provider-Input-Chart.js"],"names":[],"mappings":";AAEA;;;;;;GAMG;AACH;IAEC,2DAgHC;IA5GA,6BAA6B;IAC7B,MADW,OAAO,MAAM,CAAC,CAChB;IACT,6BAA6B;IAC7B,OADW,OAAO,MAAM,CAAC,CACf;IAoCV,qCAA+G;IAiC/G,sCAAiH;IAiCjH,qCAA+G;IAE/G,wBAA6B;IAG9B;;;;;;;OAOG;IACH,iEALW,GAAC,yBACD,GAAC,mCACD,GAAC,WA0ZX;IAED,sEAwBC;IAED,wHAyBC;IAoBD;;;;;;;;;;;OAWG;IACH,uEANW,GAAG,iBACH,MAAM,aACN,MAAM,oBACN,MAAM,GACJ,GAAG,CAKf;IAED;;;;;;;;;OASG;IACH,8CALW,GAAG,iBACH,MAAM,oBACN,MAAM,GACJ,GAAG,CAKf;IAED;;;;;;;;;;OAUG;IACH,qDANW,GAAG,iBACH,MAAM,aACN,MAAM,oBACN,MAAM,GACJ,GAAG,CAKf;IAED;;;;;;;;;;;OAWG;IACH,6EALW,GAAG,iBACH,MAAM,oBACN,MAAM,GACJ,OAAO,CAKnB;IAED;;;;;;;;;;;OAWG;IACH,yEANW,GAAG,iBACH,MAAM,aACN,MAAM,oBACN,MAAM,GACJ,GAAG,CAKf;IAED;;;;;;;;OAQG;IACH,+CAJW,GAAG,iBACH,MAAM,GACJ,GAAG,CAKf;IAED;;;;;;;;;OASG;IACH,sDALW,GAAG,iBACH,MAAM,aACN,MAAM,GACJ,GAAG,CAKf;CACD"}
1
+ {"version":3,"file":"Pict-Provider-Input-Chart.d.ts","sourceRoot":"","sources":["../../../../source/providers/inputs/Pict-Provider-Input-Chart.js"],"names":[],"mappings":";AAEA;;;;;;GAMG;AACH;IAEC,2DAiHC;IA7GA,6BAA6B;IAC7B,MADW,OAAO,MAAM,CAAC,CAChB;IACT,6BAA6B;IAC7B,OADW,OAAO,MAAM,CAAC,CACf;IAoCV,qCAA+G;IAiC/G,sCAAiH;IAiCjH,qCAA+G;IAE/G,wBAA6B;IAC7B,4BAAiC;IAGlC;;;;;;;OAOG;IACH,iEALW,GAAC,yBACD,GAAC,mCACD,GAAC,WA0ZX;IAED,sEAwBC;IAED,wHA2BC;IAoBD;;;;;;;;;;;OAWG;IACH,uEANW,GAAG,iBACH,MAAM,aACN,MAAM,oBACN,MAAM,GACJ,GAAG,CAKf;IAED;;;;;;;;;OASG;IACH,8CALW,GAAG,iBACH,MAAM,oBACN,MAAM,GACJ,GAAG,CAKf;IAED;;;;;;;;;;OAUG;IACH,qDANW,GAAG,iBACH,MAAM,aACN,MAAM,oBACN,MAAM,GACJ,GAAG,CAKf;IAED;;;;;;;;;;;OAWG;IACH,6EALW,GAAG,iBACH,MAAM,oBACN,MAAM,GACJ,OAAO,CAoBnB;IAED;;;;;;;;;;;OAWG;IACH,yEANW,GAAG,iBACH,MAAM,aACN,MAAM,oBACN,MAAM,GACJ,GAAG,CAKf;IAED;;;;;;;;OAQG;IACH,+CAJW,GAAG,iBACH,MAAM,GACJ,GAAG,CAKf;IAED;;;;;;;;;OASG;IACH,sDALW,GAAG,iBACH,MAAM,aACN,MAAM,GACJ,GAAG,CAKf;CACD"}
@@ -0,0 +1,17 @@
1
+ export = ManifestConversionToCSV;
2
+ declare class ManifestConversionToCSV {
3
+ constructor(pFable: any, pOptions: any, pServiceHash: any);
4
+ /** @type {import('pict') & { instantiateServiceProviderWithoutRegistration: (hash: string, options?: any, uuid?: string) => any }} */
5
+ fable: import("pict") & {
6
+ instantiateServiceProviderWithoutRegistration: (hash: string, options?: any, uuid?: string) => any;
7
+ };
8
+ /** @type {any} */
9
+ log: any;
10
+ /** @type {string} */
11
+ UUID: string;
12
+ CSV_HEADER: string[];
13
+ CSV_COLUMN_MAP: {};
14
+ getRowFromDescriptor(pForm: any, pDescriptorKey: any, pDescriptor: any): false | any[];
15
+ createTabularArrayFromManifests(pManifest: any): any[][];
16
+ }
17
+ //# sourceMappingURL=ManifestConversionToCSV.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ManifestConversionToCSV.d.ts","sourceRoot":"","sources":["../../../source/services/ManifestConversionToCSV.js"],"names":[],"mappings":";AAEA;IAEI,2DAgEC;IA5DG,sIAAsI;IACtI,OADW,OAAO,MAAM,CAAC,GAAG;QAAE,6CAA6C,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,GAAG,CAAA;KAAE,CACxH;IACV,kBAAkB;IAClB,KADW,GAAG,CACN;IACR,qBAAqB;IACrB,MADW,MAAM,CACR;IAET,qBA4CC;IAGD,mBAAwB;IAQ5B,uFA2JC;IAED,yDAsaC;CACJ"}
@@ -1 +1 @@
1
- {"version":3,"file":"ManifestFactory.d.ts","sourceRoot":"","sources":["../../../source/services/ManifestFactory.js"],"names":[],"mappings":";AAOA;IAEC,2DA4CC;IAtCA,sIAAsI;IACtI,OADW,OAAO,MAAM,CAAC,GAAG;QAAE,6CAA6C,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,GAAG,CAAA;KAAE,CACxH;IACV,kBAAkB;IAClB,KADW,GAAG,CACN;IACR,qBAAqB;IACrB,MADW,MAAM,CACR;IAET,cAAmC;IAcnC,+BAAoC;IAEpC,sBAA2B;IAC3B,oBAAyB;IASzB,2BAA2B;IAE3B,gCAAgD;IAChD,sCAAwC;IACxC,kCAA0C;IAG3C;;;;;OAKG;IACH,2BAHW,MAAM,GACL,MAAM,CASjB;IAED;;;;;;;;;OASG;IACH,uCAwJC;IAED;;;;OAIG;IACH,8CAOC;IAED;;;;;;OAMG;IACH,iCAJW,MAAM,OAiBhB;IAED;;;;;;;OAOG;IACH,mCALW,MAAM,MAAO,cACb,MAAM,OAkBhB;IAED;;;;OAIG;IACH,8BAFa,OAAO,CAenB;IAED;;;;;;;OAOG;IACH,kEA6UC;IAED;;;;;;;;;OASG;IACH,2GAGC;IAED;;;;;;OAMG;IACH,0CAJW,GAAG,GAEF,GAAG,CAwDd;CACD;;+BAGU,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC"}
1
+ {"version":3,"file":"ManifestFactory.d.ts","sourceRoot":"","sources":["../../../source/services/ManifestFactory.js"],"names":[],"mappings":";AAOA;IAEC,2DA4CC;IAtCA,sIAAsI;IACtI,OADW,OAAO,MAAM,CAAC,GAAG;QAAE,6CAA6C,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,GAAG,CAAA;KAAE,CACxH;IACV,kBAAkB;IAClB,KADW,GAAG,CACN;IACR,qBAAqB;IACrB,MADW,MAAM,CACR;IAET,cAAmC;IAcnC,+BAAoC;IAEpC,sBAA2B;IAC3B,oBAAyB;IASzB,2BAA2B;IAE3B,gCAAgD;IAChD,sCAAwC;IACxC,kCAA0C;IAG3C;;;;;OAKG;IACH,2BAHW,MAAM,GACL,MAAM,CASjB;IAED;;;;;;;;;OASG;IACH,uCAwJC;IAED;;;;OAIG;IACH,8CAOC;IAED;;;;;;OAMG;IACH,iCAJW,MAAM,OAiBhB;IAED;;;;;;;OAOG;IACH,mCALW,MAAM,MAAO,cACb,MAAM,OAkBhB;IAED;;;;OAIG;IACH,8BAFa,OAAO,CAenB;IAED;;;;;;;OAOG;IACH,kEAoaC;IAED;;;;;;;;;OASG;IACH,2GAGC;IAED;;;;;;OAMG;IACH,0CAJW,GAAG,GAEF,GAAG,CAwDd;CACD;;+BAGU,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Pict-View-Form-Metacontroller.d.ts","sourceRoot":"","sources":["../../../source/views/Pict-View-Form-Metacontroller.js"],"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;OAKG;IACH,8EAFW,YAAY,QAmBtB;IAED;;;;;;OAMG;IACH,oEAHW,YAAY,GACV,IAAI,CAkDhB;IAED;;;;;;;OAOG;IACH,uEAJW,YAAY,GAEX,IAAI,CAsFf;IAED;;;;;OAKG;IACH,qCAHW,MAAM,GACJ,MAAM,GAAC,OAAO,CA2C1B;IAED,+CAeC;IAED;;;;;;;OAOG;IACH,kFAJW,MAAM,GAEJ,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAoLtC;IA5JC,gCAA0D;IAC1D,yBAAiD;IA6JnD;;;;OAIG;IACH,gCAHW,MAAM,qBACN,MAAM,QA0BhB;IAED;;;OAGG;IACH,yDAHW,MAAM,uBACN,MAAM,QAKhB;IAED;;;;;OAKG;IACH,yDALW,MAAM,uBACN,MAAM,GAEL,OAAO,CAoDlB;IAED;;;;OAIG;IACH,sCAJW,MAAM,GAEL,OAAO,CA0ClB;IAED;;;OAGG;IACH,wDAHW,MAAM,6BAuBhB;IAED,oCAgBC;IAED;;;;OAIG;IACH,4BAFa,OAAO,CAKnB;CACD;;;;;qCAGU,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;oBAtpCjB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,MAAM"}
1
+ {"version":3,"file":"Pict-View-Form-Metacontroller.d.ts","sourceRoot":"","sources":["../../../source/views/Pict-View-Form-Metacontroller.js"],"names":[],"mappings":";AAaA;;GAEG;AAEH;;;;;;GAMG;AACH;IAEC,2DAsBC;IAdA,yBAA2B;IAE3B,wBAAsF;IAEtF,cAAkC;IAElC;;;;;;MAOE;IAQH,wCAGC;IARD,kCAGC;IAOD;;;;OAIG;IACH,qBAFa,GAAG,CAaf;IAED;;;;OAIG;IACH,mBAFa,GAAG,CAaf;IAED,yCAYC;IAED;;;;;OAKG;IACH,kCAHW,aAAa,GACX,IAAI,CAsBhB;IAwBD;;;;OAIG;IACH,WAFa,GAAG,CAMf;IAED,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A0D;IAC1D,yBAAiD;IA6JnD;;;;OAIG;IACH,gCAHW,MAAM,qBACN,MAAM,QA0BhB;IAED;;;OAGG;IACH,yDAHW,MAAM,uBACN,MAAM,QAKhB;IAED;;;;;OAKG;IACH,yDALW,MAAM,uBACN,MAAM,GAEL,OAAO,CAoDlB;IAED;;;;OAIG;IACH,sCAJW,MAAM,GAEL,OAAO,CA0ClB;IAED;;;OAGG;IACH,wDAHW,MAAM,6BAuBhB;IAED,oCAgBC;IAED;;;;OAIG;IACH,4BAFa,OAAO,CAKnB;CACD;;;;;qCAGU,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;oBAzpCjB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,MAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"Pict-View-PSF-Solver-Visualization.d.ts","sourceRoot":"","sources":["../../../../source/views/support/Pict-View-PSF-Solver-Visualization.js"],"names":[],"mappings":";AAsJA;CASC"}
1
+ {"version":3,"file":"Pict-View-PSF-Solver-Visualization.d.ts","sourceRoot":"","sources":["../../../../source/views/support/Pict-View-PSF-Solver-Visualization.js"],"names":[],"mappings":";AAuJA;CASC"}
@@ -22,7 +22,8 @@ let _Program = new libPictCommandLineUtility(_ProgramConfiguration,
22
22
  [
23
23
  require('./ParseCSV-Command-Inject.js'),
24
24
  require('./ParseCSV-Command-Parse.js'),
25
- require('./ParseCSV-Command-BuildDistilling.js')
25
+ require('./ParseCSV-Command-BuildDistilling.js'),
26
+ require('./ParseJSON-Command-GenerateCSV.js')
26
27
  ]);
27
28
  _Program.LogNoisiness = 4;
28
29
 
@@ -0,0 +1,116 @@
1
+
2
+ let libPictCommandLineUtility = require('pict-service-commandlineutility');
3
+
4
+ let libPictManifestConversionToCSV = require('../../source/services/ManifestConversionToCSV.js');
5
+
6
+ const libFS = require('fs');
7
+ const libPath = require('path');
8
+
9
+ class ImportCSVCommand extends libPictCommandLineUtility.ServiceCommandLineCommand
10
+ {
11
+ constructor(pFable, pSettings, pServiceHash)
12
+ {
13
+ super(pFable, pSettings, pServiceHash);
14
+
15
+ this.options.CommandKeyword = 'converttocsv';
16
+ this.options.Description = 'Convert a manifest to a CSV file.';
17
+
18
+ this.options.CommandArguments.push({ Name: '<json_manifest_file>', Description: 'The manifest file to convert to a CSV.' });
19
+
20
+ this.options.CommandOptions.push({ Name: '-o, --output [filename]', Description: 'The output file to write the csv to; defaults to the [Scope.csv]'});
21
+ this.options.CommandOptions.push({ Name: '-d, --directory [directory]', Description: 'The directory to output the manifest and other export files to.', Default: './data/'});
22
+
23
+ this.addCommand();
24
+ }
25
+
26
+ onRunAsync(fCallback)
27
+ {
28
+ let tmpManifestFileName = this.ArgumentString;
29
+
30
+ if ((!tmpManifestFileName) || (typeof(tmpManifestFileName) != 'string') || (tmpManifestFileName.length === 0))
31
+ {
32
+ this.log.error('No valid manifest filename provided.');
33
+ return fCallback();
34
+ }
35
+
36
+ // Do some input file housekeeping
37
+ let tmpManifestFilePath = libPath.resolve(tmpManifestFileName);
38
+ if (!this.fable.FilePersistence.existsSync(tmpManifestFilePath))
39
+ {
40
+ this.fable.log.error(`File [${tmpManifestFilePath}] does not exist. Checking in the current working directory...`);
41
+ tmpManifestFilePath = libPath.join(process.cwd(), tmpManifestFileName);
42
+ if (!this.fable.FilePersistence.existsSync(tmpManifestFilePath))
43
+ {
44
+ this.fable.log.error(`File [${tmpManifestFilePath}] does not exist in the current working directory. Could not parse input manifest file. Aborting.`);
45
+ return fCallback();
46
+ }
47
+ }
48
+
49
+ let tmpManifestData = this.fable.FilePersistence.readFileSync(tmpManifestFilePath, { encoding: 'utf8' });
50
+ let tmpManifest = null;
51
+ try
52
+ {
53
+ tmpManifest = JSON.parse(tmpManifestData);
54
+ }
55
+ catch(pError)
56
+ {
57
+ this.fable.log.error(`Could not parse manifest file [${tmpManifestFilePath}] as JSON. Aborting.`);
58
+ return fCallback();
59
+ }
60
+
61
+ // Load the manifest to CSV conversion service
62
+ this.fable.addAndInstantiateServiceType('ManifestConversionToCSV', libPictManifestConversionToCSV);
63
+
64
+ let tmpCSVDataArray = this.fable.ManifestConversionToCSV.createTabularArrayFromManifests(tmpManifest);
65
+
66
+ // Determine output file name
67
+ let tmpOutputFileName = this.CommandOptions.output;
68
+ if ((!tmpOutputFileName) || (typeof(tmpOutputFileName) != 'string') || (tmpOutputFileName.length === 0))
69
+ {
70
+ let tmpScope = 'Default';
71
+ if ((tmpManifest) && (tmpManifest.Scope))
72
+ {
73
+ tmpScope = tmpManifest.Scope;
74
+ }
75
+ if ((tmpManifest) && (tmpManifest.Form))
76
+ {
77
+ tmpScope = tmpManifest.Form;
78
+ }
79
+ tmpOutputFileName = `${tmpScope}.csv`;
80
+ }
81
+ tmpOutputFileName = libPath.resolve(tmpOutputFileName);
82
+
83
+ // Write the CSV data to file -- first take the tabular array and turn it into a CSV string
84
+ let tmpCSVLines = [];
85
+ for (let tmpRowIndex = 0; tmpRowIndex < tmpCSVDataArray.length; tmpRowIndex++)
86
+ {
87
+ let tmpRow = tmpCSVDataArray[tmpRowIndex];
88
+ let tmpEscapedRow = [];
89
+ for (let tmpColumnIndex = 0; tmpColumnIndex < tmpRow.length; tmpColumnIndex++)
90
+ {
91
+ let tmpCell = tmpRow[tmpColumnIndex];
92
+ if ((typeof(tmpCell) === 'string') && ((tmpCell.indexOf(',') >= 0) || (tmpCell.indexOf('"') >= 0) || (tmpCell.indexOf('\n') >= 0)))
93
+ {
94
+ // Escape quotes
95
+ let tmpEscapedCell = tmpCell.replace(/"/g, '""');
96
+ // Wrap in quotes
97
+ tmpEscapedCell = `"${tmpEscapedCell}"`;
98
+ tmpEscapedRow.push(tmpEscapedCell);
99
+ }
100
+ else
101
+ {
102
+ tmpEscapedRow.push(tmpCell);
103
+ }
104
+ }
105
+ tmpCSVLines.push(tmpEscapedRow.join(','));
106
+ }
107
+ let tmpCSVDataString = tmpCSVLines.join('\n');
108
+
109
+ this.fable.FilePersistence.writeFileSync(tmpOutputFileName, tmpCSVDataString, { encoding: 'utf8' });
110
+ this.fable.log.info(`Wrote CSV data (length ${tmpCSVDataString.length}) to file [${tmpOutputFileName}].`);
111
+
112
+ return fCallback();
113
+ };
114
+ }
115
+
116
+ module.exports = ImportCSVCommand;