@digipair/skill-s3 0.81.1 → 0.81.2

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/index.cjs2.js CHANGED
@@ -38804,20 +38804,17 @@ let S3Service = class S3Service {
38804
38804
  return new S3Client(config);
38805
38805
  }
38806
38806
  async upload(params, _pinsSettingsList, context) {
38807
- const { bucket, key, content, contentType = 'application/octet-stream', config = context.privates.S3_CONFIG } = params;
38807
+ const { bucket, key, content, config = context.privates.S3_CONFIG } = params;
38808
38808
  const client = this.getClient(config);
38809
+ const match = content.match(/^data:(.*?);base64,/);
38810
+ const contentType = match[1];
38809
38811
  const command = new PutObjectCommand({
38810
38812
  Bucket: bucket,
38811
38813
  Key: key,
38812
38814
  Body: Buffer.from(content.replace(/^data:.*;base64,/, ''), 'base64'),
38813
38815
  ContentType: contentType
38814
38816
  });
38815
- await client.send(command);
38816
- return {
38817
- message: 'File uploaded successfully',
38818
- bucket,
38819
- key
38820
- };
38817
+ return await client.send(command);
38821
38818
  }
38822
38819
  async download(params, _pinsSettingsList, context) {
38823
38820
  const { bucket, key, range, config = context.privates.S3_CONFIG } = params;
@@ -38835,10 +38832,7 @@ let S3Service = class S3Service {
38835
38832
  }
38836
38833
  const buffer = Buffer.concat(chunks);
38837
38834
  const base64 = buffer.toString('base64');
38838
- return {
38839
- filename: key,
38840
- content: `data:${response.ContentType};base64,${base64}`
38841
- };
38835
+ return `data:${response.ContentType};base64,${base64}`;
38842
38836
  }
38843
38837
  async delete(params, _pinsSettingsList, context) {
38844
38838
  const { bucket, key, config = context.privates.S3_CONFIG } = params;
@@ -38848,11 +38842,7 @@ let S3Service = class S3Service {
38848
38842
  Key: key
38849
38843
  });
38850
38844
  await client.send(command);
38851
- return {
38852
- message: 'File deleted successfully',
38853
- bucket,
38854
- key
38855
- };
38845
+ return client.send(command);
38856
38846
  }
38857
38847
  async list(params, _pinsSettingsList, context) {
38858
38848
  const { bucket, prefix = '', config = context.privates.S3_CONFIG } = params;
@@ -38861,14 +38851,7 @@ let S3Service = class S3Service {
38861
38851
  Bucket: bucket,
38862
38852
  Prefix: prefix
38863
38853
  });
38864
- const response = await client.send(command);
38865
- return {
38866
- files: (response.Contents || []).map((item)=>({
38867
- key: item.Key,
38868
- size: item.Size,
38869
- lastModified: item.LastModified
38870
- }))
38871
- };
38854
+ return await client.send(command);
38872
38855
  }
38873
38856
  };
38874
38857
  // Export helpers
package/index.esm2.js CHANGED
@@ -38782,20 +38782,17 @@ let S3Service = class S3Service {
38782
38782
  return new S3Client(config);
38783
38783
  }
38784
38784
  async upload(params, _pinsSettingsList, context) {
38785
- const { bucket, key, content, contentType = 'application/octet-stream', config = context.privates.S3_CONFIG } = params;
38785
+ const { bucket, key, content, config = context.privates.S3_CONFIG } = params;
38786
38786
  const client = this.getClient(config);
38787
+ const match = content.match(/^data:(.*?);base64,/);
38788
+ const contentType = match[1];
38787
38789
  const command = new PutObjectCommand({
38788
38790
  Bucket: bucket,
38789
38791
  Key: key,
38790
38792
  Body: Buffer.from(content.replace(/^data:.*;base64,/, ''), 'base64'),
38791
38793
  ContentType: contentType
38792
38794
  });
38793
- await client.send(command);
38794
- return {
38795
- message: 'File uploaded successfully',
38796
- bucket,
38797
- key
38798
- };
38795
+ return await client.send(command);
38799
38796
  }
