New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@pusher/push-notifications-web

Package Overview
Dependencies
Maintainers
7
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pusher/push-notifications-web - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

dist/push-notifications-cjs.js

6

CHANGELOG.md

@@ -8,6 +8,10 @@ # Changelog

## [Unreleased](https://github.com/pusher/push-notifications-web/compare/1.0.0...HEAD)
## [Unreleased](https://github.com/pusher/push-notifications-web/compare/1.0.1...HEAD)
## [1.0.1](https://github.com/pusher/push-notifications-web/compare/1.0.0...1.0.1) - 2020-07-22
- Fix bug in service worker which generated invalid open/delivery events due to
non-integer timestamps
## [1.0.0](https://github.com/pusher/push-notifications-web/compare/0.9.0...1.0.0) - 2020-07-22
- General availability (GA) release.

2

dist/service-worker.js

@@ -1282,3 +1282,3 @@ 'use strict';

userId: userId,
timestampSecs: Date.now() / 1000,
timestampSecs: Math.floor(Date.now() / 1000),
appInBackground: appInBackground,

@@ -1285,0 +1285,0 @@ hasDisplayableContent: hasDisplayableContent,

{
"name": "@pusher/push-notifications-web",
"version": "1.0.0",
"version": "1.0.1",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/push-notifications-esm.js",

# Release Process
1. Check you are part of the @pusher npm org
2. Check you are logged in to npm `npm whoami`
3. If not, login via `npm login`
4. Update version in package manifest
5. Commit
6. `git tag <VERSION e.g. 1.2.3>`
7. `git push --follow-tags`
8. `npm run publish-please`
1. Update version in package manifest
2. Update version in changelog
3. Commit
4. Check you are part of the @pusher npm org
5. Check you are logged in to npm `npm whoami`
6. If not, login via `npm login`
7. `git tag <VERSION e.g. 1.2.3>`
8. `git push --tags`
9. `npm run publish-please`
10. Upload `./dist/push-notifications-cdn` to the appropriate S3 buckets:
- Major/minor version:
- `/pusher-js-cloudfront/beams/<MAJOR>.<MINOR>`
- `/pusher-js-cloudfront/beams/<MAJOR>.<MINOR>.0`
- Patch version:
- `/pusher-js-cloudfront/beams/<MAJOR>.<MINOR>`
- `/pusher-js-cloudfront/beams/<MAJOR>.<MINOR>.<PATCH>`
11. If any changes have been made to the service worker:
- `npm run build:sw`
- Upload `./dist/service-worker.js` to S3:
- `/pusher-js-cloudfront/beams/service-worker.js`

@@ -72,3 +72,3 @@ /* eslint-env serviceworker */

userId,
timestampSecs: Date.now() / 1000,
timestampSecs: Math.floor(Date.now() / 1000),
appInBackground,

@@ -75,0 +75,0 @@ hasDisplayableContent,

@@ -15,3 +15,3 @@ import { makeDeviceStateStore } from '../test-utils/fake-device-state-store';

let clients = [];
let now = new Date('2000-01-01T00:00:00Z');
let now;

@@ -23,2 +23,3 @@ beforeEach(() => {

clients = [];
now = new Date('2000-01-01T00:00:00Z');

@@ -331,2 +332,50 @@ global.addEventListener = (name, func) => {

test('SW should send integer timestamp when time has fractional millis', () => {
jest.resetModules();
const devicestatestore = require('./device-state-store');
devicestatestore.default = makeDeviceStateStore({
deviceId: 'web-1db66b8a-f51f-49de-b225-72591535c855',
token: 'some-token',
userId: 'alice',
});
const dorequest = require('./do-request');
const mockDoRequest = jest.fn();
mockDoRequest.mockReturnValueOnce(Promise.resolve('ok'));
dorequest.default = mockDoRequest;
require('./service-worker.js');
// Given a push event that comes from Pusher
const pushEvent = makeBeamsPushEvent({});
// And that the current time as a fractional millis part
now = new Date('2000-01-01T00:00:00.999Z');
// When the push listener is called
const pushListener = listeners['push'];
if (!pushListener) {
throw new Error('No push listener has been set');
}
pushListener(pushEvent);
return new Promise(resolve => setTimeout(resolve, 200)).then(() => {
expect(mockDoRequest.mock.calls.length).toBe(1);
expect(mockDoRequest.mock.calls[0].length).toBe(1);
const requestOptions = mockDoRequest.mock.calls[0][0];
expect(requestOptions.method).toBe('POST');
expect(requestOptions.path).toBe(
[
`https://${TEST_INSTANCE_ID}.pushnotifications.pusher.com`,
`/reporting_api/v2/instances/${TEST_INSTANCE_ID}/events`,
].join('')
);
// Then the timetamp should be rounded down to the nearest second
expect(requestOptions.body.timestampSecs).toBe(946684800);
});
});
test('SW should send open event when notification clicked', () => {

@@ -333,0 +382,0 @@ jest.resetModules();

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc