Skip to content

Commit 254ec04

Browse files
authored
Release v1.51.1 (#1179)
2 parents 37112dc + 5d9efdb commit 254ec04

File tree

12 files changed

+53
-61
lines changed

12 files changed

+53
-61
lines changed

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,5 @@
109109
"tsconfig-paths": "^4.2.0",
110110
"type-fest": "4.10.3"
111111
},
112-
"version": "1.51.0"
112+
"version": "1.51.1"
113113
}

packages/backend/src/apps/formsg/__tests__/auth/decrypt-form-response.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ describe('decrypt form response', () => {
103103
userId: 'userid',
104104
hasFileProcessingActions: false,
105105
name: 'test flow',
106-
testExecutionId: 'testExecutionId',
107106
},
108107
user: {
109108
id: 'userid',

packages/backend/src/apps/gathersg/actions/tag-or-untag-case/index.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,9 @@ const action: IRawAction = {
1919
label: 'Case UUID',
2020
key: 'caseUuid',
2121
type: 'string' as const,
22-
description:
23-
'You can only select a step variable here to make reference to.',
24-
22+
description: 'Enter the case uuid you want to tag or untag',
2523
required: true,
2624
variables: true,
27-
singleVariableSelection: true,
2825
},
2926
{
3027
label: 'Tag or untag',

packages/backend/src/apps/gathersg/actions/update-case/index.ts

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ const action: IRawAction = {
2020
label: 'Case UUID',
2121
key: 'caseUuid',
2222
type: 'string' as const,
23-
description:
24-
'You can only select a step variable here to make reference to.',
23+
description: 'Enter the case uuid you want to update',
2524
required: true,
2625
variables: true,
27-
singleVariableSelection: true,
2826
},
2927
// TODO: see if it is possible to get all possible statuses from the API
3028
{
@@ -34,16 +32,12 @@ const action: IRawAction = {
3432
description: 'Enter the status you want to update the case to.',
3533
required: false,
3634
variables: true,
37-
hiddenIf: {
38-
fieldKey: 'caseUuid',
39-
op: 'is_empty',
40-
},
4135
},
4236
{
4337
label: 'Case fields',
4438
key: 'caseFields',
4539
type: 'multirow-multicol' as const,
46-
required: true,
40+
required: false,
4741
description:
4842
'Specify values for each field you want to update in your case. Note that fields that require an array of objects as a value are not supported yet.',
4943

@@ -64,10 +58,6 @@ const action: IRawAction = {
6458
name: 'key',
6559
value: 'getCaseFields',
6660
},
67-
{
68-
name: 'parameters.caseUuid',
69-
value: '{parameters.caseUuid}',
70-
},
7161
],
7262
},
7363
customStyle: { flex: 2 },
@@ -78,9 +68,11 @@ const action: IRawAction = {
7868
type: 'dropdown' as const,
7969
showOptionValue: false,
8070
required: true,
71+
value: 'string',
72+
variables: false,
8173
options: [
8274
{
83-
label: 'String',
75+
label: 'Text',
8476
value: ensureZodEnumValue(fieldTypeEnum, 'string'),
8577
},
8678
{
@@ -108,10 +100,6 @@ const action: IRawAction = {
108100
customStyle: { flex: 3, minWidth: 0, maxWidth: '60%' },
109101
},
110102
],
111-
hiddenIf: {
112-
fieldKey: 'caseUuid',
113-
op: 'is_empty',
114-
},
115103
},
116104
],
117105

packages/backend/src/apps/gathersg/actions/update-case/schema.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ export const requestSchema = z
2020
.array(
2121
z.object({
2222
field: z.string().trim().min(1, 'Field empty'),
23-
fieldType: fieldTypeEnum,
23+
// we add nullish here because defaultValue or value doesnt work properly in dropdown
24+
fieldType: fieldTypeEnum.nullish(),
2425
value: z.string().trim().nullish(),
2526
}),
2627
)

packages/backend/src/apps/gathersg/dynamic-data/get-case-fields.ts

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,49 +5,53 @@ import {
55
} from '@plumber/types'
66

77
import HttpError from '@/errors/http'
8-
import computeParameters from '@/helpers/compute-parameters'
9-
import ExecutionStep from '@/models/execution-step'
108

119
import { GatherSGError } from '../common/types'
1210

11+
/**
12+
* Subset of result
13+
*/
14+
interface GatherSGCase {
15+
uuid: string
16+
createdAt: string
17+
updatedAt: string
18+
status: {
19+
uuid: string
20+
name: string
21+
color: string
22+
isFinal: boolean
23+
}
24+
caseRef: string
25+
fields: Record<string, string | string[] | null | number>
26+
tags: string[]
27+
}
28+
1329
const dynamicData: IDynamicData = {
1430
key: 'getCaseFields',
1531
name: 'Get Case Fields',
1632
async run($: IGlobalVariable): Promise<DynamicDataOutput> {
1733
try {
18-
// This action only allows a step variable which we have to attempt to compute the parameter value, thinking if there is a better way to do this
19-
// TODO: see if we can refresh the case fields from the API instead of using the cached data because right now, the user has to manually refresh the case fields to get the latest data
20-
const { caseUuid } = $.step.parameters
21-
if (!caseUuid) {
22-
return {
23-
data: [],
24-
}
25-
}
26-
27-
const priorExecutionSteps = await ExecutionStep.query().where({
28-
execution_id: $.flow.testExecutionId,
29-
status: 'success',
30-
})
31-
32-
const computedParameters = computeParameters(
33-
$.step.parameters,
34-
priorExecutionSteps,
35-
)
36-
const computedCaseUuid = computedParameters.caseUuid as string
37-
38-
const { data: responseData } = await $.http.get(`/cases/:caseUuid`, {
39-
urlPathParams: {
40-
caseUuid: computedCaseUuid,
41-
},
34+
const { data: searchResult } = await $.http.post<{
35+
traceId: string
36+
total: number
37+
data: GatherSGCase[]
38+
}>('/cases/search', {
39+
page: 1,
40+
size: 1,
41+
sort: 'createdAt',
42+
order: 'desc',
4243
})
4344

44-
if (!responseData?.data) {
45+
/**
46+
* No cases found
47+
*/
48+
if (searchResult.data.length === 0) {
4549
return {
4650
data: [],
4751
}
4852
}
4953

50-
const caseFields: object = responseData.data.fields
54+
const caseFields: object = searchResult.data[0].fields
5155
const updatedCaseFields: { name: string; value: string }[] = []
5256
for (const [field, value] of Object.entries(caseFields)) {
5357
// Right now, we cannot support adding of array of objects as a value so just going to exclude to not cause errors unnecessarily
@@ -87,7 +91,7 @@ const dynamicData: IDynamicData = {
8791

8892
return {
8993
data: [],
90-
error: error?.message || 'Unknown error',
94+
error: error?.message || error?.code || 'Unknown error',
9195
}
9296
}
9397
},

packages/backend/src/helpers/global-variable.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ const globalVariable = async (
7272
userId: flow?.userId,
7373
hasFileProcessingActions:
7474
(await flow?.containsFileProcessingActions()) ?? false,
75-
testExecutionId: flow?.testExecutionId,
7675
},
7776
step: {
7877
id: step?.id,

packages/frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "frontend",
3-
"version": "1.51.0",
3+
"version": "1.51.1",
44
"type": "module",
55
"scripts": {
66
"dev": "wait-on tcp:3000 && vite --host --force",

packages/frontend/src/components/MultiRow/index.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,12 @@ function MultiRow(props: MultiRowProps): JSX.Element {
106106
{actualRows.map((row, index) => {
107107
const namePrefix = `${name}.${index}`
108108
return (
109-
<Flex key={row.id} flexDir="column" gap={4} mb={4}>
109+
<Flex
110+
key={`${row.id}-${index}`}
111+
flexDir="column"
112+
gap={4}
113+
mb={4}
114+
>
110115
{type === 'multirow-multicol' ? (
111116
<>
112117
<MultiCol

0 commit comments

Comments
 (0)