Skip to content

Commit ab8e5be

Browse files
CCM-13135: Address review comments
1 parent 6d7e83c commit ab8e5be

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

utils/sender-management/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ const sm = SenderManagement({ parameterStore: new ParameterStore() });
2828

2929
#### CLI Options
3030

31-
- `--environment` - The name of the environment to run the command on e.g. 'de-<shortcode>', 'uat', 'prod'. Required.
31+
- `--environment` - The name of the environment to run the command on e.g. 'pr123', 'main', 'uat', 'prod'. Required.
3232
- `--format` - print data in json or tabular format. Default is `table`.
3333

3434
#### Library Options
3535

3636
```ts
3737
const sm = SenderManagement({
3838
parameterStore: new ParameterStore(),
39-
configOverrides: { environment: 'de-miha12' },
39+
configOverrides: { environment: 'pr123' },
4040
});
4141
```
4242

@@ -60,7 +60,7 @@ Insert a new sender or update an existing one. Omit the `--sender-id` option to
6060
- `--mesh-mailbox-sender-id` - the mesh mailbox id for this sender. Unique across all the senders. (required)
6161
- `--mesh-mailbox-reports-id` - the mesh mailbox id used for reporting for this sender. It can be the same as mesh-mailbox-sender-id. (required)
6262
- `--fallback-wait-time-seconds` - the fallback wait time to print letters. (required) (number)
63-
- `--routing-config-id` - the routing configuration id. (required)
63+
- `--routing-config-id` - the routing configuration id.
6464

6565
##### Put Sender Examples
6666

@@ -71,7 +71,7 @@ npm --prefix utils/sender-management run-script cli -- put-sender \
7171
--mesh-mailbox-reports-id 'DerbyMailboxReportsId' \
7272
--fallback-wait-time-seconds 100 \
7373
--routing-config-id 'abc123' \
74-
--environment 'de-cljo1'
74+
--environment 'pr123'
7575
```
7676

7777
```bash
@@ -82,7 +82,7 @@ npm --prefix utils/sender-management run-script cli -- put-sender \
8282
--mesh-mailbox-reports-id '123456' \
8383
--fallback-wait-time-seconds 100 \
8484
--routing-config-id 'abc123' \
85-
--environment 'de-cljo1'
85+
--environment 'pr123'
8686
```
8787

8888
```ts
@@ -102,7 +102,7 @@ Return a list of all existing senders
102102
##### List Senders Examples
103103

104104
```bash
105-
npm --prefix utils/sender-management run-script cli -- list-senders --environment de-cljo1
105+
npm --prefix utils/sender-management run-script cli -- list-senders --environment pr123
106106
```
107107

108108
```ts
@@ -118,7 +118,7 @@ Return an individual sender by senderId
118118
```bash
119119
npm --prefix utils/sender-management run-script cli -- get-sender \
120120
--sender-id 'integration_test_sender' \
121-
--environment 'de-cljo1'
121+
--environment 'pr123'
122122
```
123123

124124
```ts
@@ -136,7 +136,7 @@ Delete an individual sender by senderId.
136136
```bash
137137
npm --prefix utils/sender-management run-script cli -- delete-sender \
138138
--sender-id 'integration_test_sender' \
139-
--environment de-cljo1
139+
--environment pr123
140140
```
141141

142142
```ts

utils/sender-management/src/entrypoint/cli/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export async function main() {
109109
},
110110
'routing-config-id': {
111111
type: 'string',
112-
demandOption: true,
112+
demandOption: false,
113113
},
114114
},
115115
async (argv) => {

utils/utils/src/__tests__/validators/sender.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ describe('Sender Validator', () => {
2727
expect(() => $Sender.parse(validSender)).not.toThrow();
2828
});
2929

30+
it('should validate a correct Sender object without routingConfigId', () => {
31+
const validSender = {
32+
senderId: '123e4567-e89b-12d3-a456-426614174000',
33+
senderName: 'Test Sender',
34+
meshMailboxSenderId: 'SENDER123',
35+
meshMailboxReportsId: 'REPORTS123',
36+
fallbackWaitTimeSeconds: 300,
37+
};
38+
39+
expect(() => $Sender.parse(validSender)).not.toThrow();
40+
});
41+
3042
it('should throw an error when senderId has spaces', () => {
3143
const invalidSender = {
3244
senderId: 'Spaces are invalid',
@@ -113,18 +125,6 @@ describe('Sender Validator', () => {
113125
expect(() => $Sender.parse(invalidSender)).toThrow();
114126
});
115127

116-
it('should throw an error when routingConfigId is missing', () => {
117-
const invalidSender = {
118-
senderId: '123e4567-e89b-12d3-a456-426614174000',
119-
senderName: 'Test Sender',
120-
meshMailboxSenderId: 'SENDER123',
121-
meshMailboxReportsId: 'REPORTS123',
122-
fallbackWaitTimeSeconds: 300,
123-
};
124-
125-
expect(() => $Sender.parse(invalidSender)).toThrow();
126-
});
127-
128128
it('should throw an error when fallbackWaitTimeSeconds has wrong type', () => {
129129
const invalidSender = {
130130
senderId: '123e4567-e89b-12d3-a456-426614174000',

utils/utils/src/types/sender.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ export type Sender = {
77
meshMailboxSenderId: string;
88
meshMailboxReportsId: string;
99
fallbackWaitTimeSeconds: number;
10-
routingConfigId: string;
10+
routingConfigId?: string;
1111
};

utils/utils/src/validators/sender.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ export const $Sender = z.object({
1010
meshMailboxSenderId: z.string(),
1111
meshMailboxReportsId: z.string(),
1212
fallbackWaitTimeSeconds: z.number().positive().int(),
13-
routingConfigId: z.string(),
13+
routingConfigId: z.string().optional(),
1414
});

0 commit comments

Comments
 (0)