-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: postgres should not be required in STACKS_API_MODE=offline mode #…
- Loading branch information
Showing
4 changed files
with
97 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
import { EventEmitter } from 'events'; | ||
import { PgStoreEventEmitter } from './pg-store-event-emitter'; | ||
import { PgStore } from './pg-store'; | ||
import { PgWriteStore } from './pg-write-store'; | ||
|
||
export const OfflineDummyStore: PgStore = new Proxy(new EventEmitter() as PgStoreEventEmitter, { | ||
get(target: any, propKey) { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
if (propKey === 'eventEmitter') return target; | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
if (propKey in target) return target[propKey]; | ||
return function () { | ||
throw new Error( | ||
`Cannot call function on the Dummy datastore. Check if the application is running in offline mode.` | ||
); | ||
}; | ||
}, | ||
}); | ||
export const OfflineDummyStore: PgWriteStore = new Proxy( | ||
new EventEmitter() as PgStoreEventEmitter, | ||
{ | ||
get(target: any, propKey) { | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
if (propKey === 'eventEmitter') return target; | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return | ||
if (propKey in target) return target[propKey]; | ||
return function () { | ||
throw new Error( | ||
`Cannot call function on the Dummy datastore. Check if the application is running in offline mode.` | ||
); | ||
}; | ||
}, | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters