bun-sqlite-for-rxdb 1.0.1 → 1.1.3

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.
Files changed (88) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/connection-pool.d.ts +4 -0
  3. package/dist/connection-pool.d.ts.map +1 -0
  4. package/{src/index.ts → dist/index.d.ts} +1 -0
  5. package/dist/index.d.ts.map +1 -0
  6. package/dist/index.js +13220 -0
  7. package/dist/instance.d.ts +42 -0
  8. package/dist/instance.d.ts.map +1 -0
  9. package/dist/query/builder.d.ts +6 -0
  10. package/dist/query/builder.d.ts.map +1 -0
  11. package/dist/query/operators.d.ts +21 -0
  12. package/dist/query/operators.d.ts.map +1 -0
  13. package/dist/query/schema-mapper.d.ts +8 -0
  14. package/dist/query/schema-mapper.d.ts.map +1 -0
  15. package/dist/query/smart-regex.d.ts +6 -0
  16. package/dist/query/smart-regex.d.ts.map +1 -0
  17. package/dist/rxdb-helpers.d.ts +28 -0
  18. package/dist/rxdb-helpers.d.ts.map +1 -0
  19. package/dist/statement-manager.d.ts +15 -0
  20. package/dist/statement-manager.d.ts.map +1 -0
  21. package/dist/storage.d.ts +4 -0
  22. package/dist/storage.d.ts.map +1 -0
  23. package/dist/types.d.ts +13 -0
  24. package/dist/types.d.ts.map +1 -0
  25. package/package.json +11 -3
  26. package/.serena/project.yml +0 -84
  27. package/ROADMAP.md +0 -532
  28. package/benchmarks/benchmark.ts +0 -145
  29. package/benchmarks/case-insensitive-10runs.ts +0 -156
  30. package/benchmarks/fts5-1m-scale.ts +0 -126
  31. package/benchmarks/fts5-before-after.ts +0 -104
  32. package/benchmarks/indexed-benchmark.ts +0 -141
  33. package/benchmarks/new-operators-benchmark.ts +0 -140
  34. package/benchmarks/query-builder-benchmark.ts +0 -88
  35. package/benchmarks/query-builder-consistency.ts +0 -109
  36. package/benchmarks/raw-better-sqlite3-10m.ts +0 -85
  37. package/benchmarks/raw-better-sqlite3.ts +0 -86
  38. package/benchmarks/raw-bun-sqlite-10m.ts +0 -85
  39. package/benchmarks/raw-bun-sqlite.ts +0 -86
  40. package/benchmarks/regex-10runs-all.ts +0 -216
  41. package/benchmarks/regex-comparison-benchmark.ts +0 -161
  42. package/benchmarks/regex-real-comparison.ts +0 -213
  43. package/benchmarks/run-10x.sh +0 -19
  44. package/benchmarks/smart-regex-benchmark.ts +0 -148
  45. package/benchmarks/sql-vs-mingo-benchmark.ts +0 -210
  46. package/benchmarks/sql-vs-mingo-comparison.ts +0 -175
  47. package/benchmarks/text-vs-jsonb.ts +0 -167
  48. package/benchmarks/wal-benchmark.ts +0 -112
  49. package/docs/architectural-patterns.md +0 -1336
  50. package/docs/id1-testsuite-journey.md +0 -839
  51. package/docs/official-test-suite-setup.md +0 -393
  52. package/nul +0 -0
  53. package/src/changestream.test.ts +0 -182
  54. package/src/cleanup.test.ts +0 -110
  55. package/src/collection-isolation.test.ts +0 -74
  56. package/src/connection-pool.test.ts +0 -102
  57. package/src/connection-pool.ts +0 -38
  58. package/src/findDocumentsById.test.ts +0 -122
  59. package/src/instance.ts +0 -382
  60. package/src/multi-instance-events.test.ts +0 -204
  61. package/src/query/and-operator.test.ts +0 -39
  62. package/src/query/builder.test.ts +0 -96
  63. package/src/query/builder.ts +0 -154
  64. package/src/query/elemMatch-operator.test.ts +0 -24
  65. package/src/query/exists-operator.test.ts +0 -28
  66. package/src/query/in-operators.test.ts +0 -54
  67. package/src/query/mod-operator.test.ts +0 -22
  68. package/src/query/nested-query.test.ts +0 -198
  69. package/src/query/not-operators.test.ts +0 -49
  70. package/src/query/operators.test.ts +0 -70
  71. package/src/query/operators.ts +0 -185
  72. package/src/query/or-operator.test.ts +0 -68
  73. package/src/query/regex-escaping-regression.test.ts +0 -43
  74. package/src/query/regex-operator.test.ts +0 -44
  75. package/src/query/schema-mapper.ts +0 -27
  76. package/src/query/size-operator.test.ts +0 -22
  77. package/src/query/smart-regex.ts +0 -52
  78. package/src/query/type-operator.test.ts +0 -37
  79. package/src/query-cache.test.ts +0 -286
  80. package/src/rxdb-helpers.test.ts +0 -348
  81. package/src/rxdb-helpers.ts +0 -262
  82. package/src/schema-version-isolation.test.ts +0 -126
  83. package/src/statement-manager.ts +0 -69
  84. package/src/storage.test.ts +0 -589
  85. package/src/storage.ts +0 -21
  86. package/src/types.ts +0 -14
  87. package/test/rxdb-test-suite.ts +0 -27
  88. package/tsconfig.json +0 -31
