Skip to content

Commit 550cf6a

Browse files
authored
Merge branch 'main' into dependabot/update-package-lock
2 parents 9f83ea6 + 26a6771 commit 550cf6a

6 files changed

Lines changed: 29 additions & 43 deletions

File tree

packages/blocks/aws-athena/src/lib/actions/query-athena-action.ts

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
amazonAuth,
44
dryRunCheckBox,
55
getAwsAccountsSingleSelectDropdown,
6-
getCredentialsListFromAuth,
6+
getCredentialsForAccount,
77
getRegionsDropdownState,
88
listAthenaDatabases,
99
runAndWaitForQueryResult,
@@ -33,10 +33,9 @@ export const runAthenaQueryAction = createAction({
3333
database: Property.Dropdown<string>({
3434
displayName: 'Database',
3535
description: 'Database that contains the table to query on',
36-
37-
refreshers: ['auth', 'accounts', 'region'],
36+
refreshers: ['auth', 'accounts', 'accounts.accounts', 'region'],
3837
required: true,
39-
options: async ({ auth, accounts, region }) => {
38+
options: async ({ auth, accounts, region }: any) => {
4039
if (!auth) {
4140
return {
4241
disabled: true,
@@ -46,24 +45,14 @@ export const runAthenaQueryAction = createAction({
4645
}
4746

4847
try {
49-
const authProp = auth as {
50-
accessKeyId: string;
51-
secretAccessKey: string;
52-
defaultRegion: string;
53-
};
54-
const selectedAccounts = (
55-
accounts as unknown as {
56-
accounts?: string[];
57-
}
58-
)?.accounts;
59-
const credentialsList = await getCredentialsListFromAuth(
60-
authProp,
61-
selectedAccounts,
48+
const credentials = await getCredentialsForAccount(
49+
auth,
50+
accounts?.['accounts'],
6251
);
6352

6453
const databases = await listAthenaDatabases(
65-
credentialsList[0],
66-
(region as string | undefined) ?? authProp.defaultRegion,
54+
credentials,
55+
(region as string | undefined) ?? auth.defaultRegion,
6756
);
6857

6958
return {
@@ -119,14 +108,13 @@ export const runAthenaQueryAction = createAction({
119108
}
120109

121110
try {
122-
const selectedAccounts = context.propsValue.accounts?.['accounts'];
123-
const credentialsList = await getCredentialsListFromAuth(
111+
const credentials = await getCredentialsForAccount(
124112
context.auth,
125-
selectedAccounts,
113+
context.propsValue.accounts?.['accounts'],
126114
);
127115

128116
return await runAndWaitForQueryResult(
129-
credentialsList[0],
117+
credentials,
130118
context.propsValue.region ?? context.auth.defaultRegion,
131119
query,
132120
database,

packages/blocks/aws-athena/test/athena-query-action.test.ts

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const openopsCommonMock = {
22
...jest.requireActual('@openops/common'),
3-
getCredentialsListFromAuth: jest.fn(),
3+
getCredentialsForAccount: jest.fn(),
44
runAndWaitForQueryResult: jest.fn(),
55
};
66

@@ -12,9 +12,9 @@ describe('runAthenaQueryAction tests', () => {
1212
beforeEach(() => {
1313
jest.clearAllMocks();
1414

15-
openopsCommonMock.getCredentialsListFromAuth.mockResolvedValue([
16-
{ someCreds: 'some creds' },
17-
]);
15+
openopsCommonMock.getCredentialsForAccount.mockResolvedValue({
16+
someCreds: 'some creds',
17+
});
1818
});
1919

2020
const auth = {
@@ -76,7 +76,7 @@ describe('runAthenaQueryAction tests', () => {
7676
...jest.requireActual('@openops/blocks-framework'),
7777
auth: auth,
7878
propsValue: {
79-
accounts: { accounts: ['some-account-id'] },
79+
accounts: { accounts: 'some-account-id' },
8080
query: 'some query',
8181
database: 'some database',
8282
outputBucket: 'some outputBucket',
@@ -87,12 +87,10 @@ describe('runAthenaQueryAction tests', () => {
8787
const result = (await runAthenaQueryAction.run(context)) as any;
8888

8989
expect(result).toEqual('mockResult');
90-
expect(openopsCommonMock.getCredentialsListFromAuth).toHaveBeenCalledTimes(
91-
1,
92-
);
93-
expect(openopsCommonMock.getCredentialsListFromAuth).toHaveBeenCalledWith(
90+
expect(openopsCommonMock.getCredentialsForAccount).toHaveBeenCalledTimes(1);
91+
expect(openopsCommonMock.getCredentialsForAccount).toHaveBeenCalledWith(
9492
auth,
95-
['some-account-id'],
93+
'some-account-id',
9694
);
9795
});
9896

@@ -138,7 +136,6 @@ describe('runAthenaQueryAction tests', () => {
138136
...jest.requireActual('@openops/blocks-framework'),
139137
auth: auth,
140138
propsValue: {
141-
accounts: { accounts: ['some-account-id'] },
142139
region: 'some region',
143140
query: 'some query',
144141
database: 'some database',
@@ -158,12 +155,10 @@ describe('runAthenaQueryAction tests', () => {
158155
'some database',
159156
'some outputBucket',
160157
);
161-
expect(openopsCommonMock.getCredentialsListFromAuth).toHaveBeenCalledTimes(
162-
1,
163-
);
164-
expect(openopsCommonMock.getCredentialsListFromAuth).toHaveBeenCalledWith(
158+
expect(openopsCommonMock.getCredentialsForAccount).toHaveBeenCalledTimes(1);
159+
expect(openopsCommonMock.getCredentialsForAccount).toHaveBeenCalledWith(
165160
auth,
166-
['some-account-id'],
161+
undefined,
167162
);
168163
});
169164

packages/blocks/slack/src/lib/common/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ export function dynamicBlockKitProperties(): any {
269269
const result: any = {
270270
blocks: Property.Json({
271271
displayName: 'Block Kit blocks',
272-
description: 'See https://api.slack.com/block-kit for specs',
272+
description:
273+
'See https://api.slack.com/block-kit for specs. Visual preview available at https://app.slack.com/block-kit-builder',
273274
required: true,
274275
defaultValue: [
275276
{

packages/server/api/src/app/app.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ export const setupApp = async (
114114
const openapiRoutePrefix = '/v1/openapi';
115115
app.addHook('onRoute', (route) => {
116116
if (route.url.startsWith(openapiRoutePrefix)) {
117-
route.config ??= {};
117+
route.config ??= {
118+
security: PUBLIC_ROUTE_POLICY,
119+
};
118120
route.config.skipAuth = true;
119121
route.config.security = PUBLIC_ROUTE_POLICY;
120122
}

packages/server/api/src/app/flows/flow/flow.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ const UpdateFlowRequestOptions = {
288288
config: {
289289
security: getProjectScopedRoutePolicy({
290290
allowedPrincipals: [PrincipalType.USER, PrincipalType.SERVICE],
291-
permission: Permission.UPDATE_FLOW_STATUS,
291+
permission: Permission.WRITE_FLOW,
292292
}),
293293
},
294294
schema: {

packages/server/api/types/fastify.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ declare module 'fastify' {
1717
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
1818
export interface FastifyContextConfig {
1919
rawBody?: boolean;
20-
security?: RouteSecurityPolicy; // TODO change to mandatory
20+
security: RouteSecurityPolicy;
2121

2222
// TODO: Prepare deprecation of the following properties
2323
allowedPrincipals?: PrincipalType[];

0 commit comments

Comments
 (0)