@nomalism-com/types 1.3.46 → 1.3.47

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/main.d.ts CHANGED
@@ -81,6 +81,8 @@ import * as ChatRapidMessageRoutes from "./modules/stock/chatRapidMessage/route.
81
81
  import * as ConferirEncomenda from "./modules/stock/conferirEncomenda/interface";
82
82
  import * as Dashboard from "./modules/stock/dashboard/interface";
83
83
  import * as DashboardRoutes from "./modules/stock/dashboard/route.schema";
84
+ import * as EmailAccount from "./modules/stock/emailAccount/interface";
85
+ import * as EmailAccountRoutes from "./modules/stock/emailAccount/route.schema";
84
86
  import * as File from "./modules/stock/file/interface";
85
87
  import * as FileRoutes from "./modules/stock/file/route.schema";
86
88
  import * as Gmails from "./modules/stock/gmails/interface";
@@ -258,4 +260,4 @@ import * as stockErrors from "./shared/errors/stockErrors";
258
260
  import * as userErrors from "./shared/errors/userErrors";
259
261
  import * as viewErrors from "./shared/errors/viewErrors";
260
262
  import * as shared from "./shared/interface";
261
- export { AccountCode, AccountCodeRoutes, AdminPanel, AllowedDevice, AllowedDeviceRoutes, BankData, BankDataRoutes, BillOfLading, BillOfLadingRoutes, Catalogo, CatalogoRoutes, Channel, ChannelRoutes, Chat, ChatRapidMessage, ChatRapidMessageRoutes, ChatRoutes, ChatSubscriber, ChatSubscriberRoutes, Client, ClientRoutes, ClientType, ClientTypeRoutes, CLT, CLTRoutes, Commissioner, CommissionerRoutes, ConferirEncomenda, Country, CountryRoutes, CurrentAccount, CurrentAccountRoutes, Dashboard, DashboardRoutes, DeliveryMethods, DeliveryMethodsRoutes, DocumentHeader, DocumentHeaderHistory, DocumentHeaderRoutes, DocumentHeaderSubscriber, DocumentHeaderSubscriberRoutes, DocumentHeaderSurvey, DocumentHeaderSurveyRoutes, DocumentLine, DocumentLineAssoc, DocumentLineMt, DocumentLineMtRoutes, DocumentLineNote, DocumentLineNoteRoutes, DocumentLineRm, DocumentLineRmRoutes, DocumentLineRoutes, documentManagementErrors, DocumentSet, DocumentSetRoutes, DocumentType, DocumentTypeRoutes, EmailLog, EmailLogRoutes, EmailTemplate, EmailTemplateAttachment, EmailTemplateAttachmentRoutes, EmailTemplateRoutes, EmailVerification, EmailVerificationRoutes, ErrorLog, ErrorLogRoutes, ExternalDocumentHeader, ExternalDocumentHeaderRoutes, ExternalDocumentType, Favorites, FavoritesRoutes, File, FileRoutes, Gmails, GoogleCalendar, GoogleCalendarRoutes, GoogleFilePermission, GoogleFilePermissionRoutes, GoogleSheetPool, GoogleSheets, GoogleSheetsRoutes, integrationErrors, Inventario, InventarioRoutes, Language, LanguageRoutes, LLM, LLMRoutes, Location, LocationRoutes, MaterialEntrance, MaterialEntranceRoutes, MaturityDates, MaturityDatesRoutes, MobilePrint, MobilePrintRoutes, Multimedia, MultimediaRoutes, Npc, NpcRoutes, NPF, NPFRoutes, NRCL, NRCLRoutes, Observation, ObservationRoutes, ObservationType, ObservationTypeRoutes, Order, OrderManagement, OrderRoutes, Password, PasswordRoutes, PatchNotes, Payment, PaymentBatch, PaymentBatchRoutes, PaymentMethods, PaymentMethodsRoutes, PaymentRoutes, Persona, PersonaRoutes, Portal, PortalRoutes, PreSale, PreSaleProduct, PreSaleProductRoutes, PreSaleRoutes, Printer, PrinterRoutes, Prison, PrisonRoutes, ProductGoogleSheets, ProductGoogleSheetsRoutes, ProductImage, ProductImageRoutes, ProductionOrder, ProductionOrderRoutes, ProductLocation, Proforma, ProformaRoutes, ProjectInfo, ProjectInfoRoutes, Promotion, PromotionAssoc, PromotionAssocRoutes, PromotionRoutes, PropostaFornecedor, PropostaFornecedorRoutes, PropostaSheets, PropostaSheetsRoutes, ProviderCreditNoteFromReturn, ProviderCreditNoteFromReturnRoutes, ProviderFinancialCreditNote, ProviderFinancialCreditNoteRoutes, Providers, ProviderServiceInvoice, ProviderServiceInvoiceRoutes, ProvidersRoutes, ProviderType, ProviderTypeRoutes, Purchase, PurchaseConditions, PurchaseConditionsRoutes, PurchaseRoutes, Quebra, QuebraRoutes, QueryList, QueryListRoutes, QueryParameter, QueryParameterRoutes, ReasonForExemption, ReasonForExemptionRoutes, RecurrentTasks, RefreshToken, RefreshTokenRoutes, ReturnReason, ReturnReasonRoutes, ReturnToProvider, ReturnToProviderRoutes, SavedEmPicking, SavedEmPickingRoutes, SavedProviderProposal, SavedProviderProposalRoutes, Schedule, SchedulePrintJob, SchedulePrintJobRoutes, ScheduleRoutes, SegmentsArea, SegmentsAreaRoutes, Sessions, SessionsRoutes, Settings, SettingsRoutes, shared, Shippings, ShippingsRoutes, SideMenu, SidemenuHighlight, SidemenuHighlightRoutes, SideMenuRoutes, SmsSender, SmsTemplate, SmsTemplateRoutes, StartDocumentHeaderLastUpdate, stockErrors, StockMovement, StockMovementRoutes, StoreOperator, StoreOperatorRoutes, Swift, SwiftRoutes, SystemModule, SystemModuleRoutes, Tag, TagRoutes, Task, TaskMessage, TaskMessageRoutes, TaskRead, TaskReadRoutes, TaskRoutes, Tenant, TenantRoutes, Theme, ThemeRoutes, Tickets, TicketsLanguage, TicketsLanguageRoutes, TicketsRoutes, TimeSheet, TimeSheetRoutes, Transformado, TransformadoRoutes, TypeOfLocation, TypeOfLocationRoutes, UnitOfMeasure, UnitOfMeasureRoutes, UpfrontReturn, UpfrontReturnRoutes, userErrors, UserPositions, UserPositionsRoutes, Users, UsersRoutes, UserTokens, UserTokensRoutes, VatTax, VatTaxRoutes, VatTaxZone, VatTaxZoneRoutes, VatValidation, VatValidationRoutes, Vehicles, VehiclesRoutes, viewErrors, WebSocket, Workflow, WorkflowRoutes, };
263
+ export { AccountCode, AccountCodeRoutes, AdminPanel, AllowedDevice, AllowedDeviceRoutes, BankData, BankDataRoutes, BillOfLading, BillOfLadingRoutes, Catalogo, CatalogoRoutes, Channel, ChannelRoutes, Chat, ChatRapidMessage, ChatRapidMessageRoutes, ChatRoutes, ChatSubscriber, ChatSubscriberRoutes, Client, ClientRoutes, ClientType, ClientTypeRoutes, CLT, CLTRoutes, Commissioner, CommissionerRoutes, ConferirEncomenda, Country, CountryRoutes, CurrentAccount, CurrentAccountRoutes, Dashboard, DashboardRoutes, DeliveryMethods, DeliveryMethodsRoutes, DocumentHeader, DocumentHeaderHistory, DocumentHeaderRoutes, DocumentHeaderSubscriber, DocumentHeaderSubscriberRoutes, DocumentHeaderSurvey, DocumentHeaderSurveyRoutes, DocumentLine, DocumentLineAssoc, DocumentLineMt, DocumentLineMtRoutes, DocumentLineNote, DocumentLineNoteRoutes, DocumentLineRm, DocumentLineRmRoutes, DocumentLineRoutes, documentManagementErrors, DocumentSet, DocumentSetRoutes, DocumentType, DocumentTypeRoutes, EmailAccount, EmailAccountRoutes, EmailLog, EmailLogRoutes, EmailTemplate, EmailTemplateAttachment, EmailTemplateAttachmentRoutes, EmailTemplateRoutes, EmailVerification, EmailVerificationRoutes, ErrorLog, ErrorLogRoutes, ExternalDocumentHeader, ExternalDocumentHeaderRoutes, ExternalDocumentType, Favorites, FavoritesRoutes, File, FileRoutes, Gmails, GoogleCalendar, GoogleCalendarRoutes, GoogleFilePermission, GoogleFilePermissionRoutes, GoogleSheetPool, GoogleSheets, GoogleSheetsRoutes, integrationErrors, Inventario, InventarioRoutes, Language, LanguageRoutes, LLM, LLMRoutes, Location, LocationRoutes, MaterialEntrance, MaterialEntranceRoutes, MaturityDates, MaturityDatesRoutes, MobilePrint, MobilePrintRoutes, Multimedia, MultimediaRoutes, Npc, NpcRoutes, NPF, NPFRoutes, NRCL, NRCLRoutes, Observation, ObservationRoutes, ObservationType, ObservationTypeRoutes, Order, OrderManagement, OrderRoutes, Password, PasswordRoutes, PatchNotes, Payment, PaymentBatch, PaymentBatchRoutes, PaymentMethods, PaymentMethodsRoutes, PaymentRoutes, Persona, PersonaRoutes, Portal, PortalRoutes, PreSale, PreSaleProduct, PreSaleProductRoutes, PreSaleRoutes, Printer, PrinterRoutes, Prison, PrisonRoutes, ProductGoogleSheets, ProductGoogleSheetsRoutes, ProductImage, ProductImageRoutes, ProductionOrder, ProductionOrderRoutes, ProductLocation, Proforma, ProformaRoutes, ProjectInfo, ProjectInfoRoutes, Promotion, PromotionAssoc, PromotionAssocRoutes, PromotionRoutes, PropostaFornecedor, PropostaFornecedorRoutes, PropostaSheets, PropostaSheetsRoutes, ProviderCreditNoteFromReturn, ProviderCreditNoteFromReturnRoutes, ProviderFinancialCreditNote, ProviderFinancialCreditNoteRoutes, Providers, ProviderServiceInvoice, ProviderServiceInvoiceRoutes, ProvidersRoutes, ProviderType, ProviderTypeRoutes, Purchase, PurchaseConditions, PurchaseConditionsRoutes, PurchaseRoutes, Quebra, QuebraRoutes, QueryList, QueryListRoutes, QueryParameter, QueryParameterRoutes, ReasonForExemption, ReasonForExemptionRoutes, RecurrentTasks, RefreshToken, RefreshTokenRoutes, ReturnReason, ReturnReasonRoutes, ReturnToProvider, ReturnToProviderRoutes, SavedEmPicking, SavedEmPickingRoutes, SavedProviderProposal, SavedProviderProposalRoutes, Schedule, SchedulePrintJob, SchedulePrintJobRoutes, ScheduleRoutes, SegmentsArea, SegmentsAreaRoutes, Sessions, SessionsRoutes, Settings, SettingsRoutes, shared, Shippings, ShippingsRoutes, SideMenu, SidemenuHighlight, SidemenuHighlightRoutes, SideMenuRoutes, SmsSender, SmsTemplate, SmsTemplateRoutes, StartDocumentHeaderLastUpdate, stockErrors, StockMovement, StockMovementRoutes, StoreOperator, StoreOperatorRoutes, Swift, SwiftRoutes, SystemModule, SystemModuleRoutes, Tag, TagRoutes, Task, TaskMessage, TaskMessageRoutes, TaskRead, TaskReadRoutes, TaskRoutes, Tenant, TenantRoutes, Theme, ThemeRoutes, Tickets, TicketsLanguage, TicketsLanguageRoutes, TicketsRoutes, TimeSheet, TimeSheetRoutes, Transformado, TransformadoRoutes, TypeOfLocation, TypeOfLocationRoutes, UnitOfMeasure, UnitOfMeasureRoutes, UpfrontReturn, UpfrontReturnRoutes, userErrors, UserPositions, UserPositionsRoutes, Users, UsersRoutes, UserTokens, UserTokensRoutes, VatTax, VatTaxRoutes, VatTaxZone, VatTaxZoneRoutes, VatValidation, VatValidationRoutes, Vehicles, VehiclesRoutes, viewErrors, WebSocket, Workflow, WorkflowRoutes, };
@@ -23,10 +23,10 @@ export interface IUnpaidMaterialEntranceLineResponse {
23
23
  discount: number;
24
24
  provider_purchase_discount: number;
25
25
  provider_tax_value: number;
26
- client_tax_value: number;
27
26
  global_discount: number;
28
27
  preco_custo: number;
29
28
  preco_venda: number;
29
+ client_unit_total: number;
30
30
  margin: number | null;
31
31
  total_without_tax: number;
32
32
  total: number;
@@ -30,8 +30,9 @@ export interface IFindResponse {
30
30
  telephone: string;
31
31
  message: string;
32
32
  status: string;
33
- error?: string;
34
33
  created_at: Date;
34
+ document_link?: string;
35
+ error?: string;
35
36
  processed_at?: Date;
36
37
  sent_at?: Date;
37
38
  sent_by?: string;
@@ -0,0 +1,70 @@
1
+ import type * as IShared from "../../../shared/interface";
2
+ export declare const Route = "email_account";
3
+ /** Latest sync audit summary attached to an account row. */
4
+ export interface IEmailSyncAuditView {
5
+ started_at: Date;
6
+ finished_at: Date | null;
7
+ status: string;
8
+ messages_seen: number;
9
+ messages_inserted: number;
10
+ messages_skipped: number;
11
+ messages_errored: number;
12
+ error_message: string | null;
13
+ }
14
+ /** Secret-free view of an email account for the UI. */
15
+ export interface IEmailAccountResponse {
16
+ id: string;
17
+ gmail_email: string;
18
+ imap_host: string;
19
+ imap_port: number;
20
+ imap_user: string;
21
+ active: boolean;
22
+ /** Whether the Gmail OAuth consent has been completed (token exists). */
23
+ has_token: boolean;
24
+ uid_validity: string | null;
25
+ last_uid: number;
26
+ last_error: string | null;
27
+ created_at: Date;
28
+ updated_at: Date;
29
+ last_audit: IEmailSyncAuditView | null;
30
+ }
31
+ export interface ICreateRequest {
32
+ gmail_email: string;
33
+ imap_host: string;
34
+ imap_port: number;
35
+ imap_user: string;
36
+ imap_password: string;
37
+ }
38
+ export interface IUpdateRequest {
39
+ imap_host?: string;
40
+ imap_port?: number;
41
+ imap_user?: string;
42
+ imap_password?: string;
43
+ active?: boolean;
44
+ }
45
+ export interface ICreateResponse {
46
+ id: string;
47
+ }
48
+ export interface ISyncResultResponse {
49
+ auditId: string;
50
+ status: string;
51
+ errorMessage: string | null;
52
+ seen: number;
53
+ inserted: number;
54
+ skipped: number;
55
+ errored: number;
56
+ }
57
+ export interface IRepository {
58
+ find(): Promise<IEmailAccountResponse[]>;
59
+ findById(selector: IShared.IFindByIdRequest): Promise<IEmailAccountResponse>;
60
+ create(data: ICreateRequest): Promise<ICreateResponse>;
61
+ update(selector: IShared.IFindByIdRequest, data: IUpdateRequest): Promise<void>;
62
+ deleteOne(selector: IShared.IFindByIdRequest): Promise<void>;
63
+ /** Returns the Gmail OAuth consent URL for the account's destination mailbox. */
64
+ auth(selector: IShared.IFindByIdRequest): Promise<string>;
65
+ /** Triggers a sync for one account. */
66
+ sync(selector: IShared.IFindByIdRequest): Promise<ISyncResultResponse>;
67
+ /** Triggers a sync for all active accounts. */
68
+ syncAll(): Promise<ISyncResultResponse[]>;
69
+ }
70
+ export type IController = IShared.IEntityWithUserToken<IRepository>;
@@ -0,0 +1,3 @@
1
+ import joi from "joi";
2
+ export declare const createBody: joi.ObjectSchema<any>;
3
+ export declare const updateBody: joi.ObjectSchema<any>;
@@ -19,17 +19,23 @@ export interface IPublicDocument {
19
19
  export interface IPublicOtherDocument {
20
20
  chat_subscriber_id: string;
21
21
  chat_document_header_id: string;
22
+ document_header_id: string;
22
23
  label: string;
23
24
  emission_date: Date;
24
25
  pdf_link: string;
25
26
  client_unread: number;
26
27
  tags: ITags[];
28
+ document_name: string;
29
+ store_operator_name: string;
30
+ user_type: IDocumentTypeUserType;
31
+ document_total: number;
32
+ document_state: string;
33
+ other_personas: ChatSubscriber.IPersona[];
27
34
  created_by: string;
28
35
  closed: boolean;
29
36
  }
30
37
  export interface IPublicFindBySubscriberId {
31
38
  owner_id: string;
32
- document?: IPublicDocument;
33
39
  persona?: ChatSubscriber.IPersona;
34
40
  chat: IChatBalloon[];
35
41
  documents: IPublicOtherDocument[];
@@ -6,6 +6,7 @@ import { ISmsSenderStats } from "../../modules/sms/smsSender/interfaces";
6
6
  export type SmsSender = {
7
7
  id: string;
8
8
  document_line_id: string | null;
9
+ document_header_id: string | null;
9
10
  telephone: string;
10
11
  message: string;
11
12
  status: ISmsSenderStats;
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.46",
4
+ "version": "1.3.47",
5
5
  "author": "Nomalism <it.nomalism@gmail.com> (https://nomalism.com/)",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",
@@ -17,7 +17,7 @@
17
17
  "dist"
18
18
  ],
19
19
  "scripts": {
20
- "lint": "eslint . --fix && prettier --write .",
20
+ "lint": "eslint . --fix && prettier --write . --log-level warn",
21
21
  "prebuild": "rm -rf dist",
22
22
  "build": "tsc --emitDeclarationOnly && tsup",
23
23
  "postbuild": "cp dist/index.js dist/index.cjs",
@@ -29,19 +29,19 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "@eslint/js": "^10.0.1",
32
- "@swc/core": "^1.15.43",
32
+ "@swc/core": "^1.15.46",
33
33
  "@types/node": "^26.1.1",
34
34
  "@typescript-eslint/eslint-plugin": "^8.62.0",
35
35
  "@typescript-eslint/parser": "^8.62.0",
36
36
  "eslint": "^10.7.0",
37
37
  "eslint-config-prettier": "^10.1.8",
38
- "eslint-plugin-simple-import-sort": "^13.0.0",
38
+ "eslint-plugin-simple-import-sort": "^14.0.0",
39
39
  "globals": "^17.7.0",
40
40
  "husky": "^9.1.7",
41
- "lint-staged": "^17.0.8",
42
- "prettier": "^3.9.5",
41
+ "lint-staged": "^17.1.0",
42
+ "prettier": "^3.9.6",
43
43
  "tsup": "^8.5.1",
44
- "typescript-eslint": "^8.64.0"
44
+ "typescript-eslint": "^8.65.0"
45
45
  },
46
46
  "repository": {
47
47
  "type": "git",