@@ -4,8 +4,7 @@ import { pgMeta } from './utils'
44test ( 'list' , async ( ) => {
55 const res = await pgMeta . functions . list ( )
66 expect ( res . data ?. find ( ( { name } ) => name === 'add' ) ) . toMatchInlineSnapshot (
7- { id : expect . any ( Number ) } ,
8- `
7+ { id : expect . any ( Number ) } , `
98 {
109 "args": [
1110 {
@@ -38,17 +37,14 @@ test('list', async () => {
3837 "is_set_returning_function": false,
3938 "language": "sql",
4039 "name": "add",
41- "return_table_name ": null,
40+ "prorows ": null,
4241 "return_type": "integer",
4342 "return_type_id": 23,
4443 "return_type_relation_id": null,
45- "returns_multiple_rows": false,
46- "returns_set_of_table": false,
4744 "schema": "public",
4845 "security_definer": false,
4946 }
50- `
51- )
47+ ` )
5248} )
5349
5450test ( 'list set-returning function with single object limit' , async ( ) => {
@@ -85,12 +81,10 @@ test('list set-returning function with single object limit', async () => {
8581 "is_set_returning_function": true,
8682 "language": "sql",
8783 "name": "get_user_audit_setof_single_row",
88- "return_table_name ": "users_audit" ,
84+ "prorows ": 1 ,
8985 "return_type": "SETOF users_audit",
9086 "return_type_id": 16418,
9187 "return_type_relation_id": 16416,
92- "returns_multiple_rows": false,
93- "returns_set_of_table": true,
9488 "schema": "public",
9589 "security_definer": false,
9690 },
@@ -131,12 +125,10 @@ test('list set-returning function with multiples definitions', async () => {
131125 "is_set_returning_function": true,
132126 "language": "sql",
133127 "name": "get_todos_setof_rows",
134- "return_table_name ": "todos" ,
128+ "prorows ": 1000 ,
135129 "return_type": "SETOF todos",
136130 "return_type_id": 16404,
137131 "return_type_relation_id": 16402,
138- "returns_multiple_rows": true,
139- "returns_set_of_table": true,
140132 "schema": "public",
141133 "security_definer": false,
142134 },
@@ -169,12 +161,10 @@ test('list set-returning function with multiples definitions', async () => {
169161 "is_set_returning_function": true,
170162 "language": "sql",
171163 "name": "get_todos_setof_rows",
172- "return_table_name ": "todos" ,
164+ "prorows ": 1000 ,
173165 "return_type": "SETOF todos",
174166 "return_type_id": 16404,
175167 "return_type_relation_id": 16402,
176- "returns_multiple_rows": true,
177- "returns_set_of_table": true,
178168 "schema": "public",
179169 "security_definer": false,
180170 },
@@ -234,8 +224,7 @@ test('retrieve, create, update, delete', async () => {
234224 config_params : { search_path : 'hooks, auth' , role : 'postgres' } ,
235225 } )
236226 expect ( res ) . toMatchInlineSnapshot (
237- { data : { id : expect . any ( Number ) } } ,
238- `
227+ { data : { id : expect . any ( Number ) } } , `
239228 {
240229 "data": {
241230 "args": [
@@ -274,23 +263,19 @@ test('retrieve, create, update, delete', async () => {
274263 "is_set_returning_function": false,
275264 "language": "sql",
276265 "name": "test_func",
277- "return_table_name ": null,
266+ "prorows ": null,
278267 "return_type": "integer",
279268 "return_type_id": 23,
280269 "return_type_relation_id": null,
281- "returns_multiple_rows": false,
282- "returns_set_of_table": false,
283270 "schema": "public",
284271 "security_definer": true,
285272 },
286273 "error": null,
287274 }
288- `
289- )
275+ ` )
290276 res = await pgMeta . functions . retrieve ( { id : res . data ! . id } )
291277 expect ( res ) . toMatchInlineSnapshot (
292- { data : { id : expect . any ( Number ) } } ,
293- `
278+ { data : { id : expect . any ( Number ) } } , `
294279 {
295280 "data": {
296281 "args": [
@@ -329,27 +314,23 @@ test('retrieve, create, update, delete', async () => {
329314 "is_set_returning_function": false,
330315 "language": "sql",
331316 "name": "test_func",
332- "return_table_name ": null,
317+ "prorows ": null,
333318 "return_type": "integer",
334319 "return_type_id": 23,
335320 "return_type_relation_id": null,
336- "returns_multiple_rows": false,
337- "returns_set_of_table": false,
338321 "schema": "public",
339322 "security_definer": true,
340323 },
341324 "error": null,
342325 }
343- `
344- )
326+ ` )
345327 res = await pgMeta . functions . update ( res . data ! . id , {
346328 name : 'test_func_renamed' ,
347329 schema : 'test_schema' ,
348330 definition : 'select b - a' ,
349331 } )
350332 expect ( res ) . toMatchInlineSnapshot (
351- { data : { id : expect . any ( Number ) } } ,
352- `
333+ { data : { id : expect . any ( Number ) } } , `
353334 {
354335 "data": {
355336 "args": [
@@ -388,23 +369,19 @@ test('retrieve, create, update, delete', async () => {
388369 "is_set_returning_function": false,
389370 "language": "sql",
390371 "name": "test_func_renamed",
391- "return_table_name ": null,
372+ "prorows ": null,
392373 "return_type": "integer",
393374 "return_type_id": 23,
394375 "return_type_relation_id": null,
395- "returns_multiple_rows": false,
396- "returns_set_of_table": false,
397376 "schema": "test_schema",
398377 "security_definer": true,
399378 },
400379 "error": null,
401380 }
402- `
403- )
381+ ` )
404382 res = await pgMeta . functions . remove ( res . data ! . id )
405383 expect ( res ) . toMatchInlineSnapshot (
406- { data : { id : expect . any ( Number ) } } ,
407- `
384+ { data : { id : expect . any ( Number ) } } , `
408385 {
409386 "data": {
410387 "args": [
@@ -443,19 +420,16 @@ test('retrieve, create, update, delete', async () => {
443420 "is_set_returning_function": false,
444421 "language": "sql",
445422 "name": "test_func_renamed",
446- "return_table_name ": null,
423+ "prorows ": null,
447424 "return_type": "integer",
448425 "return_type_id": 23,
449426 "return_type_relation_id": null,
450- "returns_multiple_rows": false,
451- "returns_set_of_table": false,
452427 "schema": "test_schema",
453428 "security_definer": true,
454429 },
455430 "error": null,
456431 }
457- `
458- )
432+ ` )
459433 res = await pgMeta . functions . retrieve ( { id : res . data ! . id } )
460434 expect ( res ) . toMatchObject ( {
461435 data : null ,
@@ -478,8 +452,7 @@ test('retrieve set-returning function', async () => {
478452 id : expect . any ( Number ) ,
479453 return_type_id : expect . any ( Number ) ,
480454 return_type_relation_id : expect . any ( Number ) ,
481- } ,
482- `
455+ } , `
483456 {
484457 "args": [],
485458 "argument_types": "",
@@ -501,17 +474,14 @@ test('retrieve set-returning function', async () => {
501474 "is_set_returning_function": true,
502475 "language": "sql",
503476 "name": "function_returning_set_of_rows",
504- "return_table_name ": "users" ,
477+ "prorows ": 1000 ,
505478 "return_type": "SETOF users",
506479 "return_type_id": Any<Number>,
507480 "return_type_relation_id": Any<Number>,
508- "returns_multiple_rows": true,
509- "returns_set_of_table": true,
510481 "schema": "public",
511482 "security_definer": false,
512483 }
513- `
514- )
484+ ` )
515485} )
516486
517487test ( 'retrieve function by args filter - polymorphic function with text argument' , async ( ) => {
0 commit comments