@quereus/isolation 0.2.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/README.md +216 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +6 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/isolated-connection.d.ts +32 -0
- package/dist/src/isolated-connection.d.ts.map +1 -0
- package/dist/src/isolated-connection.js +71 -0
- package/dist/src/isolated-connection.js.map +1 -0
- package/dist/src/isolated-table.d.ts +219 -0
- package/dist/src/isolated-table.d.ts.map +1 -0
- package/dist/src/isolated-table.js +785 -0
- package/dist/src/isolated-table.js.map +1 -0
- package/dist/src/isolation-module.d.ts +134 -0
- package/dist/src/isolation-module.d.ts.map +1 -0
- package/dist/src/isolation-module.js +231 -0
- package/dist/src/isolation-module.js.map +1 -0
- package/dist/src/isolation-types.d.ts +34 -0
- package/dist/src/isolation-types.d.ts.map +1 -0
- package/dist/src/isolation-types.js +2 -0
- package/dist/src/isolation-types.js.map +1 -0
- package/dist/src/merge-iterator.d.ts +37 -0
- package/dist/src/merge-iterator.d.ts.map +1 -0
- package/dist/src/merge-iterator.js +98 -0
- package/dist/src/merge-iterator.js.map +1 -0
- package/dist/src/merge-types.d.ts +61 -0
- package/dist/src/merge-types.d.ts.map +1 -0
- package/dist/src/merge-types.js +2 -0
- package/dist/src/merge-types.js.map +1 -0
- package/package.json +55 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { SqlValue, Row } from '@quereus/quereus';
|
|
2
|
+
/**
|
|
3
|
+
* Comparator function for primary keys.
|
|
4
|
+
* Returns negative if a < b, 0 if equal, positive if a > b.
|
|
5
|
+
*/
|
|
6
|
+
export type PKComparator = (a: SqlValue[], b: SqlValue[]) => number;
|
|
7
|
+
/**
|
|
8
|
+
* Function to extract primary key from a row.
|
|
9
|
+
*/
|
|
10
|
+
export type PKExtractor = (row: Row) => SqlValue[];
|
|
11
|
+
/**
|
|
12
|
+
* Comparator function for sort keys (may be PK, index key, or composite).
|
|
13
|
+
* Returns negative if a < b, 0 if equal, positive if a > b.
|
|
14
|
+
*/
|
|
15
|
+
export type SortKeyComparator = (a: SqlValue[], b: SqlValue[]) => number;
|
|
16
|
+
/**
|
|
17
|
+
* Function to extract sort key from a row.
|
|
18
|
+
* For PK scans, this returns the PK.
|
|
19
|
+
* For secondary index scans, this returns [indexKeyParts..., pkParts...].
|
|
20
|
+
*/
|
|
21
|
+
export type SortKeyExtractor = (row: Row) => SqlValue[];
|
|
22
|
+
/**
|
|
23
|
+
* An entry in the overlay stream.
|
|
24
|
+
* Can be a regular row (insert/update) or a tombstone (delete).
|
|
25
|
+
*/
|
|
26
|
+
export interface MergeEntry {
|
|
27
|
+
/** The row data (for inserts/updates) or the PK values (for tombstones) */
|
|
28
|
+
row: Row;
|
|
29
|
+
/** If true, this entry represents a deletion */
|
|
30
|
+
tombstone: boolean;
|
|
31
|
+
/** Pre-extracted primary key for efficient comparison */
|
|
32
|
+
pk: SqlValue[];
|
|
33
|
+
/**
|
|
34
|
+
* Pre-extracted sort key for merge ordering.
|
|
35
|
+
* For PK scans, this equals pk.
|
|
36
|
+
* For secondary index scans, this is [indexKeyParts..., pkParts...].
|
|
37
|
+
*/
|
|
38
|
+
sortKey: SqlValue[];
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Configuration for the merge iterator.
|
|
42
|
+
*/
|
|
43
|
+
export interface MergeConfig {
|
|
44
|
+
/** Compare two primary keys */
|
|
45
|
+
comparePK: PKComparator;
|
|
46
|
+
/** Extract primary key from an underlying row */
|
|
47
|
+
extractPK: PKExtractor;
|
|
48
|
+
/**
|
|
49
|
+
* Compare two sort keys for merge ordering.
|
|
50
|
+
* Defaults to comparePK if not provided.
|
|
51
|
+
* For secondary index scans, compares by index key first, then PK.
|
|
52
|
+
*/
|
|
53
|
+
compareSortKey?: SortKeyComparator;
|
|
54
|
+
/**
|
|
55
|
+
* Extract sort key from an underlying row.
|
|
56
|
+
* Defaults to extractPK if not provided.
|
|
57
|
+
* For secondary index scans, extracts [indexKeyParts..., pkParts...].
|
|
58
|
+
*/
|
|
59
|
+
extractSortKey?: SortKeyExtractor;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=merge-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-types.d.ts","sourceRoot":"","sources":["../../src/merge-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEtD;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,MAAM,CAAC;AAEpE;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,QAAQ,EAAE,CAAC;AAEnD;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,CAAC,EAAE,QAAQ,EAAE,KAAK,MAAM,CAAC;AAEzE;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,QAAQ,EAAE,CAAC;AAExD;;;GAGG;AACH,MAAM,WAAW,UAAU;IAC1B,2EAA2E;IAC3E,GAAG,EAAE,GAAG,CAAC;IAET,gDAAgD;IAChD,SAAS,EAAE,OAAO,CAAC;IAEnB,yDAAyD;IACzD,EAAE,EAAE,QAAQ,EAAE,CAAC;IAEf;;;;OAIG;IACH,OAAO,EAAE,QAAQ,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B,+BAA+B;IAC/B,SAAS,EAAE,YAAY,CAAC;IAExB,iDAAiD;IACjD,SAAS,EAAE,WAAW,CAAC;IAEvB;;;;OAIG;IACH,cAAc,CAAC,EAAE,iBAAiB,CAAC;IAEnC;;;;OAIG;IACH,cAAc,CAAC,EAAE,gBAAgB,CAAC;CAClC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merge-types.js","sourceRoot":"","sources":["../../src/merge-types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@quereus/isolation",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Generic transaction isolation layer for Quereus virtual table modules",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"quereus",
|
|
8
|
+
"sql",
|
|
9
|
+
"database",
|
|
10
|
+
"transaction",
|
|
11
|
+
"isolation",
|
|
12
|
+
"mvcc",
|
|
13
|
+
"acid",
|
|
14
|
+
"virtual-table"
|
|
15
|
+
],
|
|
16
|
+
"publisher": "Got Choices Foundation",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/gotchoices/quereus.git",
|
|
20
|
+
"directory": "packages/quereus-isolation"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"main": "dist/src/index.js",
|
|
24
|
+
"types": "./dist/src/index.d.ts",
|
|
25
|
+
"files": [
|
|
26
|
+
"dist",
|
|
27
|
+
"!**/*.tsbuildinfo"
|
|
28
|
+
],
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/src/index.d.ts",
|
|
32
|
+
"import": "./dist/src/index.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"clean": "rimraf dist",
|
|
37
|
+
"build": "tsc",
|
|
38
|
+
"typecheck": "tsc --noEmit",
|
|
39
|
+
"test": "cd ../.. && node --import ./packages/quereus-isolation/register.mjs node_modules/mocha/bin/mocha.js \"packages/quereus-isolation/test/**/*.spec.ts\" --colors",
|
|
40
|
+
"test:single": "cd ../.. && node --import ./packages/quereus-isolation/register.mjs node_modules/mocha/bin/mocha.js --bail"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"@quereus/quereus": "^0.13.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@quereus/quereus": "*",
|
|
47
|
+
"@types/mocha": "^10.0.10",
|
|
48
|
+
"@types/node": "^22.15.29",
|
|
49
|
+
"chai": "^5.2.0",
|
|
50
|
+
"mocha": "^11.5.0",
|
|
51
|
+
"rimraf": "^6.1.2",
|
|
52
|
+
"ts-node": "^10.9.2",
|
|
53
|
+
"typescript": "^5.8.3"
|
|
54
|
+
}
|
|
55
|
+
}
|