Skip to content

Commit 486d7cd

Browse files
authored
Merge pull request #12 from owenr88/release/1.1.10
1.1.10
2 parents de5f694 + 51403bf commit 486d7cd

File tree

9 files changed

+32
-37
lines changed

9 files changed

+32
-37
lines changed

.github/workflows/on-close-pr.yml

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
jobs:
1010
test:
11+
if: startsWith(github.head_ref, 'release/') && github.event.pull_request.merged == true
1112
runs-on: ubuntu-latest
1213
steps:
1314
- name: Checkout
@@ -40,7 +41,7 @@ jobs:
4041
- name: Split branch name
4142
id: split
4243
env:
43-
BRANCH: ${{ github.ref_name }}
44+
BRANCH: ${{ github.head_ref }}
4445
run: echo "VERSION=${BRANCH##*/}" >> "$GITHUB_OUTPUT"
4546
- name: Tag latest release
4647
id: tag_version
@@ -54,19 +55,8 @@ jobs:
5455
tag: ${{ steps.tag_version.outputs.new_tag }}
5556
name: Release ${{ steps.tag_version.outputs.new_tag }}
5657
body: ${{ steps.tag_version.outputs.changelog }}
57-
58-
# - name: Create Release
59-
# id: create_release
60-
# uses: actions/create-release@latest
61-
# env:
62-
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
63-
# with:
64-
# tag_name: $GITHUB_REF_NAME
65-
# release_name: $GITHUB_REF_NAME
66-
# # body: |
67-
# # Changes in this Release
68-
# # - First Change
69-
# # - Second Change
70-
# draft: false
71-
# prerelease: false
72-
# - run: git tag -fa $GITHUB_REF_NAME
58+
- name: Delete branch
59+
uses: dawidd6/action-delete-branch@v3
60+
with:
61+
github_token: ${{github.token}}
62+
branches: ${{ github.head_ref }}

packages/cognito-export/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ A full example of the CLI tool in effect can be found below:
3434

3535
| Flag | Description |
3636
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
37-
| -u, --user-pool-id <user-pool-id> | The ID of the AWS Cognito user pool to export from |
37+
| -u, --user-pool-id <user-pool-id> | Required. The ID of the AWS Cognito user pool to export from |
3838
| -p, --profile PROFILEA | The AWS profile to use for authentication. This will default to the AWS_PROFILE environment variable if left blank, or `default` if that is undefined. |
3939
| -o, --output ./users.csv | The path to the output CSV file. Defaults to `./users.csv`. |
4040
| -l, --limit 1000 | Limit the number of users outputted. Defaults to `1000`. |
@@ -54,7 +54,7 @@ const users = await cognitoExport({
5454
});
5555
```
5656

57-
> Please note: This method supports all flags documented above, **except** the output and verbose flags. Instead, the method just returns the user records to store somewhere.
57+
> Please note: This method supports all flags documented above, **except** the output and help flags. Instead, the method returns the type-safe user records.
5858
5959
## Use with [cognito-import](https://www.npmjs.com/package/cognito-import)
6060

packages/cognito-export/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "cognito-export",
33
"description": "A simple CLI tool and JavaScript package for exporting users from an AWS Cognito user pool.",
4-
"version": "1.1.9",
4+
"version": "1.1.10",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
77
"bin": "dist/cli.js",

packages/cognito-import/README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ A full example of the CLI tool in effect can be found below:
3030

3131
`npx cognito-import -u eu-west-1_aaaaaaaaa -p SOMEPROFILE -v -f ./users.csv`
3232

33-
| Flag | Description |
34-
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
35-
| -u, --user-pool-id <user-pool-id> | The ID of the AWS Cognito user pool to import into |
36-
| -p, --profile PROFILEA | The AWS profile to use for authentication. This will default to the AWS_PROFILE environment variable if left blank, or `default` if that is undefined. |
37-
| -f, --file ./users.csv | The path to the CSV file to import. Defaults to `./users.csv`. |
38-
| -v, --verbose | Show all logs and errors in the console. Defaults to `true`. |
39-
| -h, --help | See all flags and options |
33+
| Flag | Description |
34+
| --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
35+
| -u, --user-pool-id <user-pool-id> | Required. The ID of the AWS Cognito user pool to import into |
36+
| -p, --profile PROFILEA | The AWS profile to use for authentication. This will default to the AWS_PROFILE environment variable if left blank, or `default` if that is undefined. |
37+
| -f, --file ./users.csv | The path to the CSV file to import. Defaults to `./users.csv`. |
38+
| -i, --iam <iam-role-arn> | An IAM Role ARN. If omitted, an IAM role will be created with the correct policy. Your access credentials will need permissions to create IAM roles and policies. |
39+
| -v, --verbose | Show all logs and errors in the console. Defaults to `true`. |
40+
| -h, --help | See all flags and options |
4041

4142
## 2. Node.js Example
4243

@@ -73,9 +74,8 @@ const users = await cognitoExport({
7374
profile: "PROFILE_A",
7475
});
7576

76-
await cognitoImport(users, {
77-
jobId: "import-12345",
77+
const job = await cognitoImport(users, {
7878
userPoolId: "eu-west-2_bbbbbbbbb",
7979
profile: "PROFILE_B",
80-
}).start();
80+
});
8181
```

packages/cognito-import/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "cognito-import",
33
"description": "A simple CLI tool and JavaScript package for importing users into an AWS Cognito user pool.",
4-
"version": "1.1.9",
4+
"version": "1.1.10",
55
"main": "dist/index.js",
66
"bin": "dist/cli.js",
77
"repository": {

packages/cognito-import/src/cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ const main = async () => {
2424
path.join(process.cwd(), `users.csv`)
2525
)
2626
.option(
27-
"-i, --iam <iam-arn>",
28-
"The arn for the IAM role. If left blank, one will be created."
27+
"-i, --iam <iam-role-arn>",
28+
"The arn for the IAM Role. If left blank, one will be created."
2929
)
3030
.option("-v, --verbose", "Show all log messages", false)
3131
.action(async () => {

packages/cognito-import/src/importer.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { UserImportJobType } from "@aws-sdk/client-cognito-identity-provider";
12
import fs from "fs";
23
import fetch from "node-fetch";
34
import Papa from "papaparse";
@@ -31,9 +32,12 @@ export class CognitoImport extends CognitoBase {
3132
}
3233
}
3334

34-
async import(users: ImportRecordSchemaType[]) {
35+
async import(
36+
users: ImportRecordSchemaType[]
37+
): Promise<UserImportJobType | undefined> {
3538
if (!users) {
36-
return this.log("No users to import", "error");
39+
this.log("No users to import", "error");
40+
return;
3741
}
3842

3943
// Create the job
@@ -73,5 +77,6 @@ export class CognitoImport extends CognitoBase {
7377
UserPoolId: this.userPoolId,
7478
});
7579
this.log("Started the import job for " + users.length + " users");
80+
return job.UserImportJob;
7681
}
7782
}

packages/cognito-import/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const importCognito = async (
1515
) => {
1616
const importer = new CognitoImport(options);
1717
await importer.connect();
18-
await importer.import(users);
18+
return importer.import(users);
1919
};
2020

2121
export type {

packages/zod-cognito/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "zod-cognito",
33
"description": "Zod schemas for AWS Cognito User Pools",
4-
"version": "1.1.9",
4+
"version": "1.1.10",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",
77
"repository": {

0 commit comments

Comments
 (0)