diff --git a/CHANGELOG.md b/CHANGELOG.md index 85bce1fb5..45d75e770 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ Also: [Deployment history](https://github.com/hippware/tr-wiki/wiki/Client-deplo Ticket numbers refer to the ticket tracker for this project if not specified. +* Update: phoenix (PR #4855), tslib (PR #4856) + * react-test-renderer (PR #4857), @babel/core (PR #4858) + * typescript (PR #4859), react-dom (PR #4861) +* Make the hamburger/main menu a different colour for Staging (#4830) +* Speculative fix for: TypeError in Transport.ts:1411 (#4288) +* src/components/SignIn.tsx:102: undefined is not an object (#4820) +* Change notification to "... is sharing their location with you" (#4867) + # 4.40.1 - 2020 Feb 27 * Update: @storybook/react-native (PR #4833), tslib (PR #4834) diff --git a/package.json b/package.json index 1c6bd4278..968d15447 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "moment": "^2.24.0", "mst-middlewares": "3.10.2", "patch-package": "^6.0.5", - "phoenix": "^1.4.12", + "phoenix": "^1.4.14", "postinstall-postinstall": "^2.0.0", "prop-types": "^15.7.2", "react": "16.9.0", @@ -100,7 +100,7 @@ "validate.js": "github:hippware/validate.js#969b4fb274b0bb5234b8fe4199cc07dc1acb536e" }, "devDependencies": { - "@babel/core": "^7.8.4", + "@babel/core": "^7.8.6", "@babel/node": "^7.8.4", "@babel/plugin-proposal-decorators": "^7.8.3", "@babel/plugin-proposal-object-rest-spread": "^7.8.3", @@ -126,12 +126,12 @@ "metro-react-native-babel-preset": "^0.58.0", "prettier": "^1.19.1", "pretty-quick": "^2.0.1", - "react-dom": "^16.12.0", - "react-test-renderer": "16.12.0", + "react-dom": "^16.13.0", + "react-test-renderer": "16.13.0", "ts-jest": "^25.2.1", "ts-node": "^8.6.2", "tsconfig-paths": "^3.6.0", - "tslib": "^1.11.0", + "tslib": "^1.11.1", "tslint": "^5.20.1", "tslint-config-prettier": "^1.15.0", "tslint-react": "^4.2.0", diff --git a/patches/@absinthe+socket+0.2.1.patch b/patches/@absinthe+socket+0.2.1.patch index 3b2789c1b..e3607fab6 100644 --- a/patches/@absinthe+socket+0.2.1.patch +++ b/patches/@absinthe+socket+0.2.1.patch @@ -170,3 +170,17 @@ index 9e5f12d..2c38c75 100644 const onTimeout = (absintheSocket, notifier) => notifierNotifyActive( +diff --git a/node_modules/@absinthe/socket/src/subscription.js b/node_modules/@absinthe/socket/src/subscription.js +index de44085..3cf71bd 100644 +--- a/node_modules/@absinthe/socket/src/subscription.js ++++ b/node_modules/@absinthe/socket/src/subscription.js +@@ -143,6 +143,9 @@ const onDataMessage = ( + if (notifier) { + notifierNotifyResultEvent(notifier, payload.result); + } ++ else { ++ console.bugsnagNotify(new Error('Subscription not found'), 'absinthe_socket_subscription_error', payload) ++ } + }; + + const dataMessageEventName = "subscription:data"; diff --git a/src/components/SignIn.tsx b/src/components/SignIn.tsx index 6c2def887..c23ed5586 100644 --- a/src/components/SignIn.tsx +++ b/src/components/SignIn.tsx @@ -16,7 +16,7 @@ import {observer} from 'mobx-react' import {useFirebaseStore} from 'src/utils/injectors' const countryMap = {} -getAllCountries(FlagType.FLAT).then((countries) => { +getAllCountries(FlagType.FLAT).then(countries => { countries.forEach(country => (countryMap[country.cca2] = country)) }) @@ -26,7 +26,7 @@ let defaultCountryCode: CountryCode = 'US' if (CarrierInfo) { CarrierInfo.isoCountryCode(result => { - if (result && result !== 'nil') { + if (result && result !== 'nil' && countryMap[result.toUpperCase()]) { defaultCountryCode = result.toUpperCase() } }) diff --git a/src/store/NotificationStore.ts b/src/store/NotificationStore.ts index 1ef41e22e..f7e7eb0e3 100644 --- a/src/store/NotificationStore.ts +++ b/src/store/NotificationStore.ts @@ -32,7 +32,7 @@ export class NotificationStore { () => { if (getType(self.wocky.notification!).name === EventLocationShare.name) { const profile = (self.wocky.notification as IEventLocationShare)!.sharedWith - self.flash(`${profile.handle} and you are sharing location.`, { + self.flash(`${profile.handle} is sharing their location with you`, { autoCloseTimeout: 3000, profile, }) diff --git a/src/store/store.ts b/src/store/store.ts index 7b7c7b0f1..d9a758745 100644 --- a/src/store/store.ts +++ b/src/store/store.ts @@ -11,7 +11,7 @@ import firebase, {RNFirebase, Firebase} from 'react-native-firebase' import DeviceInfo from 'react-native-device-info' import {actionLogger, Transport, Wocky} from 'wocky-client' import analytics from '../utils/analytics' -import {bugsnagIdentify, bugsnagNotify} from '../utils/bugsnagConfig' +import {bugsnagIdentify} from '../utils/bugsnagConfig' import FirebaseStore from './FirebaseStore' import AuthStore from './AuthStore' import fileService from './fileService' @@ -29,7 +29,7 @@ import GeocodingStore from './GeocodingStore' import {AppInfo} from './AppInfo' import ContactStore from './ContactStore' import reportStore from './ReportStore' -import {log} from 'src/utils/logger' +import {log, modifyConsoleAndGetLogger} from 'src/utils/logger' import {autorun} from 'mobx' import {settings} from '../globals' import AsyncStorage from '@react-native-community/async-storage' @@ -40,13 +40,15 @@ const auth = firebase.auth() const STORE_NAME = 'MainStore' +const logger = modifyConsoleAndGetLogger() + export type IEnv = { transport: Transport auth: RNFirebase.auth.Auth firebase: Firebase fileService: any deviceInfo: TRDeviceInfo - bugsnagNotify: (e: Error, name?: string, extra?: {[name: string]: any}) => void + logger: any } const cleanState = { @@ -136,14 +138,14 @@ function tryMigrate(parsed): object { export async function createStore() { let mstStore, storeData const deviceInfo = await deviceInfoFetch() - const transport = new Transport(await DeviceInfo.getUniqueId()) + const transport = new Transport(await DeviceInfo.getUniqueId(), logger) const env: IEnv = { transport, auth, firebase, fileService, deviceInfo, - bugsnagNotify, + logger, } const appInfo = {jsVersion, nativeVersion: deviceInfo.binaryVersion} try { diff --git a/src/utils/logger.ts b/src/utils/logger.ts index cddb1b568..99245c070 100644 --- a/src/utils/logger.ts +++ b/src/utils/logger.ts @@ -1,3 +1,6 @@ +import {bugsnagNotify} from './bugsnagConfig' +import BackgroundGeolocation from 'react-native-background-geolocation-android' + // tslint:disable:no-console export function log(...args) { if (!__DEV__) return @@ -15,3 +18,39 @@ export function assert(...args) { if (!__DEV__) return ;(console as any).assert(...args) } + +export function modifyConsoleAndGetLogger() { + if (!(console as any)._modified) { + if (!__DEV__) { + const no_op = () => { + // Prevent 'block is empty' lint warning + } + + console.assert = no_op + console.log = no_op + console.info = no_op + console.warn = no_op + console.error = no_op + } + + ;(console as any).persistLog = (s: string): void => { + BackgroundGeolocation.logger.info(s) + if (__DEV__) { + console.log(s) + } + } + ;(console as any).bugsnagNotify = ( + e: Error, + name?: string, + extra?: {[name: string]: any} + ): void => { + bugsnagNotify(e, name, extra) + if (__DEV__) { + console.log(`${name}`, e, extra) + } + } + ;(console as any)._modified = true + } + + return console +} diff --git a/storybook/stories/HomeBannerStory.tsx b/storybook/stories/HomeBannerStory.tsx index 48b64cee1..971fa7b58 100644 --- a/storybook/stories/HomeBannerStory.tsx +++ b/storybook/stories/HomeBannerStory.tsx @@ -35,7 +35,7 @@ const wocky = FakeWockyStore.create( activeBots: [], }, { - transport: new Transport('mock'), + transport: new Transport('mock', console), } ) diff --git a/third-party/wocky-client/src/logger.ts b/third-party/wocky-client/src/logger.ts deleted file mode 100644 index cddb1b568..000000000 --- a/third-party/wocky-client/src/logger.ts +++ /dev/null @@ -1,17 +0,0 @@ -// tslint:disable:no-console -export function log(...args) { - if (!__DEV__) return - console.log(...args) -} -export function warn(...args) { - if (!__DEV__) return - console.warn(...args) -} -export function error(...args) { - if (!__DEV__) return - console.error(...args) -} -export function assert(...args) { - if (!__DEV__) return - ;(console as any).assert(...args) -} diff --git a/third-party/wocky-client/src/model/Location.ts b/third-party/wocky-client/src/model/Location.ts index 5b7b3fb36..cf11aa816 100644 --- a/third-party/wocky-client/src/model/Location.ts +++ b/third-party/wocky-client/src/model/Location.ts @@ -8,6 +8,7 @@ export const createLocation = ({ createdAt, activity, activityConfidence, + id, }: { lat: number lon: number @@ -15,6 +16,7 @@ export const createLocation = ({ createdAt: Date activity: UserActivityType | 'unknown' | '' | null activityConfidence: number | null + id?: string }) => { return Location.create({ latitude: lat, @@ -23,6 +25,7 @@ export const createLocation = ({ createdAt, activity: activity && activity.length && activity !== 'unknown' ? activity : undefined, activityConfidence: activityConfidence || undefined, + id: id || undefined, }) } @@ -36,6 +39,7 @@ export const Location = types types.enumeration(['still', 'on_foot', 'walking', 'in_vehicle', 'on_bicycle', 'running']) ), activityConfidence: types.maybe(types.number), + id: types.maybe(types.string), }) .volatile(() => ({ isCurrent: false, diff --git a/third-party/wocky-client/src/store/Wocky.ts b/third-party/wocky-client/src/store/Wocky.ts index 18a9dfe08..a9f035c16 100644 --- a/third-party/wocky-client/src/store/Wocky.ts +++ b/third-party/wocky-client/src/store/Wocky.ts @@ -13,7 +13,6 @@ import {EventList, createEvent, EventEntity, IEventEntity} from '../model/EventL import _ from 'lodash' import {RequestType} from '../model/PaginableList' import {ILocation, ILocationSnapshot, createLocation} from '../model/Location' -import {log} from '../logger' export const Wocky = types .compose( @@ -41,12 +40,6 @@ export const Wocky = types }) .named(SERVICE_NAME) .actions(self => ({ - bugsnagNotify: (e: Error, name?: string, extra?: {[name: string]: any}): void => { - const env = getEnv(self) - if (env.bugsnagNotify) { - env.bugsnagNotify(e, name, extra) - } - }, loadProfile: flow(function*(id: string) { yield waitFor(() => self.connected) const isOwn = id === self.username @@ -69,8 +62,12 @@ export const Wocky = types }) as (id: string) => Promise, })) .extend(self => { + const logger = getEnv(self).logger return { views: { + get logger() { + return logger + }, get connecting() { return self.transport.connecting }, @@ -348,7 +345,7 @@ export const Wocky = types } return item } catch (e) { - log('ONNOTIFICATION ERROR: ' + e.message) + self.logger.log('ONNOTIFICATION ERROR: ' + e.message) } // } }, @@ -492,12 +489,6 @@ export const Wocky = types profile.setLocation( createLocation({...location, createdAt: iso8601toDate(location.capturedAt)}) ) - } else { - self.bugsnagNotify( - new Error('Unable to setLocation due to profile not found'), - 'wocky_sharedLocation_profile_not_found', - {id, location} - ) } } ), diff --git a/third-party/wocky-client/src/transport/Transport.ts b/third-party/wocky-client/src/transport/Transport.ts index 9daeb4b67..97a5dc9e2 100644 --- a/third-party/wocky-client/src/transport/Transport.ts +++ b/third-party/wocky-client/src/transport/Transport.ts @@ -1,4 +1,4 @@ -import {ApolloClient, MutationOptions} from 'apollo-client' +import {ApolloClient, MutationOptions, QueryOptions, ApolloQueryResult} from 'apollo-client' import {InMemoryCache, IntrospectionFragmentMatcher} from 'apollo-cache-inmemory' import gql from 'graphql-tag' import {IPagingList, MediaUploadParams} from './types' @@ -40,6 +40,7 @@ import {IBotPostIn} from '../model/BotPost' import {OperationDefinitionNode} from 'graphql' import {IMessageIn} from '../model/Message' import {IEventData} from '../model/Event' +import {FetchResult} from 'apollo-link' export type PaginableLoadType = {list: T[]; count: number; cursor?: string} export type PaginableLoadPromise = Promise> @@ -55,6 +56,7 @@ export class Transport { username?: string token?: string host?: string + logger?: any @observable connected: boolean = false @observable connecting: boolean = false @@ -65,14 +67,16 @@ export class Transport { @observable rosterItem: any @observable botVisitor: any - constructor(resource: string) { + constructor(resource: string, logger: any) { this.resource = resource this.instance = Transport.instances++ + this.logger = logger } @action async login(token: string, host: string): Promise { this.host = host + this.token = token if (this.connected) { // Already connected return this.connected @@ -136,10 +140,7 @@ export class Transport { } async loadProfile(id: string): Promise { - if (!this.client) { - return null - } - const res = await this.client!.query({ + const res = await this.query({ query: gql` query LoadProfile { user(id: "${id}") { @@ -239,7 +240,7 @@ export class Transport { } async generateId(): Promise { - const res = await this.client!.mutate({ + const res = await this.mutate({ mutation: gql` mutation botCreate { botCreate { @@ -258,7 +259,7 @@ export class Transport { return (res.data as any).botCreate!.result.id } async loadBot(id: string): Promise { - const res = await this.client!.query({ + const res = await this.query({ query: gql` query loadBot($id: String!, $ownUsername: String!){ bot(id: $id) { @@ -287,8 +288,8 @@ export class Transport { return convertBot(res.data.bot) } - async getLocationUploadToken(): Promise { - const res = await this.client!.mutate({ + async getLocationUploadToken(): Promise { + const res = await this.mutate({ mutation: gql` mutation userLocationGetToken { userLocationGetToken { @@ -341,11 +342,10 @@ export class Transport { afterId?: string types: string[] | undefined }): PaginableLoadPromise { - if (this.client) { - const {limit, beforeId, afterId, types} = params - // console.log('& gql load', beforeId, afterId, limit) - const res = await this.client!.query({ - query: gql` + const {limit, beforeId, afterId, types} = params + // console.log('& gql load', beforeId, afterId, limit) + const res = await this.query({ + query: gql` query notifications($first: Int, $last: Int, $beforeId: AInt, $afterId: AInt, $ownUsername: String!, $types: [NotificationType]) { notifications(first: $first, last: $last, beforeId: $beforeId, afterId: $afterId, types: $types) { totalCount @@ -357,20 +357,20 @@ export class Transport { } } `, - variables: {beforeId, afterId, first: limit || 20, ownUsername: this.username, types}, - }) - // console.log('& gql res', JSON.stringify(res.data.notifications)) - if (res.data && res.data.notifications) { - const {totalCount, edges} = res.data.notifications - - const list = convertNotifications(edges)! - return { - count: totalCount, - list, - } + variables: {beforeId, afterId, first: limit || 20, ownUsername: this.username, types}, + }) + // console.log('& gql res', JSON.stringify(res.data.notifications)) + if (res.data && res.data.notifications) { + const {totalCount, edges} = res.data.notifications + + const list = convertNotifications(edges)! + return { + count: totalCount, + list, } + } else { + return {list: [], count: 0} } - return {count: 0, list: []} } async loadSubscribedBots( userId: string, @@ -379,11 +379,28 @@ export class Transport { ): Promise> { return await this.loadBots('SUBSCRIBED_NOT_OWNED', userId, lastId, max) } + async query(options: QueryOptions): Promise> { + if (!this.client) { + if (!this.token) throw new Error('Token is not defined!') + if (!this.host) throw new Error('Host is not defined!') + await this.login(this.token!, this.host!) + } + await waitFor(() => this.connected) + return this.client!.query(options) + } + async mutate(options: MutationOptions): Promise { + if (!this.client) { + if (!this.token) throw new Error('Token is not defined!') + if (!this.host) throw new Error('Host is not defined!') + await this.login(this.token!, this.host!) + } + await waitFor(() => this.connected) + return this.client!.mutate(options) + } async loadGeofenceBots(): PaginableLoadPromise { // load all guest bots - if (this.client) { - const res = await this.client!.query({ - query: gql` + const res = await this.query({ + query: gql` query getActiveBots($ownUsername: String!) { currentUser { id @@ -407,19 +424,16 @@ export class Transport { } } `, - variables: { - ownUsername: this.username, - }, - }) - const bots = res.data.currentUser.activeBots - const list = bots.edges.filter((e: any) => e.node).map((e: any) => convertBot(e.node)) - return { - list, - cursor: bots.edges.length ? bots.edges[bots.edges.length - 1].cursor : null, - count: bots.totalCount, - } - } else { - return {list: [], count: 0} + variables: { + ownUsername: this.username, + }, + }) + const bots = res.data.currentUser.activeBots + const list = bots.edges.filter((e: any) => e.node).map((e: any) => convertBot(e.node)) + return { + list, + cursor: bots.edges.length ? bots.edges[bots.edges.length - 1].cursor : null, + count: bots.totalCount, } } @@ -437,8 +451,11 @@ export class Transport { id: string, lastId?: string, max: number = 10 - ): Promise> { - const res = await this.client!.query({ + ): Promise | null> { + if (!this.client) { + return null + } + const res = await this.query({ query: gql` query loadBot($id: UUID!, $limit: Int, $cursor: String) { bot(id: $id) { @@ -458,7 +475,7 @@ export class Transport { } } async inviteBot(botId: string, userIds: string[]): Promise { - await this.client!.mutate({ + await this.mutate({ mutation: gql` mutation botInvite($input: BotInviteInput!) { botInvite(input: $input) { @@ -475,7 +492,7 @@ export class Transport { {latitude, longitude, accuracy}, accept: boolean = true ) { - await this.client!.mutate({ + await this.mutate({ mutation: gql` mutation botInvitationRespond($input: BotInvitationRespondInput!) { botInvitationRespond(input: $input) { @@ -555,7 +572,7 @@ export class Transport { async downloadTROS(trosUrl: string): Promise { await waitFor(() => this.connected) - const res = await this.client!.query({ + const res = await this.query({ query: gql` query mediaUrls($trosUrl: String!) { mediaUrls(timeout: 10000, trosUrl: $trosUrl) { @@ -578,7 +595,7 @@ export class Transport { // This can throw errors (due to connectionCheck()) async requestUpload({file, size, access}: MediaUploadParams): Promise { this.connectionCheck() - const res = await this.client!.mutate({ + const res = await this.mutate({ mutation: gql` mutation mediaUpload($input: MediaUploadParams!) { mediaUpload(input: $input) { @@ -767,7 +784,7 @@ export class Transport { async loadChatMessages(userId, lastId, max): PaginableLoadPromise { await waitFor(() => this.connected) - const res = await this.client!.query({ + const res = await this.query({ query: gql` query loadChat($otherUser: UUID, $after: String, $first: Int) { currentUser { @@ -800,7 +817,7 @@ export class Transport { async loadChats(max: number = 50): Promise> { await waitFor(() => this.connected) - const res = await this.client!.query({ + const res = await this.query({ query: gql` query loadChats($max: Int) { currentUser { @@ -976,7 +993,7 @@ export class Transport { if (latitudeDelta > 100 || longitudeDelta > 100) { return [] as any } - const res = await this.client!.query({ + const res = await this.query({ query: gql` query loadLocalBots($pointA: Point!, $pointB: Point!, $ownUsername: String!){ localBots(pointA: $pointA, pointB: $pointB) { @@ -1000,7 +1017,7 @@ export class Transport { } async searchUsers(text: string): Promise { - const res = await this.client!.query({ + const res = await this.query({ query: gql` query searchUsers($text: String!){ users(limit: 20, searchTerm: $text) { @@ -1028,7 +1045,7 @@ export class Transport { } async userBulkLookup(phoneNumbers: string[]): Promise { - const res = await this.client!.query({ + const res = await this.query({ query: gql` query userBulkLookup($phoneNumbers: [String]!) { userBulkLookup(phoneNumbers: $phoneNumbers) { @@ -1098,7 +1115,7 @@ export class Transport { } async userInviteGetSender(code: string): Promise { - const res = await this.client!.query({ + const res = await this.query({ query: gql` query userInviteGetSender($code: String!) { userInviteGetSender(inviteCode: $code) { @@ -1121,7 +1138,7 @@ export class Transport { async userInviteMakeUrl(_shareType: FriendShareTypeEnum): Promise { // todo: add the shareType param to the mutation when it's ready on wocky - const res = await this.client!.mutate({ + const res = await this.client!.mutate({ mutation: gql` mutation userInviteMakeUrl { userInviteMakeUrl { @@ -1305,7 +1322,7 @@ export class Transport { /******************************** END SUBSCRIPTIONS ********************************/ private async loadBots(relationship: string, userId: string, after?: string, max: number = 10) { - const res = await this.client!.query({ + const res = await this.query({ query: gql` query loadBots($max: Int!, $ownUsername: String!, $userId: String!, $after: String, $relationship: String!) { user(id: $userId) { @@ -1341,15 +1358,11 @@ export class Transport { * Reduce boilerplate for pass/fail gql mutations. */ private async voidMutation({mutation, variables}: MutationOptions): Promise { - if (!this.client || !this.connected) { - return - } - let name: string = '', res: any // todo: use the name as defined by the Wocky mutation (not the name given to the wrapper) name = (mutation.definitions[0] as OperationDefinitionNode).name!.value - res = await this.client!.mutate({mutation, variables}) + res = await this.mutate({mutation, variables}) if (res.data && !res.data![name].successful) { // console.error('voidMutation error with ', name, JSON.stringify(res.data[name])) throw new Error(`GraphQL ${name} error: ${JSON.stringify(res.data![name])}`) @@ -1363,7 +1376,7 @@ export class Transport { lastId?: string, max: number = 10 ): Promise> { - const res = await this.client!.query({ + const res = await this.query({ query: gql` query getBotProfiles($botId: UUID!, $cursor: String, $limit: Int) { bot(id: $botId) { @@ -1445,8 +1458,7 @@ export class Transport { // } // } - // tslint:disable-next-line - console.log( + this.logger.log( `${new Date().toISOString()} | socket(${ this.instance }):${kind} | ${msg} | ${JSON.stringify(data)}` diff --git a/third-party/wocky-client/src/transport/constants.ts b/third-party/wocky-client/src/transport/constants.ts index c335916d8..2b0bc2ed7 100644 --- a/third-party/wocky-client/src/transport/constants.ts +++ b/third-party/wocky-client/src/transport/constants.ts @@ -155,4 +155,5 @@ export const USER_LOCATION_PROPS = ` accuracy activity activityConfidence + id ` diff --git a/third-party/wocky-client/src/transport/utils.ts b/third-party/wocky-client/src/transport/utils.ts index 90e05c635..3f813b685 100644 --- a/third-party/wocky-client/src/transport/utils.ts +++ b/third-party/wocky-client/src/transport/utils.ts @@ -14,7 +14,6 @@ import {IEventLocationShareData} from '../model/EventLocationShare' import {IEventLocationShareNearbyStartData} from '../model/EventLocationShareNearbyStart' import {IEventLocationShareNearbyEndData} from '../model/EventLocationShareNearbyEnd' import {IEventUserBeFriendData} from '../model/EventUserBefriend' -import {log} from '../logger' export async function waitFor( condition: () => boolean, @@ -503,7 +502,8 @@ export function convertNotification(edge: any): IEventData | {deletedId: string} } return locationShareNearbyEndNotification default: - log('Failed to process notification: ' + JSON.stringify(edge)) + // tslint:disable-next-line + console.log('Failed to process notification: ' + JSON.stringify(edge)) return null } } diff --git a/third-party/wocky-client/test/friendshare.test.ts b/third-party/wocky-client/test/friendshare.test.ts index b6382afe4..8eddbde1c 100644 --- a/third-party/wocky-client/test/friendshare.test.ts +++ b/third-party/wocky-client/test/friendshare.test.ts @@ -73,6 +73,7 @@ describe('Friend Share', () => { let receivedLocation = {...bobAliceProfile.location!} delete receivedLocation.createdAt delete receivedLocation.isCurrent + delete receivedLocation.id expect(receivedLocation).toEqual(theLocation) await alice.setLocation(differentLocation) await waitFor( @@ -82,6 +83,7 @@ describe('Friend Share', () => { receivedLocation = {...bobAliceProfile.location!} delete receivedLocation.createdAt delete receivedLocation.isCurrent + delete receivedLocation.id expect(receivedLocation).toEqual(differentLocation) aliceBobProfile = await alice.loadProfile(bob.username!) @@ -105,6 +107,7 @@ describe('Friend Share', () => { receivedLocation = {...friend!.location!} delete receivedLocation.createdAt delete receivedLocation.isCurrent + delete receivedLocation.id expect(receivedLocation).toEqual(theLocation) await waitFor(() => !!friend!.sharesLocation, 'start sharing location') // change location diff --git a/third-party/wocky-client/test/support/testuser.ts b/third-party/wocky-client/test/support/testuser.ts index 052ad1b0e..4b29b496f 100644 --- a/third-party/wocky-client/test/support/testuser.ts +++ b/third-party/wocky-client/test/support/testuser.ts @@ -14,6 +14,21 @@ const SERVER_NAME = 'testing' // tslint:disable:no-console const fs = require('fs') +// Polyfill some functions that don't exist in the test/nodejs environment +function augmentConsole() { + ;(console as any).persistLog = (s: string): void => { + console.log(s) + } + ;(console as any).bugsnagNotify = ( + e: Error, + name?: string, + extra?: {[name: string]: any} + ): void => { + console.log(`${name}`, e, extra) + } +} +augmentConsole() + function token(credentials: any) { const payload = { aud: 'Wocky', @@ -58,7 +73,7 @@ export function expectedImage() { export async function createUser(num?: number, phoneNum?: string): Promise { try { - const transport = new Transport(SERVER_NAME) + const transport = new Transport(SERVER_NAME, console) const phoneNumber = phoneNum || (num diff --git a/yarn.lock b/yarn.lock index b59bb23fd..b9c40dd69 100644 --- a/yarn.lock +++ b/yarn.lock @@ -34,18 +34,18 @@ dependencies: "@babel/highlight" "^7.8.3" -"@babel/core@^7.0.0", "@babel/core@^7.1.0", "@babel/core@^7.7.5", "@babel/core@^7.8.4": - version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.8.4.tgz#d496799e5c12195b3602d0fddd77294e3e38e80e" - integrity sha512-0LiLrB2PwrVI+a2/IEskBopDYSd8BCb3rOvH7D5tzoWd696TBEduBvuLVm4Nx6rltrLZqvI3MCalB2K2aVzQjA== +"@babel/core@^7.0.0", "@babel/core@^7.1.0", "@babel/core@^7.7.5", "@babel/core@^7.8.6": + version "7.8.6" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.8.6.tgz#27d7df9258a45c2e686b6f18b6c659e563aa4636" + integrity sha512-Sheg7yEJD51YHAvLEV/7Uvw95AeWqYPL3Vk3zGujJKIhJ+8oLw2ALaf3hbucILhKsgSoADOvtKRJuNVdcJkOrg== dependencies: "@babel/code-frame" "^7.8.3" - "@babel/generator" "^7.8.4" + "@babel/generator" "^7.8.6" "@babel/helpers" "^7.8.4" - "@babel/parser" "^7.8.4" - "@babel/template" "^7.8.3" - "@babel/traverse" "^7.8.4" - "@babel/types" "^7.8.3" + "@babel/parser" "^7.8.6" + "@babel/template" "^7.8.6" + "@babel/traverse" "^7.8.6" + "@babel/types" "^7.8.6" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.1" @@ -55,12 +55,12 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/generator@^7.0.0", "@babel/generator@^7.4.0", "@babel/generator@^7.8.4": - version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.8.4.tgz#35bbc74486956fe4251829f9f6c48330e8d0985e" - integrity sha512-PwhclGdRpNAf3IxZb0YVuITPZmmrXz9zf6fH8lT4XbrmfQKr6ryBzhv593P5C6poJRciFCL/eHGW2NuGrgEyxA== +"@babel/generator@^7.0.0", "@babel/generator@^7.4.0", "@babel/generator@^7.8.6": + version "7.8.6" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.8.6.tgz#57adf96d370c9a63c241cd719f9111468578537a" + integrity sha512-4bpOR5ZBz+wWcMeVtcf7FbjcFzCp+817z2/gHNncIRcM9MmKzUhtWCYAq27RAfUrAFwb+OCG1s9WEaVxfi6cjg== dependencies: - "@babel/types" "^7.8.3" + "@babel/types" "^7.8.6" jsesc "^2.5.1" lodash "^4.17.13" source-map "^0.5.0" @@ -319,10 +319,10 @@ resolve "^1.13.1" v8flags "^3.1.1" -"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.4.3", "@babel/parser@^7.7.5", "@babel/parser@^7.8.3", "@babel/parser@^7.8.4": - version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.8.4.tgz#d1dbe64691d60358a974295fa53da074dd2ce8e8" - integrity sha512-0fKu/QqildpXmPVaRBoXOlyBb3MC+J0A66x97qEfLOMkn3u6nfY5esWogQwi/K0BjASYy4DbnsEWnpNL6qT5Mw== +"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.4.3", "@babel/parser@^7.7.5", "@babel/parser@^7.8.6": + version "7.8.6" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.8.6.tgz#ba5c9910cddb77685a008e3c587af8d27b67962c" + integrity sha512-trGNYSfwq5s0SgM1BMEB8hX3NDmO7EP2wsDGDexiaKMB92BaRpS+qZfpkMqUBhcsOTBwNy9B/jieo4ad/t/z2g== "@babel/plugin-external-helpers@^7.0.0": version "7.2.0" @@ -747,34 +747,34 @@ dependencies: regenerator-runtime "^0.13.2" -"@babel/template@^7.0.0", "@babel/template@^7.1.0", "@babel/template@^7.4.0", "@babel/template@^7.4.4", "@babel/template@^7.7.4", "@babel/template@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.8.3.tgz#e02ad04fe262a657809327f578056ca15fd4d1b8" - integrity sha512-04m87AcQgAFdvuoyiQ2kgELr2tV8B4fP/xJAVUL3Yb3bkNdMedD3d0rlSQr3PegP0cms3eHjl1F7PWlvWbU8FQ== +"@babel/template@^7.0.0", "@babel/template@^7.1.0", "@babel/template@^7.4.0", "@babel/template@^7.4.4", "@babel/template@^7.7.4", "@babel/template@^7.8.3", "@babel/template@^7.8.6": + version "7.8.6" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.8.6.tgz#86b22af15f828dfb086474f964dcc3e39c43ce2b" + integrity sha512-zbMsPMy/v0PWFZEhQJ66bqjhH+z0JgMoBWuikXybgG3Gkd/3t5oQ1Rw2WQhnSrsOmsKXnZOx15tkC4qON/+JPg== dependencies: "@babel/code-frame" "^7.8.3" - "@babel/parser" "^7.8.3" - "@babel/types" "^7.8.3" + "@babel/parser" "^7.8.6" + "@babel/types" "^7.8.6" -"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.4.4", "@babel/traverse@^7.5.5", "@babel/traverse@^7.7.4", "@babel/traverse@^7.8.3", "@babel/traverse@^7.8.4": - version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.8.4.tgz#f0845822365f9d5b0e312ed3959d3f827f869e3c" - integrity sha512-NGLJPZwnVEyBPLI+bl9y9aSnxMhsKz42so7ApAv9D+b4vAFPpY013FTS9LdKxcABoIYFU52HcYga1pPlx454mg== +"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.4.4", "@babel/traverse@^7.5.5", "@babel/traverse@^7.7.4", "@babel/traverse@^7.8.3", "@babel/traverse@^7.8.4", "@babel/traverse@^7.8.6": + version "7.8.6" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.8.6.tgz#acfe0c64e1cd991b3e32eae813a6eb564954b5ff" + integrity sha512-2B8l0db/DPi8iinITKuo7cbPznLCEk0kCxDoB9/N6gGNg/gxOXiR/IcymAFPiBwk5w6TtQ27w4wpElgp9btR9A== dependencies: "@babel/code-frame" "^7.8.3" - "@babel/generator" "^7.8.4" + "@babel/generator" "^7.8.6" "@babel/helper-function-name" "^7.8.3" "@babel/helper-split-export-declaration" "^7.8.3" - "@babel/parser" "^7.8.4" - "@babel/types" "^7.8.3" + "@babel/parser" "^7.8.6" + "@babel/types" "^7.8.6" debug "^4.1.0" globals "^11.1.0" lodash "^4.17.13" -"@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.5.5", "@babel/types@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.8.3.tgz#5a383dffa5416db1b73dedffd311ffd0788fb31c" - integrity sha512-jBD+G8+LWpMBBWvVcdr4QysjUE4mU/syrhN17o1u3gx0/WzJB1kwiVZAXRtWbsIPOwW8pF/YJV5+nmetPzepXg== +"@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.5.5", "@babel/types@^7.8.3", "@babel/types@^7.8.6": + version "7.8.6" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.8.6.tgz#629ecc33c2557fcde7126e58053127afdb3e6d01" + integrity sha512-wqz7pgWMIrht3gquyEFPVXeXCti72Rm8ep9b5tQKz9Yg9LzJA3HxosF1SB3Kc81KD1A3XBkkVYtJvCKS2Z/QrA== dependencies: esutils "^2.0.2" lodash "^4.17.13" @@ -8258,10 +8258,10 @@ performance-now@^2.1.0: resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= -phoenix@^1.4.12: - version "1.4.12" - resolved "https://registry.yarnpkg.com/phoenix/-/phoenix-1.4.12.tgz#b426c275e8ca83a80064c920cdd77a2b9e872ec7" - integrity sha512-T3nlAYuM86/SZDttXkuDCAJJb+fkKI28hhLiuBy6GQsR+bKZ+sdh6GZQSMDA8jis9mazBfqrZ+09YQlhXCSawA== +phoenix@^1.4.14: + version "1.4.14" + resolved "https://registry.yarnpkg.com/phoenix/-/phoenix-1.4.14.tgz#96d6e90bc25c57bc46ca4b3894835935e3aae402" + integrity sha512-GnX6/KcXYKdvHs9/Rwo6b0qLj5zvWXLXAOhtFZ6xpY042XfS+is64X6eYwpIxPt93+QttRKdWZyzLIHZFK1ENw== picomatch@^2.0.4, picomatch@^2.0.5: version "2.2.1" @@ -8617,26 +8617,21 @@ react-devtools-core@^3.6.3: shell-quote "^1.6.1" ws "^3.3.1" -react-dom@^16.12.0: - version "16.12.0" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.12.0.tgz#0da4b714b8d13c2038c9396b54a92baea633fe11" - integrity sha512-LMxFfAGrcS3kETtQaCkTKjMiifahaMySFDn71fZUNpPHZQEzmk/GiAeIT8JSOrHB23fnuCOMruL2a8NYlw+8Gw== +react-dom@^16.13.0: + version "16.13.0" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.13.0.tgz#cdde54b48eb9e8a0ca1b3dc9943d9bb409b81866" + integrity sha512-y09d2c4cG220DzdlFkPTnVvGTszVvNpC73v+AaLGLHbkpy3SSgvYq8x0rNwPJ/Rk/CicTNgk0hbHNw1gMEZAXg== dependencies: loose-envify "^1.1.0" object-assign "^4.1.1" prop-types "^15.6.2" - scheduler "^0.18.0" + scheduler "^0.19.0" -react-is@^16.12.0: +react-is@^16.12.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6: version "16.12.0" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c" integrity sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q== -react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6: - version "16.9.0" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.9.0.tgz#21ca9561399aad0ff1a7701c01683e8ca981edcb" - integrity sha512-tJBzzzIgnnRfEm046qRcURvwQnZVXmuCbscxUO5RWrGTXpon2d4c8mI0D8WE6ydVIm29JiLB6+RslkIvym9Rjw== - react-lifecycles-compat@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362" @@ -8973,15 +8968,15 @@ react-refresh@^0.4.0: resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.4.2.tgz#54a277a6caaac2803d88f1d6f13c1dcfbd81e334" integrity sha512-kv5QlFFSZWo7OlJFNYbxRtY66JImuP2LcrFgyJfQaf85gSP+byzG21UbDQEYjU7f//ny8rwiEkO6py2Y+fEgAQ== -react-test-renderer@16.12.0: - version "16.12.0" - resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.12.0.tgz#11417ffda579306d4e841a794d32140f3da1b43f" - integrity sha512-Vj/teSqt2oayaWxkbhQ6gKis+t5JrknXfPVo+aIJ8QwYAqMPH77uptOdrlphyxl8eQI/rtkOYg86i/UWkpFu0w== +react-test-renderer@16.13.0: + version "16.13.0" + resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.13.0.tgz#39ba3bf72cedc8210c3f81983f0bb061b14a3014" + integrity sha512-NQ2S9gdMUa7rgPGpKGyMcwl1d6D9MCF0lftdI3kts6kkiX+qvpC955jNjAZXlIDTjnN9jwFI8A8XhRh/9v0spA== dependencies: object-assign "^4.1.1" prop-types "^15.6.2" react-is "^16.8.6" - scheduler "^0.18.0" + scheduler "^0.19.0" react@16.9.0, react@^16.8.3: version "16.9.0" @@ -9538,10 +9533,10 @@ scheduler@0.15.0: loose-envify "^1.1.0" object-assign "^4.1.1" -scheduler@^0.18.0: - version "0.18.0" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.18.0.tgz#5901ad6659bc1d8f3fdaf36eb7a67b0d6746b1c4" - integrity sha512-agTSHR1Nbfi6ulI0kYNK0203joW2Y5W4po4l+v03tOoiJKpTBbxpNhWDvqc/4IcOw+KLmSiQLTasZ4cab2/UWQ== +scheduler@^0.19.0: + version "0.19.0" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.19.0.tgz#a715d56302de403df742f4a9be11975b32f5698d" + integrity sha512-xowbVaTPe9r7y7RUejcK73/j8tt2jfiyTednOvHbA8JoClvMYCp+r8QegLwK/n8zWQAtZb1fFnER4XLBZXrCxA== dependencies: loose-envify "^1.1.0" object-assign "^4.1.1" @@ -10510,10 +10505,10 @@ tsconfig-paths@^3.6.0: minimist "^1.2.0" strip-bom "^3.0.0" -tslib@^1.10.0, tslib@^1.11.0, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: - version "1.11.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.0.tgz#f1f3528301621a53220d58373ae510ff747a66bc" - integrity sha512-BmndXUtiTn/VDDrJzQE7Mm22Ix3PxgLltW9bSNLoeCY31gnG2OPx0QqJnuc9oMIKioYrz487i6K9o4Pdn0j+Kg== +tslib@^1.10.0, tslib@^1.11.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: + version "1.11.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.11.1.tgz#eb15d128827fbee2841549e171f45ed338ac7e35" + integrity sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA== tslint-config-prettier@^1.15.0: version "1.18.0" @@ -10627,9 +10622,9 @@ typedarray@^0.0.6: integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= typescript@^3.8: - version "3.8.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.2.tgz#91d6868aaead7da74f493c553aeff76c0c0b1d5a" - integrity sha512-EgOVgL/4xfVrCMbhYKUQTdF37SQn4Iw73H5BgCrF1Abdun7Kwy/QZsE/ssAy0y4LxBbvua3PIbFsbRczWWnDdQ== + version "3.8.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061" + integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w== ua-parser-js@^0.7.18: version "0.7.20"