@colijnit/mainapi 300.1.15 → 300.1.17
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
|
@@ -108,7 +108,7 @@ export declare class MainPublic extends MainApiConnection {
|
|
|
108
108
|
getBranchesByWarehouseNumber(warehouseNo: number): Promise<DataServiceResponseData>;
|
|
109
109
|
selectMultiple(moduleName: ModuleName, objectName: string, operationName?: string, parameterValues?: any, showLoader?: boolean): Promise<DataServiceResponseData>;
|
|
110
110
|
getSingleImage(nodeId: number | string, publication?: number, includeMimetype?: boolean, thumb?: boolean, tableName?: TableName): Promise<DataServiceResponseData>;
|
|
111
|
-
getImage(key: number | string, publication?: number, includeMimetype?: boolean, thumb?: boolean): Promise<DataServiceResponseData>;
|
|
111
|
+
getImage(key: number | string, publication?: number, includeMimetype?: boolean, thumb?: boolean, tableName?: TableName): Promise<DataServiceResponseData>;
|
|
112
112
|
getImageForCoDocument(document: CoDocument, thumb?: boolean): Promise<DataServiceResponseData>;
|
|
113
113
|
createQRCode(width: number, height: number, value: string, showLoader?: boolean): Promise<DataServiceResponseData>;
|
|
114
114
|
getWarehousesShort(): Promise<DataServiceResponseData>;
|
package/build/main-public.js
CHANGED
|
@@ -449,8 +449,8 @@ class MainPublic extends main_api_connection_1.MainApiConnection {
|
|
|
449
449
|
return this._call(public_service_method_1.PublicServiceMethod.GetSingleImage, data);
|
|
450
450
|
}
|
|
451
451
|
getImage(key_1) {
|
|
452
|
-
return __awaiter(this, arguments, void 0, function* (key, publication = 4, includeMimetype = false, thumb = true) {
|
|
453
|
-
const getImageObject = yield this.getSingleImage(key, publication, includeMimetype, thumb,
|
|
452
|
+
return __awaiter(this, arguments, void 0, function* (key, publication = 4, includeMimetype = false, thumb = true, tableName = table_name_enum_1.TableName.Goods) {
|
|
453
|
+
const getImageObject = yield this.getSingleImage(key, publication, includeMimetype, thumb, tableName);
|
|
454
454
|
if (getImageObject && getImageObject.validationResult && getImageObject.validationResult.success) {
|
|
455
455
|
if (getImageObject.resultObject) {
|
|
456
456
|
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": "300.1.
|
|
3
|
+
"version": "300.1.17",
|
|
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"
|