@digipair/skill-s3 0.81.0 → 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 +10 -26
- package/index.esm2.js +10 -26
- package/libs/skill-s3/src/lib/skill-s3.d.ts +5 -0
- package/package.json +1 -1
- package/schema.fr.json +0 -7
- package/schema.json +7 -7
- package/src/lib/skill-s3.d.ts +0 -22
- /package/{src → libs/skill-s3/src}/index.d.ts +0 -0
package/index.cjs2.js
CHANGED
|
@@ -38804,27 +38804,25 @@ let S3Service = class S3Service {
|
|
|
38804
38804
|
return new S3Client(config);
|
|
38805
38805
|
}
|
|
38806
38806
|
async upload(params, _pinsSettingsList, context) {
|
|
38807
|
-
const { bucket, key, content,
|
|
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
|
-
const { bucket, key, config = context.privates.S3_CONFIG } = params;
|
|
38820
|
+
const { bucket, key, range, config = context.privates.S3_CONFIG } = params;
|
|
38824
38821
|
const client = this.getClient(config);
|
|
38825
38822
|
const command = new GetObjectCommand({
|
|
38826
38823
|
Bucket: bucket,
|
|
38827
|
-
Key: key
|
|
38824
|
+
Key: key,
|
|
38825
|
+
Range: range
|
|
38828
38826
|
});
|
|
38829
38827
|
const response = await client.send(command);
|
|
38830
38828
|
const stream = response.Body;
|
|
@@ -38834,10 +38832,7 @@ let S3Service = class S3Service {
|
|
|
38834
38832
|
}
|
|
38835
38833
|
const buffer = Buffer.concat(chunks);
|
|
38836
38834
|
const base64 = buffer.toString('base64');
|
|
38837
|
-
return {
|
|
38838
|
-
filename: key,
|
|
38839
|
-
content: `data:${response.ContentType};base64,${base64}`
|
|
38840
|
-
};
|
|
38835
|
+
return `data:${response.ContentType};base64,${base64}`;
|
|
38841
38836
|
}
|
|
38842
38837
|
async delete(params, _pinsSettingsList, context) {
|
|
38843
38838
|
const { bucket, key, config = context.privates.S3_CONFIG } = params;
|
|
@@ -38847,11 +38842,7 @@ let S3Service = class S3Service {
|
|
|
38847
38842
|
Key: key
|
|
38848
38843
|
});
|
|
38849
38844
|
await client.send(command);
|
|
38850
|
-
return
|
|
38851
|
-
message: 'File deleted successfully',
|
|
38852
|
-
bucket,
|
|
38853
|
-
key
|
|
38854
|
-
};
|
|
38845
|
+
return client.send(command);
|
|
38855
38846
|
}
|
|
38856
38847
|
async list(params, _pinsSettingsList, context) {
|
|
38857
38848
|
const { bucket, prefix = '', config = context.privates.S3_CONFIG } = params;
|
|
@@ -38860,14 +38851,7 @@ let S3Service = class S3Service {
|
|
|
38860
38851
|
Bucket: bucket,
|
|
38861
38852
|
Prefix: prefix
|
|
38862
38853
|
});
|
|
38863
|
-
|
|
38864
|
-
return {
|
|
38865
|
-
files: (response.Contents || []).map((item)=>({
|
|
38866
|
-
key: item.Key,
|
|
38867
|
-
size: item.Size,
|
|
38868
|
-
lastModified: item.LastModified
|
|
38869
|
-
}))
|
|
38870
|
-
};
|
|
38854
|
+
return await client.send(command);
|
|
38871
38855
|
}
|
|
38872
38856
|
};
|
|
38873
38857
|
// Export helpers
|
package/index.esm2.js
CHANGED
|
@@ -38782,27 +38782,25 @@ let S3Service = class S3Service {
|
|
|
38782
38782
|
return new S3Client(config);
|
|
38783
38783
|
}
|
|
38784
38784
|
async upload(params, _pinsSettingsList, context) {
|
|
38785
|
-
const { bucket, key, content,
|
|
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
|
-
const { bucket, key, config = context.privates.S3_CONFIG } = params;
|
|
38798
|
+
const { bucket, key, range, config = context.privates.S3_CONFIG } = params;
|
|
38802
38799
|
const client = this.getClient(config);
|
|
38803
38800
|
const command = new GetObjectCommand({
|
|
38804
38801
|
Bucket: bucket,
|
|
38805
|
-
Key: key
|
|
38802
|
+
Key: key,
|
|
38803
|
+
Range: range
|
|
38806
38804
|
});
|
|
38807
38805
|
const response = await client.send(command);
|
|
38808
38806
|
const stream = response.Body;
|
|
@@ -38812,10 +38810,7 @@ let S3Service = class S3Service {
|
|
|
38812
38810
|
}
|
|
38813
38811
|
const buffer = Buffer.concat(chunks);
|
|
38814
38812
|
const base64 = buffer.toString('base64');
|
|
38815
|
-
return {
|
|
38816
|
-
filename: key,
|
|
38817
|
-
content: `data:${response.ContentType};base64,${base64}`
|
|
38818
|
-
};
|
|
38813
|
+
return `data:${response.ContentType};base64,${base64}`;
|
|
38819
38814
|
}
|
|
38820
38815
|
async delete(params, _pinsSettingsList, context) {
|
|
38821
38816
|
const { bucket, key, config = context.privates.S3_CONFIG } = params;
|
|
@@ -38825,11 +38820,7 @@ let S3Service = class S3Service {
|
|
|
38825
38820
|
Key: key
|
|
38826
38821
|
});
|
|
38827
38822
|
await client.send(command);
|
|
38828
|
-
return
|
|
38829
|
-
message: 'File deleted successfully',
|
|
38830
|
-
bucket,
|
|
38831
|
-
key
|
|
38832
|
-
};
|
|
38823
|
+
return client.send(command);
|
|
38833
38824
|
}
|
|
38834
38825
|
async list(params, _pinsSettingsList, context) {
|
|
38835
38826
|
const { bucket, prefix = '', config = context.privates.S3_CONFIG } = params;
|
|
@@ -38838,14 +38829,7 @@ let S3Service = class S3Service {
|
|
|
38838
38829
|
Bucket: bucket,
|
|
38839
38830
|
Prefix: prefix
|
|
38840
38831
|
});
|
|
38841
|
-
|
|
38842
|
-
return {
|
|
38843
|
-
files: (response.Contents || []).map((item)=>({
|
|
38844
|
-
key: item.Key,
|
|
38845
|
-
size: item.Size,
|
|
38846
|
-
lastModified: item.LastModified
|
|
38847
|
-
}))
|
|
38848
|
-
};
|
|
38832
|
+
return await client.send(command);
|
|
38849
38833
|
}
|
|
38850
38834
|
};
|
|
38851
38835
|
// Export helpers
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PinsSettings } from '@digipair/engine';
|
|
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
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",
|
|
@@ -73,6 +66,13 @@
|
|
|
73
66
|
"description": "The key (path) of the file to download",
|
|
74
67
|
"schema": { "type": "string" }
|
|
75
68
|
},
|
|
69
|
+
{
|
|
70
|
+
"name": "range",
|
|
71
|
+
"summary": "Content range",
|
|
72
|
+
"required": false,
|
|
73
|
+
"description": "The content range of the file to download",
|
|
74
|
+
"schema": { "type": "string" }
|
|
75
|
+
},
|
|
76
76
|
{
|
|
77
77
|
"name": "config",
|
|
78
78
|
"summary": "AWS Config",
|
package/src/lib/skill-s3.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
}>;
|
|
File without changes
|