@astram/guard 0.34.2 → 0.35.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.
|
@@ -13,8 +13,10 @@ export interface S3ObjectStoreOptions {
|
|
|
13
13
|
* (`If-None-Match: *`), atomic on the server. `'head-first'`: for a backend that does not
|
|
14
14
|
* support conditional PUT (SPEC §5 E assumption) — `head` first, refuse when the key exists,
|
|
15
15
|
* then a plain PUT; not atomic, so it relies on the server-built uuid key for uniqueness.
|
|
16
|
+
* `'none'` (ai-debug-trace SPEC §5 B): a plain PUT that REPLACES the object. Only for a store
|
|
17
|
+
* whose objects are rewritten by design (the agent trace); never for uploads.
|
|
16
18
|
*/
|
|
17
|
-
readonly noOverwrite?: 'if-none-match' | 'head-first';
|
|
19
|
+
readonly noOverwrite?: 'if-none-match' | 'head-first' | 'none';
|
|
18
20
|
}
|
|
19
21
|
export declare class S3ObjectStore implements ObjectStore {
|
|
20
22
|
private readonly config;
|
|
@@ -31,5 +33,17 @@ export declare class S3ObjectStore implements ObjectStore {
|
|
|
31
33
|
head(key: string): Promise<StoredObjectHead | null>;
|
|
32
34
|
delete(key: string): Promise<void>;
|
|
33
35
|
ping(): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* A write-only boot check (ai-debug-trace SPEC §5 A, §8): `HeadBucket`, then one small probe
|
|
38
|
+
* object under `_probe/` that is NOT read back or deleted (the trace credential is put-only;
|
|
39
|
+
* the bucket's lifecycle rule expires the probe). Fixed error, no cause.
|
|
40
|
+
*/
|
|
41
|
+
pingWriteOnly(): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the bucket has a lifecycle (expiry) rule: `'rules'`, `'none'` (the backend says no
|
|
44
|
+
* configuration exists) or `'unknown'` (not readable with this credential, or an error). Never
|
|
45
|
+
* throws and never carries a cause (ai-debug-trace SPEC §5 A.5).
|
|
46
|
+
*/
|
|
47
|
+
lifecycle(): Promise<'rules' | 'none' | 'unknown'>;
|
|
34
48
|
}
|
|
35
49
|
//# sourceMappingURL=s3-object-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3-object-store.d.ts","sourceRoot":"","sources":["../../src/storage/s3-object-store.ts"],"names":[],"mappings":"AAoBA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAiBnE;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,mBAAmB,EACnB,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,aAAa,GAAG,iBAAiB,GAAG,KAAK,CAC7E,GAAG;IAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnC,MAAM,WAAW,oBAAoB;IACnC
|
|
1
|
+
{"version":3,"file":"s3-object-store.d.ts","sourceRoot":"","sources":["../../src/storage/s3-object-store.ts"],"names":[],"mappings":"AAoBA,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACtB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAiBnE;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,CACpC,mBAAmB,EACnB,UAAU,GAAG,QAAQ,GAAG,QAAQ,GAAG,aAAa,GAAG,iBAAiB,GAAG,KAAK,CAC7E,GAAG;IAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnC,MAAM,WAAW,oBAAoB;IACnC;;;;;;;OAOG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,eAAe,GAAG,YAAY,GAAG,MAAM,CAAC;CAChE;AAWD,qBAAa,aAAc,YAAW,WAAW;IAC/C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsB;IAC7C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAW;IAC/B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA0C;IACtE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,UAAU,CAAkC;gBAExC,MAAM,EAAE,mBAAmB,EAAE,OAAO,GAAE,oBAAyB;IAc3E,kDAAkD;IAClD,OAAO,CAAC,OAAO;IAmBT,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAyBvE,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IA2BvC,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAcnD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUlC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAoB3B;;;;OAIG;IACG,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAcpC;;;;OAIG;IACG,SAAS,IAAI,OAAO,CAAC,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC;CAezD"}
|
|
@@ -210,6 +210,44 @@ class S3ObjectStore {
|
|
|
210
210
|
await this.delete(key).catch(() => undefined);
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* A write-only boot check (ai-debug-trace SPEC §5 A, §8): `HeadBucket`, then one small probe
|
|
215
|
+
* object under `_probe/` that is NOT read back or deleted (the trace credential is put-only;
|
|
216
|
+
* the bucket's lifecycle rule expires the probe). Fixed error, no cause.
|
|
217
|
+
*/
|
|
218
|
+
async pingWriteOnly() {
|
|
219
|
+
const { sdk, client } = await this.connect();
|
|
220
|
+
try {
|
|
221
|
+
await client.send(new sdk.HeadBucketCommand({ Bucket: this.bucket }));
|
|
222
|
+
}
|
|
223
|
+
catch {
|
|
224
|
+
throw new core_1.ObjectStoreUnavailableError();
|
|
225
|
+
}
|
|
226
|
+
const sha256 = (0, node_crypto_1.createHash)('sha256').update(PROBE_BYTES).digest('hex');
|
|
227
|
+
await this.put(`_probe/${(0, node_crypto_1.randomUUID)()}`, PROBE_BYTES, {
|
|
228
|
+
contentType: PROBE_CONTENT_TYPE,
|
|
229
|
+
sha256,
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Whether the bucket has a lifecycle (expiry) rule: `'rules'`, `'none'` (the backend says no
|
|
234
|
+
* configuration exists) or `'unknown'` (not readable with this credential, or an error). Never
|
|
235
|
+
* throws and never carries a cause (ai-debug-trace SPEC §5 A.5).
|
|
236
|
+
*/
|
|
237
|
+
async lifecycle() {
|
|
238
|
+
try {
|
|
239
|
+
const { sdk, client } = await this.connect();
|
|
240
|
+
const out = await client.send(new sdk.GetBucketLifecycleConfigurationCommand({ Bucket: this.bucket }));
|
|
241
|
+
return (out.Rules?.length ?? 0) > 0 ? 'rules' : 'none';
|
|
242
|
+
}
|
|
243
|
+
catch (e) {
|
|
244
|
+
const name = e?.name;
|
|
245
|
+
const code = e?.Code;
|
|
246
|
+
return name === 'NoSuchLifecycleConfiguration' || code === 'NoSuchLifecycleConfiguration'
|
|
247
|
+
? 'none'
|
|
248
|
+
: 'unknown';
|
|
249
|
+
}
|
|
250
|
+
}
|
|
213
251
|
}
|
|
214
252
|
exports.S3ObjectStore = S3ObjectStore;
|
|
215
253
|
/** Best-effort release of an unread response body (a Node stream in the SDK's Node runtime). */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astram/guard",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.35.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Astram framework — the enforcement guard + real-world adapters (the 'hands'). One global deny-by-default gate every request passes through (ADR-0002), classification decorators, boot-pool assertion (ADR-0018), the forRoot() registration seam, and the DB/Redis/crypto adapters that connect the sealed core to a real backend. Depends on @astram/core (ADR-0003, ADR-0023).",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"argon2": "^0.41.1",
|
|
37
37
|
"ioredis": "^5.4.1",
|
|
38
38
|
"mariadb": "^3.5.4",
|
|
39
|
-
"@astram/
|
|
40
|
-
"@astram/
|
|
39
|
+
"@astram/core": "1.20.0",
|
|
40
|
+
"@astram/engine": "0.21.1"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@nestjs/common": "^11",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@nestjs/platform-express": "^11",
|
|
46
46
|
"reflect-metadata": "^0.2",
|
|
47
47
|
"rxjs": "^7",
|
|
48
|
-
"@astram/messaging": "^0.1.
|
|
48
|
+
"@astram/messaging": "^0.1.25"
|
|
49
49
|
},
|
|
50
50
|
"peerDependenciesMeta": {
|
|
51
51
|
"@astram/messaging": {
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"typescript": "^5.7.0",
|
|
69
69
|
"unplugin-swc": "^1.5.1",
|
|
70
70
|
"vitest": "^2.1.8",
|
|
71
|
-
"@astram/messaging": "0.1.
|
|
71
|
+
"@astram/messaging": "0.1.25"
|
|
72
72
|
},
|
|
73
73
|
"repository": {
|
|
74
74
|
"type": "git",
|