xlport 0.3.3 → 0.4.1
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/.vscode/launch.json +15 -0
- package/dist/lib/client.d.ts +5 -3
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/client.js +101 -200
- package/dist/lib/client.js.map +1 -1
- package/dist/lib/export.types.d.ts +3 -3
- package/dist/lib/export.types.d.ts.map +1 -1
- package/dist/lib/export.types.js +1 -1
- package/dist/lib/export.types.js.map +1 -1
- package/dist/lib/import.types.d.ts +3 -3
- package/dist/lib/import.types.d.ts.map +1 -1
- package/dist/lib/shared.types.d.ts +1 -1
- package/dist/lib/shared.types.d.ts.map +1 -1
- package/package.json +15 -11
- package/tests/client/additional/data-validation/expected.xlsx +0 -0
- package/tests/client/additional/data-validation/request.json +23 -0
- package/tests/client/additional/data-validation/result.xlsx +0 -0
- package/tests/client/additional/data-validation/template.xlsx +0 -0
- package/tests/client/additional/lookup/expected.xlsx +0 -0
- package/tests/client/additional/lookup/request.json +23 -0
- package/tests/client/additional/lookup/result.xlsx +0 -0
- package/tests/client/client.e2e.spec.ts +13 -5
- package/tests/client/export/1object/expected.xlsx +0 -0
- package/tests/client/export/1table/expected.xlsx +0 -0
- package/tests/client/export/1table/request.json +1 -1
- package/tests/client/export/1table/template.xlsx +0 -0
- package/tests/client/export/thirdXlPort2Test/expected.xlsx +0 -0
- package/tests/client/export/thirdXlPort2Test/request.json +2 -0
- package/tests/client/export/v2-formats/expected.xlsx +0 -0
- package/tests/client/export/v2-formats/template.xlsx +0 -0
- package/tests/client/import/1object/expected.json +1 -10
- package/tests/client/import/1object/workbook.xlsx +0 -0
- package/tests/client/import/1table/expected.json +1 -39
- package/tests/client/import/1table/workbook.xlsx +0 -0
- package/tests/client/import/1table-10col-100rows/expected.json +1 -1306
- package/tests/client/import/1table-10col-100rows/workbook.xlsx +0 -0
- package/tests/client/import/Country Demo - Malaria Scorecard - Northern Province (2).xlsx +0 -0
- package/tests/client/import/Region 1 - Scorecard 1 - Q1_2009.xlsx +0 -0
- package/tests/client/import/v2importMultipleSheets/expected.json +1 -0
- package/tests/client/import/v2importMultipleSheets/workbook.xlsx +0 -0
- package/tests/tsconfig.json +2 -1
- package/tsconfig.json +4 -4
- package/dist/client.d.ts +0 -23
- package/dist/client.js +0 -98
- package/dist/client.js.map +0 -1
- package/dist/export.types.d.ts +0 -53
- package/dist/export.types.js +0 -3
- package/dist/export.types.js.map +0 -1
- package/dist/import.types.d.ts +0 -25
- package/dist/import.types.js +0 -11
- package/dist/import.types.js.map +0 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -21
- package/dist/index.js.map +0 -1
- package/dist/shared.types.d.ts +0 -1
- package/dist/shared.types.js +0 -3
- package/dist/shared.types.js.map +0 -1
- package/dist/tests/client/client.e2e.spec.d.ts +0 -1
- package/dist/tests/client/client.e2e.spec.js +0 -109
- package/dist/tests/client/client.e2e.spec.js.map +0 -1
- package/dist/tests/client/export/simple-export/request.json +0 -6
- package/dist/tests/client/import/1object/expected.json +0 -10
- package/dist/tests/client/import/1table/expected.json +0 -39
- package/dist/tests/client/import/1table-10col-100rows/expected.json +0 -1306
- package/dist/tests/client/import/multipleObjects/expected.json +0 -20
- package/dist/tests/client/import/multipleObjectsAndTables/expected.json +0 -84
- package/dist/tests/types/export/column-formatting.json +0 -151
- package/dist/tests/types/export/date.json +0 -6
- package/dist/tests/types/export/days.json +0 -7
- package/dist/tests/types/export/formats.json +0 -169
- package/dist/tests/types/export/formulas-and-lookups.json +0 -9
- package/dist/tests/types/export/multi-column-with-fixed-column.json +0 -24
- package/dist/tests/types/export/multi-sheet-column-fixed-topleft.json +0 -59
- package/dist/tests/types/export/multi-sheet-column-fixed.json +0 -59
- package/dist/tests/types/export/multi-sheet-column-simple-dash.json +0 -97
- package/dist/tests/types/export/multi-sheet-column-simple.json +0 -68
- package/dist/tests/types/export/multi-sheet-column.json +0 -68
- package/dist/tests/types/export/multi-sheet-simple.json +0 -41
- package/dist/tests/types/export/multiple-objects-and-tables.json +0 -83
- package/dist/tests/types/export/multiple-objects.json +0 -20
- package/dist/tests/types/export/multiple-tables.json +0 -88
- package/dist/tests/types/export/object.json +0 -11
- package/dist/tests/types/export/query-table-simple.json +0 -12
- package/dist/tests/types/export/query-table.json +0 -27
- package/dist/tests/types/export/sheets.json +0 -6
- package/dist/tests/types/export/table-with-calculations.json +0 -27
- package/dist/tests/types/export/table.json +0 -40
- package/dist/tests/types/export/utc.json +0 -7
- package/dist/tests/types/export.test.d.ts +0 -26
- package/dist/tests/types/export.test.js +0 -48
- package/dist/tests/types/export.test.js.map +0 -1
- package/dist/tests/types/import/large-table.json +0 -1
- package/dist/tests/types/import/multisheet.json +0 -1
- package/dist/tests/types/import/object.json +0 -1
- package/dist/tests/types/import/table.json +0 -1
- package/dist/tests/types/import.test.d.ts +0 -5
- package/dist/tests/types/import.test.js +0 -12
- package/dist/tests/types/import.test.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/tests/client/export/1table/test.xlsx +0 -0
- package/tests/client/export/formats/expected.xlsx +0 -0
- package/tests/client/export/formats/template.xlsx +0 -0
- package/tests/client/export/secondXlPort2Test/~$expected.xlsx +0 -0
- package/tests/client/export/thirdXlPort2Test/~$expected.xlsx +0 -0
- package/tests/client/export/thirdXlPort2Test/~$template.xlsx +0 -0
- package/tests/client/export/v2-column-formatting/~$expected.xlsx +0 -0
- package/tests/client/export/v2-column-formatting/~$template.xlsx +0 -0
- package/tests/client/import/1object/Source.xlsx +0 -0
- package/tests/client/import/1object/data.xlsx +0 -0
- package/tests/client/import/1object/request.json +0 -10
- package/tests/client/import/1table/Source.xlsx +0 -0
- package/tests/client/import/1table/data.xlsx +0 -0
- package/tests/client/import/1table/request.json +0 -15
- package/tests/client/import/1table-10col-100rows/Source.xlsx +0 -0
- package/tests/client/import/1table-10col-100rows/data.xlsx +0 -0
- package/tests/client/import/1table-10col-100rows/request.json +0 -17
- /package/tests/client/{export/lookup/lookup.xlsx → additional/lookup/template.xlsx} +0 -0
- /package/tests/client/export/{formats → v2-formats}/request.json +0 -0
- /package/tests/client/import/multipleObjects/{Source.xlsx → workbook.xlsx} +0 -0
- /package/tests/client/import/multipleObjectsAndTables/{Source.xlsx → workbook.xlsx} +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
|
3
|
+
// Hover to view descriptions of existing attributes.
|
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"configurations": [
|
|
7
|
+
{
|
|
8
|
+
"name": "Attach by Process ID",
|
|
9
|
+
"processId": "${command:PickProcess}",
|
|
10
|
+
"request": "attach",
|
|
11
|
+
"skipFiles": ["<node_internals>/**"],
|
|
12
|
+
"type": "node"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
}
|
package/dist/lib/client.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
+
import { AxiosInstance } from 'axios';
|
|
3
4
|
import { Stream } from 'stream';
|
|
4
5
|
import { Import } from './import.types';
|
|
5
6
|
import { Export } from './export.types';
|
|
@@ -15,10 +16,11 @@ export declare const mimeTypes: MimeTypes;
|
|
|
15
16
|
export type MimeTypes = Record<ExcelFileExtension, ExcelMimeType>;
|
|
16
17
|
export declare class Client {
|
|
17
18
|
private config;
|
|
19
|
+
private get authHeader();
|
|
20
|
+
axios: AxiosInstance;
|
|
18
21
|
constructor(config: ClientOptions);
|
|
19
|
-
importFromFile(file: string | Buffer, request?: Import.Request): Promise<Import.Response>;
|
|
20
|
-
exportToFile(body: Export.Body): Stream
|
|
22
|
+
importFromFile(file: string | Buffer, request?: Import.Request, filename?: string): Promise<Import.Response>;
|
|
23
|
+
exportToFile(body: Export.Body): Promise<Stream>;
|
|
21
24
|
private getExcelMimeType;
|
|
22
|
-
private loadFile;
|
|
23
25
|
}
|
|
24
26
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/lib/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../lib/client.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../lib/client.ts"],"names":[],"mappings":";;AAGA,OAAc,EAAE,aAAa,EAAc,MAAM,OAAO,CAAA;AAExD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAGvC,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;AACjE,MAAM,MAAM,oBAAoB,GAAG,0BAA0B,CAAA;AAC7D,MAAM,MAAM,aAAa,GACrB,oBAAoB,GACpB,mEAAmE,GACnE,gDAAgD,GAChD,uDAAuD,CAAA;AAE3D,eAAO,MAAM,oBAAoB,6BAA6B,CAAA;AAC9D,eAAO,MAAM,SAAS,EAAE,SAKvB,CAAA;AACD,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,kBAAkB,EAAE,aAAa,CAAC,CAAA;AAEjE,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,KAAK,UAAU,GAErB;IACM,KAAK,EAAE,aAAa,CAAA;gBACf,MAAM,EAAE,aAAa;IAqBpB,cAAc,CACzB,IAAI,EAAE,MAAM,GAAG,MAAM,EACrB,OAAO,GAAE,MAAM,CAAC,OAA+B,EAC/C,QAAQ,GAAE,MAAoB,GAC7B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;IA4BpB,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;IA0BvD,OAAO,CAAC,gBAAgB;CAGzB"}
|
package/dist/lib/client.js
CHANGED
|
@@ -1,52 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
36
7
|
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
27
|
};
|
|
38
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
29
|
exports.Client = exports.mimeTypes = exports.excelDefaultMimeType = void 0;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// import Axios, { AxiosInstance, toFormData } from 'axios'
|
|
47
|
-
var path_1 = require("path");
|
|
48
|
-
var import_types_1 = require("./import.types");
|
|
49
|
-
var export_types_1 = require("./export.types");
|
|
30
|
+
const fs_1 = require("fs");
|
|
31
|
+
// import https from 'https'
|
|
32
|
+
const axios_1 = __importStar(require("axios"));
|
|
33
|
+
const path_1 = require("path");
|
|
34
|
+
const import_types_1 = require("./import.types");
|
|
35
|
+
const form_data_1 = __importDefault(require("form-data"));
|
|
50
36
|
exports.excelDefaultMimeType = 'application/vnd.ms-excel';
|
|
51
37
|
exports.mimeTypes = {
|
|
52
38
|
xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
@@ -54,174 +40,89 @@ exports.mimeTypes = {
|
|
|
54
40
|
xlsb: 'application/vnd.ms-excel.sheet.binary.macroEnabled.12',
|
|
55
41
|
xls: 'application/vnd.ms-excel',
|
|
56
42
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
function Client(config) {
|
|
43
|
+
class Client {
|
|
44
|
+
get authHeader() {
|
|
45
|
+
return 'xlport apikey ' + this.config.apiKey;
|
|
46
|
+
}
|
|
47
|
+
constructor(config) {
|
|
63
48
|
if (config.apiKey === undefined)
|
|
64
49
|
throw Error('API Key is undefined');
|
|
65
50
|
this.config = {
|
|
66
51
|
url: config.url ? config.url.replace(/\/$/, '') : 'https://xlport.compute.molnify.com',
|
|
67
52
|
apiKey: config.apiKey,
|
|
68
53
|
};
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
switch (_e.label) {
|
|
82
|
-
case 0:
|
|
83
|
-
_a = request_promise_1.put;
|
|
84
|
-
_c = {
|
|
85
|
-
url: "".concat(this.config.url, "/import"),
|
|
86
|
-
headers: {
|
|
87
|
-
Authorization: 'xlport apikey ' + this.config.apiKey,
|
|
88
|
-
},
|
|
89
|
-
method: 'put'
|
|
90
|
-
};
|
|
91
|
-
_d = {};
|
|
92
|
-
if (!(typeof file === 'string')) return [3 /*break*/, 2];
|
|
93
|
-
return [4 /*yield*/, this.loadFile(file)];
|
|
94
|
-
case 1:
|
|
95
|
-
_b = _e.sent();
|
|
96
|
-
return [3 /*break*/, 3];
|
|
97
|
-
case 2:
|
|
98
|
-
_b = {
|
|
99
|
-
value: file,
|
|
100
|
-
options: { filename: 'file.xlsx', contentType: exports.excelDefaultMimeType },
|
|
101
|
-
};
|
|
102
|
-
_e.label = 3;
|
|
103
|
-
case 3:
|
|
104
|
-
// const formData = new FormData()
|
|
105
|
-
// if (typeof file === 'string') {
|
|
106
|
-
// try {
|
|
107
|
-
// const options = { contentType: this.getExcelMimeType(file) }
|
|
108
|
-
// formData.append('file.xlsx', createReadStream(file), options)
|
|
109
|
-
// } catch (error) {
|
|
110
|
-
// console.error(error)
|
|
111
|
-
// throw error
|
|
112
|
-
// }
|
|
113
|
-
// } else {
|
|
114
|
-
// formData.append('file.xlsx', file, { contentType: excelDefaultMimeType })
|
|
115
|
-
// }
|
|
116
|
-
// formData.append('request', JSON.stringify(request))
|
|
117
|
-
// return this.axios
|
|
118
|
-
// .put(`${this.config.url}/import`, formData, {
|
|
119
|
-
// headers: {
|
|
120
|
-
// Accept: 'application/json',
|
|
121
|
-
// 'Content-Type': 'multipart/form-data',
|
|
122
|
-
// ...formData.getHeaders(),
|
|
123
|
-
// },
|
|
124
|
-
// })
|
|
125
|
-
// .then((response) => JSON.parse(response.data))
|
|
126
|
-
// .then((response) => {
|
|
127
|
-
// if (!response) throw Error('Response body is empty')
|
|
128
|
-
// return response
|
|
129
|
-
// })
|
|
130
|
-
return [2 /*return*/, _a.apply(void 0, [(_c.formData = (_d.file = _b,
|
|
131
|
-
_d.request = {
|
|
132
|
-
value: Buffer.from(JSON.stringify(request)),
|
|
133
|
-
options: {
|
|
134
|
-
filename: 'request.json',
|
|
135
|
-
contentType: 'application/json',
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
_d),
|
|
139
|
-
_c)])
|
|
140
|
-
.then(JSON.parse)
|
|
141
|
-
.then(function (response) {
|
|
142
|
-
if (!response)
|
|
143
|
-
throw Error('Response body is empty');
|
|
144
|
-
return response;
|
|
145
|
-
})];
|
|
146
|
-
}
|
|
147
|
-
});
|
|
54
|
+
this.axios = axios_1.default.create({
|
|
55
|
+
// httpsAgent: new https.Agent({
|
|
56
|
+
// rejectUnauthorized: false, // set to false
|
|
57
|
+
// }),
|
|
58
|
+
// proxy: {
|
|
59
|
+
// host: '127.0.0.1',
|
|
60
|
+
// port: 8080,
|
|
61
|
+
// protocol: 'https',
|
|
62
|
+
// },
|
|
63
|
+
headers: {
|
|
64
|
+
Authorization: this.authHeader,
|
|
65
|
+
},
|
|
148
66
|
});
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
// },
|
|
169
|
-
// })
|
|
170
|
-
// return this.axios.put(`${this.config.url}/export`, data, { responseType: 'stream' }).then((response) => {
|
|
171
|
-
// if (response.status !== 200) throw Error(response.statusText)
|
|
172
|
-
// return response.data as Stream
|
|
173
|
-
// })
|
|
174
|
-
Client.prototype.exportToFile = function (body) {
|
|
175
|
-
var bodyHasFile = export_types_1.Export.bodyHasFile(body);
|
|
176
|
-
return (0, request_1.put)({
|
|
177
|
-
url: "".concat(this.config.url, "/export"),
|
|
67
|
+
}
|
|
68
|
+
async importFromFile(file, request = import_types_1.Import.defaultRequest, filename = 'file.xlsx') {
|
|
69
|
+
const formData = new form_data_1.default();
|
|
70
|
+
if (typeof file === 'string') {
|
|
71
|
+
try {
|
|
72
|
+
const options = { contentType: this.getExcelMimeType(file) };
|
|
73
|
+
formData.append('file', (0, fs_1.createReadStream)(file), options);
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
console.error(error);
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
formData.append('file', file, { contentType: this.getExcelMimeType(filename), filename });
|
|
82
|
+
}
|
|
83
|
+
formData.append('request', JSON.stringify(request));
|
|
84
|
+
return this.axios
|
|
85
|
+
.put(`${this.config.url}/import`, formData, {
|
|
178
86
|
headers: {
|
|
179
|
-
|
|
180
|
-
'Content-Type':
|
|
87
|
+
Accept: 'application/json',
|
|
88
|
+
'Content-Type': 'multipart/form-data',
|
|
89
|
+
...formData.getHeaders(),
|
|
181
90
|
},
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
91
|
+
})
|
|
92
|
+
.then((response) => {
|
|
93
|
+
if (!response.data)
|
|
94
|
+
throw Error('Response body is empty');
|
|
95
|
+
return response.data;
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
exportToFile(body) {
|
|
99
|
+
let data = 'templateId' in body || 'templateUrl' in body
|
|
100
|
+
? body
|
|
101
|
+
: (0, axios_1.toFormData)({
|
|
102
|
+
template: {
|
|
103
|
+
value: body.template,
|
|
104
|
+
options: {
|
|
105
|
+
filename: 'template.xlsx',
|
|
106
|
+
contentType: 'application/vnd.ms-excel',
|
|
191
107
|
},
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
108
|
+
},
|
|
109
|
+
data: {
|
|
110
|
+
value: Buffer.from(JSON.stringify(body.data)),
|
|
111
|
+
options: {
|
|
112
|
+
filename: 'data.json',
|
|
113
|
+
contentType: 'application/json',
|
|
198
114
|
},
|
|
199
|
-
}
|
|
200
|
-
: undefined,
|
|
201
|
-
});
|
|
202
|
-
};
|
|
203
|
-
Client.prototype.getExcelMimeType = function (path) {
|
|
204
|
-
return exports.mimeTypes[(0, path_1.extname)(path)] || exports.excelDefaultMimeType;
|
|
205
|
-
};
|
|
206
|
-
Client.prototype.loadFile = function (path) {
|
|
207
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
208
|
-
var _a;
|
|
209
|
-
return __generator(this, function (_b) {
|
|
210
|
-
switch (_b.label) {
|
|
211
|
-
case 0:
|
|
212
|
-
_a = {};
|
|
213
|
-
return [4 /*yield*/, (0, util_1.promisify)(fs_1.readFile)(path)];
|
|
214
|
-
case 1: return [2 /*return*/, (_a.value = _b.sent(),
|
|
215
|
-
_a.options = {
|
|
216
|
-
filename: 'file.xlsx',
|
|
217
|
-
contentType: this.getExcelMimeType(path),
|
|
218
|
-
},
|
|
219
|
-
_a)];
|
|
220
|
-
}
|
|
115
|
+
},
|
|
221
116
|
});
|
|
117
|
+
return this.axios.put(`${this.config.url}/export`, data, { responseType: 'stream' }).then((response) => {
|
|
118
|
+
if (response.status !== 200)
|
|
119
|
+
throw Error(response.statusText);
|
|
120
|
+
return response.data;
|
|
222
121
|
});
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
|
|
122
|
+
}
|
|
123
|
+
getExcelMimeType(path) {
|
|
124
|
+
return exports.mimeTypes[(0, path_1.extname)(path)] || exports.excelDefaultMimeType;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
226
127
|
exports.Client = Client;
|
|
227
128
|
//# sourceMappingURL=client.js.map
|
package/dist/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../lib/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../lib/client.ts"],"names":[],"mappings":"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"}
|
|
@@ -18,13 +18,13 @@ export declare namespace Export {
|
|
|
18
18
|
data: DataWithSheets;
|
|
19
19
|
};
|
|
20
20
|
type NamedRange = Value;
|
|
21
|
-
type Value = Shared.
|
|
21
|
+
type Value = Shared.Primitives | ScalarWithOptions;
|
|
22
22
|
type ScalarWithOptions = {
|
|
23
|
-
data: Shared.
|
|
23
|
+
data: Shared.Primitives;
|
|
24
24
|
format?: string;
|
|
25
25
|
indent?: IndentLevel;
|
|
26
26
|
};
|
|
27
|
-
type IndentLevel =
|
|
27
|
+
type IndentLevel = number;
|
|
28
28
|
type Table = TableData | TableWithColumnModifications;
|
|
29
29
|
type TableData = Record<string, Value>[];
|
|
30
30
|
type TableWithColumnModifications = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export.types.d.ts","sourceRoot":"","sources":["../../lib/export.types.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AAC/B,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAA;AACxC,yBAAiB,MAAM,CAAC;IACtB,KAAY,IAAI,GAAG,QAAQ,GAAG,OAAO,GAAG,cAAc,CAAA;IAEtD,KAAY,QAAQ,GAAG;QACrB,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAA;QAC7B,IAAI,EAAE,cAAc,CAAA;KACrB,CAAA;IAEM,MAAM,WAAW,SAAU,IAAI,qBAAyC,CAAA;IAE/E,KAAY,OAAO,GAAG;QACpB,WAAW,EAAE,MAAM,CAAA;QACnB,IAAI,EAAE,cAAc,CAAA;KACrB,CAAA;IAED,KAAY,cAAc,GAAG;QAC3B,UAAU,EAAE,MAAM,CAAA;QAClB,IAAI,EAAE,cAAc,CAAA;KACrB,CAAA;IAED,KAAY,UAAU,GAAG,KAAK,CAAA;IAC9B,KAAY,KAAK,GAAG,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"export.types.d.ts","sourceRoot":"","sources":["../../lib/export.types.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAA;AAC/B,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAA;AACxC,yBAAiB,MAAM,CAAC;IACtB,KAAY,IAAI,GAAG,QAAQ,GAAG,OAAO,GAAG,cAAc,CAAA;IAEtD,KAAY,QAAQ,GAAG;QACrB,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAA;QAC7B,IAAI,EAAE,cAAc,CAAA;KACrB,CAAA;IAEM,MAAM,WAAW,SAAU,IAAI,qBAAyC,CAAA;IAE/E,KAAY,OAAO,GAAG;QACpB,WAAW,EAAE,MAAM,CAAA;QACnB,IAAI,EAAE,cAAc,CAAA;KACrB,CAAA;IAED,KAAY,cAAc,GAAG;QAC3B,UAAU,EAAE,MAAM,CAAA;QAClB,IAAI,EAAE,cAAc,CAAA;KACrB,CAAA;IAED,KAAY,UAAU,GAAG,KAAK,CAAA;IAC9B,KAAY,KAAK,GAAG,MAAM,CAAC,UAAU,GAAG,iBAAiB,CAAA;IACzD,KAAY,iBAAiB,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC,UAAU,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,WAAW,CAAA;KAAE,CAAA;IAClG,KAAY,WAAW,GAAG,MAAM,CAAA;IAChC,KAAY,KAAK,GAAG,SAAS,GAAG,4BAA4B,CAAA;IAC5D,KAAY,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAA;IAC/C,KAAY,4BAA4B,GAAG;QACzC,OAAO,EAAE,gBAAgB,EAAE,CAAA;QAC3B,IAAI,EAAE,SAAS,CAAA;KAChB,CAAA;IACD,KAAY,SAAS,GAAG,MAAM,CAAA;IAC9B,KAAY,UAAU,GAAG,MAAM,CAAA;IAC/B,KAAY,gBAAgB,GAAG;QAC7B,IAAI,EAAE,UAAU,CAAA;QAChB,kBAAkB,EAAE,UAAU,CAAA;QAC9B,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,MAAM,CAAC,EAAE,WAAW,CAAA;KACrB,CAAA;IAED,KAAY,WAAW,GAAG,UAAU,GAAG,KAAK,CAAA;IAC5C,KAAY,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACnD,KAAY,cAAc,GAAG,iBAAiB,GAAG;QAAE,MAAM,CAAC,EAAE,KAAK,EAAE,CAAA;KAAE,CAAA;IAErE,KAAY,KAAK,GAAG;QAClB,IAAI,EAAE,SAAS,CAAA;QACf,iBAAiB,EAAE,SAAS,CAAA;QAC5B,QAAQ,CAAC,EAAE,QAAQ,CAAA;QACnB,IAAI,EAAE,iBAAiB,CAAA;KACxB,CAAA;IAED,KAAY,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAA;CACpC"}
|
package/dist/lib/export.types.js
CHANGED
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Export = void 0;
|
|
4
4
|
var Export;
|
|
5
5
|
(function (Export) {
|
|
6
|
-
Export.bodyHasFile =
|
|
6
|
+
Export.bodyHasFile = (body) => 'template' in body;
|
|
7
7
|
})(Export = exports.Export || (exports.Export = {}));
|
|
8
8
|
//# sourceMappingURL=export.types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export.types.js","sourceRoot":"","sources":["../../lib/export.types.ts"],"names":[],"mappings":";;;AAEA,IAAiB,MAAM,CAmDtB;AAnDD,WAAiB,MAAM;IAQR,kBAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"export.types.js","sourceRoot":"","sources":["../../lib/export.types.ts"],"names":[],"mappings":";;;AAEA,IAAiB,MAAM,CAmDtB;AAnDD,WAAiB,MAAM;IAQR,kBAAW,GAAG,CAAC,IAAU,EAAoB,EAAE,CAAC,UAAU,IAAI,IAAI,CAAA;AA2CjF,CAAC,EAnDgB,MAAM,GAAN,cAAM,KAAN,cAAM,QAmDtB"}
|
|
@@ -18,9 +18,9 @@ export declare namespace Import {
|
|
|
18
18
|
properties?: Record<string, Property>;
|
|
19
19
|
tables?: Record<string, Table | SheetTables>;
|
|
20
20
|
};
|
|
21
|
-
type Property = Shared.
|
|
22
|
-
type SheetProperties = Record<string, Shared.
|
|
23
|
-
type Table = Record<string, Shared.
|
|
21
|
+
type Property = Shared.Primitives | SheetProperties;
|
|
22
|
+
type SheetProperties = Record<string, Shared.Primitives>;
|
|
23
|
+
type Table = Record<string, Shared.Primitives>[];
|
|
24
24
|
type SheetTables = Record<string, Table>;
|
|
25
25
|
}
|
|
26
26
|
//# sourceMappingURL=import.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import.types.d.ts","sourceRoot":"","sources":["../../lib/import.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAA;AACxC,yBAAiB,MAAM,CAAC;IACtB,KAAY,OAAO,GAAG;QACpB,UAAU,EAAE,MAAM,EAAE,CAAA;QACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAA;KAC5C,CAAA;IAEM,MAAM,cAAc,EAAE,OAG5B,CAAA;IAED,KAAY,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAA;IAEtC,UAAiB,KAAK;QACpB,MAAM,EAAE,OAAO,CAAA;QACf,OAAO,EAAE,MAAM,CAAA;KAChB;IAED,UAAiB,OAAO;QACtB,MAAM,EAAE,SAAS,CAAA;QACjB,IAAI,EAAE,IAAI,CAAA;KACX;IAED,KAAY,IAAI,GAAG;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;QACrC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,GAAG,WAAW,CAAC,CAAA;KAC7C,CAAA;IACD,KAAY,QAAQ,GAAG,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"import.types.d.ts","sourceRoot":"","sources":["../../lib/import.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAA;AACxC,yBAAiB,MAAM,CAAC;IACtB,KAAY,OAAO,GAAG;QACpB,UAAU,EAAE,MAAM,EAAE,CAAA;QACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAA;KAC5C,CAAA;IAEM,MAAM,cAAc,EAAE,OAG5B,CAAA;IAED,KAAY,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAA;IAEtC,UAAiB,KAAK;QACpB,MAAM,EAAE,OAAO,CAAA;QACf,OAAO,EAAE,MAAM,CAAA;KAChB;IAED,UAAiB,OAAO;QACtB,MAAM,EAAE,SAAS,CAAA;QACjB,IAAI,EAAE,IAAI,CAAA;KACX;IAED,KAAY,IAAI,GAAG;QACjB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;QACrC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,GAAG,WAAW,CAAC,CAAA;KAC7C,CAAA;IACD,KAAY,QAAQ,GAAG,MAAM,CAAC,UAAU,GAAG,eAAe,CAAA;IAC1D,KAAY,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,CAAA;IAC/D,KAAY,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,EAAE,CAAA;IACvD,KAAY,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;CAChD"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type
|
|
1
|
+
export type Primitives = boolean | string | number | null;
|
|
2
2
|
//# sourceMappingURL=shared.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.types.d.ts","sourceRoot":"","sources":["../../lib/shared.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"shared.types.d.ts","sourceRoot":"","sources":["../../lib/shared.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xlport",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/lib/index.js",
|
|
6
6
|
"types": "dist/lib/index.d.ts",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"type": "git",
|
|
16
16
|
"url": "git+https://github.com/xlport/xlportjs.git"
|
|
17
17
|
},
|
|
18
|
+
"proxy": "http://localhost:8080",
|
|
18
19
|
"keywords": [
|
|
19
20
|
"xlPort",
|
|
20
21
|
"Excel import",
|
|
@@ -27,20 +28,19 @@
|
|
|
27
28
|
},
|
|
28
29
|
"homepage": "https://xlport.io",
|
|
29
30
|
"devDependencies": {
|
|
30
|
-
"@types/jest": "^29.
|
|
31
|
+
"@types/jest": "^29.5.0",
|
|
31
32
|
"@types/node": "14.14.31",
|
|
32
|
-
"@types/request": "2.48.8",
|
|
33
|
-
"@types/request-promise": "4.1.48",
|
|
34
33
|
"dotenv": "^16.0.3",
|
|
35
|
-
"jest": "^29.
|
|
34
|
+
"jest": "^29.5.0",
|
|
36
35
|
"stream-equal": "^2.0.1",
|
|
37
|
-
"ts-jest": "^29.0
|
|
36
|
+
"ts-jest": "^29.1.0",
|
|
37
|
+
"tsconfig-paths": "4.2.0",
|
|
38
|
+
"ts-node": "10.9.1",
|
|
38
39
|
"typescript": "^4.9.3"
|
|
39
40
|
},
|
|
40
41
|
"dependencies": {
|
|
41
|
-
"form-data": "4.0.0",
|
|
42
|
-
"
|
|
43
|
-
"request-promise": "4.2.6"
|
|
42
|
+
"form-data": "^4.0.0",
|
|
43
|
+
"axios": "^1.4.0"
|
|
44
44
|
},
|
|
45
45
|
"prettier": {
|
|
46
46
|
"trailingComma": "all",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"json",
|
|
57
57
|
"ts"
|
|
58
58
|
],
|
|
59
|
-
"rootDir": "
|
|
59
|
+
"rootDir": "./",
|
|
60
60
|
"testRegex": ".*\\.spec\\.ts$",
|
|
61
61
|
"transform": {
|
|
62
62
|
"^.+\\.(t|j)s$": "ts-jest"
|
|
@@ -71,7 +71,11 @@
|
|
|
71
71
|
],
|
|
72
72
|
"moduleNameMapper": {
|
|
73
73
|
"^@xlport(|/.*)$": "<rootDir>/lib/$1"
|
|
74
|
-
}
|
|
74
|
+
},
|
|
75
|
+
"moduleDirectories": [
|
|
76
|
+
"node_modules",
|
|
77
|
+
"dist"
|
|
78
|
+
]
|
|
75
79
|
},
|
|
76
80
|
"wallaby": {
|
|
77
81
|
"autoDetect": true
|
|
Binary file
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"templateId": "data-validation/template.xlsx",
|
|
3
|
+
"data": {
|
|
4
|
+
"Data": [
|
|
5
|
+
{
|
|
6
|
+
"LookupValue": "X"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"LookupValue": "Y"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"Lookup": [
|
|
13
|
+
{
|
|
14
|
+
"Id": "A",
|
|
15
|
+
"Value": "X"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"Id": "B",
|
|
19
|
+
"Value": "Y"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"templateId": "lookup/template.xlsx",
|
|
3
|
+
"data": {
|
|
4
|
+
"Data": [
|
|
5
|
+
{
|
|
6
|
+
"LookupId": "B"
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"LookupId": "A"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"Lookup": [
|
|
13
|
+
{
|
|
14
|
+
"Id": "A",
|
|
15
|
+
"Value": "X"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"Id": "B",
|
|
19
|
+
"Value": "Y"
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
Binary file
|