Socket
Socket
Sign inDemoInstall

remote.it

Package Overview
Dependencies
8
Maintainers
5
Versions
83
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.47.0 to 0.47.1

31

lib/remote.it.d.ts

@@ -9,7 +9,3 @@ import { AxiosError, Method } from 'axios'

create(email: string): Promise<IRawUser>
verifyAccount(
email: string,
password: string,
shortcode: string
): Promise<any>
verifyAccount(email: string, password: string, shortcode: string): Promise<any>
login(username: string, password: string): Promise<IUser>

@@ -25,7 +21,3 @@ authHashLogin(username: string, authhash: string): Promise<IUser>

recoverPasswordRequest(email: string): Promise<any>
verifyPasswordChange(
email: string,
password: string,
shortcode: string
): Promise<any>
verifyPasswordChange(email: string, password: string, shortcode: string): Promise<any>
preferences(): Promise<any>

@@ -132,7 +124,3 @@ process(user: IRawUser, username: string): IUser

list(): Promise<IRegistration[]>
setProuct(
bulkID: string,
descriptor: string,
productID: string
): Promise<any>
setProuct(bulkID: string, descriptor: string, productID: string): Promise<any>
setName(bulkID: string, name: string): Promise<any>

@@ -149,8 +137,3 @@ }

}
request(
method: Method,
url: string,
data?: {},
extraHeaders?: {}
): Promise<any>
request(method: Method, url: string, data?: {}, extraHeaders?: {}): Promise<any>
get(url: string, data?: {}): Promise<any>

@@ -382,7 +365,3 @@ post(url: string, data?: {}): Promise<any>

}
export declare type ServiceState =
| 'active'
| 'inactive'
| 'connected'
| 'restricted'
export declare type ServiceState = 'active' | 'inactive' | 'connected' | 'restricted'
export interface IRawService {

@@ -389,0 +368,0 @@ devicealias: string

59

lib/remote.it.js

@@ -175,5 +175,3 @@ "use strict";

return __generator(this, function (_a) {
return [2 /*return*/, r3
.get('/user/language/')
.then(function (user) { return user.language; })];
return [2 /*return*/, r3.get('/user/language/').then(function (user) { return user.language; })];
});

@@ -231,5 +229,3 @@ });

var trial = user.r3_trial;
var planQuantity = user.R3_commercial_quantity
? Number(user.R3_commercial_quantity)
: 0;
var planQuantity = user.R3_commercial_quantity ? Number(user.R3_commercial_quantity) : 0;
var planName;

@@ -250,4 +246,3 @@ var planPrice = user.R3_commercial_cost

planName = trial;
if (trial === 'remote.it, 100 Devices, Commercial' ||
trial === 'Promotional, 100 Devices, Commercial') {
if (trial === 'remote.it, 100 Devices, Commercial' || trial === 'Promotional, 100 Devices, Commercial') {
planQuantity = 100;

@@ -276,5 +271,3 @@ }

: undefined;
var createdAt = user.member_since
? new Date(user.member_since + ' GMT')
: null;
var createdAt = user.member_since ? new Date(user.member_since + ' GMT') : null;
return {

@@ -371,5 +364,3 @@ apiKey: user.apikey,

case 0: return [4 /*yield*/, Promise.all([
r3
.get('/device/list/all')
.then(function (_a) {
r3.get('/device/list/all').then(function (_a) {
var devices = _a.devices;

@@ -579,5 +570,3 @@ return devices;

return;
d.hardwareID = meta[id]
? meta[id].hardwareid
: "HardwareID-Missing-" + d.deviceaddress;
d.hardwareID = meta[id] ? meta[id].hardwareid : "HardwareID-Missing-" + d.deviceaddress;
devicesWithHardwareIDs.push(d);

@@ -637,5 +626,3 @@ });

typeID: r3.devices.parseServiceType(s.devicetype).id,
deviceID: device
? device.deviceaddress
: 'unknown-device-id',
deviceID: device ? device.deviceaddress : 'unknown-device-id',
}); }))),

@@ -777,5 +764,3 @@ };

return __generator(this, function (_a) {
return [2 /*return*/, r3
.post('/developer/customer/', contact)
.then(function (resp) { return r3.contacts._formatUpdate(resp); })];
return [2 /*return*/, r3.post('/developer/customer/', contact).then(function (resp) { return r3.contacts._formatUpdate(resp); })];
});

