@toa.io/extensions.storages 1.0.0-alpha.282 → 1.0.0-alpha.283

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 CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.0.0-alpha.283](https://github.com/toa-io/toa/compare/v1.0.0-alpha.282...v1.0.0-alpha.283) (2026-09-04)
7
+
8
+ ### Bug Fixes
9
+
10
+ * **storages:** take `Maybe` from core, not from the deprecated package ([bcaeeb3](https://github.com/toa-io/toa/commit/bcaeeb3c76c89af34e94ff569a210d21b7e87f64))
11
+
12
+ ### Features
13
+
14
+ * **extensions:** an extension declares what it puts on a component's context ([133bc2a](https://github.com/toa-io/toa/commit/133bc2aad1e45a2d4aa68a08a5e44ca48d3b7414))
15
+
16
+
6
17
  # [1.0.0-alpha.282](https://github.com/toa-io/toa/compare/v1.0.0-alpha.281...v1.0.0-alpha.282) (2026-09-03)
7
18
 
8
19
  **Note:** Version bump only for package @toa.io/extensions.storages
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/extensions.storages",
3
- "version": "1.0.0-alpha.282",
3
+ "version": "1.0.0-alpha.283",
4
4
  "type": "module",
5
5
  "description": "Toa Storages",
6
6
  "author": "temich <tema.gurtovoy@gmail.com>",
@@ -27,10 +27,10 @@
27
27
  "dependencies": {
28
28
  "@aws-sdk/client-s3": "3.1125.0",
29
29
  "@aws-sdk/lib-storage": "3.1125.0",
30
- "@toa.io/schemas": "1.0.0-alpha.282",
30
+ "@toa.io/schemas": "1.0.0-alpha.283",
31
31
  "cloudinary": "2.11.0",
32
32
  "negotiator": "1.1.0",
33
33
  "openspan": "1.0.0-alpha.277"
34
34
  },
35
- "gitHead": "4007c814725dd015d3bbebb9a28e28a247645c4f"
35
+ "gitHead": "2f52b023bed0ccb2ecdb2b82fe59fbe38bf282e1"
36
36
  }
@@ -1,7 +1,7 @@
1
1
  import * as assert from 'node:assert'
2
2
  import type { Metadata, Stream } from './Entry.js'
3
3
  import type { Readable } from 'node:stream'
4
- import type { Maybe } from '@toa.io/types'
4
+ import type { Maybe } from '@toa.io/core'
5
5
  import type { Secret, Secrets } from './Secrets.js'
6
6
 
7
7
  export abstract class Provider<Options = unknown> {
@@ -0,0 +1,14 @@
1
+ import type { Contribution } from '@toa.io/core'
2
+
3
+ /** What this extension puts on the context of a component that declares it. */
4
+ export function context (declaration: string[]): Contribution | null {
5
+ if (!Array.isArray(declaration) || declaration.length === 0) return null
6
+
7
+ const names = declaration.map((name) => JSON.stringify(name)).join(' | ')
8
+
9
+ return {
10
+ name: 'storages',
11
+ type: `Record<${names}, Storage>`,
12
+ imports: { '@toa.io/extensions.storages': ['Storage'] }
13
+ }
14
+ }
package/source/index.ts CHANGED
@@ -5,3 +5,6 @@ export { manifest } from './manifest.js'
5
5
  export type { Entry, Stream } from './Entry.js'
6
6
  export type { Storage } from './Storage.js'
7
7
  export type * from './providers/index.js'
8
+
9
+ // what this extension puts on a component's context
10
+ export { context } from './context.js'
@@ -4,7 +4,7 @@ import { v2 as cloudinary } from 'cloudinary'
4
4
  import { console } from 'openspan'
5
5
  import { Provider } from '../Provider.js'
6
6
  import { ERR_NOT_FOUND } from '../errors.js'
7
- import type { Maybe } from '@toa.io/types'
7
+ import type { Maybe } from '@toa.io/core'
8
8
  import type { Metadata, Stream } from '../Entry.js'
9
9
  import type { Secret, Secrets } from '../Secrets.js'
10
10
  import type { ReadableStream } from 'node:stream/web'
@@ -4,7 +4,7 @@ import { dirname, join } from 'node:path'
4
4
  import { Provider } from '../Provider.js'
5
5
  import { ERR_NOT_FOUND } from '../errors.js'
6
6
  import type { Readable } from 'node:stream'
7
- import type { Maybe } from '@toa.io/types'
7
+ import type { Maybe } from '@toa.io/core'
8
8
  import type { Metadata, Stream } from '../Entry.js'
9
9
 
10
10
  export interface FileSystemOptions {
@@ -8,7 +8,7 @@ import { console } from 'openspan'
8
8
  import { Provider } from '../Provider.js'
9
9
  import { ERR_NOT_FOUND } from '../errors.js'
10
10
  import type { ReadableStream } from 'node:stream/web'
11
- import type { Maybe } from '@toa.io/types'
11
+ import type { Maybe } from '@toa.io/core'
12
12
  import type { Metadata, Stream } from '../Entry.js'
13
13
  import type { Secret, Secrets } from '../Secrets.js'
14
14
 
@@ -1,6 +1,6 @@
1
1
  import type { Metadata, Stream } from './Entry.js';
2
2
  import type { Readable } from 'node:stream';
3
- import type { Maybe } from '@toa.io/types';
3
+ import type { Maybe } from '@toa.io/core';
4
4
  import type { Secret, Secrets } from './Secrets.js';
5
5
  export declare abstract class Provider<Options = unknown> {
6
6
  static readonly SECRETS?: readonly Secret[];
@@ -0,0 +1,3 @@
1
+ import type { Contribution } from '@toa.io/core';
2
+ /** What this extension puts on the context of a component that declares it. */
3
+ export declare function context(declaration: string[]): Contribution | null;
@@ -0,0 +1,12 @@
1
+ /** What this extension puts on the context of a component that declares it. */
2
+ export function context(declaration) {
3
+ if (!Array.isArray(declaration) || declaration.length === 0)
4
+ return null;
5
+ const names = declaration.map((name) => JSON.stringify(name)).join(' | ');
6
+ return {
7
+ name: 'storages',
8
+ type: `Record<${names}, Storage>`,
9
+ imports: { '@toa.io/extensions.storages': ['Storage'] }
10
+ };
11
+ }
12
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../source/context.ts"],"names":[],"mappings":"AAEA,+EAA+E;AAC/E,MAAM,UAAU,OAAO,CAAE,WAAqB;IAC5C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IAExE,MAAM,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAEzE,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,UAAU,KAAK,YAAY;QACjC,OAAO,EAAE,EAAE,6BAA6B,EAAE,CAAC,SAAS,CAAC,EAAE;KACxD,CAAA;AACH,CAAC"}
@@ -4,3 +4,4 @@ export { manifest } from './manifest.js';
4
4
  export type { Entry, Stream } from './Entry.js';
5
5
  export type { Storage } from './Storage.js';
6
6
  export type * from './providers/index.js';
7
+ export { context } from './context.js';
@@ -1,4 +1,6 @@
1
1
  export { Factory } from './Factory.js';
2
2
  export { deployment } from './deployment.js';
3
3
  export { manifest } from './manifest.js';
4
+ // what this extension puts on a component's context
5
+ export { context } from './context.js';
4
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAMxC,oDAAoD;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA"}
@@ -1,6 +1,6 @@
1
1
  import { Readable } from 'node:stream';
2
2
  import { Provider } from '../Provider.js';
3
- import type { Maybe } from '@toa.io/types';
3
+ import type { Maybe } from '@toa.io/core';
4
4
  import type { Metadata, Stream } from '../Entry.js';
5
5
  import type { Secret, Secrets } from '../Secrets.js';
6
6
  import type { TransformationOptions } from 'cloudinary';
@@ -1,6 +1,6 @@
1
1
  import { Provider } from '../Provider.js';
2
2
  import type { Readable } from 'node:stream';
3
- import type { Maybe } from '@toa.io/types';
3
+ import type { Maybe } from '@toa.io/core';
4
4
  import type { Metadata, Stream } from '../Entry.js';
5
5
  export interface FileSystemOptions {
6
6
  path: string;
@@ -1,6 +1,6 @@
1
1
  import { Readable } from 'node:stream';
2
2
  import { Provider } from '../Provider.js';
3
- import type { Maybe } from '@toa.io/types';
3
+ import type { Maybe } from '@toa.io/core';
4
4
  import type { Metadata, Stream } from '../Entry.js';
5
5
  import type { Secret, Secrets } from '../Secrets.js';
6
6
  export interface S3Options {