@nomalism-com/types 0.40.1 → 0.40.2

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.
Files changed (37) hide show
  1. package/dist/index.cjs +259 -129
  2. package/dist/index.js +259 -129
  3. package/dist/main.d.ts +9 -1
  4. package/dist/modules/document/NPF/interface.d.ts +17 -0
  5. package/dist/modules/document/NPF/route.schema.d.ts +2 -0
  6. package/dist/modules/document/NRCL/interface.d.ts +26 -0
  7. package/dist/modules/document/NRCL/route.schema.d.ts +2 -0
  8. package/dist/modules/document/order/interfaces.d.ts +1 -0
  9. package/dist/modules/stock/chat/interfaces.d.ts +1 -0
  10. package/dist/modules/stock/dashboard/interface.d.ts +7 -3
  11. package/dist/modules/stock/prison/interface.d.ts +1 -1
  12. package/dist/modules/stock/productGoogleSheets/interface.d.ts +5 -1
  13. package/dist/modules/stock/sideMenu/interface.d.ts +18 -15
  14. package/dist/modules/stock/sideMenu/route.schema.d.ts +1 -1
  15. package/dist/modules/supply/currentAccount/interface.d.ts +157 -0
  16. package/dist/modules/supply/currentAccount/route.schema.d.ts +10 -0
  17. package/dist/modules/supply/documentHeader/interfaces.d.ts +3 -30
  18. package/dist/modules/supply/documentHeader/route.schema.d.ts +0 -1
  19. package/dist/modules/supply/documentLine/route.schema.d.ts +2 -2
  20. package/dist/modules/supply/documentLineNote/interfaces.d.ts +2 -8
  21. package/dist/modules/supply/documentLineNote/route.schema.d.ts +1 -5
  22. package/dist/modules/supply/documentType/interfaces.d.ts +1 -0
  23. package/dist/modules/supply/externalDocumentHeader/interface.d.ts +10 -11
  24. package/dist/modules/supply/orderManagement/interface.d.ts +2 -2
  25. package/dist/modules/supply/payment/interface.d.ts +2 -108
  26. package/dist/modules/supply/payment/route.schema.d.ts +0 -6
  27. package/dist/modules/supply/paymentBatch/interface.d.ts +57 -0
  28. package/dist/modules/supply/paymentBatch/route.schema.d.ts +4 -0
  29. package/dist/modules/user/chatSubscribers/interfaces.d.ts +7 -5
  30. package/dist/modules/user/chatSubscribers/route.schema.d.ts +1 -0
  31. package/dist/modules/user/providers/interface.d.ts +8 -0
  32. package/dist/modules/user/providers/route.schema.d.ts +1 -0
  33. package/dist/modules/user/storeOperator/interface.d.ts +7 -1
  34. package/dist/modules/user/storeOperator/route.schema.d.ts +1 -0
  35. package/dist/shared/entities/stock.d.ts +5 -1
  36. package/dist/shared/interface.d.ts +15 -7
  37. package/package.json +3 -3
@@ -6,7 +6,7 @@ export type Entity = Payment;
6
6
  export declare const Route = "payment";
7
7
  export declare const UpperName = "Payment";
8
8
  export declare const LowerName: string;
9
- type IEntityExtended = Entity;
9
+ export type IEntityExtended = Entity;
10
10
  export type IFindByIdResponse = Omit<IEntityExtended, ''>;
11
11
  export type IFindByOwnerIdResponse = Omit<IEntityExtended, ''>;
12
12
  export type IFindRequest = Record<string, unknown>;
