@fuel-ts/account 0.0.0-rc-1976-20240416162235 → 0.0.0-rc-1976-20240417074721
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.
Potentially problematic release.
This version of @fuel-ts/account might be problematic. Click here for more details.
- package/dist/index.global.js +28 -19
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +28 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -19
- package/dist/index.mjs.map +1 -1
- package/dist/providers/fuel-graphql-subscriber.d.ts +2 -0
- package/dist/providers/fuel-graphql-subscriber.d.ts.map +1 -1
- package/dist/test-utils.global.js +28 -19
- package/dist/test-utils.global.js.map +1 -1
- package/dist/test-utils.js +28 -19
- package/dist/test-utils.js.map +1 -1
- package/dist/test-utils.mjs +28 -19
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +15 -15
package/dist/index.global.js
CHANGED
@@ -38757,36 +38757,45 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
38757
38757
|
});
|
38758
38758
|
this.stream = response.body.getReader();
|
38759
38759
|
}
|
38760
|
+
events = [];
|
38761
|
+
parsingLeftover = "";
|
38760
38762
|
async next() {
|
38761
38763
|
if (!this.stream) {
|
38762
38764
|
await this.setStream();
|
38763
38765
|
}
|
38764
38766
|
while (true) {
|
38767
|
+
if (this.events.length > 0) {
|
38768
|
+
const { data, errors } = this.events.shift();
|
38769
|
+
if (Array.isArray(errors)) {
|
38770
|
+
throw new FuelError(
|
38771
|
+
FuelError.CODES.INVALID_REQUEST,
|
38772
|
+
errors.map((err) => err.message).join("\n\n")
|
38773
|
+
);
|
38774
|
+
}
|
38775
|
+
return { value: data, done: false };
|
38776
|
+
}
|
38765
38777
|
const { value, done } = await this.stream.read();
|
38766
38778
|
if (done) {
|
38767
38779
|
return { value, done };
|
38768
38780
|
}
|
38769
|
-
const
|
38770
|
-
if (
|
38781
|
+
const decoded = _FuelGraphqlSubscriber.textDecoder.decode(value).replace(":keep-alive-text\n\n", "");
|
38782
|
+
if (decoded === "") {
|
38771
38783
|
continue;
|
38772
38784
|
}
|
38773
|
-
|
38774
|
-
|
38775
|
-
|
38776
|
-
|
38777
|
-
|
38778
|
-
|
38779
|
-
|
38780
|
-
|
38781
|
-
|
38782
|
-
|
38783
|
-
|
38784
|
-
|
38785
|
-
|
38786
|
-
|
38787
|
-
);
|
38788
|
-
}
|
38789
|
-
return { value: data, done: false };
|
38785
|
+
const text = `${this.parsingLeftover}${decoded}`;
|
38786
|
+
const regex = /data:.*\n\n/g;
|
38787
|
+
const matches = [...text.matchAll(regex)].flatMap((match) => match);
|
38788
|
+
matches.forEach((match) => {
|
38789
|
+
try {
|
38790
|
+
this.events.push(JSON.parse(match.replace(/^data:/, "")));
|
38791
|
+
} catch (e) {
|
38792
|
+
throw new FuelError(
|
38793
|
+
ErrorCode.STREAM_PARSING_ERROR,
|
38794
|
+
`Error while parsing stream data response: ${text}`
|
38795
|
+
);
|
38796
|
+
}
|
38797
|
+
});
|
38798
|
+
this.parsingLeftover = text.replace(matches.join(), "");
|
38790
38799
|
}
|
38791
38800
|
}
|
38792
38801
|
/**
|