Skip to content

Commit 7848635

Browse files
waleedlatif1claude
andcommitted
fix(rippling): use rest-destructuring for all custom object record data output
The spec uses additionalProperties for custom fields at the top level, not a nested `data` sub-object. Use the same rest-destructuring pattern across all 6 custom object record tools so `data` only contains dynamic fields, not duplicates of enumerated standard fields. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent de85ea0 commit 7848635

4 files changed

Lines changed: 92 additions & 44 deletions

File tree

apps/sim/tools/rippling/create_custom_object_record.ts

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,32 @@ export const ripplingCreateCustomObjectRecordTool: ToolConfig<RipplingCreateCust
5151
throw new Error(`Rippling API error (${response.status}): ${errorText}`)
5252
}
5353
const json = await response.json()
54-
const record = json.data ?? json
54+
const record = (json.data ?? json) as Record<string, unknown>
55+
const {
56+
id,
57+
created_at,
58+
updated_at,
59+
name,
60+
external_id,
61+
created_by,
62+
last_modified_by,
63+
owner_role,
64+
system_updated_at,
65+
...dynamicFields
66+
} = record
5567
return {
5668
success: true,
5769
output: {
58-
id: (record.id as string) ?? '',
59-
created_at: (record.created_at as string) ?? null,
60-
updated_at: (record.updated_at as string) ?? null,
61-
name: (record.name as string) ?? null,
62-
external_id: (record.external_id as string) ?? null,
63-
created_by: record.created_by ?? null,
64-
last_modified_by: record.last_modified_by ?? null,
65-
owner_role: record.owner_role ?? null,
66-
system_updated_at: (record.system_updated_at as string) ?? null,
67-
data: (record.data as Record<string, unknown>) ?? record,
70+
id: (id as string) ?? '',
71+
created_at: (created_at as string) ?? null,
72+
updated_at: (updated_at as string) ?? null,
73+
name: (name as string) ?? null,
74+
external_id: (external_id as string) ?? null,
75+
created_by: created_by ?? null,
76+
last_modified_by: last_modified_by ?? null,
77+
owner_role: owner_role ?? null,
78+
system_updated_at: (system_updated_at as string) ?? null,
79+
data: dynamicFields,
6880
},
6981
}
7082
},

apps/sim/tools/rippling/get_custom_object_record.ts

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,32 @@ export const ripplingGetCustomObjectRecordTool: ToolConfig<RipplingGetCustomObje
3333
const errorText = await response.text()
3434
throw new Error(`Rippling API error (${response.status}): ${errorText}`)
3535
}
36-
const data = await response.json()
36+
const record = await response.json()
37+
const {
38+
id,
39+
created_at,
40+
updated_at,
41+
name,
42+
external_id,
43+
created_by,
44+
last_modified_by,
45+
owner_role,
46+
system_updated_at,
47+
...dynamicFields
48+
} = record
3749
return {
3850
success: true,
3951
output: {
40-
id: (data.id as string) ?? '',
41-
created_at: (data.created_at as string) ?? null,
42-
updated_at: (data.updated_at as string) ?? null,
43-
name: (data.name as string) ?? null,
44-
external_id: (data.external_id as string) ?? null,
45-
created_by: data.created_by ?? null,
46-
last_modified_by: data.last_modified_by ?? null,
47-
owner_role: data.owner_role ?? null,
48-
system_updated_at: (data.system_updated_at as string) ?? null,
49-
data: (data.data as Record<string, unknown>) ?? data,
52+
id: (id as string) ?? '',
53+
created_at: (created_at as string) ?? null,
54+
updated_at: (updated_at as string) ?? null,
55+
name: (name as string) ?? null,
56+
external_id: (external_id as string) ?? null,
57+
created_by: created_by ?? null,
58+
last_modified_by: last_modified_by ?? null,
59+
owner_role: owner_role ?? null,
60+
system_updated_at: (system_updated_at as string) ?? null,
61+
data: dynamicFields,
5062
},
5163
}
5264
},

apps/sim/tools/rippling/get_custom_object_record_by_external_id.ts

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,32 @@ export const ripplingGetCustomObjectRecordByExternalIdTool: ToolConfig<RipplingG
4242
const errorText = await response.text()
4343
throw new Error(`Rippling API error (${response.status}): ${errorText}`)
4444
}
45-
const data = await response.json()
45+
const record = await response.json()
46+
const {
47+
id,
48+
created_at,
49+
updated_at,
50+
name,
51+
external_id,
52+
created_by,
53+
last_modified_by,
54+
owner_role,
55+
system_updated_at,
56+
...dynamicFields
57+
} = record
4658
return {
4759
success: true,
4860
output: {
49-
id: (data.id as string) ?? '',
50-
created_at: (data.created_at as string) ?? null,
51-
updated_at: (data.updated_at as string) ?? null,
52-
name: (data.name as string) ?? null,
53-
external_id: (data.external_id as string) ?? null,
54-
created_by: data.created_by ?? null,
55-
last_modified_by: data.last_modified_by ?? null,
56-
owner_role: data.owner_role ?? null,
57-
system_updated_at: (data.system_updated_at as string) ?? null,
58-
data: (data.data as Record<string, unknown>) ?? data,
61+
id: (id as string) ?? '',
62+
created_at: (created_at as string) ?? null,
63+
updated_at: (updated_at as string) ?? null,
64+
name: (name as string) ?? null,
65+
external_id: (external_id as string) ?? null,
66+
created_by: created_by ?? null,
67+
last_modified_by: last_modified_by ?? null,
68+
owner_role: owner_role ?? null,
69+
system_updated_at: (system_updated_at as string) ?? null,
70+
data: dynamicFields,
5971
},
6072
}
6173
},

apps/sim/tools/rippling/update_custom_object_record.ts

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,32 @@ export const ripplingUpdateCustomObjectRecordTool: ToolConfig<RipplingUpdateCust
6363
throw new Error(`Rippling API error (${response.status}): ${errorText}`)
6464
}
6565
const json = await response.json()
66-
const record = json.data ?? json
66+
const record = (json.data ?? json) as Record<string, unknown>
67+
const {
68+
id,
69+
created_at,
70+
updated_at,
71+
name,
72+
external_id,
73+
created_by,
74+
last_modified_by,
75+
owner_role,
76+
system_updated_at,
77+
...dynamicFields
78+
} = record
6779
return {
6880
success: true,
6981
output: {
70-
id: (record.id as string) ?? '',
71-
created_at: (record.created_at as string) ?? null,
72-
updated_at: (record.updated_at as string) ?? null,
73-
name: (record.name as string) ?? null,
74-
external_id: (record.external_id as string) ?? null,
75-
created_by: record.created_by ?? null,
76-
last_modified_by: record.last_modified_by ?? null,
77-
owner_role: record.owner_role ?? null,
78-
system_updated_at: (record.system_updated_at as string) ?? null,
79-
data: (record.data as Record<string, unknown>) ?? record,
82+
id: (id as string) ?? '',
83+
created_at: (created_at as string) ?? null,
84+
updated_at: (updated_at as string) ?? null,
85+
name: (name as string) ?? null,
86+
external_id: (external_id as string) ?? null,
87+
created_by: created_by ?? null,
88+
last_modified_by: last_modified_by ?? null,
89+
owner_role: owner_role ?? null,
90+
system_updated_at: (system_updated_at as string) ?? null,
91+
data: dynamicFields,
8092
},
8193
}
8294
},

0 commit comments

Comments
 (0)