@nomalism-com/types 1.3.39 → 1.3.41

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 (30) hide show
  1. package/dist/index.js +156 -58
  2. package/dist/main.d.ts +4 -1
  3. package/dist/modules/document/billOfLading/interfaces.d.ts +2 -0
  4. package/dist/modules/document/materialEntrance/interfaces.d.ts +1 -0
  5. package/dist/modules/document/order/interfaces.d.ts +5 -0
  6. package/dist/modules/document/order/route.schema.d.ts +1 -0
  7. package/dist/modules/sms/smsSender/interfaces.d.ts +42 -0
  8. package/dist/modules/sms/smsTemplate/interfaces.d.ts +29 -0
  9. package/dist/modules/sms/smsTemplate/route.schema.d.ts +5 -0
  10. package/dist/modules/stock/dashboard/interface.d.ts +20 -0
  11. package/dist/modules/stock/dashboard/route.schema.d.ts +1 -0
  12. package/dist/modules/supply/documentHeader/interfaces.d.ts +1 -0
  13. package/dist/modules/supply/documentHeaderSubscriber/interface.d.ts +1 -1
  14. package/dist/modules/supply/documentHeaderSurvey/interfaces.d.ts +36 -1
  15. package/dist/modules/supply/documentHeaderSurvey/route.schema.d.ts +2 -0
  16. package/dist/modules/supply/documentLine/interfaces.d.ts +8 -0
  17. package/dist/modules/ui/portal/interface.d.ts +5 -1
  18. package/dist/modules/ui/portal/route.schema.d.ts +1 -0
  19. package/dist/modules/user/chatSubscribers/interfaces.d.ts +10 -1
  20. package/dist/modules/user/chatSubscribers/route.schema.d.ts +1 -0
  21. package/dist/modules/user/storeOperator/interface.d.ts +4 -0
  22. package/dist/modules/user/storeOperator/route.schema.d.ts +1 -0
  23. package/dist/modules/user/timeSheet/interfaces.d.ts +32 -53
  24. package/dist/modules/user/timeSheet/route.schema.d.ts +3 -0
  25. package/dist/modules/view/webSocket/interfaces.d.ts +23 -0
  26. package/dist/shared/entities/sms.d.ts +31 -0
  27. package/dist/shared/entities/stock.d.ts +7 -2
  28. package/dist/shared/entities/user.d.ts +7 -18
  29. package/dist/shared/interface.d.ts +14 -1
  30. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -206,6 +206,9 @@ __export(main_exports, {
206
206
  SideMenuRoutes: () => route_schema_exports100,
207
207
  SidemenuHighlight: () => interface_exports56,
208
208
  SidemenuHighlightRoutes: () => route_schema_exports101,
209
+ SmsSender: () => interfaces_exports63,
210
+ SmsTemplate: () => interfaces_exports64,
211
+ SmsTemplateRoutes: () => route_schema_exports120,
209
212
  StartDocumentHeaderLastUpdate: () => interface_exports42,
210
213
  StockMovement: () => interface_exports36,
211
214
  StockMovementRoutes: () => route_schema_exports57,
@@ -470,7 +473,9 @@ var IBrokerTopic = /* @__PURE__ */ ((IBrokerTopic2) => {
470
473
  IBrokerTopic2["tickets_change"] = "tickets_change";
471
474
  IBrokerTopic2["push_notification"] = "push_notification";
472
475
  IBrokerTopic2["portal_subscriber_events"] = "portal_subscriber_events";
476
+ IBrokerTopic2["portal_document_events"] = "portal_document_events";
473
477
  IBrokerTopic2["sidemenu_highlight_changed"] = "sidemenu_highlight_changed";
478
+ IBrokerTopic2["proposta_sheets_import_status"] = "proposta_sheets_import_status";
474
479
  IBrokerTopic2["user_send_email_password"] = "user_send_email_password";
475
480
  IBrokerTopic2["grant_access"] = "grant_access";
476
481
  IBrokerTopic2["remove_access"] = "remove_access";
@@ -1560,6 +1565,7 @@ var updateBodyKeys8 = {
1560
1565
  owner_id: joi10.string().uuid().optional(),
1561
1566
  owner_number: joi10.number().integer().positive().optional(),
1562
1567
  owner_name: joi10.string().optional(),
1568
+ owner_ref_document: joi10.string().allow(null, "").optional(),
1563
1569
  reason_for_exemption_id: joi10.string().uuid().allow(null).optional(),
1564
1570
  reason_for_exemption: joi10.string().allow(null).optional(),
1565
1571
  billing_persona_id: joi10.string().uuid().allow(null).optional(),
@@ -1702,9 +1708,11 @@ var deliveryAddress = {
1702
1708
  delivery_departure_street: joi10.string().required(),
1703
1709
  delivery_departure_locality: joi10.string().required(),
1704
1710
  delivery_departure_postal_code: joi10.string().required(),
1711
+ delivery_departure_country_id: joi10.string().uuid().required(),
1705
1712
  delivery_street: joi10.string().required(),
1706
1713
  delivery_locality: joi10.string().required(),
1707
- delivery_postal_code: joi10.string().required()
1714
+ delivery_postal_code: joi10.string().required(),
1715
+ delivery_country_id: joi10.string().uuid().required()
1708
1716
  };
1709
1717
  var createBillOfLadingBodyKeys = {
1710
1718
  persona_id: joi10.string().uuid().required(),
@@ -1951,6 +1959,7 @@ var updateManyKeys = {
1951
1959
  provider_estimated_delivery_date: joi10.date().allow(null, "").optional(),
1952
1960
  provider_purchase_discount: joi10.number().positive().allow(0).max(100).optional(),
1953
1961
  consignacao: joi10.boolean().optional(),
1962
+ abater_na_fatura_final: joi10.boolean().optional(),
1954
1963
  cancelled: joi10.boolean().optional(),
1955
1964
  force_closed: joi10.boolean().optional()
1956
1965
  };
@@ -2960,6 +2969,7 @@ var route_schema_exports44 = {};
2960
2969
  __export(route_schema_exports44, {
2961
2970
  createBody: () => createBody32,
2962
2971
  findWithPaginationQuery: () => findWithPaginationQuery18,
2972
+ updateOwnPinBody: () => updateOwnPinBody,
2963
2973
  updatePasswordBody: () => updatePasswordBody,
2964
2974
  updateStoreOperatorQuery: () => updateStoreOperatorQuery
2965
2975
  });
@@ -2992,6 +3002,10 @@ var updatePasswordBodyKeys = {
2992
3002
  oldPassword: joi10.string().required()
2993
3003
  };
2994
3004
  var updatePasswordBody = joi10.object().keys(updatePasswordBodyKeys).messages(messages);
3005
+ var updateOwnPinBodyKeys = {
3006
+ pin: joi10.string().required()
3007
+ };
3008
+ var updateOwnPinBody = joi10.object().keys(updateOwnPinBodyKeys).messages(messages);
2995
3009
 
2996
3010
  // src/modules/user/systemModule/interface.ts
2997
3011
  var interface_exports27 = {};
@@ -4269,6 +4283,7 @@ var Route85 = "order";
4269
4283
  var route_schema_exports80 = {};
4270
4284
  __export(route_schema_exports80, {
4271
4285
  conferirEncomendaClienteBody: () => conferirEncomendaClienteBody,
4286
+ createProviderOrderChatBody: () => createProviderOrderChatBody,
4272
4287
  findByIdsQuery: () => findByIdsQuery,
4273
4288
  findQuery: () => findQuery32,
4274
4289
  setProviderBody: () => setProviderBody,
@@ -4346,6 +4361,11 @@ var undoProviderOrderBodyKeys = {
4346
4361
  send_notification: joi10.boolean().required()
4347
4362
  };
4348
4363
  var undoProviderOrderBody = joi10.object().keys(undoProviderOrderBodyKeys).messages(messages);
4364
+ var createProviderOrderChatBodyKeys = {
4365
+ from_header: joi10.array().items(joi10.string().uuid().required()).required(),
4366
+ from_lines: joi10.array().items(joi10.string().uuid().required()).required()
4367
+ };
4368
+ var createProviderOrderChatBody = joi10.object().keys(createProviderOrderChatBodyKeys).messages(messages);
4349
4369
  var conferirEncomendaClienteBody = joi10.object().keys({
4350
4370
  option: joi10.string().valid(...estadoEncomendaValues).required(),
4351
4371
  document_line_ids: joi10.array().items(joi10.string().uuid().required()).required(),
@@ -4421,7 +4441,8 @@ __export(route_schema_exports81, {
4421
4441
  });
4422
4442
  var finalizarEntradaDeMaterialBodyKeys = {
4423
4443
  provider_id: joi10.string().uuid().required(),
4424
- saved_em_picking_ids: joi10.array().items(joi10.string().uuid().required()).optional()
4444
+ saved_em_picking_ids: joi10.array().items(joi10.string().uuid().required()).optional(),
4445
+ store_operator_id: joi10.string().uuid().required()
4425
4446
  };
4426
4447
  var finalizarEntradaDeMaterialBody = joi10.object().keys(finalizarEntradaDeMaterialBodyKeys).messages(messages);
4427
4448
  var undoEntradaDeMaterialBodyKeys = {
@@ -5117,13 +5138,19 @@ var Route105 = "dashboard";
5117
5138
  // src/modules/stock/dashboard/route.schema.ts
5118
5139
  var route_schema_exports98 = {};
5119
5140
  __export(route_schema_exports98, {
5120
- findByDateParams: () => findByDateParams
5141
+ findByDateParams: () => findByDateParams,
5142
+ findTodoCountsParams: () => findTodoCountsParams
5121
5143
  });
5122
5144
  var findByDateKeys = {
5123
5145
  date: joi10.date().required(),
5124
5146
  name: joi10.string().valid("dia", "mes", "ano").required()
5125
5147
  };
5126
5148
  var findByDateParams = joi10.object().keys(findByDateKeys).messages(messages);
5149
+ var findTodoCountsKeys = {
5150
+ from: joi10.date().required(),
5151
+ to: joi10.date().required()
5152
+ };
5153
+ var findTodoCountsParams = joi10.object().keys(findTodoCountsKeys).messages(messages);
5127
5154
 
5128
5155
  // src/modules/stock/chatRapidMessage/interface.ts
5129
5156
  var interface_exports54 = {};
@@ -5318,6 +5345,7 @@ var Route113 = "chat_subscriber";
5318
5345
  var route_schema_exports105 = {};
5319
5346
  __export(route_schema_exports105, {
5320
5347
  createOrUpdateBody: () => createOrUpdateBody2,
5348
+ emailTokenParam: () => emailTokenParam,
5321
5349
  findDocumentHeaderSubscribersByLanguageQuery: () => findDocumentHeaderSubscribersByLanguageQuery,
5322
5350
  findDocumentHeaderSubscribersQuery: () => findDocumentHeaderSubscribersQuery,
5323
5351
  findSubscribedDocumentHeadersQuery: () => findSubscribedDocumentHeadersQuery
@@ -5340,6 +5368,9 @@ var findSubscribedDocumentHeadersQueryKeys = {
5340
5368
  owner_id: joi10.string().uuid().required()
5341
5369
  };
5342
5370
  var findSubscribedDocumentHeadersQuery = joi10.object().keys(findSubscribedDocumentHeadersQueryKeys).messages(messages);
5371
+ var emailTokenParam = joi10.object().keys({
5372
+ token: joi10.string().pattern(/^[a-f0-9]{64}$/).required()
5373
+ }).messages(messages);
5343
5374
 
5344
5375
  // src/modules/stock/tag/interface.ts
5345
5376
  var interface_exports59 = {};
@@ -5540,8 +5571,14 @@ var IPublicDocumentHeaderNoteType = /* @__PURE__ */ ((IPublicDocumentHeaderNoteT
5540
5571
  var route_schema_exports111 = {};
5541
5572
  __export(route_schema_exports111, {
5542
5573
  createNoteBody: () => createNoteBody,
5574
+ publicFindBySubscriberQuery: () => publicFindBySubscriberQuery,
5543
5575
  updateNoteBody: () => updateNoteBody
5544
5576
  });
5577
+ var publicFindBySubscriberQueryKeys = {
5578
+ id: joi10.alternatives().try(joi10.string().uuid(), joi10.string().pattern(/^[a-f0-9]{64}$/)).required(),
5579
+ document_header_id: joi10.string().uuid().optional()
5580
+ };
5581
+ var publicFindBySubscriberQuery = joi10.object().keys(publicFindBySubscriberQueryKeys).messages(messages);
5545
5582
  var createNoteBodyKeys = {
5546
5583
  document_header_id: joi10.string().uuid().required(),
5547
5584
  note: joi10.string().required(),
@@ -5622,9 +5659,14 @@ var Route125 = "document_header_survey";
5622
5659
  // src/modules/supply/documentHeaderSurvey/route.schema.ts
5623
5660
  var route_schema_exports114 = {};
5624
5661
  __export(route_schema_exports114, {
5662
+ findQuery: () => findQuery34,
5625
5663
  updateSentBody: () => updateSentBody,
5626
5664
  updateSurveyBody: () => updateSurveyBody
5627
5665
  });
5666
+ var findQuery34 = joi10.object().keys({
5667
+ date_start: joi10.date().required(),
5668
+ date_end: joi10.date().required()
5669
+ }).messages(messages);
5628
5670
  var updateSentBodyKeys = {
5629
5671
  document_header_id: joi10.string().uuid().required(),
5630
5672
  persona_id: joi10.string().uuid().required()
@@ -5651,7 +5693,7 @@ __export(route_schema_exports115, {
5651
5693
  });
5652
5694
  var createBodyKeys63 = {
5653
5695
  document_header_id: joi10.string().uuid().required(),
5654
- store_operator_id: joi10.string().uuid().required()
5696
+ user_id: joi10.string().uuid().required()
5655
5697
  };
5656
5698
  var createBody64 = joi10.object().keys(createBodyKeys63).messages(messages);
5657
5699
 
@@ -5706,84 +5748,88 @@ var printLocationsQuery = joi10.object({
5706
5748
  // src/modules/user/timeSheet/interfaces.ts
5707
5749
  var interfaces_exports61 = {};
5708
5750
  __export(interfaces_exports61, {
5709
- IClockTypeEnum: () => IClockTypeEnum,
5710
- IRegistryTypeEnum: () => IRegistryTypeEnum,
5711
- ITimesheetStateEnum: () => ITimesheetStateEnum,
5751
+ ITimeSheetRecordTypeEnum: () => ITimeSheetRecordTypeEnum,
5752
+ ITimeSheetRegistryTypeEnum: () => ITimeSheetRegistryTypeEnum,
5712
5753
  Route: () => Route131,
5713
- clockTypes: () => clockTypes,
5714
- registryTypes: () => registryTypes,
5715
- timesheetStates: () => timesheetStates
5754
+ timeSheetRecordTypes: () => timeSheetRecordTypes,
5755
+ timeSheetRegistryTypes: () => timeSheetRegistryTypes
5716
5756
  });
5717
5757
  var Route131 = "time_sheet";
5718
- var IClockTypeEnum = {
5758
+ var ITimeSheetRecordTypeEnum = {
5719
5759
  ENTRY: "ENTRY",
5720
- EXIT: "EXIT"
5760
+ EXIT: "EXIT",
5761
+ CREDIT: "CREDIT",
5762
+ DEBIT: "DEBIT"
5721
5763
  };
5722
- var clockTypes = Object.keys(IClockTypeEnum);
5723
- var IRegistryTypeEnum = {
5764
+ var timeSheetRecordTypes = Object.values(ITimeSheetRecordTypeEnum);
5765
+ var ITimeSheetRegistryTypeEnum = {
5724
5766
  AUTOMATIC: "AUTOMATIC",
5725
5767
  MANUAL: "MANUAL"
5726
5768
  };
5727
- var registryTypes = Object.keys(IRegistryTypeEnum);
5728
- var ITimesheetStateEnum = {
5729
- CONFIRMED: "CONFIRMED",
5730
- PENDING: "PENDING",
5731
- ERROR: "ERROR"
5732
- };
5733
- var timesheetStates = Object.keys(ITimesheetStateEnum);
5769
+ var timeSheetRegistryTypes = Object.values(ITimeSheetRegistryTypeEnum);
5734
5770
 
5735
5771
  // src/modules/user/timeSheet/route.schema.ts
5736
5772
  var route_schema_exports118 = {};
5737
5773
  __export(route_schema_exports118, {
5738
5774
  createBody: () => createBody65,
5775
+ dailySummaryQuery: () => dailySummaryQuery,
5776
+ findByDateQuery: () => findByDateQuery,
5777
+ findQuery: () => findQuery35,
5739
5778
  updateBody: () => updateBody56
5740
5779
  });
5741
- var clockSchema = joi10.object({
5742
- id: joi10.string().uuid(),
5743
- time: joi10.date().required(),
5744
- type: joi10.string().valid(...Object.values(IClockTypeEnum)).required(),
5745
- registry_type: joi10.string().valid(...Object.values(IRegistryTypeEnum)).required(),
5746
- note: joi10.string().allow("", null).optional(),
5747
- created_by: joi10.string().uuid().required(),
5748
- // 👈 Adicionado para auditoria nos updates
5749
- updated_by: joi10.string().uuid().required()
5750
- // 👈 Adicionado para auditoria nos updates
5751
- });
5752
5780
  var createBodyKeys64 = {
5753
- date: joi10.date().required(),
5754
5781
  user_id: joi10.string().uuid().required(),
5755
- total_worked: joi10.number().integer().min(0),
5756
- balance: joi10.number().integer(),
5757
- state: joi10.string().valid(...Object.values(ITimesheetStateEnum)),
5782
+ type: joi10.string().valid("ENTRY", "EXIT", "CREDIT", "DEBIT").required(),
5783
+ time: joi10.when("type", {
5784
+ is: joi10.string().valid("ENTRY", "EXIT"),
5785
+ then: joi10.date().required(),
5786
+ otherwise: joi10.date().optional().allow(null)
5787
+ }),
5788
+ minutes: joi10.when("type", {
5789
+ is: joi10.string().valid("CREDIT", "DEBIT"),
5790
+ then: joi10.number().integer().min(1).required(),
5791
+ otherwise: joi10.number().optional().allow(null)
5792
+ }),
5793
+ registry_type: joi10.string().valid("AUTOMATIC", "MANUAL").default("MANUAL").optional(),
5794
+ note: joi10.string().allow("", null).optional(),
5758
5795
  created_by: joi10.string().uuid().required(),
5759
- // 👈 Adicionado na raiz do dia
5760
- updated_by: joi10.string().uuid().required(),
5761
- // 👈 Adicionado na raiz do dia
5762
- // Objeto opcional para quando se cria o dia já com a primeira picagem
5763
- clock: joi10.object({
5764
- time: joi10.date(),
5765
- type: joi10.string().valid(...Object.values(IClockTypeEnum)).required(),
5766
- registry_type: joi10.string().valid(...Object.values(IRegistryTypeEnum)).required(),
5767
- note: joi10.string().allow("", null).optional(),
5768
- created_by: joi10.string().uuid().required(),
5769
- // 👈 Adicionado no clock interno
5770
- updated_by: joi10.string().uuid().required()
5771
- // 👈 Adicionado no clock interno
5772
- })
5796
+ updated_by: joi10.string().uuid().required()
5773
5797
  };
5774
5798
  var createBody65 = joi10.object().keys(createBodyKeys64).messages(messages);
5775
5799
  var updateBodyKeys54 = {
5776
- total_worked: joi10.number().integer().min(0),
5777
- balance: joi10.number().integer(),
5778
- state: joi10.string().valid(...Object.values(ITimesheetStateEnum)),
5779
- created_by: joi10.string().uuid().optional(),
5780
- // 💡 Opcional no update para manter o original se quiseres
5800
+ type: joi10.string().valid("ENTRY", "EXIT", "CREDIT", "DEBIT").optional(),
5801
+ time: joi10.when("type", {
5802
+ is: joi10.string().valid("ENTRY", "EXIT"),
5803
+ then: joi10.date().optional(),
5804
+ otherwise: joi10.date().optional().allow(null)
5805
+ }),
5806
+ minutes: joi10.when("type", {
5807
+ is: joi10.string().valid("CREDIT", "DEBIT"),
5808
+ then: joi10.number().integer().min(1).optional(),
5809
+ otherwise: joi10.number().optional().allow(null)
5810
+ }),
5811
+ note: joi10.string().allow("", null).optional(),
5781
5812
  updated_by: joi10.string().uuid().required(),
5782
- // 👈 Obrigatório no update do dia
5783
- // Array de picagens enviado pelo formulário de edição
5784
- clocks: joi10.array().items(clockSchema)
5813
+ updated_at: joi10.date().optional()
5785
5814
  };
5786
5815
  var updateBody56 = joi10.object().keys(updateBodyKeys54).messages(messages);
5816
+ var findQueryKeys32 = {
5817
+ user_id: joi10.string().uuid().optional(),
5818
+ start_date: joi10.date().optional(),
5819
+ end_date: joi10.date().optional()
5820
+ };
5821
+ var findQuery35 = joi10.object().keys(findQueryKeys32).messages(messages);
5822
+ var findByDateQueryKeys = {
5823
+ user_id: joi10.string().uuid().required(),
5824
+ date: joi10.string().isoDate().required()
5825
+ };
5826
+ var findByDateQuery = joi10.object().keys(findByDateQueryKeys).messages(messages);
5827
+ var dailySummaryQueryKeys = {
5828
+ user_id: joi10.string().uuid().required(),
5829
+ start_date: joi10.string().isoDate().required(),
5830
+ end_date: joi10.string().isoDate().required()
5831
+ };
5832
+ var dailySummaryQuery = joi10.object().keys(dailySummaryQueryKeys).messages(messages);
5787
5833
 
5788
5834
  // src/modules/document/CAT/interfaces.ts
5789
5835
  var interfaces_exports62 = {};
@@ -5804,6 +5850,58 @@ var createBody66 = joi10.object().keys({
5804
5850
  document_line_ids: joi10.array().items(joi10.string().uuid().required()).required()
5805
5851
  }).messages(messages);
5806
5852
 
5853
+ // src/modules/sms/smsSender/interfaces.ts
5854
+ var interfaces_exports63 = {};
5855
+ __export(interfaces_exports63, {
5856
+ ISmsSenderStatsEnum: () => ISmsSenderStatsEnum,
5857
+ Route: () => Route133,
5858
+ timeSheetRecordTypes: () => timeSheetRecordTypes2
5859
+ });
5860
+ var Route133 = "sms_sender";
5861
+ var ISmsSenderStatsEnum = {
5862
+ PENDING: "PENDING",
5863
+ PROCESSING: "PROCESSING",
5864
+ SENT: "SENT",
5865
+ FAILED: "FAILED"
5866
+ };
5867
+ var timeSheetRecordTypes2 = Object.values(ISmsSenderStatsEnum);
5868
+
5869
+ // src/modules/sms/smsTemplate/interfaces.ts
5870
+ var interfaces_exports64 = {};
5871
+ __export(interfaces_exports64, {
5872
+ Route: () => Route134
5873
+ });
5874
+ var Route134 = "sms_template";
5875
+
5876
+ // src/modules/sms/smsTemplate/route.schema.ts
5877
+ var route_schema_exports120 = {};
5878
+ __export(route_schema_exports120, {
5879
+ createBody: () => createBody67,
5880
+ idParam: () => idParam2,
5881
+ keyParam: () => keyParam,
5882
+ updateBody: () => updateBody57
5883
+ });
5884
+ var createBodyKeys65 = {
5885
+ key: joi10.string().required(),
5886
+ name: joi10.string().required(),
5887
+ message: joi10.string().required(),
5888
+ variables: joi10.object().pattern(joi10.string(), joi10.alternatives().try(joi10.string(), joi10.number(), joi10.boolean())).optional()
5889
+ };
5890
+ var createBody67 = joi10.object().keys(createBodyKeys65).messages(messages);
5891
+ var updateBodyKeys55 = {
5892
+ name: joi10.string().optional(),
5893
+ message: joi10.string().optional(),
5894
+ key: joi10.string().optional(),
5895
+ variables: joi10.object().pattern(joi10.string(), joi10.alternatives().try(joi10.string(), joi10.number(), joi10.boolean())).optional()
5896
+ };
5897
+ var updateBody57 = joi10.object().keys(updateBodyKeys55).messages(messages);
5898
+ var idParam2 = joi10.object().keys({
5899
+ id: joi10.string().uuid().required()
5900
+ }).messages(messages);
5901
+ var keyParam = joi10.object().keys({
5902
+ key: joi10.string().required()
5903
+ }).messages(messages);
5904
+
5807
5905
  // src/index.ts
5808
5906
  var index_default = main_exports;
5809
5907
 
package/dist/main.d.ts CHANGED
@@ -255,4 +255,7 @@ import * as TimeSheet from './modules/user/timeSheet/interfaces';
255
255
  import * as TimeSheetRoutes from './modules/user/timeSheet/route.schema';
256
256
  import * as Catalogo from './modules/document/CAT/interfaces';
257
257
  import * as CatalogoRoutes from './modules/document/CAT/route.schema';
258
- export { shared, viewErrors, stockErrors, userErrors, documentManagementErrors, integrationErrors, ZipCode, ZipCodeRoutes, BankData, BankDataRoutes, Client, ClientRoutes, ClientType, ClientTypeRoutes, Chat, ChatRoutes, Commissioner, CommissionerRoutes, Country, CountryRoutes, DeliveryMethods, DeliveryMethodsRoutes, DocumentHeader, DocumentHeaderRoutes, DocumentHeaderHistory, BillOfLading, BillOfLadingRoutes, ProductionOrder, ProductionOrderRoutes, Proforma, ProformaRoutes, PropostaFornecedor, PropostaFornecedorRoutes, ProviderCreditNoteFromReturn, ProviderCreditNoteFromReturnRoutes, ProviderFinancialCreditNote, ProviderFinancialCreditNoteRoutes, ProviderServiceInvoice, ProviderServiceInvoiceRoutes, DocumentLine, DocumentLineRoutes, DocumentLineAssoc, DocumentSet, DocumentSetRoutes, DocumentType, DocumentTypeRoutes, ExternalDocumentType, ExternalDocumentHeader, ExternalDocumentHeaderRoutes, Favorites, FavoritesRoutes, File, FileRoutes, GoogleSheets, GoogleSheetsRoutes, Language, LanguageRoutes, Location, LocationRoutes, MaturityDates, MaturityDatesRoutes, Multimedia, MultimediaRoutes, OrderManagement, Observation, ObservationRoutes, ObservationType, ObservationTypeRoutes, Password, PasswordRoutes, Payment, PaymentRoutes, PaymentMethods, PaymentMethodsRoutes, ProductImage, ProductImageRoutes, Promotion, PromotionRoutes, PromotionAssoc, PromotionAssocRoutes, Providers, ProvidersRoutes, ProviderType, ProviderTypeRoutes, PurchaseConditions, PurchaseConditionsRoutes, ReasonForExemption, ReasonForExemptionRoutes, RefreshToken, RefreshTokenRoutes, SegmentsArea, SegmentsAreaRoutes, Sessions, SessionsRoutes, Shippings, ShippingsRoutes, StoreOperator, StoreOperatorRoutes, SystemModule, SystemModuleRoutes, Swift, SwiftRoutes, TypeOfLocation, TypeOfLocationRoutes, UnitOfMeasure, UnitOfMeasureRoutes, UserPositions, UserPositionsRoutes, Users, UsersRoutes, UserTokens, UserTokensRoutes, VatValidation, VatValidationRoutes, VatTax, VatTaxRoutes, VatTaxZone, VatTaxZoneRoutes, Vehicles, VehiclesRoutes, Workflow, WorkflowRoutes, StockMovement, StockMovementRoutes, Tenant, TenantRoutes, PreSale, PreSaleRoutes, PreSaleProduct, PreSaleProductRoutes, Npc, NpcRoutes, Printer, PrinterRoutes, SchedulePrintJob, SchedulePrintJobRoutes, QueryList, QueryListRoutes, QueryParameter, QueryParameterRoutes, ReturnReason, ReturnReasonRoutes, PropostaSheets, PropostaSheetsRoutes, Schedule, ScheduleRoutes, GoogleFilePermission, GoogleFilePermissionRoutes, Settings, SettingsRoutes, Tickets, TicketsRoutes, Channel, ChannelRoutes, TicketsLanguage, TicketsLanguageRoutes, CLT, CLTRoutes, StartDocumentHeaderLastUpdate, Persona, PersonaRoutes, ProjectInfo, ProjectInfoRoutes, EmailVerification, EmailVerificationRoutes, EmailLog, EmailLogRoutes, Purchase, PurchaseRoutes, Order, OrderRoutes, MaterialEntrance, MaterialEntranceRoutes, Transformado, TransformadoRoutes, Quebra, QuebraRoutes, UpfrontReturn, UpfrontReturnRoutes, SavedEmPicking, SavedEmPickingRoutes, EmailTemplate, EmailTemplateRoutes, EmailTemplateAttachment, EmailTemplateAttachmentRoutes, Inventario, InventarioRoutes, ReturnToProvider, ReturnToProviderRoutes, Prison, PrisonRoutes, DocumentLineNote, DocumentLineNoteRoutes, SavedProviderProposal, SavedProviderProposalRoutes, ProductGoogleSheets, ProductGoogleSheetsRoutes, Task, TaskRoutes, TaskMessage, TaskMessageRoutes, RecurrentTasks, TaskRead, TaskReadRoutes, Theme, ThemeRoutes, Dashboard, DashboardRoutes, ChatRapidMessage, ChatRapidMessageRoutes, SideMenu, SideMenuRoutes, SidemenuHighlight, SidemenuHighlightRoutes, AdminPanel, ErrorLog, ErrorLogRoutes, DocumentLineRm, DocumentLineRmRoutes, DocumentLineMt, DocumentLineMtRoutes, ChatSubscriber, ChatSubscriberRoutes, Tag, TagRoutes, Gmails, NPF, NPFRoutes, NRCL, NRCLRoutes, CurrentAccount, CurrentAccountRoutes, PaymentBatch, PaymentBatchRoutes, Portal, PortalRoutes, GoogleSheetPool, AccountCode, AccountCodeRoutes, LLM, LLMRoutes, PatchNotes, ConferirEncomenda, DocumentHeaderSurvey, DocumentHeaderSurveyRoutes, DocumentHeaderSubscriber, DocumentHeaderSubscriberRoutes, GoogleCalendar, GoogleCalendarRoutes, WebSocket, ProductLocation, MobilePrint, MobilePrintRoutes, TimeSheet, TimeSheetRoutes, Catalogo, CatalogoRoutes, };
258
+ import * as SmsSender from './modules/sms/smsSender/interfaces';
259
+ import * as SmsTemplate from './modules/sms/smsTemplate/interfaces';
260
+ import * as SmsTemplateRoutes from './modules/sms/smsTemplate/route.schema';
261
+ export { shared, viewErrors, stockErrors, userErrors, documentManagementErrors, integrationErrors, ZipCode, ZipCodeRoutes, BankData, BankDataRoutes, Client, ClientRoutes, ClientType, ClientTypeRoutes, Chat, ChatRoutes, Commissioner, CommissionerRoutes, Country, CountryRoutes, DeliveryMethods, DeliveryMethodsRoutes, DocumentHeader, DocumentHeaderRoutes, DocumentHeaderHistory, BillOfLading, BillOfLadingRoutes, ProductionOrder, ProductionOrderRoutes, Proforma, ProformaRoutes, PropostaFornecedor, PropostaFornecedorRoutes, ProviderCreditNoteFromReturn, ProviderCreditNoteFromReturnRoutes, ProviderFinancialCreditNote, ProviderFinancialCreditNoteRoutes, ProviderServiceInvoice, ProviderServiceInvoiceRoutes, DocumentLine, DocumentLineRoutes, DocumentLineAssoc, DocumentSet, DocumentSetRoutes, DocumentType, DocumentTypeRoutes, ExternalDocumentType, ExternalDocumentHeader, ExternalDocumentHeaderRoutes, Favorites, FavoritesRoutes, File, FileRoutes, GoogleSheets, GoogleSheetsRoutes, Language, LanguageRoutes, Location, LocationRoutes, MaturityDates, MaturityDatesRoutes, Multimedia, MultimediaRoutes, OrderManagement, Observation, ObservationRoutes, ObservationType, ObservationTypeRoutes, Password, PasswordRoutes, Payment, PaymentRoutes, PaymentMethods, PaymentMethodsRoutes, ProductImage, ProductImageRoutes, Promotion, PromotionRoutes, PromotionAssoc, PromotionAssocRoutes, Providers, ProvidersRoutes, ProviderType, ProviderTypeRoutes, PurchaseConditions, PurchaseConditionsRoutes, ReasonForExemption, ReasonForExemptionRoutes, RefreshToken, RefreshTokenRoutes, SegmentsArea, SegmentsAreaRoutes, Sessions, SessionsRoutes, Shippings, ShippingsRoutes, StoreOperator, StoreOperatorRoutes, SystemModule, SystemModuleRoutes, Swift, SwiftRoutes, TypeOfLocation, TypeOfLocationRoutes, UnitOfMeasure, UnitOfMeasureRoutes, UserPositions, UserPositionsRoutes, Users, UsersRoutes, UserTokens, UserTokensRoutes, VatValidation, VatValidationRoutes, VatTax, VatTaxRoutes, VatTaxZone, VatTaxZoneRoutes, Vehicles, VehiclesRoutes, Workflow, WorkflowRoutes, StockMovement, StockMovementRoutes, Tenant, TenantRoutes, PreSale, PreSaleRoutes, PreSaleProduct, PreSaleProductRoutes, Npc, NpcRoutes, Printer, PrinterRoutes, SchedulePrintJob, SchedulePrintJobRoutes, QueryList, QueryListRoutes, QueryParameter, QueryParameterRoutes, ReturnReason, ReturnReasonRoutes, PropostaSheets, PropostaSheetsRoutes, Schedule, ScheduleRoutes, GoogleFilePermission, GoogleFilePermissionRoutes, Settings, SettingsRoutes, Tickets, TicketsRoutes, Channel, ChannelRoutes, TicketsLanguage, TicketsLanguageRoutes, CLT, CLTRoutes, StartDocumentHeaderLastUpdate, Persona, PersonaRoutes, ProjectInfo, ProjectInfoRoutes, EmailVerification, EmailVerificationRoutes, EmailLog, EmailLogRoutes, Purchase, PurchaseRoutes, Order, OrderRoutes, MaterialEntrance, MaterialEntranceRoutes, Transformado, TransformadoRoutes, Quebra, QuebraRoutes, UpfrontReturn, UpfrontReturnRoutes, SavedEmPicking, SavedEmPickingRoutes, EmailTemplate, EmailTemplateRoutes, EmailTemplateAttachment, EmailTemplateAttachmentRoutes, Inventario, InventarioRoutes, ReturnToProvider, ReturnToProviderRoutes, Prison, PrisonRoutes, DocumentLineNote, DocumentLineNoteRoutes, SavedProviderProposal, SavedProviderProposalRoutes, ProductGoogleSheets, ProductGoogleSheetsRoutes, Task, TaskRoutes, TaskMessage, TaskMessageRoutes, RecurrentTasks, TaskRead, TaskReadRoutes, Theme, ThemeRoutes, Dashboard, DashboardRoutes, ChatRapidMessage, ChatRapidMessageRoutes, SideMenu, SideMenuRoutes, SidemenuHighlight, SidemenuHighlightRoutes, AdminPanel, ErrorLog, ErrorLogRoutes, DocumentLineRm, DocumentLineRmRoutes, DocumentLineMt, DocumentLineMtRoutes, ChatSubscriber, ChatSubscriberRoutes, Tag, TagRoutes, Gmails, NPF, NPFRoutes, NRCL, NRCLRoutes, CurrentAccount, CurrentAccountRoutes, PaymentBatch, PaymentBatchRoutes, Portal, PortalRoutes, GoogleSheetPool, AccountCode, AccountCodeRoutes, LLM, LLMRoutes, PatchNotes, ConferirEncomenda, DocumentHeaderSurvey, DocumentHeaderSurveyRoutes, DocumentHeaderSubscriber, DocumentHeaderSubscriberRoutes, GoogleCalendar, GoogleCalendarRoutes, WebSocket, ProductLocation, MobilePrint, MobilePrintRoutes, TimeSheet, TimeSheetRoutes, Catalogo, CatalogoRoutes, SmsSender, SmsTemplate, SmsTemplateRoutes, };
@@ -4,9 +4,11 @@ export interface IDeliveryAddressRequest {
4
4
  delivery_street: string;
5
5
  delivery_locality: string;
6
6
  delivery_postal_code: string;
7
+ delivery_country_id: string;
7
8
  delivery_departure_locality: string;
8
9
  delivery_departure_postal_code: string;
9
10
  delivery_departure_street: string;
11
+ delivery_departure_country_id: string;
10
12
  }
11
13
  export interface ICreateRequest {
12
14
  persona_id: string;
@@ -97,6 +97,7 @@ export interface IUndoEntradaDeMaterialRequest {
97
97
  export interface IFinalizarEntradaDeMaterialRequest {
98
98
  provider_id: string;
99
99
  saved_em_picking_ids?: string[];
100
+ store_operator_id: string;
100
101
  }
101
102
  export interface IFinalizarEntradaDeMaterialResponse {
102
103
  broker_messages: IShared.IBrokerMessage<IShared.IBrokerTopic>[];
@@ -5,6 +5,10 @@ export interface IUndoProviderOrderRequest {
5
5
  document_line_ids: string[];
6
6
  send_notification: boolean;
7
7
  }
8
+ export interface ICreateProviderOrderChatRequest {
9
+ from_header: string[];
10
+ from_lines: string[];
11
+ }
8
12
  export interface IMotivosDeEsperaData {
9
13
  esperaEnvioDeMedidas?: boolean;
10
14
  esperaConfirmacaoDeMedidas?: boolean;
@@ -77,6 +81,7 @@ export interface IRepository {
77
81
  unsetProvider(selector: IShared.IFindByIdRequest): Promise<void>;
78
82
  unlinkFromProviderOrder(selector: IFindByIdsRequest): Promise<void>;
79
83
  undoProviderOrder(data: IUndoProviderOrderRequest): Promise<void>;
84
+ createProviderOrderChat(data: ICreateProviderOrderChatRequest): Promise<void>;
80
85
  unsetCativado(data: IUnsetCativado): Promise<void>;
81
86
  find(params: IFindRequest): Promise<IFindResponse[]>;
82
87
  previewRegroupLinesInProviderOrder(params: IShared.IFindByIdRequest): Promise<IPreviewResponse>;
@@ -1,6 +1,7 @@
1
1
  import joi from 'joi';
2
2
  import { IConferirEncomendaClienteRequest, IFindRequest, IFindByIdsRequest } from './interfaces';
3
3
  export declare const undoProviderOrderBody: joi.ObjectSchema<any>;
4
+ export declare const createProviderOrderChatBody: joi.ObjectSchema<any>;
4
5
  export declare const conferirEncomendaClienteBody: joi.ObjectSchema<IConferirEncomendaClienteRequest>;
5
6
  export declare const setProviderBody: joi.ObjectSchema<any>;
6
7
  export declare const unsetCativadoBody: joi.ObjectSchema<any>;
@@ -0,0 +1,42 @@
1
+ import { SmsSender } from '../../../shared/entities/sms';
2
+ export type Entity = SmsSender;
3
+ export declare const Route = "sms_sender";
4
+ export declare const ISmsSenderStatsEnum: {
5
+ readonly PENDING: "PENDING";
6
+ readonly PROCESSING: "PROCESSING";
7
+ readonly SENT: "SENT";
8
+ readonly FAILED: "FAILED";
9
+ };
10
+ export type ISmsSenderStats = (typeof ISmsSenderStatsEnum)[keyof typeof ISmsSenderStatsEnum];
11
+ export declare const timeSheetRecordTypes: ("PENDING" | "PROCESSING" | "SENT" | "FAILED")[];
12
+ export interface ICreateRequest {
13
+ telephone: string;
14
+ message: string;
15
+ google_calendar_id: string;
16
+ }
17
+ export interface IClaimResponse {
18
+ id: string;
19
+ telephone: string;
20
+ message: string;
21
+ status: string;
22
+ }
23
+ export interface IResultRequest {
24
+ status: ISmsSenderStats;
25
+ error?: string;
26
+ }
27
+ export interface IFindResponse {
28
+ id: string;
29
+ telephone: string;
30
+ message: string;
31
+ status: string;
32
+ error?: string;
33
+ created_at: Date;
34
+ processed_at?: Date;
35
+ sent_at?: Date;
36
+ }
37
+ export interface IController {
38
+ claim(): Promise<IClaimResponse[]>;
39
+ result(id: string, data: IResultRequest): Promise<void>;
40
+ findById(id: string): Promise<IFindResponse>;
41
+ findAll(): Promise<IFindResponse[]>;
42
+ }
@@ -0,0 +1,29 @@
1
+ import { SmsTemplate } from '../../../shared/entities/sms';
2
+ import * as IShared from '../../../shared/interface';
3
+ export type Entity = SmsTemplate;
4
+ export declare const Route = "sms_template";
5
+ export interface IEntity extends Entity {
6
+ }
7
+ export type SmsTemplateVariables = Record<string, string | number | boolean>;
8
+ export interface ICreateRequest {
9
+ key: string;
10
+ name: string;
11
+ message: string;
12
+ variables?: SmsTemplateVariables;
13
+ }
14
+ export interface IUpdateRequest {
15
+ name?: string;
16
+ key?: string;
17
+ message?: string;
18
+ variables?: SmsTemplateVariables;
19
+ }
20
+ export interface IRepository {
21
+ find(): Promise<IEntity[]>;
22
+ findById(id: string): Promise<Entity>;
23
+ findByKey(key: string): Promise<Entity>;
24
+ create(data: ICreateRequest): Promise<string>;
25
+ update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<void>;
26
+ deleteOne(selector: IShared.IFindByIdRequest): Promise<void>;
27
+ }
28
+ export type IController = IShared.IEntityWithUserToken<IRepository>;
29
+ export type IApi = IRepository;
@@ -0,0 +1,5 @@
1
+ import joi from 'joi';
2
+ export declare const createBody: joi.ObjectSchema<any>;
3
+ export declare const updateBody: joi.ObjectSchema<any>;
4
+ export declare const idParam: joi.ObjectSchema<any>;
5
+ export declare const keyParam: joi.ObjectSchema<any>;
@@ -26,7 +26,27 @@ export interface IDashboardProjectInfoResponse {
26
26
  d: number;
27
27
  c: number;
28
28
  }
29
+ export interface IFindDashboardTodoCounts {
30
+ from: Date;
31
+ to: Date;
32
+ }
33
+ export interface IDashboardTodoCountOperator {
34
+ store_operator_id: string;
35
+ name: string;
36
+ }
37
+ export interface IDashboardTodoCountPoint {
38
+ /** ISO timestamp of the snapshot (captured_at) */
39
+ t: string;
40
+ store_operator_id: string;
41
+ name: string;
42
+ count: number;
43
+ }
44
+ export interface IDashboardTodoCountsResponse {
45
+ operators: IDashboardTodoCountOperator[];
46
+ points: IDashboardTodoCountPoint[];
47
+ }
29
48
  export interface IRepository {
30
49
  salesByDate(selector: IFindDashboardSalesByDate): Promise<IDashboardSalesResponse>;
31
50
  projectInfo(): Promise<IDashboardProjectInfoResponse[]>;
51
+ todoCounts(selector: IFindDashboardTodoCounts): Promise<IDashboardTodoCountsResponse>;
32
52
  }
@@ -1,2 +1,3 @@
1
1
  import joi from 'joi';
2
2
  export declare const findByDateParams: joi.ObjectSchema<any>;
3
+ export declare const findTodoCountsParams: joi.ObjectSchema<any>;
@@ -140,6 +140,7 @@ export interface IUpdateRequest {
140
140
  owner_id?: string;
141
141
  owner_number?: number;
142
142
  owner_name?: string;
143
+ owner_ref_document?: string | null;
143
144
  reason_for_exemption_id?: string | null;
144
145
  reason_for_exemption?: string | null;
145
146
  billing_persona_id?: string | null;
@@ -7,7 +7,7 @@ export interface IFindByOwnerRequest {
7
7
  }
8
8
  export interface ICreateRequest {
9
9
  document_header_id: string;
10
- store_operator_id: string;
10
+ user_id: string;
11
11
  }
12
12
  export interface IRepository {
13
13
  findByOwnerId(params: IFindByOwnerRequest): Promise<Entity[]>;
@@ -4,10 +4,45 @@ export type IEntity = DocumentHeaderSurvey;
4
4
  export declare const Route = "document_header_survey";
5
5
  export type ICreateRequest = Pick<IEntity, 'owner_id' | 'document_header_id' | 'persona_id'>;
6
6
  export type IResponse = IEntity;
7
+ export interface IFindRequest {
8
+ date_start: Date;
9
+ date_end: Date;
10
+ }
11
+ export interface IFindResponseItem {
12
+ document_header_id: string;
13
+ document_number: number;
14
+ rm_date: Date | null;
15
+ survey_id: string | null;
16
+ persona_name: string | null;
17
+ persona_email: string | null;
18
+ sent: Date | null;
19
+ responded_at: Date | null;
20
+ response_url: string | null;
21
+ }
22
+ export interface IMtWithoutDateCountResponse {
23
+ count: number;
24
+ }
7
25
  export type IUpdateSentRequest = Pick<IEntity, 'document_header_id' | 'persona_id'>;
8
26
  export type IUpdateSurveyRequest = Pick<IEntity, 'document_header_id' | 'persona_id' | 'data'>;
27
+ export interface ISurveyStatsSummary {
28
+ total: number;
29
+ sent: number;
30
+ pending: number;
31
+ responded: number;
32
+ response_rate: number;
33
+ }
34
+ export interface ISurveyStatsDailyPoint {
35
+ day: string;
36
+ created: number;
37
+ sent: number;
38
+ responded: number;
39
+ }
40
+ export interface ISurveyStatsResponse {
41
+ summary: ISurveyStatsSummary;
42
+ daily: ISurveyStatsDailyPoint[];
43
+ }
9
44
  export interface IRepository {
10
- find(): Promise<IResponse[]>;
45
+ find(params: IFindRequest): Promise<IFindResponseItem[]>;
11
46
  updateSent(data: IUpdateSentRequest): Promise<void>;
12
47
  updateSurvey(data: IUpdateSurveyRequest): Promise<void>;
13
48
  }
@@ -1,3 +1,5 @@
1
1
  import joi from 'joi';
2
+ import { IFindRequest } from './interfaces';
3
+ export declare const findQuery: joi.ObjectSchema<IFindRequest>;
2
4
  export declare const updateSentBody: joi.ObjectSchema<any>;
3
5
  export declare const updateSurveyBody: joi.ObjectSchema<any>;
@@ -112,6 +112,7 @@ export interface IUpdateManyRequest {
112
112
  provider_estimated_delivery_date?: Date | null;
113
113
  provider_purchase_discount?: number;
114
114
  consignacao?: boolean;
115
+ abater_na_fatura_final?: boolean;
115
116
  cancelled?: boolean;
116
117
  force_closed?: boolean;
117
118
  }
@@ -130,7 +131,14 @@ export interface IPrintLabelParamsRequest {
130
131
  export interface IPrintLabelQueryRequest {
131
132
  token: string;
132
133
  }
134
+ export interface IGetSmsData {
135
+ document_line_id: string;
136
+ document_header_id: string;
137
+ execution_date: string;
138
+ type: 'RM' | 'MT';
139
+ }
133
140
  export interface IRepository {
141
+ getSmsData(): Promise<IGetSmsData[]>;
134
142
  create(data: ICreateRequest[]): Promise<IDocumentLineAssoc.IEntityExtended[]>;
135
143
  update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<void>;
136
144
  updateMany(data: IUpdateManyRequest): Promise<void>;
@@ -34,6 +34,10 @@ export interface IPublicFindBySubscriberId {
34
34
  chat: IChatBalloon[];
35
35
  documents: IPublicOtherDocument[];
36
36
  }
37
+ export interface IPublicFindBySubscriberIdRequest {
38
+ id: string;
39
+ document_header_id?: string;
40
+ }
37
41
  export declare enum IPublicDocumentHeaderNoteType {
38
42
  Provider = "Provider",
39
43
  Client = "Client"
@@ -56,7 +60,7 @@ export interface PublicDocumentHeaderNoteUpdateRequest {
56
60
  note: string;
57
61
  }
58
62
  export interface IRepository {
59
- publicFindBySubscriberId(params: IShared.IFindByIdRequest): Promise<IPublicFindBySubscriberId>;
63
+ publicFindBySubscriberId(params: IPublicFindBySubscriberIdRequest): Promise<IPublicFindBySubscriberId>;
60
64
  publicCreateDocumentHeaderNote: (data: PublicDocumentHeaderNoteCreateRequest[]) => Promise<PublicDocumentHeaderNote[]>;
61
65
  publicUpdateDocumentHeaderNote: (selector: IShared.IFindByIdRequest, data: PublicDocumentHeaderNoteUpdateRequest[]) => Promise<PublicDocumentHeaderNote[]>;
62
66
  }
@@ -1,3 +1,4 @@
1
1
  import joi from 'joi';
2
+ export declare const publicFindBySubscriberQuery: joi.ObjectSchema<any>;
2
3
  export declare const createNoteBody: joi.ObjectSchema<any>;
3
4
  export declare const updateNoteBody: joi.ObjectSchema<any>;
@@ -17,9 +17,16 @@ export interface IFindDocumentHeaderSubscribersByLanguageRequest {
17
17
  export interface IFindSubscribedDocumentHeadersRequest {
18
18
  owner_id: string;
19
19
  }
20
+ export interface IFindByEmailTokenRequest {
21
+ token: string;
22
+ }
23
+ export interface IPublicAuthenticateByEmailTokenRequest {
24
+ token: string;
25
+ }
20
26
  export type IPersona = Pick<Persona, 'id' | 'external' | 'name' | 'email' | 'telephone' | 'language_id'>;
27
+ export type IPersonaWithToken = IPersona & Pick<Persona, 'email_access_token'>;
21
28
  export interface IEntityWithPersona extends Pick<ChatSubscriber, 'id' | 'chat_document_header_id'> {
22
- persona: IPersona;
29
+ persona: IPersonaWithToken;
23
30
  }
24
31
  export interface IEntityWithPersonaAndSubscriptions extends IPersona {
25
32
  subscriptions: Pick<Entity, 'id' | 'chat_document_header_id'>[];
@@ -29,6 +36,8 @@ export interface IRepository {
29
36
  findDocumentHeaderSubscribersByLanguage(selector: IFindDocumentHeaderSubscribersByLanguageRequest): Promise<string[]>;
30
37
  findSubscribedDocumentHeaders(selector: IFindSubscribedDocumentHeadersRequest): Promise<IEntityWithPersonaAndSubscriptions>;
31
38
  findById(selector: IShared.IFindByIdRequest): Promise<IEntityWithPersonaAndSubscriptions>;
39
+ findByEmailToken(selector: IFindByEmailTokenRequest): Promise<IEntityWithPersonaAndSubscriptions>;
40
+ publicAuthenticateByEmailToken(selector: IPublicAuthenticateByEmailTokenRequest): Promise<string | null>;
32
41
  createOrUpdate(data: ICreateOrUpdateRequest): Promise<string>;
33
42
  deleteOne(selector: IShared.IFindByIdRequest): Promise<void>;
34
43
  deleteByDocumentHeader(selector: IShared.IFindByIdRequest): Promise<void>;
@@ -4,3 +4,4 @@ export declare const createOrUpdateBody: joi.ObjectSchema<any>;
4
4
  export declare const findDocumentHeaderSubscribersQuery: joi.ObjectSchema<any>;
5
5
  export declare const findDocumentHeaderSubscribersByLanguageQuery: joi.ObjectSchema<IFindDocumentHeaderSubscribersByLanguageRequest>;
6
6
  export declare const findSubscribedDocumentHeadersQuery: joi.ObjectSchema<any>;
7
+ export declare const emailTokenParam: joi.ObjectSchema<any>;
@@ -28,6 +28,9 @@ export interface IUpdatePasswordRequest {
28
28
  password: string;
29
29
  oldPassword: string;
30
30
  }
31
+ export interface IUpdateOwnPinRequest {
32
+ pin: string;
33
+ }
31
34
  export interface IRepository {
32
35
  findMinified(params?: IShared.IFindMinifiedRequest): Promise<IShared.IFindMinifiedResponse[]>;
33
36
  find(): Promise<IFindResponse[]>;
@@ -36,5 +39,6 @@ export interface IRepository {
36
39
  update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<void>;
37
40
  deleteOne(selector: IShared.IFindByIdRequest): Promise<void>;
38
41
  updatePassword(selector: IShared.IFindByIdRequest, data: IUpdatePasswordRequest): Promise<void>;
42
+ updateOwnPin(data: IUpdateOwnPinRequest): Promise<void>;
39
43
  }
40
44
  export type IController = IShared.IEntityWithUserToken<IRepository>;
@@ -3,3 +3,4 @@ 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
5
  export declare const updatePasswordBody: joi.ObjectSchema<any>;
6
+ export declare const updateOwnPinBody: joi.ObjectSchema<any>;
@@ -1,73 +1,52 @@
1
1
  import * as IShared from '../../../shared/interface';
2
- import { TimeSheetDay, TimeSheetClock } from '../../../shared/entities/user';
3
- export type Entity = TimeSheetDay & {
4
- clocks: TimeSheetClock[];
5
- };
2
+ import { TimeSheet } from '../../../shared/entities/user';
3
+ export type Entity = TimeSheet;
6
4
  export declare const Route = "time_sheet";
7
- export declare const IClockTypeEnum: {
8
- ENTRY: 'ENTRY';
9
- EXIT: 'EXIT';
10
- };
11
- export type IClockType = (typeof IClockTypeEnum)[keyof typeof IClockTypeEnum];
12
- export declare const clockTypes: string[];
13
- export declare const IRegistryTypeEnum: {
14
- AUTOMATIC: 'AUTOMATIC';
15
- MANUAL: 'MANUAL';
5
+ export declare const ITimeSheetRecordTypeEnum: {
6
+ readonly ENTRY: "ENTRY";
7
+ readonly EXIT: "EXIT";
8
+ readonly CREDIT: "CREDIT";
9
+ readonly DEBIT: "DEBIT";
16
10
  };
17
- export type IRegistryType = (typeof IRegistryTypeEnum)[keyof typeof IRegistryTypeEnum];
18
- export declare const registryTypes: string[];
19
- export declare const ITimesheetStateEnum: {
20
- CONFIRMED: 'CONFIRMED';
21
- PENDING: 'PENDING';
22
- ERROR: 'ERROR';
11
+ export type ITimeSheetRecordType = (typeof ITimeSheetRecordTypeEnum)[keyof typeof ITimeSheetRecordTypeEnum];
12
+ export declare const timeSheetRecordTypes: ("ENTRY" | "EXIT" | "CREDIT" | "DEBIT")[];
13
+ export declare const ITimeSheetRegistryTypeEnum: {
14
+ readonly AUTOMATIC: "AUTOMATIC";
15
+ readonly MANUAL: "MANUAL";
23
16
  };
24
- export type ITimesheetState = (typeof ITimesheetStateEnum)[keyof typeof ITimesheetStateEnum];
25
- export declare const timesheetStates: string[];
17
+ export type ITimeSheetRegistryType = (typeof ITimeSheetRegistryTypeEnum)[keyof typeof ITimeSheetRegistryTypeEnum];
18
+ export declare const timeSheetRegistryTypes: ("AUTOMATIC" | "MANUAL")[];
26
19
  export interface IFindRequest {
27
20
  user_id?: string;
28
21
  start_date?: string;
29
22
  end_date?: string;
30
- state?: ITimesheetState;
31
23
  }
32
- export interface ICreateRequest {
33
- date: Date;
24
+ export interface IFindByDateRequest {
34
25
  user_id: string;
35
- total_worked?: number;
36
- balance?: number;
37
- state?: ITimesheetState;
38
- created_by: string;
39
- updated_by: string;
40
- clock?: {
41
- time?: Date;
42
- type: IClockType;
43
- registry_type: IRegistryType;
44
- note?: string | null;
45
- created_by: string;
46
- updated_by: string;
47
- };
26
+ date: string;
48
27
  }
49
- export interface IUpdateRequest {
50
- total_worked?: number;
51
- balance?: number;
52
- state?: ITimesheetState;
53
- created_by?: string;
54
- updated_by: string;
55
- clocks?: {
56
- id?: string;
57
- time: Date;
58
- type: IClockType;
59
- registry_type: IRegistryType;
60
- note?: string | null;
61
- created_by: string;
62
- updated_by: string;
63
- }[];
28
+ export interface IDailySummaryRequest {
29
+ user_id: string;
30
+ start_date: string;
31
+ end_date: string;
32
+ }
33
+ export interface IDailySummaryResponse {
34
+ user_id: string;
35
+ date: string;
36
+ total_worked: number;
37
+ balance: number;
38
+ record_count: number;
64
39
  }
40
+ export type ICreateRequest = Omit<Entity, 'id' | 'created_at' | 'updated_at'>;
41
+ export type IUpdateRequest = Partial<Pick<Entity, 'type' | 'time' | 'minutes' | 'note' | 'updated_by' | 'updated_at'>>;
65
42
  export interface IRepository {
66
43
  find(filters?: IFindRequest): Promise<Entity[]>;
67
44
  findById(id: string): Promise<Entity | null>;
68
45
  create(data: ICreateRequest): Promise<Entity>;
69
46
  update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<Entity | null>;
70
- deleteOne(selector: IShared.IFindByIdRequest): Promise<Entity | null>;
47
+ deleteOne(selector: IShared.IFindByIdRequest): Promise<void>;
48
+ findByUserAndDate(filters: IFindByDateRequest): Promise<Entity[]>;
49
+ getDailySummary(filters: IDailySummaryRequest): Promise<IDailySummaryResponse[]>;
71
50
  }
72
51
  export type IController = IShared.IEntityWithUserToken<IRepository>;
73
52
  export type IApi = Omit<IRepository, 'findById'>;
@@ -1,3 +1,6 @@
1
1
  import joi from 'joi';
2
2
  export declare const createBody: joi.ObjectSchema<any>;
3
3
  export declare const updateBody: joi.ObjectSchema<any>;
4
+ export declare const findQuery: joi.ObjectSchema<any>;
5
+ export declare const findByDateQuery: joi.ObjectSchema<any>;
6
+ export declare const dailySummaryQuery: joi.ObjectSchema<any>;
@@ -1,6 +1,7 @@
1
1
  import type { IChatBalloon } from '../../stock/chat/interfaces';
2
2
  import type { ILastTicketCalledTodayByChannel, IRemainingTodayTickets } from '../../tickets/tickets/interfaces';
3
3
  import type { IPublicDocument, IPublicFindBySubscriberId, ITags } from '../../ui/portal/interface';
4
+ import type { IFindByOwnerIdItemWithVersions } from '../../supply/externalDocumentHeader/interface';
4
5
  export declare const Route = "ws";
5
6
  export interface IEvent {
6
7
  type: string;
@@ -65,6 +66,28 @@ export interface ITicketsChanged extends IEvent {
65
66
  remaining_today_tickets_to_call: IRemainingTodayTickets[];
66
67
  }
67
68
  export type TicketsSocketEvent = ITicketsChanged | IPing | IPong;
69
+ export interface IPropostaSheetsImportStatus extends IEvent {
70
+ type: 'proposta_sheets.import.status';
71
+ document_header_id: string;
72
+ google_sheet_id: string;
73
+ is_processing: boolean;
74
+ error: string | null;
75
+ }
76
+ export type PropostaSheetsSocketEvent = IPropostaSheetsImportStatus | IPing | IPong;
77
+ /**
78
+ * Emitted whenever an external/certified document tied to a dossier is
79
+ * created (post-create effects finished), retried, or voided. The payload
80
+ * carries the full `IFindByOwnerIdItemWithVersions` row so the client can
81
+ * upsert it straight into the `ExternalDocumentHeaderFindByOwnerId` cache
82
+ * keyed by `owner_id` (the dossier / start_document_header_id), matching on
83
+ * `item.document_header_id` to decide between insert and replace.
84
+ */
85
+ export interface IExternalDocumentUpserted extends IEvent {
86
+ type: 'external_document.upserted';
87
+ owner_id: string;
88
+ item: IFindByOwnerIdItemWithVersions;
89
+ }
90
+ export type SupplyDocumentSocketEvent = IExternalDocumentUpserted | IPing | IPong;
68
91
  export interface IPushNotificationEvent extends IEvent {
69
92
  type: 'push_notification';
70
93
  counts: Record<string, number>;
@@ -0,0 +1,31 @@
1
+ import { ISmsSenderStats } from '../../modules/sms/smsSender/interfaces';
2
+ /**
3
+ * Model SmsSender
4
+ *
5
+ */
6
+ export type SmsSender = {
7
+ id: string;
8
+ document_line_id: string | null;
9
+ telephone: string;
10
+ message: string;
11
+ status: ISmsSenderStats;
12
+ error: string | null;
13
+ created_at: Date;
14
+ processed_at: Date | null;
15
+ sent_at: Date | null;
16
+ };
17
+ /**
18
+ * Model SmsTemplate
19
+ *
20
+ */
21
+ export type SmsTemplate = {
22
+ id: string;
23
+ key: string;
24
+ name: string;
25
+ message: string;
26
+ variables: unknown;
27
+ created_at: Date;
28
+ updated_at: Date;
29
+ created_by: string;
30
+ updated_by: string;
31
+ };
@@ -40,6 +40,8 @@ export type Chat = {
40
40
  is_customer: boolean;
41
41
  deleted: boolean;
42
42
  lang: string | null;
43
+ lang_confidence: number | null;
44
+ lang_multi_dominant: boolean | null;
43
45
  created_by: string;
44
46
  updated_by: string;
45
47
  created_at: Date;
@@ -305,6 +307,8 @@ export type DocumentHeader = {
305
307
  delivery_departure_street: string | null;
306
308
  delivery_departure_locality: string | null;
307
309
  delivery_departure_postal_code: string | null;
310
+ delivery_departure_country_id: string | null;
311
+ delivery_departure_country_name: string | null;
308
312
  delivery_method_id: string | null;
309
313
  delivery_method: string | null;
310
314
  vehicle_id: string | null;
@@ -379,6 +383,7 @@ export type DocumentLine = {
379
383
  cativado: boolean;
380
384
  cativado_date: Date | null;
381
385
  consignacao: boolean;
386
+ abater_na_fatura_final: boolean;
382
387
  document_line_group_id: string;
383
388
  index: number;
384
389
  data: IData;
@@ -1087,7 +1092,7 @@ export type DocumentHeaderSurvey = {
1087
1092
  export type DocumentHeaderSubscriber = {
1088
1093
  id: string;
1089
1094
  document_header_id: string;
1090
- store_operator_id: string;
1095
+ user_id: string;
1091
1096
  created_at: Date;
1092
1097
  created_by: string;
1093
1098
  updated_at: Date;
@@ -1105,7 +1110,7 @@ export type GoogleCalendar = {
1105
1110
  summary: string;
1106
1111
  initial_date: Date;
1107
1112
  status: 'confirmed' | 'tentative' | 'cancelled';
1108
- ready_for_action: boolean;
1113
+ color_id: string | null;
1109
1114
  document_type: 'RM' | 'MT' | null;
1110
1115
  document_number: string | null;
1111
1116
  document_line_id: string | null;
@@ -1,7 +1,7 @@
1
1
  import { IPaymentMethodsSaftCodeEnum } from '../../modules/user/paymentMethods/interfaces';
2
2
  import type { IReasonForExemptionType } from '../../modules/user/reasonForExemption/interface';
3
3
  import type { SystemModuleEnum } from '../../modules/user/systemModule/interface';
4
- import { IClockType, IRegistryType, ITimesheetState } from '../../modules/user/timeSheet/interfaces';
4
+ import { ITimeSheetRecordType, ITimeSheetRegistryType } from '../../modules/user/timeSheet/interfaces';
5
5
  /**
6
6
  * Model Users
7
7
  *
@@ -424,6 +424,7 @@ export type Persona = {
424
424
  nif: string | null;
425
425
  telephone: string | null;
426
426
  email: string | null;
427
+ email_access_token: string | null;
427
428
  observations: string | null;
428
429
  street: string | null;
429
430
  postal_code: string | null;
@@ -481,26 +482,14 @@ export type SystemModule = {
481
482
  };
482
483
  /**
483
484
  * Model TimeSheet
484
- *
485
485
  */
486
- export interface TimeSheetDay {
486
+ export interface TimeSheet {
487
487
  id: string;
488
- date: Date;
489
- total_worked: number;
490
- balance: number;
491
488
  user_id: string;
492
- state: ITimesheetState;
493
- created_at: Date;
494
- updated_at: Date;
495
- created_by: string;
496
- updated_by: string;
497
- }
498
- export interface TimeSheetClock {
499
- id: string;
500
- timesheet_day_id: string;
501
- time: Date;
502
- type: IClockType;
503
- registry_type: IRegistryType;
489
+ type: ITimeSheetRecordType;
490
+ time: Date | null;
491
+ minutes: number | null;
492
+ registry_type: ITimeSheetRegistryType;
504
493
  note: string | null;
505
494
  created_at: Date;
506
495
  updated_at: Date;
@@ -11,7 +11,7 @@ import type { ProjectInfo } from './entities/integration';
11
11
  import type { IAttachment } from '../modules/supply/externalDocumentHeader/interface';
12
12
  import type { Persona } from './entities/user';
13
13
  import type { ITranslateRequest } from '../modules/stock/chat/interfaces';
14
- import type { ChatSocketEvent, TicketsSocketEvent } from '../modules/view/webSocket/interfaces';
14
+ import type { ChatSocketEvent, TicketsSocketEvent, SupplyDocumentSocketEvent } from '../modules/view/webSocket/interfaces';
15
15
  import type { SystemModuleEnum } from '../modules/user/systemModule/interface';
16
16
  export { messages };
17
17
  type CreatedAt = 'created_at';
@@ -139,7 +139,9 @@ export declare enum IBrokerTopic {
139
139
  tickets_change = "tickets_change",
140
140
  push_notification = "push_notification",
141
141
  portal_subscriber_events = "portal_subscriber_events",
142
+ portal_document_events = "portal_document_events",
142
143
  sidemenu_highlight_changed = "sidemenu_highlight_changed",
144
+ proposta_sheets_import_status = "proposta_sheets_import_status",
143
145
  user_send_email_password = "user_send_email_password",
144
146
  grant_access = "grant_access",
145
147
  remove_access = "remove_access",
@@ -305,6 +307,12 @@ export type IBrokerTopicPayload = {
305
307
  values: string[];
306
308
  timestamp: string;
307
309
  };
310
+ [IBrokerTopic.proposta_sheets_import_status]: {
311
+ document_header_id: string;
312
+ google_sheet_id: string;
313
+ is_processing: boolean;
314
+ error: string | null;
315
+ };
308
316
  [IBrokerTopic.import_master_artigos]: {};
309
317
  [IBrokerTopic.kafka_log]: {
310
318
  id: string;
@@ -367,6 +375,7 @@ export type IBrokerTopicPayload = {
367
375
  };
368
376
  [IBrokerTopic.send_email_client_survey]: {
369
377
  persona_id: string;
378
+ owner_id: string;
370
379
  document_header_id: string;
371
380
  document_number: number;
372
381
  persona_name: string;
@@ -389,6 +398,10 @@ export type IBrokerTopicPayload = {
389
398
  target_subscriber_ids: string[];
390
399
  event: ChatSocketEvent;
391
400
  };
401
+ [IBrokerTopic.portal_document_events]: {
402
+ owner_id: string;
403
+ event: SupplyDocumentSocketEvent;
404
+ };
392
405
  };
393
406
  export interface IBrokerMessage<T extends IBrokerTopic = IBrokerTopic> {
394
407
  topic: T;
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": "1.3.39",
4
+ "version": "1.3.41",
5
5
  "author": "Nomalism <it.nomalism@gmail.com> (https://nomalism.com/)",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",
@@ -23,18 +23,18 @@
23
23
  "prepack": "npm run lint && npm run build"
24
24
  },
25
25
  "dependencies": {
26
- "joi": "^18.2.1"
26
+ "joi": "^18.2.3"
27
27
  },
28
28
  "devDependencies": {
29
- "@swc/core": "^1.15.41",
29
+ "@swc/core": "^1.15.43",
30
30
  "@types/node": "^24.13.2",
31
- "@typescript-eslint/eslint-plugin": "^8.61.0",
32
- "@typescript-eslint/parser": "^8.61.0",
31
+ "@typescript-eslint/eslint-plugin": "^8.62.0",
32
+ "@typescript-eslint/parser": "^8.62.0",
33
33
  "eslint": "^9.39.4",
34
34
  "eslint-config-prettier": "^10.1.8",
35
35
  "eslint-import-resolver-typescript": "^4.4.5",
36
36
  "eslint-plugin-prettier": "^5.5.6",
37
- "prettier": "^3.8.4",
37
+ "prettier": "^3.9.1",
38
38
  "tsup": "^8.5.1"
39
39
  },
40
40
  "repository": {