read-excel-file 6.0.3 → 7.0.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 (206) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +22 -11
  3. package/browser/index.cjs +7 -0
  4. package/{index.d.ts → browser/index.d.ts} +2 -2
  5. package/browser/index.js +6 -0
  6. package/browser/package.json +17 -0
  7. package/bundle/read-excel-file.min.js +1 -1
  8. package/bundle/read-excel-file.min.js.map +1 -1
  9. package/commonjs/export/convertInputToNodeStream.js +45 -0
  10. package/commonjs/export/convertInputToNodeStream.js.map +1 -0
  11. package/commonjs/export/convertValuesFromUint8ArraysToStrings.js +20 -0
  12. package/commonjs/export/convertValuesFromUint8ArraysToStrings.js.map +1 -0
  13. package/commonjs/export/filterZipArchiveEntry.js +18 -0
  14. package/commonjs/export/filterZipArchiveEntry.js.map +1 -0
  15. package/commonjs/{read → export}/readSheetNamesBrowser.js +4 -4
  16. package/commonjs/export/readSheetNamesBrowser.js.map +1 -0
  17. package/commonjs/export/readSheetNamesNode.js.map +1 -0
  18. package/commonjs/export/readSheetNamesUniversal.js +23 -0
  19. package/commonjs/export/readSheetNamesUniversal.js.map +1 -0
  20. package/commonjs/{read → export}/readSheetNamesWebWorker.js +2 -2
  21. package/commonjs/export/readSheetNamesWebWorker.js.map +1 -0
  22. package/commonjs/{read → export}/readXlsxFileBrowser.js +6 -6
  23. package/commonjs/export/readXlsxFileBrowser.js.map +1 -0
  24. package/commonjs/{read → export}/readXlsxFileNode.js +5 -5
  25. package/commonjs/export/readXlsxFileNode.js.map +1 -0
  26. package/commonjs/export/readXlsxFileUniversal.js +24 -0
  27. package/commonjs/export/readXlsxFileUniversal.js.map +1 -0
  28. package/commonjs/{read → export}/readXlsxFileWebWorker.js +5 -5
  29. package/commonjs/export/readXlsxFileWebWorker.js.map +1 -0
  30. package/commonjs/export/unpackXlsxFileBrowser.js +38 -0
  31. package/commonjs/export/unpackXlsxFileBrowser.js.map +1 -0
  32. package/commonjs/export/unpackXlsxFileNode.js +23 -0
  33. package/commonjs/export/unpackXlsxFileNode.js.map +1 -0
  34. package/commonjs/export/unpackXlsxFileUniversal.js +23 -0
  35. package/commonjs/export/unpackXlsxFileUniversal.js.map +1 -0
  36. package/commonjs/types/Date.js +1 -1
  37. package/commonjs/types/Date.js.map +1 -1
  38. package/commonjs/{read → xlsx}/coordinates.js.map +1 -1
  39. package/commonjs/{read → xlsx}/dropEmptyColumns.js.map +1 -1
  40. package/commonjs/{read → xlsx}/dropEmptyColumns.test.js.map +1 -1
  41. package/commonjs/{read → xlsx}/dropEmptyRows.js.map +1 -1
  42. package/commonjs/{read → xlsx}/dropEmptyRows.test.js.map +1 -1
  43. package/commonjs/{read → xlsx}/getData.js.map +1 -1
  44. package/commonjs/{read → xlsx}/isDateTimestamp.js.map +1 -1
  45. package/commonjs/{read → xlsx}/parseCell.js.map +1 -1
  46. package/commonjs/{read → xlsx}/parseCellValue.js.map +1 -1
  47. package/commonjs/{read → xlsx}/parseCells.js.map +1 -1
  48. package/commonjs/{read → xlsx}/parseDate.js.map +1 -1
  49. package/commonjs/{read → xlsx}/parseDate.test.js.map +1 -1
  50. package/commonjs/{read → xlsx}/parseDimensions.js.map +1 -1
  51. package/commonjs/{read → xlsx}/parseFilePaths.js.map +1 -1
  52. package/commonjs/{read → xlsx}/parseProperties.js.map +1 -1
  53. package/commonjs/{read → xlsx}/parseSharedStrings.js.map +1 -1
  54. package/commonjs/{read → xlsx}/parseSheet.js.map +1 -1
  55. package/commonjs/{read → xlsx}/parseStyles.js.map +1 -1
  56. package/commonjs/{read/readXlsx.js → xlsx/parseXlsxFileContents.js} +10 -9
  57. package/commonjs/xlsx/parseXlsxFileContents.js.map +1 -0
  58. package/commonjs/{read/readXlsxFileContents.js → xlsx/parseXlsxFileContentsWithOptionalSchema.js} +13 -6
  59. package/commonjs/xlsx/parseXlsxFileContentsWithOptionalSchema.js.map +1 -0
  60. package/commonjs/{read → xlsx}/schema/mapToObjects.js +0 -4
  61. package/commonjs/xlsx/schema/mapToObjects.js.map +1 -0
  62. package/commonjs/{read → xlsx}/schema/mapToObjects.test.js.map +1 -1
  63. package/commonjs/zip/unzipFromArrayBuffer.js +74 -0
  64. package/commonjs/zip/unzipFromArrayBuffer.js.map +1 -0
  65. package/commonjs/zip/unzipFromArrayBufferSync.js +33 -0
  66. package/commonjs/zip/unzipFromArrayBufferSync.js.map +1 -0
  67. package/commonjs/zip/unzipFromStream.js +123 -0
  68. package/commonjs/zip/unzipFromStream.js.map +1 -0
  69. package/modules/export/convertInputToNodeStream.js +36 -0
  70. package/modules/export/convertInputToNodeStream.js.map +1 -0
  71. package/modules/export/convertValuesFromUint8ArraysToStrings.js +15 -0
  72. package/modules/export/convertValuesFromUint8ArraysToStrings.js.map +1 -0
  73. package/modules/export/filterZipArchiveEntry.js +12 -0
  74. package/modules/export/filterZipArchiveEntry.js.map +1 -0
  75. package/modules/{read → export}/readSheetNamesBrowser.js +4 -4
  76. package/modules/export/readSheetNamesBrowser.js.map +1 -0
  77. package/modules/export/readSheetNamesNode.js.map +1 -0
  78. package/modules/export/readSheetNamesUniversal.js +17 -0
  79. package/modules/export/readSheetNamesUniversal.js.map +1 -0
  80. package/modules/{read → export}/readSheetNamesWebWorker.js +2 -2
  81. package/modules/export/readSheetNamesWebWorker.js.map +1 -0
  82. package/modules/{read → export}/readXlsxFileBrowser.js +6 -6
  83. package/modules/export/readXlsxFileBrowser.js.map +1 -0
  84. package/modules/{read → export}/readXlsxFileNode.js +5 -5
  85. package/modules/export/readXlsxFileNode.js.map +1 -0
  86. package/modules/export/readXlsxFileUniversal.js +18 -0
  87. package/modules/export/readXlsxFileUniversal.js.map +1 -0
  88. package/modules/{read → export}/readXlsxFileWebWorker.js +5 -5
  89. package/modules/export/readXlsxFileWebWorker.js.map +1 -0
  90. package/modules/export/unpackXlsxFileBrowser.js +30 -0
  91. package/modules/export/unpackXlsxFileBrowser.js.map +1 -0
  92. package/modules/export/unpackXlsxFileNode.js +17 -0
  93. package/modules/export/unpackXlsxFileNode.js.map +1 -0
  94. package/modules/export/unpackXlsxFileUniversal.js +17 -0
  95. package/modules/export/unpackXlsxFileUniversal.js.map +1 -0
  96. package/modules/types/Date.js +1 -1
  97. package/modules/types/Date.js.map +1 -1
  98. package/modules/{read → xlsx}/coordinates.js.map +1 -1
  99. package/modules/{read → xlsx}/dropEmptyColumns.js.map +1 -1
  100. package/modules/{read → xlsx}/dropEmptyColumns.test.js.map +1 -1
  101. package/modules/{read → xlsx}/dropEmptyRows.js.map +1 -1
  102. package/modules/{read → xlsx}/dropEmptyRows.test.js.map +1 -1
  103. package/modules/{read → xlsx}/getData.js.map +1 -1
  104. package/modules/{read → xlsx}/isDateTimestamp.js.map +1 -1
  105. package/modules/{read → xlsx}/parseCell.js.map +1 -1
  106. package/modules/{read → xlsx}/parseCellValue.js.map +1 -1
  107. package/modules/{read → xlsx}/parseCells.js.map +1 -1
  108. package/modules/{read → xlsx}/parseDate.js.map +1 -1
  109. package/modules/{read → xlsx}/parseDate.test.js.map +1 -1
  110. package/modules/{read → xlsx}/parseDimensions.js.map +1 -1
  111. package/modules/{read → xlsx}/parseFilePaths.js.map +1 -1
  112. package/modules/{read → xlsx}/parseProperties.js.map +1 -1
  113. package/modules/{read → xlsx}/parseSharedStrings.js.map +1 -1
  114. package/modules/{read → xlsx}/parseSheet.js.map +1 -1
  115. package/modules/{read → xlsx}/parseStyles.js.map +1 -1
  116. package/modules/{read/readXlsx.js → xlsx/parseXlsxFileContents.js} +9 -8
  117. package/modules/xlsx/parseXlsxFileContents.js.map +1 -0
  118. package/modules/{read/readXlsxFileContents.js → xlsx/parseXlsxFileContentsWithOptionalSchema.js} +13 -5
  119. package/modules/xlsx/parseXlsxFileContentsWithOptionalSchema.js.map +1 -0
  120. package/modules/{read → xlsx}/schema/mapToObjects.js +0 -4
  121. package/modules/xlsx/schema/mapToObjects.js.map +1 -0
  122. package/modules/{read → xlsx}/schema/mapToObjects.test.js.map +1 -1
  123. package/modules/zip/unzipFromArrayBuffer.js +67 -0
  124. package/modules/zip/unzipFromArrayBuffer.js.map +1 -0
  125. package/modules/zip/unzipFromArrayBufferSync.js +27 -0
  126. package/modules/zip/unzipFromArrayBufferSync.js.map +1 -0
  127. package/modules/zip/unzipFromStream.js +119 -0
  128. package/modules/zip/unzipFromStream.js.map +1 -0
  129. package/node/index.cjs +4 -4
  130. package/node/index.d.ts +2 -1
  131. package/node/index.js +3 -3
  132. package/package.json +14 -9
  133. package/rollup.config.mjs +1 -1
  134. package/universal/index.cjs +7 -0
  135. package/universal/index.d.ts +28 -0
  136. package/universal/index.js +6 -0
  137. package/universal/package.json +17 -0
  138. package/web-worker/index.cjs +4 -4
  139. package/web-worker/index.js +3 -3
  140. package/commonjs/read/readSheetNamesBrowser.js.map +0 -1
  141. package/commonjs/read/readSheetNamesNode.js.map +0 -1
  142. package/commonjs/read/readSheetNamesNode.test.js.map +0 -1
  143. package/commonjs/read/readSheetNamesWebWorker.js.map +0 -1
  144. package/commonjs/read/readXlsx.js.map +0 -1
  145. package/commonjs/read/readXlsxFileBrowser.js.map +0 -1
  146. package/commonjs/read/readXlsxFileContents.js.map +0 -1
  147. package/commonjs/read/readXlsxFileNode.js.map +0 -1
  148. package/commonjs/read/readXlsxFileNode.test.js.map +0 -1
  149. package/commonjs/read/readXlsxFileWebWorker.js.map +0 -1
  150. package/commonjs/read/schema/mapToObjects.js.map +0 -1
  151. package/commonjs/read/unpackXlsxFileBrowser.js +0 -50
  152. package/commonjs/read/unpackXlsxFileBrowser.js.map +0 -1
  153. package/commonjs/read/unpackXlsxFileNode.js +0 -86
  154. package/commonjs/read/unpackXlsxFileNode.js.map +0 -1
  155. package/index.cjs +0 -7
  156. package/index.cjs.js +0 -12
  157. package/index.js +0 -6
  158. package/modules/read/readSheetNamesBrowser.js.map +0 -1
  159. package/modules/read/readSheetNamesNode.js.map +0 -1
  160. package/modules/read/readSheetNamesNode.test.js.map +0 -1
  161. package/modules/read/readSheetNamesWebWorker.js.map +0 -1
  162. package/modules/read/readXlsx.js.map +0 -1
  163. package/modules/read/readXlsxFileBrowser.js.map +0 -1
  164. package/modules/read/readXlsxFileContents.js.map +0 -1
  165. package/modules/read/readXlsxFileNode.js.map +0 -1
  166. package/modules/read/readXlsxFileNode.test.js.map +0 -1
  167. package/modules/read/readXlsxFileWebWorker.js.map +0 -1
  168. package/modules/read/schema/mapToObjects.js.map +0 -1
  169. package/modules/read/unpackXlsxFileBrowser.js +0 -45
  170. package/modules/read/unpackXlsxFileBrowser.js.map +0 -1
  171. package/modules/read/unpackXlsxFileNode.js +0 -78
  172. package/modules/read/unpackXlsxFileNode.js.map +0 -1
  173. package/node/index.cjs.js +0 -12
  174. package/web-worker/index.cjs.js +0 -12
  175. /package/commonjs/{read → export}/readSheetNamesNode.js +0 -0
  176. /package/commonjs/{read → xlsx}/coordinates.js +0 -0
  177. /package/commonjs/{read → xlsx}/dropEmptyColumns.js +0 -0
  178. /package/commonjs/{read → xlsx}/dropEmptyRows.js +0 -0
  179. /package/commonjs/{read → xlsx}/getData.js +0 -0
  180. /package/commonjs/{read → xlsx}/isDateTimestamp.js +0 -0
  181. /package/commonjs/{read → xlsx}/parseCell.js +0 -0
  182. /package/commonjs/{read → xlsx}/parseCellValue.js +0 -0
  183. /package/commonjs/{read → xlsx}/parseCells.js +0 -0
  184. /package/commonjs/{read → xlsx}/parseDate.js +0 -0
  185. /package/commonjs/{read → xlsx}/parseDimensions.js +0 -0
  186. /package/commonjs/{read → xlsx}/parseFilePaths.js +0 -0
  187. /package/commonjs/{read → xlsx}/parseProperties.js +0 -0
  188. /package/commonjs/{read → xlsx}/parseSharedStrings.js +0 -0
  189. /package/commonjs/{read → xlsx}/parseSheet.js +0 -0
  190. /package/commonjs/{read → xlsx}/parseStyles.js +0 -0
  191. /package/modules/{read → export}/readSheetNamesNode.js +0 -0
  192. /package/modules/{read → xlsx}/coordinates.js +0 -0
  193. /package/modules/{read → xlsx}/dropEmptyColumns.js +0 -0
  194. /package/modules/{read → xlsx}/dropEmptyRows.js +0 -0
  195. /package/modules/{read → xlsx}/getData.js +0 -0
  196. /package/modules/{read → xlsx}/isDateTimestamp.js +0 -0
  197. /package/modules/{read → xlsx}/parseCell.js +0 -0
  198. /package/modules/{read → xlsx}/parseCellValue.js +0 -0
  199. /package/modules/{read → xlsx}/parseCells.js +0 -0
  200. /package/modules/{read → xlsx}/parseDate.js +0 -0
  201. /package/modules/{read → xlsx}/parseDimensions.js +0 -0
  202. /package/modules/{read → xlsx}/parseFilePaths.js +0 -0
  203. /package/modules/{read → xlsx}/parseProperties.js +0 -0
  204. /package/modules/{read → xlsx}/parseSharedStrings.js +0 -0
  205. /package/modules/{read → xlsx}/parseSheet.js +0 -0
  206. /package/modules/{read → xlsx}/parseStyles.js +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"mapToObjects.js","names":["NumberType","StringType","BooleanType","DateType","DEFAULT_OPTIONS","schemaPropertyValueForMissingColumn","undefined","schemaPropertyValueForMissingValue","schemaPropertyShouldSkipRequiredValidationForMissingColumn","getEmptyObjectValue","getEmptyArrayValue","isColumnOriented","ignoreEmptyRows","arrayValueSeparator","mapToObjects","data","schema","options","_objectSpread","_options","rowIndexSourceMapOriginal","rowIndexSourceMap","schemaTransformOptions","_objectWithoutProperties","_excluded","slice","validateSchema","transpose","filter","row","i","isEmptyRow","every","cell","splice","columns","results","errors","length","result","read","push","_iterator","_createForOfIteratorHelperLoose","_step","done","error","value","rows","rowIndex","path","object","isEmptyObject","createError","_ref","schemaEntry","errorMessage","reason","column","type","pendingRequiredChecks","_loop","key","_Object$keys","_i","propertyName","columnTitle","propertyPath","concat","cellValue","columnIndex","indexOf","isMissingColumn","Array","isArray","array","parseArray","map","_value","parseValue","isEmpty","isEmptyValue","required","Object","keys","_i2","_pendingRequiredCheck","_pendingRequiredCheck2","skipRequiredValidation","isRequired","parse","Error","parseValueOfType","oneOf","validate","message","parseCustomValue","parsedValue","String","Number","Date","properties","Boolean","name","getBlock","string","endCharacter","startIndex","substring","character","block","blocks","index","_getBlock","_getBlock2","_slicedToArray","trim","_","_i3","_Object$keys2","_typeof"],"sources":["../../../source/read/schema/mapToObjects.js"],"sourcesContent":["import NumberType from '../../types/Number.js'\r\nimport StringType from '../../types/String.js'\r\nimport BooleanType from '../../types/Boolean.js'\r\nimport DateType from '../../types/Date.js'\r\n\r\nconst DEFAULT_OPTIONS = {\r\n schemaPropertyValueForMissingColumn: undefined,\r\n schemaPropertyValueForMissingValue: null,\r\n schemaPropertyShouldSkipRequiredValidationForMissingColumn: () => false,\r\n // `getEmptyObjectValue(object, { path })` applies to both the top-level object\r\n // and any of its sub-objects.\r\n getEmptyObjectValue: () => null,\r\n getEmptyArrayValue: () => null,\r\n isColumnOriented: false,\r\n ignoreEmptyRows: true,\r\n arrayValueSeparator: ','\r\n}\r\n\r\n/**\r\n * Converts spreadsheet-alike data structure into an array of objects.\r\n *\r\n * Parameters:\r\n *\r\n * * `data` — An array of rows, each row being an array of cells. The first row should be the list of column headers and the rest of the rows should be the data.\r\n * * `schema` — A \"to JSON\" convertion schema (see above).\r\n * * `options` — (optional) Schema conversion parameters of `read-excel-file`:\r\n * * `schemaPropertyValueForMissingColumn` — By default, when some of the `schema` columns are missing in the input `data`, those properties are set to `undefined` in the output objects. Pass `schemaPropertyValueForMissingColumn: null` to set such \"missing column\" properties to `null` in the output objects.\r\n * * `schemaPropertyValueForNullCellValue` — By default, when it encounters a `null` value in a cell in input `data`, it sets it to `undefined` in the output object. Pass `schemaPropertyValueForNullCellValue: null` to make it set such values as `null`s in output objects.\r\n * * `schemaPropertyValueForUndefinedCellValue` — By default, when it encounters an `undefined` value in a cell in input `data`, it it sets it to `undefined` in the output object. Pass `schemaPropertyValueForUndefinedCellValue: null` to make it set such values as `null`s in output objects.\r\n * * `schemaPropertyShouldSkipRequiredValidationForMissingColumn: (column: string, { object }) => boolean` — By default, it does apply `required` validation to `schema` properties for which columns are missing in the input `data`. One could pass a custom `schemaPropertyShouldSkipRequiredValidationForMissingColumn(column, { object })` to disable `required` validation for missing columns in some or all cases.\r\n * * `getEmptyObjectValue(object, { path? })` — By default, it returns `null` for \"empty\" objects. One could override that value using `getEmptyObjectValue(object, { path })` parameter. The value applies to both top-level object and any nested sub-objects in case of a nested schema, hence the additional (optional) `path?: string` parameter.\r\n * * `getEmptyArrayValue(array, { path })` — By default, it returns `null` for an \"empty\" array value. One could override that value using `getEmptyArrayValue(array, { path })` parameter.\r\n *\r\n * When parsing a property value, in case of an error, the value of that property is gonna be `undefined`.\r\n *\r\n * @param {any[][]} data - An array of rows, each row being an array of cells.\r\n * @param {object} schema\r\n * @param {object} [options]\r\n * @param {null} [options.schemaPropertyValueForMissingColumn] — By default, when some of the `schema` columns are missing in the input `data`, those properties are set to `undefined` in the output objects. Pass `schemaPropertyValueForMissingColumn: null` to set such \"missing column\" properties to `null` in the output objects.\r\n * @param {null} [options.schemaPropertyValueForMissingValue] — By default, when it encounters a `null` value in a cell in input `data`, it leaves the value as is. Pass a custom `schemaPropertyValueForMissingValue` to make it set such values to that value.\r\n * @param {object} [options.properties] — An optional object with optional property `epoch1904: true/false`. It is used when parsing dates.\r\n * @param {boolean} [options.schemaPropertyShouldSkipRequiredValidationForMissingColumn(column: string, { object })] — By default, it does apply `required` validation to `schema` properties for which columns are missing in the input `data`. One could pass a custom `schemaPropertyShouldSkipRequiredValidationForMissingColumn(column, { object })` to disable `required` validation for missing columns in some or all cases.\r\n * @param {function} [options.getEmptyObjectValue(object, { path })] — By default, it returns `null` for an \"empty\" resulting object. One could override that value using `getEmptyObjectValue(object, { path })` parameter. The value applies to both top-level object and any nested sub-objects in case of a nested schema, hence the additional `path?: string` parameter.\r\n * @param {function} [getEmptyArrayValue(array, { path })] — By default, it returns `null` for an \"empty\" array value. One could override that value using `getEmptyArrayValue(array, { path })` parameter.\r\n * @param {boolean} [options.isColumnOriented] — By default, the headers are assumed to be the first row in the `data`. Pass `isColumnOriented: true` if the headers are the first column in the `data`. i.e. if `data` is \"transposed\".\r\n * @param {string} [options.arrayValueSeparator] — When specified, string values will be split by this separator to get the array.\r\n * @param {object} [options.rowIndexSourceMap] — Custom row indexes of `data` rows. If present, will overwrite the indexes of `data` rows with the indexes from this `rowIndexSourceMap`.\r\n * @return {object[]}\r\n */\r\nexport default function mapToObjects(data, schema, options) {\r\n if (options) {\r\n options = {\r\n ...DEFAULT_OPTIONS,\r\n ...options\r\n }\r\n } else {\r\n options = DEFAULT_OPTIONS\r\n }\r\n\r\n const {\r\n isColumnOriented,\r\n ignoreEmptyRows,\r\n rowIndexSourceMap: rowIndexSourceMapOriginal,\r\n ...schemaTransformOptions\r\n } = options\r\n\r\n // `rowIndexSourceMap` could be mutated by `ignoreEmptyRows: true` option.\r\n // Create a copy of it so that the original `rowIndexSourceMap` is not affected by those changes.\r\n let rowIndexSourceMap = rowIndexSourceMapOriginal && rowIndexSourceMapOriginal.slice()\r\n\r\n validateSchema(schema)\r\n\r\n if (isColumnOriented) {\r\n data = transpose(data)\r\n }\r\n\r\n\tif (ignoreEmptyRows) {\r\n\t\tdata = data.filter((row, i) => {\r\n const isEmptyRow = row.every(cell => cell === null)\r\n if (isEmptyRow) {\r\n // Adjust `rowIndexSourceMap` now that the row has been removed.\r\n if (rowIndexSourceMap) {\r\n // Remove the `rowIndexSourceMap` entry that corresponds to the removed row.\r\n rowIndexSourceMap.splice(i, 1)\r\n }\r\n return false;\r\n }\r\n return true;\r\n })\r\n\t}\r\n\r\n const columns = data[0]\r\n\r\n const results = []\r\n const errors = []\r\n\r\n for (let i = 1; i < data.length; i++) {\r\n const result = read(schema, data[i], i, undefined, columns, errors, schemaTransformOptions)\r\n results.push(result)\r\n }\r\n\r\n // Set the correct `row` number in `errors` if a custom `rowIndexSourceMap` is supplied.\r\n if (rowIndexSourceMap) {\r\n for (const error of errors) {\r\n // Convert the `row` index in `data` to the\r\n // actual `row` index in the spreadsheet.\r\n // `- 1` converts row number to row index.\r\n // `+ 1` converts row index to row number.\r\n error.row = rowIndexSourceMap[error.row - 1] + 1\r\n }\r\n }\r\n\r\n return {\r\n rows: results,\r\n errors\r\n }\r\n}\r\n\r\nfunction read(schema, row, rowIndex, path, columns, errors, options) {\r\n const object = {}\r\n let isEmptyObject = true\r\n\r\n const createError = ({\r\n schemaEntry,\r\n value,\r\n error: errorMessage,\r\n reason\r\n }) => {\r\n const error = {\r\n error: errorMessage,\r\n row: rowIndex + 1,\r\n column: schemaEntry.column,\r\n value\r\n }\r\n if (reason) {\r\n error.reason = reason\r\n }\r\n // * Regular values specify a `type?` property, which is included in the `error` object.\r\n // * Nested objects specify a `schema` property, which is not included in the `error` object.\r\n if (schemaEntry.type) {\r\n error.type = schemaEntry.type\r\n }\r\n return error\r\n }\r\n\r\n const pendingRequiredChecks = []\r\n\r\n // For each schema entry.\r\n for (const key of Object.keys(schema)) {\r\n const schemaEntry = schema[key]\r\n\r\n // `schemaEntry.prop` property is now deprecated and shouldn't be used.\r\n // Instead, it now uses `key` as the key in the `object`.\r\n // And column name is now read not from `key` but from `schemaEntry.column` property.\r\n const propertyName = key\r\n const columnTitle = schemaEntry.column\r\n\r\n // The path of this property inside the resulting object.\r\n const propertyPath = `${path || ''}.${propertyName}`\r\n\r\n // Read the cell value for the schema entry.\r\n let cellValue\r\n const columnIndex = columns.indexOf(columnTitle)\r\n const isMissingColumn = columnIndex < 0\r\n if (!isMissingColumn) {\r\n cellValue = row[columnIndex]\r\n }\r\n\r\n let value\r\n let error\r\n let reason\r\n\r\n // Get property `value` from cell value.\r\n if (schemaEntry.schema) {\r\n value = read(schemaEntry.schema, row, rowIndex, propertyPath, columns, errors, options)\r\n } else {\r\n if (isMissingColumn) {\r\n if ('schemaPropertyValueForMissingColumn' in options) {\r\n value = options.schemaPropertyValueForMissingColumn\r\n }\r\n }\r\n else if (cellValue === undefined) {\r\n // This isn't supposed to be possible. Cell values are always `null` when cells are empty.\r\n // Employ some sensible fallback behavior here.\r\n if ('schemaPropertyValueForMissingValue' in options) {\r\n value = options.schemaPropertyValueForMissingValue\r\n }\r\n }\r\n else if (cellValue === null) {\r\n if ('schemaPropertyValueForMissingValue' in options) {\r\n value = options.schemaPropertyValueForMissingValue\r\n }\r\n }\r\n else if (Array.isArray(schemaEntry.type)) {\r\n const array = parseArray(cellValue, options.arrayValueSeparator).map((_value) => {\r\n if (error) {\r\n return\r\n }\r\n const result = parseValue(_value, schemaEntry, options)\r\n if (result.error) {\r\n // In case of an error, `value` won't be returned and will just be reported\r\n // as part of an `error` object, so it's fine assigning just an element of the array.\r\n value = _value\r\n error = result.error\r\n reason = result.reason\r\n }\r\n return result.value\r\n })\r\n if (!error) {\r\n const isEmpty = array.every(isEmptyValue)\r\n value = isEmpty ? options.getEmptyArrayValue(array, { path: propertyPath }) : array\r\n }\r\n } else {\r\n const result = parseValue(cellValue, schemaEntry, options)\r\n error = result.error\r\n reason = result.reason\r\n value = error ? cellValue : result.value\r\n }\r\n }\r\n\r\n // Apply `required` validation if the value is \"empty\".\r\n if (!error && isEmptyValue(value)) {\r\n if (schemaEntry.required) {\r\n // Will perform this `required()` validation in the end,\r\n // when all properties of the mapped object have been mapped.\r\n pendingRequiredChecks.push({ schemaEntry, value, isMissingColumn })\r\n }\r\n }\r\n\r\n if (error) {\r\n // If there was an error then the property value in the `object` will be `undefined`,\r\n // i.e it won't add the property value to the mapped object.\r\n errors.push(createError({\r\n schemaEntry,\r\n value,\r\n error,\r\n reason\r\n }))\r\n } else {\r\n // Possibly unmark the mapped object as \"empty\".\r\n if (isEmptyObject && !isEmptyValue(value)) {\r\n isEmptyObject = false\r\n }\r\n // Set the value in the mapped object.\r\n // Skip setting `undefined` values because they're already `undefined`\r\n // due to not having previously been set.\r\n if (value !== undefined) {\r\n object[propertyName] = value\r\n }\r\n }\r\n }\r\n\r\n // Return `null` for an \"empty\" mapped object.\r\n if (isEmptyObject) {\r\n return options.getEmptyObjectValue(object, { path })\r\n }\r\n\r\n // Perform any `required` validations.\r\n for (const { schemaEntry, value, isMissingColumn } of pendingRequiredChecks) {\r\n // Can optionally skip `required` validation for missing columns.\r\n const skipRequiredValidation = isMissingColumn && options.schemaPropertyShouldSkipRequiredValidationForMissingColumn(schemaEntry.column, { object })\r\n if (!skipRequiredValidation) {\r\n const { required } = schemaEntry\r\n const isRequired = typeof required === 'boolean' ? required : required(object)\r\n if (isRequired) {\r\n errors.push(createError({\r\n schemaEntry,\r\n value,\r\n error: 'required'\r\n }))\r\n }\r\n }\r\n }\r\n\r\n // Return the mapped object.\r\n return object\r\n}\r\n\r\n/**\r\n * Converts textual value to a javascript typed value.\r\n * @param {any} value\r\n * @param {object} schemaEntry\r\n * @return {{ value: any, error: string }}\r\n */\r\nexport function parseValue(value, schemaEntry, options) {\r\n if (value === null) {\r\n return { value: null }\r\n }\r\n let result\r\n if (schemaEntry.parse) {\r\n throw new Error('`schemaEntry.parse` property was renamed to `schemaEntry.type`')\r\n } else if (schemaEntry.type) {\r\n result = parseValueOfType(\r\n value,\r\n // Supports parsing array types.\r\n // See `parseArray()` function for more details.\r\n // Example `type`: String[]\r\n // Input: 'Barack Obama, \"String, with, colons\", Donald Trump'\r\n // Output: ['Barack Obama', 'String, with, colons', 'Donald Trump']\r\n Array.isArray(schemaEntry.type) ? schemaEntry.type[0] : schemaEntry.type,\r\n options\r\n )\r\n } else {\r\n result = { value: value }\r\n // throw new Error('Invalid schema entry: no `type` specified:\\n\\n' + JSON.stringify(schemaEntry, null, 2))\r\n }\r\n // If errored then return the error.\r\n if (result.error) {\r\n return result\r\n }\r\n if (result.value !== null) {\r\n if (schemaEntry.oneOf && schemaEntry.oneOf.indexOf(result.value) < 0) {\r\n return { error: 'invalid', reason: 'unknown' }\r\n }\r\n if (schemaEntry.validate) {\r\n try {\r\n schemaEntry.validate(result.value)\r\n } catch (error) {\r\n return { error: error.message }\r\n }\r\n }\r\n }\r\n return result\r\n}\r\n\r\n/**\r\n * Converts textual value to a custom value using supplied `.parse()`.\r\n * @param {any} value\r\n * @param {function} parse\r\n * @return {{ value: any, error: string }}\r\n */\r\nfunction parseCustomValue(value, parse) {\r\n try {\r\n const parsedValue = parse(value)\r\n if (parsedValue === undefined) {\r\n return { value: null }\r\n }\r\n return { value: parsedValue }\r\n } catch (error) {\r\n const result = { error: error.message }\r\n if (error.reason) {\r\n result.reason = error.reason;\r\n }\r\n return result\r\n }\r\n}\r\n\r\n/**\r\n * Converts textual value to a javascript typed value.\r\n * @param {any} value\r\n * @param {} type\r\n * @return {{ value: (string|number|Date|boolean), error: string, reason?: string }}\r\n */\r\nfunction parseValueOfType(value, type, options) {\r\n switch (type) {\r\n case String:\r\n return parseCustomValue(value, StringType)\r\n\r\n case Number:\r\n return parseCustomValue(value, NumberType)\r\n\r\n case Date:\r\n return parseCustomValue(value, (value) => DateType(value, { properties: options.properties }))\r\n\r\n case Boolean:\r\n return parseCustomValue(value, BooleanType)\r\n\r\n default:\r\n if (typeof type === 'function') {\r\n return parseCustomValue(value, type)\r\n }\r\n throw new Error(`Unsupported schema type: ${type && type.name || type}`)\r\n }\r\n}\r\n\r\nexport function getBlock(string, endCharacter, startIndex) {\r\n let i = 0\r\n let substring = ''\r\n let character\r\n while (startIndex + i < string.length) {\r\n const character = string[startIndex + i]\r\n if (character === endCharacter) {\r\n return [substring, i]\r\n }\r\n else if (character === '\"') {\r\n const block = getBlock(string, '\"', startIndex + i + 1)\r\n substring += block[0]\r\n i += '\"'.length + block[1] + '\"'.length\r\n }\r\n else {\r\n substring += character\r\n i++\r\n }\r\n }\r\n return [substring, i]\r\n}\r\n\r\n/**\r\n * Parses a string of comma-separated substrings into an array of substrings.\r\n * (the `export` is just for tests)\r\n * @param {string} string — A string of comma-separated substrings.\r\n * @return {string[]} An array of substrings.\r\n */\r\nexport function parseArray(string, arrayValueSeparator) {\r\n const blocks = []\r\n let index = 0\r\n while (index < string.length) {\r\n const [substring, length] = getBlock(string, arrayValueSeparator, index)\r\n index += length + arrayValueSeparator.length\r\n blocks.push(substring.trim())\r\n }\r\n return blocks\r\n}\r\n\r\n// Transpose a 2D array.\r\n// https://stackoverflow.com/questions/17428587/transposing-a-2d-array-in-javascript\r\nconst transpose = array => array[0].map((_, i) => array.map(row => row[i]))\r\n\r\nfunction validateSchema(schema) {\r\n for (const key of Object.keys(schema)) {\r\n const schemaEntry = schema[key]\r\n // Validate that the `schema` is not using a deprecated `type: nestedSchema` format.\r\n if (typeof schemaEntry.type === 'object' && !Array.isArray(schemaEntry.type)) {\r\n throw new Error('When defining a nested schema, use a `schema` property instead of a `type` property')\r\n }\r\n // Validate that every property has a source `column` title specified for it.\r\n if (!schemaEntry.schema) {\r\n if (!schemaEntry.column) {\r\n throw new Error(`\"column\" not defined for schema entry \"${key}\".`)\r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction isEmptyValue(value) {\r\n return value === undefined || value === null\r\n}"],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAOA,UAAU,MAAM,uBAAuB;AAC9C,OAAOC,UAAU,MAAM,uBAAuB;AAC9C,OAAOC,WAAW,MAAM,wBAAwB;AAChD,OAAOC,QAAQ,MAAM,qBAAqB;AAE1C,IAAMC,eAAe,GAAG;EACtBC,mCAAmC,EAAEC,SAAS;EAC9CC,kCAAkC,EAAE,IAAI;EACxCC,0DAA0D,EAAE,SAAAA,2DAAA;IAAA,OAAM,KAAK;EAAA;EACvE;EACA;EACAC,mBAAmB,EAAE,SAAAA,oBAAA;IAAA,OAAM,IAAI;EAAA;EAC/BC,kBAAkB,EAAE,SAAAA,mBAAA;IAAA,OAAM,IAAI;EAAA;EAC9BC,gBAAgB,EAAE,KAAK;EACvBC,eAAe,EAAE,IAAI;EACrBC,mBAAmB,EAAE;AACvB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,YAAYA,CAACC,IAAI,EAAEC,MAAM,EAAEC,OAA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AW,CAACI,IAAI,MAAK,QAAQ,IAAI,CAACc,KAAK,CAACC,OAAO,CAACnB,WAAW,CAACI,IAAI,CAAC,EAAE;MAC5E,MAAM,IAAIgC,KAAK,CAAC,qFAAqF,CAAC;IACxG;IACA;IACA,IAAI,CAACpC,WAAW,CAACvC,MAAM,EAAE;MACvB,IAAI,CAACuC,WAAW,CAACG,MAAM,EAAE;QACvB,MAAM,IAAIiC,KAAK,8CAAAvB,MAAA,CAA2CN,GAAG,QAAI,CAAC;MACpE;IACF;EACF;AACF;AAEA,SAASmB,YAAYA,CAAClC,KAAK,EAAE;EAC3B,OAAOA,KAAK,KAAKzC,SAAS,IAAIyC,KAAK,KAAK,IAAI;AAC9C"}
