@paddle/paddle-node-sdk 0.2.4 → 0.2.5

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 (63) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/README.md +6 -3
  3. package/dist/entities/index.d.ts +1 -0
  4. package/dist/entities/index.js +1 -0
  5. package/dist/entities/report/index.d.ts +4 -0
  6. package/dist/entities/report/index.js +20 -0
  7. package/dist/entities/report/report-collection.d.ts +6 -0
  8. package/dist/entities/report/report-collection.js +11 -0
  9. package/dist/entities/report/report-csv.d.ts +5 -0
  10. package/dist/entities/report/report-csv.js +9 -0
  11. package/dist/entities/report/report-filters.d.ts +8 -0
  12. package/dist/entities/report/report-filters.js +12 -0
  13. package/dist/entities/report/report.d.ts +13 -0
  14. package/dist/entities/report/report.js +17 -0
  15. package/dist/enums/index.d.ts +1 -0
  16. package/dist/enums/index.js +1 -0
  17. package/dist/enums/report/index.d.ts +4 -0
  18. package/dist/enums/report/index.js +20 -0
  19. package/dist/enums/report/report-filter-name.d.ts +1 -0
  20. package/dist/enums/report/report-filter-name.js +2 -0
  21. package/dist/enums/report/report-filter-operator.d.ts +1 -0
  22. package/dist/enums/report/report-filter-operator.js +2 -0
  23. package/dist/enums/report/report-status.d.ts +1 -0
  24. package/dist/enums/report/report-status.js +2 -0
  25. package/dist/enums/report/report-type.d.ts +1 -0
  26. package/dist/enums/report/report-type.js +2 -0
  27. package/dist/notifications/events/index.d.ts +1 -0
  28. package/dist/notifications/events/index.js +1 -0
  29. package/dist/notifications/events/report/index.d.ts +2 -0
  30. package/dist/notifications/events/report/index.js +18 -0
  31. package/dist/notifications/events/report/report-created-event.d.ts +9 -0
  32. package/dist/notifications/events/report/report-created-event.js +14 -0
  33. package/dist/notifications/events/report/report-updated-event.d.ts +9 -0
  34. package/dist/notifications/events/report/report-updated-event.js +14 -0
  35. package/dist/notifications/helpers/types.d.ts +6 -4
  36. package/dist/notifications/helpers/types.js +2 -0
  37. package/dist/notifications/helpers/webhooks.js +4 -0
  38. package/dist/paddle.d.ts +2 -1
  39. package/dist/paddle.js +1 -0
  40. package/dist/resources/index.d.ts +1 -0
  41. package/dist/resources/index.js +1 -0
  42. package/dist/resources/reports/index.d.ts +10 -0
  43. package/dist/resources/reports/index.js +69 -0
  44. package/dist/resources/reports/operations/create-report-request-object.d.ts +6 -0
  45. package/dist/resources/reports/operations/create-report-request-object.js +2 -0
  46. package/dist/resources/reports/operations/index.d.ts +2 -0
  47. package/dist/resources/reports/operations/index.js +18 -0
  48. package/dist/resources/reports/operations/list-report-query-parameters.d.ts +7 -0
  49. package/dist/resources/reports/operations/list-report-query-parameters.js +2 -0
  50. package/dist/types/events/events-response.d.ts +8 -1
  51. package/dist/types/index.d.ts +1 -0
  52. package/dist/types/index.js +1 -0
  53. package/dist/types/report/index.d.ts +3 -0
  54. package/dist/types/report/index.js +19 -0
  55. package/dist/types/report/report-filters.d.ts +6 -0
  56. package/dist/types/report/report-filters.js +2 -0
  57. package/dist/types/report/report.d.ts +11 -0
  58. package/dist/types/report/report.js +2 -0
  59. package/dist/types/report/reports-csv.d.ts +3 -0
  60. package/dist/types/report/reports-csv.js +2 -0
  61. package/dist/version.d.ts +1 -1
  62. package/dist/version.js +1 -1
  63. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -8,6 +8,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
8
8
 
9
9
  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.
10
10
 
