@awsless/cli 0.0.46-local.43 → 0.0.46-local.45
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 +93 -7
- package/package.json +14 -14
package/dist/bin.js
CHANGED
|
@@ -103472,7 +103472,8 @@ var init_dist2 = __esm(() => {
|
|
|
103472
103472
|
"http.host": host,
|
|
103473
103473
|
"http.port": port,
|
|
103474
103474
|
"path.data": `${cache3}/data`,
|
|
103475
|
-
"path.logs": `${cache3}/logs
|
|
103475
|
+
"path.logs": `${cache3}/logs`,
|
|
103476
|
+
"cluster.routing.allocation.disk.threshold_enabled": "false"
|
|
103476
103477
|
})
|
|
103477
103478
|
};
|
|
103478
103479
|
BulkError = class extends Error {
|
|
@@ -152669,10 +152670,94 @@ class TypeObject {
|
|
|
152669
152670
|
}
|
|
152670
152671
|
}
|
|
152671
152672
|
|
|
152673
|
+
// src/feature/auth/dev.ts
|
|
152674
|
+
import {
|
|
152675
|
+
CognitoIdentityProviderClient,
|
|
152676
|
+
ListUserPoolClientsCommand,
|
|
152677
|
+
ListUserPoolsCommand
|
|
152678
|
+
} from "@aws-sdk/client-cognito-identity-provider";
|
|
152679
|
+
var authOnDev = async (ctx) => {
|
|
152680
|
+
const ids = Object.keys(ctx.appConfig.auth ?? {});
|
|
152681
|
+
if (ids.length === 0) {
|
|
152682
|
+
return;
|
|
152683
|
+
}
|
|
152684
|
+
const pools = await ctx.keep("auth:pull", [...ids].sort().join(","), async () => {
|
|
152685
|
+
const values = {};
|
|
152686
|
+
try {
|
|
152687
|
+
ctx.log(`Resolving ${ids.length} auth userpool${ids.length === 1 ? "" : "s"} from Cognito...`);
|
|
152688
|
+
const credentials2 = await getCredentials(ctx.appConfig.profile);
|
|
152689
|
+
const client = new CognitoIdentityProviderClient({
|
|
152690
|
+
region: ctx.appConfig.region,
|
|
152691
|
+
credentials: credentials2
|
|
152692
|
+
});
|
|
152693
|
+
let timer;
|
|
152694
|
+
const timeout = new Promise((_3, reject) => {
|
|
152695
|
+
timer = setTimeout(() => reject(new Error("the lookup timed out after 15s")), 15000);
|
|
152696
|
+
});
|
|
152697
|
+
const resolve2 = async () => {
|
|
152698
|
+
const poolIdsByName = {};
|
|
152699
|
+
let token;
|
|
152700
|
+
do {
|
|
152701
|
+
const result = await client.send(new ListUserPoolsCommand({
|
|
152702
|
+
MaxResults: 60,
|
|
152703
|
+
NextToken: token
|
|
152704
|
+
}));
|
|
152705
|
+
for (const pool of result.UserPools ?? []) {
|
|
152706
|
+
if (pool.Name && pool.Id) {
|
|
152707
|
+
poolIdsByName[pool.Name] = pool.Id;
|
|
152708
|
+
}
|
|
152709
|
+
}
|
|
152710
|
+
token = result.NextToken;
|
|
152711
|
+
} while (token);
|
|
152712
|
+
for (const id of ids) {
|
|
152713
|
+
const name = formatGlobalResourceName({
|
|
152714
|
+
appName: ctx.appConfig.name,
|
|
152715
|
+
resourceType: "auth",
|
|
152716
|
+
resourceName: id
|
|
152717
|
+
});
|
|
152718
|
+
const userPoolId = poolIdsByName[name];
|
|
152719
|
+
if (!userPoolId) {
|
|
152720
|
+
ctx.log(`The auth userpool "${id}" isn't deployed yet - its login won't work locally.`);
|
|
152721
|
+
continue;
|
|
152722
|
+
}
|
|
152723
|
+
const clients = await client.send(new ListUserPoolClientsCommand({
|
|
152724
|
+
UserPoolId: userPoolId,
|
|
152725
|
+
MaxResults: 60
|
|
152726
|
+
}));
|
|
152727
|
+
const appClient = clients.UserPoolClients?.find((client2) => client2.ClientName === name) ?? clients.UserPoolClients?.[0];
|
|
152728
|
+
if (!appClient?.ClientId) {
|
|
152729
|
+
ctx.log(`The auth userpool "${id}" has no client - its login won't work locally.`);
|
|
152730
|
+
continue;
|
|
152731
|
+
}
|
|
152732
|
+
values[id] = {
|
|
152733
|
+
userPoolId,
|
|
152734
|
+
clientId: appClient.ClientId
|
|
152735
|
+
};
|
|
152736
|
+
}
|
|
152737
|
+
};
|
|
152738
|
+
await Promise.race([resolve2(), timeout]).finally(() => clearTimeout(timer));
|
|
152739
|
+
} catch (error3) {
|
|
152740
|
+
debug("Auth userpool lookup failed", error3);
|
|
152741
|
+
ctx.log(`Couldn't resolve the auth userpools from Cognito (${error3 instanceof Error ? error3.message : String(error3)}) - logins won't work locally.`);
|
|
152742
|
+
}
|
|
152743
|
+
return { value: values, stop: () => {} };
|
|
152744
|
+
});
|
|
152745
|
+
for (const [id, pool] of Object.entries(pools)) {
|
|
152746
|
+
ctx.addEnv(`AUTH_${constantCase(id)}_USER_POOL_ID`, pool.userPoolId);
|
|
152747
|
+
ctx.addEnv(`AUTH_${constantCase(id)}_CLIENT_ID`, pool.clientId);
|
|
152748
|
+
ctx.registerResource({
|
|
152749
|
+
kind: "auth",
|
|
152750
|
+
id,
|
|
152751
|
+
detail: pool.userPoolId
|
|
152752
|
+
});
|
|
152753
|
+
}
|
|
152754
|
+
};
|
|
152755
|
+
|
|
152672
152756
|
// src/feature/auth/index.ts
|
|
152673
152757
|
import { toDays as toDays4, toHours } from "@awsless/duration";
|
|
152674
152758
|
var authFeature = defineFeature({
|
|
152675
152759
|
name: "auth",
|
|
152760
|
+
onDev: authOnDev,
|
|
152676
152761
|
async onTypeGen(ctx) {
|
|
152677
152762
|
const gen = new TypeFile("awsless");
|
|
152678
152763
|
const resources = new TypeObject(1);
|
|
@@ -164584,7 +164669,7 @@ import {
|
|
|
164584
164669
|
AdminAddUserToGroupCommand,
|
|
164585
164670
|
AdminCreateUserCommand,
|
|
164586
164671
|
AdminSetUserPasswordCommand,
|
|
164587
|
-
CognitoIdentityProviderClient,
|
|
164672
|
+
CognitoIdentityProviderClient as CognitoIdentityProviderClient2,
|
|
164588
164673
|
UsernameExistsException
|
|
164589
164674
|
} from "@aws-sdk/client-cognito-identity-provider";
|
|
164590
164675
|
var create = (program3) => {
|
|
@@ -164723,7 +164808,7 @@ var create = (program3) => {
|
|
|
164723
164808
|
}))
|
|
164724
164809
|
});
|
|
164725
164810
|
}
|
|
164726
|
-
const client = new
|
|
164811
|
+
const client = new CognitoIdentityProviderClient2({
|
|
164727
164812
|
region,
|
|
164728
164813
|
credentials: credentials2
|
|
164729
164814
|
});
|
|
@@ -164772,7 +164857,7 @@ import {
|
|
|
164772
164857
|
AdminListGroupsForUserCommand,
|
|
164773
164858
|
AdminRemoveUserFromGroupCommand,
|
|
164774
164859
|
AdminSetUserPasswordCommand as AdminSetUserPasswordCommand2,
|
|
164775
|
-
CognitoIdentityProviderClient as
|
|
164860
|
+
CognitoIdentityProviderClient as CognitoIdentityProviderClient3,
|
|
164776
164861
|
UserNotFoundException
|
|
164777
164862
|
} from "@aws-sdk/client-cognito-identity-provider";
|
|
164778
164863
|
var update = (program3) => {
|
|
@@ -164860,7 +164945,7 @@ var update = (program3) => {
|
|
|
164860
164945
|
}
|
|
164861
164946
|
});
|
|
164862
164947
|
}
|
|
164863
|
-
const client = new
|
|
164948
|
+
const client = new CognitoIdentityProviderClient3({
|
|
164864
164949
|
region,
|
|
164865
164950
|
credentials: credentials2
|
|
164866
164951
|
});
|
|
@@ -164991,7 +165076,7 @@ var update = (program3) => {
|
|
|
164991
165076
|
// src/cli/command/auth/user/delete.ts
|
|
164992
165077
|
import {
|
|
164993
165078
|
AdminDeleteUserCommand,
|
|
164994
|
-
CognitoIdentityProviderClient as
|
|
165079
|
+
CognitoIdentityProviderClient as CognitoIdentityProviderClient4,
|
|
164995
165080
|
UserNotFoundException as UserNotFoundException2
|
|
164996
165081
|
} from "@aws-sdk/client-cognito-identity-provider";
|
|
164997
165082
|
var del10 = (program3) => {
|
|
@@ -165068,7 +165153,7 @@ var del10 = (program3) => {
|
|
|
165068
165153
|
throw new Cancelled;
|
|
165069
165154
|
}
|
|
165070
165155
|
}
|
|
165071
|
-
const client = new
|
|
165156
|
+
const client = new CognitoIdentityProviderClient4({
|
|
165072
165157
|
region,
|
|
165073
165158
|
credentials: credentials2
|
|
165074
165159
|
});
|
|
@@ -166755,6 +166840,7 @@ const GROUPS = [
|
|
|
166755
166840
|
['search', 'Searches'],
|
|
166756
166841
|
['store', 'Stores'],
|
|
166757
166842
|
['config', 'Config'],
|
|
166843
|
+
['auth', 'Auth'],
|
|
166758
166844
|
['email', 'Emails'],
|
|
166759
166845
|
['route', 'Routes'],
|
|
166760
166846
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/cli",
|
|
3
|
-
"version": "0.0.46-local.
|
|
3
|
+
"version": "0.0.46-local.45",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@awsless/big-float": "^0.1.7",
|
|
46
|
-
"@awsless/duration": "^0.0.4",
|
|
47
|
-
"@awsless/dynamodb": "^0.3.22",
|
|
48
|
-
"@awsless/lambda": "^0.0.47",
|
|
49
|
-
"@awsless/json": "^0.0.11",
|
|
50
46
|
"@awsless/s3": "^0.0.22",
|
|
47
|
+
"@awsless/duration": "^0.0.4",
|
|
51
48
|
"@awsless/validate": "^0.1.7",
|
|
49
|
+
"@awsless/lambda": "^0.0.47",
|
|
50
|
+
"@awsless/dynamodb": "^0.3.22",
|
|
52
51
|
"@awsless/weak-cache": "^0.0.1",
|
|
53
|
-
"awsless": "^0.0.15-local.11"
|
|
52
|
+
"awsless": "^0.0.15-local.11",
|
|
53
|
+
"@awsless/json": "^0.0.11"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@aws-sdk/client-cloudformation": "^3.369.0",
|
|
@@ -121,24 +121,24 @@
|
|
|
121
121
|
"zod": "^3.24.2",
|
|
122
122
|
"zod-to-json-schema": "^3.24.3",
|
|
123
123
|
"@awsless/big-float": "^0.1.7",
|
|
124
|
-
"@awsless/clui": "^0.0.9",
|
|
125
124
|
"@awsless/cloudwatch": "^0.0.1",
|
|
125
|
+
"@awsless/clui": "^0.0.9",
|
|
126
126
|
"@awsless/duration": "^0.0.4",
|
|
127
|
-
"@awsless/iot": "^0.0.5",
|
|
128
|
-
"@awsless/dynamodb": "^0.3.22",
|
|
129
127
|
"@awsless/json": "^0.0.11",
|
|
130
128
|
"@awsless/lambda": "^0.0.47",
|
|
131
|
-
"@awsless/open-search": "^0.0.25",
|
|
132
|
-
"@awsless/s3": "^0.0.22",
|
|
133
129
|
"@awsless/redis": "^0.1.13",
|
|
134
|
-
"@awsless/scheduler": "^0.0.5",
|
|
135
130
|
"@awsless/size": "^0.0.2",
|
|
131
|
+
"@awsless/iot": "^0.0.5",
|
|
132
|
+
"@awsless/open-search": "^0.0.26",
|
|
133
|
+
"@awsless/s3": "^0.0.22",
|
|
134
|
+
"@awsless/dynamodb": "^0.3.22",
|
|
136
135
|
"@awsless/sns": "^0.0.11",
|
|
136
|
+
"@awsless/scheduler": "^0.0.5",
|
|
137
137
|
"@awsless/sqs": "^0.0.24",
|
|
138
|
-
"@awsless/ssm": "^0.0.8",
|
|
139
138
|
"@awsless/validate": "^0.1.7",
|
|
140
139
|
"@awsless/weak-cache": "^0.0.1",
|
|
141
|
-
"awsless": "^0.0.15-local.11"
|
|
140
|
+
"awsless": "^0.0.15-local.11",
|
|
141
|
+
"@awsless/ssm": "^0.0.8"
|
|
142
142
|
},
|
|
143
143
|
"scripts": {
|
|
144
144
|
"test": "bun cli/build-handlers.ts && pnpm vitest",
|