Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.0.0 #401

Merged
merged 24 commits into from
Sep 10, 2024
Merged

3.0.0 #401

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
26b7bb3
feat: Create Axios and Fetch adapters
CookieCookson Mar 27, 2024
caddfd2
feat: Replace fixed Axios adapter with adapter option
CookieCookson Mar 27, 2024
9e555a6
test: Update tests with mocked adapters, add node-fetch jest project
CookieCookson Mar 28, 2024
ae8ef48
test: Adjust integration tests to handle adapters
CookieCookson Apr 3, 2024
9e64e92
fix: Handle fetch requests and responses for different payload types
CookieCookson Apr 3, 2024
31264a4
test: Add axios and fetch adapter unit tests
CookieCookson Apr 8, 2024
113f41b
test: resolveAdapterFunction
CookieCookson Apr 8, 2024
6c22845
test: Fetch stringifies data if JSON content type
CookieCookson Apr 8, 2024
7f33fcb
test: Add rejected promise check to fetchAdapter
CookieCookson Apr 11, 2024
dc94159
test: Add fetch response gets parsed as JSON
CookieCookson Apr 11, 2024
73b7627
fix: Remove unnecessary type check for fetch response text
CookieCookson Apr 11, 2024
af9ac0b
2.3.0-alpha.0
CookieCookson Apr 11, 2024
511eda1
fix: Improve btoa detection
CookieCookson Apr 15, 2024
15c4dd1
feat: Add edge jest environment with no coverage collection
CookieCookson Apr 15, 2024
26ad151
test: Skip testing axios adapter in edge environment
CookieCookson Apr 15, 2024
8a2613a
change: Replace uuid.v4 with built-in crypto.randomUUID
CookieCookson Apr 15, 2024
1e1f72e
2.3.0-alpha.1
CookieCookson Apr 15, 2024
15f7b4a
chore: Fix linter errors
CookieCookson Apr 16, 2024
fd6ec4f
Merge branch 'develop' into feature/adapters
CookieCookson Apr 16, 2024
b14b10d
Merge branch 'next' into feature/adapters
CookieCookson Jun 27, 2024
47d79bb
Merge pull request #383 from xapijs/feature/adapters
CookieCookson Jun 27, 2024
21ccdcc
Merge branch 'develop' into next
CookieCookson Sep 10, 2024
5135b76
fix: Patch axios version
CookieCookson Sep 10, 2024
ada7c89
3.0.0
CookieCookson Sep 10, 2024
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 3.0.0 (10 Sep 2024)

