@nomalism-com/types 0.49.28 → 0.49.29

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/index.cjs CHANGED
@@ -987,9 +987,22 @@ var Route64 = "product_location";
987
987
  // src/modules/stock/productUpdate/interface.ts
988
988
  var interface_exports22 = {};
989
989
  __export(interface_exports22, {
990
+ ExtractErrorCodeEnum: () => ExtractErrorCodeEnum,
990
991
  Route: () => Route65
991
992
  });
992
993
  var Route65 = "product_update";
994
+ var ExtractErrorCodeEnum = {
995
+ NOT_A_PDF: "NOT_A_PDF",
996
+ // o multimedia não é um PDF
997
+ INVALID_PDF: "INVALID_PDF",
998
+ // PDF corrompido/ilegível
999
+ FILE_NOT_FOUND: "FILE_NOT_FOUND",
1000
+ // multimedia_id inexistente
1001
+ TIMEOUT: "TIMEOUT",
1002
+ // o Python excedeu o tempo máximo
1003
+ EXTRACTION_FAILED: "EXTRACTION_FAILED"
1004
+ // outra falha
1005
+ };
993
1006
 
994
1007
  // src/modules/stock/promotion/interface.ts
995
1008
  var interface_exports23 = {};
package/dist/index.js CHANGED
@@ -814,9 +814,22 @@ var Route64 = "product_location";
814
814
  // src/modules/stock/productUpdate/interface.ts
815
815
  var interface_exports22 = {};
816
816
  __export(interface_exports22, {
817
+ ExtractErrorCodeEnum: () => ExtractErrorCodeEnum,
817
818
  Route: () => Route65
818
819
  });
819
820
  var Route65 = "product_update";
821
+ var ExtractErrorCodeEnum = {
822
+ NOT_A_PDF: "NOT_A_PDF",
823
+ // o multimedia não é um PDF
824
+ INVALID_PDF: "INVALID_PDF",
825
+ // PDF corrompido/ilegível
826
+ FILE_NOT_FOUND: "FILE_NOT_FOUND",
827
+ // multimedia_id inexistente
828
+ TIMEOUT: "TIMEOUT",
829
+ // o Python excedeu o tempo máximo
830
+ EXTRACTION_FAILED: "EXTRACTION_FAILED"
831
+ // outra falha
832
+ };
820
833
 
821
834
  // src/modules/stock/promotion/interface.ts
822
835
  var interface_exports23 = {};
@@ -1,25 +1,60 @@
1
+ import * as IShared from "../../../shared/interface";
1
2
  export declare const Route = "product_update";
2
- export interface ExtractionResult {
3
+ export interface IExtractRequest {
4
+ multimedia_ids: string[];
5
+ }
6
+ export interface IExtractionResult {
3
7
  source: string;
4
8
  page_count: number;
5
- tables: ExtractedTable[];
9
+ tables: IExtractedTable[];
6
10
  }
7
- export interface ExtractedTable {
11
+ export interface IExtractedTable {
8
12
  id: string;
9
13
  pages: number[];
10
14
  row_count: number;
11
- columns: ExtractedColumn[];
12
- rows: ExtractedRow[];
15
+ columns: IExtractedColumn[];
16
+ rows: IExtractedRow[];
13
17
  }
14
- export interface ExtractedColumn {
18
+ export interface IExtractedColumn {
15
19
  id: string;
16
20
  name: string;
17
21
  samples: string[];
18
22
  suggested_field: string | null;
19
23
  }
20
- export interface ExtractedRow {
24
+ export interface IExtractedRow {
21
25
  _page: number;
22
26
  _section: string | null;
23
27
  _note?: string;
24
28
  [columnId: string]: string | number | null | undefined;
25
29
  }
30
+ export declare const ExtractErrorCodeEnum: {
31
+ NOT_A_PDF: "NOT_A_PDF";
32
+ INVALID_PDF: "INVALID_PDF";
33
+ FILE_NOT_FOUND: "FILE_NOT_FOUND";
34
+ TIMEOUT: "TIMEOUT";
35
+ EXTRACTION_FAILED: "EXTRACTION_FAILED";
36
+ };
37
+ export type IExtractErrorCode = (typeof ExtractErrorCodeEnum)[keyof typeof ExtractErrorCodeEnum];
38
+ export interface IExtractError {
39
+ code: IExtractErrorCode;
40
+ message: string;
41
+ }
42
+ interface IExtractFileResultBase {
43
+ multimedia_id: string;
44
+ file_name: string;
45
+ }
46
+ export type IExtractFileResult = (IExtractFileResultBase & {
47
+ status: "ok";
48
+ data: IExtractionResult;
49
+ }) | (IExtractFileResultBase & {
50
+ status: "error";
51
+ error: IExtractError;
52
+ });
53
+ export interface IExtractResponse {
54
+ results: IExtractFileResult[];
55
+ }
56
+ export interface IRepository {
57
+ extract(data: IExtractRequest): Promise<IExtractResponse>;
58
+ }
59
+ export type IController = IShared.IEntityWithUserToken<IRepository>;
60
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nomalism-com/types",
3
3
  "description": "A nomalism package with all necessary types and validations for developing APIs",
4
- "version": "0.49.28",
4
+ "version": "0.49.29",
5
5
  "author": "Nomalism <it.nomalism@gmail.com> (https://nomalism.com/)",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",