@nomalism-com/types 0.49.36 → 0.49.38

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,14 +987,16 @@ var Route64 = "product_location";
987
987
  // src/modules/stock/productUpdate/interface.ts
988
988
  var interface_exports22 = {};
989
989
  __export(interface_exports22, {
990
+ ApplyActionLabels: () => ApplyActionLabels,
991
+ ApplyStatusEnum: () => ApplyStatusEnum,
990
992
  ExtractErrorCodeEnum: () => ExtractErrorCodeEnum,
993
+ ImportTabEnum: () => ImportTabEnum,
994
+ ImportTabLabels: () => ImportTabLabels,
991
995
  LengthUnitEnum: () => LengthUnitEnum,
992
- MappableFieldEnum: () => MappableFieldEnum,
993
- MappableFieldLabels: () => MappableFieldLabels,
996
+ MasterColumnKinds: () => MasterColumnKinds,
994
997
  RefMatchEnum: () => RefMatchEnum,
995
998
  RefMatchLabels: () => RefMatchLabels,
996
999
  Route: () => Route65,
997
- UpdatableFieldKinds: () => UpdatableFieldKinds,
998
1000
  WeightUnitEnum: () => WeightUnitEnum
999
1001
  });
1000
1002
  var Route65 = "product_update";
@@ -1010,41 +1012,31 @@ var ExtractErrorCodeEnum = {
1010
1012
  EXTRACTION_FAILED: "EXTRACTION_FAILED"
1011
1013
  // outra falha
1012
1014
  };
