@payloadcms/payload-cloud 3.28.0-internal.b3cf0a3 → 3.28.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.
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { S3 } from '@aws-sdk/client-s3';
|
|
2
2
|
export type GetStorageClient = () => Promise<{
|
|
3
3
|
identityID: string;
|
|
4
|
-
storageClient:
|
|
4
|
+
storageClient: S3;
|
|
5
5
|
}>;
|
|
6
6
|
export declare const refreshSession: () => Promise<{
|
|
7
7
|
identityID: any;
|
|
8
8
|
session: import("amazon-cognito-identity-js").CognitoUserSession;
|
|
9
|
-
storageClient:
|
|
9
|
+
storageClient: S3;
|
|
10
10
|
}>;
|
|
11
11
|
//# sourceMappingURL=refreshSession.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refreshSession.d.ts","sourceRoot":"","sources":["../../src/utilities/refreshSession.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"refreshSession.d.ts","sourceRoot":"","sources":["../../src/utilities/refreshSession.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AAKvC,MAAM,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC;IAC3C,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,EAAE,CAAA;CAClB,CAAC,CAAA;AAEF,eAAO,MAAM,cAAc;;;;EAkC1B,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CognitoIdentityClient } from '@aws-sdk/client-cognito-identity';
|
|
2
|
-
import
|
|
2
|
+
import { S3 } from '@aws-sdk/client-s3';
|
|
3
3
|
import { fromCognitoIdentityPool } from '@aws-sdk/credential-providers';
|
|
4
4
|
import { authAsCognitoUser } from './authAsCognitoUser.js';
|
|
5
5
|
export const refreshSession = async ()=>{
|
|
@@ -18,7 +18,7 @@ export const refreshSession = async ()=>{
|
|
|
18
18
|
const credentials = await cognitoIdentity.config.credentials();
|
|
19
19
|
// @ts-expect-error - Incorrect AWS types
|
|
20
20
|
const identityID = credentials.identityId;
|
|
21
|
-
const storageClient = new
|
|
21
|
+
const storageClient = new S3({
|
|
22
22
|
credentials,
|
|
23
23
|
region: process.env.PAYLOAD_CLOUD_BUCKET_REGION
|
|
24
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/refreshSession.ts"],"sourcesContent":["import { CognitoIdentityClient } from '@aws-sdk/client-cognito-identity'\nimport
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/refreshSession.ts"],"sourcesContent":["import { CognitoIdentityClient } from '@aws-sdk/client-cognito-identity'\nimport { S3 } from '@aws-sdk/client-s3'\nimport { fromCognitoIdentityPool } from '@aws-sdk/credential-providers'\n\nimport { authAsCognitoUser } from './authAsCognitoUser.js'\n\nexport type GetStorageClient = () => Promise<{\n identityID: string\n storageClient: S3\n}>\n\nexport const refreshSession = async () => {\n const session = await authAsCognitoUser(\n process.env.PAYLOAD_CLOUD_PROJECT_ID || '',\n process.env.PAYLOAD_CLOUD_COGNITO_PASSWORD || '',\n )\n\n const cognitoIdentity = new CognitoIdentityClient({\n credentials: fromCognitoIdentityPool({\n clientConfig: {\n region: 'us-east-1',\n },\n identityPoolId: process.env.PAYLOAD_CLOUD_COGNITO_IDENTITY_POOL_ID || '',\n logins: {\n [`cognito-idp.us-east-1.amazonaws.com/${process.env.PAYLOAD_CLOUD_COGNITO_USER_POOL_ID}`]:\n session.getIdToken().getJwtToken(),\n },\n }),\n })\n\n const credentials = await cognitoIdentity.config.credentials()\n\n // @ts-expect-error - Incorrect AWS types\n const identityID = credentials.identityId\n\n const storageClient = new S3({\n credentials,\n region: process.env.PAYLOAD_CLOUD_BUCKET_REGION,\n })\n\n return {\n identityID,\n session,\n storageClient,\n }\n}\n"],"names":["CognitoIdentityClient","S3","fromCognitoIdentityPool","authAsCognitoUser","refreshSession","session","process","env","PAYLOAD_CLOUD_PROJECT_ID","PAYLOAD_CLOUD_COGNITO_PASSWORD","cognitoIdentity","credentials","clientConfig","region","identityPoolId","PAYLOAD_CLOUD_COGNITO_IDENTITY_POOL_ID","logins","PAYLOAD_CLOUD_COGNITO_USER_POOL_ID","getIdToken","getJwtToken","config","identityID","identityId","storageClient","PAYLOAD_CLOUD_BUCKET_REGION"],"mappings":"AAAA,SAASA,qBAAqB,QAAQ,mCAAkC;AACxE,SAASC,EAAE,QAAQ,qBAAoB;AACvC,SAASC,uBAAuB,QAAQ,gCAA+B;AAEvE,SAASC,iBAAiB,QAAQ,yBAAwB;AAO1D,OAAO,MAAMC,iBAAiB;IAC5B,MAAMC,UAAU,MAAMF,kBACpBG,QAAQC,GAAG,CAACC,wBAAwB,IAAI,IACxCF,QAAQC,GAAG,CAACE,8BAA8B,IAAI;IAGhD,MAAMC,kBAAkB,IAAIV,sBAAsB;QAChDW,aAAaT,wBAAwB;YACnCU,cAAc;gBACZC,QAAQ;YACV;YACAC,gBAAgBR,QAAQC,GAAG,CAACQ,sCAAsC,IAAI;YACtEC,QAAQ;gBACN,CAAC,CAAC,oCAAoC,EAAEV,QAAQC,GAAG,CAACU,kCAAkC,EAAE,CAAC,EACvFZ,QAAQa,UAAU,GAAGC,WAAW;YACpC;QACF;IACF;IAEA,MAAMR,cAAc,MAAMD,gBAAgBU,MAAM,CAACT,WAAW;IAE5D,yCAAyC;IACzC,MAAMU,aAAaV,YAAYW,UAAU;IAEzC,MAAMC,gBAAgB,IAAItB,GAAG;QAC3BU;QACAE,QAAQP,QAAQC,GAAG,CAACiB,2BAA2B;IACjD;IAEA,OAAO;QACLH;QACAhB;QACAkB;IACF;AACF,EAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/payload-cloud",
|
|
3
|
-
"version": "3.28.0
|
|
3
|
+
"version": "3.28.0",
|
|
4
4
|
"description": "The official Payload Cloud plugin",
|
|
5
5
|
"homepage": "https://payloadcms.com",
|
|
6
6
|
"repository": {
|
|
@@ -37,15 +37,15 @@
|
|
|
37
37
|
"@aws-sdk/lib-storage": "^3.614.0",
|
|
38
38
|
"amazon-cognito-identity-js": "^6.1.2",
|
|
39
39
|
"nodemailer": "6.9.16",
|
|
40
|
-
"@payloadcms/email-nodemailer": "3.28.0
|
|
40
|
+
"@payloadcms/email-nodemailer": "3.28.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/jest": "29.5.12",
|
|
44
44
|
"@types/nodemailer": "6.4.17",
|
|
45
|
-
"payload": "3.28.0
|
|
45
|
+
"payload": "3.28.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"payload": "3.28.0
|
|
48
|
+
"payload": "3.28.0"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
51
|
"build": "pnpm build:types && pnpm build:swc",
|