Skip to content

Commit 3d9d9cb

Browse files
v0.5.40: supabase ops to allow non-public schemas, jira uuid
2 parents 0f4ec96 + 58fcb4e commit 3d9d9cb

File tree

11 files changed

+163
-40
lines changed

11 files changed

+163
-40
lines changed

apps/sim/blocks/blocks/jira.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,10 @@ export const JiraBlock: BlockConfig<JiraResponse> = {
253253
condition: { field: 'operation', value: 'write' },
254254
},
255255
{
256-
id: 'teamUuid',
257-
title: 'Team UUID',
256+
id: 'customFieldValue',
257+
title: 'Custom Field Value',
258258
type: 'short-input',
259-
placeholder: 'e.g., b3aa307a-76ea-462d-b6f1-a6e89ce9858a',
259+
placeholder: 'Value for the custom field',
260260
dependsOn: ['projectId'],
261261
condition: { field: 'operation', value: 'write' },
262262
},
@@ -561,6 +561,8 @@ export const JiraBlock: BlockConfig<JiraResponse> = {
561561
.filter((item) => item !== '')
562562
}
563563

564+
const customFieldValue = params.customFieldValue || undefined
565+
564566
const writeParams = {
565567
projectId: effectiveProjectId,
566568
summary: params.summary || '',
@@ -574,7 +576,7 @@ export const JiraBlock: BlockConfig<JiraResponse> = {
574576
reporter: params.reporter || undefined,
575577
environment: params.environment || undefined,
576578
customFieldId: params.customFieldId || undefined,
577-
customFieldValue: params.customFieldValue || undefined,
579+
customFieldValue: customFieldValue,
578580
}
579581
return {
580582
...baseParams,

apps/sim/blocks/blocks/supabase.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ export const SupabaseBlock: BlockConfig<SupabaseResponse> = {
6969
value: ['query', 'get_row', 'insert', 'update', 'delete', 'upsert', 'count', 'text_search'],
7070
},
7171
},
72+
{
73+
id: 'schema',
74+
title: 'Schema',
75+
type: 'short-input',
76+
placeholder: 'public (default)',
77+
condition: {
78+
field: 'operation',
79+
value: ['query', 'get_row', 'insert', 'update', 'delete', 'upsert', 'count', 'text_search'],
80+
},
81+
},
7282
{
7383
id: 'apiKey',
7484
title: 'Service Role Secret',
@@ -1026,6 +1036,7 @@ Return ONLY the PostgREST filter expression - no explanations, no markdown, no e
10261036
operation: { type: 'string', description: 'Operation to perform' },
10271037
projectId: { type: 'string', description: 'Supabase project identifier' },
10281038
table: { type: 'string', description: 'Database table name' },
1039+
schema: { type: 'string', description: 'Database schema (default: public)' },
10291040
apiKey: { type: 'string', description: 'Service role secret key' },
10301041
// Data for insert/update operations
10311042
data: { type: 'json', description: 'Row data' },

apps/sim/tools/supabase/count.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ export const countTool: ToolConfig<SupabaseCountParams, SupabaseCountResponse> =
2020
visibility: 'user-or-llm',
2121
description: 'The name of the Supabase table to count rows from',
2222
},
23+
schema: {
24+
type: 'string',
25+
required: false,
26+
visibility: 'user-or-llm',
27+
description:
28+
'Database schema to count from (default: public). Use this to access tables in other schemas.',
29+
},
2330
filter: {
2431
type: 'string',
2532
required: false,
@@ -54,11 +61,15 @@ export const countTool: ToolConfig<SupabaseCountParams, SupabaseCountResponse> =
5461
method: 'HEAD',
5562
headers: (params) => {
5663
const countType = params.countType || 'exact'
57-
return {
64+
const headers: Record<string, string> = {
5865
apikey: params.apiKey,
5966
Authorization: `Bearer ${params.apiKey}`,
6067
Prefer: `count=${countType}`,
6168
}
69+
if (params.schema) {
70+
headers['Accept-Profile'] = params.schema
71+
}
72+
return headers
6273
},
6374
},
6475

apps/sim/tools/supabase/delete.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ export const deleteTool: ToolConfig<SupabaseDeleteParams, SupabaseDeleteResponse
2020
visibility: 'user-or-llm',
2121
description: 'The name of the Supabase table to delete from',
2222
},
23+
schema: {
24+
type: 'string',
25+
required: false,
26+
visibility: 'user-or-llm',
27+
description:
28+
'Database schema to delete from (default: public). Use this to access tables in other schemas.',
29+
},
2330
filter: {
2431
type: 'string',
2532
required: true,
@@ -51,11 +58,17 @@ export const deleteTool: ToolConfig<SupabaseDeleteParams, SupabaseDeleteResponse
5158
return url
5259
},
5360
method: 'DELETE',
54-
headers: (params) => ({
55-
apikey: params.apiKey,
56-
Authorization: `Bearer ${params.apiKey}`,
57-
Prefer: 'return=representation',
58-
}),
61+
headers: (params) => {
62+
const headers: Record<string, string> = {
63+
apikey: params.apiKey,
64+
Authorization: `Bearer ${params.apiKey}`,
65+
Prefer: 'return=representation',
66+
}
67+
if (params.schema) {
68+
headers['Content-Profile'] = params.schema
69+
}
70+
return headers
71+
},
5972
},
6073