@@ -831,5 +816,3 @@ });

accountCreated: false,
companyName: c.companyname !== undefined && c.companyname !== '-'
? c.companyname
: '',
companyName: c.companyname !== undefined && c.companyname !== '-' ? c.companyname : '',
createdAt: new Date(nowInt),

@@ -848,5 +831,3 @@ email: c.email,

return __generator(this, function (_a) {
return [2 /*return*/, r3
.get('/developer/product/list/mine/')
.then(function (_a) {
return [2 /*return*/, r3.get('/developer/product/list/mine/').then(function (_a) {
var products = _a.products;

@@ -861,5 +842,3 @@ return products.map(r3.products._process);

return __generator(this, function (_a) {
return [2 /*return*/, r3
.get('/project/supported/types/')
.then(function (_a) {
return [2 /*return*/, r3.get('/project/supported/types/').then(function (_a) {
var types = _a.types;

@@ -899,5 +878,3 @@ return types;

return __generator(this, function (_a) {
return [2 /*return*/, r3
.get('/bulk/file/list/')
.then(function (_a) {
return [2 /*return*/, r3.get('/bulk/file/list/').then(function (_a) {
var items = _a.items;

@@ -1025,5 +1002,3 @@ return items.map(r3.files._process);

url = id ? "/entity/" + id : '/entity/';
return [2 /*return*/, r3
.get(url)
.then(function (data) { return (data.entity ? [data.entity] : data.entities); })];
return [2 /*return*/, r3.get(url).then(function (data) { return (data.entity ? [data.entity] : data.entities); })];
});

@@ -1182,6 +1157,3 @@ });

if (resp === void 0) { resp = {}; }
if (resp.data &&
resp.data.status &&
resp.data.reason &&
resp.data.status === 'false') {
if (resp.data && resp.data.status && resp.data.reason && resp.data.status === 'false') {
throw new Error(resp.data.reason);

@@ -1205,6 +1177,5 @@ }

var plan = user.R3_commercial_plan;
var isNewCommercial = plan &&
(plan.includes('remot3.it.device') || plan.includes('remot3.it.seat'));
var isNewCommercial = plan && (plan.includes('remot3.it.device') || plan.includes('remot3.it.seat'));
return Boolean(isNewCommercial || isLegacyCommercial);
}
//# sourceMappingURL=remote.it.js.map

@@ -23,5 +23,3 @@ "use strict";

for (var key in object) {
if (object[key] !== null &&
object[key] !== false &&
object[key] !== undefined) {
if (object[key] !== null && object[key] !== false && object[key] !== undefined) {
obj[key] = object[key];

@@ -28,0 +26,0 @@ }

{
"name": "remote.it",
"version": "0.47.0",
"version": "0.47.1",
"description": "remote.it JavaScript/node client library",

@@ -58,3 +58,3 @@ "main": "lib/remote.it.js",

"homepage": "https://github.com/remoteit/remote.it.js#readme",
"gitHead": "472de4d97c5ca083ea9f80e1a93701e443c12c5f",
"gitHead": "751413c74ea94dbb0ce447f3b9a4b61b1afc90b4",
"devDependencies": {

@@ -61,0 +61,0 @@ "@size-limit/preset-small-lib": "^4.4.2"

@@ -12,6 +12,3 @@ import axios, { AxiosError, AxiosResponse, Method } from 'axios'

export default function setup(
config: IConfig = {},
newGetToken?: () => Promise<string>
) {
export default function setup(config: IConfig = {}, newGetToken?: () => Promise<string>) {
const options: IConfig = { ...defaults, ...config }

@@ -51,7 +48,3 @@ const instance = axios.create({

},
async verifyAccount(
email: string,
password: string,
shortcode: string
): Promise<any> {
async verifyAccount(email: string, password: string, shortcode: string): Promise<any> {
return r3.post('/user/create/verified/', { email, shortcode, password })

@@ -85,5 +78,3 @@ },

async get() {
return r3
.get('/user/language/')
.then((user: IRawUser) => user.language)
return r3.get('/user/language/').then((user: IRawUser) => user.language)
},

@@ -105,7 +96,3 @@ async set(language: string) {

// TODO: Define return type
async verifyPasswordChange(
email: string,
password: string,
shortcode: string
): Promise<any> {
async verifyPasswordChange(email: string, password: string, shortcode: string): Promise<any> {
return r3.post('/user/password/recovery/verified/', {

@@ -125,5 +112,3 @@ email,

const trial = user.r3_trial
let planQuantity = user.R3_commercial_quantity
? Number(user.R3_commercial_quantity)
: 0
let planQuantity = user.R3_commercial_quantity ? Number(user.R3_commercial_quantity) : 0

@@ -138,6 +123,3 @@ let planName: RemoteItPlanName

? // "2019-07-25 12:03:35"
parseLegacyDate(
user.R3_commercial_expire_date + ' -0500',
'y-MM-dd h:mm:ss ZZZ'
)
parseLegacyDate(user.R3_commercial_expire_date + ' -0500', 'y-MM-dd h:mm:ss ZZZ')
: undefined

@@ -149,6 +131,3 @@ const plan = user.R3_commercial_plan

planName = trial as RemoteItPlanName
if (
trial === 'remote.it, 100 Devices, Commercial' ||
trial === 'Promotional, 100 Devices, Commercial'
) {
if (trial === 'remote.it, 100 Devices, Commercial' || trial === 'Promotional, 100 Devices, Commercial') {
planQuantity = 100

@@ -171,11 +150,6 @@ } else {

const planLastTransaction = user.R3_commercial_last_purchase_date
? parseLegacyDate(
user.R3_commercial_last_purchase_date + ' -0500',
'y-MM-dd h:mm:ss ZZZ'
)
? parseLegacyDate(user.R3_commercial_last_purchase_date + ' -0500', 'y-MM-dd h:mm:ss ZZZ')
: undefined
const createdAt = user.member_since
? new Date(user.member_since + ' GMT')
: null
const createdAt = user.member_since ? new Date(user.member_since + ' GMT') : null

@@ -270,5 +244,3 @@ return {

const [allDevices, metadata] = await Promise.all([
r3
.get('/device/list/all')
.then(({ devices }: { devices: IRawDevice[] }) => devices),
r3.get('/device/list/all').then(({ devices }: { devices: IRawDevice[] }) => devices),
r3.devices.metadata(),

@@ -293,6 +265,3 @@ ])

},
async connect(
service: IService,
hostip = '255.255.255.255'
): Promise<IConnection> {
async connect(service: IService, hostip = '255.255.255.255'): Promise<IConnection> {
return r3

@@ -304,77 +273,66 @@ .post('/device/connect', {

})
.then(
({
connection,
connectionid,
}: {
connection: IRawConnection
connectionid: string
}) => {
const parsed = new URL(connection.proxy)
.then(({ connection, connectionid }: { connection: IRawConnection; connectionid: string }) => {
const parsed = new URL(connection.proxy)
// TODO: rename service.protocol to service.type
const type = service.protocol
// TODO: rename service.protocol to service.type
const type = service.protocol
// This is a hack to return a proper protocol for certain
// service These are used in launch behavior for some
// applications, namely web. We also normalize the protocols
// of "Basic Web" and "Secure Web" since they are legacy
// service types that we must support till we move over
// to just using HTTP/HTTPS service
let protocol = type.toLowerCase()
if (type === 'RDP Plus') protocol = 'rdp'
if (type === 'Basic Web') protocol = 'http'
if (type === 'Secure Web') protocol = 'https'
if (type === 'Generic TCP') protocol = 'tcp'
if (type === 'NxWitness') protocol = 'nx-witness'
// This is a hack to return a proper protocol for certain
// service These are used in launch behavior for some
// applications, namely web. We also normalize the protocols
// of "Basic Web" and "Secure Web" since they are legacy
// service types that we must support till we move over
// to just using HTTP/HTTPS service
let protocol = type.toLowerCase()
if (type === 'RDP Plus') protocol = 'rdp'
if (type === 'Basic Web') protocol = 'http'
if (type === 'Secure Web') protocol = 'https'
if (type === 'Generic TCP') protocol = 'tcp'
if (type === 'NxWitness') protocol = 'nx-witness'
// Grab the port out of the URL if it exists otherwise check
// to see if the port is actually in the proxy URL since the
// API currently returns launch URLs for the proxy URL instead
// of just hostname and port. URLs for RDP and VNC in particular
// use some legacy PHP files that handle launching of these services.
// This is a hack until the API properly returns the right hostname
// and port.
// Here are the how the URLs for RDP and VNC look currently:
// RDP Plus: http://proxy71.rt3.io/rdp/rdp.php?port=38631
// VNC: http://proxy72.rt3.io/vnc/vnc.php?port=34861
const hostname = parsed.hostname
let port = toNumber(parsed.port)
if (protocol === 'vnc' || protocol === 'rdp') {
port = toNumber(parsed.searchParams.get('port') || '')
}
// Grab the port out of the URL if it exists otherwise check
// to see if the port is actually in the proxy URL since the
// API currently returns launch URLs for the proxy URL instead
// of just hostname and port. URLs for RDP and VNC in particular
// use some legacy PHP files that handle launching of these services.
// This is a hack until the API properly returns the right hostname
// and port.
// Here are the how the URLs for RDP and VNC look currently:
// RDP Plus: http://proxy71.rt3.io/rdp/rdp.php?port=38631
// VNC: http://proxy72.rt3.io/vnc/vnc.php?port=34861
const hostname = parsed.hostname
let port = toNumber(parsed.port)
if (protocol === 'vnc' || protocol === 'rdp') {
port = toNumber(parsed.searchParams.get('port') || '')
}
// Construct a URL that can be used to launch the application.
// This will mostly only work in the browser since mobile
// devices require custom application launch URLs for
// deep linking. This shouldn't be fully relied on for
// launch behavior ultimately.
let url = `${protocol.toLowerCase()}://${hostname}`
if (port) url += `:${port}`
// Construct a URL that can be used to launch the application.
// This will mostly only work in the browser since mobile
// devices require custom application launch URLs for
// deep linking. This shouldn't be fully relied on for
// launch behavior ultimately.
let url = `${protocol.toLowerCase()}://${hostname}`
if (port) url += `:${port}`
return {
// The number of seconds before this connection expires.
expiresIn: toNumber(connection.expirationsec),
hostname,
id: connectionid,
protocol,
port: port || null,
return {
// The number of seconds before this connection expires.
expiresIn: toNumber(connection.expirationsec),
hostname,
id: connectionid,
protocol,
port: port || null,
// The API currently returns datestamps as EST time instead of UTC.
// This is hack to make sure we take that in to account until the
// API supports UTC.
// '12/14/2018T7:00 AM'
requestedAt: parseLegacyDate(
connection.requested + ' -0500',
'M/d/yTh:mm a ZZZ'
),
// requestedAt: moment(
// connection.requested + ' -0500',
// 'MM/DD/YYYYTh:mm A Z'
// ).toDate(),
type,
url,
}
// The API currently returns datestamps as EST time instead of UTC.
// This is hack to make sure we take that in to account until the
// API supports UTC.
// '12/14/2018T7:00 AM'
requestedAt: parseLegacyDate(connection.requested + ' -0500', 'M/d/yTh:mm a ZZZ'),
// requestedAt: moment(
// connection.requested + ' -0500',
// 'MM/DD/YYYYTh:mm A Z'
// ).toDate(),
type,
url,
}
)
})
},

@@ -434,9 +392,6 @@ // TODO: Define return type

// Make sure metadata keys are lowercase
const meta: IRawMetaData = Object.keys(metadata).reduce(
(all: { [key: string]: IRawMetaDataItem }, key) => {
all[key.toLowerCase()] = metadata[key]
return all
},
{}
)
const meta: IRawMetaData = Object.keys(metadata).reduce((all: { [key: string]: IRawMetaDataItem }, key) => {
all[key.toLowerCase()] = metadata[key]
return all
}, {})

@@ -448,5 +403,3 @@ // Add all the device IDs to each device/service

if (!id) return
d.hardwareID = meta[id]
? meta[id].hardwareid
: `HardwareID-Missing-${d.deviceaddress}`
d.hardwareID = meta[id] ? meta[id].hardwareid : `HardwareID-Missing-${d.deviceaddress}`
devicesWithHardwareIDs.push(d)

@@ -457,11 +410,6 @@ })

// group them.
const groupedByHardwareID = groupBy(
devicesWithHardwareIDs,
'hardwareID'
)
const groupedByHardwareID = groupBy(devicesWithHardwareIDs, 'hardwareID')
// Construct a nested tree of device+services
const grouped = Object.keys(groupedByHardwareID).map((hwid: string):
| IDevice
| undefined => {
const grouped = Object.keys(groupedByHardwareID).map((hwid: string): IDevice | undefined => {
// services: IRawService[], hwid: string

@@ -509,5 +457,3 @@ let services = groupedByHardwareID[hwid]

typeID: r3.devices.parseServiceType(s.devicetype).id,
deviceID: device
? device.deviceaddress
: 'unknown-device-id',
deviceID: device ? device.deviceaddress : 'unknown-device-id',
})

@@ -619,10 +565,6 @@ )

.get('/developer/customer/list/')
.then(({ customers }: { customers: IRawContact[] }) =>
customers.map(r3.contacts._format)
)
.then(({ customers }: { customers: IRawContact[] }) => customers.map(r3.contacts._format))
},
async create(contact: IContactPoster): Promise<IContact> {
return r3
.post('/developer/customer/', contact)
.then(resp => r3.contacts._formatUpdate(resp))
return r3.post('/developer/customer/', contact).then(resp => r3.contacts._formatUpdate(resp))
},

@@ -672,14 +614,9 @@ async update(contact: IContactPoster): Promise<IContact> {

accountCreated: false,
companyName:
c.companyname !== undefined && c.companyname !== '-'
? c.companyname
: '',
companyName: c.companyname !== undefined && c.companyname !== '-' ? c.companyname : '',
createdAt: new Date(nowInt),
email: c.email,
firstName:
c.firstname !== undefined && c.firstname !== '-' ? c.firstname : '',
firstName: c.firstname !== undefined && c.firstname !== '-' ? c.firstname : '',
id: c.id,
language: c.language || 'en',
lastName:
c.lastname !== undefined && c.lastname !== '-' ? c.lastname : '',
lastName: c.lastname !== undefined && c.lastname !== '-' ? c.lastname : '',
updatedAt: new Date(nowInt),

@@ -691,10 +628,6 @@ }

async list(): Promise<IProduct> {
return r3
.get('/developer/product/list/mine/')
.then(({ products }) => products.map(r3.products._process))
return r3.get('/developer/product/list/mine/').then(({ products }) => products.map(r3.products._process))
},
async platforms(): Promise<IPlatform[]> {
return r3
.get('/project/supported/types/')
.then(({ types }: { types: IRawPlatform[] }): IPlatform[] => types)
return r3.get('/project/supported/types/').then(({ types }: { types: IRawPlatform[] }): IPlatform[] => types)
},

@@ -724,7 +657,3 @@ async create(product: IProduct): Promise<IProduct> {

async list(): Promise<IFile[]> {
return r3
.get('/bulk/file/list/')
.then(({ items }: { items: IRawFile[] }) =>
items.map(r3.files._process)
)
return r3.get('/bulk/file/list/').then(({ items }: { items: IRawFile[] }) => items.map(r3.files._process))
},

@@ -781,26 +710,21 @@ async destroy(key: string): Promise<IFile> {

.get('/bulk/registration/uploads/list/')
.then(
({ uploads }: { uploads: IRawRegistration[] }): IRegistration[] =>
uploads.map(reg => ({
id: reg.id,
state: reg.state,
uploaded: toNumber(reg.uploaded),
name: reg.name,
type: reg.type,
productID: reg.productid,
productName: reg.productname,
registered: reg.registered,
preRegistered: toNumber(reg.preregistered),
failures: toNumber(reg.service_failures),
createdAt: new Date(reg.created),
updatedAt: new Date(reg.updated),
}))
.then(({ uploads }: { uploads: IRawRegistration[] }): IRegistration[] =>
uploads.map(reg => ({
id: reg.id,
state: reg.state,
uploaded: toNumber(reg.uploaded),
name: reg.name,
type: reg.type,
productID: reg.productid,
productName: reg.productname,
registered: reg.registered,
preRegistered: toNumber(reg.preregistered),
failures: toNumber(reg.service_failures),
createdAt: new Date(reg.created),
updatedAt: new Date(reg.updated),
}))
)
},
// TODO: Define return type
async setProuct(
bulkID: string,
descriptor: string,
productID: string
): Promise<any> {
async setProuct(bulkID: string, descriptor: string, productID: string): Promise<any> {
return r3.post('/bulk/registration/name/', {

@@ -823,5 +747,3 @@ bulk_id: bulkID,

const url = id ? `/entity/${id}` : '/entity/'
return r3
.get(url)
.then(data => (data.entity ? [data.entity] : data.entities))
return r3.get(url).then(data => (data.entity ? [data.entity] : data.entities))
},

@@ -941,8 +863,3 @@ async acl(): Promise<IEntity> {

processData(resp: AxiosResponse | any = {}) {
if (
resp.data &&
resp.data.status &&
resp.data.reason &&
resp.data.status === 'false'
) {
if (resp.data && resp.data.status && resp.data.reason && resp.data.status === 'false') {
throw new Error(resp.data.reason)

@@ -965,8 +882,5 @@ }

if (user.r3_trial) return true
const isLegacyCommercial =
user.commerical_setting && user.commerical_setting === 'COMMERCIAL'
const isLegacyCommercial = user.commerical_setting && user.commerical_setting === 'COMMERCIAL'
const plan = user.R3_commercial_plan
const isNewCommercial =
plan &&
(plan.includes('remot3.it.device') || plan.includes('remot3.it.seat'))
const isNewCommercial = plan && (plan.includes('remot3.it.device') || plan.includes('remot3.it.seat'))

@@ -973,0 +887,0 @@ return Boolean(isNewCommercial || isLegacyCommercial)

@@ -12,6 +12,3 @@ import { DateTime } from 'luxon'

export function groupBy(arr: any[], key: string): any {
return arr.reduce(
(r, v, i, a, k = v[key]) => ((r[k] || (r[k] = [])).push(v), r),
{}
)
return arr.reduce((r, v, i, a, k = v[key]) => ((r[k] || (r[k] = [])).push(v), r), {})
}

@@ -22,7 +19,3 @@

for (const key in object) {
if (
object[key] !== null &&
object[key] !== false &&
object[key] !== undefined
) {
if (object[key] !== null && object[key] !== false && object[key] !== undefined) {
obj[key] = object[key]

@@ -29,0 +22,0 @@ }

@@ -1,8 +0,2 @@

import setup, {
IRawUser,
ServiceState,
DeviceState,
R3FromData,
IContactPoster,
} from '../src/remote.it'
import setup, { IRawUser, ServiceState, DeviceState, R3FromData, IContactPoster } from '../src/remote.it'
import * as mockData from './data'

@@ -78,5 +72,3 @@ import forceCast from './forceCast'

jest.spyOn(r3, 'processError')
await r3
.request('get', '/foo')
.catch((e: Error) => expect(e.message).toEqual(reason))
await r3.request('get', '/foo').catch((e: Error) => expect(e.message).toEqual(reason))
})

@@ -408,6 +400,3 @@ })

const newContact = await r3.contacts.create(newCustomerParams)
expect(r3.post).toBeCalledWith(
'/developer/customer/',
newCustomerParams
)
expect(r3.post).toBeCalledWith('/developer/customer/', newCustomerParams)
expect(newContact).toEqual({

@@ -469,5 +458,3 @@ accountCreated: false,

jest.spyOn(r3, 'get')
r3.devices.metadata = jest.fn(() =>
Promise.resolve(mockData.rawMetadata.devices)
)
r3.devices.metadata = jest.fn(() => Promise.resolve(mockData.rawMetadata.devices))
;(r3.axios.request as jest.Mock).mockResolvedValueOnce({

@@ -485,5 +472,3 @@ data: mockData.rawDevices,

jest.spyOn(r3, 'get')
r3.devices.metadata = jest.fn(() =>
Promise.resolve(mockData.rawMetadata.devices)
)
r3.devices.metadata = jest.fn(() => Promise.resolve(mockData.rawMetadata.devices))
;(r3.axios.request as jest.Mock).mockResolvedValueOnce({

@@ -501,5 +486,3 @@ data: mockData.rawDevices,

jest.spyOn(r3, 'post')
r3.devices.metadata = jest.fn(() =>
Promise.resolve(mockData.rawMetadata.devices)
)
r3.devices.metadata = jest.fn(() => Promise.resolve(mockData.rawMetadata.devices))
;(r3.axios.request as jest.Mock).mockResolvedValueOnce({

@@ -646,6 +629,3 @@ data: mockData.rawDevices,

test('should return a device and its services', () => {
const devices = r3.devices.group(
mockData.rawDevices.devices,
mockData.rawMetadata.devices
)
const devices = r3.devices.group(mockData.rawDevices.devices, mockData.rawMetadata.devices)
expect(devices).toHaveLength(3)

@@ -826,17 +806,14 @@ expect(devices).toEqual([

await r3.devices.transfer(devices, email)
expect(r3.post).toBeCalledWith(
'/developer/devices/invitation/transfer/',
{
actionurl: `${r3.successURL}/invite/accept?type=transfer&id=`,
queue_name: 'WeavedTaskQueue',
function: 'transfer_devices',
label: 'transferring',
email,
options: JSON.stringify({
devices: devices.map(d => d.id).join(','),
emails: email,
newuser: email,
}),
}
)
expect(r3.post).toBeCalledWith('/developer/devices/invitation/transfer/', {
actionurl: `${r3.successURL}/invite/accept?type=transfer&id=`,
queue_name: 'WeavedTaskQueue',
function: 'transfer_devices',
label: 'transferring',
email,
options: JSON.stringify({
devices: devices.map(d => d.id).join(','),
emails: email,
newuser: email,
}),
})
})

@@ -850,4 +827,3 @@ })

const file = {
key:
'279DB3AD-142D-4571-9FD9-15F75F461BA7/file/Screen Shot 2018-09-13 at 2.27.13 PM.png',
key: '279DB3AD-142D-4571-9FD9-15F75F461BA7/file/Screen Shot 2018-09-13 at 2.27.13 PM.png',
last_modified: '2018-09-13T22:28:14.000Z',

@@ -879,4 +855,3 @@ name: 'Screen Shot 2018-09-13 at 2.27.13 PM.png',

jest.spyOn(r3, 'post')
const key =
'279DB3AD-142D-4571-9FD9-15F75F461BA7/file/Screen Shot 2018-09-13 at 2.27.13 PM.png'
const key = '279DB3AD-142D-4571-9FD9-15F75F461BA7/file/Screen Shot 2018-09-13 at 2.27.13 PM.png'
;(r3.axios.request as jest.Mock).mockResolvedValueOnce(undefined)

@@ -893,4 +868,3 @@ const resp = await r3.files.destroy(key)

const file = {
key:
'279DB3AD-142D-4571-9FD9-15F75F461BA7/file/Screen Shot 2018-09-13 at 2.27.13 PM.png',
key: '279DB3AD-142D-4571-9FD9-15F75F461BA7/file/Screen Shot 2018-09-13 at 2.27.13 PM.png',
last_modified: '2018-09-13T22:28:14.000Z',

@@ -897,0 +871,0 @@ name: 'Screen Shot 2018-09-13 at 2.27.13 PM.png',

@@ -5,15 +5,15 @@ import { parseLegacyDate } from '../src/utils'

test('should parse date into date object', async () => {
expect(
parseLegacyDate('12/14/2018T7:00 AM -0500', 'M/d/yTh:mm a ZZZ')
).toEqual(new Date('December 14, 2018 12:00:00 UTC'))
expect(
parseLegacyDate('3/5/2020T2:15 PM -0500', 'M/d/yTh:mm a ZZZ')
).toEqual(new Date('March 5, 2020 19:15:00 UTC'))
expect(
parseLegacyDate('12/31/2019T7:00 PM -0500', 'M/d/yTh:mm a ZZZ')
).toEqual(new Date('January 1, 2020 00:00:00 UTC'))
expect(
parseLegacyDate('2019-07-25 12:03:35 -0500', 'y-MM-dd h:mm:ss ZZZ')
).toEqual(new Date('July 25, 2019 17:03:35 UTC'))
expect(parseLegacyDate('12/14/2018T7:00 AM -0500', 'M/d/yTh:mm a ZZZ')).toEqual(
new Date('December 14, 2018 12:00:00 UTC')
)
expect(parseLegacyDate('3/5/2020T2:15 PM -0500', 'M/d/yTh:mm a ZZZ')).toEqual(
new Date('March 5, 2020 19:15:00 UTC')
)
expect(parseLegacyDate('12/31/2019T7:00 PM -0500', 'M/d/yTh:mm a ZZZ')).toEqual(
new Date('January 1, 2020 00:00:00 UTC')
)
expect(parseLegacyDate('2019-07-25 12:03:35 -0500', 'y-MM-dd h:mm:ss ZZZ')).toEqual(
new Date('July 25, 2019 17:03:35 UTC')
)
})
})

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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