@@ -25,32 +25,6 @@ export interface ICreateForThisDocumentHeaderRequest {
25
25
  export interface ICreateRequest extends ICreateForThisDocumentHeaderRequest {
26
26
  document_header_id: string;
27
27
  }
28
- export interface ICurrentAccountNotes {
29
- date: string;
30
- credit: number | null;
31
- debit: number | null;
32
- iban: string | null;
33
- payment_batch_id: string | null;
34
- payment_method: string | null;
35
- notes: string | null;
36
- owner_name: string;
37
- created_at: string;
38
- created_by: string;
39
- updated_at: string;
40
- updated_by: string;
41
- }
42
- export interface IFindCurrentAccountByOwnerIdResponse {
43
- payment_date: string;
44
- emission_date: string;
45
- document_description: string;
46
- document_name: string;
47
- debit: number;
48
- credit: number;
49
- notes: ICurrentAccountNotes[];
50
- por_regularizar: number;
51
- balance: number;
52
- href?: string | null;
53
- }
54
28
  export interface IUnpaidPurchasesRequest {
55
29
  provider_id: string;
56
30
  client_id: string | null;
@@ -72,93 +46,13 @@ export interface IUnpaidPurchasesResponse extends Pick<Entity, 'date' | 'debit'
72
46
  maturity_days: number;
73
47
  observations: IObservation.IFindByOwnerResponse[];
74
48
  }
75
- export interface IProviderPaymentDocument {
76
- document_header_id: string;
77
- value: number;
78
- discount_value?: number | null;
79
- }
80
- export interface IProviderPaymentRequest {
81
- provider_id: string;
82
- client_id: string | null;
83
- documents: IProviderPaymentDocument[];
84
- total: number;
85
- }
86
- export interface IPaymentsNotExportedRequest {
87
- whiteList?: string[];
88
- }
89
- export interface IPaymentsNotExportedResponse {
90
- iban: string;
91
- payment_ids: string[];
92
- npf_dh: {
93
- id: string;
94
- name: string;
95
- pdf_link: string | null;
96
- total: number;
97
- }[];
98
- provider: string;
99
- value: number;
100
- }
101
- export interface IExportPaymentsRequest {
102
- provider: string;
103
- value: number;
104
- npf_ids?: string[];
105
- }
106
- export type IBatchType = 'national' | 'international' | 'null';
107
- export interface IPaymentsBatchNpfDh {
108
- id: string;
109
- name: string;
110
- sent: string | null;
111
- owner_id: string;
112
- owner_number: number;
113
- owner_name: string;
114
- external_document_header_id: string | null;
115
- pdf_link: string | null;
116
- total: number;
117
- }
118
- export interface IPaymentsBatchResponse {
119
- batch_id: string;
120
- batch_value: number;
121
- batch_type: IBatchType | null;
122
- multimedia_id: string | null;
123
- times_downloaded: number;
124
- npf_dh: IPaymentsBatchNpfDh[];
125
- updated_at: Date;
126
- updated_by: string;
127
- created_at: Date;
128
- }
129
- export declare const IExportCurrentAccountOutputEnum: {
130
- csv: 'csv';
131
- pdf: 'pdf';
132
- };
133
- export type IExportCurrentAccountOutput = (typeof IExportCurrentAccountOutputEnum)[keyof typeof IExportCurrentAccountOutputEnum];
134
- export declare const IExportCurrentAccountOutputOptions: string[];
135
- export interface IExportCurrentAccountRequest {
136
- token: string;
137
- owner_id: string;
138
- output: IExportCurrentAccountOutput;
139
- start_date: Date | null;
140
- end_date: Date | null;
141
- }
142
- export interface IFindCurrentAccountPaginatedRequest extends IShared.IFindByOwnerIdRequest, IShared.IPaginationRequest {
143
- }
144
49
  export interface IRepository {
145
50
  findById(selector: IShared.IFindByIdRequest): Promise<IFindByIdResponse | null>;
146
51
  findByOwnerId(params: IShared.IFindByOwnerIdRequest): Promise<IFindByOwnerIdResponse[]>;
147
52
  find(selector: IFindRequest): Promise<IFindResponse[]>;
148
53
  findPaginated(selector: IFindPaginatedRequest): Promise<IFindWithPaginationResponse>;
149
- findPaymentsNotExported(params: IPaymentsNotExportedRequest): Promise<IPaymentsNotExportedResponse[]>;
150
- findPaymentBatches(): Promise<IPaymentsBatchResponse[]>;
151
- deleteBatch(data: IShared.IFindByIdRequest): Promise<void>;
152
- findCurrentAccountByOwnerId(params: IShared.IFindByOwnerIdRequest): Promise<IFindCurrentAccountByOwnerIdResponse[]>;
153
- findBalanceByOwnerId(params: IShared.IFindByOwnerIdRequest): Promise<number>;
154
54
  findSettledMaterialEntrance(params: IUnpaidPurchasesRequest): Promise<IUnpaidPurchasesResponse[]>;
155
- findSettledMaterialEntranceProviders(): Promise<IUser.IFindProvidersWithClientIdResponse[]>;
156
55
  findSettledMaterialEntranceByDate(params: IUnpaidByDatePurchasesRequest): Promise<IUnpaidPurchasesResponse[]>;
157
- createProvidersPayments(params: IProviderPaymentRequest[]): Promise<string[]>;
158
- exportPayments(params: IExportPaymentsRequest[]): Promise<void>;
159
- updateDownloadedBatchNumber(id: IShared.IFindByIdRequest): Promise<void>;
160
- exportCurrentAccount(params: IExportCurrentAccountRequest): Promise<IFindCurrentAccountByOwnerIdResponse[]>;
161
- findCurrentAccountPaginated(params: IFindCurrentAccountPaginatedRequest): Promise<IShared.IPaginationResponse<IFindCurrentAccountByOwnerIdResponse>>;
56
+ findSettledMaterialEntranceProviders(): Promise<IUser.IFindProvidersWithClientIdResponse[]>;
162
57
  }
163
58
  export type IController = IShared.IEntityWithUserToken<IRepository>;
164
- export {};
@@ -1,11 +1,5 @@
1
1
  import joi from 'joi';
2
- import { IPaymentsNotExportedRequest } from './interface';
3
2
  export declare const findQuery: joi.ObjectSchema<any>;
4
3
  export declare const findWithPaginationQuery: joi.ObjectSchema<any>;
5
4
  export declare const findSettledMaterialEntranceQuery: joi.ObjectSchema<any>;
6
- export declare const providerPaymentBody: joi.ArraySchema<any[]>;
7
- export declare const exportPaymentsBody: joi.ArraySchema<any[]>;
8
- export declare const exportCurrentAccountBetweenDatesQuery: joi.ObjectSchema<any>;
9
5
  export declare const findSettledMaterialEntranceBuDateParams: joi.ObjectSchema<any>;
10
- export declare const findPaymentsNotExportedQuery: joi.ObjectSchema<IPaymentsNotExportedRequest>;
11
- export declare const findCurrentAccountWithPaginationQuery: joi.ObjectSchema<any>;
@@ -0,0 +1,57 @@
1
+ import * as IShared from '../../../shared/interface';
2
+ import { Payment } from '../../../shared/entities/stock';
3
+ export type Entity = Payment;
4
+ export declare const Route = "payment";
5
+ export declare const UpperName = "Payment";
6
+ export declare const LowerName: string;
7
+ export interface IPaymentsNotExportedRequest {
8
+ whiteList?: string[];
9
+ }
10
+ export interface IPaymentsNotExportedResponse {
11
+ iban: string;
12
+ payment_ids: string[];
13
+ npf_dh: {
14
+ id: string;
15
+ name: string;
16
+ pdf_link: string | null;
17
+ total: number;
18
+ }[];
19
+ provider: string;
20
+ value: number;
21
+ }
22
+ export interface IExportPaymentsRequest {
23
+ provider: string;
24
+ value: number;
25
+ npf_ids?: string[];
26
+ }
27
+ export type IBatchType = 'national' | 'international' | 'null';
28
+ export interface IPaymentsBatchNpfDh {
29
+ id: string;
30
+ name: string;
31
+ sent: string | null;
32
+ owner_id: string;
33
+ owner_number: number;
34
+ owner_name: string;
35
+ external_document_header_id: string | null;
36
+ pdf_link: string | null;
37
+ total: number;
38
+ }
39
+ export interface IPaymentsBatchResponse {
40
+ batch_id: string;
41
+ batch_value: number;
42
+ batch_type: IBatchType | null;
43
+ multimedia_id: string | null;
44
+ times_downloaded: number;
45
+ npf_dh: IPaymentsBatchNpfDh[];
46
+ updated_at: Date;
47
+ updated_by: string;
48
+ created_at: Date;
49
+ }
50
+ export interface IRepository {
51
+ findPending(params: IPaymentsNotExportedRequest): Promise<IPaymentsNotExportedResponse[]>;
52
+ create(params: IExportPaymentsRequest[]): Promise<void>;
53
+ findCreated(): Promise<IPaymentsBatchResponse[]>;
54
+ updateDownloadNumber(id: IShared.IFindByIdRequest): Promise<void>;
55
+ deleteOne(data: IShared.IFindByIdRequest): Promise<void>;
56
+ }
57
+ export type IController = IShared.IEntityWithUserToken<IRepository>;
@@ -0,0 +1,4 @@
1
+ import joi from 'joi';
2
+ import { IPaymentsNotExportedRequest } from './interface';
3
+ export declare const exportPaymentsBody: joi.ArraySchema<any[]>;
4
+ export declare const findPaymentsNotExportedQuery: joi.ObjectSchema<IPaymentsNotExportedRequest>;
@@ -9,17 +9,19 @@ export interface ICreateOrUpdateRequest {
9
9
  document_header_id: string;
10
10
  personas_ids: string[];
11
11
  }
12
- export type IFindByIdResponse = {
12
+ export interface IFindRequest {
13
+ owner_id: string;
14
+ document_header_id: string;
15
+ }
16
+ export type IFindResponse = {
13
17
  persona_id: string;
14
18
  name: string;
15
19
  email: string;
16
20
  phone_number: string | null;
17
- }[];
21
+ };
18
22
  export interface IRepository {
19
23
  createOrUpdate(data: ICreateOrUpdateRequest): Promise<Entity[]>;
20
- findByOwnerId(selector: IShared.IFindByIdRequest): Promise<IFindByIdResponse>;
21
- findByDocumentHeaderId(selector: IShared.IFindByIdRequest): Promise<IFindByIdResponse>;
22
- findByPersonaId(selector: IShared.IFindByIdRequest): Promise<IFindByIdResponse>;
24
+ find(selector: IFindRequest): Promise<IFindResponse[]>;
23
25
  deleteOne(selector: IShared.IFindByIdRequest): Promise<void>;
24
26
  }
25
27
  export type IController = IShared.IEntityWithUserToken<IRepository>;
@@ -1,2 +1,3 @@
1
1
  import joi from 'joi';
2
2
  export declare const createOrUpdateBody: joi.ObjectSchema<any>;
3
+ export declare const findByParams: joi.ObjectSchema<any>;
@@ -1,6 +1,7 @@
1
1
  import * as IShared from '../../../shared/interface';
2
2
  import { Providers, Users, Country, ReasonForExemption, Language, ProviderType, PaymentMethods, MaturityDates, DeliveryMethods, Vehicles, Persona } from '../../../shared/entities/user';
3
3
  import type { IChatType } from '../../stock/chat/interfaces';
4
+ import type { DocumentHeader } from '../../../shared/entities/stock';
4
5
  export type Entity = Providers;
5
6
  export declare const Route = "provider";
6
7
  export declare const UpperName = "Providers";
@@ -66,6 +67,12 @@ export interface IUpdateRequest {
66
67
  default_delivery_method_id?: string;
67
68
  default_vehicle_id?: string | null;
68
69
  }
70
+ export interface IFindByNumberRequest {
71
+ number: number;
72
+ }
73
+ export interface IFindByNumberResponse extends Pick<DocumentHeader, 'owner_id' | 'owner_name' | 'billing_persona_id' | 'billing_persona_name' | 'billing_persona_nif' | 'billing_persona_email' | 'billing_persona_telephone' | 'billing_persona_address_street' | 'billing_persona_address_postal_code' | 'billing_persona_address_locality' | 'billing_persona_address_country_id' | 'billing_persona_address_country_name' | 'reason_for_exemption_id' | 'reason_for_exemption' | 'delivery_persona_id' | 'delivery_persona_name' | 'delivery_persona_email' | 'delivery_persona_telephone' | 'delivery_persona_address_street' | 'delivery_persona_address_postal_code' | 'delivery_persona_address_locality' | 'delivery_persona_address_country_id' | 'delivery_persona_address_country_name' | 'delivery_method_id' | 'delivery_method' | 'vehicle_id' | 'vehicle' | 'payment_method_id' | 'payment_method' | 'maturity_date_id' | 'maturity_date'> {
74
+ default_discount: number;
75
+ }
69
76
  export interface IRepository {
70
77
  findById(selector: IShared.IFindByIdRequest): Promise<IFindByIdResponse | null>;
71
78
  findByOwnerId(params: IShared.IFindByOwnerIdRequest): Promise<IFindByOwnerIdResponse[]>;
@@ -77,6 +84,7 @@ export interface IRepository {
77
84
  create(data: ICreateRequest): Promise<IFindResponse>;
78
85
  update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<IFindResponse | null>;
79
86
  deleteOne(selector: IShared.IFindByIdRequest): Promise<IFindResponse | null>;
87
+ findByNumber(selector: IFindByNumberRequest): Promise<IFindByNumberResponse | null>;
80
88
  }
81
89
  export type IController = IShared.IEntityWithUserToken<IRepository>;
82
90
  export {};
@@ -3,3 +3,4 @@ export declare const createBody: joi.ObjectSchema<any>;
3
3
  export declare const updateBody: joi.ObjectSchema<any>;
4
4
  export declare const findQuery: joi.ObjectSchema<any>;
5
5
  export declare const findWithPaginationQuery: joi.ObjectSchema<any>;
6
+ export declare const findByNumberParams: joi.ObjectSchema<any>;
@@ -5,7 +5,7 @@ export declare const Route = "store_operator";
5
5
  export declare const UpperName = "StoreOperator";
6
6
  export declare const LowerName: string;
7
7
  export type IFindPaginatedRequest = IShared.IPaginationRequest & Pick<Entity, 'inactive'>;
8
- export interface IFindResponse extends Pick<Entity, 'id' | 'number' | 'inactive' | 'superuser' | 'default_theme'> {
8
+ export interface IFindResponse extends Pick<Entity, 'id' | 'number' | 'pin' | 'inactive' | 'superuser' | 'default_theme'> {
9
9
  user: Pick<Users, 'id' | 'account'>;
10
10
  main_persona: Pick<Persona, 'id' | 'name' | 'email'>;
11
11
  }
@@ -22,10 +22,15 @@ export interface IUpdateRequest {
22
22
  main_persona_email?: string | null;
23
23
  user_account?: string | null;
24
24
  password?: string | null;
25
+ pin?: string;
25
26
  inactive?: boolean;
26
27
  superuser?: boolean;
27
28
  default_theme?: boolean;
28
29
  }
30
+ export interface IUpdatePasswordRequest {
31
+ password: string;
32
+ oldPassword: string;
33
+ }
29
34
  export interface IRepository {
30
35
  findMinified(params?: IShared.IFindMinifiedRequest): Promise<IShared.IFindMinifiedResponse[]>;
31
36
  find(): Promise<IFindResponse[]>;
@@ -33,5 +38,6 @@ export interface IRepository {
33
38
  create(data: ICreateRequest): Promise<string>;
34
39
  update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<void>;
35
40
  deleteOne(selector: IShared.IFindByIdRequest): Promise<void>;
41
+ updatePassword(selector: IShared.IFindByIdRequest, data: IUpdatePasswordRequest): Promise<void>;
36
42
  }
37
43
  export type IController = IShared.IEntityWithUserToken<IRepository>;
@@ -2,3 +2,4 @@ import joi from 'joi';
2
2
  export declare const createBody: joi.ObjectSchema<any>;
3
3
  export declare const updateStoreOperatorQuery: joi.ObjectSchema<any>;
4
4
  export declare const findWithPaginationQuery: joi.ObjectSchema<any>;
5
+ export declare const updatePasswordBody: joi.ObjectSchema<any>;
@@ -1,6 +1,6 @@
1
1
  import { IConflict } from '../../modules/document/propostaSheets/interface';
2
2
  import { IDocumentTypeUserType, IDocumentTypeCodeType } from '../../modules/supply/documentType/interfaces';
3
- import { IBatchType } from '../../modules/supply/payment/interface';
3
+ import { IBatchType } from '../../modules/supply/paymentBatch/interface';
4
4
  import { IProductType } from '../../modules/stock/productGoogleSheets/interface';
5
5
  import { IImageType } from '../../modules/stock/productImage/interface';
6
6
  import { ITagType } from '../../modules/stock/tag/interface';
@@ -18,6 +18,7 @@ import type { ProjectInfo } from './integration';
18
18
  */
19
19
  export type Chat = {
20
20
  id: string;
21
+ owner_id: string;
21
22
  document_header_id: string;
22
23
  message: string;
23
24
  email_processed: boolean;
@@ -308,6 +309,7 @@ export type DocumentHeader = {
308
309
  is_void: boolean;
309
310
  is_void_reason: string | null;
310
311
  is_force_adjudicated: boolean;
312
+ confirmed: boolean;
311
313
  origin_id: string | null;
312
314
  who_handles: string | null;
313
315
  warning: string | null;
@@ -884,6 +886,7 @@ export type DocumentLineBaseVirtuals = {
884
886
  invoice_document_header_external_id: string | null;
885
887
  invoice_external_id: string | null;
886
888
  credit_note_id: string | null;
889
+ df_pdf: boolean;
887
890
  levantar_df: boolean;
888
891
  df_enviada: boolean;
889
892
  df_fechada: boolean;
@@ -946,6 +949,7 @@ export type DocumentLineVirtuals = {
946
949
  invoice_document_header_external_id: string | null;
947
950
  invoice_id: string | null;
948
951
  credit_note_id: string | null;
952
+ df_pdf: boolean;
949
953
  client_start_id: string | null;
950
954
  provider_start_id: string | null;
951
955
  state: string;
@@ -111,7 +111,12 @@ export declare const findByOwnerIdQueryKeys: IRouteRequest<IFindByOwnerIdRequest
111
111
  export declare const findByOwnerIdQuery: joi.ObjectSchema<any>;
112
112
  export declare const idParam: joi.ObjectSchema<any>;
113
113
  export declare const idNumberParam: joi.ObjectSchema<any>;
114
- export declare const findMinifiedReponse: joi.ArraySchema<any[]>;
114
+ export declare const findMinifiedReponse: joi.ArraySchema<{
115
+ name: unknown;
116
+ id: unknown;
117
+ group: unknown;
118
+ multimedia_id: unknown;
119
+ }[]>;
115
120
  export declare const joiValidateStamps: IRouteResponseWithoutStamps<WithTimestampsOriginID>;
116
121
  export declare const IUserSendEmailDocumentTemplateEnum: {
117
122
  generic: 'generic';
@@ -265,13 +270,16 @@ export type IBrokerTopicPayload = {
265
270
  warningErrors: string[];
266
271
  };
267
272
  [IBrokerTopic.dispatch_chat_message]: {
268
- to: {
269
- email: string;
270
- name: string;
271
- phone_number: string | null;
272
- }[];
273
+ to: [
274
+ {
275
+ email: string;
276
+ name: string;
277
+ phone_number: string | null;
278
+ }
279
+ ];
273
280
  reply_url: string;
274
- document_header_id: string;
281
+ owner_id: string;
282
+ document_header_id: string | null;
275
283
  document_name: string;
276
284
  chat_id: string;
277
285
  email_subject?: string;
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.40.1",
4
+ "version": "0.40.2",
5
5
  "author": "Nomalism <it.nomalism@gmail.com> (https://nomalism.com/)",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",
@@ -26,11 +26,11 @@
26
26
  "prepack": "npm run lint && npm run build"
27
27
  },
28
28
  "dependencies": {
29
- "joi": "^17.13.3"
29
+ "joi": "^18.0.1"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@swc/core": "^1.11.29",
33
- "@types/node": "^22.15.21",
33
+ "@types/node": "^24.3.0",
34
34
  "@typescript-eslint/eslint-plugin": "^8.32.1",
35
35
  "@typescript-eslint/parser": "^8.32.1",
36
36
  "eslint": "^9.27.0",