@fuel-ts/account 0.80.0 → 0.81.0
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 +29 -20
- 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 +29 -20
- 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 +21 -26
@@ -12,6 +12,8 @@ export declare class FuelGraphqlSubscriber implements AsyncIterator<unknown> {
|
|
12
12
|
private static textDecoder;
|
13
13
|
constructor(options: FuelGraphQLSubscriberOptions);
|
14
14
|
private setStream;
|
15
|
+
private events;
|
16
|
+
private parsingLeftover;
|
15
17
|
next(): Promise<IteratorResult<unknown, unknown>>;
|
16
18
|
/**
|
17
19
|
* Gets called when `break` is called in a `for-await-of` loop.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fuel-graphql-subscriber.d.ts","sourceRoot":"","sources":["../../src/providers/fuel-graphql-subscriber.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5C,KAAK,4BAA4B,GAAG;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,OAAO,EAAE,OAAO,KAAK,CAAC;CACvB,CAAC;AAEF,qBAAa,qBAAsB,YAAW,aAAa,CAAC,OAAO,CAAC;IAI/C,OAAO,CAAC,OAAO;IAHlC,OAAO,CAAC,MAAM,CAA2C;IACzD,OAAO,CAAC,MAAM,CAAC,WAAW,CAAqB;gBAEpB,OAAO,EAAE,4BAA4B;YAElD,SAAS;
|
1
|
+
{"version":3,"file":"fuel-graphql-subscriber.d.ts","sourceRoot":"","sources":["../../src/providers/fuel-graphql-subscriber.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5C,KAAK,4BAA4B,GAAG;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,OAAO,EAAE,OAAO,KAAK,CAAC;CACvB,CAAC;AAEF,qBAAa,qBAAsB,YAAW,aAAa,CAAC,OAAO,CAAC;IAI/C,OAAO,CAAC,OAAO;IAHlC,OAAO,CAAC,MAAM,CAA2C;IACzD,OAAO,CAAC,MAAM,CAAC,WAAW,CAAqB;gBAEpB,OAAO,EAAE,4BAA4B;YAElD,SAAS;IAmBvB,OAAO,CAAC,MAAM,CAAgE;IAC9E,OAAO,CAAC,eAAe,CAAM;IAEvB,IAAI,IAAI,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IA4DvD;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAM3D,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC;CAGrE"}
|
@@ -31916,7 +31916,7 @@ spurious results.`);
|
|
31916
31916
|
return {
|
31917
31917
|
FORC: "0.49.3",
|
31918
31918
|
FUEL_CORE: "0.22.1",
|
31919
|
-
FUELS: "0.
|
31919
|
+
FUELS: "0.81.0"
|
31920
31920
|
};
|
31921
31921
|
}
|
31922
31922
|
function parseVersion(version2) {
|
@@ -42226,36 +42226,45 @@ ${MessageCoinFragmentFragmentDoc}`;
|
|
42226
42226
|
});
|
42227
42227
|
this.stream = response.body.getReader();
|
42228
42228
|
}
|
42229
|
+
events = [];
|
42230
|
+
parsingLeftover = "";
|
42229
42231
|
async next() {
|
42230
42232
|
if (!this.stream) {
|
42231
42233
|
await this.setStream();
|
42232
42234
|
}
|
42233
42235
|
while (true) {
|
42236
|
+
if (this.events.length > 0) {
|
42237
|
+
const { data, errors } = this.events.shift();
|
42238
|
+
if (Array.isArray(errors)) {
|
42239
|
+
throw new FuelError(
|
42240
|
+
FuelError.CODES.INVALID_REQUEST,
|
42241
|
+
errors.map((err) => err.message).join("\n\n")
|
42242
|
+
);
|
42243
|
+
}
|
42244
|
+
return { value: data, done: false };
|
42245
|
+
}
|
42234
42246
|
const { value, done } = await this.stream.read();
|
42235
42247
|
if (done) {
|
42236
42248
|
return { value, done };
|
42237
42249
|
}
|
42238
|
-
const
|
42239
|
-
if (
|
42250
|
+
const decoded = _FuelGraphqlSubscriber.textDecoder.decode(value).replace(":keep-alive-text\n\n", "");
|
42251
|
+
if (decoded === "") {
|
42240
42252
|
continue;
|
42241
42253
|
}
|
42242
|
-
|
42243
|
-
|
42244
|
-
|
42245
|
-
|
42246
|
-
|
42247
|
-
|
42248
|
-
|
42249
|
-
|
42250
|
-
|
42251
|
-
|
42252
|
-
|
42253
|
-
|
42254
|
-
|
42255
|
-
|
42256
|
-
);
|
42257
|
-
}
|
42258
|
-
return { value: data, done: false };
|
42254
|
+
const text = `${this.parsingLeftover}${decoded}`;
|
42255
|
+
const regex = /data:.*\n\n/g;
|
42256
|
+
const matches = [...text.matchAll(regex)].flatMap((match) => match);
|
42257
|
+
matches.forEach((match) => {
|
42258
|
+
try {
|
42259
|
+
this.events.push(JSON.parse(match.replace(/^data:/, "")));
|
42260
|
+
} catch (e) {
|
42261
|
+
throw new FuelError(
|
42262
|
+
ErrorCode.STREAM_PARSING_ERROR,
|
42263
|
+
`Error while parsing stream data response: ${text}`
|
42264
|
+
);
|
42265
|
+
}
|
42266
|
+
});
|
42267
|
+
this.parsingLeftover = text.replace(matches.join(), "");
|
42259
42268
|
}
|
42260
42269
|
}
|
42261
42270
|
/**
|