selva-compute 1.0.0 → 1.1.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.
- package/README.md +1 -78
- package/dist/{chunk-P57VU27W.cjs → chunk-FNWG34KH.cjs} +2 -2
- package/dist/chunk-FNWG34KH.cjs.map +1 -0
- package/dist/chunk-G6W5VE7C.cjs +2 -0
- package/dist/chunk-G6W5VE7C.cjs.map +1 -0
- package/dist/chunk-I3OX3G7J.js +2 -0
- package/dist/chunk-I3OX3G7J.js.map +1 -0
- package/dist/{chunk-5DJRUPGI.cjs → chunk-M2HPEWXH.cjs} +2 -2
- package/dist/chunk-M2HPEWXH.cjs.map +1 -0
- package/dist/{chunk-AEQTQHPY.js → chunk-QFHFH5BS.js} +2 -2
- package/dist/chunk-QFHFH5BS.js.map +1 -0
- package/dist/{chunk-24EXIE4G.js → chunk-VGM4KAFN.js} +2 -2
- package/dist/chunk-VGM4KAFN.js.map +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +1 -1
- package/dist/grasshopper.cjs +1 -1
- package/dist/grasshopper.cjs.map +1 -1
- package/dist/grasshopper.d.cts +93 -7
- package/dist/grasshopper.d.ts +93 -7
- package/dist/grasshopper.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -4
- package/dist/index.d.ts +2 -4
- package/dist/index.js +1 -1
- package/dist/{schemas-5LuPKgX2.d.cts → schemas-CQEJ5EZy.d.cts} +1 -1
- package/dist/{schemas-5LuPKgX2.d.ts → schemas-CQEJ5EZy.d.ts} +1 -1
- package/dist/visualization.cjs +1 -1
- package/dist/visualization.cjs.map +1 -1
- package/dist/visualization.d.cts +1 -1
- package/dist/visualization.d.ts +1 -1
- package/dist/visualization.js +1 -1
- package/dist/visualization.js.map +1 -1
- package/package.json +118 -116
- package/dist/chunk-24EXIE4G.js.map +0 -1
- package/dist/chunk-5DJRUPGI.cjs.map +0 -1
- package/dist/chunk-AEQTQHPY.js.map +0 -1
- package/dist/chunk-JJLRDYYP.js +0 -2
- package/dist/chunk-JJLRDYYP.js.map +0 -1
- package/dist/chunk-OXD76DAK.js +0 -2
- package/dist/chunk-OXD76DAK.js.map +0 -1
- package/dist/chunk-P57VU27W.cjs.map +0 -1
- package/dist/chunk-PNG3L5TM.cjs +0 -2
- package/dist/chunk-PNG3L5TM.cjs.map +0 -1
- package/dist/chunk-TVCJBLSW.cjs +0 -2
- package/dist/chunk-TVCJBLSW.cjs.map +0 -1
- package/dist/files.cjs +0 -2
- package/dist/files.cjs.map +0 -1
- package/dist/files.d.cts +0 -34
- package/dist/files.d.ts +0 -34
- package/dist/files.js +0 -2
- package/dist/files.js.map +0 -1
- package/dist/types-SwbLAMW8.d.cts +0 -27
- package/dist/types-SwbLAMW8.d.ts +0 -27
package/dist/chunk-TVCJBLSW.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }var _chunk5DJRUPGIcjs = require('./chunk-5DJRUPGI.cjs');var _chunkP57VU27Wcjs = require('./chunk-P57VU27W.cjs');var F=async(t,r=null)=>{try{return await p(t,r)}catch(o){throw new (0, _chunkP57VU27Wcjs.d)("Failed to extract files from compute response",_chunkP57VU27Wcjs.f.INVALID_STATE,{context:{originalError:o instanceof Error?o.message:String(o)},originalError:o instanceof Error?o:void 0})}},m= exports.b =async(t,r,o=null)=>{if(typeof document>"u"||typeof Blob>"u")throw new (0, _chunkP57VU27Wcjs.d)("File download functionality is only available in browser environments. This function requires the DOM API (document, Blob).",_chunkP57VU27Wcjs.f.BROWSER_ONLY,{context:{environment:typeof window<"u"?"browser (SSR)":"Node.js",documentAvailable:typeof document<"u",blobAvailable:typeof Blob<"u"}});try{let e=await p(t,o);await w(e,r)}catch(e){throw e instanceof _chunkP57VU27Wcjs.d?e:new (0, _chunkP57VU27Wcjs.d)("Failed to download files from compute response",_chunkP57VU27Wcjs.f.INVALID_STATE,{context:{originalError:e instanceof Error?e.message:String(e)},originalError:e instanceof Error?e:void 0})}},p=async(t,r)=>{let o=[];if(t.forEach(e=>{let a=`${e.FileName}${e.FileType}`;if(e.SubFolder&&e.SubFolder.trim()!==""&&(a=`${e.SubFolder}/${a}`),e.IsBase64Encoded===!0&&e.Data){let n=_chunk5DJRUPGIcjs.c.call(void 0, e.Data);o.push({fileName:`${e.FileName}${e.FileType}`,content:new Uint8Array(n.buffer),path:a})}else e.IsBase64Encoded===!1&&e.Data&&o.push({fileName:`${e.FileName}${e.FileType}`,content:e.Data,path:a})}),r){let e=Array.isArray(r)?r:[r],a=await Promise.all(e.map(async n=>{try{let i=await fetch(n.FilePath);if(!i.ok)return _chunkP57VU27Wcjs.j.call(void 0, ).warn(`Failed to fetch additional file from URL: ${n.FilePath}`),null;let u=await(await i.blob()).arrayBuffer();return{fileName:n.FileName,content:new Uint8Array(u),path:n.FileName}}catch(i){return _chunkP57VU27Wcjs.j.call(void 0, ).error(`Error fetching additional file from URL: ${n.FilePath}`,i),null}}));o.push(...a.filter(n=>n!==null))}return o};async function w(t,r){let{zipSync:o,strToU8:e}=await Promise.resolve().then(() => _interopRequireWildcard(require("fflate"))),a={};t.forEach(l=>{a[l.path]=typeof l.content=="string"?e(l.content):l.content});let n=o(a,{level:6}),i=new Blob([n],{type:"application/zip"});y(i,`${r}.zip`)}function y(t,r){if(typeof document>"u")throw new (0, _chunkP57VU27Wcjs.d)("saveFile requires a browser environment with DOM API access.",_chunkP57VU27Wcjs.f.BROWSER_ONLY,{context:{function:"saveFile",requiredAPI:"document"}});let o=document.createElement("a");o.href=URL.createObjectURL(t),o.download=r,o.click(),URL.revokeObjectURL(o.href)}exports.a = F; exports.b = m;
|
|
2
|
-
//# sourceMappingURL=chunk-TVCJBLSW.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/felix/coding/selva-compute/dist/chunk-TVCJBLSW.cjs","../src/features/file-handling/handle-files.ts"],"names":["extractFilesFromComputeResponse","downloadableFiles","additionalFiles","processFiles","err","RhinoComputeError","ErrorCodes","downloadFileData","fileFoldername","processedFiles","createAndDownloadZip","dataItems","item","filePath"],"mappings":"AAAA,mZAAwC,wDAAuD,ICoBlFA,CAAAA,CAAkC,KAAA,CAC9CC,CAAAA,CACAC,CAAAA,CAAwD,IAAA,CAAA,EAC1B,CAC9B,GAAI,CACH,OAAO,MAAMC,CAAAA,CAAaF,CAAAA,CAAmBC,CAAe,CAC7D,CAAA,KAAA,CAASE,CAAAA,CAAK,CACb,MAAM,IAAIC,wBAAAA,CACT,+CAAA,CACAC,mBAAAA,CAAW,aAAA,CACX,CACC,OAAA,CAAS,CAAE,aAAA,CAAeF,EAAAA,WAAe,KAAA,CAAQA,CAAAA,CAAI,OAAA,CAAU,MAAA,CAAOA,CAAG,CAAE,CAAA,CAC3E,aAAA,CAAeA,EAAAA,WAAe,KAAA,CAAQA,CAAAA,CAAM,KAAA,CAC7C,CACD,CACD,CACD,CAAA,CAeaG,CAAAA,aAAmB,KAAA,CAC/BN,CAAAA,CACAO,CAAAA,CACAN,CAAAA,CAAwD,IAAA,CAAA,EACrC,CAEnB,EAAA,CAAI,OAAO,QAAA,CAAa,GAAA,EAAe,OAAO,IAAA,CAAS,GAAA,CACtD,MAAM,IAAIG,wBAAAA,CACT,6HAAA,CACAC,mBAAAA,CAAW,YAAA,CACX,CACC,OAAA,CAAS,CACR,WAAA,CAAa,OAAO,MAAA,CAAW,GAAA,CAAc,eAAA,CAAkB,SAAA,CAC/D,iBAAA,CAAmB,OAAO,QAAA,CAAa,GAAA,CACvC,aAAA,CAAe,OAAO,IAAA,CAAS,GAChC,CACD,CACD,CAAA,CAGD,GAAI,CACH,IAAMG,CAAAA,CAAiB,MAAMN,CAAAA,CAAaF,CAAAA,CAAmBC,CAAe,CAAA,CAC5E,MAAMQ,CAAAA,CAAqBD,CAAAA,CAAgBD,CAAc,CAC1D,CAAA,KAAA,CAASJ,CAAAA,CAAK,CAEb,MAAIA,EAAAA,WAAeC,mBAAAA,CACZD,CAAAA,CAED,IAAIC,wBAAAA,CACT,gDAAA,CACAC,mBAAAA,CAAW,aAAA,CACX,CACC,OAAA,CAAS,CAAE,aAAA,CAAeF,EAAAA,WAAe,KAAA,CAAQA,CAAAA,CAAI,OAAA,CAAU,MAAA,CAAOA,CAAG,CAAE,CAAA,CAC3E,aAAA,CAAeA,EAAAA,WAAe,KAAA,CAAQA,CAAAA,CAAM,KAAA,CAC7C,CACD,CACD,CACD,CAAA,CAUMD,CAAAA,CAAe,KAAA,CACpBQ,CAAAA,CACAT,CAAAA,CAAAA,EAC8B,CAC9B,IAAMO,CAAAA,CAAkC,CAAC,CAAA,CA0BzC,EAAA,CAvBAE,CAAAA,CAAU,OAAA,CAASC,CAAAA,EAAS,CAC3B,IAAIC,CAAAA,CAAW,CAAA,EAAA","file":"/Users/felix/coding/selva-compute/dist/chunk-TVCJBLSW.cjs","sourcesContent":[null,"import { RhinoComputeError, ErrorCodes, getLogger } from '@/core';\nimport { decodeBase64ToBinary } from '@/core/utils/encoding';\n\nimport { FileBaseInfo, FileData, ProcessedFile } from './types';\n\n/**\n * Extracts and processes files from compute response data without downloading them.\n * Returns an array of ProcessedFile objects that can be used programmatically.\n *\n * @param downloadableFiles - An array of FileData items from the compute response.\n * @param additionalFiles - Optional additional files to include (fetched from URLs).\n * @returns A Promise resolving to an array of ProcessedFile objects.\n * @throws Will throw an error if file processing fails.\n *\n * @example\n * const files = await extractFilesFromComputeResponse(fileData);\n * files.forEach(file => {\n * console.log(`File: ${file.fileName}, Size: ${file.content.length}`);\n * });\n */\nexport const extractFilesFromComputeResponse = async (\n\tdownloadableFiles: FileData[],\n\tadditionalFiles: FileBaseInfo[] | FileBaseInfo | null = null\n): Promise<ProcessedFile[]> => {\n\ttry {\n\t\treturn await processFiles(downloadableFiles, additionalFiles);\n\t} catch (err) {\n\t\tthrow new RhinoComputeError(\n\t\t\t'Failed to extract files from compute response',\n\t\t\tErrorCodes.INVALID_STATE,\n\t\t\t{\n\t\t\t\tcontext: { originalError: err instanceof Error ? err.message : String(err) },\n\t\t\t\toriginalError: err instanceof Error ? err : undefined\n\t\t\t}\n\t\t);\n\t}\n};\n\n/**\n * Downloads files from a compute response as a ZIP archive.\n * Packages multiple files into a single ZIP file and triggers a browser download.\n *\n * @param downloadableFiles - An array of FileData items from the compute response.\n * @param additionalFiles - Optional additional files to include in the ZIP (fetched from URLs).\n * @param fileFoldername - The name of the ZIP file (without extension).\n * @throws Will throw an error if the file handling or download fails.\n *\n * @example\n * await downloadDataFromComputeResponse(fileData, null, 'my-export');\n * // Downloads 'my-export.zip'\n */\nexport const downloadFileData = async (\n\tdownloadableFiles: FileData[],\n\tfileFoldername: string,\n\tadditionalFiles: FileBaseInfo[] | FileBaseInfo | null = null\n): Promise<void> => {\n\t// Check if we're in a browser environment\n\tif (typeof document === 'undefined' || typeof Blob === 'undefined') {\n\t\tthrow new RhinoComputeError(\n\t\t\t'File download functionality is only available in browser environments. This function requires the DOM API (document, Blob).',\n\t\t\tErrorCodes.BROWSER_ONLY,\n\t\t\t{\n\t\t\t\tcontext: {\n\t\t\t\t\tenvironment: typeof window !== 'undefined' ? 'browser (SSR)' : 'Node.js',\n\t\t\t\t\tdocumentAvailable: typeof document !== 'undefined',\n\t\t\t\t\tblobAvailable: typeof Blob !== 'undefined'\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\n\ttry {\n\t\tconst processedFiles = await processFiles(downloadableFiles, additionalFiles);\n\t\tawait createAndDownloadZip(processedFiles, fileFoldername);\n\t} catch (err) {\n\t\t// Re-throw if it's already a RhinoComputeError\n\t\tif (err instanceof RhinoComputeError) {\n\t\t\tthrow err;\n\t\t}\n\t\tthrow new RhinoComputeError(\n\t\t\t'Failed to download files from compute response',\n\t\t\tErrorCodes.INVALID_STATE,\n\t\t\t{\n\t\t\t\tcontext: { originalError: err instanceof Error ? err.message : String(err) },\n\t\t\t\toriginalError: err instanceof Error ? err : undefined\n\t\t\t}\n\t\t);\n\t}\n};\n\n/**\n * Processes files from compute response data and additional files.\n * Converts base64-encoded data to binary and fetches additional files from URLs.\n *\n * @param dataItems - An array of FileData items to process.\n * @param additionalFiles - Optional additional files to fetch and include.\n * @returns A Promise resolving to an array of ProcessedFile objects.\n */\nconst processFiles = async (\n\tdataItems: FileData[],\n\tadditionalFiles: FileBaseInfo[] | FileBaseInfo | null\n): Promise<ProcessedFile[]> => {\n\tconst processedFiles: ProcessedFile[] = [];\n\n\t// Process compute response files\n\tdataItems.forEach((item) => {\n\t\tlet filePath = `${item.FileName}${item.FileType}`;\n\n\t\tif (item.SubFolder && item.SubFolder.trim() !== '') {\n\t\t\tfilePath = `${item.SubFolder}/${filePath}`;\n\t\t}\n\n\t\tif (item.IsBase64Encoded === true && item.Data) {\n\t\t\tconst bites = decodeBase64ToBinary(item.Data);\n\t\t\tprocessedFiles.push({\n\t\t\t\tfileName: `${item.FileName}${item.FileType}`,\n\t\t\t\tcontent: new Uint8Array(bites.buffer),\n\t\t\t\tpath: filePath\n\t\t\t});\n\t\t} else if (item.IsBase64Encoded === false && item.Data) {\n\t\t\tprocessedFiles.push({\n\t\t\t\tfileName: `${item.FileName}${item.FileType}`,\n\t\t\t\tcontent: item.Data,\n\t\t\t\tpath: filePath\n\t\t\t});\n\t\t}\n\t});\n\n\tif (additionalFiles) {\n\t\tconst filesArray = Array.isArray(additionalFiles) ? additionalFiles : [additionalFiles];\n\t\tconst additionalProcessed = await Promise.all(\n\t\t\tfilesArray.map(async (file) => {\n\t\t\t\ttry {\n\t\t\t\t\tconst response = await fetch(file.FilePath);\n\t\t\t\t\tif (!response.ok) {\n\t\t\t\t\t\tgetLogger().warn(`Failed to fetch additional file from URL: ${file.FilePath}`);\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\tconst fileBlob = await response.blob();\n\t\t\t\t\tconst arrayBuffer = await fileBlob.arrayBuffer();\n\t\t\t\t\treturn {\n\t\t\t\t\t\tfileName: file.FileName,\n\t\t\t\t\t\tcontent: new Uint8Array(arrayBuffer),\n\t\t\t\t\t\tpath: file.FileName\n\t\t\t\t\t} as ProcessedFile;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tgetLogger().error(`Error fetching additional file from URL: ${file.FilePath}`, error);\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t})\n\t\t);\n\n\t\tprocessedFiles.push(...additionalProcessed.filter((f): f is ProcessedFile => f !== null));\n\t}\n\n\treturn processedFiles;\n};\n\n/**\n * Creates a ZIP archive from processed files and triggers a browser download.\n *\n * @param files - An array of ProcessedFile objects to include in the ZIP.\n * @param zipName - The name of the ZIP file (without extension).\n * @returns A Promise that resolves when the ZIP is generated and download is triggered.\n */\nasync function createAndDownloadZip(files: ProcessedFile[], zipName: string): Promise<void> {\n\tconst { zipSync, strToU8 } = await import('fflate');\n\n\t// Convert files to fflate format\n\tconst zipData: Record<string, Uint8Array> = {};\n\tfiles.forEach((file) => {\n\t\tzipData[file.path] = typeof file.content === 'string' ? strToU8(file.content) : file.content;\n\t});\n\n\tconst zipped = zipSync(zipData, { level: 6 });\n\n\tconst blob = new Blob([zipped as BlobPart], { type: 'application/zip' });\n\tsaveFile(blob, `${zipName}.zip`);\n}\n\n/**\n * Saves a Blob object as a file in the user's browser.\n *\n * @param blob - The Blob object representing the file content.\n * @param filename - The name to give the downloaded file (including extension).\n * @throws {RhinoComputeError} If not running in a browser environment.\n */\nfunction saveFile(blob: Blob, filename: string) {\n\tif (typeof document === 'undefined') {\n\t\tthrow new RhinoComputeError(\n\t\t\t'saveFile requires a browser environment with DOM API access.',\n\t\t\tErrorCodes.BROWSER_ONLY,\n\t\t\t{\n\t\t\t\tcontext: { function: 'saveFile', requiredAPI: 'document' }\n\t\t\t}\n\t\t);\n\t}\n\n\tconst a = document.createElement('a');\n\ta.href = URL.createObjectURL(blob);\n\ta.download = filename;\n\ta.click();\n\tURL.revokeObjectURL(a.href);\n}\n"]}
|
package/dist/files.cjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkTVCJBLSWcjs = require('./chunk-TVCJBLSW.cjs');require('./chunk-5DJRUPGI.cjs');require('./chunk-P57VU27W.cjs');exports.downloadFileData = _chunkTVCJBLSWcjs.b; exports.extractFilesFromComputeResponse = _chunkTVCJBLSWcjs.a;
|
|
2
|
-
//# sourceMappingURL=files.cjs.map
|
package/dist/files.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/felix/coding/selva-compute/dist/files.cjs"],"names":[],"mappings":"AAAA,iIAAqC,gCAA6B,gCAA6B,8GAAmE","file":"/Users/felix/coding/selva-compute/dist/files.cjs"}
|
package/dist/files.d.cts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { F as FileData, a as FileBaseInfo, P as ProcessedFile } from './types-SwbLAMW8.cjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Extracts and processes files from compute response data without downloading them.
|
|
5
|
-
* Returns an array of ProcessedFile objects that can be used programmatically.
|
|
6
|
-
*
|
|
7
|
-
* @param downloadableFiles - An array of FileData items from the compute response.
|
|
8
|
-
* @param additionalFiles - Optional additional files to include (fetched from URLs).
|
|
9
|
-
* @returns A Promise resolving to an array of ProcessedFile objects.
|
|
10
|
-
* @throws Will throw an error if file processing fails.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* const files = await extractFilesFromComputeResponse(fileData);
|
|
14
|
-
* files.forEach(file => {
|
|
15
|
-
* console.log(`File: ${file.fileName}, Size: ${file.content.length}`);
|
|
16
|
-
* });
|
|
17
|
-
*/
|
|
18
|
-
declare const extractFilesFromComputeResponse: (downloadableFiles: FileData[], additionalFiles?: FileBaseInfo[] | FileBaseInfo | null) => Promise<ProcessedFile[]>;
|
|
19
|
-
/**
|
|
20
|
-
* Downloads files from a compute response as a ZIP archive.
|
|
21
|
-
* Packages multiple files into a single ZIP file and triggers a browser download.
|
|
22
|
-
*
|
|
23
|
-
* @param downloadableFiles - An array of FileData items from the compute response.
|
|
24
|
-
* @param additionalFiles - Optional additional files to include in the ZIP (fetched from URLs).
|
|
25
|
-
* @param fileFoldername - The name of the ZIP file (without extension).
|
|
26
|
-
* @throws Will throw an error if the file handling or download fails.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* await downloadDataFromComputeResponse(fileData, null, 'my-export');
|
|
30
|
-
* // Downloads 'my-export.zip'
|
|
31
|
-
*/
|
|
32
|
-
declare const downloadFileData: (downloadableFiles: FileData[], fileFoldername: string, additionalFiles?: FileBaseInfo[] | FileBaseInfo | null) => Promise<void>;
|
|
33
|
-
|
|
34
|
-
export { FileBaseInfo, FileData, ProcessedFile, downloadFileData, extractFilesFromComputeResponse };
|
package/dist/files.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { F as FileData, a as FileBaseInfo, P as ProcessedFile } from './types-SwbLAMW8.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Extracts and processes files from compute response data without downloading them.
|
|
5
|
-
* Returns an array of ProcessedFile objects that can be used programmatically.
|
|
6
|
-
*
|
|
7
|
-
* @param downloadableFiles - An array of FileData items from the compute response.
|
|
8
|
-
* @param additionalFiles - Optional additional files to include (fetched from URLs).
|
|
9
|
-
* @returns A Promise resolving to an array of ProcessedFile objects.
|
|
10
|
-
* @throws Will throw an error if file processing fails.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* const files = await extractFilesFromComputeResponse(fileData);
|
|
14
|
-
* files.forEach(file => {
|
|
15
|
-
* console.log(`File: ${file.fileName}, Size: ${file.content.length}`);
|
|
16
|
-
* });
|
|
17
|
-
*/
|
|
18
|
-
declare const extractFilesFromComputeResponse: (downloadableFiles: FileData[], additionalFiles?: FileBaseInfo[] | FileBaseInfo | null) => Promise<ProcessedFile[]>;
|
|
19
|
-
/**
|
|
20
|
-
* Downloads files from a compute response as a ZIP archive.
|
|
21
|
-
* Packages multiple files into a single ZIP file and triggers a browser download.
|
|
22
|
-
*
|
|
23
|
-
* @param downloadableFiles - An array of FileData items from the compute response.
|
|
24
|
-
* @param additionalFiles - Optional additional files to include in the ZIP (fetched from URLs).
|
|
25
|
-
* @param fileFoldername - The name of the ZIP file (without extension).
|
|
26
|
-
* @throws Will throw an error if the file handling or download fails.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* await downloadDataFromComputeResponse(fileData, null, 'my-export');
|
|
30
|
-
* // Downloads 'my-export.zip'
|
|
31
|
-
*/
|
|
32
|
-
declare const downloadFileData: (downloadableFiles: FileData[], fileFoldername: string, additionalFiles?: FileBaseInfo[] | FileBaseInfo | null) => Promise<void>;
|
|
33
|
-
|
|
34
|
-
export { FileBaseInfo, FileData, ProcessedFile, downloadFileData, extractFilesFromComputeResponse };
|
package/dist/files.js
DELETED
package/dist/files.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This type is defining a FileData object that comes from the IO Compuceraptor components.
|
|
3
|
-
*/
|
|
4
|
-
type FileData = {
|
|
5
|
-
FileName: string;
|
|
6
|
-
Data: string;
|
|
7
|
-
/** eg. **.3dm** will be added to the file name*/
|
|
8
|
-
FileType: string;
|
|
9
|
-
/** Helps to determine if the file needs to be decoded first */
|
|
10
|
-
IsBase64Encoded: boolean;
|
|
11
|
-
/** Create a directory structure to be used to create the the ZIP in the end @file handle-files.ts */
|
|
12
|
-
SubFolder: string;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Represents a processed file ready for use.
|
|
16
|
-
*/
|
|
17
|
-
type ProcessedFile = {
|
|
18
|
-
fileName: string;
|
|
19
|
-
content: Uint8Array | string;
|
|
20
|
-
path: string;
|
|
21
|
-
};
|
|
22
|
-
type FileBaseInfo = {
|
|
23
|
-
FileName: string;
|
|
24
|
-
FilePath: string;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export type { FileData as F, ProcessedFile as P, FileBaseInfo as a };
|
package/dist/types-SwbLAMW8.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This type is defining a FileData object that comes from the IO Compuceraptor components.
|
|
3
|
-
*/
|
|
4
|
-
type FileData = {
|
|
5
|
-
FileName: string;
|
|
6
|
-
Data: string;
|
|
7
|
-
/** eg. **.3dm** will be added to the file name*/
|
|
8
|
-
FileType: string;
|
|
9
|
-
/** Helps to determine if the file needs to be decoded first */
|
|
10
|
-
IsBase64Encoded: boolean;
|
|
11
|
-
/** Create a directory structure to be used to create the the ZIP in the end @file handle-files.ts */
|
|
12
|
-
SubFolder: string;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Represents a processed file ready for use.
|
|
16
|
-
*/
|
|
17
|
-
type ProcessedFile = {
|
|
18
|
-
fileName: string;
|
|
19
|
-
content: Uint8Array | string;
|
|
20
|
-
path: string;
|
|
21
|
-
};
|
|
22
|
-
type FileBaseInfo = {
|
|
23
|
-
FileName: string;
|
|
24
|
-
FilePath: string;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export type { FileData as F, ProcessedFile as P, FileBaseInfo as a };
|