Skip to content

Commit

Permalink
Added the underlying fetch / node-fetch Response instance to RestResp…
Browse files Browse the repository at this point in the history
…onse<T>
  • Loading branch information
verifalia committed Oct 8, 2021
1 parent a46eb07 commit f92c96b
Show file tree
Hide file tree
Showing 22 changed files with 102 additions and 50 deletions.
6 changes: 4 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ module.exports = {
"eslint-plugin-import",
"eslint-plugin-jsdoc",
"eslint-plugin-prefer-arrow",
"@typescript-eslint"
"@typescript-eslint",
"deprecation"
],
"rules": {
"@typescript-eslint/adjacent-overload-signatures": "error",
Expand Down Expand Up @@ -213,6 +214,7 @@ module.exports = {
}
],
"use-isnan": "error",
"valid-typeof": "off"
"valid-typeof": "off",
"deprecation/deprecation": ["warn"]
}
};
12 changes: 7 additions & 5 deletions browser/amd/verifalia.js
Original file line number Diff line number Diff line change
Expand Up @@ -1185,15 +1185,17 @@ define('verifalia', ['exports', 'tslib'], function (exports, tslib) { 'use stric
throw new RequestThrottledError();
}
return [2 /*return*/, { value: {
status: response.status,
statusText: response.statusText,
body: response.body,
deserialize: function () { return tslib.__awaiter(_this, void 0, void 0, function () { return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, response.json()];
case 1: return [2 /*return*/, (_a.sent())];
}
}); }); }
}); }); },
response: response,
// Obsolete fields, for backward compatibility only
status: response.status,
statusText: response.statusText,
body: response.body,
} }];
}
});
Expand Down Expand Up @@ -1227,7 +1229,7 @@ define('verifalia', ['exports', 'tslib'], function (exports, tslib) { 'use stric
}());

// generated by genversion
var version = '3.0.3';
var version = '3.1.0';

/**
* A factory of MultiplexedRestClient instances, used to issue REST commands against the Verifalia API.
Expand Down
12 changes: 7 additions & 5 deletions browser/cjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1189,15 +1189,17 @@ var MultiplexedRestClient = /** @class */ (function () {
throw new RequestThrottledError();
}
return [2 /*return*/, { value: {
status: response.status,
statusText: response.statusText,
body: response.body,
deserialize: function () { return tslib.__awaiter(_this, void 0, void 0, function () { return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, response.json()];
case 1: return [2 /*return*/, (_a.sent())];
}
}); }); }
}); }); },
response: response,
// Obsolete fields, for backward compatibility only
status: response.status,
statusText: response.statusText,
body: response.body,
} }];
}
});
Expand Down Expand Up @@ -1231,7 +1233,7 @@ var MultiplexedRestClient = /** @class */ (function () {
}());

// generated by genversion
var version = '3.0.3';
var version = '3.1.0';

/**
* A factory of MultiplexedRestClient instances, used to issue REST commands against the Verifalia API.
Expand Down
6 changes: 4 additions & 2 deletions browser/esm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,10 +382,12 @@ class MultiplexedRestClient {
throw new RequestThrottledError();
}
return {
deserialize: () => __awaiter(this, void 0, void 0, function* () { return (yield response.json()); }),
response,
// Obsolete fields, for backward compatibility only
status: response.status,
statusText: response.statusText,
body: response.body,
deserialize: () => __awaiter(this, void 0, void 0, function* () { return (yield response.json()); })
};
}
throw new ServiceUnreachableError(errors);
Expand All @@ -400,7 +402,7 @@ class MultiplexedRestClient {
}

// generated by genversion
const version = '3.0.3';
const version = '3.1.0';

/**
* A factory of MultiplexedRestClient instances, used to issue REST commands against the Verifalia API.
Expand Down
2 changes: 1 addition & 1 deletion browser/esm/rest/MultiplexedRestClient.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion browser/esm/rest/RestResponse.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
/// <reference types="node" />
import { Response as NodeResponse } from "node-fetch";
export interface RestResponse<T> {
deserialize: () => Promise<T>;
response: NodeResponse | // HACK: Keep the IDE's background compiler happy
Response;
/** @deprecated */
status: number;
/** @deprecated */
statusText: string;
/** @deprecated */
body: NodeJS.ReadableStream | // HACK: Keep the IDE's background compiler happy
ReadableStream<Uint8Array> | null;
deserialize: () => Promise<T>;
}
//# sourceMappingURL=RestResponse.d.ts.map
2 changes: 1 addition & 1 deletion browser/esm/rest/RestResponse.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion browser/esm/version.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export declare const version = "3.0.3";
export declare const version = "3.1.0";
//# sourceMappingURL=version.d.ts.map
12 changes: 7 additions & 5 deletions browser/iife/verifalia.js
Original file line number Diff line number Diff line change
Expand Up @@ -1299,15 +1299,17 @@ var Verifalia = (function (exports) {
throw new RequestThrottledError();
}
return [2 /*return*/, { value: {
status: response.status,
statusText: response.statusText,
body: response.body,
deserialize: function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, response.json()];
case 1: return [2 /*return*/, (_a.sent())];
}
}); }); }
}); }); },
response: response,
// Obsolete fields, for backward compatibility only
status: response.status,
statusText: response.statusText,
body: response.body,
} }];
}
});
Expand Down Expand Up @@ -1341,7 +1343,7 @@ var Verifalia = (function (exports) {
}());

