Skip to content

Commit 49b8e4c

Browse files
v1.3.0 - 2024-04-18 (#24)
1 parent 8aada8c commit 49b8e4c

13 files changed

+91
-11
lines changed

.eslintrc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ extends: standard-with-typescript
55
parserOptions:
66
ecmaVersion: latest
77
sourceType: module
8+
project: tsconfig.cjs.json
89
rules:
910
'@typescript-eslint/semi': 'off'
1011
'@typescript-eslint/strict-boolean-expressions': 'off'

.github/workflows/build-test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ on:
55
branches:
66
- main
77
- v1.X
8+
- release/beta
89
pull_request:
910
branches:
1011
- main
1112
- v1.X
13+
- release/beta
1214

1315
concurrency:
1416
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
@@ -40,4 +42,4 @@ jobs:
4042
run: yarn build
4143

4244
- name: Test
43-
run: yarn test
45+
run: yarn test

.github/workflows/linting.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ on:
55
branches:
66
- main
77
- v1.X
8+
- release/beta
89
pull_request:
910
branches:
1011
- main
1112
- v1.X
13+
- release/beta
1214

1315
concurrency:
1416
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
@@ -39,4 +41,4 @@ jobs:
3941
- name: Lint
4042
run: |
4143
yarn lint
42-
yarn prettier
44+
yarn prettier

.github/workflows/publish-beta.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish to Beta Tag
2+
3+
on:
4+
push:
5+
branches:
6+
- release/beta
7+
8+
jobs:
9+
run-publish:
10+
name: Run publish
11+
runs-on: ubuntu-latest
12+
13+
permissions:
14+
contents: read
15+
actions: write
16+
17+
steps:
18+
- name: Check out git repository
19+
uses: actions/checkout@v3
20+
21+
- name: Set up Node.js
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: lts/*
25+
cache: "yarn"
26+
registry-url: 'https://registry.npmjs.org'
27+
28+
- name: Install yarn dependencies
29+
run: yarn install
30+
31+
- name: Build
32+
run: yarn build
33+
34+
- name: Test
35+
run: yarn test
36+
37+
- name: Publish
38+
run: yarn publish:beta
39+
env:
40+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ When we make [non-breaking changes](https://developer.paddle.com/api-reference/a
1212

1313
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.
1414

15+
## 1.3.0 - 2024-04-18
16+
17+
### Changed
18+
19+
- Updated the package to export both CommonJS and ES module formats.
20+
- Updated `Collection` to return `hasMore` and `estimatedTotal` properties
21+
22+
---
23+
1524
## 1.2.2 - 2024-04-03
1625

1726
### Fixed

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
{
22
"name": "@paddle/paddle-node-sdk",
3-
"version": "1.2.2",
3+
"version": "1.3.0",
44
"description": "A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.",
5-
"main": "./dist/index.js",
6-
"types": "./dist/index.d.ts",
5+
"main": "./dist/cjs/index.js",
6+
"module": "./dist/esm/index.js",
7+
"types": "./dist/types/index.d.ts",
78
"scripts": {
89
"test": "jest",
910
"prebuild": "node ./scripts/update-env-vars.js",
10-
"build": "yarn clean && tsc",
11+
"build": "yarn clean && tsc -b ./tsconfig.cjs.json ./tsconfig.esm.json ./tsconfig.types.json",
1112
"prettier": "prettier --check ./src",
1213
"prettier:fix": "prettier --check ./src --write",
1314
"lint": "eslint --ext .ts,.tsx ./src",

src/internal/api/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import fetch from 'node-fetch';
44
import { SDK_VERSION } from '../../version';
55
import { type PaddleOptions } from '../types/config';
66
import { Environment } from './environment';
7-
import { randomUUID } from 'crypto';
7+
import { randomUUID } from 'node:crypto';
88
import { Logger } from '../base/logger';
99
import { convertToSnakeCase } from './case-helpers';
1010
import { type ErrorResponse } from '../types/response';

src/internal/base/collection.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { ApiError } from '../errors/generic';
33
import { type ErrorResponse, type ResponsePaginated } from '../types/response';
44

55
export abstract class Collection<T, C> implements AsyncIterable<C> {
6-
private hasMore: boolean = true;
6+
public hasMore: boolean = true;
7+
public estimatedTotal: number = 0;
78
private nextLink: string;
89
private data: C[] = [];
910

@@ -21,6 +22,7 @@ export abstract class Collection<T, C> implements AsyncIterable<C> {
2122

2223
this.hasMore = handledResponse.meta.pagination.has_more ?? false;
2324
this.nextLink = handledResponse.meta.pagination.next;
25+
this.estimatedTotal = handledResponse.meta.pagination.estimated_total ?? 0;
2426
this.data = handledResponse.data.map((data) => this.fromJson(data));
2527

2628
return this.data.length > 0 ? this.data : [];

src/notifications/helpers/webhooks-validator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createHmac } from 'crypto';
1+
import { createHmac } from 'node:crypto';
22

33
interface ParsedHeaders {
44
ts: number;

tsconfig.json renamed to tsconfig.base.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"lib": ["ESNext"],
55
"module": "NodeNext",
66
"rootDir": "./src",
7-
"moduleResolution": "nodenext",
7+
"moduleResolution": "Node",
88
"baseUrl": "./src",
9-
"declaration": true,
9+
"declaration": false,
1010
"outDir": "./dist",
1111
"removeComments": true,
1212
"esModuleInterop": true,

tsconfig.cjs.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig.base.json",
3+
"compilerOptions": {
4+
"outDir": "./dist/cjs",
5+
"module": "commonjs"
6+
}
7+
}

tsconfig.esm.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "./tsconfig.base.json",
3+
"compilerOptions": {
4+
"outDir": "./dist/esm",
5+
"module": "esnext"
6+
}
7+
}

tsconfig.types.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"extends": "./tsconfig.base.json",
3+
"compilerOptions": {
4+
"outDir": "./dist/types",
5+
"declaration": true,
6+
"moduleResolution": "NodeNext",
7+
"emitDeclarationOnly": true
8+
}
9+
}

0 commit comments

Comments
 (0)