6174
transformResponse: async (response: Response) => {

apps/sim/tools/supabase/get_row.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ export const getRowTool: ToolConfig<SupabaseGetRowParams, SupabaseGetRowResponse
2020
visibility: 'user-or-llm',
2121
description: 'The name of the Supabase table to query',
2222
},
23+
schema: {
24+
type: 'string',
25+
required: false,
26+
visibility: 'user-or-llm',
27+
description:
28+
'Database schema to query from (default: public). Use this to access tables in other schemas.',
29+
},
2330
filter: {
2431
type: 'string',
2532
required: true,
@@ -50,10 +57,16 @@ export const getRowTool: ToolConfig<SupabaseGetRowParams, SupabaseGetRowResponse
5057
return url
5158
},
5259
method: 'GET',
53-
headers: (params) => ({
54-
apikey: params.apiKey,
55-
Authorization: `Bearer ${params.apiKey}`,
56-
}),
60+
headers: (params) => {
61+
const headers: Record<string, string> = {
62+
apikey: params.apiKey,
63+
Authorization: `Bearer ${params.apiKey}`,
64+
}
65+
if (params.schema) {
66+
headers['Accept-Profile'] = params.schema
67+
}
68+
return headers
69+
},
5770
},
5871

5972
transformResponse: async (response: Response) => {

apps/sim/tools/supabase/insert.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ export const insertTool: ToolConfig<SupabaseInsertParams, SupabaseInsertResponse
2020
visibility: 'user-or-llm',
2121
description: 'The name of the Supabase table to insert data into',
2222
},
23+
schema: {
24+
type: 'string',
25+
required: false,
26+
visibility: 'user-or-llm',
27+
description:
28+
'Database schema to insert into (default: public). Use this to access tables in other schemas.',
29+
},
2330
data: {
2431
type: 'array',
2532
required: true,
@@ -37,12 +44,18 @@ export const insertTool: ToolConfig<SupabaseInsertParams, SupabaseInsertResponse
3744
request: {
3845
url: (params) => `https://${params.projectId}.supabase.co/rest/v1/${params.table}?select=*`,
3946
method: 'POST',
40-
headers: (params) => ({
41-
apikey: params.apiKey,
42-
Authorization: `Bearer ${params.apiKey}`,
43-
'Content-Type': 'application/json',
44-
Prefer: 'return=representation',
45-
}),
47+
headers: (params) => {
48+
const headers: Record<string, string> = {
49+
apikey: params.apiKey,
50+
Authorization: `Bearer ${params.apiKey}`,
51+
'Content-Type': 'application/json',
52+
Prefer: 'return=representation',
53+
}
54+
if (params.schema) {
55+
headers['Content-Profile'] = params.schema
56+
}
57+
return headers
58+
},
4659
body: (params) => {
4760
// Prepare the data - if it's an object but not an array, wrap it in an array
4861
const dataToSend =

apps/sim/tools/supabase/query.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ export const queryTool: ToolConfig<SupabaseQueryParams, SupabaseQueryResponse> =
2020
visibility: 'user-or-llm',
2121
description: 'The name of the Supabase table to query',
2222
},
23+
schema: {
24+
type: 'string',
25+
required: false,
26+
visibility: 'user-or-llm',
27+
description:
28+
'Database schema to query from (default: public). Use this to access tables in other schemas.',
29+
},
2330
filter: {
2431
type: 'string',
2532
required: false,
@@ -84,10 +91,16 @@ export const queryTool: ToolConfig<SupabaseQueryParams, SupabaseQueryResponse> =
8491
return url
8592
},
8693
method: 'GET',
87-
headers: (params) => ({
88-
apikey: params.apiKey,
89-
Authorization: `Bearer ${params.apiKey}`,
90-
}),
94+
headers: (params) => {
95+
const headers: Record<string, string> = {
96+
apikey: params.apiKey,
97+
Authorization: `Bearer ${params.apiKey}`,
98+
}
99+
if (params.schema) {
100+
headers['Accept-Profile'] = params.schema
101+
}
102+
return headers
103+
},
91104
},
92105

93106
transformResponse: async (response: Response) => {

apps/sim/tools/supabase/text_search.ts

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ export const textSearchTool: ToolConfig<SupabaseTextSearchParams, SupabaseTextSe
2020
visibility: 'user-or-llm',
2121
description: 'The name of the Supabase table to search',
2222
},
23+
schema: {
24+
type: 'string',
25+
required: false,
26+
visibility: 'user-or-llm',
27+
description:
28+
'Database schema to search in (default: public). Use this to access tables in other schemas.',
29+
},
2330
column: {
2431
type: 'string',
2532
required: true,
@@ -86,10 +93,16 @@ export const textSearchTool: ToolConfig<SupabaseTextSearchParams, SupabaseTextSe
8693
return url
8794
},
8895
method: 'GET',
89-
headers: (params) => ({
90-
apikey: params.apiKey,
91-
Authorization: `Bearer ${params.apiKey}`,
92-
}),
96+
headers: (params) => {
97+
const headers: Record<string, string> = {
98+
apikey: params.apiKey,
99+
Authorization: `Bearer ${params.apiKey}`,
100+
}
101+
if (params.schema) {
102+
headers['Accept-Profile'] = params.schema
103+
}
104+
return headers
105+
},
93106
},
94107

