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
20 changes: 13 additions & 7 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
{
"presets": [
["@babel/preset-env", { "targets": { "browsers": ["last 2 versions", "ie >= 10"] } }],
[
"@babel/preset-env",
{
"targets": {
"browsers": [
"chrome >= 80",
"firefox >= 74",
"safari >= 13.4"
],
"node": "18"
}
}
],
"@babel/preset-typescript"
],
"sourceType": "unambiguous",
"plugins": [
"@babel/plugin-transform-object-assign",
"@babel/plugin-transform-runtime",
"@babel/proposal-object-rest-spread",
"@babel/plugin-proposal-class-properties"
],
"ignore": ["node_modules", "dist", "lib"]
}
13 changes: 1 addition & 12 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ const sharedRules = {
'prefer-destructuring': ['error', { object: true, array: false }],
'max-classes-per-file': 0,
'no-plusplus': 0,
'sonarjs/cognitive-complexity': 0,
'sonarjs/no-collapsible-if': 0,
'sonarjs/no-duplicate-string': 0,
'sonarjs/no-identical-functions': 0,
'class-methods-use-this': 0,
};

Expand All @@ -24,13 +20,7 @@ const settings = {
module.exports = {
root: true,
plugins: ['prettier', 'chai-friendly'],
extends: [
'airbnb-base',
'eslint:recommended',
'plugin:prettier/recommended',
'plugin:sonarjs/recommended',
'plugin:chai-friendly/recommended',
],
extends: ['airbnb-base', 'eslint:recommended', 'plugin:prettier/recommended', 'plugin:chai-friendly/recommended'],
parser: '@babel/eslint-parser',
env: {
es6: true,
Expand All @@ -53,7 +43,6 @@ module.exports = {
'plugin:prettier/recommended',
'prettier',
'plugin:@typescript-eslint/recommended',
'plugin:sonarjs/recommended',
],
parser: '@typescript-eslint/parser',
settings,
Expand Down
5 changes: 0 additions & 5 deletions .github/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ inputs:
node-version:
required: false
default: '24'
skip-puppeteer:
required: false
default: 'true'

runs:
using: 'composite'
Expand All @@ -22,5 +19,3 @@ runs:
- name: Install Dependencies
run: yarn install --immutable
shell: bash
env:
PUPPETEER_SKIP_DOWNLOAD: ${{ inputs.skip-puppeteer }}
6 changes: 3 additions & 3 deletions .github/workflows/browser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ permissions:
jobs:
browser:
runs-on: ubuntu-latest
# karma-webpack turns a failed bundle into an indefinite hang rather than an
# error, so cap the job; a healthy run takes about two minutes.
timeout-minutes: 10
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-node
- name: Install Chrome
run: npx puppeteer browsers install chrome
shell: bash
- name: Test
env:
STREAM_APP_ID: ${{ secrets.STREAM_APP_ID }}
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ jobs:
steps:
- uses: actions/checkout@v6
- uses: preactjs/compressed-size-action@v2
env:
PUPPETEER_SKIP_DOWNLOAD: 'true'
with:
repo-token: '${{ secrets.GITHUB_TOKEN }}'
build-script: 'dist'
18 changes: 0 additions & 18 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,3 @@ jobs:
STREAM_API_KEY: ${{ secrets.STREAM_API_KEY }}
STREAM_API_SECRET: ${{ secrets.STREAM_API_SECRET }}
run: yarn run test-unit-node

# Node 16 can't run Yarn 4 or tsx (both require Node >= 18), so we install
# dependencies on a supported Node version and then switch to Node 16 to run
# the suite through Babel (see babel-register.js).
unit-node16:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-node
- uses: actions/setup-node@v6
with:
node-version: 16
- name: Test
env:
STREAM_APP_ID: ${{ secrets.STREAM_APP_ID }}
STREAM_API_KEY: ${{ secrets.STREAM_API_KEY }}
STREAM_API_SECRET: ${{ secrets.STREAM_API_SECRET }}
run: npm run test-unit-node16
2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enableHardenedMode: true
enableHardenedMode: false

enableScripts: false

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ Docs are available on [GetStream.io](http://getstream.io/docs/?language=js).

## ⚠️ Node version requirements & Browser support

This API Client project requires Node.js v16 at a minimum.
This API Client project requires Node.js v18 at a minimum.

The project is supported in line with the Node.js Foundation Release Working Group.

Expand Down
37 changes: 0 additions & 37 deletions babel-register.js

This file was deleted.

13 changes: 12 additions & 1 deletion karma.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,18 @@ const webpackConfig = require('./webpack.config.js')(); // eslint-disable-line i
delete webpackConfig.entry;
delete webpackConfig.output;
webpackConfig.devtool = 'inline-source-map';
webpackConfig.plugins = [new webpack.EnvironmentPlugin(process.env)];
webpackConfig.resolve = { ...webpackConfig.resolve, fallback: { module: false } };
webpackConfig.plugins = [
...webpackConfig.plugins,
new webpack.EnvironmentPlugin({
STREAM_ANALYTICS_BASE_URL: '',
STREAM_API_KEY: '',
STREAM_API_SECRET: '',
STREAM_APP_ID: '',
STREAM_URL: '',
...process.env,
}),
];

// Karma config
module.exports = function (config) {
Expand Down
80 changes: 24 additions & 56 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"version": "8.14.0",
"scripts": {
"changelog": "standard-version --release-as $VERSION --skip.tag --skip.commit --tag-prefix=v",
"commitlinter": "commitlint",
"transpile": "babel src --out-dir lib --extensions '.ts'",
"types": "tsc --emitDeclarationOnly",
"build": "rm -rf lib && yarn run transpile && yarn run types",
Expand All @@ -26,7 +25,6 @@
"test": "yarn run test-unit-node",
"test-types": "tsc --skipLibCheck --target es2020 --esModuleInterop true --noEmit true test/typescript/*.ts",
"test-unit-node": "mocha --require tsx/cjs --require dotenv/config test/unit/common test/unit/node",
"test-unit-node16": "mocha --require ./babel-register.js test/unit/common test/unit/node",
"test-integration-node": "mocha --require tsx/cjs --require dotenv/config test/integration/common test/integration/node --exit",
"test-cloud": "mocha --require tsx/cjs --require dotenv/config test/integration/cloud --timeout 40000 --exit",
"test-cloud-local": "LOCAL=true mocha --require tsx/cjs --require dotenv/config test/integration/cloud --timeout 40000 --ignore 'test/integration/cloud/{personalized_feed,files,images}.js'",
Expand All @@ -36,99 +34,69 @@
"version": "yarn run dist && yarn run build && git add dist",
"postversion": "git push && git push --tags && npm publish"
},
"husky": {
"hooks": {
"pre-commit": "yarn run lint"
}
},
"browser": {
"./lib/batch_operations.js": false,
"./lib/redirect_url.js": false,
"crypto": false,
"http": false,
"https": false,
"jsonwebtoken": false,
"qs": false,
"url": false
},
"react-native": {
"crypto": false,
"jsonwebtoken": false,
"./lib/batch_operations.js": false,
"./lib/redirect_url.js": false,
"qs": false,
"url": false
},
"devDependencies": {
"@babel/cli": "^7.29.7",
"@babel/core": "^7.29.7",
"@babel/eslint-parser": "^7.29.7",
"@babel/node": "^7.29.7",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/plugin-transform-object-assign": "^7.29.7",
"@babel/plugin-transform-runtime": "^7.29.7",
"@babel/preset-env": "^7.29.7",
"@babel/preset-typescript": "^7.29.7",
"@babel/register": "^7.29.7",
"@commitlint/cli": "^18.4.1",
"@commitlint/config-conventional": "^18.4.0",
"@types/node": "^18.19.130",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"babel-loader": "^9.2.1",
"chai": "^4.3.10",
"dotenv": "^16.0.3",
"eslint": "^8.53.0",
"chai": "^4.5.0",
"dotenv": "^16.6.1",
"eslint": "^8.57.1",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.1.2",
"eslint-plugin-chai-friendly": "^0.7.2",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-chai-friendly": "^0.7.4",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-prettier": "^5.5.6",
"eslint-plugin-sonarjs": "^0.23.0",
"eslint-plugin-typescript-sort-keys": "^3.1.0",
"eslint-plugin-typescript-sort-keys": "^3.3.0",
"expect.js": "^0.3.1",
"husky": "^8.0.3",
"json-loader": "~0.5.7",
"karma": "^6.3.9",
"karma-chrome-launcher": "^3.1.0",
"karma": "^6.4.4",
"karma-chrome-launcher": "^3.2.0",
"karma-mocha": "^2.0.1",
"karma-mocha-reporter": "~2.2.5",
"karma-sauce-launcher": "^4.3.6",
"karma-sourcemap-loader": "~0.4.0",
"karma-webpack": "^5.0.0",
"mocha": "^10.2.0",
"karma-webpack": "^5.0.1",
"mocha": "^10.8.2",
"null-loader": "^4.0.1",
"nyc": "^15.1.0",
"prettier": "^3.1.0",
"puppeteer": "^24.39.0",
"puppeteer-core": "^24.39.0",
"request": "^2.88.2",
"standard-version": "^9.3.2",
"testdouble": "3.20.0",
"tsx": "^4.21.0",
"prettier": "^3.9.6",
"standard-version": "^9.5.0",
"testdouble": "3.20.2",
"tsx": "^4.23.13",
"typescript": "^5.2.2",
"webpack": "^5.107.2",
"webpack-cli": "^5.1.1"
"webpack": "^5.110.2",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"@babel/runtime": "^7.29.7",
"@types/jsonwebtoken": "^9.0.5",
"@types/qs": "^6.9.10",
"axios": "^1.17.0",
"faye": "^1.4.0",
"follow-redirects": "^1.16.0",
"form-data": "^4.0.4",
"@types/jsonwebtoken": "^9.0.10",
"axios": "^1.20.0",
"faye": "^1.4.1",
"form-data": "^4.0.6",
"jsonwebtoken": "^9.0.3",
"jwt-decode": "^4.0.0",
"qs": "^6.14.2"
"jwt-decode": "^4.0.0"
},
"peerDependencies": {
"@types/node": ">=10"
},
"resolutions": {
"jws": "^3.2.3"
},
"repository": {
"type": "git",
"url": "git://github.com/GetStream/stream-js.git"
Expand All @@ -140,7 +108,7 @@
"lib"
],
"engines": {
"node": ">=16"
"node": ">=18"
},
"keywords": [
"stream",
Expand Down
6 changes: 3 additions & 3 deletions src/redirect_url.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import qs from 'qs';

import { StreamClient } from './client';
import { MissingSchemaError } from './errors';
import utils from './utils';
Expand Down Expand Up @@ -43,7 +41,9 @@ export default function createRedirectUrl(this: StreamClient, targetUrl: string,
events: JSON.stringify(events),
};

const qString = utils.rfc3986(qs.stringify(kwargs));
// URLSearchParams form-encodes spaces as + and percent-encodes ~; the analytics endpoint
// expects %20 and a literal ~, so keep both replaces to match the previous qs.stringify output.
const qString = utils.rfc3986(new URLSearchParams(kwargs).toString().replace(/\+/g, '%20').replace(/%7E/g, '~'));

return `${analyticsUrl}?${qString}`;
}
Loading