38800
38797
  async download(params, _pinsSettingsList, context) {
38801
38798
  const { bucket, key, range, config = context.privates.S3_CONFIG } = params;
@@ -38813,10 +38810,7 @@ let S3Service = class S3Service {
38813
38810
  }
38814
38811
  const buffer = Buffer.concat(chunks);
38815
38812
  const base64 = buffer.toString('base64');
38816
- return {
38817
- filename: key,
38818
- content: `data:${response.ContentType};base64,${base64}`
38819
- };
38813
+ return `data:${response.ContentType};base64,${base64}`;
38820
38814
  }
38821
38815
  async delete(params, _pinsSettingsList, context) {
38822
38816
  const { bucket, key, config = context.privates.S3_CONFIG } = params;
@@ -38826,11 +38820,7 @@ let S3Service = class S3Service {
38826
38820
  Key: key
38827
38821
  });
38828
38822
  await client.send(command);
38829
- return {
38830
- message: 'File deleted successfully',
38831
- bucket,
38832
- key
38833
- };
38823
+ return client.send(command);
38834
38824
  }
38835
38825
  async list(params, _pinsSettingsList, context) {
38836
38826
  const { bucket, prefix = '', config = context.privates.S3_CONFIG } = params;
@@ -38839,14 +38829,7 @@ let S3Service = class S3Service {
38839
38829
  Bucket: bucket,
38840
38830
  Prefix: prefix
38841
38831
  });
38842
- const response = await client.send(command);
38843
- return {
38844
- files: (response.Contents || []).map((item)=>({
38845
- key: item.Key,
38846
- size: item.Size,
38847
- lastModified: item.LastModified
38848
- }))
38849
- };
38832
+ return await client.send(command);
38850
38833
  }
38851
38834
  };
38852
38835
  // Export helpers
@@ -1,22 +1,5 @@
1
1
  import { PinsSettings } from '@digipair/engine';
2
- export declare const upload: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<{
3
- message: string;
4
- bucket: any;
5
- key: any;
6
- }>;
7
- export declare const download: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<{
8
- filename: any;
9
- content: string;
10
- }>;
11
- export declare const remove: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<{
12
- message: string;
13
- bucket: any;
14
- key: any;
15
- }>;
16
- export declare const list: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<{
17
- files: {
18
- key: string | undefined;
19
- size: number | undefined;
20
- lastModified: Date | undefined;
21
- }[];
22
- }>;
2
+ export declare const upload: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<import("@aws-sdk/client-s3").PutObjectCommandOutput>;
3
+ export declare const download: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<string>;
4
+ export declare const remove: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<import("@aws-sdk/client-s3").DeleteObjectCommandOutput>;
5
+ export declare const list: (params: any, pinsSettingsList: PinsSettings[], context: any) => Promise<import("@aws-sdk/client-s3").ListObjectsV2CommandOutput>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digipair/skill-s3",
3
- "version": "0.81.1",
3
+ "version": "0.81.2",
4
4
  "keywords": [
5
5
  "digipair",
6
6
  "service",
package/schema.fr.json CHANGED
@@ -35,13 +35,6 @@
35
35
  "description": "Contenu encodé en base64 du fichier (avec préfixe data URI)",
36
36
  "schema": { "type": "string" }
37
37
  },
38
- {
39
- "name": "contentType",
40
- "summary": "Type MIME",
41
- "required": false,
42
- "description": "Type MIME du fichier",
43
- "schema": { "type": "string" }
44
- },
45
38
  {
46
39
  "name": "config",
47
40
  "summary": "Configuration AWS",
package/schema.json CHANGED
@@ -35,13 +35,6 @@
35
35
  "description": "Base64-encoded content of the file (with data URI prefix)",
36
36
  "schema": { "type": "string" }
37
37
  },
38
- {
39
- "name": "contentType",
40
- "summary": "MIME Type",
41
- "required": false,
42
- "description": "The MIME type of the file",
43
- "schema": { "type": "string" }
44
- },
45
38
  {
46
39
  "name": "config",
47
40
  "summary": "AWS Config",