// generated by genversion
var version = '3.0.3';
var version = '3.1.0';

/**
* A factory of MultiplexedRestClient instances, used to issue REST commands against the Verifalia API.
Expand Down
2 changes: 1 addition & 1 deletion browser/iife/verifalia.min.js

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions browser/system/verifalia.js
Original file line number Diff line number Diff line change
Expand Up @@ -1208,15 +1208,17 @@ System.register('verifalia', ['tslib'], function (exports) {
throw new RequestThrottledError();
}
return [2 /*return*/, { value: {
status: response.status,
statusText: response.statusText,
body: response.body,
deserialize: function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, response.json()];
case 1: return [2 /*return*/, (_a.sent())];
}
}); }); }
}); }); },
response: response,
// Obsolete fields, for backward compatibility only
status: response.status,
statusText: response.statusText,
body: response.body,
} }];
}
});
Expand Down Expand Up @@ -1250,7 +1252,7 @@ System.register('verifalia', ['tslib'], function (exports) {
}());

// generated by genversion
var version = '3.0.3';
var version = '3.1.0';

/**
* A factory of MultiplexedRestClient instances, used to issue REST commands against the Verifalia API.
Expand Down
12 changes: 7 additions & 5 deletions browser/umd/verifalia.js
Original file line number Diff line number Diff line change
Expand Up @@ -1189,15 +1189,17 @@
throw new RequestThrottledError();
}
return [2 /*return*/, { value: {
status: response.status,
statusText: response.statusText,
body: response.body,
deserialize: function () { return tslib.__awaiter(_this, void 0, void 0, function () { return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, response.json()];
case 1: return [2 /*return*/, (_a.sent())];
}
}); }); }
}); }); },
response: response,
// Obsolete fields, for backward compatibility only
status: response.status,
statusText: response.statusText,
body: response.body,
} }];
}
});
Expand Down Expand Up @@ -1231,7 +1233,7 @@
}());

// generated by genversion
var version = '3.0.3';
var version = '3.1.0';

/**
* A factory of MultiplexedRestClient instances, used to issue REST commands against the Verifalia API.
Expand Down
12 changes: 7 additions & 5 deletions node/cjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3807,15 +3807,17 @@ var MultiplexedRestClient = /** @class */ (function () {
throw new RequestThrottledError();
}
return [2 /*return*/, { value: {
status: response.status,
statusText: response.statusText,
body: response.body,
deserialize: function () { return tslib.__awaiter(_this, void 0, void 0, function () { return tslib.__generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, response.json()];
case 1: return [2 /*return*/, (_a.sent())];
}
}); }); }
}); }); },
response: response,
// Obsolete fields, for backward compatibility only
status: response.status,
statusText: response.statusText,
body: response.body,
} }];
}
});
Expand Down Expand Up @@ -3849,7 +3851,7 @@ var MultiplexedRestClient = /** @class */ (function () {
}());

// generated by genversion
var version = '3.0.3';
var version = '3.1.0';

/**
* A factory of MultiplexedRestClient instances, used to issue REST commands against the Verifalia API.
Expand Down
6 changes: 4 additions & 2 deletions node/esm/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2992,10 +2992,12 @@ class MultiplexedRestClient {
throw new RequestThrottledError();
}
return {
deserialize: () => __awaiter(this, void 0, void 0, function* () { return (yield response.json()); }),
response,
// Obsolete fields, for backward compatibility only
status: response.status,
statusText: response.statusText,
body: response.body,
deserialize: () => __awaiter(this, void 0, void 0, function* () { return (yield response.json()); })
};
}
throw new ServiceUnreachableError(errors);
Expand All @@ -3010,7 +3012,7 @@ class MultiplexedRestClient {
}

// generated by genversion
const version = '3.0.3';
const version = '3.1.0';

/**
* A factory of MultiplexedRestClient instances, used to issue REST commands against the Verifalia API.
Expand Down
2 changes: 1 addition & 1 deletion node/esm/rest/MultiplexedRestClient.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion node/esm/rest/RestResponse.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
/// <reference types="node" />
import { Response as NodeResponse } from "node-fetch";
export interface RestResponse<T> {
deserialize: () => Promise<T>;
response: NodeResponse | // HACK: Keep the IDE's background compiler happy
Response;
/** @deprecated */
status: number;
/** @deprecated */
statusText: string;
/** @deprecated */
body: NodeJS.ReadableStream | // HACK: Keep the IDE's background compiler happy
ReadableStream<Uint8Array> | null;
deserialize: () => Promise<T>;
}
//# sourceMappingURL=RestResponse.d.ts.map
Loading

0 comments on commit f92c96b

Please sign in to comment.