Skip to content

Commit

Permalink
v1.3.0 - 2024-04-18 (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
vijayasingam-paddle authored Apr 18, 2024
1 parent 8aada8c commit 49b8e4c
Show file tree
Hide file tree
Showing 13 changed files with 91 additions and 11 deletions.
1 change: 1 addition & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ extends: standard-with-typescript
parserOptions:
ecmaVersion: latest
sourceType: module
project: tsconfig.cjs.json
rules:
'@typescript-eslint/semi': 'off'
'@typescript-eslint/strict-boolean-expressions': 'off'
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ on:
branches:
- main
- v1.X
- release/beta
pull_request:
branches:
- main
- v1.X
- release/beta

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

- name: Test
run: yarn test
run: yarn test
4 changes: 3 additions & 1 deletion .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ on:
branches:
- main
- v1.X
- release/beta
pull_request:
branches:
- main
- v1.X
- release/beta

concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }}
Expand Down Expand Up @@ -39,4 +41,4 @@ jobs:
- name: Lint
run: |
yarn lint
yarn prettier
yarn prettier
40 changes: 40 additions & 0 deletions .github/workflows/publish-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish to Beta Tag

on:
push:
branches:
- release/beta

jobs:
run-publish:
name: Run publish
runs-on: ubuntu-latest

permissions:
contents: read
actions: write

steps:
- name: Check out git repository
uses: actions/checkout@v3

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*
cache: "yarn"
registry-url: 'https://registry.npmjs.org'

- name: Install yarn dependencies
run: yarn install

- name: Build
run: yarn build

- name: Test
run: yarn test

- name: Publish
run: yarn publish:beta
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ 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.

## 1.3.0 - 2024-04-18

### Changed

- Updated the package to export both CommonJS and ES module formats.
- Updated `Collection` to return `hasMore` and `estimatedTotal` properties

---

## 1.2.2 - 2024-04-03

### Fixed
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "@paddle/paddle-node-sdk",
"version": "1.2.2",
"version": "1.3.0",
"description": "A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"main": "./dist/cjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/types/index.d.ts",
"scripts": {
"test": "jest",
"prebuild": "node ./scripts/update-env-vars.js",
"build": "yarn clean && tsc",
"build": "yarn clean && tsc -b ./tsconfig.cjs.json ./tsconfig.esm.json ./tsconfig.types.json",
"prettier": "prettier --check ./src",
"prettier:fix": "prettier --check ./src --write",
"lint": "eslint --ext .ts,.tsx ./src",
Expand Down
2 changes: 1 addition & 1 deletion src/internal/api/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import fetch from 'node-fetch';
import { SDK_VERSION } from '../../version';
import { type PaddleOptions } from '../types/config';
import { Environment } from './environment';
import { randomUUID } from 'crypto';
import { randomUUID } from 'node:crypto';
import { Logger } from '../base/logger';
import { convertToSnakeCase } from './case-helpers';
import { type ErrorResponse } from '../types/response';
Expand Down
4 changes: 3 additions & 1 deletion src/internal/base/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { ApiError } from '../errors/generic';
import { type ErrorResponse, type ResponsePaginated } from '../types/response';

export abstract class Collection<T, C> implements AsyncIterable<C> {
private hasMore: boolean = true;
public hasMore: boolean = true;
public estimatedTotal: number = 0;
private nextLink: string;
private data: C[] = [];

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

this.hasMore = handledResponse.meta.pagination.has_more ?? false;
this.nextLink = handledResponse.meta.pagination.next;
this.estimatedTotal = handledResponse.meta.pagination.estimated_total ?? 0;
this.data = handledResponse.data.map((data) => this.fromJson(data));

return this.data.length > 0 ? this.data : [];
Expand Down
2 changes: 1 addition & 1 deletion src/notifications/helpers/webhooks-validator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createHmac } from 'crypto';
import { createHmac } from 'node:crypto';

interface ParsedHeaders {
ts: number;
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json → tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"lib": ["ESNext"],
"module": "NodeNext",
"rootDir": "./src",
"moduleResolution": "nodenext",
"moduleResolution": "Node",
"baseUrl": "./src",
"declaration": true,
"declaration": false,
"outDir": "./dist",
"removeComments": true,
"esModuleInterop": true,
Expand Down
7 changes: 7 additions & 0 deletions tsconfig.cjs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist/cjs",
"module": "commonjs"
}
}
7 changes: 7 additions & 0 deletions tsconfig.esm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist/esm",
"module": "esnext"
}
}
9 changes: 9 additions & 0 deletions tsconfig.types.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist/types",
"declaration": true,
"moduleResolution": "NodeNext",
"emitDeclarationOnly": true
}
}

0 comments on commit 49b8e4c

Please sign in to comment.