@@ -0,0 +1,42 @@
1
+ import { Observable } from 'rxjs';
2
+ import type { RxStorageInstance, RxStorageInstanceCreationParams, BulkWriteRow, RxDocumentData, RxStorageBulkWriteResponse, RxStorageQueryResult, RxStorageCountResult, EventBulk, RxStorageChangeEvent, PreparedQuery, RxJsonSchema, RxStorageDefaultCheckpoint } from 'rxdb';
3
+ import type { BunSQLiteStorageSettings, BunSQLiteInternals } from './types';
4
+ export declare class BunSQLiteStorageInstance<RxDocType> implements RxStorageInstance<RxDocType, BunSQLiteInternals, BunSQLiteStorageSettings> {
5
+ private db;
6
+ private stmtManager;
7
+ private changeStream$;
8
+ readonly databaseName: string;
9
+ readonly collectionName: string;
10
+ readonly schema: Readonly<RxJsonSchema<RxDocumentData<RxDocType>>>;
11
+ readonly internals: Readonly<BunSQLiteInternals>;
12
+ readonly options: Readonly<BunSQLiteStorageSettings>;
13
+ private primaryPath;
14
+ private tableName;
15
+ closed?: Promise<void>;
16
+ constructor(params: RxStorageInstanceCreationParams<RxDocType, BunSQLiteStorageSettings>, settings?: BunSQLiteStorageSettings);
17
+ private initTable;
18
+ bulkWrite(documentWrites: BulkWriteRow<RxDocType>[], context: string): Promise<RxStorageBulkWriteResponse<RxDocType>>;
19
+ findDocumentsById(ids: string[], withDeleted: boolean): Promise<RxDocumentData<RxDocType>[]>;
20
+ query(preparedQuery: PreparedQuery<RxDocType>): Promise<RxStorageQueryResult<RxDocType>>;
21
+ private matchesSelector;
22
+ private sortDocuments;
23
+ private getNestedValue;
24
+ count(preparedQuery: PreparedQuery<RxDocType>): Promise<RxStorageCountResult>;
25
+ changeStream(): Observable<EventBulk<RxStorageChangeEvent<RxDocumentData<RxDocType>>, RxStorageDefaultCheckpoint>>;
26
+ cleanup(minimumDeletedTime: number): Promise<boolean>;
27
+ close(): Promise<void>;
28
+ remove(): Promise<void>;
29
+ private attachmentMapKey;
30
+ getAttachmentData(documentId: string, attachmentId: string, digest: string): Promise<string>;
31
+ getChangedDocumentsSince(limit: number, checkpoint?: {
32
+ id: string;
33
+ lwt: number;
34
+ }): Promise<{
35
+ documents: RxDocumentData<RxDocType>[];
36
+ checkpoint: {
37
+ id: string;
38
+ lwt: number;
39
+ } | null;
40
+ }>;
41
+ }
42
+ //# sourceMappingURL=instance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"instance.d.ts","sourceRoot":"","sources":["../src/instance.ts"],"names":[],"mappings":"AACA,OAAO,EAAW,UAAU,EAAE,MAAM,MAAM,CAAC;AAC3C,OAAO,KAAK,EACX,iBAAiB,EACjB,+BAA+B,EAC/B,YAAY,EACZ,cAAc,EACd,0BAA0B,EAC1B,oBAAoB,EACpB,oBAAoB,EACpB,SAAS,EACT,oBAAoB,EAEpB,aAAa,EACb,YAAY,EAGZ,0BAA0B,EAC1B,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAM5E,qBAAa,wBAAwB,CAAC,SAAS,CAAE,YAAW,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,EAAE,wBAAwB,CAAC;IACrI,OAAO,CAAC,EAAE,CAAW;IACrB,OAAO,CAAC,WAAW,CAAmB;IACtC,OAAO,CAAC,aAAa,CAAyG;IAC9H,SAAgB,YAAY,EAAE,MAAM,CAAC;IACrC,SAAgB,cAAc,EAAE,MAAM,CAAC;IACvC,SAAgB,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAC1E,SAAgB,SAAS,EAAE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,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAa5F,wBAAwB,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE;;;gBAArB,MAAM;iBAAO,MAAM;;;CAmBpF"}
@@ -0,0 +1,6 @@
1
+ import type { RxJsonSchema, MangoQuerySelector, RxDocumentData } from 'rxdb';
2
+ import type { SqlFragment } from './operators';
3
+ export declare function getCacheSize(): number;
4
+ export declare function clearCache(): void;
5
+ export declare function buildWhereClause<RxDocType>(selector: MangoQuerySelector<RxDocumentData<RxDocType>>, schema: RxJsonSchema<RxDocumentData<RxDocType>>): SqlFragment;
6
+ //# sourceMappingURL=builder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../../src/query/builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAG7E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAM/C,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,wBAAgB,UAAU,IAAI,IAAI,CAEjC;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EACzC,QAAQ,EAAE,kBAAkB,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,EACvD,MAAM,EAAE,YAAY,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,GAC7C,WAAW,CAmBb"}
@@ -0,0 +1,21 @@
1
+ export interface SqlFragment {
2
+ sql: string;
3
+ args: (string | number | boolean | null)[];
4
+ }
5
+ export declare function translateEq(field: string, value: unknown): SqlFragment;
6
+ export declare function translateNe(field: string, value: unknown): SqlFragment;
7
+ export declare function translateGt(field: string, value: unknown): SqlFragment;
8
+ export declare function translateGte(field: string, value: unknown): SqlFragment;
9
+ export declare function translateLt(field: string, value: unknown): SqlFragment;
10
+ export declare function translateLte(field: string, value: unknown): SqlFragment;
11
+ export declare function translateIn(field: string, values: unknown[]): SqlFragment;
12
+ export declare function translateNin(field: string, values: unknown[]): SqlFragment;
13
+ export declare function translateExists(field: string, exists: boolean): SqlFragment;
14
+ export declare function translateRegex(field: string, pattern: string, options?: string): SqlFragment | null;
15
+ export declare function translateElemMatch(field: string, criteria: any): SqlFragment | null;
16
+ export declare function translateNot(field: string, criteria: any): SqlFragment;
17
+ export declare function translateNor(conditions: any[]): SqlFragment;
18
+ export declare function translateType(field: string, type: string): SqlFragment | null;
19
+ export declare function translateSize(field: string, size: number): SqlFragment;
20
+ export declare function translateMod(field: string, [divisor, remainder]: [number, number]): SqlFragment;
21
+ //# sourceMappingURL=operators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operators.d.ts","sourceRoot":"","sources":["../../src/query/operators.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC;CAC3C;AAID,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,WAAW,CAKtE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,WAAW,CAKtE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,WAAW,CAEtE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,WAAW,CAEvE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,WAAW,CAEtE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,WAAW,CAEvE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,WAAW,CAuBzE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,WAAW,CAuB1E;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,WAAW,CAK3E;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAKnG;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,WAAW,GAAG,IAAI,CAEnF;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,GAAG,WAAW,CAMtE;AAED,wBAAgB,YAAY,CAAC,UAAU,EAAE,GAAG,EAAE,GAAG,WAAW,CAiB3D;AAsBD,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAkB7E;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAKtE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,WAAW,CAK/F"}
@@ -0,0 +1,8 @@
1
+ import type { RxJsonSchema, RxDocumentData } from 'rxdb';
2
+ export interface ColumnInfo {
3
+ column?: string;
4
+ jsonPath?: string;
5
+ type: 'string' | 'number' | 'boolean' | 'unknown';
6
+ }
7
+ export declare function getColumnInfo<RxDocType>(path: string, schema: RxJsonSchema<RxDocumentData<RxDocType>>): ColumnInfo;
8
+ //# sourceMappingURL=schema-mapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-mapper.d.ts","sourceRoot":"","sources":["../../src/query/schema-mapper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAEzD,MAAM,WAAW,UAAU;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;CAClD;AAED,wBAAgB,aAAa,CAAC,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,GAAG,UAAU,CAkBlH"}
@@ -0,0 +1,6 @@
1
+ export interface SqlFragment {
2
+ sql: string;
3
+ args: (string | number | boolean)[];
4
+ }
5
+ export declare function smartRegexToLike(field: string, pattern: string, options?: string): SqlFragment | null;
6
+ //# sourceMappingURL=smart-regex.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smart-regex.d.ts","sourceRoot":"","sources":["../../src/query/smart-regex.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC;CACpC;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CA8CrG"}
@@ -0,0 +1,28 @@
1
+ import type { RxStorageInstance, BulkWriteRow, RxDocumentData, RxStorageWriteError, EventBulk, RxStorageChangeEvent, RxStorageInstanceCreationParams, RxStorageDefaultCheckpoint, RxAttachmentWriteData } from 'rxdb';
2
+ export interface AttachmentOperation {
3
+ documentId: string;
4
+ attachmentId: string;
5
+ attachmentData: RxAttachmentWriteData;
6
+ digest: string;
7
+ }
8
+ export interface AttachmentRemoveOperation {
9
+ documentId: string;
10
+ attachmentId: string;
11
+ digest: string;
12
+ }
13
+ export declare function getAttachmentSize(attachmentBase64String: string): number;
14
+ export declare function attachmentWriteDataToNormalData(writeData: RxAttachmentWriteData): any;
15
+ export declare function stripAttachmentsDataFromDocument<T>(doc: RxDocumentData<T>): RxDocumentData<T>;
16
+ export declare function stripAttachmentsDataFromRow<T>(writeRow: BulkWriteRow<T>): BulkWriteRow<T>;
17
+ export declare function categorizeBulkWriteRows<RxDocType>(storageInstance: RxStorageInstance<RxDocType, any, any>, primaryPath: string, docsInDb: Map<string, RxDocumentData<RxDocType>>, bulkWriteRows: BulkWriteRow<RxDocType>[], context: string): {
18
+ bulkInsertDocs: BulkWriteRow<RxDocType>[];
19
+ bulkUpdateDocs: BulkWriteRow<RxDocType>[];
20
+ errors: RxStorageWriteError<RxDocType>[];
21
+ eventBulk: EventBulk<RxStorageChangeEvent<RxDocumentData<RxDocType>>, RxStorageDefaultCheckpoint>;
22
+ newestRow?: BulkWriteRow<RxDocType>;
23
+ attachmentsAdd: AttachmentOperation[];
24
+ attachmentsRemove: AttachmentRemoveOperation[];
25
+ attachmentsUpdate: AttachmentOperation[];
26
+ };
27
+ export declare function ensureRxStorageInstanceParamsAreCorrect(params: RxStorageInstanceCreationParams<any, any>): void;
28
+ //# sourceMappingURL=rxdb-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rxdb-helpers.d.ts","sourceRoot":"","sources":["../src/rxdb-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,mBAAmB,EACnB,SAAS,EACT,oBAAoB,EACpB,+BAA+B,EAC/B,0BAA0B,EAC1B,qBAAqB,EACtB,MAAM,MAAM,CAAC;AAEd,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE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EAAE,CAAC;IAC/C,iBAAiB,EAAE,mBAAmB,EAAE,CAAC;CAC1C,CAuKA;AAED,wBAAgB,uCAAuC,CACrD,MAAM,EAAE,+BAA+B,CAAC,GAAG,EAAE,GAAG,CAAC,GAChD,IAAI,CAON"}
@@ -0,0 +1,15 @@
1
+ import type { Database, Changes } from 'bun:sqlite';
2
+ export type QueryWithParams = {
3
+ query: string;
4
+ params: any[];
5
+ };
6
+ export declare class StatementManager {
7
+ private db;
8
+ private staticStatements;
9
+ constructor(db: Database);
10
+ all(queryWithParams: QueryWithParams): any[];
11
+ run(queryWithParams: QueryWithParams): Changes;
12
+ close(): void;
13
+ private isStaticSQL;
14
+ }
15
+ //# sourceMappingURL=statement-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statement-manager.d.ts","sourceRoot":"","sources":["../src/statement-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAa,OAAO,EAAE,MAAM,YAAY,CAAC;AAE/D,MAAM,MAAM,eAAe,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,GAAG,EAAE,CAAC;CACd,CAAC;AAEF,qBAAa,gBAAgB;IAC5B,OAAO,CAAC,EAAE,CAAW;IACrB,OAAO,CAAC,gBAAgB,CAAgC;gBAE5C,EAAE,EAAE,QAAQ;IAIxB,GAAG,CAAC,eAAe,EAAE,eAAe,GAAG,GAAG,EAAE;IAoB5C,GAAG,CAAC,eAAe,EAAE,eAAe,GAAG,OAAO;IAoB9C,KAAK,IAAI,IAAI;IAOb,OAAO,CAAC,WAAW;CAMnB"}
@@ -0,0 +1,4 @@
1
+ import type { RxStorage } from 'rxdb';
2
+ import type { BunSQLiteStorageSettings, BunSQLiteInternals } from './types';
3
+ export declare function getRxStorageBunSQLite(settings?: BunSQLiteStorageSettings): RxStorage<BunSQLiteInternals, BunSQLiteStorageSettings>;
4
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAmC,MAAM,MAAM,CAAC;AAEvE,OAAO,KAAK,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAG5E,wBAAgB,qBAAqB,CACpC,QAAQ,GAAE,wBAA6B,GACrC,SAAS,CAAC,kBAAkB,EAAE,wBAAwB,CAAC,CAazD"}
@@ -0,0 +1,13 @@
1
+ import type { Database } from 'bun:sqlite';
2
+ export interface BunSQLiteStorageSettings {
3
+ /**
4
+ * Database file path. Use ':memory:' for in-memory database.
5
+ * @default ':memory:'
6
+ */
7
+ filename?: string;
8
+ }
9
+ export interface BunSQLiteInternals {
10
+ db: Database;
11
+ primaryPath: string;
12
+ }
13
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,WAAW,wBAAwB;IACxC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IAClC,EAAE,EAAE,QAAQ,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACpB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bun-sqlite-for-rxdb",
3
- "version": "1.0.1",
3
+ "version": "1.1.3",
4
4
  "author": "adam2am",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,8 +30,16 @@
