@@ -4,8 +4,7 @@ import { pgMeta } from './utils'
4
4
test ( 'list' , async ( ) => {
5
5
const res = await pgMeta . functions . list ( )
6
6
expect ( res . data ?. find ( ( { name } ) => name === 'add' ) ) . toMatchInlineSnapshot (
7
- { id : expect . any ( Number ) } ,
8
- `
7
+ { id : expect . any ( Number ) } , `
9
8
{
10
9
"args": [
11
10
{
@@ -38,17 +37,14 @@ test('list', async () => {
38
37
"is_set_returning_function": false,
39
38
"language": "sql",
40
39
"name": "add",
41
- "return_table_name ": null,
40
+ "prorows ": null,
42
41
"return_type": "integer",
43
42
"return_type_id": 23,
44
43
"return_type_relation_id": null,
45
- "returns_multiple_rows": false,
46
- "returns_set_of_table": false,
47
44
"schema": "public",
48
45
"security_definer": false,
49
46
}
50
- `
51
- )
47
+ ` )
52
48
} )
53
49
54
50
test ( 'list set-returning function with single object limit' , async ( ) => {
@@ -85,12 +81,10 @@ test('list set-returning function with single object limit', async () => {
85
81
"is_set_returning_function": true,
86
82
"language": "sql",
87
83
"name": "get_user_audit_setof_single_row",
88
- "return_table_name ": "users_audit" ,
84
+ "prorows ": 1 ,
89
85
"return_type": "SETOF users_audit",
90
86
"return_type_id": 16418,
91
87
"return_type_relation_id": 16416,
92
- "returns_multiple_rows": false,
93
- "returns_set_of_table": true,
94
88
"schema": "public",
95
89
"security_definer": false,
96
90
},
@@ -131,12 +125,10 @@ test('list set-returning function with multiples definitions', async () => {
131
125
"is_set_returning_function": true,
132
126
"language": "sql",
133
127
"name": "get_todos_setof_rows",
134
- "return_table_name ": "todos" ,
128
+ "prorows ": 1000 ,
135
129
"return_type": "SETOF todos",
136
130
"return_type_id": 16404,
137
131
"return_type_relation_id": 16402,
138
- "returns_multiple_rows": true,
139
- "returns_set_of_table": true,
140
132
"schema": "public",
141
133
"security_definer": false,
142
134
},
@@ -169,12 +161,10 @@ test('list set-returning function with multiples definitions', async () => {
169
161
"is_set_returning_function": true,
170
162
"language": "sql",
171
163
"name": "get_todos_setof_rows",
172
- "return_table_name ": "todos" ,
164
+ "prorows ": 1000 ,
173
165
"return_type": "SETOF todos",
174
166
"return_type_id": 16404,
175
167
"return_type_relation_id": 16402,
176
- "returns_multiple_rows": true,
177
- "returns_set_of_table": true,
178
168
"schema": "public",
179
169
"security_definer": false,
180
170
},
@@ -234,8 +224,7 @@ test('retrieve, create, update, delete', async () => {
234
224
config_params : { search_path : 'hooks, auth' , role : 'postgres' } ,
235
225
} )
236
226
expect ( res ) . toMatchInlineSnapshot (
237
- { data : { id : expect . any ( Number ) } } ,
238
- `
227
+ { data : { id : expect . any ( Number ) } } , `
239
228
{
240
229
"data": {
241
230
"args": [
@@ -274,23 +263,19 @@ test('retrieve, create, update, delete', async () => {
274
263
"is_set_returning_function": false,
275
264
"language": "sql",
276
265
"name": "test_func",
277
- "return_table_name ": null,
266
+ "prorows ": null,
278
267
"return_type": "integer",
279
268
"return_type_id": 23,
280
269
"return_type_relation_id": null,
281
- "returns_multiple_rows": false,
282
- "returns_set_of_table": false,
283
270
"schema": "public",
284
271
"security_definer": true,
285
272
},
286
273
"error": null,
287
274
}
288
- `
289
- )
275
+ ` )
290
276
res = await pgMeta . functions . retrieve ( { id : res . data ! . id } )
291
277
expect ( res ) . toMatchInlineSnapshot (
292
- { data : { id : expect . any ( Number ) } } ,
293
- `
278
+ { data : { id : expect . any ( Number ) } } , `
294
279
{
295
280
"data": {
296
281
"args": [
@@ -329,27 +314,23 @@ test('retrieve, create, update, delete', async () => {
329
314
"is_set_returning_function": false,
330
315
"language": "sql",
331
316
"name": "test_func",
332
- "return_table_name ": null,
317
+ "prorows ": null,
333
318
"return_type": "integer",
334
319
"return_type_id": 23,
335
320
"return_type_relation_id": null,
336
- "returns_multiple_rows": false,
337
- "returns_set_of_table": false,
338
321
"schema": "public",
339
322
"security_definer": true,
340
323
},
341
324
"error": null,
342
325
}
343
- `
344
- )
326
+ ` )
345
327
res = await pgMeta . functions . update ( res . data ! . id , {
346
328
name : 'test_func_renamed' ,
347
329
schema : 'test_schema' ,
348
330
definition : 'select b - a' ,
349
331
} )
350
332
expect ( res ) . toMatchInlineSnapshot (
351
- { data : { id : expect . any ( Number ) } } ,
352
- `
333
+ { data : { id : expect . any ( Number ) } } , `
353
334
{
354
335
"data": {
355
336
"args": [
@@ -388,23 +369,19 @@ test('retrieve, create, update, delete', async () => {
388
369
"is_set_returning_function": false,
389
370
"language": "sql",
390
371
"name": "test_func_renamed",
391
- "return_table_name ": null,
372
+ "prorows ": null,
392
373
"return_type": "integer",
393
374
"return_type_id": 23,
394
375
"return_type_relation_id": null,
395
- "returns_multiple_rows": false,
396
- "returns_set_of_table": false,
397
376
"schema": "test_schema",
398
377
"security_definer": true,
399
378
},
400
379
"error": null,
401
380
}
402
- `
403
- )
381
+ ` )
404
382
res = await pgMeta . functions . remove ( res . data ! . id )
405
383
expect ( res ) . toMatchInlineSnapshot (
406
- { data : { id : expect . any ( Number ) } } ,
407
- `
384
+ { data : { id : expect . any ( Number ) } } , `
408
385
{
409
386
"data": {
410
387
"args": [
@@ -443,19 +420,16 @@ test('retrieve, create, update, delete', async () => {
443
420
"is_set_returning_function": false,
444
421
"language": "sql",
445
422
"name": "test_func_renamed",
446
- "return_table_name ": null,
423
+ "prorows ": null,
447
424
"return_type": "integer",
448
425
"return_type_id": 23,
449
426
"return_type_relation_id": null,
450
- "returns_multiple_rows": false,
451
- "returns_set_of_table": false,
452
427
"schema": "test_schema",
453
428
"security_definer": true,
454
429
},
455
430
"error": null,
456
431
}
457
- `
458
- )
432
+ ` )
459
433
res = await pgMeta . functions . retrieve ( { id : res . data ! . id } )
460
434
expect ( res ) . toMatchObject ( {
461
435
data : null ,
@@ -478,8 +452,7 @@ test('retrieve set-returning function', async () => {
478
452
id : expect . any ( Number ) ,
479
453
return_type_id : expect . any ( Number ) ,
480
454
return_type_relation_id : expect . any ( Number ) ,
481
- } ,
482
- `
455
+ } , `
483
456
{
484
457
"args": [],
485
458
"argument_types": "",
@@ -501,17 +474,14 @@ test('retrieve set-returning function', async () => {
501
474
"is_set_returning_function": true,
502
475
"language": "sql",
503
476
"name": "function_returning_set_of_rows",
504
- "return_table_name ": "users" ,
477
+ "prorows ": 1000 ,
505
478
"return_type": "SETOF users",
506
479
"return_type_id": Any<Number>,
507
480
"return_type_relation_id": Any<Number>,
508
- "returns_multiple_rows": true,
509
- "returns_set_of_table": true,
510
481
"schema": "public",
511
482
"security_definer": false,
512
483
}
513
- `
514
- )
484
+ ` )
515
485
} )
516
486
517
487
test ( 'retrieve function by args filter - polymorphic function with text argument' , async ( ) => {
0 commit comments