@constructive-io/s3-streamer 2.8.12 → 2.9.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 CHANGED
@@ -9,7 +9,7 @@
9
9
  <img height="20" src="https://github.com/constructive-io/constructive/actions/workflows/run-tests.yaml/badge.svg" />
10
10
  </a>
11
11
  <a href="https://github.com/constructive-io/constructive/blob/main/LICENSE"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a>
12
- <a href="https://www.npmjs.com/package/@constructive-io/s3-streamer"><img height="20" src="https://img.shields.io/github/package-json/v/constructive-io/constructive?filename=streaming%2Fs3-streamer%2Fpackage.json"/></a>
12
+ <a href="https://www.npmjs.com/package/@constructive-io/s3-streamer"><img height="20" src="https://img.shields.io/github/package-json/v/constructive-io/constructive?filename=uploads%2Fs3-streamer%2Fpackage.json"/></a>
13
13
  </p>
14
14
 
15
15
  Stream uploads to S3 with automatic content-type detection, ETag generation, and metadata extraction. Built on AWS SDK v3 for optimal performance and smaller bundle sizes.
@@ -222,9 +222,14 @@ Common issues and solutions for pgpm, PostgreSQL, and testing.
222
222
 
223
223
  ## Related Constructive Tooling
224
224
 
225
+ ### 📦 Package Management
226
+
227
+ * [pgpm](https://github.com/constructive-io/constructive/tree/main/pgpm/pgpm): **🖥️ PostgreSQL Package Manager** for modular Postgres development. Works with database workspaces, scaffolding, migrations, seeding, and installing database packages.
228
+
225
229
  ### 🧪 Testing
226
230
 
227
231
  * [pgsql-test](https://github.com/constructive-io/constructive/tree/main/postgres/pgsql-test): **📊 Isolated testing environments** with per-test transaction rollbacks—ideal for integration tests, complex migrations, and RLS simulation.
232
+ * [pgsql-seed](https://github.com/constructive-io/constructive/tree/main/postgres/pgsql-seed): **🌱 PostgreSQL seeding utilities** for CSV, JSON, SQL data loading, and pgpm deployment.
228
233
  * [supabase-test](https://github.com/constructive-io/constructive/tree/main/postgres/supabase-test): **🧪 Supabase-native test harness** preconfigured for the local Supabase stack—per-test rollbacks, JWT/role context helpers, and CI/GitHub Actions ready.
229
234
  * [graphile-test](https://github.com/constructive-io/constructive/tree/main/graphile/graphile-test): **🔐 Authentication mocking** for Graphile-focused test helpers and emulating row-level security contexts.
230
235
  * [pg-query-context](https://github.com/constructive-io/constructive/tree/main/postgres/pg-query-context): **🔒 Session context injection** to add session-local context (e.g., `SET LOCAL`) into queries—ideal for setting `role`, `jwt.claims`, and other session settings.
@@ -238,28 +243,6 @@ Common issues and solutions for pgpm, PostgreSQL, and testing.
238
243
  * [@pgsql/types](https://www.npmjs.com/package/@pgsql/types): **📝 Type definitions** for PostgreSQL AST nodes in TypeScript.
239
244
  * [@pgsql/utils](https://www.npmjs.com/package/@pgsql/utils): **🛠️ AST utilities** for constructing and transforming PostgreSQL syntax trees.
240
245
 
241
- ### 🚀 API & Dev Tools
242
-
243
- * [@constructive-io/graphql-server](https://github.com/constructive-io/constructive/tree/main/graphql/server): **⚡ Express-based API server** powered by PostGraphile to expose a secure, scalable GraphQL API over your Postgres database.
244
- * [@constructive-io/graphql-explorer](https://github.com/constructive-io/constructive/tree/main/graphql/explorer): **🔎 Visual API explorer** with GraphiQL for browsing across all databases and schemas—useful for debugging, documentation, and API prototyping.
245
-
246
- ### 🔁 Streaming & Uploads
247
-
248
- * [etag-hash](https://github.com/constructive-io/constructive/tree/main/streaming/etag-hash): **🏷️ S3-compatible ETags** created by streaming and hashing file uploads in chunks.
249
- * [etag-stream](https://github.com/constructive-io/constructive/tree/main/streaming/etag-stream): **🔄 ETag computation** via Node stream transformer during upload or transfer.
250
- * [uuid-hash](https://github.com/constructive-io/constructive/tree/main/streaming/uuid-hash): **🆔 Deterministic UUIDs** generated from hashed content, great for deduplication and asset referencing.
251
- * [uuid-stream](https://github.com/constructive-io/constructive/tree/main/streaming/uuid-stream): **🌊 Streaming UUID generation** based on piped file content—ideal for upload pipelines.
252
- * [@constructive-io/s3-streamer](https://github.com/constructive-io/constructive/tree/main/streaming/s3-streamer): **📤 Direct S3 streaming** for large files with support for metadata injection and content validation.
253
- * [@constructive-io/upload-names](https://github.com/constructive-io/constructive/tree/main/streaming/upload-names): **📂 Collision-resistant filenames** utility for structured and unique file names for uploads.
254
-
255
- ### 🧰 CLI & Codegen
256
-
257
- * [pgpm](https://github.com/constructive-io/constructive/tree/main/pgpm/pgpm): **🖥️ PostgreSQL Package Manager** for modular Postgres development. Works with database workspaces, scaffolding, migrations, seeding, and installing database packages.
258
- * [@constructive-io/cli](https://github.com/constructive-io/constructive/tree/main/packages/cli): **🖥️ Command-line toolkit** for managing Constructive projects—supports database scaffolding, migrations, seeding, code generation, and automation.
259
- * [@constructive-io/graphql-codegen](https://github.com/constructive-io/constructive/tree/main/graphql/codegen): **✨ GraphQL code generation** (types, operations, SDK) from schema/endpoint introspection.
260
- * [@constructive-io/query-builder](https://github.com/constructive-io/constructive/tree/main/packages/query-builder): **🏗️ SQL constructor** providing a robust TypeScript-based query builder for dynamic generation of `SELECT`, `INSERT`, `UPDATE`, `DELETE`, and stored procedure calls—supports advanced SQL features like `JOIN`, `GROUP BY`, and schema-qualified queries.
261
- * [@constructive-io/graphql-query](https://github.com/constructive-io/constructive/tree/main/graphql/query): **🧩 Fluent GraphQL builder** for PostGraphile schemas. ⚡ Schema-aware via introspection, 🧩 composable and ergonomic for building deeply nested queries.
262
-
263
246
  ## Credits
264
247
 
265
248
  **🛠 Built by the [Constructive](https://constructive.io) team — creators of modular Postgres tooling for secure, composable backends. If you like our work, contribute on [GitHub](https://github.com/constructive-io).**
package/esm/s3.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { S3Client } from '@aws-sdk/client-s3';
2
2
  export default function getS3(opts) {
3
- const isMinio = Boolean(opts.minioEndpoint);
3
+ // Use explicit provider if set, otherwise fall back to checking minioEndpoint for backwards compatibility
4
+ const isMinio = opts.provider === 'minio' || (opts.provider === undefined && Boolean(opts.minioEndpoint));
4
5
  const awsConfig = {
5
6
  region: opts.awsRegion,
6
7
  ...(opts.awsAccessKey && opts.awsSecretKey
@@ -11,7 +12,7 @@ export default function getS3(opts) {
11
12
  },
12
13
  }
13
14
  : {}),
14
- ...(isMinio
15
+ ...(isMinio && opts.minioEndpoint
15
16
  ? {
16
17
  endpoint: opts.minioEndpoint,
17
18
  forcePathStyle: true,
package/esm/streamer.js CHANGED
@@ -3,12 +3,13 @@ import { upload as streamUpload } from './utils';
3
3
  export class Streamer {
4
4
  s3;
5
5
  defaultBucket;
6
- constructor({ awsRegion, awsSecretKey, awsAccessKey, minioEndpoint, defaultBucket }) {
6
+ constructor({ awsRegion, awsSecretKey, awsAccessKey, minioEndpoint, provider, defaultBucket }) {
7
7
  this.s3 = getS3({
8
8
  awsRegion,
9
9
  awsSecretKey,
10
10
  awsAccessKey,
11
- minioEndpoint
11
+ minioEndpoint,
12
+ provider
12
13
  });
13
14
  this.defaultBucket = defaultBucket;
14
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructive-io/s3-streamer",
3
- "version": "2.8.12",
3
+ "version": "2.9.0",
4
4
  "author": "Constructive <developers@constructive.io>",
5
5
  "description": "stream files to s3",
6
6
  "main": "index.js",
@@ -29,16 +29,16 @@
29
29
  "test:watch": "jest --watch"
30
30
  },
31
31
  "devDependencies": {
32
- "@constructive-io/s3-utils": "^2.3.7",
33
- "@pgpmjs/env": "^2.8.10",
32
+ "@constructive-io/s3-utils": "^2.4.0",
33
+ "@pgpmjs/env": "^2.9.0",
34
34
  "glob": "^13.0.0",
35
35
  "makage": "^0.1.9"
36
36
  },
37
37
  "dependencies": {
38
38
  "@aws-sdk/client-s3": "^3.958.0",
39
39
  "@aws-sdk/lib-storage": "^3.958.0",
40
- "@constructive-io/content-type-stream": "^2.4.4",
41
- "@pgpmjs/types": "^2.12.7"
40
+ "@constructive-io/content-type-stream": "^2.4.5",
41
+ "@pgpmjs/types": "^2.13.0"
42
42
  },
43
43
  "keywords": [
44
44
  "s3",
@@ -48,5 +48,5 @@
48
48
  "minio",
49
49
  "constructive"
50
50
  ],
51
- "gitHead": "6e76a6344e93683031fd48c21f30829f12f10dd8"
51
+ "gitHead": "f04912cac2edf6435c6add5a6ec65a11d6b79df2"
52
52
  }
package/s3.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import { S3Client } from '@aws-sdk/client-s3';
2
+ import type { BucketProvider } from '@pgpmjs/types';
2
3
  interface S3Options {
3
4
  awsAccessKey: string;
4
5
  awsSecretKey: string;
5
6
  awsRegion: string;
6
7
  minioEndpoint?: string;
8
+ provider?: BucketProvider;
7
9
  }
8
10
  export default function getS3(opts: S3Options): S3Client;
9
11
  export {};
package/s3.js CHANGED
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = getS3;
4
4
  const client_s3_1 = require("@aws-sdk/client-s3");
5
5
  function getS3(opts) {
6
- const isMinio = Boolean(opts.minioEndpoint);
6
+ // Use explicit provider if set, otherwise fall back to checking minioEndpoint for backwards compatibility
7
+ const isMinio = opts.provider === 'minio' || (opts.provider === undefined && Boolean(opts.minioEndpoint));
7
8
  const awsConfig = {
8
9
  region: opts.awsRegion,
9
10
  ...(opts.awsAccessKey && opts.awsSecretKey
@@ -14,7 +15,7 @@ function getS3(opts) {
14
15
  },
15
16
  }
16
17
  : {}),
17
- ...(isMinio
18
+ ...(isMinio && opts.minioEndpoint
18
19
  ? {
19
20
  endpoint: opts.minioEndpoint,
20
21
  forcePathStyle: true,
package/streamer.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  import { ReadStream } from 'fs';
2
+ import type { BucketProvider } from '@pgpmjs/types';
2
3
  import { type AsyncUploadResult } from './utils';
3
4
  interface StreamerOptions {
4
5
  awsRegion: string;
5
6
  awsSecretKey: string;
6
7
  awsAccessKey: string;
7
8
  minioEndpoint?: string;
9
+ provider?: BucketProvider;
8
10
  defaultBucket: string;
9
11
  }
10
12
  interface UploadParams {
@@ -16,7 +18,7 @@ interface UploadParams {
16
18
  export declare class Streamer {
17
19
  private s3;
18
20
  private defaultBucket?;
19
- constructor({ awsRegion, awsSecretKey, awsAccessKey, minioEndpoint, defaultBucket }: StreamerOptions);
21
+ constructor({ awsRegion, awsSecretKey, awsAccessKey, minioEndpoint, provider, defaultBucket }: StreamerOptions);
20
22
  upload({ readStream, filename, key, bucket }: UploadParams): Promise<AsyncUploadResult>;
21
23
  destroy(): void;
22
24
  }
package/streamer.js CHANGED
@@ -9,12 +9,13 @@ const utils_1 = require("./utils");
9
9
  class Streamer {
10
10
  s3;
11
11
  defaultBucket;
12
- constructor({ awsRegion, awsSecretKey, awsAccessKey, minioEndpoint, defaultBucket }) {
12
+ constructor({ awsRegion, awsSecretKey, awsAccessKey, minioEndpoint, provider, defaultBucket }) {
13
13
  this.s3 = (0, s3_1.default)({
14
14
  awsRegion,
15
15
  awsSecretKey,
16
16
  awsAccessKey,
17
- minioEndpoint
17
+ minioEndpoint,
18
+ provider
18
19
  });
19
20
  this.defaultBucket = defaultBucket;
20
21
  }