1013
- var MappableFieldEnum = {
1014
- provider_ref: "provider_ref",
1015
- // obrigatório: liga a linha do PDF ao artigo
1016
- designation: "designation",
1017
- price_cost: "price_cost",
1018
- price_sale: "price_sale",
1019
- width: "width",
1020
- height: "height",
1021
- length: "length",
1022
- diameter: "diameter",
1023
- weight: "weight",
1024
- compositions: "compositions"
1015
+ var ImportTabEnum = {
1016
+ PRODUTOS: "PRODUTOS",
1017
+ // stock
1018
+ NOVA_ENCOMENDA: "NOVA_ENCOMENDA"
1019
+ // encomenda (pré-artigos)
1025
1020
  };
1026
- var MappableFieldLabels = {
1027
- provider_ref: "Refer\xEAncia do fornecedor",
1028
- designation: "Designa\xE7\xE3o",
1029
- price_cost: "Pre\xE7o de custo",
1030
- price_sale: "Pre\xE7o de venda",
1031
- width: "Largura",
1032
- height: "Altura",
1033
- length: "Comprimento",
1034
- diameter: "Di\xE2metro",
1035
- weight: "Peso",
1036
- compositions: "Composi\xE7\xE3o"
1021
+ var ImportTabLabels = {
1022
+ PRODUTOS: "Stock (PRODUTOS)",
1023
+ NOVA_ENCOMENDA: "Encomenda (NOVA_ENCOMENDA)"
1037
1024
  };
1038
- var UpdatableFieldKinds = {
1039
- designation: "text",
1025
+ var MasterColumnKinds = {
1040
1026
  price_cost: "price",
1041
1027
  price_sale: "price",
1028
+ price_sale_less_3m: "price",
1029
+ price_sale_greater_3m: "price",
1030
+ price_sale_piece: "price",
1031
+ shipping: "price",
1032
+ margin: "number",
1033
+ tax_value: "number",
1034
+ max_discount: "number",
1042
1035
  width: "length",
1043
1036
  height: "length",
1044
1037
  length: "length",
1045
1038
  diameter: "length",
1046
- weight: "weight",
1047
- compositions: "text"
1039
+ weight: "weight"
1048
1040
  };
1049
1041
  var LengthUnitEnum = {
1050
1042
  m: "m",
@@ -1060,6 +1052,19 @@ var RefMatchLabels = {
1060
1052
  exact: "Igual \xE0 ref. fornecedor",
1061
1053
  contains: "Contida na ref. fornecedor"
1062
1054
  };
1055
+ var ApplyStatusEnum = {
1056
+ applied: "applied",
1057
+ // escrito no MA
1058
+ conflict: "conflict",
1059
+ // o MA mudou desde a análise: nada escrito
1060
+ not_found: "not_found"
1061
+ // a linha já não existe no MA
1062
+ };
1063
+ var ApplyActionLabels = {
1064
+ update: "Alterar",
1065
+ create: "Criar",
1066
+ deactivate: "Desativar"
1067
+ };
1063
1068
 
1064
1069
  // src/modules/stock/promotion/interface.ts
1065
1070
  var interface_exports23 = {};
package/dist/index.js CHANGED
@@ -814,14 +814,16 @@ var Route64 = "product_location";
814
814
  // src/modules/stock/productUpdate/interface.ts
815
815
  var interface_exports22 = {};
816
816
  __export(interface_exports22, {
817
+ ApplyActionLabels: () => ApplyActionLabels,
818
+ ApplyStatusEnum: () => ApplyStatusEnum,
817
819
  ExtractErrorCodeEnum: () => ExtractErrorCodeEnum,
820
+ ImportTabEnum: () => ImportTabEnum,
821
+ ImportTabLabels: () => ImportTabLabels,
818
822
  LengthUnitEnum: () => LengthUnitEnum,
819
- MappableFieldEnum: () => MappableFieldEnum,
820
- MappableFieldLabels: () => MappableFieldLabels,
823
+ MasterColumnKinds: () => MasterColumnKinds,
821
824
  RefMatchEnum: () => RefMatchEnum,
822
825
  RefMatchLabels: () => RefMatchLabels,
823
826
  Route: () => Route65,
824
- UpdatableFieldKinds: () => UpdatableFieldKinds,
825
827
  WeightUnitEnum: () => WeightUnitEnum
826
828
  });
827
829
  var Route65 = "product_update";
@@ -837,41 +839,31 @@ var ExtractErrorCodeEnum = {
837
839
  EXTRACTION_FAILED: "EXTRACTION_FAILED"
838
840
  // outra falha
839
841
  };
840
- var MappableFieldEnum = {
841
- provider_ref: "provider_ref",
842
- // obrigatório: liga a linha do PDF ao artigo
843
- designation: "designation",
844
- price_cost: "price_cost",
845
- price_sale: "price_sale",
846
- width: "width",
847
- height: "height",
848
- length: "length",
849
- diameter: "diameter",
850
- weight: "weight",
851
- compositions: "compositions"
842
+ var ImportTabEnum = {
843
+ PRODUTOS: "PRODUTOS",
844
+ // stock
845
+ NOVA_ENCOMENDA: "NOVA_ENCOMENDA"
846
+ // encomenda (pré-artigos)
852
847
  };
853
- var MappableFieldLabels = {
854
- provider_ref: "Refer\xEAncia do fornecedor",
855
- designation: "Designa\xE7\xE3o",
856
- price_cost: "Pre\xE7o de custo",
857
- price_sale: "Pre\xE7o de venda",
858
- width: "Largura",
859
- height: "Altura",
860
- length: "Comprimento",
861
- diameter: "Di\xE2metro",
862
- weight: "Peso",
863
- compositions: "Composi\xE7\xE3o"
848
+ var ImportTabLabels = {
849
+ PRODUTOS: "Stock (PRODUTOS)",
850
+ NOVA_ENCOMENDA: "Encomenda (NOVA_ENCOMENDA)"
864
851
  };
865
- var UpdatableFieldKinds = {
866
- designation: "text",
852
+ var MasterColumnKinds = {
867
853
  price_cost: "price",
868
854
  price_sale: "price",
855
+ price_sale_less_3m: "price",
856
+ price_sale_greater_3m: "price",
857
+ price_sale_piece: "price",
858
+ shipping: "price",
859
+ margin: "number",
860
+ tax_value: "number",
861
+ max_discount: "number",
869
862
  width: "length",
870
863
  height: "length",
871
864
  length: "length",
872
865
  diameter: "length",
873
- weight: "weight",
874
- compositions: "text"
866
+ weight: "weight"
875
867
  };
876
868
  var LengthUnitEnum = {
877
869
  m: "m",
@@ -887,6 +879,19 @@ var RefMatchLabels = {
887
879
  exact: "Igual \xE0 ref. fornecedor",
888
880
  contains: "Contida na ref. fornecedor"
889
881
  };
882
+ var ApplyStatusEnum = {
883
+ applied: "applied",
884
+ // escrito no MA
885
+ conflict: "conflict",
886
+ // o MA mudou desde a análise: nada escrito
887
+ not_found: "not_found"
888
+ // a linha já não existe no MA
889
+ };
890
+ var ApplyActionLabels = {
891
+ update: "Alterar",
892
+ create: "Criar",
893
+ deactivate: "Desativar"
894
+ };
890
895
 
891
896
  // src/modules/stock/promotion/interface.ts
892
897
  var interface_exports23 = {};
@@ -1,5 +1,4 @@
1
1
  import * as IShared from "../../../shared/interface";
2
- import type { IProductState, IProductType } from "../productGoogleSheets/interface";
3
2
  export declare const Route = "product_update";
4
3
  export interface IExtractRequest {
5
4
  multimedia_ids: string[];
@@ -54,23 +53,28 @@ export type IExtractFileResult = (IExtractFileResultBase & {
54
53
  export interface IExtractResponse {
55
54
  results: IExtractFileResult[];
56
55
  }
57
- export declare const MappableFieldEnum: {
58
- provider_ref: "provider_ref";
59
- designation: "designation";
60
- price_cost: "price_cost";
61
- price_sale: "price_sale";
62
- width: "width";
63
- height: "height";
64
- length: "length";
65
- diameter: "diameter";
66
- weight: "weight";
67
- compositions: "compositions";
56
+ export declare const ImportTabEnum: {
57
+ PRODUTOS: "PRODUTOS";
58
+ NOVA_ENCOMENDA: "NOVA_ENCOMENDA";
68
59
  };
69
- export type IMappableField = (typeof MappableFieldEnum)[keyof typeof MappableFieldEnum];
70
- export type IUpdatableField = Exclude<IMappableField, "provider_ref">;
71
- export declare const MappableFieldLabels: Record<IMappableField, string>;
72
- export type IMappableFieldKind = "text" | "price" | "length" | "weight";
73
- export declare const UpdatableFieldKinds: Record<IUpdatableField, IMappableFieldKind>;
60
+ export type IImportTab = (typeof ImportTabEnum)[keyof typeof ImportTabEnum];
61
+ export declare const ImportTabLabels: Record<IImportTab, string>;
62
+ export type IColumnKind = "text" | "price" | "number" | "length" | "weight";
63
+ export declare const MasterColumnKinds: Record<string, IColumnKind>;
64
+ export interface IMasterColumn {
65
+ key: string;
66
+ letter: string;
67
+ kind: IColumnKind;
68
+ locked: string | null;
69
+ }
70
+ export interface IColumnsRequest {
71
+ tab: IImportTab;
72
+ }
73
+ export interface IColumnsResponse {
74
+ tab: IImportTab;
75
+ columns: IMasterColumn[];
76
+ suggested_match_column: string | null;
77
+ }
74
78
  export declare const LengthUnitEnum: {
75
79
  m: "m";
76
80
  cm: "cm";
@@ -88,7 +92,7 @@ export declare const RefMatchEnum: {
88
92
  };
89
93
  export type IRefMatch = (typeof RefMatchEnum)[keyof typeof RefMatchEnum];
90
94
  export declare const RefMatchLabels: Record<IRefMatch, string>;
91
- export type IAnalyzeRowValues = Partial<Record<IUpdatableField, string>>;
95
+ export type IAnalyzeRowValues = Record<string, string>;
92
96
  export interface IAnalyzeRowInput {
93
97
  page: number;
94
98
  provider_ref: string;
@@ -96,79 +100,114 @@ export interface IAnalyzeRowInput {
96
100
  }
97
101
  export interface IAnalyzeRequest {
98
102
  id_provider: number;
103
+ tab: IImportTab;
104
+ match_column: string;
99
105
  ref_match: IRefMatch;
100
- price_sale_includes_vat: boolean;
101
- new_products_vat_tax_id?: string;
102
106
  length_unit: ILengthUnit;
103
107
  weight_unit: IWeightUnit;
104
108
  rows: IAnalyzeRowInput[];
105
109
  }
106
- export type IAnalyzeValues = Partial<Record<IUpdatableField, string | number | null>>;
107
- export interface IAnalyzeUpdate {
108
- product_id: string;
110
+ export type IMasterValue = string | number | null;
111
+ export type IMasterValues = Record<string, IMasterValue>;
112
+ export interface IMasterRow {
113
+ key: string;
114
+ row_number: number;
109
115
  reference: string;
116
+ match_value: string;
117
+ state: string | null;
118
+ values: IMasterValues;
119
+ }
120
+ export interface IAnalyzeUpdate extends IMasterRow {
110
121
  provider_ref: string;
111
- product_provider_ref: string;
112
122
  page: number;
113
- current: IAnalyzeValues & {
114
- state: IProductState;
115
- };
116
- new: IAnalyzeValues;
117
- changes: IUpdatableField[];
123
+ new: IMasterValues;
124
+ changes: string[];
118
125
  reactivate: boolean;
119
126
  warnings: string[];
120
127
  }
121
128
  export interface IAnalyzeCreate {
122
129
  provider_ref: string;
123
130
  page: number;
124
- values: IAnalyzeValues;
131
+ values: IMasterValues;
125
132
  warnings: string[];
126
133
  }
127
- export interface IAnalyzeProduct {
128
- product_id: string;
129
- reference: string;
130
- provider_ref: string;
131
- designation: string;
132
- state: IProductState;
133
- price_cost: number | null;
134
- price_sale: number | null;
135
- }
136
- export type IAnalyzeDiscontinue = IAnalyzeProduct;
134
+ export type IAnalyzeDeactivate = IMasterRow;
137
135
  export interface IAnalyzeProblem {
138
136
  page: number;
139
137
  provider_ref: string | null;
140
138
  message: string;
141
139
  }
142
140
  export interface IAnalyzeResponse {
141
+ tab: IImportTab;
142
+ columns: IMasterColumn[];
143
143
  to_update: IAnalyzeUpdate[];
144
144
  to_create: IAnalyzeCreate[];
145
- to_discontinue: IAnalyzeDiscontinue[];
145
+ to_deactivate: IAnalyzeDeactivate[];
146
146
  problems: IAnalyzeProblem[];
147
147
  unchanged_count: number;
148
- without_provider_ref: IAnalyzeProduct[];
149
- }
150
- export interface IExecuteNewProducts {
151
- type: IProductType;
152
- unit_of_measure_quantity_id: string;
153
- }
154
- export interface IExecuteRequest extends IAnalyzeRequest {
155
- update_product_ids: string[];
156
- create_provider_refs: string[];
157
- discontinue_product_ids: string[];
158
- new_products?: IExecuteNewProducts;
159
- }
160
- export interface IExecuteResponse {
161
- updated: number;
162
- created: {
163
- provider_ref: string;
164
- reference: string;
165
- }[];
166
- discontinued: number;
148
+ without_match_value: IMasterRow[];
149
+ }
150
+ export interface IApplyRowItem {
151
+ key: string;
152
+ current: IMasterValues;
153
+ }
154
+ export interface IApplyUpdateRequest extends IAnalyzeRequest {
155
+ items: IApplyRowItem[];
156
+ }
157
+ export interface IApplyCreateRequest extends IAnalyzeRequest {
158
+ provider_refs: string[];
159
+ }
160
+ export interface IApplyDeactivateRequest extends IAnalyzeRequest {
161
+ items: IApplyRowItem[];
162
+ }
163
+ export declare const ApplyStatusEnum: {
164
+ applied: "applied";
165
+ conflict: "conflict";
166
+ not_found: "not_found";
167
+ };
168
+ export type IApplyStatus = (typeof ApplyStatusEnum)[keyof typeof ApplyStatusEnum];
169
+ export interface IApplyResult {
170
+ key: string;
171
+ status: IApplyStatus;
172
+ message: string | null;
173
+ }
174
+ export interface IApplyResponse {
175
+ applied: number;
176
+ results: IApplyResult[];
177
+ }
178
+ export type IApplyAction = "update" | "create" | "deactivate";
179
+ export declare const ApplyActionLabels: Record<IApplyAction, string>;
180
+ export interface IHistoryItem {
181
+ key: string;
182
+ row_number: number | null;
183
+ before: IMasterValues;
184
+ after: IMasterValues;
185
+ }
186
+ export interface IHistoryRequest {
187
+ id_provider?: number;
188
+ limit?: number;
189
+ }
190
+ export interface IHistoryEntry {
191
+ id: string;
192
+ created_at: Date;
193
+ user_id: string;
194
+ user_name: string | null;
195
+ id_provider: number;
196
+ tab: IImportTab;
197
+ action: IApplyAction;
198
+ items: IHistoryItem[];
199
+ }
200
+ export interface IHistoryResponse {
201
+ entries: IHistoryEntry[];
167
202
  }
168
203
  export interface IRepository {
169
204
  extract(data: IExtractRequest): Promise<IExtractResponse>;
205
+ columns(data: IColumnsRequest): Promise<IColumnsResponse>;
170
206
  analyze(data: IAnalyzeRequest): Promise<IAnalyzeResponse>;
171
- execute(data: IExecuteRequest): Promise<IExecuteResponse>;
207
+ applyUpdate(data: IApplyUpdateRequest): Promise<IApplyResponse>;
208
+ applyCreate(data: IApplyCreateRequest): Promise<IApplyResponse>;
209
+ applyDeactivate(data: IApplyDeactivateRequest): Promise<IApplyResponse>;
210
+ history(data: IHistoryRequest): Promise<IHistoryResponse>;
172
211
  }
173
212
  export type IController = IShared.IEntityWithUserToken<IRepository>;
174
213
  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.36",
4
+ "version": "0.49.38",
5
5
  "author": "Nomalism <it.nomalism@gmail.com> (https://nomalism.com/)",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",