@@ -1,45 +0,0 @@
1
- import { unzipSync, strFromU8 } from 'fflate';
2
-
3
- /**
4
- * Reads XLSX file in a browser.
5
- * @param {(File|Blob|ArrayBuffer)} input - A `File` or an `ArrayBuffer`.
6
- * @return {Promise} Resolves to an object holding XLSX file entries.
7
- */
8
- export default function unpackXlsxFile(input) {
9
- if (input instanceof File) {
10
- return input.arrayBuffer().then(unpackXlsxArrayBuffer);
11
- }
12
- if (input instanceof Blob) {
13
- return input.arrayBuffer().then(unpackXlsxArrayBuffer);
14
- }
15
- return unpackXlsxArrayBuffer(input);
16
- }
17
-
18
- /**
19
- * Reads XLSX file in a browser from an `ArrayBuffer`.
20
- * @param {ArrayBuffer} input
21
- * @return {Promise} Resolves to an object holding XLSX file entries.
22
- */
23
- function unpackXlsxArrayBuffer(arrayBuffer) {
24
- var archive = new Uint8Array(arrayBuffer);
25
- var contents = unzipSync(archive);
26
- return Promise.resolve(getContents(contents));
27
- // return new Promise((resolve, reject) => {
28
- // unzip(archive, (error, contents) => {
29
- // if (error) {
30
- // return reject(error)
31
- // }
32
- // return resolve(getContents(contents))
33
- // })
34
- // })
35
- }
36
-
37
- function getContents(contents) {
38
- var unzippedFiles = [];
39
- for (var _i = 0, _Object$keys = Object.keys(contents); _i < _Object$keys.length; _i++) {
40
- var key = _Object$keys[_i];
41
- unzippedFiles[key] = strFromU8(contents[key]);
42
- }
43
- return unzippedFiles;
44
- }
45
- //# sourceMappingURL=unpackXlsxFileBrowser.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unpackXlsxFileBrowser.js","names":["unzipSync","strFromU8","unpackXlsxFile","input","File","arrayBuffer","then","unpackXlsxArrayBuffer","Blob","archive","Uint8Array","contents","Promise","resolve","getContents","unzippedFiles","_i","_Object$keys","Object","keys","length","key"],"sources":["../../source/read/unpackXlsxFileBrowser.js"],"sourcesContent":["import { unzipSync, strFromU8 } from 'fflate'\r\n\r\n/**\r\n * Reads XLSX file in a browser.\r\n * @param {(File|Blob|ArrayBuffer)} input - A `File` or an `ArrayBuffer`.\r\n * @return {Promise} Resolves to an object holding XLSX file entries.\r\n */\r\nexport default function unpackXlsxFile(input) {\r\n\tif (input instanceof File) {\r\n\t\treturn input.arrayBuffer().then(unpackXlsxArrayBuffer)\r\n\t}\r\n\tif (input instanceof Blob) {\r\n\t\treturn input.arrayBuffer().then(unpackXlsxArrayBuffer)\r\n\t}\r\n\treturn unpackXlsxArrayBuffer(input)\r\n}\r\n\r\n/**\r\n * Reads XLSX file in a browser from an `ArrayBuffer`.\r\n * @param {ArrayBuffer} input\r\n * @return {Promise} Resolves to an object holding XLSX file entries.\r\n */\r\nfunction unpackXlsxArrayBuffer(arrayBuffer) {\r\n\tconst archive = new Uint8Array(arrayBuffer)\r\n\tconst contents = unzipSync(archive)\r\n\treturn Promise.resolve(getContents(contents))\r\n\t// return new Promise((resolve, reject) => {\r\n\t// \tunzip(archive, (error, contents) => {\r\n\t// \t\tif (error) {\r\n\t// \t\t\treturn reject(error)\r\n\t// \t\t}\r\n\t// \t\treturn resolve(getContents(contents))\r\n\t// \t})\r\n\t// })\r\n}\r\n\r\nfunction getContents(contents) {\r\n\tconst unzippedFiles = []\r\n\tfor (const key of Object.keys(contents)) {\r\n\t\tunzippedFiles[key] = strFromU8(contents[key])\r\n\t}\r\n\treturn unzippedFiles\r\n}"],"mappings":"AAAA,SAASA,SAAS,EAAEC,SAAS,QAAQ,QAAQ;;AAE7C;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,cAAcA,CAACC,KAAK,EAAE;EAC7C,IAAIA,KAAK,YAAYC,IAAI,EAAE;IAC1B,OAAOD,KAAK,CAACE,WAAW,CAAC,CAAC,CAACC,IAAI,CAACC,qBAAqB,CAAC;EACvD;EACA,IAAIJ,KAAK,YAAYK,IAAI,EAAE;IAC1B,OAAOL,KAAK,CAACE,WAAW,CAAC,CAAC,CAACC,IAAI,CAACC,qBAAqB,CAAC;EACvD;EACA,OAAOA,qBAAqB,CAACJ,KAAK,CAAC;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASI,qBAAqBA,CAACF,WAAW,EAAE;EAC3C,IAAMI,OAAO,GAAG,IAAIC,UAAU,CAACL,WAAW,CAAC;EAC3C,IAAMM,QAAQ,GAAGX,SAAS,CAACS,OAAO,CAAC;EACnC,OAAOG,OAAO,CAACC,OAAO,CAACC,WAAW,CAACH,QAAQ,CAAC,CAAC;EAC7C;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AACD;;AAEA,SAASG,WAAWA,CAACH,QAAQ,EAAE;EAC9B,IAAMI,aAAa,GAAG,EAAE;EACxB,SAAAC,EAAA,MAAAC,YAAA,GAAkBC,MAAM,CAACC,IAAI,CAACR,QAAQ,CAAC,EAAAK,EAAA,GAAAC,YAAA,CAAAG,MAAA,EAAAJ,EAAA,IAAE;IAApC,IAAMK,GAAG,GAAAJ,YAAA,CAAAD,EAAA;IACbD,aAAa,CAACM,GAAG,CAAC,GAAGpB,SAAS,CAACU,QAAQ,CAACU,GAAG,CAAC,CAAC;EAC9C;EACA,OAAON,aAAa;AACrB"}
@@ -1,78 +0,0 @@
1
- import fs from 'fs';
2
- import Stream, { Readable } from 'stream';
3
-
4
- // `unzipper` has a bug when it doesn't include "@aws-sdk/client-s3" package in the `dependencies`
5
- // which causes some "bundlers" throw an error.
6
- // https://github.com/ZJONSSON/node-unzipper/issues/330
7
- //
8
- // One workaround is to install "@aws-sdk/client-s3" package manually, which would still lead to increased bundle size.
9
- // If the code is bundled for server-side-use only, that is will not be used in a web browser,
10
- // then the increased bundle size would not be an issue.
11
- //
12
- // Another workaround could be to "alias" "@aws-sdk/client-s3" package in a "bundler" configuration file
13
- // with a path to a `*.js` file containing just "export default null". But that kind of a workaround would also
14
- // result in errors when using other packages that `import` anything from "@aws-sdk/client-s3" package,
15
- // so it's not really a workaround but more of a ticking bomb.
16
- //
17
- import unzip from 'unzipper';
18
-
19
- /**
20
- * Reads XLSX file in Node.js.
21
- * @param {(string|Stream)} input - A Node.js readable stream or a path to a file.
22
- * @return {Promise} Resolves to an object holding XLSX file entries.
23
- */
24
- export default function unpackXlsxFile(input) {
25
- // XLSX file is a zip archive.
26
- // The `entries` object stores the files
27
- // and their contents from this XLSX zip archive.
28
- var entries = {};
29
- var stream = input instanceof Stream ? input : input instanceof Buffer ? createReadableStreamFromBuffer(input) : fs.createReadStream(input);
30
- return new Promise(function (resolve, reject) {
31
- var entryPromises = [];
32
- stream
33
- // This first "error" listener is for the original stream errors.
34
- .on('error', reject).pipe(unzip.Parse())
35
- // This second "error" listener is for the unzip stream errors.
36
- .on('error', reject).on('finish', function () {}).on('close', function () {
37
- Promise.all(entryPromises).then(function () {
38
- return resolve(entries);
39
- });
40
- }).on('entry', function (entry) {
41
- var contents = '';
42
- // To ignore an entry: `entry.autodrain()`.
43
- entryPromises.push(new Promise(function (resolve) {
44
- // It's not clear what encoding are the files inside XLSX in.
45
- // https://stackoverflow.com/questions/45194771/are-xlsx-files-utf-8-encoded-by-definition
46
- // For example, for XML files, encoding is specified at the top node:
47
- // `<?xml version="1.0" encoding="UTF-8"/>`.
48
- //
49
- // `unzipper` supports setting encoding when reading an `entry`.
50
- // https://github.com/ZJONSSON/node-unzipper/issues/35
51
- // https://gitlab.com/catamphetamine/read-excel-file/-/issues/54
52
- //
53
- // If the `entry.setEncoding('utf8')` line would be commented out,
54
- // there's a `nonAsciiCharacterEncoding` test that wouldn't pass.
55
- //
56
- entry.setEncoding('utf8');
57
- //
58
- entry.on('data', function (data) {
59
- return contents += data.toString();
60
- }).on('end', function () {
61
- return resolve(entries[entry.path] = contents);
62
- });
63
- }));
64
- });
65
- });
66
- }
67
-
68
- // Creates a readable stream from a `Buffer`.
69
- function createReadableStreamFromBuffer(buffer) {
70
- // Node.js seems to have a bug in `Readable.from()` function:
71
- // it doesn't correctly handle empty buffers, i.e. it doesn't return a correct stream.
72
- // https://gitlab.com/catamphetamine/read-excel-file/-/issues/106
73
- if (buffer.length === 0) {
74
- throw new Error('No data');
75
- }
76
- return Readable.from(buffer);
77
- }
78
- //# sourceMappingURL=unpackXlsxFileNode.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unpackXlsxFileNode.js","names":["fs","Stream","Readable","unzip","unpackXlsxFile","input","entries","stream","Buffer","createReadableStreamFromBuffer","createReadStream","Promise","resolve","reject","entryPromises","on","pipe","Parse","all","then","entry","contents","push","setEncoding","data","toString","path","buffer","length","Error","from"],"sources":["../../source/read/unpackXlsxFileNode.js"],"sourcesContent":["import fs from 'fs'\r\nimport Stream, { Readable } from 'stream'\r\n\r\n// `unzipper` has a bug when it doesn't include \"@aws-sdk/client-s3\" package in the `dependencies`\r\n// which causes some \"bundlers\" throw an error.\r\n// https://github.com/ZJONSSON/node-unzipper/issues/330\r\n//\r\n// One workaround is to install \"@aws-sdk/client-s3\" package manually, which would still lead to increased bundle size.\r\n// If the code is bundled for server-side-use only, that is will not be used in a web browser,\r\n// then the increased bundle size would not be an issue.\r\n//\r\n// Another workaround could be to \"alias\" \"@aws-sdk/client-s3\" package in a \"bundler\" configuration file\r\n// with a path to a `*.js` file containing just \"export default null\". But that kind of a workaround would also\r\n// result in errors when using other packages that `import` anything from \"@aws-sdk/client-s3\" package,\r\n// so it's not really a workaround but more of a ticking bomb.\r\n//\r\nimport unzip from 'unzipper'\r\n\r\n/**\r\n * Reads XLSX file in Node.js.\r\n * @param {(string|Stream)} input - A Node.js readable stream or a path to a file.\r\n * @return {Promise} Resolves to an object holding XLSX file entries.\r\n */\r\nexport default function unpackXlsxFile(input) {\r\n // XLSX file is a zip archive.\r\n // The `entries` object stores the files\r\n // and their contents from this XLSX zip archive.\r\n const entries = {}\r\n\r\n const stream = input instanceof Stream\r\n ? input\r\n : (\r\n input instanceof Buffer\r\n ? createReadableStreamFromBuffer(input)\r\n : fs.createReadStream(input)\r\n )\r\n\r\n return new Promise((resolve, reject) => {\r\n const entryPromises = []\r\n\r\n stream\r\n // This first \"error\" listener is for the original stream errors.\r\n .on('error', reject)\r\n .pipe(unzip.Parse())\r\n // This second \"error\" listener is for the unzip stream errors.\r\n .on('error', reject)\r\n .on('finish', () => {\r\n })\r\n .on('close', () => {\r\n Promise.all(entryPromises).then(() => resolve(entries))\r\n })\r\n .on('entry', (entry) => {\r\n let contents = ''\r\n // To ignore an entry: `entry.autodrain()`.\r\n entryPromises.push(new Promise((resolve) => {\r\n // It's not clear what encoding are the files inside XLSX in.\r\n // https://stackoverflow.com/questions/45194771/are-xlsx-files-utf-8-encoded-by-definition\r\n // For example, for XML files, encoding is specified at the top node:\r\n // `<?xml version=\"1.0\" encoding=\"UTF-8\"/>`.\r\n //\r\n // `unzipper` supports setting encoding when reading an `entry`.\r\n // https://github.com/ZJONSSON/node-unzipper/issues/35\r\n // https://gitlab.com/catamphetamine/read-excel-file/-/issues/54\r\n //\r\n // If the `entry.setEncoding('utf8')` line would be commented out,\r\n // there's a `nonAsciiCharacterEncoding` test that wouldn't pass.\r\n //\r\n entry.setEncoding('utf8')\r\n //\r\n entry\r\n .on('data', data => contents += data.toString())\r\n .on('end', () => resolve(entries[entry.path] = contents))\r\n }))\r\n })\r\n })\r\n}\r\n\r\n// Creates a readable stream from a `Buffer`.\r\nfunction createReadableStreamFromBuffer(buffer) {\r\n // Node.js seems to have a bug in `Readable.from()` function:\r\n // it doesn't correctly handle empty buffers, i.e. it doesn't return a correct stream.\r\n // https://gitlab.com/catamphetamine/read-excel-file/-/issues/106\r\n if (buffer.length === 0) {\r\n throw new Error('No data')\r\n }\r\n return Readable.from(buffer)\r\n}"],"mappings":"AAAA,OAAOA,EAAE,MAAM,IAAI;AACnB,OAAOC,MAAM,IAAIC,QAAQ,QAAQ,QAAQ;;AAEzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOC,KAAK,MAAM,UAAU;;AAE5B;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,cAAcA,CAACC,KAAK,EAAE;EAC5C;EACA;EACA;EACA,IAAMC,OAAO,GAAG,CAAC,CAAC;EAElB,IAAMC,MAAM,GAAGF,KAAK,YAAYJ,MAAM,GAClCI,KAAK,GAELA,KAAK,YAAYG,MAAM,GACnBC,8BAA8B,CAACJ,KAAK,CAAC,GACrCL,EAAE,CAACU,gBAAgB,CAACL,KAAK,CAC9B;EAEH,OAAO,IAAIM,OAAO,CAAC,UAACC,OAAO,EAAEC,MAAM,EAAK;IACtC,IAAMC,aAAa,GAAG,EAAE;IAExBP;IACE;IAAA,CACCQ,EAAE,CAAC,OAAO,EAAEF,MAAM,CAAC,CACnBG,IAAI,CAACb,KAAK,CAACc,KAAK,CAAC,CAAC;IACnB;IAAA,CACCF,EAAE,CAAC,OAAO,EAAEF,MAAM,CAAC,CACnBE,EAAE,CAAC,QAAQ,EAAE,YAAM,CACpB,CAAC,CAAC,CACDA,EAAE,CAAC,OAAO,EAAE,YAAM;MACjBJ,OAAO,CAACO,GAAG,CAACJ,aAAa,CAAC,CAACK,IAAI,CAAC;QAAA,OAAMP,OAAO,CAACN,OAAO,CAAC;MAAA,EAAC;IACzD,CAAC,CAAC,CACDS,EAAE,CAAC,OAAO,EAAE,UAACK,KAAK,EAAK;MACtB,IAAIC,QAAQ,GAAG,EAAE;MACjB;MACAP,aAAa,CAACQ,IAAI,CAAC,IAAIX,OAAO,CAAC,UAACC,OAAO,EAAK;QAC1C;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACAQ,KAAK,CAACG,WAAW,CAAC,MAAM,CAAC;QACzB;QACAH,KAAK,CACFL,EAAE,CAAC,MAAM,EAAE,UAAAS,IAAI;UAAA,OAAIH,QAAQ,IAAIG,IAAI,CAACC,QAAQ,CAAC,CAAC;QAAA,EAAC,CAC/CV,EAAE,CAAC,KAAK,EAAE;UAAA,OAAMH,OAAO,CAACN,OAAO,CAACc,KAAK,CAACM,IAAI,CAAC,GAAGL,QAAQ,CAAC;QAAA,EAAC;MAC7D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;EACN,CAAC,CAAC;AACJ;;AAEA;AACA,SAASZ,8BAA8BA,CAACkB,MAAM,EAAE;EAC9C;EACA;EACA;EACA,IAAIA,MAAM,CAACC,MAAM,KAAK,CAAC,EAAE;IACvB,MAAM,IAAIC,KAAK,CAAC,SAAS,CAAC;EAC5B;EACA,OAAO3B,QAAQ,CAAC4B,IAAI,CAACH,MAAM,CAAC;AAC9B"}
package/node/index.cjs.js DELETED
@@ -1,12 +0,0 @@
1
- // This file is deprecated.
2
- // It's the same as `index.cjs`, just with an added `*.js` extension.
3
- // It fixes the issue when some software doesn't see files with `*.cjs` file extensions
4
- // when used as the `main` property value in `package.json`.
5
-
6
- exports = module.exports = require('../commonjs/read/readXlsxFileNode.js').default
7
- exports['default'] = require('../commonjs/read/readXlsxFileNode.js').default
8
- exports.readSheetNames = require('../commonjs/read/readSheetNamesNode.js').default
9
- exports.parseExcelDate = require('../commonjs/read/parseDate.js').default
10
- exports.Integer = require('../commonjs/types/Integer.js').default
11
- exports.Email = require('../commonjs/types/Email.js').default
12
- exports.URL = require('../commonjs/types/URL.js').default
@@ -1,12 +0,0 @@
1
- // This file is deprecated.
2
- // It's the same as `index.cjs`, just with an added `*.js` extension.
3
- // It fixes the issue when some software doesn't see files with `*.cjs` file extensions
4
- // when used as the `main` property value in `package.json`.
5
-
6
- exports = module.exports = require('../commonjs/read/readXlsxFileWebWorker.js').default
7
- exports['default'] = require('../commonjs/read/readXlsxFileWebWorker.js').default
8
- exports.readSheetNames = require('../commonjs/read/readSheetNamesWebWorker.js').default
9
- exports.parseExcelDate = require('../commonjs/read/parseDate.js').default
10
- exports.Integer = require('../commonjs/types/Integer.js').default
11
- exports.Email = require('../commonjs/types/Email.js').default
12
- exports.URL = require('../commonjs/types/URL.js').default
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes