bun-sqlite-for-rxdb 1.3.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,7 @@ export declare class BunSQLiteStorageInstance<RxDocType> implements RxStorageIns
5
5
  private db;
6
6
  private stmtManager;
7
7
  private changeStream$;
8
+ private queryCache;
8
9
  readonly databaseName: string;
9
10
  readonly collectionName: string;
10
11
  readonly schema: Readonly<RxJsonSchema<RxDocumentData<RxDocType>>>;
@@ -18,13 +19,13 @@ export declare class BunSQLiteStorageInstance<RxDocType> implements RxStorageIns
18
19
  bulkWrite(documentWrites: BulkWriteRow<RxDocType>[], context: string): Promise<RxStorageBulkWriteResponse<RxDocType>>;
19
20
  findDocumentsById(ids: string[], withDeleted: boolean): Promise<RxDocumentData<RxDocType>[]>;
20
21
  query(preparedQuery: PreparedQuery<RxDocType>): Promise<RxStorageQueryResult<RxDocType>>;
21
- private matchesSelector;
22
22
  private sortDocuments;
23
23
  private getNestedValue;
24
24
  count(preparedQuery: PreparedQuery<RxDocType>): Promise<RxStorageCountResult>;
25
25
  changeStream(): Observable<EventBulk<RxStorageChangeEvent<RxDocumentData<RxDocType>>, RxStorageDefaultCheckpoint>>;
26
26
  cleanup(minimumDeletedTime: number): Promise<boolean>;
27
27
  close(): Promise<void>;
28
+ getCacheSize(): number;
28
29
  remove(): Promise<void>;
29
30
  private attachmentMapKey;
30
31
  getAttachmentData(documentId: string, attachmentId: string, digest: string): Promise<string>;
@@ -2,5 +2,6 @@ import type { RxJsonSchema, MangoQuerySelector, RxDocumentData } from 'rxdb';
2
2
  import type { SqlFragment } from './operators';
3
3
  export declare function getCacheSize(): number;
4
4
  export declare function clearCache(): void;
5
- export declare function buildWhereClause<RxDocType>(selector: MangoQuerySelector<RxDocumentData<RxDocType>>, schema: RxJsonSchema<RxDocumentData<RxDocType>>, collectionName: string): SqlFragment | null;
5
+ export declare function buildWhereClause<RxDocType>(selector: MangoQuerySelector<RxDocumentData<RxDocType>>, schema: RxJsonSchema<RxDocumentData<RxDocType>>, collectionName: string, cache?: Map<string, SqlFragment | null>): SqlFragment | null;
6
+ export declare function buildLogicalOperator<RxDocType>(operator: 'or' | 'nor' | 'and', conditions: MangoQuerySelector<RxDocumentData<RxDocType>>[], schema: RxJsonSchema<RxDocumentData<RxDocType>>, logicalDepth: number): SqlFragment | null;
6
7
  //# sourceMappingURL=builder.d.ts.map
@@ -0,0 +1,3 @@
1
+ import type { RxDocumentData, MangoQuerySelector } from 'rxdb';
2
+ export declare function matchesSelector<RxDocType>(doc: RxDocumentData<RxDocType>, selector: MangoQuerySelector<RxDocumentData<RxDocType>>): boolean;
3
+ //# sourceMappingURL=lightweight-matcher.d.ts.map
@@ -8,19 +8,20 @@ type OperatorExpression = {
8
8
  [key: string]: unknown;
9
9
  };
10
10
  export type ElemMatchCriteria = QueryValue | OperatorExpression;
11
- export declare function translateEq(field: string, value: unknown): SqlFragment;
12
- export declare function translateNe(field: string, value: unknown): SqlFragment;
13
- export declare function translateGt(field: string, value: unknown): SqlFragment;
14
- export declare function translateGte(field: string, value: unknown): SqlFragment;
15
- export declare function translateLt(field: string, value: unknown): SqlFragment;
16
- export declare function translateLte(field: string, value: unknown): SqlFragment;
17
- export declare function translateIn(field: string, values: unknown[]): SqlFragment;
18
- export declare function translateNin(field: string, values: unknown[]): SqlFragment;
11
+ export declare function translateEq<RxDocType>(field: string, value: unknown, schema?: RxJsonSchema<RxDocumentData<RxDocType>>, actualFieldName?: string): SqlFragment;
12
+ export declare function translateNe<RxDocType>(field: string, value: unknown, schema?: RxJsonSchema<RxDocumentData<RxDocType>>, actualFieldName?: string): SqlFragment;
13
+ export declare function translateGt<RxDocType>(field: string, value: unknown, schema?: RxJsonSchema<RxDocumentData<RxDocType>>, actualFieldName?: string): SqlFragment;
14
+ export declare function translateGte<RxDocType>(field: string, value: unknown, schema?: RxJsonSchema<RxDocumentData<RxDocType>>, actualFieldName?: string): SqlFragment;
15
+ export declare function translateLt<RxDocType>(field: string, value: unknown, schema?: RxJsonSchema<RxDocumentData<RxDocType>>, actualFieldName?: string): SqlFragment;
16
+ export declare function translateLte<RxDocType>(field: string, value: unknown, schema?: RxJsonSchema<RxDocumentData<RxDocType>>, actualFieldName?: string): SqlFragment;
17
+ export declare function translateIn<RxDocType>(field: string, values: unknown[], schema?: RxJsonSchema<RxDocumentData<RxDocType>>, actualFieldName?: string): SqlFragment;
18
+ export declare function translateNin<RxDocType>(field: string, values: unknown[], schema?: RxJsonSchema<RxDocumentData<RxDocType>>, actualFieldName?: string): SqlFragment;
19
19
  export declare function translateExists(field: string, exists: boolean): SqlFragment;
20
20
  export declare function translateRegex<RxDocType>(field: string, pattern: string, options: string | undefined, schema: RxJsonSchema<RxDocumentData<RxDocType>>, fieldName: string): SqlFragment | null;
21
- export declare function translateElemMatch(field: string, criteria: ElemMatchCriteria): SqlFragment | null;
22
- export declare function translateNot(field: string, criteria: unknown): SqlFragment | null;
23
- export declare function translateType(jsonColumn: string, fieldName: string, type: string): SqlFragment | null;
21
+ export declare function translateElemMatch<RxDocType>(field: string, criteria: ElemMatchCriteria, schema: RxJsonSchema<RxDocumentData<RxDocType>>, actualFieldName: string): SqlFragment | null;
22
+ export declare function translateLeafOperator<RxDocType>(op: string, field: string, value: unknown, schema: RxJsonSchema<RxDocumentData<RxDocType>>, actualFieldName: string): SqlFragment | null;
23
+ export declare function wrapWithNot(innerFragment: SqlFragment): SqlFragment;
24
+ export declare function translateType(jsonColumn: string, fieldName: string, type: string, isDirectPath?: boolean): SqlFragment | null;
24
25
  export declare function translateSize(field: string, size: number): SqlFragment;
25
26
  export declare function translateMod(field: string, value: unknown): SqlFragment | null;
26
27
  export {};
@@ -2,7 +2,7 @@ import type { RxJsonSchema, RxDocumentData } from 'rxdb';
2
2
  export interface ColumnInfo {
3
3
  column?: string;
4
4
  jsonPath?: string;
5
- type: 'string' | 'number' | 'boolean' | 'unknown';
5
+ type: 'string' | 'number' | 'boolean' | 'array' | 'unknown';
6
6
  }
7
7
  export declare function getColumnInfo<RxDocType>(path: string, schema: RxJsonSchema<RxDocumentData<RxDocType>>): ColumnInfo;
8
8
  //# sourceMappingURL=schema-mapper.d.ts.map
@@ -3,5 +3,6 @@ export interface SqlFragment {
3
3
  sql: string;
4
4
  args: (string | number | boolean)[];
5
5
  }
6
+ export declare function clearRegexCache(): void;
6
7
  export declare function smartRegexToLike<RxDocType>(field: string, pattern: string, options: string | undefined, schema: RxJsonSchema<RxDocumentData<RxDocType>>, fieldName: string): SqlFragment | null;
7
8
  //# sourceMappingURL=smart-regex.d.ts.map
package/package.json CHANGED
@@ -1,18 +1,26 @@
1
1
  {
2
2
  "name": "bun-sqlite-for-rxdb",
3
- "version": "1.3.1",
3
+ "version": "1.5.0",
4
4
  "author": "adam2am",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/adam2am/bun-sqlite-for-rxdb.git"
8
8
  },
9
+ "scripts": {
10
+ "build": "bun build src/index.ts --outdir dist --target bun && tsc --emitDeclarationOnly --declaration --outDir dist",
11
+ "test": "bun test test/",
12
+ "typecheck": "tsc --noEmit"
13
+ },
9
14
  "main": "dist/index.js",
10
15
  "dependencies": {},
11
16
  "devDependencies": {
12
17
  "@types/better-sqlite3": "^7.6.13",
13
18
  "@types/bun": "latest",
14
19
  "better-sqlite3": "^12.6.2",
20
+ "fast-check": "^4.5.3",
21
+ "mingo": "^7.2.0",
15
22
  "rxdb": "^16.21.1",
23
+ "sift": "^17.1.3",
16
24
  "typescript": "^5.0.0"
17
25
  },
18
26
  "peerDependencies": {
@@ -40,14 +48,8 @@
40
48
  "!dist/**/*.test.d.ts.map",
41
49
  "!dist/**/*.d.ts.map",
42
50
  "README.md",
43
- "LICENSE",
44
- "CHANGELOG.md"
51
+ "LICENSE"
45
52
  ],
46
- "scripts": {
47
- "build": "bun build src/index.ts --outdir dist --target bun && tsc --emitDeclarationOnly --declaration --outDir dist",
48
- "test": "bun test src/",
49
- "typecheck": "tsc --noEmit"
50
- },
51
53
  "type": "module",
52
54
  "types": "dist/index.d.ts"
53
55
  }