@pnpm/store.index 1100.2.4 → 1100.3.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/CHANGELOG.md +13 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +28 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @pnpm/store.index
|
|
2
2
|
|
|
3
|
+
## 1100.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Verified remote build artifacts are persisted in the shared store with their signed origin metadata. Later installs reverify the artifact against current trust, policy, platform, and source before reuse, while invalid remote variants are quarantined per channel ([pnpm/pnpm#13771](https://github.com/pnpm/pnpm/issues/13771)).
|
|
8
|
+
|
|
9
|
+
## 1100.2.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies:
|
|
14
|
+
- @pnpm/error@1100.1.3
|
|
15
|
+
|
|
3
16
|
## 1100.2.4
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/lib/index.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ export declare class StoreIndex {
|
|
|
64
64
|
*/
|
|
65
65
|
getRaw(key: string): Uint8Array | undefined;
|
|
66
66
|
set(key: string, data: unknown): void;
|
|
67
|
+
update(key: string, updateValue: (value: unknown) => unknown): boolean;
|
|
67
68
|
delete(key: string): boolean;
|
|
68
69
|
has(key: string): boolean;
|
|
69
70
|
/**
|
|
@@ -123,6 +124,7 @@ export declare class ReadOnlyStoreIndex extends StoreIndex {
|
|
|
123
124
|
protected optimizeBeforeClose(): void;
|
|
124
125
|
set(_key: string, _data: unknown): void;
|
|
125
126
|
delete(_key: string): boolean;
|
|
127
|
+
update(_key: string, _updateValue: (value: unknown) => unknown): boolean;
|
|
126
128
|
queueWrites(_writes: Array<{
|
|
127
129
|
key: string;
|
|
128
130
|
buffer: Uint8Array;
|
package/lib/index.js
CHANGED
|
@@ -170,6 +170,31 @@ export class StoreIndex {
|
|
|
170
170
|
this.stmtSet.run(key, buffer);
|
|
171
171
|
});
|
|
172
172
|
}
|
|
173
|
+
update(key, updateValue) {
|
|
174
|
+
this.flush();
|
|
175
|
+
return sqliteRetry(() => {
|
|
176
|
+
this.db.exec('BEGIN IMMEDIATE');
|
|
177
|
+
try {
|
|
178
|
+
const row = this.stmtGet.get(key);
|
|
179
|
+
if (row == null) {
|
|
180
|
+
this.db.exec('COMMIT');
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
this.stmtSet.run(key, packr.pack(updateValue(packr.unpack(row.data))));
|
|
184
|
+
this.db.exec('COMMIT');
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
catch (updateError) {
|
|
188
|
+
try {
|
|
189
|
+
this.db.exec('ROLLBACK');
|
|
190
|
+
}
|
|
191
|
+
catch (rollbackError) {
|
|
192
|
+
throw new AggregateError([updateError, rollbackError], `Failed to roll back store index update for ${key}`, { cause: rollbackError });
|
|
193
|
+
}
|
|
194
|
+
throw updateError;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}
|
|
173
198
|
delete(key) {
|
|
174
199
|
let result;
|
|
175
200
|
sqliteRetry(() => {
|
|
@@ -351,6 +376,9 @@ export class ReadOnlyStoreIndex extends StoreIndex {
|
|
|
351
376
|
delete(_key) {
|
|
352
377
|
this.throwReadOnly();
|
|
353
378
|
}
|
|
379
|
+
update(_key, _updateValue) {
|
|
380
|
+
this.throwReadOnly();
|
|
381
|
+
}
|
|
354
382
|
queueWrites(_writes) {
|
|
355
383
|
this.throwReadOnly();
|
|
356
384
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pnpm/store.index",
|
|
3
|
-
"version": "1100.
|
|
3
|
+
"version": "1100.3.0",
|
|
4
4
|
"description": "SQLite-backed index for the pnpm content-addressable store",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pnpm",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"!*.map"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@pnpm/error": "1100.1.
|
|
32
|
-
"msgpackr": "2.0.
|
|
31
|
+
"@pnpm/error": "1100.1.3",
|
|
32
|
+
"msgpackr": "2.0.6"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@jest/globals": "30.4.1",
|
|
36
|
-
"@pnpm/store.index": "1100.
|
|
36
|
+
"@pnpm/store.index": "1100.3.0",
|
|
37
37
|
"@types/node": "^22.19.19",
|
|
38
38
|
"tempy": "3.0.0"
|
|
39
39
|
},
|