@colijnit/mainapi 262.1.22 → 262.1.24
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/build/main-public.d.ts
CHANGED
|
@@ -107,7 +107,7 @@ export declare class MainPublic extends MainApiConnection {
|
|
|
107
107
|
getBranchesByWarehouseNumber(warehouseNo: number): Promise<DataServiceResponseData>;
|
|
108
108
|
selectMultiple(moduleName: ModuleName, objectName: string, operationName?: string, parameterValues?: any, showLoader?: boolean): Promise<DataServiceResponseData>;
|
|
109
109
|
getSingleImage(nodeId: number | string, publication?: number, includeMimetype?: boolean, thumb?: boolean, tableName?: TableName): Promise<DataServiceResponseData>;
|
|
110
|
-
getImage(key: number | string, publication?: number, includeMimetype?: boolean, thumb?: boolean): Promise<DataServiceResponseData>;
|
|
110
|
+
getImage(key: number | string, publication?: number, includeMimetype?: boolean, thumb?: boolean, tableName?: TableName): Promise<DataServiceResponseData>;
|
|
111
111
|
getImageForCoDocument(document: CoDocument, thumb?: boolean): Promise<DataServiceResponseData>;
|
|
112
112
|
createQRCode(width: number, height: number, value: string, showLoader?: boolean): Promise<DataServiceResponseData>;
|
|
113
113
|
getWarehousesShort(): Promise<DataServiceResponseData>;
|
package/build/main-public.js
CHANGED
|
@@ -445,8 +445,8 @@ class MainPublic extends main_api_connection_1.MainApiConnection {
|
|
|
445
445
|
return this._call(public_service_method_1.PublicServiceMethod.GetSingleImage, data);
|
|
446
446
|
}
|
|
447
447
|
getImage(key_1) {
|
|
448
|
-
return __awaiter(this, arguments, void 0, function* (key, publication = 4, includeMimetype = false, thumb = true) {
|
|
449
|
-
const getImageObject = yield this.getSingleImage(key, publication, includeMimetype, thumb,
|
|
448
|
+
return __awaiter(this, arguments, void 0, function* (key, publication = 4, includeMimetype = false, thumb = true, tableName = table_name_enum_1.TableName.Goods) {
|
|
449
|
+
const getImageObject = yield this.getSingleImage(key, publication, includeMimetype, thumb, tableName);
|
|
450
450
|
if (getImageObject && getImageObject.validationResult && getImageObject.validationResult.success) {
|
|
451
451
|
if (getImageObject.resultObject) {
|
|
452
452
|
const document = getImageObject.resultObject;
|
|
@@ -22,6 +22,9 @@ export declare class FileUtils {
|
|
|
22
22
|
static ReadAsText(file: File): Promise<string>;
|
|
23
23
|
static readAsDataURL(file: File): Promise<string>;
|
|
24
24
|
static ReadFileAsNewCoDocument(file: File, resize?: boolean, maxSizeInPixels?: number): Promise<CoDocument>;
|
|
25
|
+
static IsHeicFile(file: File): boolean;
|
|
26
|
+
static ConvertHeicToJpeg(file: File, jpegQuality?: number): Promise<File>;
|
|
27
|
+
private static _readFileAsNewCoDocument;
|
|
25
28
|
static ResizeImage(src: string, fileType: string, maxSizeInPixels: number): Promise<string>;
|
|
26
29
|
static CalculateSha256Hash(file: ArrayBuffer): Promise<string>;
|
|
27
30
|
static ReadFileAsDataURL(file: File): Promise<string>;
|
|
@@ -79,6 +79,8 @@ class FileUtils {
|
|
|
79
79
|
case "tiff":
|
|
80
80
|
case "tga":
|
|
81
81
|
case "dds":
|
|
82
|
+
case "heic":
|
|
83
|
+
case "heif":
|
|
82
84
|
return file_type_internal_enum_1.FileTypeInternal.Image;
|
|
83
85
|
case "swf":
|
|
84
86
|
return file_type_internal_enum_1.FileTypeInternal.Swf;
|
|
@@ -290,7 +292,28 @@ class FileUtils {
|
|
|
290
292
|
};
|
|
291
293
|
});
|
|
292
294
|
}
|
|
293
|
-
static ReadFileAsNewCoDocument(
|
|
295
|
+
static ReadFileAsNewCoDocument(file_1) {
|
|
296
|
+
return __awaiter(this, arguments, void 0, function* (file, resize = false, maxSizeInPixels = 1200) {
|
|
297
|
+
const readableFile = FileUtils.IsHeicFile(file) ? yield FileUtils.ConvertHeicToJpeg(file) : file;
|
|
298
|
+
return FileUtils._readFileAsNewCoDocument(readableFile, resize, maxSizeInPixels);
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
static IsHeicFile(file) {
|
|
302
|
+
if (!file) {
|
|
303
|
+
return false;
|
|
304
|
+
}
|
|
305
|
+
const mimeType = (file.type || "").toLowerCase();
|
|
306
|
+
return mimeType === "image/heic" || mimeType === "image/heif" || /\.(heic|heif)$/i.test(file.name);
|
|
307
|
+
}
|
|
308
|
+
static ConvertHeicToJpeg(file_1) {
|
|
309
|
+
return __awaiter(this, arguments, void 0, function* (file, jpegQuality = 0.9) {
|
|
310
|
+
const { heicTo } = yield Promise.resolve().then(() => __importStar(require("heic-to")));
|
|
311
|
+
const jpeg = yield heicTo({ blob: file, type: "image/jpeg", quality: jpegQuality });
|
|
312
|
+
const fileName = file.name.replace(/\.(heic|heif)$/i, ".jpg");
|
|
313
|
+
return new File([jpeg], fileName, { type: "image/jpeg", lastModified: file.lastModified });
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
static _readFileAsNewCoDocument(file, resize, maxSizeInPixels) {
|
|
294
317
|
return new Promise((resolve) => {
|
|
295
318
|
const reader = new FileReader();
|
|
296
319
|
reader.readAsDataURL(file);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colijnit/mainapi",
|
|
3
|
-
"version": "262.1.
|
|
3
|
+
"version": "262.1.24",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"build": "grunt clean && tsc",
|
|
6
6
|
"browserify": "browserify build/connector.js --s colijn -o dist/out-tsc/bundle.js",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"license": "ISC",
|
|
20
20
|
"private": false,
|
|
21
21
|
"dependencies": {
|
|
22
|
+
"heic-to": "^1.6.7",
|
|
22
23
|
"qrcode": "^1.4.4",
|
|
23
24
|
"reflect-metadata": "^0.1.12",
|
|
24
25
|
"rxjs": "6.6.3"
|
|
@@ -27,8 +28,8 @@
|
|
|
27
28
|
"@colijnit/ioneconnector": ">=262.1.0"
|
|
28
29
|
},
|
|
29
30
|
"devDependencies": {
|
|
30
|
-
"@types/jest": "^24.0.13",
|
|
31
31
|
"@colijnit/ioneconnector": "262.1.0",
|
|
32
|
+
"@types/jest": "^24.0.13",
|
|
32
33
|
"grunt": "^1.0.3",
|
|
33
34
|
"grunt-clean": "^0.4.0",
|
|
34
35
|
"grunt-contrib-clean": "^1.1.0",
|