facturas 0.20.2 → 0.20.3
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/{chunk-ZNMTFZ2Q.mjs → chunk-5CUMVSJY.mjs} +33 -20
- package/dist/chunk-5CUMVSJY.mjs.map +1 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.mjs +7 -5
- package/dist/cli.mjs.map +1 -1
- package/dist/{client-BIkLOgBA.d.ts → client-BgWH_jKT.d.ts} +10 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-ZNMTFZ2Q.mjs.map +0 -1
|
@@ -3906,6 +3906,7 @@ async function runOperation(wsfe, operation, input, prepare, options, context, r
|
|
|
3906
3906
|
environment,
|
|
3907
3907
|
taxId,
|
|
3908
3908
|
sequence: sequenceRecord,
|
|
3909
|
+
sequenceTaxId: sequence.taxId,
|
|
3909
3910
|
coordinates: sequence.coordinates,
|
|
3910
3911
|
select: select ?? (() => wsfe),
|
|
3911
3912
|
options,
|
|
@@ -3945,6 +3946,7 @@ async function runOperation(wsfe, operation, input, prepare, options, context, r
|
|
|
3945
3946
|
const claimed = {
|
|
3946
3947
|
v: 1,
|
|
3947
3948
|
key: idempotencyKey,
|
|
3949
|
+
issuerTaxId: taxId,
|
|
3948
3950
|
number,
|
|
3949
3951
|
claimedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3950
3952
|
};
|
|
@@ -3993,7 +3995,7 @@ async function runOperation(wsfe, operation, input, prepare, options, context, r
|
|
|
3993
3995
|
readSettledRecord(recorded),
|
|
3994
3996
|
options,
|
|
3995
3997
|
taxId,
|
|
3996
|
-
(other) => storeCall(() => store.get(settledKey(environment,
|
|
3998
|
+
(owner, other) => storeCall(() => store.get(settledKey(environment, owner, other)))
|
|
3997
3999
|
);
|
|
3998
4000
|
}
|
|
3999
4001
|
return await settle2(
|
|
@@ -4046,7 +4048,7 @@ async function recordConflict(store, key, outcome) {
|
|
|
4046
4048
|
function readSettledRecord(json) {
|
|
4047
4049
|
try {
|
|
4048
4050
|
const record = JSON.parse(json);
|
|
4049
|
-
if (record?.v !== 1 && record?.v !== 2 || !Number.isSafeInteger(record.number) || (record.kind === "conflict" ? !record.found || typeof record.found !== "object" : record.kind !== "superseded" || typeof record.by !== "string")) {
|
|
4051
|
+
if (record?.v !== 1 && record?.v !== 2 || !Number.isSafeInteger(record.number) || (record.kind === "conflict" ? !record.found || typeof record.found !== "object" : record.kind !== "superseded" || typeof record.by !== "string" || record.byTaxId !== void 0 && typeof record.byTaxId !== "string")) {
|
|
4050
4052
|
throw new Error("Invalid settled structure");
|
|
4051
4053
|
}
|
|
4052
4054
|
if (record.kind === "conflict" && record.v === 1) {
|
|
@@ -4072,7 +4074,7 @@ async function settledOutcome(select, reservation, settled, options, taxId, sett
|
|
|
4072
4074
|
true
|
|
4073
4075
|
);
|
|
4074
4076
|
const empty = outcome.kind === "indeterminate" && outcome.lookup.kind === "not_found";
|
|
4075
|
-
if (!empty && (outcome.kind !== "conflict" || await successionDisputed(settled
|
|
4077
|
+
if (!empty && (outcome.kind !== "conflict" || await successionDisputed(settled, taxId, settledFor))) {
|
|
4076
4078
|
return outcome;
|
|
4077
4079
|
}
|
|
4078
4080
|
return {
|
|
@@ -4083,7 +4085,11 @@ async function settledOutcome(select, reservation, settled, options, taxId, sett
|
|
|
4083
4085
|
number: settled.number
|
|
4084
4086
|
},
|
|
4085
4087
|
attempt: replayEvidence(reservation.service),
|
|
4086
|
-
lookup: {
|
|
4088
|
+
lookup: {
|
|
4089
|
+
kind: "superseded",
|
|
4090
|
+
by: settled.by,
|
|
4091
|
+
byTaxId: settled.byTaxId ?? taxId
|
|
4092
|
+
},
|
|
4087
4093
|
...requestEvidence(
|
|
4088
4094
|
preparedFromRecord(reservation).data,
|
|
4089
4095
|
reservation.number,
|
|
@@ -4091,10 +4097,11 @@ async function settledOutcome(select, reservation, settled, options, taxId, sett
|
|
|
4091
4097
|
)
|
|
4092
4098
|
};
|
|
4093
4099
|
}
|
|
4094
|
-
async function successionDisputed(
|
|
4095
|
-
let
|
|
4100
|
+
async function successionDisputed(superseded, taxId, settledFor) {
|
|
4101
|
+
let owner = superseded.byTaxId ?? taxId;
|
|
4102
|
+
let next = superseded.by;
|
|
4096
4103
|
for (let hop = 0; hop < 16; hop += 1) {
|
|
4097
|
-
const json = await settledFor(next);
|
|
4104
|
+
const json = await settledFor(owner, next);
|
|
4098
4105
|
if (json === null) {
|
|
4099
4106
|
return false;
|
|
4100
4107
|
}
|
|
@@ -4102,6 +4109,7 @@ async function successionDisputed(key, settledFor) {
|
|
|
4102
4109
|
if (record.kind === "conflict") {
|
|
4103
4110
|
return true;
|
|
4104
4111
|
}
|
|
4112
|
+
owner = record.byTaxId ?? owner;
|
|
4105
4113
|
next = record.by;
|
|
4106
4114
|
}
|
|
4107
4115
|
return true;
|
|
@@ -4844,13 +4852,9 @@ async function recoverOperation(select, key, inputOptions, context) {
|
|
|
4844
4852
|
readSettledRecord(recorded),
|
|
4845
4853
|
options,
|
|
4846
4854
|
context.taxId,
|
|
4847
|
-
(other) => storeCall(
|
|
4855
|
+
(owner, other) => storeCall(
|
|
4848
4856
|
() => store.get(
|
|
4849
|
-
settledKey(
|
|
4850
|
-
context.environment,
|
|
4851
|
-
context.taxId,
|
|
4852
|
-
other
|
|
4853
|
-
)
|
|
4857
|
+
settledKey(context.environment, owner, other)
|
|
4854
4858
|
)
|
|
4855
4859
|
)
|
|
4856
4860
|
);
|
|
@@ -4990,6 +4994,7 @@ async function runSequenceBarrier({
|
|
|
4990
4994
|
environment,
|
|
4991
4995
|
taxId,
|
|
4992
4996
|
sequence,
|
|
4997
|
+
sequenceTaxId,
|
|
4993
4998
|
coordinates,
|
|
4994
4999
|
select,
|
|
4995
5000
|
options,
|
|
@@ -5004,12 +5009,13 @@ async function runSequenceBarrier({
|
|
|
5004
5009
|
if (claimed.resolvedAt !== void 0) {
|
|
5005
5010
|
return {};
|
|
5006
5011
|
}
|
|
5007
|
-
const
|
|
5012
|
+
const owner = claimed.issuerTaxId ?? taxId;
|
|
5013
|
+
const settled = settledKey(environment, owner, claimed.key);
|
|
5008
5014
|
if (await storeCall(() => store.get(settled)) !== null) {
|
|
5009
5015
|
return {};
|
|
5010
5016
|
}
|
|
5011
5017
|
const reservation = await storeCall(
|
|
5012
|
-
() => store.get(attemptKey(environment,
|
|
5018
|
+
() => store.get(attemptKey(environment, owner, claimed.key))
|
|
5013
5019
|
);
|
|
5014
5020
|
if (reservation === null) {
|
|
5015
5021
|
return {};
|
|
@@ -5020,7 +5026,7 @@ async function runSequenceBarrier({
|
|
|
5020
5026
|
kind: "indeterminate",
|
|
5021
5027
|
attempted: { ...coordinates, number: record.number },
|
|
5022
5028
|
attempt: replayEvidence(options.service),
|
|
5023
|
-
lookup: { kind: "blocked", by: claimed.key }
|
|
5029
|
+
lookup: { kind: "blocked", by: claimed.key, byTaxId: owner }
|
|
5024
5030
|
}
|
|
5025
5031
|
};
|
|
5026
5032
|
const outcome = await recordConflict(
|
|
@@ -5028,12 +5034,18 @@ async function runSequenceBarrier({
|
|
|
5028
5034
|
settled,
|
|
5029
5035
|
await consultReservation(
|
|
5030
5036
|
select,
|
|
5031
|
-
|
|
5037
|
+
// This call's certificate may not be the one that claimed. Without a
|
|
5038
|
+
// represented CUIT, it would read its own numbering instead of the one
|
|
5039
|
+
// the claim advanced.
|
|
5040
|
+
{
|
|
5041
|
+
...record,
|
|
5042
|
+
representedTaxId: record.representedTaxId ?? sequenceTaxId
|
|
5043
|
+
},
|
|
5032
5044
|
{
|
|
5033
5045
|
forceRefresh: options.forceRefresh,
|
|
5034
5046
|
...options.abortSignal === void 0 ? {} : { abortSignal: options.abortSignal }
|
|
5035
5047
|
},
|
|
5036
|
-
|
|
5048
|
+
owner
|
|
5037
5049
|
)
|
|
5038
5050
|
);
|
|
5039
5051
|
if (outcome.kind === "authorized" || outcome.kind === "conflict") {
|
|
@@ -5054,6 +5066,7 @@ async function runSequenceBarrier({
|
|
|
5054
5066
|
kind: "superseded",
|
|
5055
5067
|
number: record.number,
|
|
5056
5068
|
by: supersededBy,
|
|
5069
|
+
byTaxId: taxId,
|
|
5057
5070
|
settledAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
5058
5071
|
})
|
|
5059
5072
|
)
|
|
@@ -5063,7 +5076,7 @@ async function runSequenceBarrier({
|
|
|
5063
5076
|
function readSequenceRecord(json) {
|
|
5064
5077
|
try {
|
|
5065
5078
|
const record = JSON.parse(json);
|
|
5066
|
-
if (record?.v !== 1 || typeof record.key !== "string" || !Number.isSafeInteger(record.number)) {
|
|
5079
|
+
if (record?.v !== 1 || typeof record.key !== "string" || record.issuerTaxId !== void 0 && typeof record.issuerTaxId !== "string" || !Number.isSafeInteger(record.number)) {
|
|
5067
5080
|
throw new Error("Invalid sequence structure");
|
|
5068
5081
|
}
|
|
5069
5082
|
return record;
|
|
@@ -5595,4 +5608,4 @@ export {
|
|
|
5595
5608
|
withLease,
|
|
5596
5609
|
createFileStore
|
|
5597
5610
|
};
|
|
5598
|
-
//# sourceMappingURL=chunk-
|
|
5611
|
+
//# sourceMappingURL=chunk-5CUMVSJY.mjs.map
|