Skip to content

Commit

Permalink
Simulations 2.0 (#54)
Browse files Browse the repository at this point in the history
* feat(SimulationTypes): Add simulation types resource

* chore: remove payment_method events

* feat(Simulations): Add simulation resource

* chore(Simulations): update request body types

* chore: remove unused import

* feat(Simulations): Add simulation runs resources

* feat(Simulations): Add simulation run events resources

* chore: clean up unused vars

* feat(Simulations): narrow down simulation payload types (#52)

* feat(Simulations): narrow down simulation payload types

* refactor(Simulations): rename event map

* fix(Simulations): Include scenarios in union

* refactor(Simulations): rename DiscriminatedEventResponse

* chore: bump version

* fix(Simulations): update imports

* chore: update import
  • Loading branch information
danbillson authored Oct 15, 2024
1 parent efd9e66 commit c5cd863
Show file tree
Hide file tree
Showing 65 changed files with 1,810 additions and 9 deletions.
25 changes: 18 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ When we make [non-breaking changes](https://developer.paddle.com/api-reference/a

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.

## 2.0.0-rc.1 - 2024-10-08

### Added

- Added `simulationTypes` resources
- Added `simulations` resources
- Added `simulationRuns` resources
- Added `simulationRunEvents` resources

---

## 2.0.0-rc.0 - 2024-09-26

> **Breaking changes:** This version includes major improvements that introduce breaking changes. These are called out below.
Expand Down Expand Up @@ -40,7 +51,7 @@ This means when upgrading minor versions of the SDK, you may notice type errors.
## 1.6.0 - 2024-09-16

### Added

- Added `adjustments.getCreditNotePDF()` to [get a credit note for an adjustment](https://developer.paddle.com/api-reference/adjustments/get-credit-note-pdf?utm_source=dx&utm_medium=paddle-node-sdk)
- Added `disposition` query parameter to `adjustments.getCreditNotePDF()` and `transactions.getInvoicePDF()` operations, see [related changelog](https://developer.paddle.com/changelog/2024/invoice-pdf-open-in-browser?utm_source=dx&utm_medium=paddle-node-sdk).
- Added pagination support to `notificationSettings.list()` operation, see [related changelog](https://developer.paddle.com/changelog/2024/notification-settings-pagination?utm_source=dx&utm_medium=paddle-node-sdk).
Expand Down Expand Up @@ -170,7 +181,7 @@ This means when upgrading minor versions of the SDK, you may notice type errors.
### Removed

- **Breaking change:** Removed `*Includes` entity in favour of standard entities.

- Use `Price` instead of `PriceWithIncludes`
- Use `Product` instead of `ProductWithIncludes`
- Use `Subscription` instead of `SubscriptionIncludes`
Expand Down Expand Up @@ -230,7 +241,7 @@ This means when upgrading minor versions of the SDK, you may notice type errors.

### Fixed

- Marked `unitPriceOverrides` as optional in Price entity.
- Marked `unitPriceOverrides` as optional in Price entity.

---

Expand Down Expand Up @@ -290,7 +301,7 @@ This means when upgrading minor versions of the SDK, you may notice type errors.
- Added `notificationSettings.get()` to [get a notification settings](https://developer.paddle.com/api-reference/notification-settings/get-notification-setting?utm_source=dx&utm_medium=paddle-node-sdk)
- Added `notificationSettings.update()` to [update a notification settings](https://developer.paddle.com/api-reference/notification-settings/update-notification-setting?utm_source=dx&utm_medium=paddle-node-sdk)
- Added `notificationSettings.delete()` to [delete a notification settings](https://developer.paddle.com/api-reference/notification-settings/delete-notification-setting?utm_source=dx&utm_medium=paddle-node-sdk)
- Added `notifications.list()` to [list all notifications](https://developer.paddle.com/api-reference/notifications/list-notifications?utm_source=dx&utm_medium=paddle-node-sdk)
- Added `notifications.list()` to [list all notifications](https://developer.paddle.com/api-reference/notifications/list-notifications?utm_source=dx&utm_medium=paddle-node-sdk)
- Added `notifications.get()` to [get a notification](https://developer.paddle.com/api-reference/notifications/get-notification?utm_source=dx&utm_medium=paddle-node-sdk)
- Added `notifications.replay()` to [replay a notification](https://developer.paddle.com/api-reference/notifications/replay-notification?utm_source=dx&utm_medium=paddle-node-sdk)
- 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)
Expand All @@ -315,7 +326,7 @@ This means when upgrading minor versions of the SDK, you may notice type errors.
### Added

- Added helper function to archive supported entities
- Added `pricingPreview.preview()` to [preview calculations for one or more prices](https://developer.paddle.com/api-reference/pricing-preview/preview-prices?utm_source=dx&utm_medium=paddle-node-sdk)
- Added `pricingPreview.preview()` to [preview calculations for one or more prices](https://developer.paddle.com/api-reference/pricing-preview/preview-prices?utm_source=dx&utm_medium=paddle-node-sdk)

### Changed

Expand Down Expand Up @@ -363,15 +374,15 @@ This means when upgrading minor versions of the SDK, you may notice type errors.

- Added changelog.

---
---

## 0.1.6 - 2023-11-22

### Fixed

- Fixed optional management URL object in subscription entities.

---
---

## 0.1.5 - 2023-11-14

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@paddle/paddle-node-sdk",
"version": "2.0.0-rc.0",
"version": "2.0.0-rc.1",
"description": "A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.",
"main": "dist/cjs/index.cjs.node.js",
"module": "dist/esm/index.esm.node.js",
Expand Down
39 changes: 39 additions & 0 deletions src/__tests__/mocks/resources/simulation-run-events.mock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* ! Autogenerated code !
* Do not make changes to this file.
* Changes may be overwritten as part of auto-generation.
*/

import { ISimulationRunEventResponse } from '../../../types/index.js';
import { Response, ResponsePaginated } from '../../../internal/index.js';

export const SimulationRunEventMock: ISimulationRunEventResponse = {
id: 'ntfsimevt_123',
status: 'success',
event_type: 'subscription.created',
payload: {},
request: null,
response: null,
created_at: '2024-09-18T12:24:47.960617Z',
updated_at: '2024-09-18T12:24:48.309530Z',
};

export const SimulationRunEventMockResponse: Response<ISimulationRunEventResponse> = {
data: SimulationRunEventMock,
meta: {
request_id: '',
},
};

export const ListSimulationRunEventMockResponse: ResponsePaginated<ISimulationRunEventResponse> = {
data: [SimulationRunEventMock],
meta: {
request_id: '',
pagination: {
estimated_total: 10,
has_more: true,
next: '/simulations/ntfsim_123/runs/ntfsimrun_123/events?after=1',
per_page: 10,
},
},
};
36 changes: 36 additions & 0 deletions src/__tests__/mocks/resources/simulation-runs.mock.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* ! Autogenerated code !
* Do not make changes to this file.
* Changes may be overwritten as part of auto-generation.
*/

import { ISimulationRunResponse } from '../../../types/index.js';
import { Response, ResponsePaginated } from '../../../internal/index.js';

export const SimulationRunMock: ISimulationRunResponse = {
id: 'ntfsimrun_01j82gvz2cgw08p7mak3gcd3a3',
status: 'completed',
type: 'subscription_creation',
created_at: '2024-09-18T12:14:15.628606Z',
updated_at: '2024-09-18T12:14:27.244695Z',
};

export const SimulationRunMockResponse: Response<ISimulationRunResponse> = {
data: SimulationRunMock,
meta: {
request_id: '',
},
};

export const ListSimulationRunMockResponse: ResponsePaginated<ISimulationRunResponse> = {
data: [SimulationRunMock],
meta: {
request_id: '',
pagination: {
estimated_total: 10,
has_more: true,
next: '/simulations/ntfsim_123/runs?after=1',
per_page: 10,
},
},
};
Loading

0 comments on commit c5cd863

Please sign in to comment.