@innet/server 2.0.0-alpha.21 → 2.0.0-alpha.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +119 -47
- package/handler/handler.d.ts +3 -3
- package/handler/handler.es6.js +2 -2
- package/handler/handler.js +2 -2
- package/index.es6.js +1 -1
- package/index.js +2 -2
- package/package.json +1 -1
- package/plugins/main/index.d.ts +1 -1
- package/plugins/main/index.es6.js +1 -1
- package/plugins/main/index.js +1 -1
- package/plugins/main/return/index.d.ts +1 -0
- package/plugins/main/return/index.es6.js +1 -0
- package/plugins/main/return/index.js +9 -0
- package/plugins/main/return/return.d.ts +4 -0
- package/plugins/main/{request/request.es6.js → return/return.es6.js} +2 -2
- package/plugins/main/{request/request.js → return/return.js} +2 -2
- package/plugins/main/request/index.d.ts +0 -1
- package/plugins/main/request/index.es6.js +0 -1
- package/plugins/main/request/index.js +0 -9
- package/plugins/main/request/request.d.ts +0 -4
package/README.md
CHANGED
|
@@ -81,18 +81,18 @@ Here is a **Hello World** example:
|
|
|
81
81
|
```typescript jsx
|
|
82
82
|
export default (
|
|
83
83
|
<server>
|
|
84
|
-
<
|
|
84
|
+
<return>
|
|
85
85
|
<success>
|
|
86
86
|
Hello World!
|
|
87
87
|
</success>
|
|
88
|
-
</
|
|
88
|
+
</return>
|
|
89
89
|
</server>
|
|
90
90
|
)
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
*Use `npm start` to run this server.*
|
|
94
94
|
|
|
95
|
-
Open http://localhost
|
|
95
|
+
Open http://localhost
|
|
96
96
|
You will see the `Hello Word!` string.
|
|
97
97
|
|
|
98
98
|
---
|
|
@@ -110,7 +110,7 @@ export default (
|
|
|
110
110
|
|
|
111
111
|
*Use `npm start` to run this server.*
|
|
112
112
|
|
|
113
|
-
Open http://localhost
|
|
113
|
+
Open http://localhost
|
|
114
114
|
You will see a base Open API JSON structure.
|
|
115
115
|
|
|
116
116
|
```json
|
|
@@ -130,7 +130,7 @@ You will see a base Open API JSON structure.
|
|
|
130
130
|
|
|
131
131
|
[\<server>](#server)
|
|
132
132
|
[\<api>](#api)
|
|
133
|
-
[\<
|
|
133
|
+
[\<return>](#return)
|
|
134
134
|
[\<preset>](#preset)
|
|
135
135
|
|
|
136
136
|
---
|
|
@@ -376,41 +376,100 @@ export default (
|
|
|
376
376
|
)
|
|
377
377
|
```
|
|
378
378
|
|
|
379
|
-
### \<
|
|
379
|
+
### \<return>
|
|
380
380
|
|
|
381
381
|
[← back](#main)
|
|
382
382
|
|
|
383
383
|
This element MUST be placed in [\<server>](#server) element.
|
|
384
|
-
It defines run-time call handler for parent element.
|
|
384
|
+
It defines a run-time call handler for parent element.
|
|
385
385
|
|
|
386
386
|
*src/app.tsx*
|
|
387
387
|
```typescript jsx
|
|
388
388
|
export default (
|
|
389
389
|
<server>
|
|
390
|
-
<
|
|
390
|
+
<return>
|
|
391
391
|
<error status={404} />
|
|
392
|
-
</
|
|
392
|
+
</return>
|
|
393
393
|
</server>
|
|
394
394
|
)
|
|
395
395
|
```
|
|
396
396
|
*Any request returns 404*
|
|
397
397
|
|
|
398
|
-
|
|
398
|
+
The code runs from top to bottom and from left to right.
|
|
399
|
+
You cannot use two [\<return>](#return) elements one by one,
|
|
400
|
+
the same as you cannot use two `return` one by one for a JS `function`.
|
|
401
|
+
|
|
402
|
+
*src/app.tsx*
|
|
403
|
+
```typescript jsx
|
|
404
|
+
export default (
|
|
405
|
+
<server>
|
|
406
|
+
<return>
|
|
407
|
+
<error status={404} />
|
|
408
|
+
</return>
|
|
409
|
+
<return>
|
|
410
|
+
<success />
|
|
411
|
+
</return>
|
|
412
|
+
</server>
|
|
413
|
+
)
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
like
|
|
417
|
+
|
|
418
|
+
```javascript
|
|
419
|
+
function server () {
|
|
420
|
+
return 'error'
|
|
421
|
+
return 'success'
|
|
422
|
+
}
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
*The second [\<return>](#return) will newer run.*
|
|
426
|
+
|
|
427
|
+
You can use [\<return>](#return) in some elements like you use `return` in `if` or `while`.
|
|
428
|
+
|
|
429
|
+
*src/app.tsx*
|
|
430
|
+
```typescript jsx
|
|
431
|
+
export default (
|
|
432
|
+
<server>
|
|
433
|
+
<env is='dev'>
|
|
434
|
+
<return>
|
|
435
|
+
<error status={404} />
|
|
436
|
+
</return>
|
|
437
|
+
</env>
|
|
438
|
+
<return>
|
|
439
|
+
<success />
|
|
440
|
+
</return>
|
|
441
|
+
</server>
|
|
442
|
+
)
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
like
|
|
446
|
+
|
|
447
|
+
```javascript
|
|
448
|
+
function server () {
|
|
449
|
+
if (process.env.NODE_ENV === 'dev') {
|
|
450
|
+
return 'error'
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
return 'success'
|
|
454
|
+
}
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
Place [\<return>](#return) in [\<api>](#api) to handle any unknown request in the [\<api>](#api).
|
|
399
458
|
|
|
400
459
|
*src/app.tsx*
|
|
401
460
|
```typescript jsx
|
|
402
461
|
export default (
|
|
403
462
|
<server>
|
|
404
463
|
<api>
|
|
405
|
-
<
|
|
464
|
+
<return>
|
|
406
465
|
<error status={404} />
|
|
407
|
-
</
|
|
466
|
+
</return>
|
|
408
467
|
</api>
|
|
409
468
|
</server>
|
|
410
469
|
)
|
|
411
470
|
```
|
|
412
471
|
|
|
413
|
-
Place [\<
|
|
472
|
+
Place [\<return>](#return) in [\<endpoint>](#endpoint) to handle the [\<endpoint>](#endpoint) request.
|
|
414
473
|
|
|
415
474
|
*src/app.tsx*
|
|
416
475
|
```typescript jsx
|
|
@@ -418,23 +477,23 @@ export default (
|
|
|
418
477
|
<server>
|
|
419
478
|
<api>
|
|
420
479
|
<endpoint method='get' path='/my-endpoint'>
|
|
421
|
-
<
|
|
480
|
+
<return>
|
|
422
481
|
<success>
|
|
423
482
|
My Endpoint
|
|
424
483
|
</success>
|
|
425
|
-
</
|
|
484
|
+
</return>
|
|
426
485
|
</endpoint>
|
|
427
486
|
</api>
|
|
428
|
-
<
|
|
487
|
+
<return>
|
|
429
488
|
<success>
|
|
430
489
|
Any other request
|
|
431
490
|
</success>
|
|
432
|
-
</
|
|
491
|
+
</return>
|
|
433
492
|
</server>
|
|
434
493
|
)
|
|
435
494
|
```
|
|
436
495
|
|
|
437
|
-
You can place a component inside [\<
|
|
496
|
+
You can place a component inside [\<return>](#return).
|
|
438
497
|
The component will run when the request will be triggered.
|
|
439
498
|
|
|
440
499
|
*src/app.tsx*
|
|
@@ -445,9 +504,9 @@ export default (
|
|
|
445
504
|
<server>
|
|
446
505
|
<api>
|
|
447
506
|
<endpoint method='get' path='/partners'>
|
|
448
|
-
<
|
|
507
|
+
<return>
|
|
449
508
|
<GetPartners />
|
|
450
|
-
</
|
|
509
|
+
</return>
|
|
451
510
|
</endpoint>
|
|
452
511
|
</api>
|
|
453
512
|
</server>
|
|
@@ -469,6 +528,8 @@ export const GetPartners = () => (
|
|
|
469
528
|
|
|
470
529
|
`<preset>` element MUST be placed in `<server>` element.
|
|
471
530
|
This element adds handling of each request.
|
|
531
|
+
It works the same as [\<return>](#return), but do not interrupt the running.
|
|
532
|
+
You can use it to add a `header` or `cookie` or some setup of a parent element.
|
|
472
533
|
|
|
473
534
|
*src/app.tsx*
|
|
474
535
|
```typescript jsx
|
|
@@ -497,7 +558,18 @@ export default (
|
|
|
497
558
|
value='no-cache, no-store, must-revalidate'
|
|
498
559
|
/>
|
|
499
560
|
</preset>
|
|
561
|
+
...Endpoints
|
|
562
|
+
<return>
|
|
563
|
+
<success>
|
|
564
|
+
Header contains `Cache-Control`
|
|
565
|
+
</success>
|
|
566
|
+
</return>
|
|
500
567
|
</api>
|
|
568
|
+
<return>
|
|
569
|
+
<success>
|
|
570
|
+
Header do not contain `Cache-Control`
|
|
571
|
+
</success>
|
|
572
|
+
</return>
|
|
501
573
|
</server>
|
|
502
574
|
)
|
|
503
575
|
```
|
|
@@ -3116,9 +3188,9 @@ export default (
|
|
|
3116
3188
|
<api>
|
|
3117
3189
|
<endpoint method='post' path='/users'>
|
|
3118
3190
|
<body>
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3191
|
+
<object
|
|
3192
|
+
description='The object of a user'
|
|
3193
|
+
/>
|
|
3122
3194
|
</body>
|
|
3123
3195
|
</endpoint>
|
|
3124
3196
|
</api>
|
|
@@ -3295,7 +3367,7 @@ export default (
|
|
|
3295
3367
|
[← back](#run-time)
|
|
3296
3368
|
|
|
3297
3369
|
Returns an error.
|
|
3298
|
-
This element MUST be placed in [\<
|
|
3370
|
+
This element MUST be placed in [\<return>](#return) or [\<response>](#response).
|
|
3299
3371
|
|
|
3300
3372
|
*src/app.tsx*
|
|
3301
3373
|
```typescript jsx
|
|
@@ -3421,7 +3493,7 @@ There are some default errors:
|
|
|
3421
3493
|
|
|
3422
3494
|
[← back](#run-time)
|
|
3423
3495
|
|
|
3424
|
-
MUST be placed in [\<
|
|
3496
|
+
MUST be placed in [\<return>](#return) or [\<response>](#response).
|
|
3425
3497
|
|
|
3426
3498
|
You can easy proxy endpoints to another server/service.
|
|
3427
3499
|
|
|
@@ -3433,9 +3505,9 @@ export default (
|
|
|
3433
3505
|
<endpoint
|
|
3434
3506
|
path='/test'
|
|
3435
3507
|
method='get'>
|
|
3436
|
-
<
|
|
3508
|
+
<return>
|
|
3437
3509
|
<proxy to='https://...' />
|
|
3438
|
-
</
|
|
3510
|
+
</return>
|
|
3439
3511
|
</endpoint>
|
|
3440
3512
|
</api>
|
|
3441
3513
|
<response>
|
|
@@ -3449,7 +3521,7 @@ export default (
|
|
|
3449
3521
|
|
|
3450
3522
|
[← back](#run-time)
|
|
3451
3523
|
|
|
3452
|
-
MUST be placed in [\<
|
|
3524
|
+
MUST be placed in [\<return>](#return) or [\<response>](#response).
|
|
3453
3525
|
|
|
3454
3526
|
You can redirect users to another resource. It adds `Cache-Control` header by default.
|
|
3455
3527
|
|
|
@@ -3461,14 +3533,14 @@ export default (
|
|
|
3461
3533
|
<endpoint
|
|
3462
3534
|
path='/test'
|
|
3463
3535
|
method='get'>
|
|
3464
|
-
<
|
|
3536
|
+
<return>
|
|
3465
3537
|
<redirect to='https://...' />
|
|
3466
|
-
</
|
|
3538
|
+
</return>
|
|
3467
3539
|
</endpoint>
|
|
3468
3540
|
</api>
|
|
3469
|
-
<
|
|
3541
|
+
<return>
|
|
3470
3542
|
<redirect to='https://...' />
|
|
3471
|
-
</
|
|
3543
|
+
</return>
|
|
3472
3544
|
</server>
|
|
3473
3545
|
)
|
|
3474
3546
|
```
|
|
@@ -3486,12 +3558,12 @@ export default (
|
|
|
3486
3558
|
<endpoint
|
|
3487
3559
|
path='/test'
|
|
3488
3560
|
method='get'>
|
|
3489
|
-
<
|
|
3561
|
+
<return>
|
|
3490
3562
|
<redirect
|
|
3491
3563
|
status='found'
|
|
3492
3564
|
to='https://...'
|
|
3493
3565
|
/>
|
|
3494
|
-
</
|
|
3566
|
+
</return>
|
|
3495
3567
|
</endpoint>
|
|
3496
3568
|
</api>
|
|
3497
3569
|
<response>
|
|
@@ -3508,7 +3580,7 @@ export default (
|
|
|
3508
3580
|
|
|
3509
3581
|
[← back](#run-time)
|
|
3510
3582
|
|
|
3511
|
-
MUST be placed in [\<
|
|
3583
|
+
MUST be placed in [\<return>](#return) or [\<response>](#response).
|
|
3512
3584
|
|
|
3513
3585
|
`<cms>` helps to return files from a folder by path. It checks files run-time on the server.
|
|
3514
3586
|
|
|
@@ -3604,7 +3676,7 @@ export default (
|
|
|
3604
3676
|
|
|
3605
3677
|
[← back](#run-time)
|
|
3606
3678
|
|
|
3607
|
-
It returns a file. MUST be placed in [\<
|
|
3679
|
+
It returns a file. MUST be placed in [\<return>](#return) or [\<response>](#response).
|
|
3608
3680
|
|
|
3609
3681
|
It adds `Content-Length` and `Content-Type` automatically.
|
|
3610
3682
|
|
|
@@ -3642,7 +3714,7 @@ export default (
|
|
|
3642
3714
|
|
|
3643
3715
|
### \<header>
|
|
3644
3716
|
|
|
3645
|
-
MUST be placed in [\<
|
|
3717
|
+
MUST be placed in [\<return>](#return) or [\<response>](#response).
|
|
3646
3718
|
|
|
3647
3719
|
[← back](#run-time)
|
|
3648
3720
|
|
|
@@ -3665,7 +3737,7 @@ export default (
|
|
|
3665
3737
|
|
|
3666
3738
|
### \<cookie>
|
|
3667
3739
|
|
|
3668
|
-
MUST be placed in [\<
|
|
3740
|
+
MUST be placed in [\<return>](#return) or [\<response>](#response).
|
|
3669
3741
|
|
|
3670
3742
|
[← back](#run-time)
|
|
3671
3743
|
|
|
@@ -3957,7 +4029,7 @@ Both
|
|
|
3957
4029
|
|
|
3958
4030
|
[← back](#hooks)
|
|
3959
4031
|
|
|
3960
|
-
This hook MUST be used in a component placed in [\<
|
|
4032
|
+
This hook MUST be used in a component placed in [\<return>](#return) or [\<response>](#response).
|
|
3961
4033
|
This hook returns current request instance.
|
|
3962
4034
|
|
|
3963
4035
|
*src/Component.tsx*
|
|
@@ -3978,7 +4050,7 @@ export function Component () {
|
|
|
3978
4050
|
|
|
3979
4051
|
[← back](#hooks)
|
|
3980
4052
|
|
|
3981
|
-
This hook MUST be used in a component placed in [\<
|
|
4053
|
+
This hook MUST be used in a component placed in [\<return>](#return) or [\<response>](#response).
|
|
3982
4054
|
This hook returns current response instance.
|
|
3983
4055
|
|
|
3984
4056
|
*src/Component.tsx*
|
|
@@ -3999,7 +4071,7 @@ export function Component () {
|
|
|
3999
4071
|
|
|
4000
4072
|
[← back](#hooks)
|
|
4001
4073
|
|
|
4002
|
-
This hook MUST be used in a component placed in [\<
|
|
4074
|
+
This hook MUST be used in a component placed in [\<return>](#return) or [\<response>](#response).
|
|
4003
4075
|
This hook returns current request headers object.
|
|
4004
4076
|
|
|
4005
4077
|
*src/Component.tsx*
|
|
@@ -4018,7 +4090,7 @@ export function Component () {
|
|
|
4018
4090
|
|
|
4019
4091
|
[← back](#hooks)
|
|
4020
4092
|
|
|
4021
|
-
This hook MUST be used in a component placed in [\<
|
|
4093
|
+
This hook MUST be used in a component placed in [\<return>](#return) or [\<response>](#response).
|
|
4022
4094
|
This hook returns current request cookies object.
|
|
4023
4095
|
|
|
4024
4096
|
*src/Component.tsx*
|
|
@@ -4037,7 +4109,7 @@ export function Component () {
|
|
|
4037
4109
|
|
|
4038
4110
|
[← back](#hooks)
|
|
4039
4111
|
|
|
4040
|
-
This hook MUST be used in a component placed in [\<
|
|
4112
|
+
This hook MUST be used in a component placed in [\<return>](#return) or [\<response>](#response).
|
|
4041
4113
|
This hook returns current request URL path as a `string`.
|
|
4042
4114
|
|
|
4043
4115
|
*src/Component.tsx*
|
|
@@ -4056,7 +4128,7 @@ export function Component () {
|
|
|
4056
4128
|
|
|
4057
4129
|
[← back](#hooks)
|
|
4058
4130
|
|
|
4059
|
-
This hook MUST be used in a component placed in [\<
|
|
4131
|
+
This hook MUST be used in a component placed in [\<return>](#return) or [\<response>](#response).
|
|
4060
4132
|
This hook returns an object of URL params you set by [\<param>](#param).
|
|
4061
4133
|
|
|
4062
4134
|
*src/Component.tsx*
|
|
@@ -4074,7 +4146,7 @@ export function Component () {
|
|
|
4074
4146
|
|
|
4075
4147
|
[← back](#hooks)
|
|
4076
4148
|
|
|
4077
|
-
This hook MUST be used in a component placed in [\<
|
|
4149
|
+
This hook MUST be used in a component placed in [\<return>](#return) or [\<response>](#response).
|
|
4078
4150
|
This hook returns an object of URL query params.
|
|
4079
4151
|
|
|
4080
4152
|
*src/Component.tsx*
|
|
@@ -4092,7 +4164,7 @@ export function Component () {
|
|
|
4092
4164
|
|
|
4093
4165
|
[← back](#hooks)
|
|
4094
4166
|
|
|
4095
|
-
This hook MUST be used in a component placed in [\<
|
|
4167
|
+
This hook MUST be used in a component placed in [\<return>](#return) or [\<response>](#response).
|
|
4096
4168
|
This hook returns current request body.
|
|
4097
4169
|
|
|
4098
4170
|
*src/Component.tsx*
|
|
@@ -4111,7 +4183,7 @@ export function Component () {
|
|
|
4111
4183
|
[← back](#hooks)
|
|
4112
4184
|
|
|
4113
4185
|
This hook returns request user IP.
|
|
4114
|
-
This hook MUST be used in a component placed in [\<
|
|
4186
|
+
This hook MUST be used in a component placed in [\<return>](#return) or [\<response>](#response).
|
|
4115
4187
|
|
|
4116
4188
|
*src/Component.tsx*
|
|
4117
4189
|
```typescript jsx
|
package/handler/handler.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { context, type ContextProps, slot, type SlotProps, slots, type SlotsProps } from '@innet/jsx';
|
|
2
2
|
import { arraySync, async } from '@innet/utils';
|
|
3
|
-
import { type AnyProps, type ApiProps, type ArrayProps, type BinaryProps, blacklist, type BlacklistProps, type BodyProps, type BooleanProps, cms, type CmsProps, type ContactProps, type CookieProps, type DateProps, type DtsProps, type EndpointProps, type EnvProps, type ErrorProps, type FieldProps, file, type FileProps, type HeaderProps, type HostProps, type IntegerProps, type LicenseProps, type NullProps, type NumberProps, type ObjectProps, type ParamProps, preset, type PresetProps, protection, type ProtectionProps, type ProxyProps, type RedirectProps, type
|
|
3
|
+
import { type AnyProps, type ApiProps, type ArrayProps, type BinaryProps, blacklist, type BlacklistProps, type BodyProps, type BooleanProps, cms, type CmsProps, type ContactProps, type CookieProps, type DateProps, type DtsProps, type EndpointProps, type EnvProps, type ErrorProps, type FieldProps, file, type FileProps, type HeaderProps, type HostProps, type IntegerProps, type LicenseProps, type NullProps, type NumberProps, type ObjectProps, type ParamProps, preset, type PresetProps, protection, type ProtectionProps, type ProxyProps, type RedirectProps, type ResponseProps, type ReturnProps, type ServerProps, type StringProps, type SuccessProps, type SwaggerProps, type TagProps, type TupleProps, type UuidProps, type VariableProps, whitelist, type WhitelistProps } from '../plugins';
|
|
4
4
|
export declare const arrayPlugins: (typeof arraySync)[];
|
|
5
5
|
export declare const JSXPlugins: {
|
|
6
6
|
any: import("innet").HandlerPlugin;
|
|
@@ -33,8 +33,8 @@ export declare const JSXPlugins: {
|
|
|
33
33
|
protection: typeof protection;
|
|
34
34
|
proxy: import("innet").HandlerPlugin;
|
|
35
35
|
redirect: import("innet").HandlerPlugin;
|
|
36
|
-
request: import("innet").HandlerPlugin;
|
|
37
36
|
response: import("innet").HandlerPlugin;
|
|
37
|
+
return: import("innet").HandlerPlugin;
|
|
38
38
|
slot: typeof slot;
|
|
39
39
|
slots: typeof slots;
|
|
40
40
|
server: import("innet").HandlerPlugin;
|
|
@@ -84,7 +84,7 @@ declare global {
|
|
|
84
84
|
protection: ProtectionProps;
|
|
85
85
|
proxy: ProxyProps;
|
|
86
86
|
redirect: RedirectProps;
|
|
87
|
-
|
|
87
|
+
return: ReturnProps;
|
|
88
88
|
response: ResponseProps;
|
|
89
89
|
slot: SlotProps;
|
|
90
90
|
slots: SlotsProps;
|
package/handler/handler.es6.js
CHANGED
|
@@ -31,8 +31,8 @@ import { preset } from '../plugins/main/preset/preset.es6.js';
|
|
|
31
31
|
import { protection } from '../plugins/utils/protection/protection.es6.js';
|
|
32
32
|
import { proxy } from '../plugins/request/proxy/proxy.es6.js';
|
|
33
33
|
import { redirect } from '../plugins/request/redirect/redirect.es6.js';
|
|
34
|
-
import { request } from '../plugins/main/request/request.es6.js';
|
|
35
34
|
import { response } from '../plugins/main/response/response.es6.js';
|
|
35
|
+
import { returnPlugin } from '../plugins/main/return/return.es6.js';
|
|
36
36
|
import { server } from '../plugins/main/server/server.es6.js';
|
|
37
37
|
import { swagger } from '../plugins/utils/swagger/swagger.es6.js';
|
|
38
38
|
import { string } from '../plugins/schema/string/string.es6.js';
|
|
@@ -78,8 +78,8 @@ const JSXPlugins = {
|
|
|
78
78
|
protection,
|
|
79
79
|
proxy,
|
|
80
80
|
redirect,
|
|
81
|
-
request,
|
|
82
81
|
response,
|
|
82
|
+
return: returnPlugin,
|
|
83
83
|
slot,
|
|
84
84
|
slots,
|
|
85
85
|
server,
|
package/handler/handler.js
CHANGED
|
@@ -35,8 +35,8 @@ var preset = require('../plugins/main/preset/preset.js');
|
|
|
35
35
|
var protection = require('../plugins/utils/protection/protection.js');
|
|
36
36
|
var proxy = require('../plugins/request/proxy/proxy.js');
|
|
37
37
|
var redirect = require('../plugins/request/redirect/redirect.js');
|
|
38
|
-
var request = require('../plugins/main/request/request.js');
|
|
39
38
|
var response = require('../plugins/main/response/response.js');
|
|
39
|
+
var _return = require('../plugins/main/return/return.js');
|
|
40
40
|
var server = require('../plugins/main/server/server.js');
|
|
41
41
|
var swagger = require('../plugins/utils/swagger/swagger.js');
|
|
42
42
|
var string = require('../plugins/schema/string/string.js');
|
|
@@ -82,8 +82,8 @@ const JSXPlugins = {
|
|
|
82
82
|
protection: protection.protection,
|
|
83
83
|
proxy: proxy.proxy,
|
|
84
84
|
redirect: redirect.redirect,
|
|
85
|
-
request: request.request,
|
|
86
85
|
response: response.response,
|
|
86
|
+
return: _return.returnPlugin,
|
|
87
87
|
slot: jsx.slot,
|
|
88
88
|
slots: jsx.slots,
|
|
89
89
|
server: server.server,
|
package/index.es6.js
CHANGED
|
@@ -13,7 +13,7 @@ export { variable } from './plugins/main/variable/variable.es6.js';
|
|
|
13
13
|
export { tag } from './plugins/main/tag/tag.es6.js';
|
|
14
14
|
export { endpoint } from './plugins/main/endpoint/endpoint.es6.js';
|
|
15
15
|
export { response, statuses } from './plugins/main/response/response.es6.js';
|
|
16
|
-
export {
|
|
16
|
+
export { returnPlugin } from './plugins/main/return/return.es6.js';
|
|
17
17
|
export { param } from './plugins/main/param/param.es6.js';
|
|
18
18
|
export { body } from './plugins/main/body/body.es6.js';
|
|
19
19
|
export { preset } from './plugins/main/preset/preset.es6.js';
|
package/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var variable = require('./plugins/main/variable/variable.js');
|
|
|
17
17
|
var tag = require('./plugins/main/tag/tag.js');
|
|
18
18
|
var endpoint = require('./plugins/main/endpoint/endpoint.js');
|
|
19
19
|
var response = require('./plugins/main/response/response.js');
|
|
20
|
-
var
|
|
20
|
+
var _return = require('./plugins/main/return/return.js');
|
|
21
21
|
var param = require('./plugins/main/param/param.js');
|
|
22
22
|
var body = require('./plugins/main/body/body.js');
|
|
23
23
|
var preset = require('./plugins/main/preset/preset.js');
|
|
@@ -137,7 +137,7 @@ exports.tag = tag.tag;
|
|
|
137
137
|
exports.endpoint = endpoint.endpoint;
|
|
138
138
|
exports.response = response.response;
|
|
139
139
|
exports.statuses = response.statuses;
|
|
140
|
-
exports.
|
|
140
|
+
exports.returnPlugin = _return.returnPlugin;
|
|
141
141
|
exports.param = param.param;
|
|
142
142
|
exports.body = body.body;
|
|
143
143
|
exports.preset = preset.preset;
|
package/package.json
CHANGED
package/plugins/main/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import './variable/index.es6.js';
|
|
|
7
7
|
import './tag/index.es6.js';
|
|
8
8
|
import './endpoint/index.es6.js';
|
|
9
9
|
import './response/index.es6.js';
|
|
10
|
-
import './
|
|
10
|
+
import './return/index.es6.js';
|
|
11
11
|
import './param/index.es6.js';
|
|
12
12
|
import './body/index.es6.js';
|
|
13
13
|
import './preset/index.es6.js';
|
package/plugins/main/index.js
CHANGED
|
@@ -9,7 +9,7 @@ require('./variable/index.js');
|
|
|
9
9
|
require('./tag/index.js');
|
|
10
10
|
require('./endpoint/index.js');
|
|
11
11
|
require('./response/index.js');
|
|
12
|
-
require('./
|
|
12
|
+
require('./return/index.js');
|
|
13
13
|
require('./param/index.js');
|
|
14
14
|
require('./body/index.js');
|
|
15
15
|
require('./preset/index.js');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './return';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { returnPlugin } from './return.es6.js';
|
|
@@ -2,9 +2,9 @@ import { useChildren } from '@innet/jsx';
|
|
|
2
2
|
import '../../../hooks/index.es6.js';
|
|
3
3
|
import { useServerPlugin } from '../../../hooks/useServerPlugin/useServerPlugin.es6.js';
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const returnPlugin = () => {
|
|
6
6
|
const children = useChildren();
|
|
7
7
|
useServerPlugin(() => children);
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
export {
|
|
10
|
+
export { returnPlugin };
|
|
@@ -6,9 +6,9 @@ var jsx = require('@innet/jsx');
|
|
|
6
6
|
require('../../../hooks/index.js');
|
|
7
7
|
var useServerPlugin = require('../../../hooks/useServerPlugin/useServerPlugin.js');
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const returnPlugin = () => {
|
|
10
10
|
const children = jsx.useChildren();
|
|
11
11
|
useServerPlugin.useServerPlugin(() => children);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
exports.
|
|
14
|
+
exports.returnPlugin = returnPlugin;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './request';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { request } from './request.es6.js';
|