@paddle/paddle-node-sdk 1.0.2 → 1.1.0

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.
Files changed (28) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +6 -0
  3. package/dist/entities/price/price.d.ts +2 -0
  4. package/dist/entities/price/price.js +2 -0
  5. package/dist/entities/product/product.d.ts +1 -0
  6. package/dist/entities/product/product.js +1 -0
  7. package/dist/enums/report/report-filter-name.d.ts +1 -1
  8. package/dist/enums/report/report-type.d.ts +1 -1
  9. package/dist/notifications/entities/price/price-notification.d.ts +2 -0
  10. package/dist/notifications/entities/price/price-notification.js +3 -0
  11. package/dist/notifications/entities/product/product-notification.d.ts +1 -0
  12. package/dist/notifications/entities/product/product-notification.js +2 -1
  13. package/dist/notifications/types/price/price-notification-response.d.ts +2 -0
  14. package/dist/notifications/types/shared/shared-product-notification-response.d.ts +1 -0
  15. package/dist/types/price/price-response.d.ts +5 -3
  16. package/dist/types/product/product-response.d.ts +4 -3
  17. package/dist/types/shared/index.d.ts +0 -2
  18. package/dist/types/shared/index.js +0 -2
  19. package/dist/types/shared/transaction-line-item-preview-response.d.ts +2 -2
  20. package/dist/types/transaction/transaction-item-response.d.ts +2 -2
  21. package/dist/types/transaction/transaction-line-item-response.d.ts +2 -2
  22. package/dist/version.d.ts +1 -1
  23. package/dist/version.js +1 -1
  24. package/package.json +1 -1
  25. package/dist/types/shared/shared-price-response.d.ts +0 -18
  26. package/dist/types/shared/shared-price-response.js +0 -2
  27. package/dist/types/shared/shared-product-response.d.ts +0 -14
  28. package/dist/types/shared/shared-product-response.js +0 -2
package/CHANGELOG.md CHANGED
@@ -6,6 +6,28 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
 
