diff --git a/package.json b/package.json index fddf9b1..f6e1563 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "@adyen/api-library", - "version": "2.2.0", + "version": "2.2.1-rc.0", "description": "The Adyen API Library for NodeJS enables you to work with Adyen APIs.", "main": "dist/lib/src/index.js", - "types": "dist/lib/src/index.d.ts", + "types": "dist/lib/src/typings/index.d.ts", "module": "dist/lib-esm/src/index.js", "engines": { "node": ">=8.1.1" @@ -48,7 +48,6 @@ "@babel/runtime": "7.8.3", "@types/jest": "24.0.25", "@types/nock": "10.0.3", - "@types/node": "13.1.7", "@typescript-eslint/eslint-plugin": "2.16.0", "@typescript-eslint/parser": "2.16.0", "babel-loader": "8.0.6", @@ -64,6 +63,7 @@ "webpack-cli": "3.3.10" }, "dependencies": { + "@types/node": "13.1.7", "https-proxy-agent": "4.0.0" } } diff --git a/src/helpers/getJsonResponse.ts b/src/helpers/getJsonResponse.ts index 2f4f797..132934a 100644 --- a/src/helpers/getJsonResponse.ts +++ b/src/helpers/getJsonResponse.ts @@ -22,6 +22,7 @@ import Resource from "../services/resource"; import HttpClientException from "../httpClient/httpClientException"; import ApiException from "../services/exception/apiException"; +import {IRequest} from "../typings/requestOptions"; async function getJsonResponse(resource: Resource, jsonRequest: T | string, requestOptions?: IRequest.Options): Promise; async function getJsonResponse(resource: Resource, jsonRequest: T | string, requestOptions?: IRequest.Options): Promise; diff --git a/src/httpClient/clientInterface.ts b/src/httpClient/clientInterface.ts index 9c226f2..4b2be9f 100644 --- a/src/httpClient/clientInterface.ts +++ b/src/httpClient/clientInterface.ts @@ -22,6 +22,7 @@ import { AgentOptions } from "https"; import HttpClientException from "./httpClientException"; import ApiException from "../services/exception/apiException"; import {Config} from "../index"; +import {IRequest} from "../typings/requestOptions"; interface ClientInterface { request( diff --git a/src/httpClient/httpURLConnectionClient.ts b/src/httpClient/httpURLConnectionClient.ts index d9b04f9..bdba7c2 100644 --- a/src/httpClient/httpURLConnectionClient.ts +++ b/src/httpClient/httpURLConnectionClient.ts @@ -33,6 +33,7 @@ import {ApiError} from "../typings/apiError"; import ApiException from "../services/exception/apiException"; import ClientInterface from "./clientInterface"; import {ApiConstants} from "../constants/apiConstants"; +import {IRequest} from "../typings/requestOptions"; class HttpURLConnectionClient implements ClientInterface { private static CHARSET = "utf-8"; diff --git a/src/services/checkout.ts b/src/services/checkout.ts index b4b686d..83c9119 100644 --- a/src/services/checkout.ts +++ b/src/services/checkout.ts @@ -29,6 +29,7 @@ import PaymentSession from "./resource/checkout/paymentSession"; import PaymentsResult from "./resource/checkout/paymentsResult"; import PaymentLinks from "./resource/checkout/paymentLinks"; import setApplicationInfo from "../helpers/setApplicationInfo"; +import {IRequest} from "../typings/requestOptions"; class Checkout extends ApiKeyAuthenticatedService { private readonly _payments: Payments; diff --git a/src/services/modification.ts b/src/services/modification.ts index 8ad69ad..18730a2 100644 --- a/src/services/modification.ts +++ b/src/services/modification.ts @@ -29,6 +29,7 @@ import Refund from "./resource/modification/refund"; import TechnicalCancel from "./resource/modification/technicalCancel"; import setApplicationInfo from "../helpers/setApplicationInfo"; import {ApplicationInfo} from "../typings/applicationInfo"; +import {IRequest} from "../typings/requestOptions"; interface AppInfo { applicationInfo?: ApplicationInfo } type GenericRequest = T & AppInfo; diff --git a/src/services/resource.ts b/src/services/resource.ts index 3f1b191..de0024b 100644 --- a/src/services/resource.ts +++ b/src/services/resource.ts @@ -24,6 +24,7 @@ import Service from "../service"; import HttpClientException from "../httpClient/httpClientException"; import ApiException from "./exception/apiException"; import ClientInterface from "../httpClient/clientInterface"; +import {IRequest} from "../typings/requestOptions"; abstract class Resource { protected endpoint: string; diff --git a/src/typings/applicationInfo.ts b/src/typings/applicationInfo.ts index 49a8757..99350be 100644 --- a/src/typings/applicationInfo.ts +++ b/src/typings/applicationInfo.ts @@ -40,22 +40,22 @@ export class ApplicationInfo { } } -export interface CommonField { +declare interface CommonField { name?: string; version?: string; } -export interface ExternalPlatform extends CommonField { +declare interface ExternalPlatform extends CommonField { integrator?: string; } -export interface MerchantDevice { +declare interface MerchantDevice { os?: string; osVersion?: string; reference?: string; } -export interface ShopperInteractionDevice { +declare interface ShopperInteractionDevice { os?: string; osVersion?: string; locale?: string; diff --git a/src/typings/index.ts b/src/typings/index.ts new file mode 100644 index 0000000..35e907e --- /dev/null +++ b/src/typings/index.ts @@ -0,0 +1,18 @@ +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// diff --git a/src/typings/requestOptions.d.ts b/src/typings/requestOptions.ts similarity index 87% rename from src/typings/requestOptions.d.ts rename to src/typings/requestOptions.ts index e0c9eaa..3bd4dfd 100644 --- a/src/typings/requestOptions.d.ts +++ b/src/typings/requestOptions.ts @@ -20,8 +20,13 @@ */ // Generated using typescript-generator version 2.14.505 on 2019-06-03 16:13:35. -declare namespace IRequest { - export type Options = HttpsRequestOptions & { + +/// + +import * as https from "https"; + +export namespace IRequest { + export type Options = https.RequestOptions & { idempotencyKey?: string; } }