- Added `adapter` property to `XAPI` constructor params, allowing a choice between `axios` (Default), `fetch` or a custom adapter function
- Adds support for edge environments through the `fetch` adapter
- Updated `axios` to patch security vulnerability ([CVE-2024-39338](https://github.com/advisories/GHSA-8hc4-vh64-cxmj))

# 2.2.8 (31 Jul 2024)

- Updated `braces` to patch security vulnerability
Expand Down
19 changes: 19 additions & 0 deletions jest.config.edge.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require("dotenv").config();

module.exports = {
preset: "ts-jest",
projects: [
{
displayName: "edge-fetch-unit",
testMatch: ["**/*.unit.test.ts"],
testEnvironment: "@edge-runtime/jest-environment",
setupFiles: ["./test/mockFetch.ts", "./test/setupFetch.ts"],
},
{
displayName: "edge-fetch-int",
testMatch: ["**/*.int.test.ts"],
testEnvironment: "@edge-runtime/jest-environment",
setupFilesAfterEnv: ["./test/setupInt.ts", "./test/setupFetch.ts"],
},
],
};
64 changes: 62 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,72 @@ module.exports = {
},
projects: [
{
displayName: "dom",
displayName: "dom-axios-unit",
testMatch: ["**/*.unit.test.ts"],
testEnvironment: "jsdom",
setupFiles: [
"./test/mockAxios.ts",
"./test/mockFetch.ts",
"./test/setupAxios.ts",
],
},
{
displayName: "node",
displayName: "dom-fetch-unit",
testMatch: ["**/*.unit.test.ts"],
testEnvironment: "jsdom",
setupFiles: [
"./test/mockAxios.ts",
"./test/mockFetch.ts",
"./test/setupFetch.ts",
],
},
{
displayName: "node-axios-unit",
testMatch: ["**/*.unit.test.ts"],
testEnvironment: "node",
setupFiles: [
"./test/mockAxios.ts",
"./test/mockFetch.ts",
"./test/setupAxios.ts",
],
},
{
displayName: "node-fetch-unit",
testMatch: ["**/*.unit.test.ts"],
testEnvironment: "node",
setupFiles: [
"./test/mockAxios.ts",
"./test/mockFetch.ts",
"./test/setupFetch.ts",
],
},
{
displayName: "dom-axios-int",
testMatch: ["**/*.int.test.ts"],
testEnvironment: "jsdom",
setupFilesAfterEnv: ["./test/setupInt.ts"],
},
{
displayName: "dom-fetch-int",
testMatch: ["**/*.int.test.ts"],
testEnvironment: "jsdom",
setupFilesAfterEnv: [
"./test/setupInt.ts",
"./test/polyfillFetch.ts",
"./test/setupFetch.ts",
],
},
{
displayName: "node-axios-int",
testMatch: ["**/*.int.test.ts"],
testEnvironment: "node",
setupFilesAfterEnv: ["./test/setupInt.ts", "./test/setupAxios.ts"],
},
{
displayName: "node-fetch-int",
testMatch: ["**/*.int.test.ts"],
testEnvironment: "node",
setupFilesAfterEnv: ["./test/setupInt.ts", "./test/setupFetch.ts"],
},
],
};
202 changes: 183 additions & 19 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xapi/xapi",
"version": "2.2.8",
"version": "3.0.0",
"description": "Communicate over xAPI using JavaScript.",
"main": "dist/XAPI.cjs.js",
"module": "dist/XAPI.esm.js",
Expand All @@ -16,9 +16,10 @@
"build:types": "tsc --emitDeclarationOnly",
"build": "npm run clean && npm run build:types && npm run build:js",
"format": "prettier --write '**/*.{js,jsx,json,ts,tsx}'",
"test": "jest --runInBand && npm run test:example:node:require && npm run test:example:node:import",
"test:unit": "jest --testPathPattern=.unit.test.ts",
"test:int": "jest --testPathPattern=.int.test.ts --runInBand",
"test": "jest --runInBand && npm run test:edge && npm run test:example:node:require && npm run test:example:node:import",
"test:edge": "jest --runInBand --config jest.config.edge.js",
"test:unit": "jest --selectProjects dom-axios-unit dom-fetch-unit node-axios-unit node-fetch-unit",
"test:int": "jest --selectProjects dom-axios-int dom-fetch-int node-axios-int node-fetch-int --runInBand",
"test:format": "prettier --check .",
"test:example:node:require": "node ./example/node/require.js",
"test:example:node:import": "node --experimental-modules --es-module-specifier-resolution=node ./example/node/import.mjs",
Expand All @@ -44,6 +45,7 @@
"@babel/plugin-proposal-optional-chaining": "^7.21.0",
"@babel/preset-env": "^7.23.2",
"@babel/preset-typescript": "^7.23.2",
"@edge-runtime/jest-environment": "^2.3.10",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^25.0.7",
"@rollup/plugin-json": "^6.0.1",
Expand All @@ -66,7 +68,7 @@
"rollup": "^4.3.0",
"ts-jest": "^29.1.1",
"typescript": "^5.2.2",
"uuid": "^9.0.1"
"whatwg-fetch": "^3.6.20"
},
"dependencies": {
"axios": "^1.6.0"
Expand Down
Loading
Loading