Socket
Socket
Sign inDemoInstall

paddle-sdk

Package Overview
Dependencies
9
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 4.0.1 to 4.1.0

3

cjs/sdk.d.ts

@@ -253,4 +253,3 @@ import { CreateSubscriptionModifierResponse, GeneratePaylinkBody, GeneratePaylinkResponse, GetProductCouponsResponse, GetProductsResponse, GetSubscriptionPaymentsResponse, GetSubscriptionPlansResponse, GetSubscriptionUsersBody, GetSubscriptionUsersResponse, GetTransactionsResponse, GetWebhookHistoryResponse, UpdateSubscriptionUserResponse } from './types';

* @param {object} [options.headers] - header parameters
* @param {boolean} [options.form] - form parameter (ref: got package)
* @param {boolean} [options.json] - json parameter (ref: got package)
* @param {boolean} [options.form] - serialize the data object to urlencoded format
*/

@@ -257,0 +256,0 @@ private _request;

@@ -8,3 +8,3 @@ "use strict";

const crypto_1 = __importDefault(require("crypto"));
const got_1 = __importDefault(require("got"));
const axios_1 = __importDefault(require("axios"));
const serialize_1 = __importDefault(require("./serialize"));

@@ -360,13 +360,12 @@ const version_1 = require("./version");

* @param {object} [options.headers] - header parameters
* @param {boolean} [options.form] - form parameter (ref: got package)
* @param {boolean} [options.json] - json parameter (ref: got package)
* @param {boolean} [options.form] - serialize the data object to urlencoded format
*/
async _request(path, { body, headers, form = true, json = false, checkoutAPI = false, } = {}) {
async _request(path, { body: requestBody, headers, form = true, checkoutAPI = false, } = {}) {
const url = this.serverURL(checkoutAPI) + path;
// Requests to Checkout API are using only GET,
const method = checkoutAPI ? 'GET' : 'POST';
const fullBody = {
const fullRequestBody = {
vendor_id: this.vendorID,
vendor_auth_code: this.apiKey,
...body,
...requestBody,
};

@@ -376,2 +375,3 @@ const options = {

'User-Agent': `paddle-sdk/${version_1.VERSION} (https://github.com/avaly/paddle-sdk)`,
...(form && { 'Content-Type': 'application/x-www-form-urlencoded' }),
...(headers || {}),

@@ -382,10 +382,5 @@ },

if (method !== 'GET') {
if (form) {
options.form = fullBody;
}
if (json) {
options.json = fullBody;
}
options.data = fullRequestBody;
}
const data = await (0, got_1.default)(url, options).json();
const { data } = await (0, axios_1.default)(url, options);
if ('success' in data && typeof data.success === 'boolean') {

@@ -392,0 +387,0 @@ if (data.success) {

@@ -160,2 +160,3 @@ export interface Product {

customer_country?: string;
customer_email?: string;
customer_postcode?: string;

@@ -162,0 +163,0 @@ discountable?: number;

@@ -1,1 +0,1 @@

export declare const VERSION = "4.0.1";
export declare const VERSION = "4.1.0";

@@ -5,2 +5,2 @@ "use strict";

// Generated by yarn build
exports.VERSION = '4.0.1';
exports.VERSION = '4.1.0';

@@ -253,4 +253,3 @@ import { CreateSubscriptionModifierResponse, GeneratePaylinkBody, GeneratePaylinkResponse, GetProductCouponsResponse, GetProductsResponse, GetSubscriptionPaymentsResponse, GetSubscriptionPlansResponse, GetSubscriptionUsersBody, GetSubscriptionUsersResponse, GetTransactionsResponse, GetWebhookHistoryResponse, UpdateSubscriptionUserResponse } from './types';

* @param {object} [options.headers] - header parameters
* @param {boolean} [options.form] - form parameter (ref: got package)
* @param {boolean} [options.json] - json parameter (ref: got package)
* @param {boolean} [options.form] - serialize the data object to urlencoded format
*/

@@ -257,0 +256,0 @@ private _request;

import crypto from 'crypto';
import got from 'got';
import axios from 'axios';
import serialize from './serialize.js';

@@ -360,13 +360,12 @@ import { VERSION } from './version.js';

* @param {object} [options.headers] - header parameters
* @param {boolean} [options.form] - form parameter (ref: got package)
* @param {boolean} [options.json] - json parameter (ref: got package)
* @param {boolean} [options.form] - serialize the data object to urlencoded format
*/
async _request(path, { body, headers, form = true, json = false, checkoutAPI = false, } = {}) {
async _request(path, { body: requestBody, headers, form = true, checkoutAPI = false, } = {}) {
const url = this.serverURL(checkoutAPI) + path;
// Requests to Checkout API are using only GET,
const method = checkoutAPI ? 'GET' : 'POST';
const fullBody = {
const fullRequestBody = {
vendor_id: this.vendorID,
vendor_auth_code: this.apiKey,
...body,
...requestBody,
};

@@ -376,2 +375,3 @@ const options = {

'User-Agent': `paddle-sdk/${VERSION} (https://github.com/avaly/paddle-sdk)`,
...(form && { 'Content-Type': 'application/x-www-form-urlencoded' }),
...(headers || {}),

@@ -382,10 +382,5 @@ },

if (method !== 'GET') {
if (form) {
options.form = fullBody;
}
if (json) {
options.json = fullBody;
}
options.data = fullRequestBody;
}
const data = await got(url, options).json();
const { data } = await axios(url, options);
if ('success' in data && typeof data.success === 'boolean') {

@@ -392,0 +387,0 @@ if (data.success) {

@@ -160,2 +160,3 @@ export interface Product {

customer_country?: string;
customer_email?: string;
customer_postcode?: string;

@@ -162,0 +163,0 @@ discountable?: number;

@@ -1,1 +0,1 @@

export declare const VERSION = "4.0.1";
export declare const VERSION = "4.1.0";
// Generated by yarn build
export const VERSION = '4.0.1';
export const VERSION = '4.1.0';
{
"name": "paddle-sdk",
"description": "The Paddle.com Node.js SDK",
"version": "4.0.1",
"version": "4.1.0",
"type": "module",

@@ -26,3 +26,3 @@ "main": "./cjs/index.js",

"engines": {
"node": ">=14.0.0"
"node": ">=14.17.0"
},

@@ -38,2 +38,3 @@ "files": [

"prepack": "yarn build",
"prepare": "husky install",
"pretty": "prettier --write --list-different \"**/*.ts\"",

@@ -50,3 +51,3 @@ "release": "standard-version -a",

"dependencies": {
"got": "^10.2.0"
"axios": "1.3.5"
},

@@ -59,8 +60,8 @@ "devDependencies": {

"eslint": "8.36.0",
"husky": "3.1.0",
"husky": "8.0.3",
"jest": "29.5.0",
"lint-staged": "9.5.0",
"lint-staged": "13.2.0",
"nock": "11.7.0",
"prettier": "2.8.7",
"standard-version": "8.0.0",
"standard-version": "9.5.0",
"ts-jest": "29.0.5",

@@ -72,8 +73,2 @@ "ts-node": "10.9.1",

},
"husky": {
"hooks": {
"commit-msg": "validate-commit-msg",
"pre-commit": "lint-staged"
}
},
"standard-version": {

@@ -80,0 +75,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc