@btravstack/storage 0.15.0 → 0.17.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 +1 -1
- package/dist/index.cjs +1 -4
- package/dist/index.mjs +2 -5
- package/dist/s3.cjs +2 -4
- package/dist/s3.d.cts +0 -25
- package/dist/s3.d.mts +0 -25
- package/dist/s3.mjs +4 -4
- package/package.json +15 -15
package/README.md
CHANGED
|
@@ -129,7 +129,7 @@ says so instead of minting a URL that would fail only in production.
|
|
|
129
129
|
fail your request, or how long a link should live. There is no streaming, no
|
|
130
130
|
listing and no bucket management — each reason is on
|
|
131
131
|
[the reference page](https://btravstack.github.io/btravstack/reference/storage),
|
|
132
|
-
and the same reasoning is in [`
|
|
132
|
+
and the same reasoning is in [`AGENTS.md`](./AGENTS.md) for contributors.
|
|
133
133
|
|
|
134
134
|
## License
|
|
135
135
|
|
package/dist/index.cjs
CHANGED
|
@@ -125,10 +125,7 @@ const storage = ({ adapter }) => {
|
|
|
125
125
|
return (0, _btravstack_di.Module)("Storage")({
|
|
126
126
|
imports: [adapter],
|
|
127
127
|
provides: [
|
|
128
|
-
|
|
129
|
-
inject: {},
|
|
130
|
-
value: _btravstack_core.noObserver
|
|
131
|
-
}),
|
|
128
|
+
_btravstack_core.noObserverMember,
|
|
132
129
|
(0, _btravstack_di.Provider)(require_storage.Storage)({
|
|
133
130
|
inject: {
|
|
134
131
|
backend: require_storage.StorageBackend,
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as StorageUnavailable, i as StorageBackend, n as PresignNotSupported, r as Storage, t as ObjectNotFound } from "./storage-CRkwIhac.mjs";
|
|
2
2
|
import { Module, Provider } from "@btravstack/di";
|
|
3
3
|
import { Err, ErrAsync, Ok, OkAsync, P } from "unthrown";
|
|
4
|
-
import { HealthCheckFailed, HealthChecks, Observers,
|
|
4
|
+
import { HealthCheckFailed, HealthChecks, Observers, noObserverMember, observed } from "@btravstack/core";
|
|
5
5
|
//#region src/memory.ts
|
|
6
6
|
/**
|
|
7
7
|
* The in-process adapter: a `Map`, and an honest refusal to presign.
|
|
@@ -124,10 +124,7 @@ const storage = ({ adapter }) => {
|
|
|
124
124
|
return Module("Storage")({
|
|
125
125
|
imports: [adapter],
|
|
126
126
|
provides: [
|
|
127
|
-
|
|
128
|
-
inject: {},
|
|
129
|
-
value: noObserver
|
|
130
|
-
}),
|
|
127
|
+
noObserverMember,
|
|
131
128
|
Provider(Storage)({
|
|
132
129
|
inject: {
|
|
133
130
|
backend: StorageBackend,
|
package/dist/s3.cjs
CHANGED
|
@@ -83,7 +83,7 @@ const s3Storage = () => (0, _btravstack_di.Module)("S3Storage")({
|
|
|
83
83
|
_btravstack_config.Config.provider(StorageConfig)(s3Schema),
|
|
84
84
|
(0, _btravstack_di.Provider)(S3Connection)({
|
|
85
85
|
inject: { config: StorageConfig },
|
|
86
|
-
acquire: ({ config }) => (0, unthrown.
|
|
86
|
+
acquire: ({ config }) => (0, unthrown.Ok)({
|
|
87
87
|
client: new _aws_sdk_client_s3.S3Client({
|
|
88
88
|
endpoint: config.endpoint,
|
|
89
89
|
region: config.region,
|
|
@@ -94,7 +94,7 @@ const s3Storage = () => (0, _btravstack_di.Module)("S3Storage")({
|
|
|
94
94
|
}
|
|
95
95
|
}),
|
|
96
96
|
bucket: config.bucket
|
|
97
|
-
})
|
|
97
|
+
}),
|
|
98
98
|
release: ({ client }) => {
|
|
99
99
|
client.destroy();
|
|
100
100
|
}
|
|
@@ -107,7 +107,5 @@ const s3Storage = () => (0, _btravstack_di.Module)("S3Storage")({
|
|
|
107
107
|
exports: [require_storage.StorageBackend]
|
|
108
108
|
});
|
|
109
109
|
//#endregion
|
|
110
|
-
exports.StorageConfig = StorageConfig;
|
|
111
|
-
exports.s3Schema = s3Schema;
|
|
112
110
|
exports.s3Storage = s3Storage;
|
|
113
111
|
exports.s3StorageBackend = s3StorageBackend;
|
package/dist/s3.d.cts
CHANGED
|
@@ -3,31 +3,6 @@ import { Module, Scope } from "@btravstack/di";
|
|
|
3
3
|
import { S3Client } from "@aws-sdk/client-s3";
|
|
4
4
|
import { ConfigInvalid, Env } from "@btravstack/config";
|
|
5
5
|
//#region src/s3.d.ts
|
|
6
|
-
declare const StorageConfig_base: import("@btravstack/di").PortClass<"StorageConfig">;
|
|
7
|
-
/** What the graph bound from the environment for the S3 adapter. */
|
|
8
|
-
export declare class StorageConfig extends StorageConfig_base<{
|
|
9
|
-
readonly endpoint: string;
|
|
10
|
-
readonly region: string;
|
|
11
|
-
readonly bucket: string;
|
|
12
|
-
readonly accessKeyId: string;
|
|
13
|
-
readonly secretAccessKey: string;
|
|
14
|
-
}> {}
|
|
15
|
-
/**
|
|
16
|
-
* The five variables an S3-compatible store needs, and no sixth.
|
|
17
|
-
*
|
|
18
|
-
* `STORAGE_S3_ENDPOINT` is required rather than defaulted to AWS: every store
|
|
19
|
-
* this port exists for has one, and a default pointing at Amazon would be a
|
|
20
|
-
* surprising bill. **Path-style addressing is not configurable**, it is simply
|
|
21
|
-
* on — every self-hosted store requires it and AWS accepts it, so it is a value
|
|
22
|
-
* that never changes.
|
|
23
|
-
*/
|
|
24
|
-
export declare const s3Schema: import("@btravstack/config").ConfigSchema<Readonly<Record<string, string | undefined>>, {
|
|
25
|
-
readonly endpoint: string;
|
|
26
|
-
readonly region: string;
|
|
27
|
-
readonly bucket: string;
|
|
28
|
-
readonly accessKeyId: string;
|
|
29
|
-
readonly secretAccessKey: string;
|
|
30
|
-
}>;
|
|
31
6
|
/**
|
|
32
7
|
* The adapter's service over a client and a bucket. A delete of a key nobody
|
|
33
8
|
* stored answers `Ok`, which is S3's own idempotent behaviour rather than a
|
package/dist/s3.d.mts
CHANGED
|
@@ -3,31 +3,6 @@ import { Module, Scope } from "@btravstack/di";
|
|
|
3
3
|
import { S3Client } from "@aws-sdk/client-s3";
|
|
4
4
|
import { ConfigInvalid, Env } from "@btravstack/config";
|
|
5
5
|
//#region src/s3.d.ts
|
|
6
|
-
declare const StorageConfig_base: import("@btravstack/di").PortClass<"StorageConfig">;
|
|
7
|
-
/** What the graph bound from the environment for the S3 adapter. */
|
|
8
|
-
export declare class StorageConfig extends StorageConfig_base<{
|
|
9
|
-
readonly endpoint: string;
|
|
10
|
-
readonly region: string;
|
|
11
|
-
readonly bucket: string;
|
|
12
|
-
readonly accessKeyId: string;
|
|
13
|
-
readonly secretAccessKey: string;
|
|
14
|
-
}> {}
|
|
15
|
-
/**
|
|
16
|
-
* The five variables an S3-compatible store needs, and no sixth.
|
|
17
|
-
*
|
|
18
|
-
* `STORAGE_S3_ENDPOINT` is required rather than defaulted to AWS: every store
|
|
19
|
-
* this port exists for has one, and a default pointing at Amazon would be a
|
|
20
|
-
* surprising bill. **Path-style addressing is not configurable**, it is simply
|
|
21
|
-
* on — every self-hosted store requires it and AWS accepts it, so it is a value
|
|
22
|
-
* that never changes.
|
|
23
|
-
*/
|
|
24
|
-
export declare const s3Schema: import("@btravstack/config").ConfigSchema<Readonly<Record<string, string | undefined>>, {
|
|
25
|
-
readonly endpoint: string;
|
|
26
|
-
readonly region: string;
|
|
27
|
-
readonly bucket: string;
|
|
28
|
-
readonly accessKeyId: string;
|
|
29
|
-
readonly secretAccessKey: string;
|
|
30
|
-
}>;
|
|
31
6
|
/**
|
|
32
7
|
* The adapter's service over a client and a bucket. A delete of a key nobody
|
|
33
8
|
* stored answers `Ok`, which is S3's own idempotent behaviour rather than a
|
package/dist/s3.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as StorageUnavailable, i as StorageBackend, t as ObjectNotFound } from "./storage-CRkwIhac.mjs";
|
|
2
2
|
import { Module, Port, Provider } from "@btravstack/di";
|
|
3
|
-
import {
|
|
3
|
+
import { Ok, fromPromise } from "unthrown";
|
|
4
4
|
import { DeleteObjectCommand, GetObjectCommand, PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
|
|
5
5
|
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
|
|
6
6
|
import { Config, Env } from "@btravstack/config";
|
|
@@ -82,7 +82,7 @@ const s3Storage = () => Module("S3Storage")({
|
|
|
82
82
|
Config.provider(StorageConfig)(s3Schema),
|
|
83
83
|
Provider(S3Connection)({
|
|
84
84
|
inject: { config: StorageConfig },
|
|
85
|
-
acquire: ({ config }) =>
|
|
85
|
+
acquire: ({ config }) => Ok({
|
|
86
86
|
client: new S3Client({
|
|
87
87
|
endpoint: config.endpoint,
|
|
88
88
|
region: config.region,
|
|
@@ -93,7 +93,7 @@ const s3Storage = () => Module("S3Storage")({
|
|
|
93
93
|
}
|
|
94
94
|
}),
|
|
95
95
|
bucket: config.bucket
|
|
96
|
-
})
|
|
96
|
+
}),
|
|
97
97
|
release: ({ client }) => {
|
|
98
98
|
client.destroy();
|
|
99
99
|
}
|
|
@@ -106,4 +106,4 @@ const s3Storage = () => Module("S3Storage")({
|
|
|
106
106
|
exports: [StorageBackend]
|
|
107
107
|
});
|
|
108
108
|
//#endregion
|
|
109
|
-
export {
|
|
109
|
+
export { s3Storage, s3StorageBackend };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@btravstack/storage",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "A Storage port for @btravstack/core: an in-memory adapter, an S3-compatible adapter with presigned reads, and a composition that spans, counts and logs every operation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dependency-injection",
|
|
@@ -53,32 +53,32 @@
|
|
|
53
53
|
"./package.json": "./package.json"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@aws-sdk/client-s3": "3.
|
|
57
|
-
"@aws-sdk/s3-request-presigner": "3.
|
|
58
|
-
"@btravstack/config": "0.
|
|
59
|
-
"@btravstack/core": "0.
|
|
60
|
-
"@btravstack/di": "0.
|
|
56
|
+
"@aws-sdk/client-s3": "3.1146.0",
|
|
57
|
+
"@aws-sdk/s3-request-presigner": "3.1146.0",
|
|
58
|
+
"@btravstack/config": "0.17.0",
|
|
59
|
+
"@btravstack/core": "0.17.0",
|
|
60
|
+
"@btravstack/di": "0.17.0",
|
|
61
61
|
"@btravstack/internal-test-infra": "0.0.0",
|
|
62
|
-
"@btravstack/observability": "0.
|
|
62
|
+
"@btravstack/observability": "0.17.0",
|
|
63
63
|
"@btravstack/tsconfig": "0.4.0",
|
|
64
64
|
"@opentelemetry/api": "1.9.1",
|
|
65
65
|
"@opentelemetry/sdk-metrics": "2.11.0",
|
|
66
66
|
"@opentelemetry/sdk-node": "0.222.0",
|
|
67
67
|
"@opentelemetry/sdk-trace": "2.11.0",
|
|
68
|
-
"@types/node": "26.4
|
|
69
|
-
"@unthrown/vitest": "5.
|
|
70
|
-
"@vitest/coverage-v8": "
|
|
68
|
+
"@types/node": "26.6.4",
|
|
69
|
+
"@unthrown/vitest": "5.12.0",
|
|
70
|
+
"@vitest/coverage-v8": "5.0.3",
|
|
71
71
|
"tsdown": "0.23.0",
|
|
72
72
|
"typescript": "7.0.2",
|
|
73
|
-
"unthrown": "5.
|
|
74
|
-
"vitest": "
|
|
73
|
+
"unthrown": "5.12.0",
|
|
74
|
+
"vitest": "5.0.3"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
77
|
"@aws-sdk/client-s3": "^3.1000.0",
|
|
78
78
|
"@aws-sdk/s3-request-presigner": "^3.1000.0",
|
|
79
|
-
"@btravstack/config": "^0.
|
|
80
|
-
"@btravstack/core": "^0.
|
|
81
|
-
"@btravstack/di": "^0.
|
|
79
|
+
"@btravstack/config": "^0.17.0",
|
|
80
|
+
"@btravstack/core": "^0.17.0",
|
|
81
|
+
"@btravstack/di": "^0.17.0",
|
|
82
82
|
"unthrown": "^5.0.0"
|
|
83
83
|
},
|
|
84
84
|
"peerDependenciesMeta": {
|