@awsless/awsless 0.0.144 → 0.0.146

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/bin.js CHANGED
@@ -1727,17 +1727,19 @@ var authPlugin = definePlugin({
1727
1727
  gen.addInterface("AuthResources", resources);
1728
1728
  await write("auth.d.ts", gen, true);
1729
1729
  },
1730
- onStack({ bootstrap: bootstrap2, stackConfig, bind }) {
1730
+ onStack({ config: config2, bootstrap: bootstrap2, stackConfig, bind }) {
1731
1731
  for (const [id, props] of Object.entries(stackConfig.auth ?? {})) {
1732
1732
  if (props.access) {
1733
1733
  const userPoolId = bootstrap2.import(`auth-${id}-user-pool-id`);
1734
1734
  const clientId = bootstrap2.import(`auth-${id}-client-id`);
1735
- const clientSecret = bootstrap2.import(`auth-${id}-client-secret`);
1736
1735
  const name = constantCase5(id);
1737
1736
  bind((lambda) => {
1738
1737
  lambda.addEnvironment(`AUTH_${name}_USER_POOL_ID`, userPoolId);
1739
1738
  lambda.addEnvironment(`AUTH_${name}_CLIENT_ID`, clientId);
1740
- lambda.addEnvironment(`AUTH_${name}_CLIENT_SECRET`, clientSecret);
1739
+ if (config2.app.defaults.auth?.[id]?.secret) {
1740
+ const clientSecret = bootstrap2.import(`auth-${id}-client-secret`);
1741
+ lambda.addEnvironment(`AUTH_${name}_CLIENT_SECRET`, clientSecret);
1742
+ }
1741
1743
  lambda.addPermissions({
1742
1744
  actions: ["cognito:*"],
1743
1745
  resources: ["*"]
@@ -1813,14 +1815,17 @@ var authPlugin = definePlugin({
1813
1815
  const domain = userPool.addDomain({
1814
1816
  domain: `${config2.app.name}-${id}`
1815
1817
  });
1816
- const clientSecret = new CustomResource(`${id}-client-secret`, {
1817
- serviceToken: clientSecretLambda.arn,
1818
- properties: {
1819
- userPoolId: userPool.id,
1820
- clientId: client.id
1821
- }
1822
- }).dependsOn(client, userPool);
1823
- bootstrap2.add(userPool).add(clientSecret).export(`auth-${id}-user-pool-arn`, userPool.arn).export(`auth-${id}-user-pool-id`, userPool.id).export(`auth-${id}-client-id`, client.id).export(`auth-${id}-client-secret`, clientSecret.getAtt("secret")).export(`auth-${id}-domain`, domain.domain);
1818
+ if (props.secret) {
1819
+ const clientSecret = new CustomResource(`${id}-client-secret`, {
1820
+ serviceToken: clientSecretLambda.arn,
1821
+ properties: {
1822
+ userPoolId: userPool.id,
1823
+ clientId: client.id
1824
+ }
1825
+ }).dependsOn(client, userPool);
1826
+ bootstrap2.add(clientSecret).export(`auth-${id}-client-secret`, clientSecret.getAtt("secret"));
1827
+ }
1828
+ bootstrap2.add(userPool).export(`auth-${id}-user-pool-arn`, userPool.arn).export(`auth-${id}-user-pool-id`, userPool.id).export(`auth-${id}-client-id`, client.id).export(`auth-${id}-domain`, domain.domain);
1824
1829
  for (const [event, lambda] of functions) {
1825
1830
  const permission = new Permission(`auth-${id}-${event}`, {
1826
1831
  action: "lambda:InvokeFunction",
@@ -1 +1 @@
1
- 64ab50c75f36adcc289b9470606a9a989516e8b1
1
+ f5c28bc8e4ff914a9f488b942df7d06d20e600a3
@@ -35,13 +35,12 @@ const handler = async (event)=>{
35
35
  console.log('ClientId:', clientId);
36
36
  try {
37
37
  if (type === 'Create' || type === 'Update') {
38
- const input = {
38
+ const command = new clientCognitoIdentityProvider.DescribeUserPoolClientCommand({
39
39
  UserPoolId: userPoolId,
40
40
  ClientId: clientId
41
- };
42
- const command = new clientCognitoIdentityProvider.DescribeUserPoolClientCommand(input);
41
+ });
43
42
  const response = await client.send(command);
44
- const secret = response.UserPoolClient?.ClientSecret;
43
+ const secret = response.UserPoolClient?.ClientSecret ?? '';
45
44
  await send(event, clientId, 'SUCCESS', {
46
45
  secret
47
46
  });
@@ -33,13 +33,12 @@ const handler = async (event)=>{
33
33
  console.log('ClientId:', clientId);
34
34
  try {
35
35
  if (type === 'Create' || type === 'Update') {
36
- const input = {
36
+ const command = new DescribeUserPoolClientCommand({
37
37
  UserPoolId: userPoolId,
38
38
  ClientId: clientId
39
- };
40
- const command = new DescribeUserPoolClientCommand(input);
39
+ });
41
40
  const response = await client.send(command);
42
- const secret = response.UserPoolClient?.ClientSecret;
41
+ const secret = response.UserPoolClient?.ClientSecret ?? '';
43
42
  await send(event, clientId, 'SUCCESS', {
44
43
  secret
45
44
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/awsless",
3
- "version": "0.0.144",
3
+ "version": "0.0.146",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -29,11 +29,11 @@
29
29
  },
30
30
  "peerDependencies": {
31
31
  "@awsless/lambda": "^0.0.15",
32
- "@awsless/ssm": "^0.0.7",
33
32
  "@awsless/sns": "^0.0.7",
33
+ "@awsless/redis": "^0.0.10",
34
34
  "@awsless/sqs": "^0.0.7",
35
+ "@awsless/ssm": "^0.0.7",
35
36
  "@awsless/validate": "^0.0.10",
36
- "@awsless/redis": "^0.0.10",
37
37
  "@awsless/weak-cache": "^0.0.1"
38
38
  },
39
39
  "dependencies": {