11
+ ## 0.2.5 - 2023-12-15
12
+
13
+ ### Added
14
+
15
+ - Added `reports.list()` to [list reports](https://developer.paddle.com/api-reference/reports/list-reports?utm_source=dx&utm_medium=paddle-node-sdk)
16
+ - Added `reports.create()` to [create a new report](https://developer.paddle.com/api-reference/reports/create-report?utm_source=dx&utm_medium=paddle-node-sdk)
17
+ - Added `reports.get()` to [get a report](https://developer.paddle.com/api-reference/reports/get-report?utm_source=dx&utm_medium=paddle-node-sdk)
18
+ - Added `reports.getReportCsv()` to [get a CSV file for a report](https://developer.paddle.com/api-reference/reports/get-report-csv?utm_source=dx&utm_medium=paddle-node-sdk)
19
+
20
+ ---
21
+
11
22
  ## 0.2.4 - 2023-12-14
12
23
 
13
24
  ### Changed
@@ -33,7 +44,6 @@ Check our main [developer changelog](https://developer.paddle.com/?utm_source=dx
33
44
  - Added `notifications.replay()` to [replay a notification](https://developer.paddle.com/api-reference/notifications/replay-notification?utm_source=dx&utm_medium=paddle-node-sdk)
34
45
  - Added `notifications.getLogs()` to [get all logs for a notification](https://developer.paddle.com/api-reference/notification-logs/list-notification-logs?utm_source=dx&utm_medium=paddle-node-sdk)
35
46
 
36
-
37
47
  ### Fixed
38
48
 
39
49
  - Fixed incorrect type of `action` in `subscriptions.scheduled_change`
package/README.md CHANGED
@@ -269,9 +269,7 @@ app.listen(3000)
269
269
 
270
270
  ## Feature parity
271
271
 
272
- While in early access, not all operations in the Paddle API are available in our Node.js SDK. We're working on complete feature parity for our final release.
273
-
274
- This table shows which operations are available as of the latest release.
272
+ The Node.js SDK has complete feature parity with the Paddle API. All operations in the Paddle API are supported.
275
273
 
276
274
  | Paddle API operation | Support |
277
275
  |----------------------------------------------|:--------:|
@@ -330,6 +328,11 @@ This table shows which operations are available as of the latest release.
330
328
  | Create an adjustment | ✅ |
331
329
  | **Pricing preview** | **Full** |
332
330
  | Preview prices | ✅ |
331
+ | **Reports** | **Full** |
332
+ | List reports | ✅ |
333
+ | Create a report | ✅ |
334
+ | Get a report | ✅ |
335
+ | Get a CSV file for a report | ✅ |
333
336
  | **Event types** | **Full** |
334
337
  | List event types | ✅ |
335
338
  | **Events** | **Full** |
@@ -13,4 +13,5 @@ export * from './payout';
13
13
  export * from './event-types';
14
14
  export * from './notification-settings';
15
15
  export * from './notifications';
16
+ export * from './report';
16
17
  export type CustomData = object;
@@ -29,3 +29,4 @@ __exportStar(require("./payout"), exports);
29
29
  __exportStar(require("./event-types"), exports);
30
30
  __exportStar(require("./notification-settings"), exports);
31
31
  __exportStar(require("./notifications"), exports);
32
+ __exportStar(require("./report"), exports);
@@ -0,0 +1,4 @@
1
+ export * from './report-filters';
2
+ export * from './report';
3
+ export * from './report-csv';
4
+ export * from './report-collection';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./report-filters"), exports);
18
+ __exportStar(require("./report"), exports);
19
+ __exportStar(require("./report-csv"), exports);
20
+ __exportStar(require("./report-collection"), exports);
@@ -0,0 +1,6 @@
1
+ import { Report } from '../../entities';
2
+ import { type IReportResponse } from '../../types';
3
+ import { Collection } from '../../internal/base';
4
+ export declare class ReportCollection extends Collection<IReportResponse, Report> {
5
+ fromJson(data: IReportResponse): Report;
6
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportCollection = void 0;
4
+ const entities_1 = require("../../entities");
5
+ const base_1 = require("../../internal/base");
6
+ class ReportCollection extends base_1.Collection {
7
+ fromJson(data) {
8
+ return new entities_1.Report(data);
9
+ }
10
+ }
11
+ exports.ReportCollection = ReportCollection;
@@ -0,0 +1,5 @@
1
+ import { type IReportCsvResponse } from '../../types';
2
+ export declare class ReportCsv {
3
+ readonly url: string;
4
+ constructor(response: IReportCsvResponse);
5
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportCsv = void 0;
4
+ class ReportCsv {
5
+ constructor(response) {
6
+ this.url = response.url;
7
+ }
8
+ }
9
+ exports.ReportCsv = ReportCsv;
@@ -0,0 +1,8 @@
1
+ import { type IReportFilters } from '../../types';
2
+ import { type ReportFilterName, type ReportFilterOperator } from '../../enums';
3
+ export declare class ReportFilters {
4
+ readonly name: ReportFilterName;
5
+ readonly operator: null | ReportFilterOperator;
6
+ readonly value: string[] | string;
7
+ constructor(reportFiltersResponse: IReportFilters);
8
+ }
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportFilters = void 0;
4
+ class ReportFilters {
5
+ constructor(reportFiltersResponse) {
6
+ var _a;
7
+ this.name = reportFiltersResponse.name;
8
+ this.operator = (_a = reportFiltersResponse.operator) !== null && _a !== void 0 ? _a : null;
9
+ this.value = reportFiltersResponse.value;
10
+ }
11
+ }
12
+ exports.ReportFilters = ReportFilters;
@@ -0,0 +1,13 @@
1
+ import { type IReportResponse } from '../../types';
2
+ import { ReportFilters } from '../index';
3
+ import { type ReportStatus, type ReportType } from '../../enums';
4
+ export declare class Report {
5
+ readonly id: string;
6
+ readonly status: ReportStatus;
7
+ readonly rows: number | null;
8
+ readonly type: ReportType;
9
+ readonly filters: ReportFilters[];
10
+ readonly expiresAt: string | null;
11
+ readonly createdAt: string;
12
+ constructor(reportResponse: IReportResponse);
13
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Report = void 0;
4
+ const index_1 = require("../index");
5
+ class Report {
6
+ constructor(reportResponse) {
7
+ var _a, _b, _c;
8
+ this.id = reportResponse.id;
9
+ this.status = reportResponse.status;
10
+ this.rows = (_a = reportResponse.rows) !== null && _a !== void 0 ? _a : null;
11
+ this.type = reportResponse.type;
12
+ this.filters = (_b = reportResponse.filters) === null || _b === void 0 ? void 0 : _b.map((filter) => new index_1.ReportFilters(filter));
13
+ this.expiresAt = (_c = reportResponse.expires_at) !== null && _c !== void 0 ? _c : null;
14
+ this.createdAt = reportResponse.created_at;
15
+ }
16
+ }
17
+ exports.Report = Report;
@@ -6,3 +6,4 @@ export * from './transaction';
6
6
  export * from './payout';
7
7
  export * from './notification-settings';
8
8
  export * from './notification';
9
+ export * from './report';
@@ -22,3 +22,4 @@ __exportStar(require("./transaction"), exports);
22
22
  __exportStar(require("./payout"), exports);
23
23
  __exportStar(require("./notification-settings"), exports);
24
24
  __exportStar(require("./notification"), exports);
25
+ __exportStar(require("./report"), exports);
@@ -0,0 +1,4 @@
1
+ export * from './report-status';
2
+ export * from './report-type';
3
+ export * from './report-filter-name';
4
+ export * from './report-filter-operator';
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./report-status"), exports);
18
+ __exportStar(require("./report-type"), exports);
19
+ __exportStar(require("./report-filter-name"), exports);
20
+ __exportStar(require("./report-filter-operator"), exports);
@@ -0,0 +1 @@
1
+ export type ReportFilterName = 'action' | 'collection_mode' | 'currency_code' | 'origin' | 'status' | 'updated_at';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type ReportFilterOperator = 'lt' | 'gte';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type ReportStatus = 'pending' | 'ready' | 'failed' | 'expired';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type ReportType = 'adjustments' | 'adjustment_line_items' | 'transactions' | 'transaction_line_items';
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -8,3 +8,4 @@ export * from './price';
8
8
  export * from './product';
9
9
  export * from './subscription';
10
10
  export * from './transaction';
11
+ export * from './report';
@@ -24,3 +24,4 @@ __exportStar(require("./price"), exports);
24
24
  __exportStar(require("./product"), exports);
25
25
  __exportStar(require("./subscription"), exports);
26
26
  __exportStar(require("./transaction"), exports);
27
+ __exportStar(require("./report"), exports);
@@ -0,0 +1,2 @@
1
+ export * from './report-created-event';
2
+ export * from './report-updated-event';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./report-created-event"), exports);
18
+ __exportStar(require("./report-updated-event"), exports);
@@ -0,0 +1,9 @@
1
+ import { Event } from '../../../entities/events/event';
2
+ import { Report } from '../../../entities';
3
+ import { EventName } from '../../helpers';
4
+ import { type IEventsResponse, type IReportResponse } from '../../../types';
5
+ export declare class ReportCreatedEvent extends Event {
6
+ readonly eventType = EventName.ReportCreated;
7
+ readonly data: Report;
8
+ constructor(response: IEventsResponse<IReportResponse>);
9
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportCreatedEvent = void 0;
4
+ const event_1 = require("../../../entities/events/event");
5
+ const entities_1 = require("../../../entities");
6
+ const helpers_1 = require("../../helpers");
7
+ class ReportCreatedEvent extends event_1.Event {
8
+ constructor(response) {
9
+ super(response);
10
+ this.eventType = helpers_1.EventName.ReportCreated;
11
+ this.data = new entities_1.Report(response.data);
12
+ }
13
+ }
14
+ exports.ReportCreatedEvent = ReportCreatedEvent;
@@ -0,0 +1,9 @@
1
+ import { Event } from '../../../entities/events/event';
2
+ import { Report } from '../../../entities';
3
+ import { EventName } from '../../helpers';
4
+ import { type IEventsResponse, type IReportResponse } from '../../../types';
5
+ export declare class ReportUpdatedEvent extends Event {
6
+ readonly eventType = EventName.ReportUpdated;
7
+ readonly data: Report;
8
+ constructor(response: IEventsResponse<IReportResponse>);
9
+ }
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ReportUpdatedEvent = void 0;
4
+ const event_1 = require("../../../entities/events/event");
5
+ const entities_1 = require("../../../entities");
6
+ const helpers_1 = require("../../helpers");
7
+ class ReportUpdatedEvent extends event_1.Event {
8
+ constructor(response) {
9
+ super(response);
10
+ this.eventType = helpers_1.EventName.ReportUpdated;
11
+ this.data = new entities_1.Report(response.data);
12
+ }
13
+ }
14
+ exports.ReportUpdatedEvent = ReportUpdatedEvent;
@@ -1,5 +1,5 @@
1
- import { type AddressCreatedEvent, type AddressUpdatedEvent, type BusinessCreatedEvent, type AdjustmentCreatedEvent, type AdjustmentUpdatedEvent, type BusinessUpdatedEvent, type CustomerCreatedEvent, type CustomerUpdatedEvent, type DiscountCreatedEvent, type DiscountImportedEvent, type DiscountUpdatedEvent, type PayoutCreatedEvent, type PayoutPaidEvent, type PriceCreatedEvent, type PriceUpdatedEvent, type ProductCreatedEvent, type ProductUpdatedEvent, type SubscriptionCreatedEvent, type SubscriptionActivatedEvent, type SubscriptionCanceledEvent, type SubscriptionImportedEvent, type SubscriptionPausedEvent, type SubscriptionResumedEvent, type SubscriptionTrialingEvent, type SubscriptionUpdatedEvent, type TransactionCanceledEvent, type TransactionBilledEvent, type TransactionCompletedEvent, type TransactionCreatedEvent, type TransactionPaidEvent, type SubscriptionPastDueEvent, type TransactionPastDueEvent, type TransactionPaymentFailedEvent, type TransactionReadyEvent, type TransactionUpdatedEvent } from '../events';
2
- export type EventEntity = AddressCreatedEvent | AddressUpdatedEvent | AdjustmentUpdatedEvent | AdjustmentCreatedEvent | BusinessCreatedEvent | BusinessUpdatedEvent | CustomerCreatedEvent | CustomerUpdatedEvent | DiscountCreatedEvent | DiscountUpdatedEvent | DiscountImportedEvent | PayoutCreatedEvent | PayoutPaidEvent | PriceCreatedEvent | PriceUpdatedEvent | ProductCreatedEvent | ProductUpdatedEvent | SubscriptionActivatedEvent | SubscriptionCanceledEvent | SubscriptionCreatedEvent | SubscriptionImportedEvent | SubscriptionPastDueEvent | SubscriptionPausedEvent | SubscriptionResumedEvent | SubscriptionTrialingEvent | SubscriptionUpdatedEvent | TransactionBilledEvent | TransactionCanceledEvent | TransactionCompletedEvent | TransactionCreatedEvent | TransactionPaidEvent | TransactionPastDueEvent | TransactionPaymentFailedEvent | TransactionReadyEvent | TransactionUpdatedEvent;
1
+ import { type AddressCreatedEvent, type AddressUpdatedEvent, type BusinessCreatedEvent, type AdjustmentCreatedEvent, type AdjustmentUpdatedEvent, type BusinessUpdatedEvent, type CustomerCreatedEvent, type CustomerUpdatedEvent, type DiscountCreatedEvent, type DiscountImportedEvent, type DiscountUpdatedEvent, type PayoutCreatedEvent, type PayoutPaidEvent, type PriceCreatedEvent, type PriceUpdatedEvent, type ProductCreatedEvent, type ProductUpdatedEvent, type SubscriptionCreatedEvent, type SubscriptionActivatedEvent, type SubscriptionCanceledEvent, type SubscriptionImportedEvent, type SubscriptionPausedEvent, type SubscriptionResumedEvent, type SubscriptionTrialingEvent, type SubscriptionUpdatedEvent, type TransactionCanceledEvent, type TransactionBilledEvent, type TransactionCompletedEvent, type TransactionCreatedEvent, type TransactionPaidEvent, type SubscriptionPastDueEvent, type TransactionPastDueEvent, type TransactionPaymentFailedEvent, type TransactionReadyEvent, type TransactionUpdatedEvent, type ReportUpdatedEvent, type ReportCreatedEvent } from '../events';
2
+ export type EventEntity = AddressCreatedEvent | AddressUpdatedEvent | AdjustmentUpdatedEvent | AdjustmentCreatedEvent | BusinessCreatedEvent | BusinessUpdatedEvent | CustomerCreatedEvent | CustomerUpdatedEvent | DiscountCreatedEvent | DiscountUpdatedEvent | DiscountImportedEvent | PayoutCreatedEvent | PayoutPaidEvent | PriceCreatedEvent | PriceUpdatedEvent | ProductCreatedEvent | ProductUpdatedEvent | SubscriptionActivatedEvent | SubscriptionCanceledEvent | SubscriptionCreatedEvent | SubscriptionImportedEvent | SubscriptionPastDueEvent | SubscriptionPausedEvent | SubscriptionResumedEvent | SubscriptionTrialingEvent | SubscriptionUpdatedEvent | TransactionBilledEvent | TransactionCanceledEvent | TransactionCompletedEvent | TransactionCreatedEvent | TransactionPaidEvent | TransactionPastDueEvent | TransactionPaymentFailedEvent | TransactionReadyEvent | TransactionUpdatedEvent | ReportUpdatedEvent | ReportCreatedEvent;
3
3
  export declare enum EventName {
4
4
  AddressCreated = "address.created",
5
5
  AddressUpdated = "address.updated",
@@ -35,6 +35,8 @@ export declare enum EventName {
35
35
  TransactionPastDue = "transaction.past_due",
36
36
  TransactionPaymentFailed = "transaction.payment_failed",
37
37
  TransactionReady = "transaction.ready",
38
- TransactionUpdated = "transaction.updated"
38
+ TransactionUpdated = "transaction.updated",
39
+ ReportCreated = "report.created",
40
+ ReportUpdated = "report.updated"
39
41
  }
40
- export type IEventName = 'address.created' | 'address.updated' | 'adjustment.created' | 'adjustment.updated' | 'business.created' | 'business.updated' | 'customer.created' | 'customer.updated' | 'discount.created' | 'discount.updated' | 'discount.imported' | 'payout.updated' | 'payout.paid' | 'price.updated' | 'price.created' | 'product.updated' | 'product.created' | 'subscription.activated' | 'subscription.canceled' | 'subscription.imported' | 'subscription.created' | 'subscription.past_due' | 'subscription.paused' | 'subscription.resumed' | 'subscription.trialing' | 'subscription.updated' | 'transaction.billed' | 'transaction.canceled' | 'transaction.completed' | 'transaction.paid' | 'transaction.created' | 'transaction.past_due' | 'transaction.payment_failed' | 'transaction.ready' | 'transaction.updated';
42
+ export type IEventName = 'address.created' | 'address.updated' | 'adjustment.created' | 'adjustment.updated' | 'business.created' | 'business.updated' | 'customer.created' | 'customer.updated' | 'discount.created' | 'discount.updated' | 'discount.imported' | 'payout.updated' | 'payout.paid' | 'price.updated' | 'price.created' | 'product.updated' | 'product.created' | 'subscription.activated' | 'subscription.canceled' | 'subscription.imported' | 'subscription.created' | 'subscription.past_due' | 'subscription.paused' | 'subscription.resumed' | 'subscription.trialing' | 'subscription.updated' | 'transaction.billed' | 'transaction.canceled' | 'transaction.completed' | 'transaction.paid' | 'transaction.created' | 'transaction.past_due' | 'transaction.payment_failed' | 'transaction.ready' | 'transaction.updated' | 'report.created' | 'report.updated';
@@ -38,4 +38,6 @@ var EventName;
38
38
  EventName["TransactionPaymentFailed"] = "transaction.payment_failed";
39
39
  EventName["TransactionReady"] = "transaction.ready";
40
40
  EventName["TransactionUpdated"] = "transaction.updated";
41
+ EventName["ReportCreated"] = "report.created";
42
+ EventName["ReportUpdated"] = "report.updated";
41
43
  })(EventName || (exports.EventName = EventName = {}));
@@ -91,6 +91,10 @@ class Webhooks {
91
91
  return new events_1.TransactionReadyEvent(data);
92
92
  case types_1.EventName.TransactionUpdated:
93
93
  return new events_1.TransactionUpdatedEvent(data);
94
+ case types_1.EventName.ReportCreated:
95
+ return new events_1.ReportCreatedEvent(data);
96
+ case types_1.EventName.ReportUpdated:
97
+ return new events_1.ReportUpdatedEvent(data);
94
98
  default:
95
99
  logger_1.Logger.log('Unknown event_type');
96
100
  return null;
package/dist/paddle.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomersResource, DiscountsResource, EventTypesResource, NotificationSettingsResource, NotificationsResource, PricesResource, PricingPreviewResource, ProductsResource, SubscriptionsResource, TransactionsResource } from './resources';
1
+ import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomersResource, DiscountsResource, EventTypesResource, NotificationSettingsResource, NotificationsResource, PricesResource, PricingPreviewResource, ProductsResource, ReportsResource, SubscriptionsResource, TransactionsResource } from './resources';
2
2
  import { type PaddleOptions } from './internal';
3
3
  import { EventsResource } from './resources/events';
4
4
  import { Webhooks } from './notifications';
@@ -20,5 +20,6 @@ export declare class Paddle {
20
20
  eventTypes: EventTypesResource;
21
21
  notificationSettings: NotificationSettingsResource;
22
22
  notifications: NotificationsResource;
23
+ reports: ReportsResource;
23
24
  constructor(apiKey: string, options?: PaddleOptions);
24
25
  }
package/dist/paddle.js CHANGED
@@ -27,6 +27,7 @@ class Paddle {
27
27
  this.eventTypes = new resources_1.EventTypesResource(this.client);
28
28
  this.notificationSettings = new resources_1.NotificationSettingsResource(this.client);
29
29
  this.notifications = new resources_1.NotificationsResource(this.client);
30
+ this.reports = new resources_1.ReportsResource(this.client);
30
31
  }
31
32
  }
32
33
  exports.Paddle = Paddle;
@@ -11,3 +11,4 @@ export * from './pricing-preview';
11
11
  export * from './event-types';
12
12
  export * from './notification-settings';
13
13
  export * from './notifications';
14
+ export * from './reports';
@@ -27,3 +27,4 @@ __exportStar(require("./pricing-preview"), exports);
27
27
  __exportStar(require("./event-types"), exports);
28
28
  __exportStar(require("./notification-settings"), exports);
29
29
  __exportStar(require("./notifications"), exports);
30
+ __exportStar(require("./reports"), exports);
@@ -0,0 +1,10 @@
1
+ import { Report, ReportCollection, ReportCsv } from '../../entities';
2
+ import { BaseResource } from '../../internal/base';
3
+ import { type CreateReportRequestBody, type ListReportQueryParameters } from './operations';
4
+ export * from './operations';
5
+ export declare class ReportsResource extends BaseResource {
6
+ list(queryParams?: ListReportQueryParameters): ReportCollection;
7
+ create(createReportParameters: CreateReportRequestBody): Promise<Report>;
8
+ get(reportId: string): Promise<Report>;
9
+ getReportCsv(reportId: string): Promise<ReportCsv>;
10
+ }
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
17
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
18
+ return new (P || (P = Promise))(function (resolve, reject) {
19
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
20
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
21
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
22
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
23
+ });
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.ReportsResource = void 0;
27
+ const entities_1 = require("../../entities");
28
+ const base_1 = require("../../internal/base");
29
+ const ReportPaths = {
30
+ list: '/reports',
31
+ create: '/reports',
32
+ get: '/reports/{report_id}',
33
+ getReportCsv: '/reports/{report_id}/download-url',
34
+ };
35
+ __exportStar(require("./operations"), exports);
36
+ class ReportsResource extends base_1.BaseResource {
37
+ list(queryParams) {
38
+ const queryParameters = new base_1.QueryParameters(queryParams);
39
+ return new entities_1.ReportCollection(this.client, ReportPaths.list + '?' + queryParameters.toQueryString());
40
+ }
41
+ create(createReportParameters) {
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ const response = yield this.client.post(ReportPaths.create, createReportParameters);
44
+ const data = this.handleResponse(response);
45
+ return new entities_1.Report(data);
46
+ });
47
+ }
48
+ get(reportId) {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ const urlWithPathParams = new base_1.PathParameters(ReportPaths.get, {
51
+ report_id: reportId,
52
+ }).deriveUrl();
53
+ const response = yield this.client.get(urlWithPathParams);
54
+ const data = this.handleResponse(response);
55
+ return new entities_1.Report(data);
56
+ });
57
+ }
58
+ getReportCsv(reportId) {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ const urlWithPathParams = new base_1.PathParameters(ReportPaths.getReportCsv, {
61
+ report_id: reportId,
62
+ }).deriveUrl();
63
+ const response = yield this.client.get(urlWithPathParams);
64
+ const data = this.handleResponse(response);
65
+ return new entities_1.ReportCsv(data);
66
+ });
67
+ }
68
+ }
69
+ exports.ReportsResource = ReportsResource;
@@ -0,0 +1,6 @@
1
+ import { type IReportFilters } from '../../../types';
2
+ import { type ReportType } from '../../../enums';
3
+ export interface CreateReportRequestBody {
4
+ type: ReportType;
5
+ filters?: IReportFilters[] | null;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export * from './list-report-query-parameters';
2
+ export * from './create-report-request-object';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./list-report-query-parameters"), exports);
18
+ __exportStar(require("./create-report-request-object"), exports);
@@ -0,0 +1,7 @@
1
+ import { type ReportStatus } from '../../../enums';
2
+ export interface ListReportQueryParameters {
3
+ after?: string;
4
+ orderBy?: string;
5
+ perPage?: number;
6
+ status?: ReportStatus[];
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -9,6 +9,7 @@ import { type IProductResponse } from '../product';
9
9
  import { type ISubscriptionNotificationResponse } from '../subscription';
10
10
  import { type ITransactionResponse } from '../transaction';
11
11
  import { type IPayoutResponse } from '../payout';
12
+ import { type IReportResponse } from '../report';
12
13
  export interface IEventsResponse<T = object> {
13
14
  event_id: string;
14
15
  notification_id: string;
@@ -121,5 +122,11 @@ interface ITransactionReady extends IEventsResponse<ITransactionResponse> {
121
122
  interface ITransactionUpdated extends IEventsResponse<ITransactionResponse> {
122
123
  event_type: EventName.TransactionUpdated;
123
124
  }
124
- export type IEvents = IAddressCreated | IAddressUpdated | IAdjustmentCreated | IAdjustmentUpdated | IBusinessCreated | IBusinessUpdated | ICustomerCreated | ICustomerUpdated | IDiscountCreated | IDiscountUpdated | IDiscountImported | IPayoutCreated | IPayoutPaid | IPriceCreated | IPriceUpdated | IProductCreated | IProductUpdated | ISubscriptionActivated | ISubscriptionCanceled | ISubscriptionCreated | ISubscriptionImported | ISubscriptionPastDue | ISubscriptionPaused | ISubscriptionResumed | ISubscriptionTrialing | ISubscriptionUpdated | ITransactionBilled | ITransactionCanceled | ITransactionCompleted | ITransactionCreated | ITransactionPaid | ITransactionPastDue | ITransactionPaymentFailed | ITransactionReady | ITransactionUpdated;
125
+ interface IReportCreated extends IEventsResponse<IReportResponse> {
126
+ event_type: EventName.ReportCreated;
127
+ }
128
+ interface IReportUpdated extends IEventsResponse<IReportResponse> {
129
+ event_type: EventName.ReportUpdated;
130
+ }
131
+ export type IEvents = IAddressCreated | IAddressUpdated | IAdjustmentCreated | IAdjustmentUpdated | IBusinessCreated | IBusinessUpdated | ICustomerCreated | ICustomerUpdated | IDiscountCreated | IDiscountUpdated | IDiscountImported | IPayoutCreated | IPayoutPaid | IPriceCreated | IPriceUpdated | IProductCreated | IProductUpdated | ISubscriptionActivated | ISubscriptionCanceled | ISubscriptionCreated | ISubscriptionImported | ISubscriptionPastDue | ISubscriptionPaused | ISubscriptionResumed | ISubscriptionTrialing | ISubscriptionUpdated | ITransactionBilled | ITransactionCanceled | ITransactionCompleted | ITransactionCreated | ITransactionPaid | ITransactionPastDue | ITransactionPaymentFailed | ITransactionReady | ITransactionUpdated | IReportCreated | IReportUpdated;
125
132
  export {};
@@ -14,3 +14,4 @@ export * from './payout';
14
14
  export * from './event-types';
15
15
  export * from './notification-settings';
16
16
  export * from './notifications';
17
+ export * from './report';
@@ -30,3 +30,4 @@ __exportStar(require("./payout"), exports);
30
30
  __exportStar(require("./event-types"), exports);
31
31
  __exportStar(require("./notification-settings"), exports);
32
32
  __exportStar(require("./notifications"), exports);
33
+ __exportStar(require("./report"), exports);
@@ -0,0 +1,3 @@
1
+ export * from './report-filters';
2
+ export * from './report';
3
+ export * from './reports-csv';
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./report-filters"), exports);
18
+ __exportStar(require("./report"), exports);
19
+ __exportStar(require("./reports-csv"), exports);
@@ -0,0 +1,6 @@
1
+ import { type ReportFilterName, type ReportFilterOperator } from '../../enums';
2
+ export interface IReportFilters {
3
+ name: ReportFilterName;
4
+ operator?: null | ReportFilterOperator;
5
+ value: string[] | string;
6
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ import { type IReportFilters } from '../index';
2
+ import { type ReportType, type ReportStatus } from '../../enums';
3
+ export interface IReportResponse {
4
+ id: string;
5
+ status: ReportStatus;
6
+ rows?: number | null;
7
+ type: ReportType;
8
+ filters: IReportFilters[];
9
+ expires_at?: string | null;
10
+ created_at: string;
11
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ export interface IReportCsvResponse {
2
+ url: string;
3
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.2.4";
1
+ export declare const SDK_VERSION = "0.2.5";
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 = '0.2.4';
4
+ exports.SDK_VERSION = '0.2.5';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paddle/paddle-node-sdk",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "A NodeJS SDK for Paddle Billing API",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",