Skip to content

Commit 1db80f3

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
fix(netsuite): restore update location output
1 parent bead59f commit 1db80f3

6 files changed

Lines changed: 29 additions & 7 deletions

File tree

apps/docs/content/docs/en/integrations/netsuite.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ Update fields on an existing NetSuite record with PATCH.
149149
| --------- | ---- | ----------- |
150150
| `status` | number | HTTP status returned by NetSuite |
151151
| `data` | json | NetSuite response body; record fields are account-specific and dynamic |
152+
| `location` | string | Updated record URL from the Location response header |
152153

153154
### NetSuite Upsert Record
154155

apps/sim/blocks/blocks/netsuite.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,7 @@ describe('Oracle NetSuite block', () => {
264264
field: 'operation',
265265
value: [
266266
'netsuite_create_record',
267+
'netsuite_update_record',
267268
'netsuite_batch_get_records',
268269
'netsuite_batch_create_records',
269270
'netsuite_batch_update_records',

apps/sim/blocks/blocks/netsuite.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,11 @@ const BATCH_OPERATIONS = [
111111
'netsuite_batch_delete_records',
112112
]
113113

114-
const LOCATION_OPERATIONS = ['netsuite_create_record', ...BATCH_OPERATIONS]
114+
const LOCATION_OPERATIONS = [
115+
'netsuite_create_record',
116+
'netsuite_update_record',
117+
...BATCH_OPERATIONS,
118+
]
115119

116120
const BATCH_WRITE_OPERATIONS = [
117121
'netsuite_batch_create_records',
@@ -832,7 +836,7 @@ Return ONLY the comma-separated sublist IDs - no explanations, no extra text.`,
832836
},
833837
location: {
834838
type: 'string',
835-
description: 'Created resource or async job location',
839+
description: 'Record resource or async job location returned by NetSuite',
836840
condition: { field: 'operation', value: LOCATION_OPERATIONS },
837841
},
838842
jobId: {

apps/sim/tools/generated/tool-outputs.ts

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

apps/sim/tools/netsuite/netsuite.test.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,11 @@ describe('NetSuite operation contracts', () => {
489489
const entry = SOURCE_MATRIX[apiIndex]
490490
apiIndex += 1
491491
const headers =
492-
entry.successStatus === 202
493-
? { Location: `${ORIGIN}/services/rest/async/v1/job/job-${apiIndex}` }
494-
: undefined
492+
entry.id === 'netsuite_update_record'
493+
? { Location: `${ORIGIN}/services/rest/record/v1/customer/7` }
494+
: entry.successStatus === 202
495+
? { Location: `${ORIGIN}/services/rest/async/v1/job/job-${apiIndex}` }
496+
: undefined
495497
return entry.successStatus === 204 || entry.successStatus === 202
496498
? new Response(null, { status: entry.successStatus, headers })
497499
: new Response(JSON.stringify({ operation: entry.id }), {
@@ -506,6 +508,11 @@ describe('NetSuite operation contracts', () => {
506508
expect(result.success, entry.id).toBe(true)
507509
expect(result.output?.status, entry.id).toBe(entry.successStatus)
508510
if (entry.successStatus === 204) expect(result.output?.data, entry.id).toBeNull()
511+
if (entry.id === 'netsuite_update_record') {
512+
expect(result.output?.location, entry.id).toBe(
513+
`${ORIGIN}/services/rest/record/v1/customer/7`
514+
)
515+
}
509516
if (entry.successStatus === 202) {
510517
expect(result.output?.data, entry.id).toBeNull()
511518
expect(result.output?.location, entry.id).toContain('/services/rest/async/v1/job/')
@@ -563,7 +570,11 @@ describe('NetSuite operation contracts', () => {
563570

564571
for (const tool of NETSUITE_TOOLS) {
565572
const expected = ['status', 'data']
566-
if (tool.id === 'netsuite_create_record' || batchToolIds.has(tool.id)) {
573+
if (
574+
tool.id === 'netsuite_create_record' ||
575+
tool.id === 'netsuite_update_record' ||
576+
batchToolIds.has(tool.id)
577+
) {
567578
expected.push('location')
568579
}
569580
if (batchToolIds.has(tool.id)) expected.push('jobId')

apps/sim/tools/netsuite/update_record.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,10 @@ export const netsuiteUpdateRecordTool: ToolConfig<NetSuiteUpdateRecordParams, Ne
8080
description: 'NetSuite response body; record fields are account-specific and dynamic',
8181
nullable: true,
8282
},
83+
location: {
84+
type: 'string',
85+
description: 'Updated record URL from the Location response header',
86+
optional: true,
87+
},
8388
},
8489
}

0 commit comments

Comments
 (0)