95108
transformResponse: async (response: Response) => {

apps/sim/tools/supabase/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export interface SupabaseQueryParams {
44
apiKey: string
55
projectId: string
66
table: string
7+
schema?: string
78
filter?: string
89
orderBy?: string
910
limit?: number
@@ -13,20 +14,23 @@ export interface SupabaseInsertParams {
1314
apiKey: string
1415
projectId: string
1516
table: string
17+
schema?: string
1618
data: any
1719
}
1820

1921
export interface SupabaseGetRowParams {
2022
apiKey: string
2123
projectId: string
2224
table: string
25+
schema?: string
2326
filter: string
2427
}
2528

2629
export interface SupabaseUpdateParams {
2730
apiKey: string
2831
projectId: string
2932
table: string
33+
schema?: string
3034
filter: string
3135
data: any
3236
}
@@ -35,13 +39,15 @@ export interface SupabaseDeleteParams {
3539
apiKey: string
3640
projectId: string
3741
table: string
42+
schema?: string
3843
filter: string
3944
}
4045

4146
export interface SupabaseUpsertParams {
4247
apiKey: string
4348
projectId: string
4449
table: string
50+
schema?: string
4551
data: any
4652
}
4753

@@ -93,6 +99,7 @@ export interface SupabaseTextSearchParams {
9399
apiKey: string
94100
projectId: string
95101
table: string
102+
schema?: string
96103
column: string
97104
query: string
98105
searchType?: string
@@ -107,6 +114,7 @@ export interface SupabaseCountParams {
107114
apiKey: string
108115
projectId: string
109116
table: string
117+
schema?: string
110118
filter?: string
111119
countType?: string
112120
}

apps/sim/tools/supabase/update.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ export const updateTool: ToolConfig<SupabaseUpdateParams, SupabaseUpdateResponse
2020
visibility: 'user-or-llm',
2121
description: 'The name of the Supabase table to update',
2222
},
23+
schema: {
24+
type: 'string',
25+
required: false,
26+
visibility: 'user-or-llm',
27+
description:
28+
'Database schema to update in (default: public). Use this to access tables in other schemas.',
29+
},
2330
filter: {
2431
type: 'string',
2532
required: true,
@@ -53,12 +60,18 @@ export const updateTool: ToolConfig<SupabaseUpdateParams, SupabaseUpdateResponse
5360
return url
5461
},
5562
method: 'PATCH',
56-
headers: (params) => ({
57-
apikey: params.apiKey,
58-
Authorization: `Bearer ${params.apiKey}`,
59-
'Content-Type': 'application/json',
60-
Prefer: 'return=representation',
61-
}),
63+
headers: (params) => {
64+
const headers: Record<string, string> = {
65+
apikey: params.apiKey,
66+
Authorization: `Bearer ${params.apiKey}`,
67+
'Content-Type': 'application/json',
68+
Prefer: 'return=representation',
69+
}
70+
if (params.schema) {
71+
headers['Content-Profile'] = params.schema
72+
}
73+
return headers
74+
},
6275
body: (params) => params.data,
6376
},
6477

0 commit comments

Comments
 (0)