From c4152c0124171495d4e5221faa48b0a438d5149e Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Fri, 28 Aug 2020 09:04:15 -0400 Subject: [PATCH 1/3] fix(integrations): Add localforage type --- packages/integrations/src/offline.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/integrations/src/offline.ts b/packages/integrations/src/offline.ts index dac92c0e5619..f13bd3ea8ed6 100644 --- a/packages/integrations/src/offline.ts +++ b/packages/integrations/src/offline.ts @@ -34,7 +34,7 @@ export class Offline implements Integration { /** * event cache */ - public offlineEventStore: LocalForage; // type imported from localforage + public offlineEventStore: typeof localForage; // type imported from localforage /** * @inheritDoc From 0c9ade2868f5bd735f7fc55ddad28acc37d70fa3 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Fri, 28 Aug 2020 09:18:46 -0400 Subject: [PATCH 2/3] fix(integrations): Use require import --- packages/integrations/package.json | 2 +- packages/integrations/src/offline.ts | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/integrations/package.json b/packages/integrations/package.json index db4ff0cc64cb..6be25cf0accc 100644 --- a/packages/integrations/package.json +++ b/packages/integrations/package.json @@ -18,7 +18,7 @@ "dependencies": { "@sentry/types": "5.22.1", "@sentry/utils": "5.22.1", - "localforage": "^1.8.1", + "localforage": "1.8.1", "tslib": "^1.9.3" }, "devDependencies": { diff --git a/packages/integrations/src/offline.ts b/packages/integrations/src/offline.ts index f13bd3ea8ed6..5d6d451c7eb1 100644 --- a/packages/integrations/src/offline.ts +++ b/packages/integrations/src/offline.ts @@ -1,7 +1,9 @@ import { Event, EventProcessor, Hub, Integration } from '@sentry/types'; import { getGlobalObject, logger, uuid4 } from '@sentry/utils'; -import * as localForage from 'localforage'; +import * as localForageType from 'localforage'; +// eslint-disable-next-line @typescript-eslint/no-var-requires +const localForage = require('localforage'); /** * cache offline errors and send when connected */ @@ -34,7 +36,7 @@ export class Offline implements Integration { /** * event cache */ - public offlineEventStore: typeof localForage; // type imported from localforage + public offlineEventStore: typeof localForageType; // type imported from localforage /** * @inheritDoc @@ -42,6 +44,7 @@ export class Offline implements Integration { public constructor(options: { maxStoredEvents?: number } = {}) { this.global = getGlobalObject(); this.maxStoredEvents = options.maxStoredEvents || 30; // set a reasonable default + // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access this.offlineEventStore = localForage.createInstance({ name: 'sentry/offlineEventStore', }); From 05bb810b868f213012bdcc1993a4bd97c4f4b4b9 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Fri, 28 Aug 2020 09:24:19 -0400 Subject: [PATCH 3/3] Update yarn.lockg --- yarn.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yarn.lock b/yarn.lock index 14a4c677edef..57598a0120c5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12386,10 +12386,10 @@ loader.js@^4.7.0: resolved "https://registry.yarnpkg.com/loader.js/-/loader.js-4.7.0.tgz#a1a52902001c83631efde9688b8ab3799325ef1f" integrity sha512-9M2KvGT6duzGMgkOcTkWb+PR/Q2Oe54df/tLgHGVmFpAmtqJ553xJh6N63iFYI2yjo2PeJXbS5skHi/QpJq4vA== -localforage@^1.8.1: - version "1.9.0" - resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.9.0.tgz#f3e4d32a8300b362b4634cc4e066d9d00d2f09d1" - integrity sha512-rR1oyNrKulpe+VM9cYmcFn6tsHuokyVHFaCM3+osEmxaHTbEk8oQu6eGDfS6DQLWi/N67XRmB8ECG37OES368g== +localforage@1.8.1: + version "1.8.1" + resolved "https://registry.yarnpkg.com/localforage/-/localforage-1.8.1.tgz#f6c0a24b41ab33b10e4dc84342dd696f6f3e3433" + integrity sha512-azSSJJfc7h4bVpi0PGi+SmLQKJl2/8NErI+LhJsrORNikMZnhaQ7rv9fHj+ofwgSHrKRlsDCL/639a6nECIKuQ== dependencies: lie "3.1.1"