30
30
  "reactive"
31
31
  ],
32
32
  "license": "MIT",
33
+ "files": [
34
+ "dist/",
35
+ "!dist/**/*.test.d.ts",
36
+ "!dist/**/*.test.d.ts.map",
37
+ "README.md",
38
+ "LICENSE",
39
+ "CHANGELOG.md"
40
+ ],
33
41
  "scripts": {
34
- "build": "bun build src/index.ts --outdir dist --target bun",
42
+ "build": "bun build src/index.ts --outdir dist --target bun && tsc --emitDeclarationOnly --declaration --outDir dist",
35
43
  "test": "bun test src/",
36
44
  "typecheck": "tsc --noEmit"
37
45
  },
@@ -41,4 +49,4 @@
41
49
  "fast-stable-stringify": "^1.0.0",
42
50
  "mingo": "^7.2.0"
43
51
  }
44
- }
52
+ }
@@ -1,84 +0,0 @@
1
- # list of languages for which language servers are started; choose from:
2
- # al bash clojure cpp csharp csharp_omnisharp
3
- # dart elixir elm erlang fortran go
4
- # haskell java julia kotlin lua markdown
5
- # nix perl php python python_jedi r
6
- # rego ruby ruby_solargraph rust scala swift
7
- # terraform typescript typescript_vts yaml zig
8
- # Note:
9
- # - For C, use cpp
10
- # - For JavaScript, use typescript
11
- # Special requirements:
12
- # - csharp: Requires the presence of a .sln file in the project folder.
13
- # When using multiple languages, the first language server that supports a given file will be used for that file.
14
- # The first language is the default language and the respective language server will be used as a fallback.
15
- # Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
16
- languages:
17
- - typescript
18
-
19
- # the encoding used by text files in the project
20
- # For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
21
- encoding: "utf-8"
22
-
23
- # whether to use the project's gitignore file to ignore files
24
- # Added on 2025-04-07
25
- ignore_all_files_in_gitignore: true
26
-
27
- # list of additional paths to ignore
28
- # same syntax as gitignore, so you can use * and **
29
- # Was previously called `ignored_dirs`, please update your config if you are using that.
30
- # Added (renamed) on 2025-04-07
31
- ignored_paths: []
32
-
33
- # whether the project is in read-only mode
34
- # If set to true, all editing tools will be disabled and attempts to use them will result in an error
35
- # Added on 2025-04-18
36
- read_only: false
37
-
38
- # list of tool names to exclude. We recommend not excluding any tools, see the readme for more details.
39
- # Below is the complete list of tools for convenience.
40
- # To make sure you have the latest list of tools, and to view their descriptions,
41
- # execute `uv run scripts/print_tool_overview.py`.
42
- #
43
- # * `activate_project`: Activates a project by name.
44
- # * `check_onboarding_performed`: Checks whether project onboarding was already performed.
45
- # * `create_text_file`: Creates/overwrites a file in the project directory.
46
- # * `delete_lines`: Deletes a range of lines within a file.
47
- # * `delete_memory`: Deletes a memory from Serena's project-specific memory store.
48
- # * `execute_shell_command`: Executes a shell command.
49
- # * `find_referencing_code_snippets`: Finds code snippets in which the symbol at the given location is referenced.
50
- # * `find_referencing_symbols`: Finds symbols that reference the symbol at the given location (optionally filtered by type).
51
- # * `find_symbol`: Performs a global (or local) search for symbols with/containing a given name/substring (optionally filtered by type).
52
- # * `get_current_config`: Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes.
53
- # * `get_symbols_overview`: Gets an overview of the top-level symbols defined in a given file.
54
- # * `initial_instructions`: Gets the initial instructions for the current project.
55
- # Should only be used in settings where the system prompt cannot be set,
56
- # e.g. in clients you have no control over, like Claude Desktop.
57
- # * `insert_after_symbol`: Inserts content after the end of the definition of a given symbol.
58
- # * `insert_at_line`: Inserts content at a given line in a file.
59
- # * `insert_before_symbol`: Inserts content before the beginning of the definition of a given symbol.
60
- # * `list_dir`: Lists files and directories in the given directory (optionally with recursion).
61
- # * `list_memories`: Lists memories in Serena's project-specific memory store.
62
- # * `onboarding`: Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or building).
63
- # * `prepare_for_new_conversation`: Provides instructions for preparing for a new conversation (in order to continue with the necessary context).
64
- # * `read_file`: Reads a file within the project directory.
65
- # * `read_memory`: Reads the memory with the given name from Serena's project-specific memory store.
66
- # * `remove_project`: Removes a project from the Serena configuration.
67
- # * `replace_lines`: Replaces a range of lines within a file with new content.
68
- # * `replace_symbol_body`: Replaces the full definition of a symbol.
69
- # * `restart_language_server`: Restarts the language server, may be necessary when edits not through Serena happen.
70
- # * `search_for_pattern`: Performs a search for a pattern in the project.
71
- # * `summarize_changes`: Provides instructions for summarizing the changes made to the codebase.
72
- # * `switch_modes`: Activates modes by providing a list of their names
73
- # * `think_about_collected_information`: Thinking tool for pondering the completeness of collected information.
74
- # * `think_about_task_adherence`: Thinking tool for determining whether the agent is still on track with the current task.
75
- # * `think_about_whether_you_are_done`: Thinking tool for determining whether the task is truly completed.
76
- # * `write_memory`: Writes a named memory (for future reference) to Serena's project-specific memory store.
77
- excluded_tools: []
78
-
79
- # initial prompt for the project. It will always be given to the LLM upon activating the project
80
- # (contrary to the memories, which are loaded on demand).
81
- initial_prompt: ""
82
-
83
- project_name: "bun-sqlite-for-rxdb"
84
- included_optional_tools: []