Socket
Socket
Sign inDemoInstall

anypush

Package Overview
Dependencies
213
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.1-0 to 0.0.1

29

bld/library/services/apple-service.js

@@ -62,10 +62,23 @@ "use strict";

}));
const status = await new Promise((resolve, reject) => {
request.on('response', response => {
const [status, reason] = await new Promise((resolve, reject) => {
request
.on('response', response => {
var _a;
resolve((_a = response.statusCode) !== null && _a !== void 0 ? _a : 0);
});
request.on('error', reject);
const status = (_a = response.statusCode) !== null && _a !== void 0 ? _a : 0;
const chunks = [];
response
.on('data', chunk => chunks.push(chunk))
.on('end', () => {
const content = Buffer.concat(chunks).toString();
let reason;
if (content.startsWith('{')) {
({ reason } = JSON.parse(content));
}
resolve([status, reason]);
})
.on('error', reject);
})
.on('error', reject);
});
debug('push response', status, data, message);
debug('push response', { status, reason, data, message });
switch (status) {

@@ -75,5 +88,5 @@ case 200:

case 400:
throw new Error('Bad request');
throw new Error(`Bad request: ${reason}`);
case 403:
throw new Error("There was an error with the provider's authentication token");
throw new Error(`There was an error with the provider's authentication token: ${reason}`);
case 410:

@@ -80,0 +93,0 @@ throw new expected_errors_1.TargetInactiveError('The device token is no longer active for the topic');

{
"name": "anypush",
"version": "0.0.1-0",
"version": "0.0.1",
"description": "AnyPush",

@@ -5,0 +5,0 @@ "repository": "https://github.com/vilic/anypush.git",

@@ -368,12 +368,31 @@ import Debug from 'debug';

const status = await new Promise<number>((resolve, reject) => {
request.on('response', response => {
resolve(response.statusCode ?? 0);
});
const [status, reason] = await new Promise<[number, string | undefined]>(
(resolve, reject) => {
request
.on('response', response => {
const status = response.statusCode ?? 0;
request.on('error', reject);
});
const chunks: Buffer[] = [];
debug('push response', status, data, message);
response
.on('data', chunk => chunks.push(chunk))
.on('end', () => {
const content = Buffer.concat(chunks).toString();
let reason: string | undefined;
if (content.startsWith('{')) {
({reason} = JSON.parse(content));
}
resolve([status, reason]);
})
.on('error', reject);
})
.on('error', reject);
},
);
debug('push response', {status, reason, data, message});
switch (status) {

@@ -383,6 +402,6 @@ case 200:

case 400:
throw new Error('Bad request');
throw new Error(`Bad request: ${reason}`);
case 403:
throw new Error(
"There was an error with the provider's authentication token",
`There was an error with the provider's authentication token: ${reason}`,
);

@@ -389,0 +408,0 @@ case 410:

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with āš”ļø by Socket Inc