@colijnit/mainapi 262.1.21 → 262.1.23

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.
@@ -38,6 +38,7 @@ export declare abstract class MainApiConnection {
38
38
  abstract getSendMethods(): Promise<DataServiceResponseData>;
39
39
  abstract getDocumentContent(id: number, thumbnail: boolean): Promise<DataServiceResponseData>;
40
40
  abstract loadDocuments(key: string, table: TableName): Promise<DataServiceResponseData>;
41
+ abstract selectNotesByTableKey(key: string, table: TableName): Promise<DataServiceResponseData>;
41
42
  abstract loadDocumentContent(docId: number): Promise<DataServiceResponseData>;
42
43
  abstract deleteDocument(documentId: number): Promise<DataServiceResponseData>;
43
44
  abstract upsertDocument(key: string, table: TableName, document: CoDocument): Promise<DataServiceResponseData>;
@@ -54,6 +54,7 @@ export declare class MainApi {
54
54
  getSendMethods(): Promise<DataServiceResponseData>;
55
55
  getDocumentContent(id: number, thumbnail?: boolean): Promise<DataServiceResponseData>;
56
56
  loadDocuments(key: string, table: TableName): Promise<DataServiceResponseData>;
57
+ selectNotesByTableKey(key: string, table: TableName): Promise<DataServiceResponseData>;
57
58
  loadDocumentContent(docId: number): Promise<DataServiceResponseData>;
58
59
  deleteDocument(documentId: number): Promise<DataServiceResponseData>;
59
60
  upsertDocument(key: string, table: TableName, document: CoDocument): Promise<DataServiceResponseData>;
package/build/main-api.js CHANGED
@@ -94,6 +94,11 @@ class MainApi {
94
94
  return this.mainApi.loadDocuments(key, table);
95
95
  });
96
96
  }
97
+ selectNotesByTableKey(key, table) {
98
+ return __awaiter(this, void 0, void 0, function* () {
99
+ return this.mainApi.selectNotesByTableKey(key, table);
100
+ });
101
+ }
97
102
  loadDocumentContent(docId) {
98
103
  return this.mainApi.loadDocumentContent(docId);
99
104
  }
@@ -218,4 +218,9 @@ describe("Connector", () => {
218
218
  const result = yield connector.createQRCode(width, height, value);
219
219
  expect(result).toBeDefined();
220
220
  }));
221
+ it('selectNotesByTableKey', () => __awaiter(void 0, void 0, void 0, function* () {
222
+ yield connector.connect();
223
+ const result = yield connector.selectNotesByTableKey('738428', table_name_enum_1.TableName.Goods);
224
+ expect(result).toBeDefined();
225
+ }));
221
226
  });
@@ -33,6 +33,7 @@ export declare class MainAuth extends MainApiConnection {
33
33
  getSendMethods(): Promise<DataServiceResponseData>;
34
34
  getDocumentContent(id: number, thumbnail?: boolean): Promise<DataServiceResponseData>;
35
35
  loadDocuments(key: string, table: TableName): Promise<DataServiceResponseData>;
36
+ selectNotesByTableKey(key: string, table: TableName): Promise<DataServiceResponseData>;
36
37
  loadDocumentContent(docId: number): Promise<DataServiceResponseData>;
37
38
  upsertDocument(key: string, table: TableName, document: CoDocument): Promise<DataServiceResponseData>;
38
39
  deleteDocument(documentId: number): Promise<DataServiceResponseData>;
@@ -142,6 +142,13 @@ class MainAuth extends main_api_connection_1.MainApiConnection {
142
142
  };
143
143
  return this.selectMultiple(module_name_enum_1.ModuleName.General, "CoDocument", document_method_enum_1.DocumentMethod.SelectDocsByTableKey, data);
144
144
  }
145
+ selectNotesByTableKey(key, table) {
146
+ const data = {
147
+ key: key,
148
+ table: table
149
+ };
150
+ return this.selectMultiple(module_name_enum_1.ModuleName.General, "Note", general_method_enum_1.GeneralMethod.SelectNotesByTableKey, data);
151
+ }
145
152
  loadDocumentContent(docId) {
146
153
  const params = {
147
154
  docId: docId
@@ -32,6 +32,7 @@ export declare class MainPublic extends MainApiConnection {
32
32
  getSendMethods(): Promise<DataServiceResponseData>;
33
33
  getDocumentContent(id: number, thumbnail: boolean): Promise<DataServiceResponseData>;
34
34
  loadDocuments(key: string, table: TableName): Promise<DataServiceResponseData>;
35
+ selectNotesByTableKey(key: string, table: TableName): Promise<DataServiceResponseData>;
35
36
  loadDocumentContent(docId: number): Promise<DataServiceResponseData>;
36
37
  upsertDocument(key: string, table: TableName, document: CoDocument): Promise<DataServiceResponseData>;
37
38
  deleteDocument(documentId: number): Promise<DataServiceResponseData>;
@@ -71,6 +71,12 @@ class MainPublic extends main_api_connection_1.MainApiConnection {
71
71
  return Promise.resolve(new data_service_response_data_1.DataServiceResponseData());
72
72
  });
73
73
  }
74
+ selectNotesByTableKey(key, table) {
75
+ return __awaiter(this, void 0, void 0, function* () {
76
+ console.warn('selectNotesByTableKey not implemented');
77
+ return Promise.resolve(new data_service_response_data_1.DataServiceResponseData());
78
+ });
79
+ }
74
80
  loadDocumentContent(docId) {
75
81
  console.warn('loadDocumentContent not implemented');
76
82
  return Promise.resolve(new data_service_response_data_1.DataServiceResponseData());
@@ -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(file, resize = false, maxSizeInPixels = 1200) {
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.21",
3
+ "version": "262.1.23",
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",