@oneblink/storage 2.1.0 → 2.1.1-beta.1
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/dist/generateS3Client.js
CHANGED
|
@@ -27,6 +27,7 @@ function generateS3Client({ region, apiOrigin, getBearerToken, requestBodyHeader
|
|
|
27
27
|
region,
|
|
28
28
|
maxAttempts: RETRY_ATTEMPTS,
|
|
29
29
|
requestHandler: oneBlinkRequestHandler,
|
|
30
|
+
credentials: {},
|
|
30
31
|
// Sign requests with our own Authorization header instead
|
|
31
32
|
// of letting AWS SDK attempt to generate credentials
|
|
32
33
|
signer: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateS3Client.js","sourceRoot":"","sources":["../src/generateS3Client.ts"],"names":[],"mappings":";;;AAAA,kDAA6C;
|
|
1
|
+
{"version":3,"file":"generateS3Client.js","sourceRoot":"","sources":["../src/generateS3Client.ts"],"names":[],"mappings":";;;AAAA,kDAA6C;AAG7C,mDAAwD;AACxD,qEAAiE;AAGjE,MAAM,cAAc,GAAG,CAAC,CAAA;AAExB,SAAgB,gBAAgB,CAAI,EAClC,MAAM,EACN,SAAS,EACT,cAAc,EACd,iBAAiB,GAGlB;IACC,MAAM,mBAAmB,GAAG,IAAA,sCAAsB,GAAE,CAAA;IACpD,MAAM,sBAAsB,GAAG,IAAI,+CAAsB,CACvD,mBAAmB,EACnB,iBAAiB,CAClB,CAAA;IAED,4DAA4D;IAC5D,iEAAiE;IACjE,8DAA8D;IAC9D,mEAAmE;IACnE,oEAAoE;IACpE,kEAAkE;IAClE,gEAAgE;IAChE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAA;IAC9B,GAAG,CAAC,QAAQ,GAAG,UAAU,CAAA;IACzB,MAAM,CAAC,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACxD,GAAG,CAAC,QAAQ,GAAG,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAEpC,OAAO;QACL,MAAM;QACN,sBAAsB;QACtB,QAAQ,EAAE,IAAI,oBAAQ,CAAC;YACrB,QAAQ,EAAE,GAAG,CAAC,IAAI;YAClB,MAAM;YACN,WAAW,EAAE,cAAc;YAC3B,cAAc,EAAE,sBAAsB;YACtC,WAAW,EAAE,EAA2B;YACxC,0DAA0D;YAC1D,qDAAqD;YACrD,MAAM,EAAE;gBACN,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;oBACtB,MAAM,KAAK,GAAG,MAAM,cAAc,EAAE,CAAA;oBACpC,IAAI,KAAK,EAAE,CAAC;wBACV,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,GAAG,KAAK,CAAA;oBACtD,CAAC;oBAED,OAAO,OAAO,CAAA;gBAChB,CAAC;aACF;SACF,CAAC;KACH,CAAA;AACH,CAAC;AAjDD,4CAiDC","sourcesContent":["import { S3Client } from '@aws-sdk/client-s3'\nimport { AwsCredentialIdentity } from '@smithy/types'\nimport { StorageConstructorOptions } from './types'\nimport { getOneBlinkHttpHandler } from './http-handlers'\nimport { OneBlinkRequestHandler } from './OneBlinkRequestHandler'\nimport { RequestBodyHeader } from './http-handlers/types'\n\nconst RETRY_ATTEMPTS = 3\n\nexport function generateS3Client<T>({\n region,\n apiOrigin,\n getBearerToken,\n requestBodyHeader,\n}: StorageConstructorOptions & {\n requestBodyHeader?: RequestBodyHeader\n}) {\n const oneBlinkHttpHandler = getOneBlinkHttpHandler()\n const oneBlinkRequestHandler = new OneBlinkRequestHandler<T>(\n oneBlinkHttpHandler,\n requestBodyHeader,\n )\n\n // The endpoint we use instead of the the AWS S3 endpoint is\n // formatted internally by the AWS S3 SDK. It will add the Bucket\n // parameter below as the subdomain to the URL (as long as the\n // bucket does not contain a `.`). The logic below allows the final\n // URL used to upload the object to be the origin that is passed in.\n // The suffix on the end is important as it will allow us to route\n // traffic to S3 via lambda at edge instead of going to our API.\n const url = new URL(apiOrigin)\n url.pathname = '/storage'\n const [bucket, ...domainParts] = url.hostname.split('.')\n url.hostname = domainParts.join('.')\n\n return {\n bucket,\n oneBlinkRequestHandler,\n s3Client: new S3Client({\n endpoint: url.href,\n region,\n maxAttempts: RETRY_ATTEMPTS,\n requestHandler: oneBlinkRequestHandler,\n credentials: {} as AwsCredentialIdentity,\n // Sign requests with our own Authorization header instead\n // of letting AWS SDK attempt to generate credentials\n signer: {\n sign: async (request) => {\n const token = await getBearerToken()\n if (token) {\n request.headers['authorization'] = 'Bearer ' + token\n }\n\n return request\n },\n },\n }),\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oneblink/storage",
|
|
3
3
|
"description": "SDK for managing storage files in the OneBlink ecosystem",
|
|
4
|
-
"version": "2.1.
|
|
4
|
+
"version": "2.1.1-beta.1",
|
|
5
5
|
"author": "OneBlink <developers@oneblink.io> (https://oneblink.io)",
|
|
6
6
|
"bugs": {
|
|
7
7
|
"url": "https://github.com/oneblink/storage/issues"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@aws-sdk/client-s3": "^3.
|
|
11
|
-
"@aws-sdk/lib-storage": "^3.
|
|
10
|
+
"@aws-sdk/client-s3": "^3.637.0",
|
|
11
|
+
"@aws-sdk/lib-storage": "^3.637.0",
|
|
12
12
|
"browser-or-node": "^3.0.0"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|