@seidor-cloud-produtos/tax-core 0.0.76 → 0.0.78
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 +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +95 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +94 -8
- package/dist/index.mjs.map +1 -1
- package/dist/taxReport/CounterRegister.js +3 -2
- package/dist/taxReport/CounterRegister.js.map +1 -1
- package/dist/taxReport/CounterRegister.mjs +3 -2
- package/dist/taxReport/CounterRegister.mjs.map +1 -1
- package/dist/taxReport/Decorators.d.mts +2 -1
- package/dist/taxReport/Decorators.d.ts +2 -1
- package/dist/taxReport/Decorators.js +6 -4
- package/dist/taxReport/Decorators.js.map +1 -1
- package/dist/taxReport/Decorators.mjs +6 -4
- package/dist/taxReport/Decorators.mjs.map +1 -1
- package/dist/taxReport/Register.js.map +1 -1
- package/dist/taxReport/Register.mjs.map +1 -1
- package/dist/taxReport/ReportGenerator.js +17 -6
- package/dist/taxReport/ReportGenerator.js.map +1 -1
- package/dist/taxReport/ReportGenerator.mjs +17 -6
- package/dist/taxReport/ReportGenerator.mjs.map +1 -1
- package/dist/taxReport/SimpleReportGenerator.d.mts +31 -0
- package/dist/taxReport/SimpleReportGenerator.d.ts +31 -0
- package/dist/taxReport/SimpleReportGenerator.js +216 -0
- package/dist/taxReport/SimpleReportGenerator.js.map +1 -0
- package/dist/taxReport/SimpleReportGenerator.mjs +192 -0
- package/dist/taxReport/SimpleReportGenerator.mjs.map +1 -0
- package/dist/taxReport/implementations/TaxRegisterGenerator.d.mts +1 -0
- package/dist/taxReport/implementations/TaxRegisterGenerator.d.ts +1 -0
- package/dist/taxReport/implementations/TaxRegisterGenerator.js +13 -3
- package/dist/taxReport/implementations/TaxRegisterGenerator.js.map +1 -1
- package/dist/taxReport/implementations/TaxRegisterGenerator.mjs +13 -3
- package/dist/taxReport/implementations/TaxRegisterGenerator.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -59,6 +59,7 @@ export { InternationalTransportTypeEnum } from './documents/enums/international-
|
|
|
59
59
|
export { IntermediationTypeEnum } from './documents/enums/intermediation-type.enum.mjs';
|
|
60
60
|
export { default as ImportDeclaration } from './documents/ImportDeclaration.class.mjs';
|
|
61
61
|
export { default as Addition } from './documents/AdditionImportDeclaration.class.mjs';
|
|
62
|
+
export { SimpleReportGenerator } from './taxReport/SimpleReportGenerator.mjs';
|
|
62
63
|
import './taxReport/TagCounter.mjs';
|
|
63
64
|
import './documents/interfaces/cloneable.interface.mjs';
|
|
64
65
|
import 'mongodb';
|
package/dist/index.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export { InternationalTransportTypeEnum } from './documents/enums/international-
|
|
|
59
59
|
export { IntermediationTypeEnum } from './documents/enums/intermediation-type.enum.js';
|
|
60
60
|
export { default as ImportDeclaration } from './documents/ImportDeclaration.class.js';
|
|
61
61
|
export { default as Addition } from './documents/AdditionImportDeclaration.class.js';
|
|
62
|
+
export { SimpleReportGenerator } from './taxReport/SimpleReportGenerator.js';
|
|
62
63
|
import './taxReport/TagCounter.js';
|
|
63
64
|
import './documents/interfaces/cloneable.interface.js';
|
|
64
65
|
import 'mongodb';
|
package/dist/index.js
CHANGED
|
@@ -92,6 +92,7 @@ __export(index_exports, {
|
|
|
92
92
|
Register: () => Register,
|
|
93
93
|
RevenueTypeEnum: () => RevenueTypeEnum,
|
|
94
94
|
ServiceCodeEnum: () => ServiceCodeEnum,
|
|
95
|
+
SimpleReportGenerator: () => SimpleReportGenerator,
|
|
95
96
|
StateRegistrationIndicatorEnum: () => StateRegistrationIndicatorEnum,
|
|
96
97
|
StatusDocumentEnum: () => StatusDocumentEnum,
|
|
97
98
|
StringArrayOutput: () => StringArrayOutput,
|
|
@@ -174,14 +175,15 @@ var ValueProviderType = /* @__PURE__ */ ((ValueProviderType2) => {
|
|
|
174
175
|
ValueProviderType2[ValueProviderType2["method"] = 1] = "method";
|
|
175
176
|
return ValueProviderType2;
|
|
176
177
|
})(ValueProviderType || {});
|
|
177
|
-
function numericField(required, maximumLength, valueProvider, fillEntireLength = false, maximumDecimalsLength = 0) {
|
|
178
|
+
function numericField(required, maximumLength, valueProvider, fillEntireLength = false, maximumDecimalsLength = 0, decimalSeparator = "") {
|
|
178
179
|
return {
|
|
179
180
|
required,
|
|
180
181
|
dataType: 1 /* numeric */,
|
|
181
182
|
maximumLength,
|
|
182
183
|
maximumDecimalsLength,
|
|
183
184
|
fillEntireLength,
|
|
184
|
-
valueProvider
|
|
185
|
+
valueProvider,
|
|
186
|
+
decimalSeparator
|
|
185
187
|
};
|
|
186
188
|
}
|
|
187
189
|
function alphanumericField(required, maximumLength, valueProvider, fillEntireLength = false, maximumDecimalsLength = 0) {
|
|
@@ -208,7 +210,7 @@ function Numeric(required = false, fillEntireLength = false, maximumLength = Max
|
|
|
208
210
|
);
|
|
209
211
|
};
|
|
210
212
|
}
|
|
211
|
-
function Decimal(required = false, fillEntireLength = false, maximumLength = MaximumNumericLength, maximumDecimalsLength = 2) {
|
|
213
|
+
function Decimal(required = false, fillEntireLength = false, maximumLength = MaximumNumericLength, maximumDecimalsLength = 2, decimalSeparator = ",") {
|
|
212
214
|
return function(target, propertyKey, other) {
|
|
213
215
|
Reflect.defineMetadata(
|
|
214
216
|
propertyKey,
|
|
@@ -217,7 +219,8 @@ function Decimal(required = false, fillEntireLength = false, maximumLength = Max
|
|
|
217
219
|
maximumLength,
|
|
218
220
|
other ? 1 /* method */ : 0 /* property */,
|
|
219
221
|
fillEntireLength,
|
|
220
|
-
maximumDecimalsLength
|
|
222
|
+
maximumDecimalsLength,
|
|
223
|
+
decimalSeparator
|
|
221
224
|
),
|
|
222
225
|
target
|
|
223
226
|
);
|
|
@@ -482,7 +485,8 @@ var TaxRegisterGenerator = class _TaxRegisterGenerator {
|
|
|
482
485
|
writer,
|
|
483
486
|
fieldSeparator: "|",
|
|
484
487
|
separatorAtTheRegisterStart: false,
|
|
485
|
-
separatorAtTheRegisterEnd: false
|
|
488
|
+
separatorAtTheRegisterEnd: false,
|
|
489
|
+
writeRegisterTag: true
|
|
486
490
|
};
|
|
487
491
|
}
|
|
488
492
|
static newWithDefaultOptions() {
|
|
@@ -495,10 +499,15 @@ var TaxRegisterGenerator = class _TaxRegisterGenerator {
|
|
|
495
499
|
return this._options.writer;
|
|
496
500
|
}
|
|
497
501
|
generate(register) {
|
|
498
|
-
let registerStr = `${this._options.separatorAtTheRegisterStart ? this._options.fieldSeparator : ""}${register.reg}${this._options.fieldSeparator}`;
|
|
499
502
|
const metadataKeys = Reflect.getMetadataKeys(register).filter((v) => {
|
|
500
503
|
return typeof v !== "symbol";
|
|
501
504
|
});
|
|
505
|
+
let registerStr = `${this._options.separatorAtTheRegisterStart ? this._options.fieldSeparator : ""}`;
|
|
506
|
+
if (this._options.writeRegisterTag) {
|
|
507
|
+
registerStr = registerStr.concat(
|
|
508
|
+
`${register.reg}${this._options.fieldSeparator}`
|
|
509
|
+
);
|
|
510
|
+
}
|
|
502
511
|
for (let i = 0; i < metadataKeys.length; i++) {
|
|
503
512
|
const metadataKey = metadataKeys[i];
|
|
504
513
|
const metadata = Reflect.getMetadata(metadataKey, register);
|
|
@@ -545,7 +554,11 @@ var TaxRegisterGenerator = class _TaxRegisterGenerator {
|
|
|
545
554
|
} else {
|
|
546
555
|
decimalPart = "".padEnd(metadata.maximumDecimalsLength, "0");
|
|
547
556
|
}
|
|
548
|
-
result = result.concat(
|
|
557
|
+
result = result.concat(metadata.decimalSeparator, decimalPart);
|
|
558
|
+
}
|
|
559
|
+
const padStartSize = metadata.decimalSeparator.length > 0 ? metadata.maximumLength + 1 : metadata.maximumLength;
|
|
560
|
+
if (metadata.fillEntireLength) {
|
|
561
|
+
result = result.padStart(padStartSize, "0");
|
|
549
562
|
}
|
|
550
563
|
return result;
|
|
551
564
|
}
|
|
@@ -571,7 +584,7 @@ var OpenBlock = class extends Register {
|
|
|
571
584
|
}
|
|
572
585
|
};
|
|
573
586
|
__decorateClass([
|
|
574
|
-
Alphanumeric(1)
|
|
587
|
+
Alphanumeric(true, false, 1)
|
|
575
588
|
], OpenBlock.prototype, "ind_mov", 2);
|
|
576
589
|
var CloseBlock = class extends Register {
|
|
577
590
|
constructor(tag) {
|
|
@@ -55042,6 +55055,79 @@ var MongoRepository = class {
|
|
|
55042
55055
|
return new MongoToDocumentBuilder().build(data);
|
|
55043
55056
|
}
|
|
55044
55057
|
};
|
|
55058
|
+
|
|
55059
|
+
// lib/taxReport/SimpleReportGenerator.ts
|
|
55060
|
+
var SimpleReportGenerator = class _SimpleReportGenerator {
|
|
55061
|
+
constructor(options) {
|
|
55062
|
+
__publicField(this, "_options");
|
|
55063
|
+
this._options = options;
|
|
55064
|
+
}
|
|
55065
|
+
static defaultOptions(openFileRegister, registerGenerator) {
|
|
55066
|
+
return {
|
|
55067
|
+
openFileRegister,
|
|
55068
|
+
registerGenerator
|
|
55069
|
+
};
|
|
55070
|
+
}
|
|
55071
|
+
static newWithDefaultOptions(openFileRegister) {
|
|
55072
|
+
return this.newWithOptions(
|
|
55073
|
+
this.defaultOptions(
|
|
55074
|
+
openFileRegister,
|
|
55075
|
+
TaxRegisterGenerator.newWithDefaultOptions()
|
|
55076
|
+
)
|
|
55077
|
+
);
|
|
55078
|
+
}
|
|
55079
|
+
static newWithOptions(options) {
|
|
55080
|
+
return new _SimpleReportGenerator(options);
|
|
55081
|
+
}
|
|
55082
|
+
beforeGeneration(taxReport) {
|
|
55083
|
+
if (this._options.openFileRegister) {
|
|
55084
|
+
this.addRegister(this._options.openFileRegister);
|
|
55085
|
+
}
|
|
55086
|
+
}
|
|
55087
|
+
generation(taxReport) {
|
|
55088
|
+
const blocks = taxReport.Blocks;
|
|
55089
|
+
for (const block of blocks) {
|
|
55090
|
+
this.addBlock(block);
|
|
55091
|
+
}
|
|
55092
|
+
}
|
|
55093
|
+
afterGeneration(taxReport) {
|
|
55094
|
+
}
|
|
55095
|
+
beforeBlockGeneration(block) {
|
|
55096
|
+
}
|
|
55097
|
+
blockGeneration(block) {
|
|
55098
|
+
for (const register of block.registers) {
|
|
55099
|
+
this.addRegister(register);
|
|
55100
|
+
}
|
|
55101
|
+
}
|
|
55102
|
+
beforeRegisterGeneration(register) {
|
|
55103
|
+
}
|
|
55104
|
+
registerGeneration(register) {
|
|
55105
|
+
this._options.registerGenerator.generate(register);
|
|
55106
|
+
for (const child of register.getChildren()) {
|
|
55107
|
+
this.addRegister(child);
|
|
55108
|
+
}
|
|
55109
|
+
}
|
|
55110
|
+
afterRegisterGeneration(register) {
|
|
55111
|
+
}
|
|
55112
|
+
afterBlockGeneration(block) {
|
|
55113
|
+
}
|
|
55114
|
+
addBlock(block) {
|
|
55115
|
+
this.beforeBlockGeneration(block);
|
|
55116
|
+
this.blockGeneration(block);
|
|
55117
|
+
this.afterBlockGeneration(block);
|
|
55118
|
+
}
|
|
55119
|
+
addRegister(register) {
|
|
55120
|
+
this.beforeRegisterGeneration(register);
|
|
55121
|
+
this.registerGeneration(register);
|
|
55122
|
+
this.afterRegisterGeneration(register);
|
|
55123
|
+
}
|
|
55124
|
+
generateFile(taxReport) {
|
|
55125
|
+
this.beforeGeneration(taxReport);
|
|
55126
|
+
this.generation(taxReport);
|
|
55127
|
+
this.afterGeneration(taxReport);
|
|
55128
|
+
this._options.registerGenerator.save();
|
|
55129
|
+
}
|
|
55130
|
+
};
|
|
55045
55131
|
// Annotate the CommonJS export names for ESM import in node:
|
|
55046
55132
|
0 && (module.exports = {
|
|
55047
55133
|
Addition,
|
|
@@ -55097,6 +55183,7 @@ var MongoRepository = class {
|
|
|
55097
55183
|
Register,
|
|
55098
55184
|
RevenueTypeEnum,
|
|
55099
55185
|
ServiceCodeEnum,
|
|
55186
|
+
SimpleReportGenerator,
|
|
55100
55187
|
StateRegistrationIndicatorEnum,
|
|
55101
55188
|
StatusDocumentEnum,
|
|
55102
55189
|
StringArrayOutput,
|