@seidor-cloud-produtos/tax-core 1.0.33 → 1.0.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +127 -22
- package/dist/index.d.ts +127 -22
- package/dist/index.js +5 -5
- package/dist/index.mjs +5 -5
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,132 @@
|
|
|
1
1
|
import { MongoClient } from 'mongodb';
|
|
2
2
|
import { ClientConfig, Pool } from 'pg';
|
|
3
3
|
|
|
4
|
+
type AuditAction = 'CREATED' | 'UPDATED' | 'DELETED' | 'INACTIVATED' | 'ACTIVATED' | 'STATUS_CHANGED' | 'IMPORTED' | 'REPROCESSED';
|
|
5
|
+
type AuditActorType = 'USER' | 'SYSTEM' | 'INTEGRATION';
|
|
6
|
+
type AuditSourceType = 'HTTP' | 'CONSUMER' | 'JOB' | 'WEBHOOK';
|
|
7
|
+
type AuditChangeSetType = 'PATCH' | 'BEFORE_AFTER' | 'NONE';
|
|
8
|
+
interface AuditFieldChange {
|
|
9
|
+
field: string;
|
|
10
|
+
previous?: unknown;
|
|
11
|
+
next?: unknown;
|
|
12
|
+
label?: string;
|
|
13
|
+
}
|
|
14
|
+
interface AuditChangeSet {
|
|
15
|
+
type: AuditChangeSetType;
|
|
16
|
+
changed_fields?: string[];
|
|
17
|
+
patch?: Record<string, unknown>;
|
|
18
|
+
before?: Record<string, unknown>;
|
|
19
|
+
after?: Record<string, unknown>;
|
|
20
|
+
field_changes?: AuditFieldChange[];
|
|
21
|
+
}
|
|
22
|
+
interface AuditEvent {
|
|
23
|
+
event_id: string;
|
|
24
|
+
service: string;
|
|
25
|
+
tenant_id: string;
|
|
26
|
+
action: AuditAction;
|
|
27
|
+
entity: string;
|
|
28
|
+
user: {
|
|
29
|
+
type: AuditActorType;
|
|
30
|
+
id?: string;
|
|
31
|
+
name?: string;
|
|
32
|
+
email?: string;
|
|
33
|
+
};
|
|
34
|
+
source: {
|
|
35
|
+
type: AuditSourceType;
|
|
36
|
+
name: string;
|
|
37
|
+
};
|
|
38
|
+
change_set?: AuditChangeSet;
|
|
39
|
+
created_at?: Date;
|
|
40
|
+
updated_at: Date;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface IAuditEventRepository {
|
|
44
|
+
insert(event: AuditEvent): Promise<AuditEvent>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare class AuditEventBuilder {
|
|
48
|
+
private readonly event;
|
|
49
|
+
withEventId(value: string): this;
|
|
50
|
+
withEntity(value: string): this;
|
|
51
|
+
withUser(user: AuditEvent['user']): this;
|
|
52
|
+
withAction(action: AuditAction): this;
|
|
53
|
+
withTenant(tenantId: string): this;
|
|
54
|
+
withService(service: string): this;
|
|
55
|
+
withSource(type: AuditSourceType, name: string): this;
|
|
56
|
+
withChangeSet(changeSet: AuditChangeSet): this;
|
|
57
|
+
build(): AuditEvent;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
interface CompareOptions {
|
|
61
|
+
ignore?: string[];
|
|
62
|
+
}
|
|
63
|
+
interface CompareResult {
|
|
64
|
+
hasChanges: boolean;
|
|
65
|
+
fieldChanges: AuditFieldChange[];
|
|
66
|
+
changedFields: string[];
|
|
67
|
+
}
|
|
68
|
+
declare class ObjectComparator {
|
|
69
|
+
static compare<T extends Record<string, unknown>>(previous: T, next: T, options?: CompareOptions): CompareResult;
|
|
70
|
+
private static flatten;
|
|
71
|
+
private static isIgnored;
|
|
72
|
+
private static isEqual;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
interface AuditServiceConfig {
|
|
76
|
+
service: string;
|
|
77
|
+
source: {
|
|
78
|
+
type: AuditSourceType;
|
|
79
|
+
name: string;
|
|
80
|
+
};
|
|
81
|
+
defaultIgnoredFields?: string[];
|
|
82
|
+
}
|
|
83
|
+
interface AuditContext {
|
|
84
|
+
tenantId: string;
|
|
85
|
+
user: AuditEvent['user'];
|
|
86
|
+
}
|
|
87
|
+
declare class AuditEventService {
|
|
88
|
+
private readonly repository;
|
|
89
|
+
private readonly config;
|
|
90
|
+
constructor(repository: IAuditEventRepository, config: AuditServiceConfig);
|
|
91
|
+
trackCreate<T extends Record<string, unknown>>(entityType: string, eventId: string, entity: T, context: AuditContext): Promise<AuditEvent>;
|
|
92
|
+
trackUpdate<T extends Record<string, unknown>>(entityType: string, eventId: string, before: T, after: T, context: AuditContext, compareOptions?: CompareOptions): Promise<AuditEvent | null>;
|
|
93
|
+
trackDelete<T extends Record<string, unknown>>(entityType: string, eventId: string, entity: T, context: AuditContext): Promise<AuditEvent>;
|
|
94
|
+
track(action: AuditAction, entityType: string, eventId: string, changeSet: AuditChangeSet, context: AuditContext): Promise<AuditEvent>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
declare class MongoConfig {
|
|
98
|
+
host: string;
|
|
99
|
+
port: number;
|
|
100
|
+
database: string;
|
|
101
|
+
username?: string;
|
|
102
|
+
password?: string;
|
|
103
|
+
isSrv: boolean;
|
|
104
|
+
maxPoolSize: number;
|
|
105
|
+
minPoolSize: number;
|
|
106
|
+
connectTimeoutMS: number;
|
|
107
|
+
socketTimeoutMS: number;
|
|
108
|
+
constructor(host: string, port: number, database: string, username?: string, password?: string, isSrv?: boolean, maxPoolSize?: number, minPoolSize?: number, connectTimeoutMS?: number, socketTimeoutMS?: number);
|
|
109
|
+
getConnectionString(): string;
|
|
110
|
+
getPoolOptions(): {
|
|
111
|
+
maxPoolSize: number;
|
|
112
|
+
minPoolSize: number;
|
|
113
|
+
connectTimeoutMS: number;
|
|
114
|
+
socketTimeoutMS: number;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
declare class MongoAuditEventRepository implements IAuditEventRepository {
|
|
119
|
+
private readonly mongoConfig;
|
|
120
|
+
private readonly collectionName;
|
|
121
|
+
private readonly _client;
|
|
122
|
+
private collection;
|
|
123
|
+
constructor(mongoConfig: MongoConfig, collectionName?: string);
|
|
124
|
+
private getCollection;
|
|
125
|
+
private ensureIndexes;
|
|
126
|
+
insert(event: AuditEvent): Promise<AuditEvent>;
|
|
127
|
+
disconnect(): Promise<void>;
|
|
128
|
+
}
|
|
129
|
+
|
|
4
130
|
interface Cloneable {
|
|
5
131
|
clone(): this;
|
|
6
132
|
}
|
|
@@ -2449,27 +2575,6 @@ type MongoRetainedTaxFilter = MongoBaseFilter & {
|
|
|
2449
2575
|
declare function buildMongoFilter(filters: FiltersDocument): MongoBaseFilter;
|
|
2450
2576
|
declare function buildMongoFilterToRetainedTax(filters: FiltersDocument): MongoRetainedTaxFilter;
|
|
2451
2577
|
|
|
2452
|
-
declare class MongoConfig {
|
|
2453
|
-
host: string;
|
|
2454
|
-
port: number;
|
|
2455
|
-
database: string;
|
|
2456
|
-
username?: string;
|
|
2457
|
-
password?: string;
|
|
2458
|
-
isSrv: boolean;
|
|
2459
|
-
maxPoolSize: number;
|
|
2460
|
-
minPoolSize: number;
|
|
2461
|
-
connectTimeoutMS: number;
|
|
2462
|
-
socketTimeoutMS: number;
|
|
2463
|
-
constructor(host: string, port: number, database: string, username?: string, password?: string, isSrv?: boolean, maxPoolSize?: number, minPoolSize?: number, connectTimeoutMS?: number, socketTimeoutMS?: number);
|
|
2464
|
-
getConnectionString(): string;
|
|
2465
|
-
getPoolOptions(): {
|
|
2466
|
-
maxPoolSize: number;
|
|
2467
|
-
minPoolSize: number;
|
|
2468
|
-
connectTimeoutMS: number;
|
|
2469
|
-
socketTimeoutMS: number;
|
|
2470
|
-
};
|
|
2471
|
-
}
|
|
2472
|
-
|
|
2473
2578
|
declare class PostgresConfig {
|
|
2474
2579
|
config: {
|
|
2475
2580
|
user: string;
|
|
@@ -4957,4 +5062,4 @@ declare class Calendar {
|
|
|
4957
5062
|
|
|
4958
5063
|
declare const BRAZIL_HOLIDAYS: HolidayDefinition[];
|
|
4959
5064
|
|
|
4960
|
-
export { AccountingDocument, ActionTypeEnum, Addition, Address, type AllowedCfopsCreditConfig, Alphanumeric, type AuditTaxCollectionDetails, type AuditTaxCollectionInfo, type AuthTokenExpiredParams, type AuthUnauthorizedParams, BRAZIL_HOLIDAYS, Block, BuilderAccountingDocument, BuilderAddition, BuilderAddress, BuilderConversionFactor, BuilderDocument, BuilderImportDeclaration, BuilderItem, BuilderPerson, BuilderTax, CNPJ, CNPJ_FLEXIBLE_REGEX, CNPJ_MASKED_REGEX, CNPJ_RAW_REGEX, CPF, CPF_FLEXIBLE_REGEX, CPF_MASKED_REGEX, CPF_RAW_REGEX, CST, CalculationBasisNatureSetting, Calendar, type Cloneable, CloseBlock, CloseFile, CodIncTrib, type Cod_ent_ref, CodeStatusEnum, ConfigTypeEnum, ConsoleOutput, Contact, ContactTypesEnum, ConversionFactor, CounterBlock, CounterRegister, Country, CountryCodeEnum, CprbOption, CreditBalanceOriginCreditTypeEnum, CreditBalanceRegimeTypeEnum, CteTypeEnum, DEFAULT_LOCALE, type DatabaseConnectionFailedParams, type DatabaseQueryErrorParams, DayOfWeek, Decimal, DefaultAlphanumericLength, DefaultDecimalLength, DefaultDecimalSeparator, DescriptionStatusEnum, DifalIcmsCategoryEnum, Document, type DocumentRepository, DocumentTypeEnum, DonationIndicatorEnum, DueDateAdjustmentEnum, EasterCalculator, EcdSpecializedProfile, EcfSpecializedProfile, EfdContribSpecializedProfile, EfdIcmsIpiSpecializedProfile, Email, EnforceabilityOfISSEnum, Establishment, EstablishmentEvent, Event, EventEnum, FederalCollectionSettings, FieldDataType, type FieldFormat, type FiltersDocument, FiscalQualificationType, FreightContractedNatureIndicatorEnum, FreightTypeCodeEnum, FreightTypeEnum, type GetAuditTaxCollectionQuery, GrossRevenueContributionHeaders, type HolidayDefinition, type HolidayLocation, type HolidayScope, type IAccountingDocumentMongo, type IAddition, type IAddressMongo, type IBaseHeadersDTO, type ICalculationBasisNatureSetting, type ICollectionSettings, type IConversionFactor, type IDocumentMongo, type IEcdSpecializedProfile, type IEcfSpecializedProfile, type IEfdContribSpecializedProfile, type IEfdicmsipiAdditionalFields, type IEstablishment, type IEstablishmentEvent, type IGrossRevenueContributionHeader, type IIcmsAdjustmentExtraInfo, type IIcmsAdjustmentSetting, type IIcmsCreditBaseConfig, type IIcmsCreditConfigLog, type IImportDeclaration, type IItemMongo, type IJudicialProcess, type INatureConfig, type INatureOfIncomeBusinessPartner, type IPersonMongo, type IProfile, type IProfileRepository, type IProfileServiceUrls, type IReinfAdditionalFields, type IRevenueNatureSettings, type IScp, type ISignatory, type IStartingCreditBalance, type IStateCollectionSettingsRepository, type ITable9, type ITaxMongo, type ITaxTypeConfig, type ITaxTypeConfigBase, type ITaxTypeConfigCreateOrUpdate, type ITaxTypeConfigLog, IcmsAdjustmentGroupEnum, IcmsAdjustmentRegistryEnum, IcmsAdjustmentSetting, IcmsAdjustmentTaxTypeEnum, IcmsAdjustmentTypeEnum, IcmsCalculationIndicatorEnum, type IdentificationNumber, ImportDeclaration, IntermediationTypeEnum, type InternalServerErrorParams, InternationalTransportTypeEnum, IssuerIndicatorEnum, Item, ItemTypeEnum, JudicialProcessOriginEnum, Key, type KeyComposition, type KeyFieldDefinition, LayoutDateFormat, type Locale, MaximumNumericLength, MemoryMasterDataRepository, MemoryPersist, MessageCategory, MessageCode, type MessageCodeType, Messages, ModelConverter, ModelRollback, MongoConfig, MongoRepository, MongoToDocumentBuilder, MunicipalObligation, MunicipalObligationIdEnum, MunicipalObligationNameEnum, MunicipalObligationTypeEnum, MunicipalRegistration, Municipality, NameCountryEnum, NatureCode, NatureConfig, Numeric, ObligationCodeEnum, OnDuplication, OnDuplicationStrategy, OpenBlock, OperationTypeEnum, OurDate, type OutputWriter, type ParameterTypes, PaymentTypeEnum, PeriodDateFieldEnum, Person, type PisCofinsOptions, PostgresConfig, PostgresRepository, ProductOriginEnum, Profile, ProfileDbRepository, ProfileRestRepository, ProfileTaxTypeEnum, Register, type RegisterDefinition, type RegisterEventData, type RegisterEventNotifier, type RegisterGenerator, type RegisterPersist, type RegisterSubscriber, ReinfSpecializedProfile, type ReportGenerationOptions, ReportGenerator, type Repository, type ResolvedHoliday, RevenueNatureSettings, RevenueTypeEnum, Scp, ServiceCode, ServiceCodeEnum, type SettingErrorParams, Signatory, SimpleNationalOption, type SimpleReportGenerationOptions, SimpleReportGenerator, StartingCreditBalance, StartingCreditBalanceTypeEnum, State, StateCollectionSettings, StateCollectionSettingsConfigTypeEnum, StateCollectionSettingsTaxTypeEnum, StateEnum, StateRegistration, StateRegistrationIndicatorEnum, StatusDocumentEnum, StringArrayOutput, TagCounter, Tax, type TaxCollectionDetails, TaxCollectionType, TaxCollectionTypeEnum, TaxRegimeEnum, type TaxRegimes, type TaxRegisterGenerationOptions, TaxRegisterGenerator, TaxReport, TaxTypeEnum, TaxationType, Telephone, Uf, type ValidationInvalidInputParams, type ValidationMissingFieldParams, ValueProviderType, WEEKDAYS, ZERO_PIS_COFINS_BY_CST, ZfmPresumedCreditTypeEnum, buildMongoFilter, buildMongoFilterToRetainedTax, calculate_bases_values, cleanData, formatMessage, isEmptyObject, keyCompositionMetadata, logWithContext, newRegisterEventData, normalizeServiceCode, onDuplicationStrategyMetadata, parseState, toSafeNumber, validationValue };
|
|
5065
|
+
export { AccountingDocument, ActionTypeEnum, Addition, Address, type AllowedCfopsCreditConfig, Alphanumeric, type AuditAction, type AuditActorType, type AuditChangeSet, type AuditChangeSetType, type AuditContext, type AuditEvent, AuditEventBuilder, AuditEventService, type AuditFieldChange, type AuditServiceConfig, type AuditSourceType, type AuditTaxCollectionDetails, type AuditTaxCollectionInfo, type AuthTokenExpiredParams, type AuthUnauthorizedParams, BRAZIL_HOLIDAYS, Block, BuilderAccountingDocument, BuilderAddition, BuilderAddress, BuilderConversionFactor, BuilderDocument, BuilderImportDeclaration, BuilderItem, BuilderPerson, BuilderTax, CNPJ, CNPJ_FLEXIBLE_REGEX, CNPJ_MASKED_REGEX, CNPJ_RAW_REGEX, CPF, CPF_FLEXIBLE_REGEX, CPF_MASKED_REGEX, CPF_RAW_REGEX, CST, CalculationBasisNatureSetting, Calendar, type Cloneable, CloseBlock, CloseFile, CodIncTrib, type Cod_ent_ref, CodeStatusEnum, type CompareOptions, type CompareResult, ConfigTypeEnum, ConsoleOutput, Contact, ContactTypesEnum, ConversionFactor, CounterBlock, CounterRegister, Country, CountryCodeEnum, CprbOption, CreditBalanceOriginCreditTypeEnum, CreditBalanceRegimeTypeEnum, CteTypeEnum, DEFAULT_LOCALE, type DatabaseConnectionFailedParams, type DatabaseQueryErrorParams, DayOfWeek, Decimal, DefaultAlphanumericLength, DefaultDecimalLength, DefaultDecimalSeparator, DescriptionStatusEnum, DifalIcmsCategoryEnum, Document, type DocumentRepository, DocumentTypeEnum, DonationIndicatorEnum, DueDateAdjustmentEnum, EasterCalculator, EcdSpecializedProfile, EcfSpecializedProfile, EfdContribSpecializedProfile, EfdIcmsIpiSpecializedProfile, Email, EnforceabilityOfISSEnum, Establishment, EstablishmentEvent, Event, EventEnum, FederalCollectionSettings, FieldDataType, type FieldFormat, type FiltersDocument, FiscalQualificationType, FreightContractedNatureIndicatorEnum, FreightTypeCodeEnum, FreightTypeEnum, type GetAuditTaxCollectionQuery, GrossRevenueContributionHeaders, type HolidayDefinition, type HolidayLocation, type HolidayScope, type IAccountingDocumentMongo, type IAddition, type IAddressMongo, type IAuditEventRepository, type IBaseHeadersDTO, type ICalculationBasisNatureSetting, type ICollectionSettings, type IConversionFactor, type IDocumentMongo, type IEcdSpecializedProfile, type IEcfSpecializedProfile, type IEfdContribSpecializedProfile, type IEfdicmsipiAdditionalFields, type IEstablishment, type IEstablishmentEvent, type IGrossRevenueContributionHeader, type IIcmsAdjustmentExtraInfo, type IIcmsAdjustmentSetting, type IIcmsCreditBaseConfig, type IIcmsCreditConfigLog, type IImportDeclaration, type IItemMongo, type IJudicialProcess, type INatureConfig, type INatureOfIncomeBusinessPartner, type IPersonMongo, type IProfile, type IProfileRepository, type IProfileServiceUrls, type IReinfAdditionalFields, type IRevenueNatureSettings, type IScp, type ISignatory, type IStartingCreditBalance, type IStateCollectionSettingsRepository, type ITable9, type ITaxMongo, type ITaxTypeConfig, type ITaxTypeConfigBase, type ITaxTypeConfigCreateOrUpdate, type ITaxTypeConfigLog, IcmsAdjustmentGroupEnum, IcmsAdjustmentRegistryEnum, IcmsAdjustmentSetting, IcmsAdjustmentTaxTypeEnum, IcmsAdjustmentTypeEnum, IcmsCalculationIndicatorEnum, type IdentificationNumber, ImportDeclaration, IntermediationTypeEnum, type InternalServerErrorParams, InternationalTransportTypeEnum, IssuerIndicatorEnum, Item, ItemTypeEnum, JudicialProcessOriginEnum, Key, type KeyComposition, type KeyFieldDefinition, LayoutDateFormat, type Locale, MaximumNumericLength, MemoryMasterDataRepository, MemoryPersist, MessageCategory, MessageCode, type MessageCodeType, Messages, ModelConverter, ModelRollback, MongoAuditEventRepository, MongoConfig, MongoRepository, MongoToDocumentBuilder, MunicipalObligation, MunicipalObligationIdEnum, MunicipalObligationNameEnum, MunicipalObligationTypeEnum, MunicipalRegistration, Municipality, NameCountryEnum, NatureCode, NatureConfig, Numeric, ObjectComparator, ObligationCodeEnum, OnDuplication, OnDuplicationStrategy, OpenBlock, OperationTypeEnum, OurDate, type OutputWriter, type ParameterTypes, PaymentTypeEnum, PeriodDateFieldEnum, Person, type PisCofinsOptions, PostgresConfig, PostgresRepository, ProductOriginEnum, Profile, ProfileDbRepository, ProfileRestRepository, ProfileTaxTypeEnum, Register, type RegisterDefinition, type RegisterEventData, type RegisterEventNotifier, type RegisterGenerator, type RegisterPersist, type RegisterSubscriber, ReinfSpecializedProfile, type ReportGenerationOptions, ReportGenerator, type Repository, type ResolvedHoliday, RevenueNatureSettings, RevenueTypeEnum, Scp, ServiceCode, ServiceCodeEnum, type SettingErrorParams, Signatory, SimpleNationalOption, type SimpleReportGenerationOptions, SimpleReportGenerator, StartingCreditBalance, StartingCreditBalanceTypeEnum, State, StateCollectionSettings, StateCollectionSettingsConfigTypeEnum, StateCollectionSettingsTaxTypeEnum, StateEnum, StateRegistration, StateRegistrationIndicatorEnum, StatusDocumentEnum, StringArrayOutput, TagCounter, Tax, type TaxCollectionDetails, TaxCollectionType, TaxCollectionTypeEnum, TaxRegimeEnum, type TaxRegimes, type TaxRegisterGenerationOptions, TaxRegisterGenerator, TaxReport, TaxTypeEnum, TaxationType, Telephone, Uf, type ValidationInvalidInputParams, type ValidationMissingFieldParams, ValueProviderType, WEEKDAYS, ZERO_PIS_COFINS_BY_CST, ZfmPresumedCreditTypeEnum, buildMongoFilter, buildMongoFilterToRetainedTax, calculate_bases_values, cleanData, formatMessage, isEmptyObject, keyCompositionMetadata, logWithContext, newRegisterEventData, normalizeServiceCode, onDuplicationStrategyMetadata, parseState, toSafeNumber, validationValue };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,132 @@
|
|
|
1
1
|
import { MongoClient } from 'mongodb';
|
|
2
2
|
import { ClientConfig, Pool } from 'pg';
|
|
3
3
|
|
|
4
|
+
type AuditAction = 'CREATED' | 'UPDATED' | 'DELETED' | 'INACTIVATED' | 'ACTIVATED' | 'STATUS_CHANGED' | 'IMPORTED' | 'REPROCESSED';
|
|
5
|
+
type AuditActorType = 'USER' | 'SYSTEM' | 'INTEGRATION';
|
|
6
|
+
type AuditSourceType = 'HTTP' | 'CONSUMER' | 'JOB' | 'WEBHOOK';
|
|
7
|
+
type AuditChangeSetType = 'PATCH' | 'BEFORE_AFTER' | 'NONE';
|
|
8
|
+
interface AuditFieldChange {
|
|
9
|
+
field: string;
|
|
10
|
+
previous?: unknown;
|
|
11
|
+
next?: unknown;
|
|
12
|
+
label?: string;
|
|
13
|
+
}
|
|
14
|
+
interface AuditChangeSet {
|
|
15
|
+
type: AuditChangeSetType;
|
|
16
|
+
changed_fields?: string[];
|
|
17
|
+
patch?: Record<string, unknown>;
|
|
18
|
+
before?: Record<string, unknown>;
|
|
19
|
+
after?: Record<string, unknown>;
|
|
20
|
+
field_changes?: AuditFieldChange[];
|
|
21
|
+
}
|
|
22
|
+
interface AuditEvent {
|
|
23
|
+
event_id: string;
|
|
24
|
+
service: string;
|
|
25
|
+
tenant_id: string;
|
|
26
|
+
action: AuditAction;
|
|
27
|
+
entity: string;
|
|
28
|
+
user: {
|
|
29
|
+
type: AuditActorType;
|
|
30
|
+
id?: string;
|
|
31
|
+
name?: string;
|
|
32
|
+
email?: string;
|
|
33
|
+
};
|
|
34
|
+
source: {
|
|
35
|
+
type: AuditSourceType;
|
|
36
|
+
name: string;
|
|
37
|
+
};
|
|
38
|
+
change_set?: AuditChangeSet;
|
|
39
|
+
created_at?: Date;
|
|
40
|
+
updated_at: Date;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface IAuditEventRepository {
|
|
44
|
+
insert(event: AuditEvent): Promise<AuditEvent>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
declare class AuditEventBuilder {
|
|
48
|
+
private readonly event;
|
|
49
|
+
withEventId(value: string): this;
|
|
50
|
+
withEntity(value: string): this;
|
|
51
|
+
withUser(user: AuditEvent['user']): this;
|
|
52
|
+
withAction(action: AuditAction): this;
|
|
53
|
+
withTenant(tenantId: string): this;
|
|
54
|
+
withService(service: string): this;
|
|
55
|
+
withSource(type: AuditSourceType, name: string): this;
|
|
56
|
+
withChangeSet(changeSet: AuditChangeSet): this;
|
|
57
|
+
build(): AuditEvent;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
interface CompareOptions {
|
|
61
|
+
ignore?: string[];
|
|
62
|
+
}
|
|
63
|
+
interface CompareResult {
|
|
64
|
+
hasChanges: boolean;
|
|
65
|
+
fieldChanges: AuditFieldChange[];
|
|
66
|
+
changedFields: string[];
|
|
67
|
+
}
|
|
68
|
+
declare class ObjectComparator {
|
|
69
|
+
static compare<T extends Record<string, unknown>>(previous: T, next: T, options?: CompareOptions): CompareResult;
|
|
70
|
+
private static flatten;
|
|
71
|
+
private static isIgnored;
|
|
72
|
+
private static isEqual;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
interface AuditServiceConfig {
|
|
76
|
+
service: string;
|
|
77
|
+
source: {
|
|
78
|
+
type: AuditSourceType;
|
|
79
|
+
name: string;
|
|
80
|
+
};
|
|
81
|
+
defaultIgnoredFields?: string[];
|
|
82
|
+
}
|
|
83
|
+
interface AuditContext {
|
|
84
|
+
tenantId: string;
|
|
85
|
+
user: AuditEvent['user'];
|
|
86
|
+
}
|
|
87
|
+
declare class AuditEventService {
|
|
88
|
+
private readonly repository;
|
|
89
|
+
private readonly config;
|
|
90
|
+
constructor(repository: IAuditEventRepository, config: AuditServiceConfig);
|
|
91
|
+
trackCreate<T extends Record<string, unknown>>(entityType: string, eventId: string, entity: T, context: AuditContext): Promise<AuditEvent>;
|
|
92
|
+
trackUpdate<T extends Record<string, unknown>>(entityType: string, eventId: string, before: T, after: T, context: AuditContext, compareOptions?: CompareOptions): Promise<AuditEvent | null>;
|
|
93
|
+
trackDelete<T extends Record<string, unknown>>(entityType: string, eventId: string, entity: T, context: AuditContext): Promise<AuditEvent>;
|
|
94
|
+
track(action: AuditAction, entityType: string, eventId: string, changeSet: AuditChangeSet, context: AuditContext): Promise<AuditEvent>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
declare class MongoConfig {
|
|
98
|
+
host: string;
|
|
99
|
+
port: number;
|
|
100
|
+
database: string;
|
|
101
|
+
username?: string;
|
|
102
|
+
password?: string;
|
|
103
|
+
isSrv: boolean;
|
|
104
|
+
maxPoolSize: number;
|
|
105
|
+
minPoolSize: number;
|
|
106
|
+
connectTimeoutMS: number;
|
|
107
|
+
socketTimeoutMS: number;
|
|
108
|
+
constructor(host: string, port: number, database: string, username?: string, password?: string, isSrv?: boolean, maxPoolSize?: number, minPoolSize?: number, connectTimeoutMS?: number, socketTimeoutMS?: number);
|
|
109
|
+
getConnectionString(): string;
|
|
110
|
+
getPoolOptions(): {
|
|
111
|
+
maxPoolSize: number;
|
|
112
|
+
minPoolSize: number;
|
|
113
|
+
connectTimeoutMS: number;
|
|
114
|
+
socketTimeoutMS: number;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
declare class MongoAuditEventRepository implements IAuditEventRepository {
|
|
119
|
+
private readonly mongoConfig;
|
|
120
|
+
private readonly collectionName;
|
|
121
|
+
private readonly _client;
|
|
122
|
+
private collection;
|
|
123
|
+
constructor(mongoConfig: MongoConfig, collectionName?: string);
|
|
124
|
+
private getCollection;
|
|
125
|
+
private ensureIndexes;
|
|
126
|
+
insert(event: AuditEvent): Promise<AuditEvent>;
|
|
127
|
+
disconnect(): Promise<void>;
|
|
128
|
+
}
|
|
129
|
+
|
|
4
130
|
interface Cloneable {
|
|
5
131
|
clone(): this;
|
|
6
132
|
}
|
|
@@ -2449,27 +2575,6 @@ type MongoRetainedTaxFilter = MongoBaseFilter & {
|
|
|
2449
2575
|
declare function buildMongoFilter(filters: FiltersDocument): MongoBaseFilter;
|
|
2450
2576
|
declare function buildMongoFilterToRetainedTax(filters: FiltersDocument): MongoRetainedTaxFilter;
|
|
2451
2577
|
|
|
2452
|
-
declare class MongoConfig {
|
|
2453
|
-
host: string;
|
|
2454
|
-
port: number;
|
|
2455
|
-
database: string;
|
|
2456
|
-
username?: string;
|
|
2457
|
-
password?: string;
|
|
2458
|
-
isSrv: boolean;
|
|
2459
|
-
maxPoolSize: number;
|
|
2460
|
-
minPoolSize: number;
|
|
2461
|
-
connectTimeoutMS: number;
|
|
2462
|
-
socketTimeoutMS: number;
|
|
2463
|
-
constructor(host: string, port: number, database: string, username?: string, password?: string, isSrv?: boolean, maxPoolSize?: number, minPoolSize?: number, connectTimeoutMS?: number, socketTimeoutMS?: number);
|
|
2464
|
-
getConnectionString(): string;
|
|
2465
|
-
getPoolOptions(): {
|
|
2466
|
-
maxPoolSize: number;
|
|
2467
|
-
minPoolSize: number;
|
|
2468
|
-
connectTimeoutMS: number;
|
|
2469
|
-
socketTimeoutMS: number;
|
|
2470
|
-
};
|
|
2471
|
-
}
|
|
2472
|
-
|
|
2473
2578
|
declare class PostgresConfig {
|
|
2474
2579
|
config: {
|
|
2475
2580
|
user: string;
|
|
@@ -4957,4 +5062,4 @@ declare class Calendar {
|
|
|
4957
5062
|
|
|
4958
5063
|
declare const BRAZIL_HOLIDAYS: HolidayDefinition[];
|
|
4959
5064
|
|
|
4960
|
-
export { AccountingDocument, ActionTypeEnum, Addition, Address, type AllowedCfopsCreditConfig, Alphanumeric, type AuditTaxCollectionDetails, type AuditTaxCollectionInfo, type AuthTokenExpiredParams, type AuthUnauthorizedParams, BRAZIL_HOLIDAYS, Block, BuilderAccountingDocument, BuilderAddition, BuilderAddress, BuilderConversionFactor, BuilderDocument, BuilderImportDeclaration, BuilderItem, BuilderPerson, BuilderTax, CNPJ, CNPJ_FLEXIBLE_REGEX, CNPJ_MASKED_REGEX, CNPJ_RAW_REGEX, CPF, CPF_FLEXIBLE_REGEX, CPF_MASKED_REGEX, CPF_RAW_REGEX, CST, CalculationBasisNatureSetting, Calendar, type Cloneable, CloseBlock, CloseFile, CodIncTrib, type Cod_ent_ref, CodeStatusEnum, ConfigTypeEnum, ConsoleOutput, Contact, ContactTypesEnum, ConversionFactor, CounterBlock, CounterRegister, Country, CountryCodeEnum, CprbOption, CreditBalanceOriginCreditTypeEnum, CreditBalanceRegimeTypeEnum, CteTypeEnum, DEFAULT_LOCALE, type DatabaseConnectionFailedParams, type DatabaseQueryErrorParams, DayOfWeek, Decimal, DefaultAlphanumericLength, DefaultDecimalLength, DefaultDecimalSeparator, DescriptionStatusEnum, DifalIcmsCategoryEnum, Document, type DocumentRepository, DocumentTypeEnum, DonationIndicatorEnum, DueDateAdjustmentEnum, EasterCalculator, EcdSpecializedProfile, EcfSpecializedProfile, EfdContribSpecializedProfile, EfdIcmsIpiSpecializedProfile, Email, EnforceabilityOfISSEnum, Establishment, EstablishmentEvent, Event, EventEnum, FederalCollectionSettings, FieldDataType, type FieldFormat, type FiltersDocument, FiscalQualificationType, FreightContractedNatureIndicatorEnum, FreightTypeCodeEnum, FreightTypeEnum, type GetAuditTaxCollectionQuery, GrossRevenueContributionHeaders, type HolidayDefinition, type HolidayLocation, type HolidayScope, type IAccountingDocumentMongo, type IAddition, type IAddressMongo, type IBaseHeadersDTO, type ICalculationBasisNatureSetting, type ICollectionSettings, type IConversionFactor, type IDocumentMongo, type IEcdSpecializedProfile, type IEcfSpecializedProfile, type IEfdContribSpecializedProfile, type IEfdicmsipiAdditionalFields, type IEstablishment, type IEstablishmentEvent, type IGrossRevenueContributionHeader, type IIcmsAdjustmentExtraInfo, type IIcmsAdjustmentSetting, type IIcmsCreditBaseConfig, type IIcmsCreditConfigLog, type IImportDeclaration, type IItemMongo, type IJudicialProcess, type INatureConfig, type INatureOfIncomeBusinessPartner, type IPersonMongo, type IProfile, type IProfileRepository, type IProfileServiceUrls, type IReinfAdditionalFields, type IRevenueNatureSettings, type IScp, type ISignatory, type IStartingCreditBalance, type IStateCollectionSettingsRepository, type ITable9, type ITaxMongo, type ITaxTypeConfig, type ITaxTypeConfigBase, type ITaxTypeConfigCreateOrUpdate, type ITaxTypeConfigLog, IcmsAdjustmentGroupEnum, IcmsAdjustmentRegistryEnum, IcmsAdjustmentSetting, IcmsAdjustmentTaxTypeEnum, IcmsAdjustmentTypeEnum, IcmsCalculationIndicatorEnum, type IdentificationNumber, ImportDeclaration, IntermediationTypeEnum, type InternalServerErrorParams, InternationalTransportTypeEnum, IssuerIndicatorEnum, Item, ItemTypeEnum, JudicialProcessOriginEnum, Key, type KeyComposition, type KeyFieldDefinition, LayoutDateFormat, type Locale, MaximumNumericLength, MemoryMasterDataRepository, MemoryPersist, MessageCategory, MessageCode, type MessageCodeType, Messages, ModelConverter, ModelRollback, MongoConfig, MongoRepository, MongoToDocumentBuilder, MunicipalObligation, MunicipalObligationIdEnum, MunicipalObligationNameEnum, MunicipalObligationTypeEnum, MunicipalRegistration, Municipality, NameCountryEnum, NatureCode, NatureConfig, Numeric, ObligationCodeEnum, OnDuplication, OnDuplicationStrategy, OpenBlock, OperationTypeEnum, OurDate, type OutputWriter, type ParameterTypes, PaymentTypeEnum, PeriodDateFieldEnum, Person, type PisCofinsOptions, PostgresConfig, PostgresRepository, ProductOriginEnum, Profile, ProfileDbRepository, ProfileRestRepository, ProfileTaxTypeEnum, Register, type RegisterDefinition, type RegisterEventData, type RegisterEventNotifier, type RegisterGenerator, type RegisterPersist, type RegisterSubscriber, ReinfSpecializedProfile, type ReportGenerationOptions, ReportGenerator, type Repository, type ResolvedHoliday, RevenueNatureSettings, RevenueTypeEnum, Scp, ServiceCode, ServiceCodeEnum, type SettingErrorParams, Signatory, SimpleNationalOption, type SimpleReportGenerationOptions, SimpleReportGenerator, StartingCreditBalance, StartingCreditBalanceTypeEnum, State, StateCollectionSettings, StateCollectionSettingsConfigTypeEnum, StateCollectionSettingsTaxTypeEnum, StateEnum, StateRegistration, StateRegistrationIndicatorEnum, StatusDocumentEnum, StringArrayOutput, TagCounter, Tax, type TaxCollectionDetails, TaxCollectionType, TaxCollectionTypeEnum, TaxRegimeEnum, type TaxRegimes, type TaxRegisterGenerationOptions, TaxRegisterGenerator, TaxReport, TaxTypeEnum, TaxationType, Telephone, Uf, type ValidationInvalidInputParams, type ValidationMissingFieldParams, ValueProviderType, WEEKDAYS, ZERO_PIS_COFINS_BY_CST, ZfmPresumedCreditTypeEnum, buildMongoFilter, buildMongoFilterToRetainedTax, calculate_bases_values, cleanData, formatMessage, isEmptyObject, keyCompositionMetadata, logWithContext, newRegisterEventData, normalizeServiceCode, onDuplicationStrategyMetadata, parseState, toSafeNumber, validationValue };
|
|
5065
|
+
export { AccountingDocument, ActionTypeEnum, Addition, Address, type AllowedCfopsCreditConfig, Alphanumeric, type AuditAction, type AuditActorType, type AuditChangeSet, type AuditChangeSetType, type AuditContext, type AuditEvent, AuditEventBuilder, AuditEventService, type AuditFieldChange, type AuditServiceConfig, type AuditSourceType, type AuditTaxCollectionDetails, type AuditTaxCollectionInfo, type AuthTokenExpiredParams, type AuthUnauthorizedParams, BRAZIL_HOLIDAYS, Block, BuilderAccountingDocument, BuilderAddition, BuilderAddress, BuilderConversionFactor, BuilderDocument, BuilderImportDeclaration, BuilderItem, BuilderPerson, BuilderTax, CNPJ, CNPJ_FLEXIBLE_REGEX, CNPJ_MASKED_REGEX, CNPJ_RAW_REGEX, CPF, CPF_FLEXIBLE_REGEX, CPF_MASKED_REGEX, CPF_RAW_REGEX, CST, CalculationBasisNatureSetting, Calendar, type Cloneable, CloseBlock, CloseFile, CodIncTrib, type Cod_ent_ref, CodeStatusEnum, type CompareOptions, type CompareResult, ConfigTypeEnum, ConsoleOutput, Contact, ContactTypesEnum, ConversionFactor, CounterBlock, CounterRegister, Country, CountryCodeEnum, CprbOption, CreditBalanceOriginCreditTypeEnum, CreditBalanceRegimeTypeEnum, CteTypeEnum, DEFAULT_LOCALE, type DatabaseConnectionFailedParams, type DatabaseQueryErrorParams, DayOfWeek, Decimal, DefaultAlphanumericLength, DefaultDecimalLength, DefaultDecimalSeparator, DescriptionStatusEnum, DifalIcmsCategoryEnum, Document, type DocumentRepository, DocumentTypeEnum, DonationIndicatorEnum, DueDateAdjustmentEnum, EasterCalculator, EcdSpecializedProfile, EcfSpecializedProfile, EfdContribSpecializedProfile, EfdIcmsIpiSpecializedProfile, Email, EnforceabilityOfISSEnum, Establishment, EstablishmentEvent, Event, EventEnum, FederalCollectionSettings, FieldDataType, type FieldFormat, type FiltersDocument, FiscalQualificationType, FreightContractedNatureIndicatorEnum, FreightTypeCodeEnum, FreightTypeEnum, type GetAuditTaxCollectionQuery, GrossRevenueContributionHeaders, type HolidayDefinition, type HolidayLocation, type HolidayScope, type IAccountingDocumentMongo, type IAddition, type IAddressMongo, type IAuditEventRepository, type IBaseHeadersDTO, type ICalculationBasisNatureSetting, type ICollectionSettings, type IConversionFactor, type IDocumentMongo, type IEcdSpecializedProfile, type IEcfSpecializedProfile, type IEfdContribSpecializedProfile, type IEfdicmsipiAdditionalFields, type IEstablishment, type IEstablishmentEvent, type IGrossRevenueContributionHeader, type IIcmsAdjustmentExtraInfo, type IIcmsAdjustmentSetting, type IIcmsCreditBaseConfig, type IIcmsCreditConfigLog, type IImportDeclaration, type IItemMongo, type IJudicialProcess, type INatureConfig, type INatureOfIncomeBusinessPartner, type IPersonMongo, type IProfile, type IProfileRepository, type IProfileServiceUrls, type IReinfAdditionalFields, type IRevenueNatureSettings, type IScp, type ISignatory, type IStartingCreditBalance, type IStateCollectionSettingsRepository, type ITable9, type ITaxMongo, type ITaxTypeConfig, type ITaxTypeConfigBase, type ITaxTypeConfigCreateOrUpdate, type ITaxTypeConfigLog, IcmsAdjustmentGroupEnum, IcmsAdjustmentRegistryEnum, IcmsAdjustmentSetting, IcmsAdjustmentTaxTypeEnum, IcmsAdjustmentTypeEnum, IcmsCalculationIndicatorEnum, type IdentificationNumber, ImportDeclaration, IntermediationTypeEnum, type InternalServerErrorParams, InternationalTransportTypeEnum, IssuerIndicatorEnum, Item, ItemTypeEnum, JudicialProcessOriginEnum, Key, type KeyComposition, type KeyFieldDefinition, LayoutDateFormat, type Locale, MaximumNumericLength, MemoryMasterDataRepository, MemoryPersist, MessageCategory, MessageCode, type MessageCodeType, Messages, ModelConverter, ModelRollback, MongoAuditEventRepository, MongoConfig, MongoRepository, MongoToDocumentBuilder, MunicipalObligation, MunicipalObligationIdEnum, MunicipalObligationNameEnum, MunicipalObligationTypeEnum, MunicipalRegistration, Municipality, NameCountryEnum, NatureCode, NatureConfig, Numeric, ObjectComparator, ObligationCodeEnum, OnDuplication, OnDuplicationStrategy, OpenBlock, OperationTypeEnum, OurDate, type OutputWriter, type ParameterTypes, PaymentTypeEnum, PeriodDateFieldEnum, Person, type PisCofinsOptions, PostgresConfig, PostgresRepository, ProductOriginEnum, Profile, ProfileDbRepository, ProfileRestRepository, ProfileTaxTypeEnum, Register, type RegisterDefinition, type RegisterEventData, type RegisterEventNotifier, type RegisterGenerator, type RegisterPersist, type RegisterSubscriber, ReinfSpecializedProfile, type ReportGenerationOptions, ReportGenerator, type Repository, type ResolvedHoliday, RevenueNatureSettings, RevenueTypeEnum, Scp, ServiceCode, ServiceCodeEnum, type SettingErrorParams, Signatory, SimpleNationalOption, type SimpleReportGenerationOptions, SimpleReportGenerator, StartingCreditBalance, StartingCreditBalanceTypeEnum, State, StateCollectionSettings, StateCollectionSettingsConfigTypeEnum, StateCollectionSettingsTaxTypeEnum, StateEnum, StateRegistration, StateRegistrationIndicatorEnum, StatusDocumentEnum, StringArrayOutput, TagCounter, Tax, type TaxCollectionDetails, TaxCollectionType, TaxCollectionTypeEnum, TaxRegimeEnum, type TaxRegimes, type TaxRegisterGenerationOptions, TaxRegisterGenerator, TaxReport, TaxTypeEnum, TaxationType, Telephone, Uf, type ValidationInvalidInputParams, type ValidationMissingFieldParams, ValueProviderType, WEEKDAYS, ZERO_PIS_COFINS_BY_CST, ZfmPresumedCreditTypeEnum, buildMongoFilter, buildMongoFilterToRetainedTax, calculate_bases_values, cleanData, formatMessage, isEmptyObject, keyCompositionMetadata, logWithContext, newRegisterEventData, normalizeServiceCode, onDuplicationStrategyMetadata, parseState, toSafeNumber, validationValue };
|