@daytonaio/sdk 0.170.0 → 0.171.0-alpha.3
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/LICENSE +190 -0
- package/cjs/CodeInterpreter.d.ts +95 -0
- package/cjs/CodeInterpreter.d.ts.map +1 -0
- package/cjs/CodeInterpreter.js +297 -0
- package/cjs/CodeInterpreter.js.map +1 -0
- package/cjs/ComputerUse.d.ts +539 -0
- package/cjs/ComputerUse.d.ts.map +1 -0
- package/cjs/ComputerUse.js +808 -0
- package/cjs/ComputerUse.js.map +1 -0
- package/cjs/Daytona.d.ts +355 -0
- package/cjs/Daytona.d.ts.map +1 -0
- package/cjs/Daytona.js +527 -0
- package/cjs/Daytona.js.map +1 -0
- package/cjs/FileSystem.d.ts +371 -0
- package/cjs/FileSystem.d.ts.map +1 -0
- package/cjs/FileSystem.js +489 -0
- package/cjs/FileSystem.js.map +1 -0
- package/cjs/Git.d.ts +203 -0
- package/cjs/Git.d.ts.map +1 -0
- package/cjs/Git.js +326 -0
- package/cjs/Git.js.map +1 -0
- package/cjs/Image.d.ts +265 -0
- package/cjs/Image.d.ts.map +1 -0
- package/cjs/Image.js +586 -0
- package/cjs/Image.js.map +1 -0
- package/cjs/LspServer.d.ts +172 -0
- package/cjs/LspServer.d.ts.map +1 -0
- package/cjs/LspServer.js +259 -0
- package/cjs/LspServer.js.map +1 -0
- package/cjs/ObjectStorage.d.ts +79 -0
- package/cjs/ObjectStorage.d.ts.map +1 -0
- package/cjs/ObjectStorage.js +199 -0
- package/cjs/ObjectStorage.js.map +1 -0
- package/cjs/Process.d.ts +490 -0
- package/cjs/Process.d.ts.map +1 -0
- package/cjs/Process.js +647 -0
- package/cjs/Process.js.map +1 -0
- package/cjs/PtyHandle.d.ts +155 -0
- package/cjs/PtyHandle.d.ts.map +1 -0
- package/cjs/PtyHandle.js +416 -0
- package/cjs/PtyHandle.js.map +1 -0
- package/cjs/README.md +180 -0
- package/cjs/Sandbox.d.ts +476 -0
- package/cjs/Sandbox.d.ts.map +1 -0
- package/cjs/Sandbox.js +905 -0
- package/cjs/Sandbox.js.map +1 -0
- package/cjs/Snapshot.d.ts +140 -0
- package/cjs/Snapshot.d.ts.map +1 -0
- package/cjs/Snapshot.js +248 -0
- package/cjs/Snapshot.js.map +1 -0
- package/cjs/Volume.d.ts +84 -0
- package/cjs/Volume.d.ts.map +1 -0
- package/cjs/Volume.js +119 -0
- package/cjs/Volume.js.map +1 -0
- package/cjs/__tests__/helpers.d.ts +6 -0
- package/cjs/__tests__/helpers.d.ts.map +1 -0
- package/cjs/__tests__/helpers.js +26 -0
- package/cjs/__tests__/helpers.js.map +1 -0
- package/cjs/errors/DaytonaError.d.ts +171 -0
- package/cjs/errors/DaytonaError.d.ts.map +1 -0
- package/cjs/errors/DaytonaError.js +258 -0
- package/cjs/errors/DaytonaError.js.map +1 -0
- package/cjs/index.d.ts +22 -0
- package/cjs/index.d.ts.map +1 -0
- package/cjs/index.js +49 -0
- package/cjs/index.js.map +1 -0
- package/cjs/package.json +3 -0
- package/cjs/types/Charts.d.ts +38 -0
- package/cjs/types/Charts.d.ts.map +1 -0
- package/cjs/types/Charts.js +37 -0
- package/cjs/types/Charts.js.map +1 -0
- package/cjs/types/CodeInterpreter.d.ts +77 -0
- package/cjs/types/CodeInterpreter.d.ts.map +1 -0
- package/cjs/types/CodeInterpreter.js +7 -0
- package/cjs/types/CodeInterpreter.js.map +1 -0
- package/cjs/types/ExecuteResponse.d.ts +26 -0
- package/cjs/types/ExecuteResponse.d.ts.map +1 -0
- package/cjs/types/ExecuteResponse.js +7 -0
- package/cjs/types/ExecuteResponse.js.map +1 -0
- package/cjs/types/Pty.d.ts +48 -0
- package/cjs/types/Pty.d.ts.map +1 -0
- package/cjs/types/Pty.js +7 -0
- package/cjs/types/Pty.js.map +1 -0
- package/cjs/utils/Binary.d.ts +39 -0
- package/cjs/utils/Binary.d.ts.map +1 -0
- package/cjs/utils/Binary.js +168 -0
- package/cjs/utils/Binary.js.map +1 -0
- package/cjs/utils/FileTransfer.d.ts +15 -0
- package/cjs/utils/FileTransfer.d.ts.map +1 -0
- package/cjs/utils/FileTransfer.js +261 -0
- package/cjs/utils/FileTransfer.js.map +1 -0
- package/cjs/utils/Import.d.ts +125 -0
- package/cjs/utils/Import.d.ts.map +1 -0
- package/cjs/utils/Import.js +112 -0
- package/cjs/utils/Import.js.map +1 -0
- package/cjs/utils/Multipart.d.ts +29 -0
- package/cjs/utils/Multipart.d.ts.map +1 -0
- package/cjs/utils/Multipart.js +115 -0
- package/cjs/utils/Multipart.js.map +1 -0
- package/cjs/utils/Runtime.d.ts +44 -0
- package/cjs/utils/Runtime.d.ts.map +1 -0
- package/cjs/utils/Runtime.js +95 -0
- package/cjs/utils/Runtime.js.map +1 -0
- package/cjs/utils/Stream.d.ts +20 -0
- package/cjs/utils/Stream.d.ts.map +1 -0
- package/cjs/utils/Stream.js +364 -0
- package/cjs/utils/Stream.js.map +1 -0
- package/cjs/utils/WebSocket.d.ts +10 -0
- package/cjs/utils/WebSocket.d.ts.map +1 -0
- package/cjs/utils/WebSocket.js +26 -0
- package/cjs/utils/WebSocket.js.map +1 -0
- package/cjs/utils/otel.decorator.d.ts +83 -0
- package/cjs/utils/otel.decorator.d.ts.map +1 -0
- package/cjs/utils/otel.decorator.js +141 -0
- package/cjs/utils/otel.decorator.js.map +1 -0
- package/esm/CodeInterpreter.d.ts +95 -0
- package/esm/CodeInterpreter.d.ts.map +1 -0
- package/esm/CodeInterpreter.js +292 -0
- package/esm/CodeInterpreter.js.map +1 -0
- package/esm/ComputerUse.d.ts +539 -0
- package/esm/ComputerUse.d.ts.map +1 -0
- package/esm/ComputerUse.js +799 -0
- package/esm/ComputerUse.js.map +1 -0
- package/esm/Daytona.d.ts +355 -0
- package/esm/Daytona.d.ts.map +1 -0
- package/esm/Daytona.js +523 -0
- package/esm/Daytona.js.map +1 -0
- package/esm/FileSystem.d.ts +371 -0
- package/esm/FileSystem.d.ts.map +1 -0
- package/esm/FileSystem.js +485 -0
- package/esm/FileSystem.js.map +1 -0
- package/esm/Git.d.ts +203 -0
- package/esm/Git.d.ts.map +1 -0
- package/esm/Git.js +322 -0
- package/esm/Git.js.map +1 -0
- package/esm/Image.d.ts +265 -0
- package/esm/Image.d.ts.map +1 -0
- package/esm/Image.js +581 -0
- package/esm/Image.js.map +1 -0
- package/esm/LspServer.d.ts +172 -0
- package/esm/LspServer.d.ts.map +1 -0
- package/esm/LspServer.js +255 -0
- package/esm/LspServer.js.map +1 -0
- package/esm/ObjectStorage.d.ts +79 -0
- package/esm/ObjectStorage.d.ts.map +1 -0
- package/esm/ObjectStorage.js +195 -0
- package/esm/ObjectStorage.js.map +1 -0
- package/esm/Process.d.ts +490 -0
- package/esm/Process.d.ts.map +1 -0
- package/esm/Process.js +642 -0
- package/esm/Process.js.map +1 -0
- package/esm/PtyHandle.d.ts +155 -0
- package/esm/PtyHandle.d.ts.map +1 -0
- package/esm/PtyHandle.js +412 -0
- package/esm/PtyHandle.js.map +1 -0
- package/esm/README.md +180 -0
- package/esm/Sandbox.d.ts +476 -0
- package/esm/Sandbox.d.ts.map +1 -0
- package/esm/Sandbox.js +901 -0
- package/esm/Sandbox.js.map +1 -0
- package/esm/Snapshot.d.ts +140 -0
- package/esm/Snapshot.d.ts.map +1 -0
- package/esm/Snapshot.js +244 -0
- package/esm/Snapshot.js.map +1 -0
- package/esm/Volume.d.ts +84 -0
- package/esm/Volume.d.ts.map +1 -0
- package/esm/Volume.js +115 -0
- package/esm/Volume.js.map +1 -0
- package/esm/__tests__/helpers.d.ts +6 -0
- package/esm/__tests__/helpers.d.ts.map +1 -0
- package/esm/__tests__/helpers.js +20 -0
- package/esm/__tests__/helpers.js.map +1 -0
- package/esm/errors/DaytonaError.d.ts +171 -0
- package/esm/errors/DaytonaError.d.ts.map +1 -0
- package/esm/errors/DaytonaError.js +243 -0
- package/esm/errors/DaytonaError.js.map +1 -0
- package/esm/index.d.ts +22 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +21 -0
- package/esm/index.js.map +1 -0
- package/esm/package.json +3 -0
- package/esm/types/Charts.d.ts +38 -0
- package/esm/types/Charts.d.ts.map +1 -0
- package/esm/types/Charts.js +33 -0
- package/esm/types/Charts.js.map +1 -0
- package/esm/types/CodeInterpreter.d.ts +77 -0
- package/esm/types/CodeInterpreter.d.ts.map +1 -0
- package/esm/types/CodeInterpreter.js +6 -0
- package/esm/types/CodeInterpreter.js.map +1 -0
- package/esm/types/ExecuteResponse.d.ts +26 -0
- package/esm/types/ExecuteResponse.d.ts.map +1 -0
- package/esm/types/ExecuteResponse.js +6 -0
- package/esm/types/ExecuteResponse.js.map +1 -0
- package/esm/types/Pty.d.ts +48 -0
- package/esm/types/Pty.d.ts.map +1 -0
- package/esm/types/Pty.js +6 -0
- package/esm/types/Pty.js.map +1 -0
- package/esm/utils/Binary.d.ts +39 -0
- package/esm/utils/Binary.d.ts.map +1 -0
- package/esm/utils/Binary.js +157 -0
- package/esm/utils/Binary.js.map +1 -0
- package/esm/utils/FileTransfer.d.ts +15 -0
- package/esm/utils/FileTransfer.d.ts.map +1 -0
- package/esm/utils/FileTransfer.js +254 -0
- package/esm/utils/FileTransfer.js.map +1 -0
- package/esm/utils/Import.d.ts +95 -0
- package/esm/utils/Import.d.ts.map +1 -0
- package/esm/utils/Import.js +77 -0
- package/esm/utils/Import.js.map +1 -0
- package/esm/utils/Multipart.d.ts +29 -0
- package/esm/utils/Multipart.d.ts.map +1 -0
- package/esm/utils/Multipart.js +109 -0
- package/esm/utils/Multipart.js.map +1 -0
- package/esm/utils/Runtime.d.ts +44 -0
- package/esm/utils/Runtime.d.ts.map +1 -0
- package/esm/utils/Runtime.js +89 -0
- package/esm/utils/Runtime.js.map +1 -0
- package/esm/utils/Stream.d.ts +20 -0
- package/esm/utils/Stream.d.ts.map +1 -0
- package/esm/utils/Stream.js +360 -0
- package/esm/utils/Stream.js.map +1 -0
- package/esm/utils/WebSocket.d.ts +10 -0
- package/esm/utils/WebSocket.d.ts.map +1 -0
- package/esm/utils/WebSocket.js +22 -0
- package/esm/utils/WebSocket.js.map +1 -0
- package/esm/utils/otel.decorator.d.ts +83 -0
- package/esm/utils/otel.decorator.d.ts.map +1 -0
- package/esm/utils/otel.decorator.js +136 -0
- package/esm/utils/otel.decorator.js.map +1 -0
- package/package.json +20 -8
- package/src/ComputerUse.d.ts +4 -4
- package/src/ComputerUse.js +4 -4
- package/src/Sandbox.d.ts +1 -18
- package/src/Sandbox.js +0 -29
- package/src/Sandbox.js.map +1 -1
- package/src/__tests__/helpers.js +0 -2
- package/src/__tests__/helpers.js.map +1 -1
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2025 Daytona Platforms Inc.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.abortStream = abortStream;
|
|
8
|
+
exports.normalizeResponseStream = normalizeResponseStream;
|
|
9
|
+
exports.processDownloadFilesResponseWithBusboy = processDownloadFilesResponseWithBusboy;
|
|
10
|
+
exports.processDownloadFilesResponseWithBuffered = processDownloadFilesResponseWithBuffered;
|
|
11
|
+
const tslib_1 = require("tslib");
|
|
12
|
+
const buffer_1 = require("buffer");
|
|
13
|
+
const busboy_1 = tslib_1.__importDefault(require("busboy"));
|
|
14
|
+
const DaytonaError_1 = require("../errors/DaytonaError");
|
|
15
|
+
const Import_1 = require("./Import");
|
|
16
|
+
const Binary_1 = require("./Binary");
|
|
17
|
+
const Multipart_1 = require("./Multipart");
|
|
18
|
+
const Multipart_2 = require("./Multipart");
|
|
19
|
+
/**
|
|
20
|
+
* Parses a bulk-download error part into the legacy message and structured metadata.
|
|
21
|
+
*/
|
|
22
|
+
function parseDownloadErrorPart(data, contentType) {
|
|
23
|
+
let message = new TextDecoder('utf-8').decode(data).trim();
|
|
24
|
+
if (!contentType || !/application\/json/i.test(contentType)) {
|
|
25
|
+
return { message };
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const payload = JSON.parse(message);
|
|
29
|
+
if (!payload || typeof payload !== 'object' || Array.isArray(payload)) {
|
|
30
|
+
return { message };
|
|
31
|
+
}
|
|
32
|
+
const payloadObject = payload;
|
|
33
|
+
const structuredMessage = payloadObject.message;
|
|
34
|
+
const statusCode = payloadObject.statusCode ?? payloadObject.status_code;
|
|
35
|
+
const errorCode = payloadObject.code ?? payloadObject.error_code;
|
|
36
|
+
if (typeof structuredMessage === 'string') {
|
|
37
|
+
message = structuredMessage;
|
|
38
|
+
}
|
|
39
|
+
return {
|
|
40
|
+
message,
|
|
41
|
+
errorDetails: {
|
|
42
|
+
message,
|
|
43
|
+
statusCode: typeof statusCode === 'number' ? statusCode : undefined,
|
|
44
|
+
errorCode: typeof errorCode === 'string' ? errorCode : undefined,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return { message };
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Records a per-file error part on the corresponding download metadata entry.
|
|
54
|
+
*/
|
|
55
|
+
function assignDownloadErrorPart(metadata, data, contentType) {
|
|
56
|
+
const { message, errorDetails } = parseDownloadErrorPart(data, contentType);
|
|
57
|
+
metadata.error = message;
|
|
58
|
+
metadata.errorDetails = errorDetails;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Safely aborts a stream
|
|
62
|
+
*/
|
|
63
|
+
function abortStream(stream) {
|
|
64
|
+
if (stream && typeof stream.destroy === 'function') {
|
|
65
|
+
stream.destroy();
|
|
66
|
+
}
|
|
67
|
+
else if (stream && typeof stream.cancel === 'function') {
|
|
68
|
+
stream.cancel();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Normalizes response data to extract the actual stream
|
|
73
|
+
*/
|
|
74
|
+
function normalizeResponseStream(responseData) {
|
|
75
|
+
if (!responseData || typeof responseData !== 'object') {
|
|
76
|
+
return responseData;
|
|
77
|
+
}
|
|
78
|
+
// WHATWG ReadableStream
|
|
79
|
+
if (responseData.body && typeof responseData.body.getReader === 'function') {
|
|
80
|
+
return responseData.body;
|
|
81
|
+
}
|
|
82
|
+
// Some adapters use .stream
|
|
83
|
+
if (responseData.stream) {
|
|
84
|
+
return responseData.stream;
|
|
85
|
+
}
|
|
86
|
+
return responseData;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Processes multipart response using busboy (Node.js path)
|
|
90
|
+
*/
|
|
91
|
+
async function processDownloadFilesResponseWithBusboy(stream, headers, metadataMap, onFileStream) {
|
|
92
|
+
const fileTasks = [];
|
|
93
|
+
await new Promise((resolve, reject) => {
|
|
94
|
+
const bb = (0, busboy_1.default)({
|
|
95
|
+
headers,
|
|
96
|
+
preservePath: true,
|
|
97
|
+
});
|
|
98
|
+
bb.on('file', (fieldName, fileStream, fileInfo) => {
|
|
99
|
+
const source = fileInfo?.filename;
|
|
100
|
+
if (!source) {
|
|
101
|
+
abortStream(stream);
|
|
102
|
+
reject(new DaytonaError_1.DaytonaError(`Received unexpected file "${fileInfo?.filename}".`));
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const metadata = metadataMap.get(source);
|
|
106
|
+
if (!metadata) {
|
|
107
|
+
abortStream(stream);
|
|
108
|
+
reject(new DaytonaError_1.DaytonaError(`Target metadata missing for valid source: ${source}`));
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (fieldName === 'error') {
|
|
112
|
+
// Collect per-file error metadata.
|
|
113
|
+
const chunks = [];
|
|
114
|
+
fileStream.on('data', (chunk) => chunks.push(chunk));
|
|
115
|
+
fileStream.on('end', () => {
|
|
116
|
+
assignDownloadErrorPart(metadata, buffer_1.Buffer.concat(chunks), fileInfo?.mimeType);
|
|
117
|
+
});
|
|
118
|
+
fileStream.on('error', (err) => {
|
|
119
|
+
metadata.error = `Stream error: ${err.message}`;
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
else if (fieldName === 'file') {
|
|
123
|
+
if (onFileStream) {
|
|
124
|
+
onFileStream(source, fileStream);
|
|
125
|
+
}
|
|
126
|
+
else if (metadata.destination) {
|
|
127
|
+
// Stream to file
|
|
128
|
+
fileTasks.push(new Promise((resolveTask) => {
|
|
129
|
+
(0, Import_1.dynamicImport)('fs', 'Downloading files to local files is not supported: ').then((fs) => {
|
|
130
|
+
const writeStream = fs.createWriteStream(metadata.destination, { autoClose: true });
|
|
131
|
+
fileStream.pipe(writeStream);
|
|
132
|
+
writeStream.on('finish', () => {
|
|
133
|
+
metadata.result = metadata.destination;
|
|
134
|
+
resolveTask();
|
|
135
|
+
});
|
|
136
|
+
writeStream.on('error', (err) => {
|
|
137
|
+
metadata.error = `Write stream failed: ${err.message}`;
|
|
138
|
+
resolveTask();
|
|
139
|
+
});
|
|
140
|
+
fileStream.on('error', (err) => {
|
|
141
|
+
metadata.error = `Read stream failed: ${err.message}`;
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
}));
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
// Collect to buffer
|
|
148
|
+
const chunks = [];
|
|
149
|
+
fileStream.on('data', (chunk) => {
|
|
150
|
+
chunks.push(buffer_1.Buffer.isBuffer(chunk) ? chunk : buffer_1.Buffer.from(chunk));
|
|
151
|
+
});
|
|
152
|
+
fileStream.on('end', () => {
|
|
153
|
+
metadata.result = buffer_1.Buffer.concat(chunks);
|
|
154
|
+
});
|
|
155
|
+
fileStream.on('error', (err) => {
|
|
156
|
+
metadata.error = `Read failed: ${err.message}`;
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
// Unknown field, drain it
|
|
162
|
+
fileStream.resume();
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
bb.on('error', (err) => {
|
|
166
|
+
abortStream(stream);
|
|
167
|
+
reject(err);
|
|
168
|
+
});
|
|
169
|
+
bb.on('finish', resolve);
|
|
170
|
+
// Feed stream into busboy
|
|
171
|
+
feedStreamToBusboy(stream, bb).catch((err) => bb.destroy(err));
|
|
172
|
+
});
|
|
173
|
+
await Promise.all(fileTasks);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Feeds various stream types into busboy
|
|
177
|
+
*/
|
|
178
|
+
async function feedStreamToBusboy(stream, bb) {
|
|
179
|
+
// Node.js stream (piping)
|
|
180
|
+
if (typeof stream?.pipe === 'function') {
|
|
181
|
+
stream.pipe(bb);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
// Direct buffer-like data
|
|
185
|
+
if (typeof stream === 'string' || stream instanceof ArrayBuffer || ArrayBuffer.isView(stream)) {
|
|
186
|
+
const data = (0, Binary_1.toUint8Array)(stream);
|
|
187
|
+
bb.write(buffer_1.Buffer.from(data));
|
|
188
|
+
bb.end();
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
// WHATWG ReadableStream
|
|
192
|
+
if (typeof stream?.getReader === 'function') {
|
|
193
|
+
const reader = stream.getReader();
|
|
194
|
+
while (true) {
|
|
195
|
+
const { done, value } = await reader.read();
|
|
196
|
+
if (done)
|
|
197
|
+
break;
|
|
198
|
+
bb.write(buffer_1.Buffer.from(value));
|
|
199
|
+
}
|
|
200
|
+
bb.end();
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
// AsyncIterable
|
|
204
|
+
if (stream?.[Symbol.asyncIterator]) {
|
|
205
|
+
for await (const chunk of stream) {
|
|
206
|
+
const buffer = buffer_1.Buffer.isBuffer(chunk) ? chunk : buffer_1.Buffer.from((0, Binary_1.toUint8Array)(chunk));
|
|
207
|
+
bb.write(buffer);
|
|
208
|
+
}
|
|
209
|
+
bb.end();
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
// Unsupported stream type
|
|
213
|
+
throw new DaytonaError_1.DaytonaError(`Unsupported stream type: ${stream?.constructor?.name || typeof stream}`);
|
|
214
|
+
}
|
|
215
|
+
async function processDownloadFilesResponseWithBuffered(stream, headers, metadataMap) {
|
|
216
|
+
const contentType = (0, Multipart_1.getHeader)(headers, 'content-type') || '';
|
|
217
|
+
const bodyBytes = await (0, Binary_1.collectStreamBytes)(stream);
|
|
218
|
+
// Try native FormData parsing for multipart/form-data
|
|
219
|
+
if (/^multipart\/form-data/i.test(contentType) && typeof Response !== 'undefined') {
|
|
220
|
+
try {
|
|
221
|
+
const formDataParts = await (0, Multipart_1.parseMultipartWithFormData)(bodyBytes, contentType);
|
|
222
|
+
for (const part of formDataParts) {
|
|
223
|
+
const metadata = metadataMap.get(part.filename);
|
|
224
|
+
if (!metadata) {
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
if (part.fieldName === 'error') {
|
|
228
|
+
assignDownloadErrorPart(metadata, part.data, part.contentType);
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
metadata.result = (0, Binary_1.toBuffer)(part.data);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
catch {
|
|
237
|
+
// Fall through to manual parsing
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
// Manual multipart parsing (handles multipart/mixed, etc.)
|
|
241
|
+
const boundary = (0, Multipart_1.extractBoundary)(contentType);
|
|
242
|
+
if (!boundary) {
|
|
243
|
+
throw new DaytonaError_1.DaytonaError(`Missing multipart boundary in Content-Type: "${contentType}"`);
|
|
244
|
+
}
|
|
245
|
+
const parts = (0, Multipart_2.parseMultipart)(bodyBytes, boundary);
|
|
246
|
+
for (const part of parts) {
|
|
247
|
+
if (!part.filename)
|
|
248
|
+
continue;
|
|
249
|
+
const metadata = metadataMap.get(part.filename);
|
|
250
|
+
if (!metadata)
|
|
251
|
+
continue;
|
|
252
|
+
if (part.name === 'error') {
|
|
253
|
+
assignDownloadErrorPart(metadata, part.data, part.headers['content-type']);
|
|
254
|
+
}
|
|
255
|
+
else if (part.name === 'file') {
|
|
256
|
+
metadata.result = (0, Binary_1.toBuffer)(part.data);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
//# sourceMappingURL=FileTransfer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileTransfer.js","sourceRoot":"","sources":["../../../../../../libs/sdk-typescript/src/utils/FileTransfer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAiEH,kCAMC;AAKD,0DAgBC;AAKD,wFA8FC;AA8CD,4FAoDC;;AA/RD,mCAA+B;AAC/B,4DAA2B;AAC3B,yDAAqD;AACrD,qCAAwC;AACxC,qCAAqE;AACrE,2CAAoF;AACpF,2CAA4C;AAQ5C;;GAEG;AACH,SAAS,sBAAsB,CAAC,IAAgB,EAAE,WAAoB;IACpE,IAAI,OAAO,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAA;IAC1D,IAAI,CAAC,WAAW,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;QAC5D,OAAO,EAAE,OAAO,EAAE,CAAA;IACpB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAY,CAAA;QAC9C,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACtE,OAAO,EAAE,OAAO,EAAE,CAAA;QACpB,CAAC;QAED,MAAM,aAAa,GAAG,OAAkC,CAAA;QACxD,MAAM,iBAAiB,GAAG,aAAa,CAAC,OAAO,CAAA;QAC/C,MAAM,UAAU,GAAG,aAAa,CAAC,UAAU,IAAI,aAAa,CAAC,WAAW,CAAA;QACxE,MAAM,SAAS,GAAG,aAAa,CAAC,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}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
declare const loaderMap: {
|
|
2
|
+
'fast-glob': () => Promise<{
|
|
3
|
+
default: typeof import("fast-glob");
|
|
4
|
+
sync(source: import("fast-glob/out/types").Pattern | import("fast-glob/out/types").Pattern[], options: import("fast-glob/out/settings").Options & ({
|
|
5
|
+
objectMode: true;
|
|
6
|
+
} | {
|
|
7
|
+
stats: true;
|
|
8
|
+
})): import("fast-glob/out/types").Entry[];
|
|
9
|
+
sync(source: import("fast-glob/out/types").Pattern | import("fast-glob/out/types").Pattern[], options?: import("fast-glob/out/settings").Options): string[];
|
|
10
|
+
stream(source: import("fast-glob/out/types").Pattern | import("fast-glob/out/types").Pattern[], options?: import("fast-glob/out/settings").Options): NodeJS.ReadableStream;
|
|
11
|
+
generateTasks(source: import("fast-glob/out/types").Pattern | import("fast-glob/out/types").Pattern[], options?: import("fast-glob/out/settings").Options): import("fast-glob").Task[];
|
|
12
|
+
isDynamicPattern(source: import("fast-glob/out/types").Pattern, options?: import("fast-glob/out/settings").Options): boolean;
|
|
13
|
+
escapePath(source: string): import("fast-glob/out/types").Pattern;
|
|
14
|
+
convertPathToPattern(source: string): import("fast-glob/out/types").Pattern;
|
|
15
|
+
glob: typeof import("fast-glob");
|
|
16
|
+
globSync: typeof import("fast-glob").sync;
|
|
17
|
+
globStream: typeof import("fast-glob").stream;
|
|
18
|
+
async: typeof import("fast-glob");
|
|
19
|
+
posix: typeof import("fast-glob").posix;
|
|
20
|
+
win32: typeof import("fast-glob").win32;
|
|
21
|
+
}>;
|
|
22
|
+
'@iarna/toml': () => Promise<{
|
|
23
|
+
default: typeof import("@iarna/toml");
|
|
24
|
+
parse: import("@iarna/toml").FuncParse;
|
|
25
|
+
stringify: import("@iarna/toml").FuncStringify;
|
|
26
|
+
}>;
|
|
27
|
+
stream: () => Promise<{
|
|
28
|
+
default: typeof import("stream");
|
|
29
|
+
Stream: typeof import("stream");
|
|
30
|
+
promises: typeof import("node:stream/promises");
|
|
31
|
+
duplexPair(options?: import("stream").DuplexOptions): [import("stream").Duplex, import("stream").Duplex];
|
|
32
|
+
addAbortSignal<T extends import("stream")>(signal: AbortSignal, stream: T): T;
|
|
33
|
+
getDefaultHighWaterMark(objectMode: boolean): number;
|
|
34
|
+
setDefaultHighWaterMark(objectMode: boolean, value: number): void;
|
|
35
|
+
finished: typeof import("stream").finished;
|
|
36
|
+
pipeline: typeof import("stream").pipeline;
|
|
37
|
+
isErrored(stream: import("stream").Readable | import("stream").Writable | NodeJS.ReadableStream | NodeJS.WritableStream): boolean;
|
|
38
|
+
isReadable(stream: import("stream").Readable | NodeJS.ReadableStream): boolean;
|
|
39
|
+
Readable: typeof import("stream").Readable;
|
|
40
|
+
Writable: typeof import("stream").Writable;
|
|
41
|
+
Duplex: typeof import("stream").Duplex;
|
|
42
|
+
Transform: typeof import("stream").Transform;
|
|
43
|
+
PassThrough: typeof import("stream").PassThrough;
|
|
44
|
+
errorMonitor: typeof import("events").errorMonitor;
|
|
45
|
+
captureRejectionSymbol: typeof import("events").captureRejectionSymbol;
|
|
46
|
+
captureRejections: boolean;
|
|
47
|
+
defaultMaxListeners: number;
|
|
48
|
+
EventEmitter: typeof import("events");
|
|
49
|
+
EventEmitterAsyncResource: typeof import("events").EventEmitterAsyncResource;
|
|
50
|
+
}>;
|
|
51
|
+
tar: () => Promise<{
|
|
52
|
+
default: typeof import("tar");
|
|
53
|
+
c: import("tar/dist/commonjs/make-command").TarCommand<import("tar").Pack, import("tar").PackSync>;
|
|
54
|
+
x: import("tar/dist/commonjs/make-command").TarCommand<import("tar").Unpack, import("tar").UnpackSync>;
|
|
55
|
+
t: import("tar/dist/commonjs/make-command").TarCommand<import("tar").Parser, import("tar").Parser & {
|
|
56
|
+
sync: true;
|
|
57
|
+
}>;
|
|
58
|
+
r: import("tar/dist/commonjs/make-command").TarCommand<never, never>;
|
|
59
|
+
types: typeof import("tar/dist/commonjs/types");
|
|
60
|
+
u: import("tar/dist/commonjs/make-command").TarCommand<never, never>;
|
|
61
|
+
create: import("tar/dist/commonjs/make-command").TarCommand<import("tar").Pack, import("tar").PackSync>;
|
|
62
|
+
extract: import("tar/dist/commonjs/make-command").TarCommand<import("tar").Unpack, import("tar").UnpackSync>;
|
|
63
|
+
Header: typeof import("tar").Header;
|
|
64
|
+
filesFilter: (opt: import("tar/dist/commonjs/options").TarOptions, files: string[]) => void;
|
|
65
|
+
list: import("tar/dist/commonjs/make-command").TarCommand<import("tar").Parser, import("tar").Parser & {
|
|
66
|
+
sync: true;
|
|
67
|
+
}>;
|
|
68
|
+
PackJob: typeof import("tar").PackJob;
|
|
69
|
+
Pack: typeof import("tar").Pack;
|
|
70
|
+
PackSync: typeof import("tar").PackSync;
|
|
71
|
+
Parser: typeof import("tar").Parser;
|
|
72
|
+
Pax: typeof import("tar").Pax;
|
|
73
|
+
ReadEntry: typeof import("tar").ReadEntry;
|
|
74
|
+
replace: import("tar/dist/commonjs/make-command").TarCommand<never, never>;
|
|
75
|
+
Unpack: typeof import("tar").Unpack;
|
|
76
|
+
UnpackSync: typeof import("tar").UnpackSync;
|
|
77
|
+
update: import("tar/dist/commonjs/make-command").TarCommand<never, never>;
|
|
78
|
+
WriteEntry: typeof import("tar").WriteEntry;
|
|
79
|
+
WriteEntrySync: typeof import("tar").WriteEntrySync;
|
|
80
|
+
WriteEntryTar: typeof import("tar").WriteEntryTar;
|
|
81
|
+
}>;
|
|
82
|
+
'expand-tilde': () => Promise<any>;
|
|
83
|
+
ObjectStorage: () => Promise<typeof import("../ObjectStorage.js")>;
|
|
84
|
+
fs: () => Promise<typeof import("fs")>;
|
|
85
|
+
'form-data': () => Promise<{
|
|
86
|
+
default: typeof import("form-data");
|
|
87
|
+
Stream: typeof import("stream");
|
|
88
|
+
promises: typeof import("node:stream/promises");
|
|
89
|
+
duplexPair(options?: import("stream").DuplexOptions): [import("stream").Duplex, import("stream").Duplex];
|
|
90
|
+
addAbortSignal<T extends import("stream")>(signal: AbortSignal, stream: T): T;
|
|
91
|
+
getDefaultHighWaterMark(objectMode: boolean): number;
|
|
92
|
+
setDefaultHighWaterMark(objectMode: boolean, value: number): void;
|
|
93
|
+
finished: typeof import("stream").finished;
|
|
94
|
+
pipeline: typeof import("stream").pipeline;
|
|
95
|
+
isErrored(stream: import("stream").Readable | import("stream").Writable | NodeJS.ReadableStream | NodeJS.WritableStream): boolean;
|
|
96
|
+
isReadable(stream: import("stream").Readable | NodeJS.ReadableStream): boolean;
|
|
97
|
+
Readable: typeof import("stream").Readable;
|
|
98
|
+
Writable: typeof import("stream").Writable;
|
|
99
|
+
Duplex: typeof import("stream").Duplex;
|
|
100
|
+
Transform: typeof import("stream").Transform;
|
|
101
|
+
PassThrough: typeof import("stream").PassThrough;
|
|
102
|
+
errorMonitor: typeof import("events").errorMonitor;
|
|
103
|
+
captureRejectionSymbol: typeof import("events").captureRejectionSymbol;
|
|
104
|
+
captureRejections: boolean;
|
|
105
|
+
defaultMaxListeners: number;
|
|
106
|
+
EventEmitter: typeof import("events");
|
|
107
|
+
EventEmitterAsyncResource: typeof import("events").EventEmitterAsyncResource;
|
|
108
|
+
}>;
|
|
109
|
+
util: () => Promise<typeof import("util")>;
|
|
110
|
+
};
|
|
111
|
+
declare const requireMap: {
|
|
112
|
+
'fast-glob': () => any;
|
|
113
|
+
'@iarna/toml': () => any;
|
|
114
|
+
stream: () => any;
|
|
115
|
+
tar: () => any;
|
|
116
|
+
'expand-tilde': () => any;
|
|
117
|
+
fs: () => any;
|
|
118
|
+
'form-data': () => any;
|
|
119
|
+
};
|
|
120
|
+
type ModuleMap = typeof loaderMap;
|
|
121
|
+
export declare function dynamicImport<K extends keyof ModuleMap>(name: K, errorPrefix?: string): Promise<Awaited<ReturnType<ModuleMap[K]>>>;
|
|
122
|
+
type RequireMap = typeof requireMap;
|
|
123
|
+
export declare function dynamicRequire<K extends keyof RequireMap>(name: K, errorPrefix?: string): ReturnType<RequireMap[K]>;
|
|
124
|
+
export {};
|
|
125
|
+
//# sourceMappingURL=Import.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Import.d.ts","sourceRoot":"","sources":["../../../../../../libs/sdk-typescript/src/utils/Import.ts"],"names":[],"mappings":"AAQA,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAOL,OAAO,CAAC,cAAc,IAAI,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;gBAE1B,OAAO,CAAC,cAAc,MAAM,CAAC,CAAC;CACzC,CAAA;AAED,QAAA,MAAM,UAAU;;;;;;;;CAQf,CAAA;AAaD,KAAK,SAAS,GAAG,OAAO,SAAS,CAAA;AAEjC,wBAAsB,aAAa,CAAC,CAAC,SAAS,MAAM,SAAS,EAC3D,IAAI,EAAE,CAAC,EACP,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAsB5C;AAED,KAAK,UAAU,GAAG,OAAO,UAAU,CAAA;AAEnC,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,UAAU,EAAE,IAAI,EAAE,CAAC,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAsBnH"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2025 Daytona Platforms Inc.
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
18
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
19
|
+
}) : function(o, v) {
|
|
20
|
+
o["default"] = v;
|
|
21
|
+
});
|
|
22
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
23
|
+
var ownKeys = function(o) {
|
|
24
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
25
|
+
var ar = [];
|
|
26
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
27
|
+
return ar;
|
|
28
|
+
};
|
|
29
|
+
return ownKeys(o);
|
|
30
|
+
};
|
|
31
|
+
return function (mod) {
|
|
32
|
+
if (mod && mod.__esModule) return mod;
|
|
33
|
+
var result = {};
|
|
34
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
35
|
+
__setModuleDefault(result, mod);
|
|
36
|
+
return result;
|
|
37
|
+
};
|
|
38
|
+
})();
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.dynamicImport = dynamicImport;
|
|
41
|
+
exports.dynamicRequire = dynamicRequire;
|
|
42
|
+
const DaytonaError_1 = require("../errors/DaytonaError");
|
|
43
|
+
const Runtime_1 = require("./Runtime");
|
|
44
|
+
const loaderMap = {
|
|
45
|
+
'fast-glob': () => Promise.resolve().then(() => __importStar(require('fast-glob'))),
|
|
46
|
+
'@iarna/toml': () => Promise.resolve().then(() => __importStar(require('@iarna/toml'))),
|
|
47
|
+
stream: () => Promise.resolve().then(() => __importStar(require('stream'))),
|
|
48
|
+
tar: () => Promise.resolve().then(() => __importStar(require('tar'))),
|
|
49
|
+
'expand-tilde': () => Promise.resolve().then(() => __importStar(require('expand-tilde'))),
|
|
50
|
+
ObjectStorage: () => Promise.resolve().then(() => __importStar(require('../ObjectStorage.js'))),
|
|
51
|
+
fs: () => Promise.resolve().then(() => __importStar(require('fs'))),
|
|
52
|
+
'form-data': () => Promise.resolve().then(() => __importStar(require('form-data'))),
|
|
53
|
+
util: () => Promise.resolve().then(() => __importStar(require('util'))),
|
|
54
|
+
};
|
|
55
|
+
const requireMap = {
|
|
56
|
+
'fast-glob': () => require('fast-glob'),
|
|
57
|
+
'@iarna/toml': () => require('@iarna/toml'),
|
|
58
|
+
stream: () => require('stream'),
|
|
59
|
+
tar: () => require('tar'),
|
|
60
|
+
'expand-tilde': () => require('expand-tilde'),
|
|
61
|
+
fs: () => require('fs'),
|
|
62
|
+
'form-data': () => require('form-data'),
|
|
63
|
+
};
|
|
64
|
+
const validateMap = {
|
|
65
|
+
'fast-glob': (mod) => typeof mod === 'function' && typeof mod?.sync === 'function',
|
|
66
|
+
'@iarna/toml': (mod) => typeof mod.parse === 'function' && typeof mod.stringify === 'function',
|
|
67
|
+
stream: (mod) => typeof mod.Readable === 'function' && typeof mod.Writable === 'function',
|
|
68
|
+
tar: (mod) => typeof mod.extract === 'function' && typeof mod.create === 'function',
|
|
69
|
+
'expand-tilde': (mod) => typeof mod === 'function',
|
|
70
|
+
fs: (mod) => typeof mod.createReadStream === 'function' && typeof mod.readFile === 'function',
|
|
71
|
+
'form-data': (mod) => typeof mod === 'function',
|
|
72
|
+
util: (mod) => typeof mod.promisify === 'function',
|
|
73
|
+
};
|
|
74
|
+
async function dynamicImport(name, errorPrefix) {
|
|
75
|
+
const loader = loaderMap[name];
|
|
76
|
+
if (!loader) {
|
|
77
|
+
throw new DaytonaError_1.DaytonaError(`${errorPrefix || ''} Unknown module "${name}"`);
|
|
78
|
+
}
|
|
79
|
+
let mod;
|
|
80
|
+
try {
|
|
81
|
+
mod = (await loader());
|
|
82
|
+
mod = mod?.default ?? mod;
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
86
|
+
throw new DaytonaError_1.DaytonaError(`${errorPrefix || ''} Module "${name}" is not available in the "${Runtime_1.RUNTIME}" runtime: ${msg}`);
|
|
87
|
+
}
|
|
88
|
+
if (validateMap[name] && !validateMap[name](mod)) {
|
|
89
|
+
throw new DaytonaError_1.DaytonaError(`${errorPrefix || ''} Module "${name}" didn't pass import validation in the "${Runtime_1.RUNTIME}" runtime`);
|
|
90
|
+
}
|
|
91
|
+
return mod;
|
|
92
|
+
}
|
|
93
|
+
function dynamicRequire(name, errorPrefix) {
|
|
94
|
+
const loader = requireMap[name];
|
|
95
|
+
if (!loader) {
|
|
96
|
+
throw new DaytonaError_1.DaytonaError(`${errorPrefix || ''} Unknown module "${name}"`);
|
|
97
|
+
}
|
|
98
|
+
let mod;
|
|
99
|
+
try {
|
|
100
|
+
mod = loader();
|
|
101
|
+
mod = mod?.default ?? mod;
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
105
|
+
throw new DaytonaError_1.DaytonaError(`${errorPrefix || ''} Module "${name}" is not available in the "${Runtime_1.RUNTIME}" runtime: ${msg}`);
|
|
106
|
+
}
|
|
107
|
+
if (validateMap[name] && !validateMap[name](mod)) {
|
|
108
|
+
throw new DaytonaError_1.DaytonaError(`${errorPrefix || ''} Module "${name}" didn't pass import validation in the "${Runtime_1.RUNTIME}" runtime`);
|
|
109
|
+
}
|
|
110
|
+
return mod;
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=Import.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Import.js","sourceRoot":"","sources":["../../../../../../libs/sdk-typescript/src/utils/Import.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;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YAAY,IAAI,2CAA2C,iBAAO,WAAW,CAClG,CAAA;IACH,CAAC;IAED,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface MultipartPart {
|
|
2
|
+
name: string | undefined;
|
|
3
|
+
filename: string | undefined;
|
|
4
|
+
headers: Record<string, string>;
|
|
5
|
+
data: Uint8Array;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Extracts the boundary from a Content-Type header
|
|
9
|
+
*/
|
|
10
|
+
export declare function extractBoundary(contentType: string): string | null;
|
|
11
|
+
/**
|
|
12
|
+
* Parses multipart/form-data or multipart/mixed response body
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseMultipart(body: Uint8Array, boundary: string): MultipartPart[];
|
|
15
|
+
/**
|
|
16
|
+
* Parses multipart response using browser's native FormData API
|
|
17
|
+
* This is more reliable than manual parsing when available
|
|
18
|
+
*/
|
|
19
|
+
export declare function parseMultipartWithFormData(bodyBytes: Uint8Array, contentType: string): Promise<Array<{
|
|
20
|
+
fieldName: string;
|
|
21
|
+
filename: string;
|
|
22
|
+
contentType: string;
|
|
23
|
+
data: Uint8Array;
|
|
24
|
+
}>>;
|
|
25
|
+
/**
|
|
26
|
+
* Extracts a header value from response headers (case-insensitive)
|
|
27
|
+
*/
|
|
28
|
+
export declare function getHeader(headers: any, key: string): string | undefined;
|
|
29
|
+
//# sourceMappingURL=Multipart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Multipart.d.ts","sourceRoot":"","sources":["../../../../../../libs/sdk-typescript/src/utils/Multipart.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;IACxB,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAA;IAC5B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,IAAI,EAAE,UAAU,CAAA;CACjB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGlE;AAWD;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,aAAa,EAAE,CAmDlF;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAC9C,SAAS,EAAE,UAAU,EACrB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,KAAK,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,CAAC,CA4BhG;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAMvE"}
|