cojson-storage-sqlite 0.10.15 → 0.11.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.
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +13 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/sqliteClient.d.ts +40 -0
- package/dist/sqliteClient.d.ts.map +1 -0
- package/dist/sqliteNode.d.ts +14 -0
- package/dist/sqliteNode.d.ts.map +1 -0
- package/package.json +4 -4
- package/tsconfig.json +3 -1
package/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# cojson-storage-sqlite
|
|
2
2
|
|
|
3
|
+
## 0.11.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a4713df: Moving to the d.ts files for the exported type definitions
|
|
8
|
+
- Updated dependencies [b9d194a]
|
|
9
|
+
- Updated dependencies [a4713df]
|
|
10
|
+
- Updated dependencies [e22de9f]
|
|
11
|
+
- Updated dependencies [34cbdc3]
|
|
12
|
+
- Updated dependencies [0f67e0a]
|
|
13
|
+
- cojson@0.11.0
|
|
14
|
+
- cojson-storage@0.11.0
|
|
15
|
+
|
|
3
16
|
## 0.10.15
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Database as DatabaseT } from "better-sqlite3";
|
|
2
|
+
import { type CojsonInternalTypes, type OutgoingSyncQueue, type SessionID } from "cojson";
|
|
3
|
+
import type { DBClientInterface, SessionRow, SignatureAfterRow, StoredCoValueRow, StoredSessionRow, TransactionRow } from "cojson-storage";
|
|
4
|
+
type RawCoID = CojsonInternalTypes.RawCoID;
|
|
5
|
+
type Signature = CojsonInternalTypes.Signature;
|
|
6
|
+
type Transaction = CojsonInternalTypes.Transaction;
|
|
7
|
+
export type RawCoValueRow = {
|
|
8
|
+
id: CojsonInternalTypes.RawCoID;
|
|
9
|
+
header: string;
|
|
10
|
+
};
|
|
11
|
+
export type RawTransactionRow = {
|
|
12
|
+
ses: number;
|
|
13
|
+
idx: number;
|
|
14
|
+
tx: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function getErrorMessage(error: unknown): string;
|
|
17
|
+
export declare class SQLiteClient implements DBClientInterface {
|
|
18
|
+
private readonly db;
|
|
19
|
+
private readonly toLocalNode;
|
|
20
|
+
constructor(db: DatabaseT, toLocalNode: OutgoingSyncQueue);
|
|
21
|
+
getCoValue(coValueId: RawCoID): StoredCoValueRow | undefined;
|
|
22
|
+
getCoValueSessions(coValueRowId: number): StoredSessionRow[];
|
|
23
|
+
getSingleCoValueSession(coValueRowId: number, sessionID: SessionID): StoredSessionRow | undefined;
|
|
24
|
+
getNewTransactionInSession(sessionRowId: number, firstNewTxIdx: number): TransactionRow[];
|
|
25
|
+
getSignatures(sessionRowId: number, firstNewTxIdx: number): SignatureAfterRow[];
|
|
26
|
+
addCoValue(msg: CojsonInternalTypes.NewContentMessage): number;
|
|
27
|
+
addSessionUpdate({ sessionUpdate, sessionRow, }: {
|
|
28
|
+
sessionUpdate: SessionRow;
|
|
29
|
+
sessionRow?: StoredSessionRow;
|
|
30
|
+
}): number;
|
|
31
|
+
addTransaction(sessionRowID: number, nextIdx: number, newTransaction: Transaction): void;
|
|
32
|
+
addSignatureAfter({ sessionRowID, idx, signature, }: {
|
|
33
|
+
sessionRowID: number;
|
|
34
|
+
idx: number;
|
|
35
|
+
signature: Signature;
|
|
36
|
+
}): void;
|
|
37
|
+
transaction(operationsCallback: () => unknown): undefined;
|
|
38
|
+
}
|
|
39
|
+
export {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AE,MAAM,EACpB,SAAS,EAAE,SAAS,GACnB,gBAAgB,GAAG,SAAS;IAQ/B,0BAA0B,CACxB,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,GACpB,cAAc,EAAE;IAkBnB,aAAa,CACX,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,GACpB,iBAAiB,EAAE;IAQtB,UAAU,CAAC,GAAG,EAAE,mBAAmB,CAAC,iBAAiB,GAAG,MAAM;IAQ9D,gBAAgB,CAAC,EACf,aAAa,EACb,UAAU,GACX,EAAE;QACD,aAAa,EAAE,UAAU,CAAC;QAC1B,UAAU,CAAC,EAAE,gBAAgB,CAAC;KAC/B,GAAG,MAAM;IAkBV,cAAc,CACZ,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,WAAW;IAS7B,iBAAiB,CAAC,EAChB,YAAY,EACZ,GAAG,EACH,SAAS,GACV,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,SAAS,CAAA;KAAE;IAQ9D,WAAW,CAAC,kBAAkB,EAAE,MAAM,OAAO;CAI9C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Database as DatabaseT } from "better-sqlite3";
|
|
2
|
+
import { type IncomingSyncStream, type OutgoingSyncQueue, type Peer } from "cojson";
|
|
3
|
+
export declare class SQLiteNode {
|
|
4
|
+
private readonly syncManager;
|
|
5
|
+
private readonly dbClient;
|
|
6
|
+
constructor(db: DatabaseT, fromLocalNode: IncomingSyncStream, toLocalNode: OutgoingSyncQueue);
|
|
7
|
+
static asPeer({ filename, trace, localNodeName, }: {
|
|
8
|
+
filename: string;
|
|
9
|
+
trace?: boolean;
|
|
10
|
+
localNodeName?: string;
|
|
11
|
+
}): Promise<Peer>;
|
|
12
|
+
static open(filename: string, fromLocalNode: IncomingSyncStream, toLocalNode: OutgoingSyncQueue): Promise<SQLiteNode>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=sqliteNode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqliteNode.d.ts","sourceRoot":"","sources":["../src/sqliteNode.ts"],"names":[],"mappings":"AAAA,OAAiB,EAAE,KAAK,QAAQ,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,IAAI,EAGV,MAAM,QAAQ,CAAC;AAIhB,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;IAC1C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAe;gBAGtC,EAAE,EAAE,SAAS,EACb,aAAa,EAAE,kBAAkB,EACjC,WAAW,EAAE,iBAAiB;WA2CnB,MAAM,CAAC,EAClB,QAAQ,EACR,KAAK,EACL,aAAuB,GACxB,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC,IAAI,CAAC;WAgBJ,IAAI,CACf,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,kBAAkB,EACjC,WAAW,EAAE,iBAAiB;CAwFjC"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cojson-storage-sqlite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.11.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
-
"types": "
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"better-sqlite3": "^11.7.0",
|
|
10
|
-
"cojson": "0.
|
|
11
|
-
"cojson-storage": "0.
|
|
10
|
+
"cojson": "0.11.0",
|
|
11
|
+
"cojson-storage": "0.11.0"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@types/better-sqlite3": "^7.6.12",
|
package/tsconfig.json
CHANGED