From 48b76e10602b0b5cc9bc43b9b3abd653e27e1817 Mon Sep 17 00:00:00 2001 From: Ivan Artemiev <29709626+iartemiev@users.noreply.github.com> Date: Tue, 31 Aug 2021 10:11:50 -0400 Subject: [PATCH] fix(@aws-amplify/datastore): remove conditional require (#8828) --- .../src/storage/adapter/getDefaultAdapter/index.ts | 8 ++++---- packages/datastore/src/types.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/datastore/src/storage/adapter/getDefaultAdapter/index.ts b/packages/datastore/src/storage/adapter/getDefaultAdapter/index.ts index c80c1619a0a..47006acfaac 100644 --- a/packages/datastore/src/storage/adapter/getDefaultAdapter/index.ts +++ b/packages/datastore/src/storage/adapter/getDefaultAdapter/index.ts @@ -1,16 +1,16 @@ import { browserOrNode, isWebWorker } from '@aws-amplify/core'; import { Adapter } from '..'; +import IndexedDBAdapter from '../IndexedDBAdapter'; +import AsyncStorageAdapter from '../AsyncStorageAdapter'; const getDefaultAdapter: () => Adapter = () => { const { isBrowser } = browserOrNode(); if ((isBrowser && window.indexedDB) || (isWebWorker() && self.indexedDB)) { - return require('../IndexedDBAdapter').default; + return IndexedDBAdapter; } - const { AsyncStorageAdapter } = require('../AsyncStorageAdapter'); - - return new AsyncStorageAdapter(); + return AsyncStorageAdapter; }; export default getDefaultAdapter; diff --git a/packages/datastore/src/types.ts b/packages/datastore/src/types.ts index 9feb1a265be..27abe95fcb9 100644 --- a/packages/datastore/src/types.ts +++ b/packages/datastore/src/types.ts @@ -631,7 +631,7 @@ export type DataStoreConfig = { }; export type AuthProviders = { - functionAuthProvider: Promise; + functionAuthProvider: () => { token: string } | Promise<{ token: string }>; }; export enum AuthModeStrategyType {