@vendure/asset-server-plugin 2.0.0-beta.1 → 2.0.0-beta.3
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.
|
@@ -1,16 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="node" />
|
|
3
|
+
import { AwsCredentialIdentity, AwsCredentialIdentityProvider } from '@aws-sdk/types';
|
|
3
4
|
import { AssetStorageStrategy } from '@vendure/core';
|
|
4
5
|
import { Request } from 'express';
|
|
5
|
-
import {
|
|
6
|
+
import { Readable } from 'node:stream';
|
|
6
7
|
import { AssetServerOptions } from './types';
|
|
7
|
-
export type S3Credentials = {
|
|
8
|
-
accessKeyId: string;
|
|
9
|
-
secretAccessKey: string;
|
|
10
|
-
};
|
|
11
|
-
export type S3CredentialsProfile = {
|
|
12
|
-
profile: string;
|
|
13
|
-
};
|
|
14
8
|
/**
|
|
15
9
|
* @description
|
|
16
10
|
* Configuration for connecting to AWS S3.
|
|
@@ -21,12 +15,12 @@ export type S3CredentialsProfile = {
|
|
|
21
15
|
export interface S3Config {
|
|
22
16
|
/**
|
|
23
17
|
* @description
|
|
24
|
-
* The credentials used to access your s3 account. You can supply either the access key ID & secret,
|
|
25
|
-
* or you can make use of a
|
|
18
|
+
* The credentials used to access your s3 account. You can supply either the access key ID & secret, or you can make use of a
|
|
26
19
|
* [shared credentials file](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/loading-node-credentials-shared.html)
|
|
27
|
-
*
|
|
20
|
+
* To use a shared credentials file, import the `fromIni()` function from the "@aws-sdk/credential-provider-ini" or "@aws-sdk/credential-providers" package and supply
|
|
21
|
+
* the profile name (e.g. `{ profile: 'default' }`) as its argument.
|
|
28
22
|
*/
|
|
29
|
-
credentials
|
|
23
|
+
credentials: AwsCredentialIdentity | AwsCredentialIdentityProvider;
|
|
30
24
|
/**
|
|
31
25
|
* @description
|
|
32
26
|
* The S3 bucket in which to store the assets. If it does not exist, it will be created on startup.
|
|
@@ -52,16 +46,17 @@ export interface S3Config {
|
|
|
52
46
|
* Returns a configured instance of the {@link S3AssetStorageStrategy} which can then be passed to the {@link AssetServerOptions}
|
|
53
47
|
* `storageStrategyFactory` property.
|
|
54
48
|
*
|
|
55
|
-
* Before using this strategy, make sure you have the `aws-sdk` package installed:
|
|
49
|
+
* Before using this strategy, make sure you have the `@aws-sdk/client-s3` and `@aws-sdk/lib-storage` package installed:
|
|
56
50
|
*
|
|
57
51
|
* ```sh
|
|
58
|
-
* npm install aws-sdk
|
|
52
|
+
* npm install @aws-sdk/client-s3 @aws-sdk/lib-storage
|
|
59
53
|
* ```
|
|
60
54
|
*
|
|
61
55
|
* @example
|
|
62
56
|
* ```TypeScript
|
|
63
57
|
* import { AssetServerPlugin, configureS3AssetStorage } from '\@vendure/asset-server-plugin';
|
|
64
58
|
* import { DefaultAssetNamingStrategy } from '\@vendure/core';
|
|
59
|
+
* import { fromEnv } from '\@aws-sdk/credential-providers';
|
|
65
60
|
*
|
|
66
61
|
* // ...
|
|
67
62
|
*
|
|
@@ -72,10 +67,7 @@ export interface S3Config {
|
|
|
72
67
|
* namingStrategy: new DefaultAssetNamingStrategy(),
|
|
73
68
|
* storageStrategyFactory: configureS3AssetStorage({
|
|
74
69
|
* bucket: 'my-s3-bucket',
|
|
75
|
-
* credentials:
|
|
76
|
-
* accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
|
77
|
-
* secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
|
|
78
|
-
* },
|
|
70
|
+
* credentials: fromEnv(), // or any other credential provider
|
|
79
71
|
* }),
|
|
80
72
|
* }),
|
|
81
73
|
* ```
|
|
@@ -118,12 +110,12 @@ export declare function configureS3AssetStorage(s3Config: S3Config): (options: A
|
|
|
118
110
|
* @description
|
|
119
111
|
* An {@link AssetStorageStrategy} which uses [Amazon S3](https://aws.amazon.com/s3/) object storage service.
|
|
120
112
|
* To us this strategy you must first have access to an AWS account.
|
|
121
|
-
* See their [getting started guide](https://aws.amazon.com/s3/getting-started
|
|
113
|
+
* See their [getting started guide](https://aws.amazon.com/s3/getting-started/) for how to get set up.
|
|
122
114
|
*
|
|
123
|
-
* Before using this strategy, make sure you have the `aws-sdk` package installed:
|
|
115
|
+
* Before using this strategy, make sure you have the `@aws-sdk/client-s3` and `@aws-sdk/lib-storage` package installed:
|
|
124
116
|
*
|
|
125
117
|
* ```sh
|
|
126
|
-
* npm install aws-sdk
|
|
118
|
+
* npm install @aws-sdk/client-s3 @aws-sdk/lib-storage
|
|
127
119
|
* ```
|
|
128
120
|
*
|
|
129
121
|
* **Note:** Rather than instantiating this manually, use the {@link configureS3AssetStorage} function.
|
|
@@ -140,18 +132,21 @@ export declare class S3AssetStorageStrategy implements AssetStorageStrategy {
|
|
|
140
132
|
private s3Config;
|
|
141
133
|
readonly toAbsoluteUrl: (request: Request, identifier: string) => string;
|
|
142
134
|
private AWS;
|
|
143
|
-
private
|
|
135
|
+
private libStorage;
|
|
136
|
+
private s3Client;
|
|
144
137
|
constructor(s3Config: S3Config, toAbsoluteUrl: (request: Request, identifier: string) => string);
|
|
145
138
|
init(): Promise<void>;
|
|
146
139
|
destroy?: (() => void | Promise<void>) | undefined;
|
|
147
140
|
writeFileFromBuffer(fileName: string, data: Buffer): Promise<string>;
|
|
148
|
-
writeFileFromStream(fileName: string, data:
|
|
141
|
+
writeFileFromStream(fileName: string, data: Readable): Promise<string>;
|
|
149
142
|
readFileToBuffer(identifier: string): Promise<Buffer>;
|
|
150
|
-
readFileToStream(identifier: string): Promise<
|
|
143
|
+
readFileToStream(identifier: string): Promise<Readable>;
|
|
144
|
+
private readFile;
|
|
145
|
+
private writeFile;
|
|
151
146
|
deleteFile(identifier: string): Promise<void>;
|
|
152
147
|
fileExists(fileName: string): Promise<boolean>;
|
|
153
148
|
private getObjectParams;
|
|
154
|
-
private getS3Credentials;
|
|
155
149
|
private ensureBucket;
|
|
150
|
+
private getCredentials;
|
|
156
151
|
private isCredentialsProfile;
|
|
157
152
|
}
|
|
@@ -22,11 +22,18 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
26
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
27
|
+
var m = o[Symbol.asyncIterator], i;
|
|
28
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
29
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
30
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
31
|
+
};
|
|
25
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
33
|
exports.S3AssetStorageStrategy = exports.configureS3AssetStorage = void 0;
|
|
27
34
|
const core_1 = require("@vendure/core");
|
|
28
|
-
const path = __importStar(require("path"));
|
|
29
|
-
const
|
|
35
|
+
const path = __importStar(require("node:path"));
|
|
36
|
+
const node_stream_1 = require("node:stream");
|
|
30
37
|
const common_1 = require("./common");
|
|
31
38
|
const constants_1 = require("./constants");
|
|
32
39
|
/**
|
|
@@ -34,16 +41,17 @@ const constants_1 = require("./constants");
|
|
|
34
41
|
* Returns a configured instance of the {@link S3AssetStorageStrategy} which can then be passed to the {@link AssetServerOptions}
|
|
35
42
|
* `storageStrategyFactory` property.
|
|
36
43
|
*
|
|
37
|
-
* Before using this strategy, make sure you have the `aws-sdk` package installed:
|
|
44
|
+
* Before using this strategy, make sure you have the `@aws-sdk/client-s3` and `@aws-sdk/lib-storage` package installed:
|
|
38
45
|
*
|
|
39
46
|
* ```sh
|
|
40
|
-
* npm install aws-sdk
|
|
47
|
+
* npm install @aws-sdk/client-s3 @aws-sdk/lib-storage
|
|
41
48
|
* ```
|
|
42
49
|
*
|
|
43
50
|
* @example
|
|
44
51
|
* ```TypeScript
|
|
45
52
|
* import { AssetServerPlugin, configureS3AssetStorage } from '\@vendure/asset-server-plugin';
|
|
46
53
|
* import { DefaultAssetNamingStrategy } from '\@vendure/core';
|
|
54
|
+
* import { fromEnv } from '\@aws-sdk/credential-providers';
|
|
47
55
|
*
|
|
48
56
|
* // ...
|
|
49
57
|
*
|
|
@@ -54,10 +62,7 @@ const constants_1 = require("./constants");
|
|
|
54
62
|
* namingStrategy: new DefaultAssetNamingStrategy(),
|
|
55
63
|
* storageStrategyFactory: configureS3AssetStorage({
|
|
56
64
|
* bucket: 'my-s3-bucket',
|
|
57
|
-
* credentials:
|
|
58
|
-
* accessKeyId: process.env.AWS_ACCESS_KEY_ID,
|
|
59
|
-
* secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
|
|
60
|
-
* },
|
|
65
|
+
* credentials: fromEnv(), // or any other credential provider
|
|
61
66
|
* }),
|
|
62
67
|
* }),
|
|
63
68
|
* ```
|
|
@@ -97,7 +102,6 @@ const constants_1 = require("./constants");
|
|
|
97
102
|
*/
|
|
98
103
|
function configureS3AssetStorage(s3Config) {
|
|
99
104
|
return (options) => {
|
|
100
|
-
const { assetUrlPrefix, route } = options;
|
|
101
105
|
const prefixFn = (0, common_1.getAssetUrlPrefixFn)(options);
|
|
102
106
|
const toAbsoluteUrlFn = (request, identifier) => {
|
|
103
107
|
if (!identifier) {
|
|
@@ -114,12 +118,12 @@ exports.configureS3AssetStorage = configureS3AssetStorage;
|
|
|
114
118
|
* @description
|
|
115
119
|
* An {@link AssetStorageStrategy} which uses [Amazon S3](https://aws.amazon.com/s3/) object storage service.
|
|
116
120
|
* To us this strategy you must first have access to an AWS account.
|
|
117
|
-
* See their [getting started guide](https://aws.amazon.com/s3/getting-started
|
|
121
|
+
* See their [getting started guide](https://aws.amazon.com/s3/getting-started/) for how to get set up.
|
|
118
122
|
*
|
|
119
|
-
* Before using this strategy, make sure you have the `aws-sdk` package installed:
|
|
123
|
+
* Before using this strategy, make sure you have the `@aws-sdk/client-s3` and `@aws-sdk/lib-storage` package installed:
|
|
120
124
|
*
|
|
121
125
|
* ```sh
|
|
122
|
-
* npm install aws-sdk
|
|
126
|
+
* npm install @aws-sdk/client-s3 @aws-sdk/lib-storage
|
|
123
127
|
* ```
|
|
124
128
|
*
|
|
125
129
|
* **Note:** Rather than instantiating this manually, use the {@link configureS3AssetStorage} function.
|
|
@@ -139,84 +143,95 @@ class S3AssetStorageStrategy {
|
|
|
139
143
|
}
|
|
140
144
|
async init() {
|
|
141
145
|
try {
|
|
142
|
-
this.AWS = await Promise.resolve().then(() => __importStar(require('aws-sdk')));
|
|
146
|
+
this.AWS = await Promise.resolve().then(() => __importStar(require('@aws-sdk/client-s3')));
|
|
143
147
|
}
|
|
144
|
-
catch (
|
|
145
|
-
core_1.Logger.error('Could not find the "aws-sdk" package. Make sure it is installed', constants_1.loggerCtx,
|
|
148
|
+
catch (err) {
|
|
149
|
+
core_1.Logger.error('Could not find the "@aws-sdk/client-s3" package. Make sure it is installed', constants_1.loggerCtx, err.stack);
|
|
146
150
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
151
|
+
try {
|
|
152
|
+
this.libStorage = await Promise.resolve().then(() => __importStar(require('@aws-sdk/lib-storage')));
|
|
153
|
+
}
|
|
154
|
+
catch (err) {
|
|
155
|
+
core_1.Logger.error('Could not find the "@aws-sdk/lib-storage" package. Make sure it is installed', constants_1.loggerCtx, err.stack);
|
|
156
|
+
}
|
|
157
|
+
const config = Object.assign(Object.assign({}, this.s3Config.nativeS3Configuration), { credentials: await this.getCredentials() // Avoid credentials overriden by nativeS3Configuration
|
|
158
|
+
});
|
|
159
|
+
this.s3Client = new this.AWS.S3Client(config);
|
|
160
|
+
await this.ensureBucket();
|
|
150
161
|
}
|
|
151
162
|
async writeFileFromBuffer(fileName, data) {
|
|
152
|
-
|
|
153
|
-
.upload({
|
|
154
|
-
Bucket: this.s3Config.bucket,
|
|
155
|
-
Key: fileName,
|
|
156
|
-
Body: data,
|
|
157
|
-
}, this.s3Config.nativeS3UploadConfiguration)
|
|
158
|
-
.promise();
|
|
159
|
-
return result.Key;
|
|
163
|
+
return this.writeFile(fileName, data);
|
|
160
164
|
}
|
|
161
165
|
async writeFileFromStream(fileName, data) {
|
|
162
|
-
|
|
163
|
-
.upload({
|
|
164
|
-
Bucket: this.s3Config.bucket,
|
|
165
|
-
Key: fileName,
|
|
166
|
-
Body: data,
|
|
167
|
-
}, this.s3Config.nativeS3UploadConfiguration)
|
|
168
|
-
.promise();
|
|
169
|
-
return result.Key;
|
|
166
|
+
return this.writeFile(fileName, data);
|
|
170
167
|
}
|
|
171
168
|
async readFileToBuffer(identifier) {
|
|
172
|
-
|
|
173
|
-
const body =
|
|
169
|
+
var _a, e_1, _b, _c;
|
|
170
|
+
const body = await this.readFile(identifier);
|
|
174
171
|
if (!body) {
|
|
175
172
|
core_1.Logger.error(`Got undefined Body for ${identifier}`, constants_1.loggerCtx);
|
|
176
173
|
return Buffer.from('');
|
|
177
174
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
175
|
+
const chunks = [];
|
|
176
|
+
try {
|
|
177
|
+
for (var _d = true, body_1 = __asyncValues(body), body_1_1; body_1_1 = await body_1.next(), _a = body_1_1.done, !_a;) {
|
|
178
|
+
_c = body_1_1.value;
|
|
179
|
+
_d = false;
|
|
180
|
+
try {
|
|
181
|
+
const chunk = _c;
|
|
182
|
+
chunks.push(chunk);
|
|
183
|
+
}
|
|
184
|
+
finally {
|
|
185
|
+
_d = true;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
183
188
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
const intArray = Uint8Array.from(buf);
|
|
191
|
-
resolve(Buffer.concat([intArray]));
|
|
192
|
-
});
|
|
193
|
-
});
|
|
189
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
190
|
+
finally {
|
|
191
|
+
try {
|
|
192
|
+
if (!_d && !_a && (_b = body_1.return)) await _b.call(body_1);
|
|
193
|
+
}
|
|
194
|
+
finally { if (e_1) throw e_1.error; }
|
|
194
195
|
}
|
|
195
|
-
return Buffer.
|
|
196
|
+
return Buffer.concat(chunks);
|
|
196
197
|
}
|
|
197
198
|
async readFileToStream(identifier) {
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
const readable = new stream_1.Readable();
|
|
202
|
-
readable._read = () => {
|
|
203
|
-
/* noop */
|
|
204
|
-
};
|
|
205
|
-
readable.push(body);
|
|
206
|
-
readable.push(null);
|
|
207
|
-
return readable;
|
|
199
|
+
const body = await this.readFile(identifier);
|
|
200
|
+
if (!body) {
|
|
201
|
+
return new node_stream_1.Readable({ read() { this.push(null); } });
|
|
208
202
|
}
|
|
209
203
|
return body;
|
|
210
204
|
}
|
|
205
|
+
async readFile(identifier) {
|
|
206
|
+
const { GetObjectCommand } = this.AWS;
|
|
207
|
+
const result = await this.s3Client.send(new GetObjectCommand(this.getObjectParams(identifier)));
|
|
208
|
+
return result.Body;
|
|
209
|
+
}
|
|
210
|
+
async writeFile(fileName, data) {
|
|
211
|
+
const { Upload } = this.libStorage;
|
|
212
|
+
const upload = new Upload({
|
|
213
|
+
client: this.s3Client,
|
|
214
|
+
params: Object.assign(Object.assign({}, this.s3Config.nativeS3UploadConfiguration), { Bucket: this.s3Config.bucket, Key: fileName, Body: data }),
|
|
215
|
+
});
|
|
216
|
+
return upload.done().then((result) => {
|
|
217
|
+
if (!('Key' in result) || !result.Key) {
|
|
218
|
+
core_1.Logger.error(`Got undefined Key for ${fileName}`, constants_1.loggerCtx);
|
|
219
|
+
throw new Error(`Got undefined Key for ${fileName}`);
|
|
220
|
+
}
|
|
221
|
+
return result.Key;
|
|
222
|
+
});
|
|
223
|
+
}
|
|
211
224
|
async deleteFile(identifier) {
|
|
212
|
-
|
|
225
|
+
const { DeleteObjectCommand } = this.AWS;
|
|
226
|
+
await this.s3Client.send(new DeleteObjectCommand(this.getObjectParams(identifier)));
|
|
213
227
|
}
|
|
214
228
|
async fileExists(fileName) {
|
|
229
|
+
const { HeadObjectCommand } = this.AWS;
|
|
215
230
|
try {
|
|
216
|
-
await this.
|
|
231
|
+
await this.s3Client.send(new HeadObjectCommand(this.getObjectParams(fileName)));
|
|
217
232
|
return true;
|
|
218
233
|
}
|
|
219
|
-
catch (
|
|
234
|
+
catch (err) {
|
|
220
235
|
return false;
|
|
221
236
|
}
|
|
222
237
|
}
|
|
@@ -226,38 +241,37 @@ class S3AssetStorageStrategy {
|
|
|
226
241
|
Key: path.join(identifier.replace(/^\//, '')),
|
|
227
242
|
};
|
|
228
243
|
}
|
|
229
|
-
|
|
230
|
-
const {
|
|
231
|
-
|
|
232
|
-
|
|
244
|
+
async ensureBucket(bucket = this.s3Config.bucket) {
|
|
245
|
+
const { HeadBucketCommand, CreateBucketCommand } = this.AWS;
|
|
246
|
+
try {
|
|
247
|
+
await this.s3Client.send(new HeadBucketCommand({ Bucket: bucket }));
|
|
248
|
+
core_1.Logger.verbose(`Found S3 bucket "${bucket}"`, constants_1.loggerCtx);
|
|
249
|
+
return;
|
|
233
250
|
}
|
|
234
|
-
|
|
235
|
-
|
|
251
|
+
catch (err) {
|
|
252
|
+
core_1.Logger.verbose(`Could not find bucket "${bucket}: ${JSON.stringify(err.message)}". Attempting to create...`);
|
|
236
253
|
}
|
|
237
|
-
return new this.AWS.Credentials(credentials);
|
|
238
|
-
}
|
|
239
|
-
async ensureBucket(bucket) {
|
|
240
|
-
let bucketExists = false;
|
|
241
254
|
try {
|
|
242
|
-
await this.
|
|
243
|
-
|
|
244
|
-
core_1.Logger.verbose(`Found S3 bucket "${bucket}"`, constants_1.loggerCtx);
|
|
255
|
+
await this.s3Client.send(new CreateBucketCommand({ Bucket: bucket, ACL: 'private' }));
|
|
256
|
+
core_1.Logger.verbose(`Created S3 bucket "${bucket}"`, constants_1.loggerCtx);
|
|
245
257
|
}
|
|
246
|
-
catch (
|
|
247
|
-
core_1.Logger.
|
|
258
|
+
catch (err) {
|
|
259
|
+
core_1.Logger.error(`Could not find nor create the S3 bucket "${bucket}: ${JSON.stringify(err.message)}"`, constants_1.loggerCtx, err.stack);
|
|
248
260
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
261
|
+
}
|
|
262
|
+
async getCredentials() {
|
|
263
|
+
if (this.s3Config.credentials == null) {
|
|
264
|
+
return undefined;
|
|
265
|
+
}
|
|
266
|
+
if (this.isCredentialsProfile(this.s3Config.credentials)) {
|
|
267
|
+
core_1.Logger.warn('The "profile" property of the "s3Config.credentials" is deprecated. ' +
|
|
268
|
+
'Please use the "fromIni()" function from the "@aws-sdk/credential-provider-ini" or "@aws-sdk/credential-providers" package instead.', constants_1.loggerCtx);
|
|
269
|
+
return (await Promise.resolve().then(() => __importStar(require('@aws-sdk/credential-provider-ini')))).fromIni({ profile: this.s3Config.credentials.profile });
|
|
257
270
|
}
|
|
271
|
+
return this.s3Config.credentials;
|
|
258
272
|
}
|
|
259
273
|
isCredentialsProfile(credentials) {
|
|
260
|
-
return credentials
|
|
274
|
+
return credentials !== null && typeof credentials === 'object' && 'profile' in credentials && Object.keys(credentials).length === 1;
|
|
261
275
|
}
|
|
262
276
|
}
|
|
263
277
|
exports.S3AssetStorageStrategy = S3AssetStorageStrategy;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"s3-asset-storage-strategy.js","sourceRoot":"","sources":["../../src/s3-asset-storage-strategy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"s3-asset-storage-strategy.js","sourceRoot":"","sources":["../../src/s3-asset-storage-strategy.ts"],"names":[],"mapp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CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;IACxI,CAAC;CACJ;AA9JD,wDA8JC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vendure/asset-server-plugin",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.3",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -21,13 +21,14 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
+
"@aws-sdk/client-s3": "^3.312.0",
|
|
25
|
+
"@aws-sdk/lib-storage": "^3.312.0",
|
|
24
26
|
"@types/express": "^4.17.8",
|
|
25
27
|
"@types/fs-extra": "^9.0.8",
|
|
26
28
|
"@types/node-fetch": "^2.5.8",
|
|
27
29
|
"@types/sharp": "^0.30.4",
|
|
28
|
-
"@vendure/common": "
|
|
29
|
-
"@vendure/core": "
|
|
30
|
-
"aws-sdk": "^2.856.0",
|
|
30
|
+
"@vendure/common": "2.0.0-beta.3",
|
|
31
|
+
"@vendure/core": "2.0.0-beta.3",
|
|
31
32
|
"express": "^4.17.1",
|
|
32
33
|
"node-fetch": "^2.6.7",
|
|
33
34
|
"rimraf": "^3.0.2",
|
|
@@ -38,5 +39,5 @@
|
|
|
38
39
|
"fs-extra": "^10.0.0",
|
|
39
40
|
"sharp": "~0.31.2"
|
|
40
41
|
},
|
|
41
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "609e2ed4a0f8b5101a5fa0824e2caca791efca66"
|
|
42
43
|
}
|