7
7
  Check our main [developer changelog](https://developer.paddle.com/?utm_source=dx&utm_medium=paddle-node-sdk) for information about changes to the Paddle Billing platform, the Paddle API, and other developer tools.
8
8
 
9
+ ### Versioning
10
+
11
+ When we make [non-breaking changes](https://developer.paddle.com/api-reference/about/versioning?utm_source=dx&utm_medium=paddle-node-sdk#non-breaking-change) to the Paddle API, we'll only release a new major version of the Node.js SDK when it causes problems at runtime. We won't release a new version of the SDK when we weaken TypeScript types in a way that doesn't cause existing implementations to break or malfunction. For example, if we add a new field to a request or an allowed value for a field in a response, this weakens the Typescript type but does not cause existing usages to stop working.
12
+
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
+
15
+
16
+ ## 1.1.0 - 2024-03-13
17
+
18
+ ### Added
19
+
20
+ - Added `createdAt` and `updatedAt` to product and price entities, see [related changelog](https://developer.paddle.com/changelog/2024/product-price-dates?utm_source=dx&utm_medium=paddle-node-sdk).
21
+
22
+ ### Changed
23
+
24
+ - Updated [report API](https://developer.paddle.com/api-reference/reports/create-report?utm_source=dx&utm_medium=paddle-node-sdk) to support `discounts` and `product_prices` report, see [related changelog](https://developer.paddle.com/changelog/2024/product-prices-discounts-reports?utm_source=dx&utm_medium=paddle-node-sdk).
25
+
26
+ ### Removed
27
+
28
+ - Removed `ISharedProductResponse` and `ISharedPriceResponse` interfaces as they were redundant. Please use `IProductResponse` and `IPriceResponse` instead.
29
+
30
+ ---
9
31
 
10
32
  ## 1.0.2 - 2024-03-12
11
33
 
package/README.md CHANGED
@@ -54,6 +54,12 @@ Keep in mind that API keys are separate for your sandbox and live accounts, so y
54
54
 
55
55
  This SDK comes with TypeScript definitions for the Paddle API. We recommend that you update frequently to keep the TypeScript definitions up-to-date with the API. Use `// @ts-ignore` to prevent any type error if you don't want to update.
56
56
 
57
+ ### Versioning
58
+
59
+ When we make [non-breaking changes](https://developer.paddle.com/api-reference/about/versioning?utm_source=dx&utm_medium=paddle-node-sdk#non-breaking-change) to the Paddle API, we'll only release a new major version of the Node.js SDK when it causes problems at runtime. We won't release a new version of the SDK when we weaken TypeScript types in a way that doesn't cause existing implementations to break or malfunction. For example, if we add a new field to a request or an allowed value for a field in a response, this weakens the Typescript type but does not cause existing usages to stop working.
60
+
61
+ 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.
62
+
57
63
  ## Naming conventions
58
64
 
59
65
  Properties in the Paddle API use `snake_case`. To follow JavaScript conventions, properties in this SDK use `camelCase`. This means:
@@ -14,6 +14,8 @@ export declare class Price {
14
14
  readonly unitPriceOverrides: UnitPriceOverride[];
15
15
  readonly quantity: PriceQuantity;
16
16
  readonly status: Status;
17
+ readonly createdAt: string;
18
+ readonly updatedAt: string;
17
19
  readonly customData: ICustomData | null;
18
20
  readonly importMeta: ImportMeta | null;
19
21
  readonly product: Product | null;
@@ -16,6 +16,8 @@ class Price {
16
16
  this.unitPriceOverrides = price.unit_price_overrides.map((unit_price_override) => new index_1.UnitPriceOverride(unit_price_override));
17
17
  this.quantity = new index_1.PriceQuantity(price.quantity);
18
18
  this.status = price.status;
19
+ this.createdAt = price.created_at;
20
+ this.updatedAt = price.updated_at;
19
21
  this.customData = price.custom_data ? price.custom_data : null;
20
22
  this.importMeta = price.import_meta ? new index_1.ImportMeta(price.import_meta) : null;
21
23
  this.product = price.product ? new index_1.Product(price.product) : null;
@@ -11,6 +11,7 @@ export declare class Product {
11
11
  readonly customData: CustomData | null;
12
12
  readonly status: Status;
13
13
  readonly createdAt: string;
14
+ readonly updatedAt: string;
14
15
  readonly importMeta: ImportMeta | null;
15
16
  readonly prices: Price[] | null;
16
17
  constructor(product: IProductResponse);
@@ -14,6 +14,7 @@ class Product {
14
14
  this.customData = product.custom_data ? product.custom_data : null;
15
15
  this.status = product.status;
16
16
  this.createdAt = product.created_at;
17
+ this.updatedAt = product.updated_at;
17
18
  this.importMeta = product.import_meta ? new index_1.ImportMeta(product.import_meta) : null;
18
19
  this.prices = product.prices ? product.prices.map((price) => new index_1.Price(price)) : null;
19
20
  }
@@ -1 +1 @@
1
- export type ReportFilterName = 'action' | 'collection_mode' | 'currency_code' | 'origin' | 'status' | 'updated_at';
1
+ export type ReportFilterName = 'action' | 'collection_mode' | 'currency_code' | 'origin' | 'status' | 'updated_at' | 'type' | 'product_status' | 'price_status' | 'product_type' | 'price_type' | 'product_updated_at' | 'price_updated_at';
@@ -1 +1 @@
1
- export type ReportType = 'adjustments' | 'adjustment_line_items' | 'transactions' | 'transaction_line_items';
1
+ export type ReportType = 'adjustments' | 'adjustment_line_items' | 'transactions' | 'transaction_line_items' | 'discounts' | 'products_prices';
@@ -15,6 +15,8 @@ export declare class PriceNotification {
15
15
  readonly unitPriceOverrides: UnitPriceOverrideNotification[];
16
16
  readonly quantity: PriceQuantityNotification;
17
17
  readonly status: Status;
18
+ readonly createdAt: string | null;
19
+ readonly updatedAt: string | null;
18
20
  readonly customData: ICustomData | null;
19
21
  readonly importMeta: ImportMetaNotification | null;
20
22
  constructor(price: IPriceNotificationResponse);
@@ -4,6 +4,7 @@ exports.PriceNotification = void 0;
4
4
  const index_1 = require("../index");
5
5
  class PriceNotification {
6
6
  constructor(price) {
7
+ var _a, _b;
7
8
  this.id = price.id;
8
9
  this.productId = price.product_id;
9
10
  this.description = price.description;
@@ -16,6 +17,8 @@ class PriceNotification {
16
17
  this.unitPriceOverrides = price.unit_price_overrides.map((unit_price_override) => new index_1.UnitPriceOverrideNotification(unit_price_override));
17
18
  this.quantity = new index_1.PriceQuantityNotification(price.quantity);
18
19
  this.status = price.status;
20
+ this.createdAt = (_a = price.created_at) !== null && _a !== void 0 ? _a : null;
21
+ this.updatedAt = (_b = price.updated_at) !== null && _b !== void 0 ? _b : null;
19
22
  this.customData = price.custom_data ? price.custom_data : null;
20
23
  this.importMeta = price.import_meta ? new index_1.ImportMetaNotification(price.import_meta) : null;
21
24
  }
@@ -12,6 +12,7 @@ export declare class ProductNotification {
12
12
  readonly customData: CustomData | null;
13
13
  readonly status: Status;
14
14
  readonly createdAt: string;
15
+ readonly updatedAt: string | null;
15
16
  readonly importMeta: ImportMetaNotification | null;
16
17
  constructor(product: ISharedProductNotificationResponse);
17
18
  }
@@ -4,7 +4,7 @@ exports.ProductNotification = void 0;
4
4
  const index_1 = require("../index");
5
5
  class ProductNotification {
6
6
  constructor(product) {
7
- var _a;
7
+ var _a, _b;
8
8
  this.id = product.id;
9
9
  this.name = product.name;
10
10
  this.type = (_a = product.type) !== null && _a !== void 0 ? _a : null;
@@ -14,6 +14,7 @@ class ProductNotification {
14
14
  this.customData = product.custom_data ? product.custom_data : null;
15
15
  this.status = product.status;
16
16
  this.createdAt = product.created_at;
17
+ this.updatedAt = (_b = product.updated_at) !== null && _b !== void 0 ? _b : null;
17
18
  this.importMeta = product.import_meta ? new index_1.ImportMetaNotification(product.import_meta) : null;
18
19
  }
19
20
  }
@@ -14,6 +14,8 @@ export interface IPriceNotificationResponse {
14
14
  unit_price_overrides: IUnitPriceOverrideNotificationResponse[];
15
15
  quantity: IPriceQuantityNotification;
16
16
  status: Status;
17
+ created_at?: string | null;
18
+ updated_at?: string | null;
17
19
  custom_data?: ICustomData | null;
18
20
  import_meta?: IImportMetaNotificationResponse | null;
19
21
  product?: ISharedProductNotificationResponse | null;
@@ -11,5 +11,6 @@ export interface ISharedProductNotificationResponse {
11
11
  custom_data?: ICustomData | null;
12
12
  status: Status;
13
13
  created_at: string;
14
+ updated_at?: string | null;
14
15
  import_meta?: IImportMetaNotificationResponse | null;
15
16
  }
@@ -1,5 +1,5 @@
1
- import { type ITimePeriod, type IMoneyResponse, type IUnitPriceOverrideResponse, type IPriceQuantity, type ICustomData, type ISharedProductResponse, type IImportMetaResponse } from '../index';
2
- import { type TaxMode, type Status, type CatalogType } from '../../enums';
1
+ import { type ICustomData, type IImportMetaResponse, type IMoneyResponse, type IPriceQuantity, type IProductResponse, type ITimePeriod, type IUnitPriceOverrideResponse } from '../index';
2
+ import { type CatalogType, type Status, type TaxMode } from '../../enums';
3
3
  export interface IPriceResponse {
4
4
  id: string;
5
5
  product_id: string;
@@ -13,7 +13,9 @@ export interface IPriceResponse {
13
13
  unit_price_overrides: IUnitPriceOverrideResponse[];
14
14
  quantity: IPriceQuantity;
15
15
  status: Status;
16
+ created_at: string;
17
+ updated_at: string;
16
18
  custom_data?: ICustomData | null;
17
19
  import_meta?: IImportMetaResponse | null;
18
- product?: ISharedProductResponse | null;
20
+ product?: IProductResponse | null;
19
21
  }
@@ -1,5 +1,5 @@
1
- import { type ICustomData, type IImportMetaResponse, type ISharedPriceResponse } from '../index';
2
- import { type TaxCategory, type Status, type CatalogType } from '../../enums';
1
+ import { type ICustomData, type IImportMetaResponse, type IPriceResponse } from '../index';
2
+ import { type CatalogType, type Status, type TaxCategory } from '../../enums';
3
3
  export interface IProductResponse {
4
4
  id: string;
5
5
  name: string;
@@ -10,6 +10,7 @@ export interface IProductResponse {
10
10
  custom_data?: ICustomData | null;
11
11
  status: Status;
12
12
  created_at: string;
13
+ updated_at: string;
13
14
  import_meta?: IImportMetaResponse | null;
14
- prices?: ISharedPriceResponse[] | null;
15
+ prices?: IPriceResponse[] | null;
15
16
  }
@@ -4,8 +4,6 @@ export * from './money-response';
4
4
  export * from './unit-price-override';
5
5
  export * from './unit-price-override-response';
6
6
  export * from './price-quantity';
7
- export * from './shared-price-response';
8
- export * from './shared-product-response';
9
7
  export * from './billing-details-response';
10
8
  export * from './totals';
11
9
  export * from './tax-rates-used-response';
@@ -20,8 +20,6 @@ __exportStar(require("./money-response"), exports);
20
20
  __exportStar(require("./unit-price-override"), exports);
21
21
  __exportStar(require("./unit-price-override-response"), exports);
22
22
  __exportStar(require("./price-quantity"), exports);
23
- __exportStar(require("./shared-price-response"), exports);
24
- __exportStar(require("./shared-product-response"), exports);
25
23
  __exportStar(require("./billing-details-response"), exports);
26
24
  __exportStar(require("./totals"), exports);
27
25
  __exportStar(require("./tax-rates-used-response"), exports);
@@ -1,9 +1,9 @@
1
- import { type IUnitTotals, type ITotals, type ISharedProductResponse } from '../index';
1
+ import { type IProductResponse, type ITotals, type IUnitTotals } from '../index';
2
2
  export interface ITransactionLineItemPreviewResponse {
3
3
  price_id: string;
4
4
  quantity: number;
5
5
  tax_rate: string;
6
6
  unit_totals: IUnitTotals;
7
7
  totals: ITotals;
8
- product: ISharedProductResponse;
8
+ product: IProductResponse;
9
9
  }
@@ -1,7 +1,7 @@
1
- import { type ISharedPriceResponse, type ITransactionProrationResponse } from '../index';
1
+ import { type IPriceResponse, type ITransactionProrationResponse } from '../index';
2
2
  export interface ITransactionItemResponse {
3
3
  price_id?: string | null;
4
- price?: ISharedPriceResponse | null;
4
+ price?: IPriceResponse | null;
5
5
  quantity: number;
6
6
  proration?: ITransactionProrationResponse | null;
7
7
  }
@@ -1,4 +1,4 @@
1
- import { type ITransactionProrationResponse, type IUnitTotals, type ITotals, type ISharedProductResponse } from '../index';
1
+ import { type IProductResponse, type ITotals, type ITransactionProrationResponse, type IUnitTotals } from '../index';
2
2
  export interface ITransactionLineItemResponse {
3
3
  id: string;
4
4
  price_id: string;
@@ -7,5 +7,5 @@ export interface ITransactionLineItemResponse {
7
7
  tax_rate: string;
8
8
  unit_totals?: IUnitTotals | null;
9
9
  totals?: ITotals | null;
10
- product?: ISharedProductResponse | null;
10
+ product?: IProductResponse | null;
11
11
  }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.0.2";
1
+ export declare const SDK_VERSION = "1.1.0";
package/dist/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = '1.0.2';
4
+ exports.SDK_VERSION = '1.1.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paddle/paddle-node-sdk",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
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/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1,18 +0,0 @@
1
- import { type ITimePeriod, type IMoneyResponse, type IUnitPriceOverrideResponse, type IPriceQuantity, type ICustomData, type IImportMetaResponse } from '../index';
2
- import { type TaxMode, type Status, type CatalogType } from '../../enums';
3
- export interface ISharedPriceResponse {
4
- id: string;
5
- product_id: string;
6
- description: string;
7
- type: CatalogType;
8
- name?: string | null;
9
- billing_cycle?: ITimePeriod | null;
10
- trial_period?: ITimePeriod | null;
11
- tax_mode: TaxMode;
12
- unit_price: IMoneyResponse;
13
- unit_price_overrides: IUnitPriceOverrideResponse[];
14
- quantity: IPriceQuantity;
15
- status: Status;
16
- custom_data?: ICustomData | null;
17
- import_meta?: IImportMetaResponse | null;
18
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,14 +0,0 @@
1
- import { type ICustomData, type IImportMetaResponse } from '../index';
2
- import { type TaxCategory, type Status, type CatalogType } from '../../enums';
3
- export interface ISharedProductResponse {
4
- id: string;
5
- name: string;
6
- type?: CatalogType | null;
7
- description?: string | null;
8
- tax_category: TaxCategory;
9
- image_url?: string | null;
10
- custom_data?: ICustomData | null;
11
- status: Status;
12
- created_at: string;
13
- import_meta?: IImportMetaResponse | null;
14
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });