Skip to content

Commit

Permalink
fix: code fix
Browse files Browse the repository at this point in the history
  • Loading branch information
elribonazo committed Jan 9, 2024
1 parent ddb4483 commit d2a58b7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
21 changes: 17 additions & 4 deletions packages/database/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
* @module database
*/
import SDK from '@atala/prism-wallet-sdk'
import { DatabaseCreateOptions, PlutoCollections, getDefaultCollections } from '@pluto-encrypted/schemas'
import { DatabaseBase } from '@pluto-encrypted/shared'
import { PlutoCollections, getDefaultCollections } from '@pluto-encrypted/schemas'
import { DatabaseBase, ExtendedCollections } from '@pluto-encrypted/shared'
import {
CollectionsOfDatabase,
RxCollection,
RxError
RxCollectionCreator,
RxDumpDatabase,
RxError,
RxStorage
} from 'rxdb'

export type * from './types'
Expand All @@ -21,7 +24,17 @@ export type * from './types'
export const Database = {
createEncrypted: async function createEncrypted<
Collections = CollectionsOfDatabase
>(options: DatabaseCreateOptions<Collections & PlutoCollections>): Promise<DatabaseBase<Collections & PlutoCollections, PlutoCollections> & SDK.Domain.Pluto> {
>(options: {
name: string;
encryptionKey: Uint8Array;
importData?: RxDumpDatabase<ExtendedCollections<Collections & PlutoCollections>>;
storage: RxStorage<any, any>;
autoStart?: boolean;
withDefaultCollections?: boolean;
collections?: {
[key in keyof Collections]: RxCollectionCreator<any>;
};
}): Promise<DatabaseBase<Collections & PlutoCollections, PlutoCollections> & SDK.Domain.Pluto> {
try {
const { name, storage, encryptionKey, importData, autoStart = true, collections, withDefaultCollections = true } = options
if (!storage) {
Expand Down
11 changes: 0 additions & 11 deletions packages/schemas/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,6 @@ export interface PlutoCollectionsCreator {
linksecrets: RxCollectionCreator
}
export type PlutoDatabase<Collections> = RxDatabase<ExtendedCollections<Collections>, any, any>;
export type DatabaseCreateOptions<CreatedCollections> = {
name: string;
encryptionKey: Uint8Array;
importData?: RxDumpDatabase<ExtendedCollections<CreatedCollections>>;
storage: RxStorage<any, any>;
autoStart?: boolean;
withDefaultCollections: boolean;
collections?: {
[key in keyof CreatedCollections]: RxCollectionCreator<any>;
};
};
export type DBOptions = RxDatabaseCreator;
export type PlutoInstance<
Collections = CollectionsOfDatabase,
Expand Down

0 comments on commit d2a58b7

Please sign in to comment.