@nomalism-com/types 0.49.28 → 0.49.30
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 +28 -0
- package/dist/index.js +28 -0
- package/dist/modules/stock/productUpdate/interface.d.ts +109 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -987,9 +987,37 @@ 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,
|
|
991
|
+
MappableFieldEnum: () => MappableFieldEnum,
|
|
992
|
+
MappableFieldLabels: () => MappableFieldLabels,
|
|
990
993
|
Route: () => Route65
|
|
991
994
|
});
|
|
992
995
|
var Route65 = "product_update";
|
|
996
|
+
var ExtractErrorCodeEnum = {
|
|
997
|
+
NOT_A_PDF: "NOT_A_PDF",
|
|
998
|
+
// o multimedia não é um PDF
|
|
999
|
+
INVALID_PDF: "INVALID_PDF",
|
|
1000
|
+
// PDF corrompido/ilegível
|
|
1001
|
+
FILE_NOT_FOUND: "FILE_NOT_FOUND",
|
|
1002
|
+
// multimedia_id inexistente
|
|
1003
|
+
TIMEOUT: "TIMEOUT",
|
|
1004
|
+
// o Python excedeu o tempo máximo
|
|
1005
|
+
EXTRACTION_FAILED: "EXTRACTION_FAILED"
|
|
1006
|
+
// outra falha
|
|
1007
|
+
};
|
|
1008
|
+
var MappableFieldEnum = {
|
|
1009
|
+
provider_ref: "provider_ref",
|
|
1010
|
+
// obrigatório: liga a linha do PDF ao artigo
|
|
1011
|
+
designation: "designation",
|
|
1012
|
+
price_cost: "price_cost",
|
|
1013
|
+
price_sale: "price_sale"
|
|
1014
|
+
};
|
|
1015
|
+
var MappableFieldLabels = {
|
|
1016
|
+
provider_ref: "Refer\xEAncia do fornecedor",
|
|
1017
|
+
designation: "Designa\xE7\xE3o",
|
|
1018
|
+
price_cost: "Pre\xE7o de custo",
|
|
1019
|
+
price_sale: "Pre\xE7o de venda"
|
|
1020
|
+
};
|
|
993
1021
|
|
|
994
1022
|
// src/modules/stock/promotion/interface.ts
|
|
995
1023
|
var interface_exports23 = {};
|
package/dist/index.js
CHANGED
|
@@ -814,9 +814,37 @@ 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,
|
|
818
|
+
MappableFieldEnum: () => MappableFieldEnum,
|
|
819
|
+
MappableFieldLabels: () => MappableFieldLabels,
|
|
817
820
|
Route: () => Route65
|
|
818
821
|
});
|
|
819
822
|
var Route65 = "product_update";
|
|
823
|
+
var ExtractErrorCodeEnum = {
|
|
824
|
+
NOT_A_PDF: "NOT_A_PDF",
|
|
825
|
+
// o multimedia não é um PDF
|
|
826
|
+
INVALID_PDF: "INVALID_PDF",
|
|
827
|
+
// PDF corrompido/ilegível
|
|
828
|
+
FILE_NOT_FOUND: "FILE_NOT_FOUND",
|
|
829
|
+
// multimedia_id inexistente
|
|
830
|
+
TIMEOUT: "TIMEOUT",
|
|
831
|
+
// o Python excedeu o tempo máximo
|
|
832
|
+
EXTRACTION_FAILED: "EXTRACTION_FAILED"
|
|
833
|
+
// outra falha
|
|
834
|
+
};
|
|
835
|
+
var MappableFieldEnum = {
|
|
836
|
+
provider_ref: "provider_ref",
|
|
837
|
+
// obrigatório: liga a linha do PDF ao artigo
|
|
838
|
+
designation: "designation",
|
|
839
|
+
price_cost: "price_cost",
|
|
840
|
+
price_sale: "price_sale"
|
|
841
|
+
};
|
|
842
|
+
var MappableFieldLabels = {
|
|
843
|
+
provider_ref: "Refer\xEAncia do fornecedor",
|
|
844
|
+
designation: "Designa\xE7\xE3o",
|
|
845
|
+
price_cost: "Pre\xE7o de custo",
|
|
846
|
+
price_sale: "Pre\xE7o de venda"
|
|
847
|
+
};
|
|
820
848
|
|
|
821
849
|
// src/modules/stock/promotion/interface.ts
|
|
822
850
|
var interface_exports23 = {};
|
|
@@ -1,25 +1,127 @@
|
|
|
1
|
+
import * as IShared from "../../../shared/interface";
|
|
2
|
+
import type { IProductState } from "../productGoogleSheets/interface";
|
|
1
3
|
export declare const Route = "product_update";
|
|
2
|
-
export interface
|
|
4
|
+
export interface IExtractRequest {
|
|
5
|
+
multimedia_ids: string[];
|
|
6
|
+
}
|
|
7
|
+
export interface IExtractionResult {
|
|
3
8
|
source: string;
|
|
4
9
|
page_count: number;
|
|
5
|
-
tables:
|
|
10
|
+
tables: IExtractedTable[];
|
|
6
11
|
}
|
|
7
|
-
export interface
|
|
12
|
+
export interface IExtractedTable {
|
|
8
13
|
id: string;
|
|
9
14
|
pages: number[];
|
|
10
15
|
row_count: number;
|
|
11
|
-
columns:
|
|
12
|
-
rows:
|
|
16
|
+
columns: IExtractedColumn[];
|
|
17
|
+
rows: IExtractedRow[];
|
|
13
18
|
}
|
|
14
|
-
export interface
|
|
19
|
+
export interface IExtractedColumn {
|
|
15
20
|
id: string;
|
|
16
21
|
name: string;
|
|
17
22
|
samples: string[];
|
|
18
23
|
suggested_field: string | null;
|
|
19
24
|
}
|
|
20
|
-
export interface
|
|
25
|
+
export interface IExtractedRow {
|
|
21
26
|
_page: number;
|
|
22
27
|
_section: string | null;
|
|
23
28
|
_note?: string;
|
|
24
29
|
[columnId: string]: string | number | null | undefined;
|
|
25
30
|
}
|
|
31
|
+
export declare const ExtractErrorCodeEnum: {
|
|
32
|
+
NOT_A_PDF: "NOT_A_PDF";
|
|
33
|
+
INVALID_PDF: "INVALID_PDF";
|
|
34
|
+
FILE_NOT_FOUND: "FILE_NOT_FOUND";
|
|
35
|
+
TIMEOUT: "TIMEOUT";
|
|
36
|
+
EXTRACTION_FAILED: "EXTRACTION_FAILED";
|
|
37
|
+
};
|
|
38
|
+
export type IExtractErrorCode = (typeof ExtractErrorCodeEnum)[keyof typeof ExtractErrorCodeEnum];
|
|
39
|
+
export interface IExtractError {
|
|
40
|
+
code: IExtractErrorCode;
|
|
41
|
+
message: string;
|
|
42
|
+
}
|
|
43
|
+
interface IExtractFileResultBase {
|
|
44
|
+
multimedia_id: string;
|
|
45
|
+
file_name: string;
|
|
46
|
+
}
|
|
47
|
+
export type IExtractFileResult = (IExtractFileResultBase & {
|
|
48
|
+
status: "ok";
|
|
49
|
+
data: IExtractionResult;
|
|
50
|
+
}) | (IExtractFileResultBase & {
|
|
51
|
+
status: "error";
|
|
52
|
+
error: IExtractError;
|
|
53
|
+
});
|
|
54
|
+
export interface IExtractResponse {
|
|
55
|
+
results: IExtractFileResult[];
|
|
56
|
+
}
|
|
57
|
+
export declare const MappableFieldEnum: {
|
|
58
|
+
provider_ref: "provider_ref";
|
|
59
|
+
designation: "designation";
|
|
60
|
+
price_cost: "price_cost";
|
|
61
|
+
price_sale: "price_sale";
|
|
62
|
+
};
|
|
63
|
+
export type IMappableField = (typeof MappableFieldEnum)[keyof typeof MappableFieldEnum];
|
|
64
|
+
export declare const MappableFieldLabels: Record<IMappableField, string>;
|
|
65
|
+
export interface IAnalyzeRowInput {
|
|
66
|
+
page: number;
|
|
67
|
+
provider_ref: string;
|
|
68
|
+
designation?: string;
|
|
69
|
+
price_cost?: string;
|
|
70
|
+
price_sale?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface IAnalyzeRequest {
|
|
73
|
+
id_provider: number;
|
|
74
|
+
price_sale_includes_vat: boolean;
|
|
75
|
+
new_products_vat_tax_id?: string;
|
|
76
|
+
rows: IAnalyzeRowInput[];
|
|
77
|
+
}
|
|
78
|
+
export interface IAnalyzeValues {
|
|
79
|
+
designation: string | null;
|
|
80
|
+
price_cost: number | null;
|
|
81
|
+
price_sale: number | null;
|
|
82
|
+
}
|
|
83
|
+
export interface IAnalyzeUpdate {
|
|
84
|
+
product_id: string;
|
|
85
|
+
reference: string;
|
|
86
|
+
provider_ref: string;
|
|
87
|
+
page: number;
|
|
88
|
+
current: IAnalyzeValues & {
|
|
89
|
+
state: IProductState;
|
|
90
|
+
};
|
|
91
|
+
new: IAnalyzeValues;
|
|
92
|
+
changes: IMappableField[];
|
|
93
|
+
reactivate: boolean;
|
|
94
|
+
}
|
|
95
|
+
export interface IAnalyzeCreate {
|
|
96
|
+
provider_ref: string;
|
|
97
|
+
page: number;
|
|
98
|
+
values: IAnalyzeValues;
|
|
99
|
+
}
|
|
100
|
+
export interface IAnalyzeDiscontinue {
|
|
101
|
+
product_id: string;
|
|
102
|
+
reference: string;
|
|
103
|
+
provider_ref: string;
|
|
104
|
+
designation: string;
|
|
105
|
+
state: IProductState;
|
|
106
|
+
price_cost: number | null;
|
|
107
|
+
price_sale: number | null;
|
|
108
|
+
}
|
|
109
|
+
export interface IAnalyzeProblem {
|
|
110
|
+
page: number;
|
|
111
|
+
provider_ref: string | null;
|
|
112
|
+
message: string;
|
|
113
|
+
}
|
|
114
|
+
export interface IAnalyzeResponse {
|
|
115
|
+
to_update: IAnalyzeUpdate[];
|
|
116
|
+
to_create: IAnalyzeCreate[];
|
|
117
|
+
to_discontinue: IAnalyzeDiscontinue[];
|
|
118
|
+
problems: IAnalyzeProblem[];
|
|
119
|
+
unchanged_count: number;
|
|
120
|
+
without_provider_ref_count: number;
|
|
121
|
+
}
|
|
122
|
+
export interface IRepository {
|
|
123
|
+
extract(data: IExtractRequest): Promise<IExtractResponse>;
|
|
124
|
+
analyze(data: IAnalyzeRequest): Promise<IAnalyzeResponse>;
|
|
125
|
+
}
|
|
126
|
+
export type IController = IShared.IEntityWithUserToken<IRepository>;
|
|
127
|
+
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.
|
|
4
|
+
"version": "0.49.30",
|
|
5
5
|
"author": "Nomalism <it.nomalism@gmail.com> (https://nomalism.com/)",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"type": "module",
|