Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ Explain the **details** for making this change. What existing problem does the p

Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI.

<!-- Make sure tests pass on both Travis and Circle CI. -->
<!-- Make sure `npm test`, `npm run lint`, and `npm run build` pass before submitting. -->

**Code formatting**

<!-- See the simple style guide. -->
Ensure your code follows the existing style. Run `npm run lint` before submitting.

**Closing issues**

Expand Down
42 changes: 33 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
![wrapsplash-logo](public/logo.png)
# WrapSplashTS v5.0.0
<div align="center">
<img src="public/logo.png" alt="wrapsplash-logo" width="600">

[![license](https://img.shields.io/github/license/SandeepVattapparambil/wrapsplash.svg)](https://github.com/SandeepVattapparambil/wrapsplash/blob/master/LICENSE) ![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg) ![npm version](https://badge.fury.io/js/wrapsplash.svg) [![CI](https://github.com/SandeepVattapparambil/wrapsplash/workflows/CI/badge.svg)](https://github.com/SandeepVattapparambil/wrapsplash/actions?query=workflow%3ACI) [![codecov](https://codecov.io/gh/SandeepVattapparambil/wrapsplash/branch/main/graph/badge.svg)](https://codecov.io/gh/SandeepVattapparambil/wrapsplash) ![GitHub issues](https://img.shields.io/github/issues/SandeepVattapparambil/wrapsplash.svg) ![GitHub forks](https://img.shields.io/github/forks/SandeepVattapparambil/wrapsplash.svg) ![GitHub stars](https://img.shields.io/github/stars/SandeepVattapparambil/wrapsplash.svg)
# WrapSplashTS v5.1.0

[![license](https://img.shields.io/github/license/SandeepVattapparambil/wrapsplash.svg)](https://github.com/SandeepVattapparambil/wrapsplash/blob/master/LICENSE) ![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg) ![npm version](https://badge.fury.io/js/wrapsplash.svg) [![CI](https://github.com/SandeepVattapparambil/wrapsplash/workflows/CI/badge.svg)](https://github.com/SandeepVattapparambil/wrapsplash/actions?query=workflow%3ACI) [![codecov](https://codecov.io/gh/SandeepVattapparambil/wrapsplash/branch/main/graph/badge.svg)](https://codecov.io/gh/SandeepVattapparambil/wrapsplash) ![coverage](https://img.shields.io/badge/coverage-97.8%25-brightgreen) ![GitHub issues](https://img.shields.io/github/issues/SandeepVattapparambil/wrapsplash.svg) ![GitHub forks](https://img.shields.io/github/forks/SandeepVattapparambil/wrapsplash.svg) ![GitHub stars](https://img.shields.io/github/stars/SandeepVattapparambil/wrapsplash.svg)

<img src="public/badge.png" alt="wrapsplash-badge" width="200">

</div>

WrapSplashTS is a simple, promise-based API wrapper for the popular [Unsplash](https://unsplash.com/) platform. The library is now written in **TypeScript**, bundled with **Vite**, and can be used in both Node.js and browser-based projects.
Unsplash provides beautiful high quality free images and photos that you can download and use for any project without any attribution.
Expand All @@ -13,13 +18,14 @@ Before using the Unsplash API, you need to **register as a developer** and **rea

## Table of Contents
<!--ts-->
* [About](#wrapsplashts-v500)
* [About](#wrapsplashts-v510)
* [Installation](#installation)
* [Sample Usage](#sample-usage)
* [Development](#development)
* [New API aliases](#new-api-aliases)
* [Dependency](#dependency)
* [Changelog](#changelog)
* [v5.1.0](#v510)
* [v5.0.0](#v500)
* [v4.2.0](#v420)
* [v4.1.1](#v411)
Expand Down Expand Up @@ -107,15 +113,15 @@ Install the package from NPM
npm install --save wrapsplash
```

The package exposes the main class through the CommonJS entry point in [index.js](index.js), which loads the built distribution bundle.
The package exposes the main class through ES module and CommonJS entry points configured via the `exports` field in `package.json`.

### Sample usage
```js
// CommonJS
const WrapSplash = require('wrapsplash');

// ES modules
// import WrapSplash from 'wrapsplash';
import WrapSplash from 'wrapsplash';

const unsplash = new WrapSplash();

Expand Down Expand Up @@ -154,6 +160,15 @@ npm run test:coverage
# Coverage report will be generated in ./coverage directory
```

#### Current Coverage (v5.1.0)

| Metric | Coverage | Threshold |
| --- | --- | --- |
| Statements | 97.8% | 80% |
| Branches | 79.5% | 55% |
| Functions | 98.4% | 80% |
| Lines | 97.8% | 80% |

Coverage thresholds (enforced):
- **Lines:** 80%
- **Functions:** 80%
Expand Down Expand Up @@ -184,9 +199,20 @@ unsplash.createNewCollection('My Collection');
}
```
### Dependency
This library depends on [axios](https://www.npmjs.com/package/axios) and [crypto-js](https://www.npmjs.com/package/crypto-js) to make requests and generate required request headers for the [Unsplash API](https://unsplash.com/documentation).
This library depends on [axios](https://www.npmjs.com/package/axios) to make requests and generates required request headers for the [Unsplash API](https://unsplash.com/documentation).

### Changelog
#### v5.1.0
- **Security:** Removed `crypto-js` dependency (CVE-2023-46233), replaced with Node.js built-in `crypto` module
- Added `files` field to `package.json` to prevent publishing unnecessary files to npm
- Added smart retry logic with exponential backoff and `Retry-After` header support
- Added retryable error filtering: only network errors, timeouts, 429, and 5xx responses are retried
- Removed stale root `index.js` entry point in favor of `package.json` exports configuration
- Removed `crypto-js` and `@types/crypto-js` from dependencies
- Updated Security Policy: 5.0.x is now a supported version
- Updated PR template to reference GitHub Actions instead of Travis/Circle CI
- Expanded test suite from 32 to 109 tests with 97.8% statement coverage

#### v5.0.0
- Rebranded project name from WrapSplashJS to WrapSplashTS to reflect TypeScript-first development
- Fixed missing type definitions for `WrapSplashResponse` and `WrapSplashError` class
Expand All @@ -197,8 +223,6 @@ This library depends on [axios](https://www.npmjs.com/package/axios) and [crypto
- Integrated Codecov for automated code coverage tracking via GitHub Actions
- Added V8 coverage provider with multiple output formats (text, LCOV, JSON, HTML)
- Enforced coverage thresholds: 80% lines/functions/statements, 55% branches
- All 30 tests passing with verified production-ready code quality
- **Security:** Resolved all npm audit vulnerabilities (0 vulnerabilities)

#### v4.2.0
- Added clearer convenience methods such as `getPhoto`, `getRandomPhoto`, `createCollection`, and `updateCollection`
Expand Down
13 changes: 3 additions & 10 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,13 @@

## Supported Versions

Use this section to tell people about which versions of your project are
currently being supported with security updates.

| Version | Supported |
| ------- | ------------------ |
| 5.1.x | :white_check_mark: |
| 5.0.x | :x: |
| 4.0.x | :white_check_mark: |
| 5.0.x | :white_check_mark: |
| 4.0.x | :x: |
| < 4.0 | :x: |

## Reporting a Vulnerability

Use this section to tell people how to report a vulnerability.

Tell them where to go, how often they can expect to get an update on a
reported vulnerability, what to expect if the vulnerability is accepted or
declined, etc.
If you discover a security vulnerability within WrapSplash, please send an email to Sandeep Vattapparambil via [GitHub](https://github.com/SandeepVattapparambil). All security vulnerabilities will be promptly addressed.
Binary file added dist/badge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions dist/types/lib/axiosAjaxLib.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ declare class AxiosAjax {
private retryDelayMs;
constructor(options?: AxiosAjaxOptions);
private sleep;
private isRetryableError;
private getRetryDelay;
makeRequest(url: string, method: string, queryParameters?: Record<string, unknown>, body?: unknown): Promise<import("axios").AxiosResponse<any, any, {}>>;
}
export default AxiosAjax;
Loading
Loading