Skip to content

Commit 3e4088d

Browse files
committed
remove more vault related stuff
1 parent 37d76f6 commit 3e4088d

File tree

4 files changed

+6
-51
lines changed

4 files changed

+6
-51
lines changed

packages/backend/src/apps/vault-workspace/index.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@ import { IApp } from '@plumber/types'
22

33
import actions from './actions'
44

5-
const WORKSPACE_BASEURL =
6-
'https://jcxk888grj.execute-api.ap-southeast-1.amazonaws.com'
7-
85
const app: IApp = {
96
name: 'Vault Workspace',
107
key: 'vault-workspace',
11-
baseUrl: WORKSPACE_BASEURL,
12-
apiBaseUrl: WORKSPACE_BASEURL,
8+
baseUrl: '',
9+
apiBaseUrl: '',
1310
iconUrl: '{BASE_URL}/apps/vault-workspace/assets/favicon.svg',
1411
authDocUrl:
1512
'https://guide.plumber.gov.sg/user-guides/actions/vault-workspace',

packages/backend/src/controllers/webhooks/handler.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,7 @@ export default async (request: IRequest, response: Response) => {
7474
const triggerStep = await flow.getTriggerStep()
7575
const triggerCommand = await triggerStep.getTriggerCommand()
7676
const app = await triggerStep.getApp()
77-
const isWebhookApp =
78-
app.key === 'webhook' ||
79-
app.key === 'formsg' ||
80-
app.key === 'vault-workspace'
77+
const isWebhookApp = app.key === 'webhook' || app.key === 'formsg'
8178

8279
// Allow all webhook test runs to work
8380
if (testRun && !isWebhookApp) {

packages/backend/src/helpers/__tests__/compute-parameters.test.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -278,28 +278,6 @@ describe('compute parameters', () => {
278278
],
279279
})
280280
})
281-
it('can compute on templates with non-hex-encoded param keys using new vault WS objects whose keys hex-encoded', () => {
282-
const vaultWSExecutionStep = [
283-
{
284-
stepId: randomStepID,
285-
appKey: vaultWorkspace.key,
286-
dataOut: {
287-
'4974732d612d6d65': 'Mario!', // key is hex-encoded `Its a me`
288-
_metadata: {
289-
keysEncoded: true,
290-
},
291-
},
292-
} as unknown as ExecutionStep,
293-
]
294-
const params = {
295-
toSubstitute: `Its a me {{step.${randomStepID}.Its-a-me}}`,
296-
}
297-
const expected = {
298-
toSubstitute: 'Its a me Mario!',
299-
}
300-
const result = computeParameters(params, vaultWSExecutionStep)
301-
expect(result).toEqual(expected)
302-
})
303281

304282
it('should work with space separated keys', () => {
305283
const vaultWSExecutionStep = [

packages/backend/src/helpers/compute-parameters.ts

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { IAction, IJSONObject } from '@plumber/types'
1+
import type { IAction } from '@plumber/types'
22

33
import get from 'lodash.get'
44

5-
import vaultWorkspace from '@/apps/vault-workspace'
65
import ExecutionStep from '@/models/execution-step'
76

87
import Step from '../models/step'
@@ -63,24 +62,8 @@ function findAndSubstituteVariables(
6362
const data = executionStep?.dataOut
6463

6564
const keyPath = keyPaths.join('.') // for lodash get to work
66-
let dataValue = get(data, keyPath)
67-
// custom logic to deal with backward compatibility of key encoding for
68-
// data from vault. Under the new logic, data from vault will always have
69-
// hex-encoded key while the old templates might still used non-encoded
70-
// hence if the value is not defined and keysEncoded flag was set, we
71-
// attempt to convert the template string to use hex-encoded key
72-
// FIXME: Remove this custom logic after we migrate off Vault WS
73-
if (
74-
dataValue === undefined &&
75-
executionStep?.appKey === vaultWorkspace.key &&
76-
(data?._metadata as IJSONObject)?.keysEncoded &&
77-
keyPaths.length > 0
78-
) {
79-
keyPaths[keyPaths.length - 1] = Buffer.from(
80-
keyPaths[keyPaths.length - 1],
81-
).toString('hex')
82-
dataValue = get(data, keyPaths.join('.'))
83-
}
65+
const dataValue = get(data, keyPath)
66+
8467
// NOTE: dataValue could be an array if it is not processed on variables.ts
8568
// which is the case for formSG checkbox only, this is to deal with forEach next time
8669
return preprocessVariable

0 commit comments

Comments
 (0)