@apimatic/core
Advanced tools
Comparing version 0.7.4 to 0.7.5
import { __spreadArray, __read, __assign, __awaiter, __generator } from 'tslib'; | ||
import isNode from 'detect-node'; | ||
import JSONBig from '@apimatic/json-bigint'; | ||
@@ -14,2 +13,3 @@ import { deprecated, sanitizeUrl } from '../apiHelper.js'; | ||
import { shouldRetryRequest, RequestRetryOption, getRetryWaitTime } from './retryConfiguration.js'; | ||
import { convertToStream } from '@apimatic/convert-to-stream'; | ||
/** | ||
@@ -679,21 +679,2 @@ * bandwidthLib | ||
function convertToStream(content) { | ||
if (typeof content !== 'string') { | ||
return content; | ||
} | ||
if (isNode) { | ||
// ref: https://stackoverflow.com/a/22085851 | ||
var rs = new (require('stream').Readable)(); // tslint:disable-next-line:no-empty | ||
rs._read = function () {}; | ||
rs.push(content); | ||
rs.push(null); | ||
return rs; | ||
} | ||
return new Blob([content]); | ||
} | ||
export { DefaultRequestBuilder, convertToStream, createRequestBuilderFactory, skipEncode }; | ||
export { DefaultRequestBuilder, createRequestBuilderFactory, skipEncode }; |
@@ -10,4 +10,4 @@ export { deprecated, isBlob, sanitizeUrl, updateUserAgent } from './apiHelper.js'; | ||
export { callHttpInterceptors, passThroughInterceptor } from './http/httpInterceptor.js'; | ||
export { DefaultRequestBuilder, convertToStream, createRequestBuilderFactory, skipEncode } from './http/requestBuilder.js'; | ||
export { DefaultRequestBuilder, createRequestBuilderFactory, skipEncode } from './http/requestBuilder.js'; | ||
export { SkipEncode, pathTemplate } from './http/pathTemplate.js'; | ||
export { RequestRetryOption } from './http/retryConfiguration.js'; |
@@ -140,4 +140,3 @@ /** | ||
export declare function createRequestBuilderFactory<BaseUrlParamType, AuthParams>(httpClient: HttpClientInterface, baseUrlProvider: (arg?: BaseUrlParamType) => string, apiErrorFactory: ApiErrorConstructor, authenticationProvider: AuthenticatorInterface<AuthParams>, xmlSerializer: XmlSerializerInterface, retryConfig: RetryConfiguration): RequestBuilderFactory<BaseUrlParamType, AuthParams>; | ||
export declare function convertToStream(content: string | Blob | NodeJS.ReadableStream): Blob | NodeJS.ReadableStream; | ||
export {}; | ||
//# sourceMappingURL=requestBuilder.d.ts.map |
@@ -8,5 +8,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.convertToStream = exports.createRequestBuilderFactory = exports.DefaultRequestBuilder = exports.skipEncode = void 0; | ||
exports.createRequestBuilderFactory = exports.DefaultRequestBuilder = exports.skipEncode = void 0; | ||
var tslib_1 = require("tslib"); | ||
var detect_node_1 = tslib_1.__importDefault(require("detect-node")); | ||
var json_bigint_1 = tslib_1.__importDefault(require("@apimatic/json-bigint")); | ||
@@ -23,2 +22,3 @@ var apiHelper_1 = require("../apiHelper"); | ||
var retryConfiguration_1 = require("./retryConfiguration"); | ||
var convert_to_stream_1 = require("@apimatic/convert-to-stream"); | ||
var JSON = json_bigint_1.default(); | ||
@@ -278,3 +278,3 @@ function skipEncode(value) { | ||
result = _a.sent(); | ||
return [2 /*return*/, tslib_1.__assign(tslib_1.__assign({}, result), { result: convertToStream(result.body) })]; | ||
return [2 /*return*/, tslib_1.__assign(tslib_1.__assign({}, result), { result: convert_to_stream_1.convertToStream(result.body) })]; | ||
} | ||
@@ -461,17 +461,1 @@ }); | ||
} | ||
function convertToStream(content) { | ||
if (typeof content !== 'string') { | ||
return content; | ||
} | ||
if (detect_node_1.default) { | ||
// ref: https://stackoverflow.com/a/22085851 | ||
var rs = new (require('stream').Readable)(); | ||
// tslint:disable-next-line:no-empty | ||
rs._read = function () { }; | ||
rs.push(content); | ||
rs.push(null); | ||
return rs; | ||
} | ||
return new Blob([content]); | ||
} | ||
exports.convertToStream = convertToStream; |
{ | ||
"name": "@apimatic/core", | ||
"author": "Wajahat Iqbal", | ||
"version": "0.7.4", | ||
"version": "0.7.5", | ||
"license": "SEE LICENSE IN LICENSE.md", | ||
@@ -61,2 +61,3 @@ "sideEffects": false, | ||
"dependencies": { | ||
"@apimatic/convert-to-stream": "0.0.0", | ||
"@apimatic/json-bigint": "^1.2.0", | ||
@@ -63,0 +64,0 @@ "@apimatic/schema": "^0.6.0", |
@@ -7,3 +7,2 @@ /** | ||
import isNode from 'detect-node'; | ||
import JSONBig from '@apimatic/json-bigint'; | ||
@@ -62,2 +61,3 @@ import { FileWrapper } from '../fileWrapper'; | ||
} from './retryConfiguration'; | ||
import { convertToStream } from '@apimatic/convert-to-stream'; | ||
@@ -637,21 +637,1 @@ export type RequestBuilderFactory<BaseUrlParamType, AuthParams> = ( | ||
} | ||
export function convertToStream( | ||
content: string | Blob | NodeJS.ReadableStream | ||
): Blob | NodeJS.ReadableStream { | ||
if (typeof content !== 'string') { | ||
return content; | ||
} | ||
if (isNode) { | ||
// ref: https://stackoverflow.com/a/22085851 | ||
const rs = new (require('stream').Readable)(); | ||
// tslint:disable-next-line:no-empty | ||
rs._read = () => {}; | ||
rs.push(content); | ||
rs.push(null); | ||
return rs; | ||
} | ||
return new Blob([content]); | ||
} |
@@ -0,0 +0,0 @@ import { getHeader } from './httpHeaders'; |
@@ -0,0 +0,0 @@ // tslint:disable-next-line:no-reference |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
205834
10
5468
+ Added@apimatic/convert-to-stream@0.0.0(transitive)