@delopay/sdk 0.167.0 → 0.169.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/dist/{chunk-RWCROWXW.js → chunk-ZBNUOFNR.js} +29 -15
- package/dist/chunk-ZBNUOFNR.js.map +1 -0
- package/dist/index.cjs +28 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +124 -2
- package/dist/index.d.ts +124 -2
- package/dist/index.js +1 -1
- package/dist/internal.cjs +28 -14
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-RWCROWXW.js.map +0 -1
|
@@ -1063,6 +1063,26 @@ var JsonArrayRecordCounter = class {
|
|
|
1063
1063
|
|
|
1064
1064
|
// src/exportDownload.ts
|
|
1065
1065
|
var RECORD_COUNT_HEADER = "x-delopay-record-count";
|
|
1066
|
+
var PRESENTATION_HEADER = "X-Delopay-Export-Presentation";
|
|
1067
|
+
var MAX_PRESENTATION_HEADER = 6 * 1024;
|
|
1068
|
+
function encodePresentation(presentation) {
|
|
1069
|
+
const bytes = new TextEncoder().encode(JSON.stringify(presentation));
|
|
1070
|
+
let binary = "";
|
|
1071
|
+
for (const byte of bytes) binary += String.fromCharCode(byte);
|
|
1072
|
+
const encoded = btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
1073
|
+
if (encoded.length > MAX_PRESENTATION_HEADER) {
|
|
1074
|
+
throw new DelopayError(
|
|
1075
|
+
`Export presentation is ${encoded.length} bytes encoded; the server reads at most ${MAX_PRESENTATION_HEADER}`,
|
|
1076
|
+
{
|
|
1077
|
+
status: 0,
|
|
1078
|
+
code: "EXPORT_PRESENTATION_TOO_LARGE",
|
|
1079
|
+
type: "invalid_request",
|
|
1080
|
+
data: { encoded_length: encoded.length, max_length: MAX_PRESENTATION_HEADER }
|
|
1081
|
+
}
|
|
1082
|
+
);
|
|
1083
|
+
}
|
|
1084
|
+
return encoded;
|
|
1085
|
+
}
|
|
1066
1086
|
var LIST_ENVELOPE = { rows: "records", count: "record_count" };
|
|
1067
1087
|
var WORKSPACE_ENVELOPE = { rows: "data", count: "total_count" };
|
|
1068
1088
|
function parseRecordCount(header) {
|
|
@@ -1208,15 +1228,18 @@ var ACCEPT = {
|
|
|
1208
1228
|
json: "application/json",
|
|
1209
1229
|
pdf: "application/pdf"
|
|
1210
1230
|
};
|
|
1211
|
-
function negotiated(options, format) {
|
|
1231
|
+
function negotiated(options, format, presentation) {
|
|
1212
1232
|
const headers = { ...options.headers, Accept: ACCEPT[format] };
|
|
1233
|
+
if (format === "pdf" && presentation !== void 0) {
|
|
1234
|
+
headers[PRESENTATION_HEADER] = encodePresentation(presentation);
|
|
1235
|
+
}
|
|
1213
1236
|
return format === "json" ? { ...options, headers } : { ...options, headers, responseType: "blob" };
|
|
1214
1237
|
}
|
|
1215
1238
|
function runExport(request, method, path, base, options) {
|
|
1216
1239
|
const format = options?.format ?? "json";
|
|
1217
1240
|
return downloadExport(
|
|
1218
1241
|
request,
|
|
1219
|
-
{ method, path, request: negotiated(base, format), format },
|
|
1242
|
+
{ method, path, request: negotiated(base, format, options?.presentation), format },
|
|
1220
1243
|
options
|
|
1221
1244
|
);
|
|
1222
1245
|
}
|
|
@@ -1249,24 +1272,15 @@ var Disputes = class {
|
|
|
1249
1272
|
async workspaceAggregate(params) {
|
|
1250
1273
|
return this.request("GET", "/disputes/workspace/aggregate", { query: workspaceQuery(params) });
|
|
1251
1274
|
}
|
|
1252
|
-
/**
|
|
1253
|
-
* Export the complete filtered set, or throw on the server's explicit
|
|
1254
|
-
* export-limit refusal. `GET /disputes/workspace/export`
|
|
1255
|
-
*
|
|
1256
|
-
* The body is streamed, and held to the `X-Delopay-Record-Count` the server
|
|
1257
|
-
* announces and to its own `total_count`: a set that arrives short rejects
|
|
1258
|
-
* with `EXPORT_INCOMPLETE` rather than resolving. `options` reports the
|
|
1259
|
-
* download's progress and takes a signal and an idle timeout — see
|
|
1260
|
-
* {@link ExportTransferOptions}.
|
|
1261
|
-
*/
|
|
1262
1275
|
async workspaceExport(params, options) {
|
|
1276
|
+
const format = options?.format ?? "json";
|
|
1263
1277
|
return downloadExport(
|
|
1264
1278
|
this.request,
|
|
1265
1279
|
{
|
|
1266
1280
|
method: "GET",
|
|
1267
1281
|
path: "/disputes/workspace/export",
|
|
1268
|
-
request: { query: workspaceQuery(params) },
|
|
1269
|
-
format
|
|
1282
|
+
request: negotiated({ query: workspaceQuery(params) }, format, options?.presentation),
|
|
1283
|
+
format,
|
|
1270
1284
|
envelope: WORKSPACE_ENVELOPE
|
|
1271
1285
|
},
|
|
1272
1286
|
options
|
|
@@ -10172,4 +10186,4 @@ export {
|
|
|
10172
10186
|
decodeNativePanes,
|
|
10173
10187
|
encodeNativePanes
|
|
10174
10188
|
};
|
|
10175
|
-
//# sourceMappingURL=chunk-
|
|
10189
|
+
//# sourceMappingURL=chunk-ZBNUOFNR.js.map
|