@paddle/paddle-node-sdk 1.4.1 → 1.5.1
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.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/entities/subscription/subscription-item.js +2 -1
- package/dist/cjs/internal/base/query-parameters.js +6 -5
- package/dist/cjs/notifications/entities/subscription/subscription-item-notification.js +1 -0
- package/dist/cjs/version.js +1 -1
- package/dist/esm/entities/subscription/subscription-item.js +3 -2
- package/dist/esm/internal/base/query-parameters.js +6 -2
- package/dist/esm/notifications/entities/subscription/subscription-item-notification.js +2 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/entities/subscription/subscription-item.d.ts +3 -2
- package/dist/types/notifications/entities/subscription/subscription-item-notification.d.ts +2 -1
- package/dist/types/notifications/types/subscription/subscription-item-notification-response.d.ts +2 -1
- package/dist/types/types/subscription/subscription-item-response.d.ts +3 -2
- package/dist/types/version.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,23 @@ When we make [non-breaking changes](https://developer.paddle.com/api-reference/a
|
|
|
12
12
|
|
|
13
13
|
This means when upgrading minor versions of the SDK, you may notice type errors. You can safely ignore these or fix by adding additional type guards.
|
|
14
14
|
|
|
15
|
+
## 1.5.1 - 2024-09-10
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- Fixed a bug where query parameters with special characters were not passed correctly to the API.
|
|
20
|
+
- Dependabot security updates.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 1.5.0 - 2024-08-16
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- Updated subscription items model to include `product`. See [related changelog](https://developer.paddle.com/changelog/2024/subscription-items-product?utm_source=dx&utm_medium=paddle-node-sdk).
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
15
32
|
## 1.4.1 - 2024-06-21
|
|
16
33
|
|
|
17
34
|
### Fixed
|
|
@@ -12,7 +12,8 @@ class SubscriptionItem {
|
|
|
12
12
|
this.previouslyBilledAt = subscriptionItem.previously_billed_at ? subscriptionItem.previously_billed_at : null;
|
|
13
13
|
this.nextBilledAt = subscriptionItem.next_billed_at ? subscriptionItem.next_billed_at : null;
|
|
14
14
|
this.trialDates = subscriptionItem.trial_dates ? new index_1.SubscriptionTimePeriod(subscriptionItem.trial_dates) : null;
|
|
15
|
-
this.price =
|
|
15
|
+
this.price = new index_1.Price(subscriptionItem.price);
|
|
16
|
+
this.product = new index_1.Product(subscriptionItem.product);
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
exports.SubscriptionItem = SubscriptionItem;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.QueryParameters = void 0;
|
|
7
|
-
|
|
4
|
+
function convertCamelCaseToSnakeCase(input) {
|
|
5
|
+
return input.replace(/\b(\w+)([A-Z][a-z])/g, (_match, p1, p2) => {
|
|
6
|
+
return p1.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase() + '_' + p2.toLowerCase();
|
|
7
|
+
});
|
|
8
|
+
}
|
|
8
9
|
class QueryParameters {
|
|
9
10
|
constructor(queryParameters) {
|
|
10
11
|
this.queryParameters = queryParameters;
|
|
@@ -14,7 +15,7 @@ class QueryParameters {
|
|
|
14
15
|
for (const key in this.queryParameters) {
|
|
15
16
|
const value = this.queryParameters[key];
|
|
16
17
|
if (key && value) {
|
|
17
|
-
urlSearchParam.append((
|
|
18
|
+
urlSearchParam.append(convertCamelCaseToSnakeCase(key), `${value}`);
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
return '?' + urlSearchParam.toString();
|
|
@@ -15,6 +15,7 @@ class SubscriptionItemNotification {
|
|
|
15
15
|
? new index_1.SubscriptionTimePeriodNotification(subscriptionItem.trial_dates)
|
|
16
16
|
: null;
|
|
17
17
|
this.price = subscriptionItem.price ? new index_1.SubscriptionPriceNotification(subscriptionItem.price) : null;
|
|
18
|
+
this.product = subscriptionItem.product ? new index_1.ProductNotification(subscriptionItem.product) : null;
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
exports.SubscriptionItemNotification = SubscriptionItemNotification;
|
package/dist/cjs/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Price, SubscriptionTimePeriod } from '../index';
|
|
1
|
+
import { Price, Product, SubscriptionTimePeriod } from '../index';
|
|
2
2
|
export class SubscriptionItem {
|
|
3
3
|
constructor(subscriptionItem) {
|
|
4
4
|
this.status = subscriptionItem.status;
|
|
@@ -9,6 +9,7 @@ export class SubscriptionItem {
|
|
|
9
9
|
this.previouslyBilledAt = subscriptionItem.previously_billed_at ? subscriptionItem.previously_billed_at : null;
|
|
10
10
|
this.nextBilledAt = subscriptionItem.next_billed_at ? subscriptionItem.next_billed_at : null;
|
|
11
11
|
this.trialDates = subscriptionItem.trial_dates ? new SubscriptionTimePeriod(subscriptionItem.trial_dates) : null;
|
|
12
|
-
this.price =
|
|
12
|
+
this.price = new Price(subscriptionItem.price);
|
|
13
|
+
this.product = new Product(subscriptionItem.product);
|
|
13
14
|
}
|
|
14
15
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
function convertCamelCaseToSnakeCase(input) {
|
|
2
|
+
return input.replace(/\b(\w+)([A-Z][a-z])/g, (_match, p1, p2) => {
|
|
3
|
+
return p1.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase() + '_' + p2.toLowerCase();
|
|
4
|
+
});
|
|
5
|
+
}
|
|
2
6
|
export class QueryParameters {
|
|
3
7
|
constructor(queryParameters) {
|
|
4
8
|
this.queryParameters = queryParameters;
|
|
@@ -8,7 +12,7 @@ export class QueryParameters {
|
|
|
8
12
|
for (const key in this.queryParameters) {
|
|
9
13
|
const value = this.queryParameters[key];
|
|
10
14
|
if (key && value) {
|
|
11
|
-
urlSearchParam.append(
|
|
15
|
+
urlSearchParam.append(convertCamelCaseToSnakeCase(key), `${value}`);
|
|
12
16
|
}
|
|
13
17
|
}
|
|
14
18
|
return '?' + urlSearchParam.toString();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SubscriptionPriceNotification, SubscriptionTimePeriodNotification } from '../index';
|
|
1
|
+
import { ProductNotification, SubscriptionPriceNotification, SubscriptionTimePeriodNotification } from '../index';
|
|
2
2
|
export class SubscriptionItemNotification {
|
|
3
3
|
constructor(subscriptionItem) {
|
|
4
4
|
this.status = subscriptionItem.status;
|
|
@@ -12,5 +12,6 @@ export class SubscriptionItemNotification {
|
|
|
12
12
|
? new SubscriptionTimePeriodNotification(subscriptionItem.trial_dates)
|
|
13
13
|
: null;
|
|
14
14
|
this.price = subscriptionItem.price ? new SubscriptionPriceNotification(subscriptionItem.price) : null;
|
|
15
|
+
this.product = subscriptionItem.product ? new ProductNotification(subscriptionItem.product) : null;
|
|
15
16
|
}
|
|
16
17
|
}
|
package/dist/esm/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = '1.
|
|
1
|
+
export const SDK_VERSION = '1.5.1';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ISubscriptionItemResponse } from '../../types';
|
|
2
|
-
import { Price, SubscriptionTimePeriod } from '../index';
|
|
2
|
+
import { Price, Product, SubscriptionTimePeriod } from '../index';
|
|
3
3
|
import { type SubscriptionItemStatus } from '../../enums';
|
|
4
4
|
export declare class SubscriptionItem {
|
|
5
5
|
readonly status: SubscriptionItemStatus;
|
|
@@ -10,6 +10,7 @@ export declare class SubscriptionItem {
|
|
|
10
10
|
readonly previouslyBilledAt: string | null;
|
|
11
11
|
readonly nextBilledAt: string | null;
|
|
12
12
|
readonly trialDates: SubscriptionTimePeriod | null;
|
|
13
|
-
readonly price: Price
|
|
13
|
+
readonly price: Price;
|
|
14
|
+
readonly product: Product;
|
|
14
15
|
constructor(subscriptionItem: ISubscriptionItemResponse);
|
|
15
16
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ISubscriptionItemNotificationResponse } from '../../types';
|
|
2
|
-
import { SubscriptionPriceNotification, SubscriptionTimePeriodNotification } from '../index';
|
|
2
|
+
import { ProductNotification, SubscriptionPriceNotification, SubscriptionTimePeriodNotification } from '../index';
|
|
3
3
|
import { type SubscriptionItemStatus } from '../../../enums';
|
|
4
4
|
export declare class SubscriptionItemNotification {
|
|
5
5
|
readonly status: SubscriptionItemStatus;
|
|
@@ -11,5 +11,6 @@ export declare class SubscriptionItemNotification {
|
|
|
11
11
|
readonly nextBilledAt: string | null;
|
|
12
12
|
readonly trialDates: SubscriptionTimePeriodNotification | null;
|
|
13
13
|
readonly price: SubscriptionPriceNotification | null;
|
|
14
|
+
readonly product: ProductNotification | null;
|
|
14
15
|
constructor(subscriptionItem: ISubscriptionItemNotificationResponse);
|
|
15
16
|
}
|
package/dist/types/notifications/types/subscription/subscription-item-notification-response.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ISubscriptionPriceNotificationResponse, type ISubscriptionTimePeriodNotificationResponse } from '../index';
|
|
1
|
+
import { type IProductNotificationResponse, type ISubscriptionPriceNotificationResponse, type ISubscriptionTimePeriodNotificationResponse } from '../index';
|
|
2
2
|
import { type SubscriptionItemStatus } from '../../../enums';
|
|
3
3
|
export interface ISubscriptionItemNotificationResponse {
|
|
4
4
|
status: SubscriptionItemStatus;
|
|
@@ -10,4 +10,5 @@ export interface ISubscriptionItemNotificationResponse {
|
|
|
10
10
|
next_billed_at?: string | null;
|
|
11
11
|
trial_dates?: ISubscriptionTimePeriodNotificationResponse | null;
|
|
12
12
|
price?: ISubscriptionPriceNotificationResponse | null;
|
|
13
|
+
product?: IProductNotificationResponse | null;
|
|
13
14
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type IPriceResponse, type ISubscriptionTimePeriodResponse } from '../index';
|
|
1
|
+
import { type IPriceResponse, type IProductResponse, type ISubscriptionTimePeriodResponse } from '../index';
|
|
2
2
|
import { type SubscriptionItemStatus } from '../../enums';
|
|
3
3
|
export interface ISubscriptionItemResponse {
|
|
4
4
|
status: SubscriptionItemStatus;
|
|
@@ -9,5 +9,6 @@ export interface ISubscriptionItemResponse {
|
|
|
9
9
|
previously_billed_at?: string | null;
|
|
10
10
|
next_billed_at?: string | null;
|
|
11
11
|
trial_dates?: ISubscriptionTimePeriodResponse | null;
|
|
12
|
-
price
|
|
12
|
+
price: IPriceResponse;
|
|
13
|
+
product: IProductResponse;
|
|
13
14
|
}
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.
|
|
1
|
+
export declare const SDK_VERSION = "1.5.1";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paddle/paddle-node-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|