@innet/server 2.0.0-alpha.8 → 2.0.0-beta.1
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 +1200 -440
- package/_virtual/_rollup-plugin-process-env.es6.js +10 -0
- package/_virtual/_rollup-plugin-process-env.js +12 -0
- package/handler/handler.d.ts +27 -14
- package/handler/handler.es6.js +17 -11
- package/handler/handler.js +17 -11
- package/hooks/index.d.ts +6 -1
- package/hooks/index.es6.js +6 -1
- package/hooks/index.js +6 -1
- package/hooks/useAction/useAction.es6.js +1 -1
- package/hooks/useAction/useAction.js +1 -1
- package/hooks/useApi/useApi.d.ts +1 -3
- package/hooks/useClientIp/useClientIp.d.ts +1 -1
- package/hooks/useClientIp/useClientIp.es6.js +4 -10
- package/hooks/useClientIp/useClientIp.js +4 -10
- package/hooks/useEndpoint/useEndpoint.d.ts +1 -1
- package/hooks/useEndpoint/useEndpoint.es6.js +3 -1
- package/hooks/useEndpoint/useEndpoint.js +3 -1
- package/hooks/useIsServerHttps/index.d.ts +1 -0
- package/hooks/useIsServerHttps/index.es6.js +1 -0
- package/hooks/useIsServerHttps/index.js +10 -0
- package/hooks/useIsServerHttps/useIsServerHttps.d.ts +3 -0
- package/hooks/useIsServerHttps/useIsServerHttps.es6.js +14 -0
- package/hooks/useIsServerHttps/useIsServerHttps.js +19 -0
- package/hooks/useNewSchema/useNewSchema.es6.js +1 -1
- package/hooks/useNewSchema/useNewSchema.js +1 -1
- package/hooks/useObjectSchemaContext/index.d.ts +1 -0
- package/hooks/useObjectSchemaContext/index.es6.js +1 -0
- package/hooks/useObjectSchemaContext/index.js +10 -0
- package/hooks/useObjectSchemaContext/useObjectSchemaContext.d.ts +3 -0
- package/hooks/useObjectSchemaContext/useObjectSchemaContext.es6.js +14 -0
- package/hooks/useObjectSchemaContext/useObjectSchemaContext.js +19 -0
- package/hooks/useRequest/index.es6.js +1 -1
- package/hooks/useRequest/index.js +0 -1
- package/hooks/useRequest/useRequest.d.ts +1 -4
- package/hooks/useRequest/useRequest.es6.js +4 -4
- package/hooks/useRequest/useRequest.js +3 -4
- package/hooks/useRequestHandler/index.d.ts +1 -0
- package/hooks/useRequestHandler/index.es6.js +1 -0
- package/hooks/useRequestHandler/index.js +10 -0
- package/hooks/useRequestHandler/useRequestHandler.d.ts +4 -0
- package/hooks/useRequestHandler/useRequestHandler.es6.js +14 -0
- package/hooks/useRequestHandler/useRequestHandler.js +19 -0
- package/hooks/useResponse/index.es6.js +1 -1
- package/hooks/useResponse/index.js +0 -1
- package/hooks/useResponse/useResponse.d.ts +1 -4
- package/hooks/useResponse/useResponse.es6.js +4 -4
- package/hooks/useResponse/useResponse.js +3 -4
- package/hooks/useSchemaType/useSchemaType.d.ts +3 -2
- package/hooks/useSchemaType/useSchemaType.es6.js +5 -6
- package/hooks/useSchemaType/useSchemaType.js +5 -6
- package/hooks/useServer/useServer.d.ts +2 -1
- package/hooks/useServer/useServer.es6.js +3 -1
- package/hooks/useServer/useServer.js +3 -1
- package/hooks/useServerPlugin/index.d.ts +1 -0
- package/hooks/useServerPlugin/index.es6.js +1 -0
- package/hooks/useServerPlugin/index.js +9 -0
- package/hooks/useServerPlugin/useServerPlugin.d.ts +2 -0
- package/hooks/useServerPlugin/useServerPlugin.es6.js +13 -0
- package/hooks/useServerPlugin/useServerPlugin.js +17 -0
- package/hooks/useServerPlugins/index.d.ts +1 -0
- package/hooks/useServerPlugins/index.es6.js +1 -0
- package/hooks/useServerPlugins/index.js +10 -0
- package/hooks/useServerPlugins/useServerPlugins.d.ts +4 -0
- package/hooks/useServerPlugins/useServerPlugins.es6.js +14 -0
- package/hooks/useServerPlugins/useServerPlugins.js +19 -0
- package/hooks/useServerPort/index.d.ts +1 -0
- package/hooks/useServerPort/index.es6.js +1 -0
- package/hooks/useServerPort/index.js +10 -0
- package/hooks/useServerPort/useServerPort.d.ts +3 -0
- package/hooks/useServerPort/useServerPort.es6.js +14 -0
- package/hooks/useServerPort/useServerPort.js +19 -0
- package/index.es6.js +17 -9
- package/index.js +33 -14
- package/package.json +2 -3
- package/plugins/main/api/api.d.ts +11 -8
- package/plugins/main/api/api.es6.js +55 -56
- package/plugins/main/api/api.js +54 -55
- package/plugins/main/body/body.d.ts +1 -0
- package/plugins/main/contact/contact.d.ts +2 -2
- package/plugins/main/endpoint/endpoint.d.ts +16 -15
- package/plugins/main/endpoint/endpoint.es6.js +8 -6
- package/plugins/main/endpoint/endpoint.js +7 -5
- package/plugins/main/host/host.d.ts +5 -5
- package/plugins/main/index.d.ts +2 -2
- package/plugins/main/index.es6.js +2 -2
- package/plugins/main/index.js +2 -2
- package/plugins/main/license/license.d.ts +5 -5
- package/plugins/main/param/param.d.ts +12 -11
- package/plugins/main/param/param.es6.js +6 -6
- package/plugins/main/param/param.js +5 -5
- package/plugins/main/preset/index.d.ts +1 -0
- package/plugins/main/preset/index.es6.js +1 -0
- package/plugins/{utils/prod → main/preset}/index.js +2 -2
- package/plugins/main/preset/preset.d.ts +3 -0
- package/plugins/main/preset/preset.es6.js +13 -0
- package/plugins/{utils/dev/dev.js → main/preset/preset.js} +9 -6
- package/plugins/main/response/index.es6.js +1 -1
- package/plugins/main/response/index.js +1 -0
- package/plugins/main/response/response.d.ts +6 -1
- package/plugins/main/response/response.es6.js +22 -13
- package/plugins/main/response/response.js +21 -11
- 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/return/return.es6.js +10 -0
- package/plugins/main/return/return.js +14 -0
- package/plugins/main/server/server.d.ts +6 -5
- package/plugins/main/server/server.es6.js +43 -16
- package/plugins/main/server/server.js +42 -15
- package/plugins/main/tag/tag.d.ts +3 -2
- package/plugins/main/tag/tag.es6.js +6 -4
- package/plugins/main/tag/tag.js +5 -3
- package/plugins/main/variable/variable.d.ts +5 -5
- package/plugins/main/variable/variable.es6.js +3 -1
- package/plugins/main/variable/variable.js +3 -1
- package/plugins/request/cms/cms.d.ts +1 -0
- package/plugins/request/cms/cms.es6.js +3 -4
- package/plugins/request/cms/cms.js +2 -3
- package/plugins/request/cookie/cookie.es6.js +3 -19
- package/plugins/request/cookie/cookie.js +3 -23
- package/plugins/request/error/error.d.ts +41 -40
- package/plugins/request/error/error.es6.js +48 -45
- package/plugins/request/error/error.js +47 -44
- package/plugins/request/file/file.d.ts +1 -0
- package/plugins/request/file/file.es6.js +5 -6
- package/plugins/request/file/file.js +4 -5
- package/plugins/request/header/header.es6.js +1 -1
- package/plugins/request/header/header.js +1 -1
- package/plugins/request/proxy/proxy.d.ts +4 -1
- package/plugins/request/proxy/proxy.es6.js +5 -2
- package/plugins/request/proxy/proxy.js +5 -2
- package/plugins/request/redirect/redirect.d.ts +8 -7
- package/plugins/request/redirect/redirect.es6.js +7 -7
- package/plugins/request/redirect/redirect.js +7 -7
- package/plugins/request/success/success.d.ts +8 -6
- package/plugins/request/success/success.es6.js +21 -11
- package/plugins/request/success/success.js +20 -10
- package/plugins/schema/any/any.d.ts +5 -0
- package/plugins/schema/any/any.es6.js +27 -0
- package/plugins/schema/any/any.js +31 -0
- package/plugins/schema/array/array.d.ts +1 -0
- package/plugins/schema/array/array.es6.js +3 -3
- package/plugins/schema/array/array.js +2 -2
- package/plugins/schema/binary/binary.d.ts +3 -3
- package/plugins/schema/date/date.d.ts +1 -1
- package/plugins/schema/date/date.es6.js +3 -3
- package/plugins/schema/date/date.js +3 -3
- package/plugins/schema/field/field.d.ts +2 -0
- package/plugins/schema/field/field.es6.js +8 -8
- package/plugins/schema/field/field.js +6 -6
- package/plugins/schema/index.d.ts +1 -0
- package/plugins/schema/index.es6.js +1 -0
- package/plugins/schema/index.js +1 -0
- package/plugins/schema/integer/integer.d.ts +3 -3
- package/plugins/schema/integer/integer.es6.js +1 -1
- package/plugins/schema/integer/integer.js +1 -1
- package/plugins/schema/number/number.d.ts +2 -2
- package/plugins/schema/number/number.es6.js +1 -1
- package/plugins/schema/number/number.js +1 -1
- package/plugins/schema/object/object.d.ts +1 -0
- package/plugins/schema/object/object.es6.js +20 -7
- package/plugins/schema/object/object.js +19 -6
- package/plugins/schema/string/string.d.ts +2 -2
- package/plugins/schema/string/string.es6.js +44 -30
- package/plugins/schema/string/string.js +44 -30
- package/plugins/schema/tuple/tuple.d.ts +1 -0
- package/plugins/schema/tuple/tuple.es6.js +5 -5
- package/plugins/schema/tuple/tuple.js +4 -4
- package/plugins/schema/uuid/uuid.es6.js +1 -1
- package/plugins/schema/uuid/uuid.js +1 -1
- package/plugins/utils/blacklist/blacklist.d.ts +5 -0
- package/plugins/utils/blacklist/blacklist.es6.js +17 -0
- package/plugins/utils/blacklist/blacklist.js +21 -0
- package/plugins/utils/blacklist/index.d.ts +1 -0
- package/plugins/utils/blacklist/index.es6.js +1 -0
- package/plugins/utils/blacklist/index.js +9 -0
- package/plugins/utils/dts/dts.d.ts +2 -1
- package/plugins/utils/dts/dts.es6.js +2 -2
- package/plugins/utils/dts/dts.js +2 -2
- package/plugins/utils/env/env.d.ts +7 -0
- package/plugins/utils/env/env.es6.js +11 -0
- package/plugins/utils/{prod/prod.js → env/env.js} +5 -4
- package/plugins/utils/env/index.d.ts +1 -0
- package/plugins/utils/env/index.es6.js +1 -0
- package/plugins/utils/{dev → env}/index.js +2 -2
- package/plugins/utils/index.d.ts +4 -2
- package/plugins/utils/index.es6.js +4 -2
- package/plugins/utils/index.js +4 -2
- package/plugins/utils/protection/index.d.ts +1 -0
- package/plugins/utils/protection/index.es6.js +1 -0
- package/plugins/utils/protection/index.js +9 -0
- package/plugins/utils/protection/protection.d.ts +9 -0
- package/plugins/utils/protection/protection.es6.js +35 -0
- package/plugins/utils/protection/protection.js +39 -0
- package/plugins/utils/swagger/swagger.es6.js +10 -8
- package/plugins/utils/swagger/swagger.js +10 -8
- package/plugins/utils/whitelist/index.d.ts +1 -0
- package/plugins/utils/whitelist/index.es6.js +1 -0
- package/plugins/utils/whitelist/index.js +9 -0
- package/plugins/utils/whitelist/whitelist.d.ts +5 -0
- package/plugins/utils/whitelist/whitelist.es6.js +19 -0
- package/plugins/utils/whitelist/whitelist.js +23 -0
- package/types.d.ts +15 -23
- package/utils/FileData/Bin.d.ts +13 -13
- package/utils/FileData/Bin.es6.js +2 -2
- package/utils/FileData/Bin.js +2 -2
- package/utils/action/Action.d.ts +17 -14
- package/utils/action/Action.es6.js +102 -78
- package/utils/action/Action.js +102 -78
- package/utils/dateFormat/dateFormat.d.ts +1 -1
- package/utils/dateFormat/dateFormat.es6.js +1 -1
- package/utils/dateFormat/dateFormat.js +1 -1
- package/utils/decorators/once/once.es6.js +1 -1
- package/utils/decorators/once/once.js +1 -1
- package/utils/generateTypes/generateTypes.d.ts +2 -2
- package/utils/generateTypes/generateTypes.es6.js +85 -25
- package/utils/generateTypes/generateTypes.js +85 -25
- package/utils/getEndpoint/getEndpoint.es6.js +2 -2
- package/utils/getEndpoint/getEndpoint.js +2 -2
- package/utils/getOrAdd/getOrAdd.d.ts +1 -1
- package/utils/httpOnStart/httpOnStart.d.ts +1 -1
- package/utils/httpOnStart/httpOnStart.es6.js +1 -1
- package/utils/httpOnStart/httpOnStart.js +1 -1
- package/utils/rules/binaryAccept/binaryAccept.es6.js +2 -2
- package/utils/rules/binaryAccept/binaryAccept.js +2 -2
- package/utils/rules/dateTo/dateTo.d.ts +1 -1
- package/utils/rules/helpers.d.ts +1 -1
- package/utils/rules/index.d.ts +0 -1
- package/utils/rules/index.es6.js +0 -1
- package/utils/rules/index.js +0 -1
- package/utils/rules/int/int.es6.js +2 -2
- package/utils/rules/int/int.js +2 -2
- package/utils/rules/max/max.d.ts +1 -1
- package/utils/rules/max/max.es6.js +3 -3
- package/utils/rules/max/max.js +3 -3
- package/utils/rules/maxBin/maxBin.es6.js +2 -2
- package/utils/rules/maxBin/maxBin.js +2 -2
- package/utils/rules/maxDate/maxDate.es6.js +1 -1
- package/utils/rules/maxDate/maxDate.js +1 -1
- package/utils/rules/maxLength/maxLength.es6.js +2 -2
- package/utils/rules/maxLength/maxLength.js +2 -2
- package/utils/rules/min/min.d.ts +1 -1
- package/utils/rules/min/min.es6.js +3 -3
- package/utils/rules/min/min.js +3 -3
- package/utils/rules/minBin/minBin.es6.js +2 -2
- package/utils/rules/minBin/minBin.js +2 -2
- package/utils/rules/minDate/minDate.es6.js +1 -1
- package/utils/rules/minDate/minDate.js +1 -1
- package/utils/rules/minLength/minLength.es6.js +2 -2
- package/utils/rules/minLength/minLength.js +2 -2
- package/utils/rules/objectOf/objectOf.d.ts +1 -1
- package/utils/rules/objectOf/objectOf.es6.js +11 -1
- package/utils/rules/objectOf/objectOf.js +11 -1
- package/utils/rules/pattern/pattern.d.ts +1 -1
- package/utils/rules/pattern/pattern.es6.js +2 -1
- package/utils/rules/pattern/pattern.js +2 -1
- package/example/app/App/App.d.ts +0 -1
- package/example/app/App/index.d.ts +0 -1
- package/example/index.d.ts +0 -1
- package/example/requests/index.d.ts +0 -1
- package/example/requests/todo/AddTodo/AddTodo.d.ts +0 -1
- package/example/requests/todo/AddTodo/index.d.ts +0 -1
- package/example/requests/todo/DeleteTodo/DeleteTodo.d.ts +0 -1
- package/example/requests/todo/DeleteTodo/index.d.ts +0 -1
- package/example/requests/todo/EditTodo/EditTodo.d.ts +0 -1
- package/example/requests/todo/EditTodo/index.d.ts +0 -1
- package/example/requests/todo/GetTodo/GetTodo.d.ts +0 -1
- package/example/requests/todo/GetTodo/index.d.ts +0 -1
- package/example/requests/todo/GetTodos/GetTodos.d.ts +0 -1
- package/example/requests/todo/GetTodos/index.d.ts +0 -1
- package/example/requests/todo/index.d.ts +0 -5
- package/example/requests/todo/todos.d.ts +0 -1
- package/example/schemas/app/ListQueryParams/ListQueryParams.d.ts +0 -1
- package/example/schemas/app/ListQueryParams/index.d.ts +0 -1
- package/example/schemas/app/ListSchema/ListSchema.d.ts +0 -4
- package/example/schemas/app/ListSchema/index.d.ts +0 -1
- package/example/schemas/app/index.d.ts +0 -2
- package/example/schemas/index.d.ts +0 -2
- package/example/schemas/todo/TodoSchema/TodoSchema.d.ts +0 -4
- package/example/schemas/todo/TodoSchema/index.d.ts +0 -1
- package/example/schemas/todo/index.d.ts +0 -1
- package/example/tags/Todo/Todo.d.ts +0 -1
- package/example/tags/Todo/index.d.ts +0 -1
- package/example/tags/index.d.ts +0 -1
- package/hooks/useRequestPlugin/index.d.ts +0 -1
- package/hooks/useRequestPlugin/index.es6.js +0 -1
- package/hooks/useRequestPlugin/index.js +0 -9
- package/hooks/useRequestPlugin/useRequestPlugin.d.ts +0 -2
- package/hooks/useRequestPlugin/useRequestPlugin.es6.js +0 -13
- package/hooks/useRequestPlugin/useRequestPlugin.js +0 -17
- package/openApi.test.d.ts +0 -1
- package/plugins/main/fallback/fallback.d.ts +0 -4
- package/plugins/main/fallback/fallback.es6.js +0 -19
- package/plugins/main/fallback/fallback.js +0 -23
- package/plugins/main/fallback/index.d.ts +0 -1
- package/plugins/main/fallback/index.es6.js +0 -1
- package/plugins/main/fallback/index.js +0 -9
- 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/plugins/main/request/request.es6.js +0 -21
- package/plugins/main/request/request.js +0 -25
- package/plugins/utils/dev/dev.d.ts +0 -4
- package/plugins/utils/dev/dev.es6.js +0 -10
- package/plugins/utils/dev/index.d.ts +0 -1
- package/plugins/utils/dev/index.es6.js +0 -1
- package/plugins/utils/prod/index.d.ts +0 -1
- package/plugins/utils/prod/index.es6.js +0 -1
- package/plugins/utils/prod/prod.d.ts +0 -4
- package/plugins/utils/prod/prod.es6.js +0 -10
- package/utils/decorators/once/once.test.d.ts +0 -1
- package/utils/generateTypes/generateTypes.test.d.ts +0 -1
- package/utils/parseSearch/parseSearch.test.d.ts +0 -1
- package/utils/rules/any/any.d.ts +0 -1
- package/utils/rules/any/any.es6.js +0 -5
- package/utils/rules/any/any.js +0 -9
- /package/{utils/rules → plugins/schema}/any/index.d.ts +0 -0
- /package/{utils/rules → plugins/schema}/any/index.es6.js +0 -0
- /package/{utils/rules → plugins/schema}/any/index.js +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
;(function () {
|
|
4
|
+
const env = {"INNETJS_JSX_PACKAGE_VERSION":"1.4.0"};
|
|
5
|
+
if (typeof process === 'undefined') {
|
|
6
|
+
globalThis.process = { env: env };
|
|
7
|
+
} else if (process.env) {
|
|
8
|
+
Object.assign(process.env, env);
|
|
9
|
+
} else {
|
|
10
|
+
process.env = env;
|
|
11
|
+
}
|
|
12
|
+
})();
|
package/handler/handler.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { context, type ContextProps, slot, type SlotProps, slots, type SlotsProps } from '@innet/jsx';
|
|
1
|
+
import { context, type ContextProps, type JSXElement, slot, type SlotProps, slots, type SlotsProps } from '@innet/jsx';
|
|
2
2
|
import { arraySync, async } from '@innet/utils';
|
|
3
|
-
import { type ApiProps, type ArrayProps, type BinaryProps, type BodyProps, type BooleanProps, cms, type CmsProps, type ContactProps, type CookieProps, type DateProps, 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
|
+
any: import("innet").HandlerPlugin;
|
|
6
7
|
api: import("innet").HandlerPlugin;
|
|
7
8
|
array: import("innet").HandlerPlugin;
|
|
8
9
|
binary: import("innet").HandlerPlugin;
|
|
10
|
+
blacklist: typeof blacklist;
|
|
9
11
|
body: import("innet").HandlerPlugin;
|
|
10
12
|
boolean: import("innet").HandlerPlugin;
|
|
11
13
|
cms: typeof cms;
|
|
@@ -13,11 +15,10 @@ export declare const JSXPlugins: {
|
|
|
13
15
|
context: typeof context;
|
|
14
16
|
cookie: import("innet").HandlerPlugin;
|
|
15
17
|
date: import("innet").HandlerPlugin;
|
|
16
|
-
dev: import("innet").HandlerPlugin;
|
|
17
18
|
dts: import("innet").HandlerPlugin;
|
|
18
19
|
endpoint: import("innet").HandlerPlugin;
|
|
20
|
+
env: import("innet").HandlerPlugin;
|
|
19
21
|
error: import("innet").HandlerPlugin;
|
|
20
|
-
fallback: import("innet").HandlerPlugin;
|
|
21
22
|
field: import("innet").HandlerPlugin;
|
|
22
23
|
file: typeof file;
|
|
23
24
|
header: import("innet").HandlerPlugin;
|
|
@@ -28,21 +29,23 @@ export declare const JSXPlugins: {
|
|
|
28
29
|
number: import("innet").HandlerPlugin;
|
|
29
30
|
object: import("innet").HandlerPlugin;
|
|
30
31
|
param: import("innet").HandlerPlugin;
|
|
31
|
-
|
|
32
|
+
preset: typeof preset;
|
|
33
|
+
protection: typeof protection;
|
|
32
34
|
proxy: import("innet").HandlerPlugin;
|
|
33
35
|
redirect: import("innet").HandlerPlugin;
|
|
34
|
-
request: import("innet").HandlerPlugin;
|
|
35
36
|
response: import("innet").HandlerPlugin;
|
|
37
|
+
return: import("innet").HandlerPlugin;
|
|
38
|
+
server: import("innet").HandlerPlugin;
|
|
36
39
|
slot: typeof slot;
|
|
37
40
|
slots: typeof slots;
|
|
38
|
-
server: import("innet").HandlerPlugin;
|
|
39
|
-
swagger: import("innet").HandlerPlugin;
|
|
40
41
|
string: import("innet").HandlerPlugin;
|
|
41
42
|
success: import("innet").HandlerPlugin;
|
|
43
|
+
swagger: import("innet").HandlerPlugin;
|
|
42
44
|
tag: import("innet").HandlerPlugin;
|
|
43
45
|
tuple: import("innet").HandlerPlugin;
|
|
44
46
|
uuid: import("innet").HandlerPlugin;
|
|
45
47
|
variable: import("innet").HandlerPlugin;
|
|
48
|
+
whitelist: typeof whitelist;
|
|
46
49
|
};
|
|
47
50
|
export declare const fnPlugins: import("innet").Plugin[];
|
|
48
51
|
export declare const objectPlugins: import("innet").Plugin[];
|
|
@@ -50,10 +53,19 @@ export declare const promisePlugins: (typeof async)[];
|
|
|
50
53
|
export declare const handler: import("innet").Handler;
|
|
51
54
|
declare global {
|
|
52
55
|
namespace JSX {
|
|
56
|
+
type Element = ArrayElement | FunctionElement | JSXElement | boolean | null | number | (string & {}) | undefined;
|
|
57
|
+
interface ArrayElement extends Array<Element> {
|
|
58
|
+
}
|
|
59
|
+
type FunctionElement = () => Element;
|
|
60
|
+
interface ElementChildrenAttribute {
|
|
61
|
+
children: {};
|
|
62
|
+
}
|
|
53
63
|
interface IntrinsicElements {
|
|
64
|
+
any: AnyProps;
|
|
54
65
|
api: ApiProps;
|
|
55
66
|
array: ArrayProps;
|
|
56
67
|
binary: BinaryProps;
|
|
68
|
+
blacklist: BlacklistProps;
|
|
57
69
|
body: BodyProps;
|
|
58
70
|
boolean: BooleanProps;
|
|
59
71
|
cms: CmsProps;
|
|
@@ -61,11 +73,10 @@ declare global {
|
|
|
61
73
|
context: ContextProps;
|
|
62
74
|
cookie: CookieProps;
|
|
63
75
|
date: DateProps;
|
|
64
|
-
dev: DevProps;
|
|
65
76
|
dts: DtsProps;
|
|
66
77
|
endpoint: EndpointProps;
|
|
78
|
+
env: EnvProps;
|
|
67
79
|
error: ErrorProps;
|
|
68
|
-
fallback: FallbackProps;
|
|
69
80
|
field: FieldProps;
|
|
70
81
|
file: FileProps;
|
|
71
82
|
header: HeaderProps;
|
|
@@ -76,21 +87,23 @@ declare global {
|
|
|
76
87
|
number: NumberProps;
|
|
77
88
|
object: ObjectProps;
|
|
78
89
|
param: ParamProps;
|
|
79
|
-
|
|
90
|
+
preset: PresetProps;
|
|
91
|
+
protection: ProtectionProps;
|
|
80
92
|
proxy: ProxyProps;
|
|
81
93
|
redirect: RedirectProps;
|
|
82
|
-
request: RequestProps;
|
|
83
94
|
response: ResponseProps;
|
|
95
|
+
return: ReturnProps;
|
|
96
|
+
server: ServerProps;
|
|
84
97
|
slot: SlotProps;
|
|
85
98
|
slots: SlotsProps;
|
|
86
|
-
server: ServerProps;
|
|
87
|
-
swagger: SwaggerProps;
|
|
88
99
|
string: StringProps;
|
|
89
100
|
success: SuccessProps;
|
|
101
|
+
swagger: SwaggerProps;
|
|
90
102
|
tag: TagProps;
|
|
91
103
|
tuple: TupleProps;
|
|
92
104
|
uuid: UuidProps;
|
|
93
105
|
variable: VariableProps;
|
|
106
|
+
whitelist: WhitelistProps;
|
|
94
107
|
}
|
|
95
108
|
}
|
|
96
109
|
}
|
package/handler/handler.es6.js
CHANGED
|
@@ -2,20 +2,21 @@ import { createHandler } from 'innet';
|
|
|
2
2
|
import { context, slot, slots, jsxPlugins, jsxComponent } from '@innet/jsx';
|
|
3
3
|
import { arraySync, async, promise, array as array$1, nullish, object as object$1, fn } from '@innet/utils';
|
|
4
4
|
import '../plugins/index.es6.js';
|
|
5
|
+
import { any } from '../plugins/schema/any/any.es6.js';
|
|
5
6
|
import { api } from '../plugins/main/api/api.es6.js';
|
|
6
7
|
import { array } from '../plugins/schema/array/array.es6.js';
|
|
7
8
|
import { binary } from '../plugins/schema/binary/binary.es6.js';
|
|
9
|
+
import { blacklist } from '../plugins/utils/blacklist/blacklist.es6.js';
|
|
8
10
|
import { body } from '../plugins/main/body/body.es6.js';
|
|
9
11
|
import { boolean } from '../plugins/schema/boolean/boolean.es6.js';
|
|
10
12
|
import { cms } from '../plugins/request/cms/cms.es6.js';
|
|
11
13
|
import { contact } from '../plugins/main/contact/contact.es6.js';
|
|
12
14
|
import { cookie } from '../plugins/request/cookie/cookie.es6.js';
|
|
13
15
|
import { date } from '../plugins/schema/date/date.es6.js';
|
|
14
|
-
import { dev } from '../plugins/utils/dev/dev.es6.js';
|
|
15
16
|
import { dts } from '../plugins/utils/dts/dts.es6.js';
|
|
16
17
|
import { endpoint } from '../plugins/main/endpoint/endpoint.es6.js';
|
|
18
|
+
import { env } from '../plugins/utils/env/env.es6.js';
|
|
17
19
|
import { error } from '../plugins/request/error/error.es6.js';
|
|
18
|
-
import { fallback } from '../plugins/main/fallback/fallback.es6.js';
|
|
19
20
|
import { field } from '../plugins/schema/field/field.es6.js';
|
|
20
21
|
import { file } from '../plugins/request/file/file.es6.js';
|
|
21
22
|
import { header } from '../plugins/request/header/header.es6.js';
|
|
@@ -26,28 +27,32 @@ import { nullPlugin } from '../plugins/schema/null/null.es6.js';
|
|
|
26
27
|
import { number } from '../plugins/schema/number/number.es6.js';
|
|
27
28
|
import { object } from '../plugins/schema/object/object.es6.js';
|
|
28
29
|
import { param } from '../plugins/main/param/param.es6.js';
|
|
29
|
-
import {
|
|
30
|
+
import { preset } from '../plugins/main/preset/preset.es6.js';
|
|
31
|
+
import { protection } from '../plugins/utils/protection/protection.es6.js';
|
|
30
32
|
import { proxy } from '../plugins/request/proxy/proxy.es6.js';
|
|
31
33
|
import { redirect } from '../plugins/request/redirect/redirect.es6.js';
|
|
32
|
-
import { request } from '../plugins/main/request/request.es6.js';
|
|
33
34
|
import { response } from '../plugins/main/response/response.es6.js';
|
|
35
|
+
import { returnPlugin } from '../plugins/main/return/return.es6.js';
|
|
34
36
|
import { server } from '../plugins/main/server/server.es6.js';
|
|
35
|
-
import { swagger } from '../plugins/utils/swagger/swagger.es6.js';
|
|
36
37
|
import { string } from '../plugins/schema/string/string.es6.js';
|
|
37
38
|
import { success } from '../plugins/request/success/success.es6.js';
|
|
39
|
+
import { swagger } from '../plugins/utils/swagger/swagger.es6.js';
|
|
38
40
|
import { tag } from '../plugins/main/tag/tag.es6.js';
|
|
39
41
|
import { tuple } from '../plugins/schema/tuple/tuple.es6.js';
|
|
40
42
|
import { uuid } from '../plugins/schema/uuid/uuid.es6.js';
|
|
41
43
|
import { variable } from '../plugins/main/variable/variable.es6.js';
|
|
44
|
+
import { whitelist } from '../plugins/utils/whitelist/whitelist.es6.js';
|
|
42
45
|
import { serverFn } from '../plugins/handler/serverFn/serverFn.es6.js';
|
|
43
46
|
|
|
44
47
|
const arrayPlugins = [
|
|
45
48
|
arraySync,
|
|
46
49
|
];
|
|
47
50
|
const JSXPlugins = {
|
|
51
|
+
any,
|
|
48
52
|
api,
|
|
49
53
|
array,
|
|
50
54
|
binary,
|
|
55
|
+
blacklist,
|
|
51
56
|
body,
|
|
52
57
|
boolean,
|
|
53
58
|
cms,
|
|
@@ -55,11 +60,10 @@ const JSXPlugins = {
|
|
|
55
60
|
context,
|
|
56
61
|
cookie,
|
|
57
62
|
date,
|
|
58
|
-
dev,
|
|
59
63
|
dts,
|
|
60
64
|
endpoint,
|
|
65
|
+
env,
|
|
61
66
|
error,
|
|
62
|
-
fallback,
|
|
63
67
|
field,
|
|
64
68
|
file,
|
|
65
69
|
header,
|
|
@@ -70,21 +74,23 @@ const JSXPlugins = {
|
|
|
70
74
|
number,
|
|
71
75
|
object,
|
|
72
76
|
param,
|
|
73
|
-
|
|
77
|
+
preset,
|
|
78
|
+
protection,
|
|
74
79
|
proxy,
|
|
75
80
|
redirect,
|
|
76
|
-
request,
|
|
77
81
|
response,
|
|
82
|
+
return: returnPlugin,
|
|
83
|
+
server,
|
|
78
84
|
slot,
|
|
79
85
|
slots,
|
|
80
|
-
server,
|
|
81
|
-
swagger,
|
|
82
86
|
string,
|
|
83
87
|
success,
|
|
88
|
+
swagger,
|
|
84
89
|
tag,
|
|
85
90
|
tuple,
|
|
86
91
|
uuid,
|
|
87
92
|
variable,
|
|
93
|
+
whitelist,
|
|
88
94
|
};
|
|
89
95
|
const fnPlugins = [
|
|
90
96
|
serverFn,
|
package/handler/handler.js
CHANGED
|
@@ -6,20 +6,21 @@ var innet = require('innet');
|
|
|
6
6
|
var jsx = require('@innet/jsx');
|
|
7
7
|
var utils = require('@innet/utils');
|
|
8
8
|
require('../plugins/index.js');
|
|
9
|
+
var any = require('../plugins/schema/any/any.js');
|
|
9
10
|
var api = require('../plugins/main/api/api.js');
|
|
10
11
|
var array = require('../plugins/schema/array/array.js');
|
|
11
12
|
var binary = require('../plugins/schema/binary/binary.js');
|
|
13
|
+
var blacklist = require('../plugins/utils/blacklist/blacklist.js');
|
|
12
14
|
var body = require('../plugins/main/body/body.js');
|
|
13
15
|
var boolean = require('../plugins/schema/boolean/boolean.js');
|
|
14
16
|
var cms = require('../plugins/request/cms/cms.js');
|
|
15
17
|
var contact = require('../plugins/main/contact/contact.js');
|
|
16
18
|
var cookie = require('../plugins/request/cookie/cookie.js');
|
|
17
19
|
var date = require('../plugins/schema/date/date.js');
|
|
18
|
-
var dev = require('../plugins/utils/dev/dev.js');
|
|
19
20
|
var dts = require('../plugins/utils/dts/dts.js');
|
|
20
21
|
var endpoint = require('../plugins/main/endpoint/endpoint.js');
|
|
22
|
+
var env = require('../plugins/utils/env/env.js');
|
|
21
23
|
var error = require('../plugins/request/error/error.js');
|
|
22
|
-
var fallback = require('../plugins/main/fallback/fallback.js');
|
|
23
24
|
var field = require('../plugins/schema/field/field.js');
|
|
24
25
|
var file = require('../plugins/request/file/file.js');
|
|
25
26
|
var header = require('../plugins/request/header/header.js');
|
|
@@ -30,28 +31,32 @@ var _null = require('../plugins/schema/null/null.js');
|
|
|
30
31
|
var number = require('../plugins/schema/number/number.js');
|
|
31
32
|
var object = require('../plugins/schema/object/object.js');
|
|
32
33
|
var param = require('../plugins/main/param/param.js');
|
|
33
|
-
var
|
|
34
|
+
var preset = require('../plugins/main/preset/preset.js');
|
|
35
|
+
var protection = require('../plugins/utils/protection/protection.js');
|
|
34
36
|
var proxy = require('../plugins/request/proxy/proxy.js');
|
|
35
37
|
var redirect = require('../plugins/request/redirect/redirect.js');
|
|
36
|
-
var request = require('../plugins/main/request/request.js');
|
|
37
38
|
var response = require('../plugins/main/response/response.js');
|
|
39
|
+
var _return = require('../plugins/main/return/return.js');
|
|
38
40
|
var server = require('../plugins/main/server/server.js');
|
|
39
|
-
var swagger = require('../plugins/utils/swagger/swagger.js');
|
|
40
41
|
var string = require('../plugins/schema/string/string.js');
|
|
41
42
|
var success = require('../plugins/request/success/success.js');
|
|
43
|
+
var swagger = require('../plugins/utils/swagger/swagger.js');
|
|
42
44
|
var tag = require('../plugins/main/tag/tag.js');
|
|
43
45
|
var tuple = require('../plugins/schema/tuple/tuple.js');
|
|
44
46
|
var uuid = require('../plugins/schema/uuid/uuid.js');
|
|
45
47
|
var variable = require('../plugins/main/variable/variable.js');
|
|
48
|
+
var whitelist = require('../plugins/utils/whitelist/whitelist.js');
|
|
46
49
|
var serverFn = require('../plugins/handler/serverFn/serverFn.js');
|
|
47
50
|
|
|
48
51
|
const arrayPlugins = [
|
|
49
52
|
utils.arraySync,
|
|
50
53
|
];
|
|
51
54
|
const JSXPlugins = {
|
|
55
|
+
any: any.any,
|
|
52
56
|
api: api.api,
|
|
53
57
|
array: array.array,
|
|
54
58
|
binary: binary.binary,
|
|
59
|
+
blacklist: blacklist.blacklist,
|
|
55
60
|
body: body.body,
|
|
56
61
|
boolean: boolean.boolean,
|
|
57
62
|
cms: cms.cms,
|
|
@@ -59,11 +64,10 @@ const JSXPlugins = {
|
|
|
59
64
|
context: jsx.context,
|
|
60
65
|
cookie: cookie.cookie,
|
|
61
66
|
date: date.date,
|
|
62
|
-
dev: dev.dev,
|
|
63
67
|
dts: dts.dts,
|
|
64
68
|
endpoint: endpoint.endpoint,
|
|
69
|
+
env: env.env,
|
|
65
70
|
error: error.error,
|
|
66
|
-
fallback: fallback.fallback,
|
|
67
71
|
field: field.field,
|
|
68
72
|
file: file.file,
|
|
69
73
|
header: header.header,
|
|
@@ -74,21 +78,23 @@ const JSXPlugins = {
|
|
|
74
78
|
number: number.number,
|
|
75
79
|
object: object.object,
|
|
76
80
|
param: param.param,
|
|
77
|
-
|
|
81
|
+
preset: preset.preset,
|
|
82
|
+
protection: protection.protection,
|
|
78
83
|
proxy: proxy.proxy,
|
|
79
84
|
redirect: redirect.redirect,
|
|
80
|
-
request: request.request,
|
|
81
85
|
response: response.response,
|
|
86
|
+
return: _return.returnPlugin,
|
|
87
|
+
server: server.server,
|
|
82
88
|
slot: jsx.slot,
|
|
83
89
|
slots: jsx.slots,
|
|
84
|
-
server: server.server,
|
|
85
|
-
swagger: swagger.swagger,
|
|
86
90
|
string: string.string,
|
|
87
91
|
success: success.success,
|
|
92
|
+
swagger: swagger.swagger,
|
|
88
93
|
tag: tag.tag,
|
|
89
94
|
tuple: tuple.tuple,
|
|
90
95
|
uuid: uuid.uuid,
|
|
91
96
|
variable: variable.variable,
|
|
97
|
+
whitelist: whitelist.whitelist,
|
|
92
98
|
};
|
|
93
99
|
const fnPlugins = [
|
|
94
100
|
serverFn.serverFn,
|
package/hooks/index.d.ts
CHANGED
|
@@ -23,5 +23,10 @@ export * from './useRule';
|
|
|
23
23
|
export * from './useObjectRule';
|
|
24
24
|
export * from './useBodyFile';
|
|
25
25
|
export * from './usePath';
|
|
26
|
-
export * from './
|
|
26
|
+
export * from './useServerPlugin';
|
|
27
27
|
export * from './useClientIp';
|
|
28
|
+
export * from './useServerPlugins';
|
|
29
|
+
export * from './useObjectSchemaContext';
|
|
30
|
+
export * from './useServerPort';
|
|
31
|
+
export * from './useIsServerHttps';
|
|
32
|
+
export * from './useRequestHandler';
|
package/hooks/index.es6.js
CHANGED
|
@@ -23,5 +23,10 @@ import './useRule/index.es6.js';
|
|
|
23
23
|
import './useObjectRule/index.es6.js';
|
|
24
24
|
import './useBodyFile/index.es6.js';
|
|
25
25
|
import './usePath/index.es6.js';
|
|
26
|
-
import './
|
|
26
|
+
import './useServerPlugin/index.es6.js';
|
|
27
27
|
import './useClientIp/index.es6.js';
|
|
28
|
+
import './useServerPlugins/index.es6.js';
|
|
29
|
+
import './useObjectSchemaContext/index.es6.js';
|
|
30
|
+
import './useServerPort/index.es6.js';
|
|
31
|
+
import './useIsServerHttps/index.es6.js';
|
|
32
|
+
import './useRequestHandler/index.es6.js';
|
package/hooks/index.js
CHANGED
|
@@ -25,6 +25,11 @@ require('./useRule/index.js');
|
|
|
25
25
|
require('./useObjectRule/index.js');
|
|
26
26
|
require('./useBodyFile/index.js');
|
|
27
27
|
require('./usePath/index.js');
|
|
28
|
-
require('./
|
|
28
|
+
require('./useServerPlugin/index.js');
|
|
29
29
|
require('./useClientIp/index.js');
|
|
30
|
+
require('./useServerPlugins/index.js');
|
|
31
|
+
require('./useObjectSchemaContext/index.js');
|
|
32
|
+
require('./useServerPort/index.js');
|
|
33
|
+
require('./useIsServerHttps/index.js');
|
|
34
|
+
require('./useRequestHandler/index.js');
|
|
30
35
|
|
|
@@ -6,7 +6,7 @@ const actionContext = new Context();
|
|
|
6
6
|
function useAction() {
|
|
7
7
|
const action = useContext(actionContext);
|
|
8
8
|
if (!action) {
|
|
9
|
-
useThrow('<{type}> MUST be in <request> or <fallback>');
|
|
9
|
+
useThrow('<{type}> MUST be in <request>, <preset> or <fallback>');
|
|
10
10
|
}
|
|
11
11
|
return action;
|
|
12
12
|
}
|
|
@@ -10,7 +10,7 @@ const actionContext = new jsx.Context();
|
|
|
10
10
|
function useAction() {
|
|
11
11
|
const action = jsx.useContext(actionContext);
|
|
12
12
|
if (!action) {
|
|
13
|
-
useThrow.useThrow('<{type}> MUST be in <request> or <fallback>');
|
|
13
|
+
useThrow.useThrow('<{type}> MUST be in <request>, <preset> or <fallback>');
|
|
14
14
|
}
|
|
15
15
|
return action;
|
|
16
16
|
}
|
package/hooks/useApi/useApi.d.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { Context } from '@innet/jsx';
|
|
2
|
-
import { type Document, type Endpoints
|
|
2
|
+
import { type Document, type Endpoints } from '../../types';
|
|
3
3
|
import { type Rule } from '../../utils';
|
|
4
4
|
export interface ApiContext {
|
|
5
5
|
docs: Document;
|
|
6
6
|
endpoints: Endpoints;
|
|
7
7
|
prefix: string;
|
|
8
|
-
requestPlugins: Set<RequestPlugin>;
|
|
9
|
-
fallback?: Fallback;
|
|
10
8
|
refRules: Record<string, Rule>;
|
|
11
9
|
}
|
|
12
10
|
export declare const apiContext: Context<ApiContext, ApiContext | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function useClientIp():
|
|
1
|
+
export declare function useClientIp(): null | string;
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import '../
|
|
3
|
-
import '../useThrow/index.es6.js';
|
|
4
|
-
import { useRequest } from '../useRequest/useRequest.es6.js';
|
|
5
|
-
import { useThrow } from '../useThrow/useThrow.es6.js';
|
|
1
|
+
import '../useAction/index.es6.js';
|
|
2
|
+
import { useAction } from '../useAction/useAction.es6.js';
|
|
6
3
|
|
|
7
4
|
function useClientIp() {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
useThrow('<{type}> MUST be in <request> or <fallback>');
|
|
11
|
-
}
|
|
12
|
-
return getClientIp(req);
|
|
5
|
+
const action = useAction();
|
|
6
|
+
return action.clientIp;
|
|
13
7
|
}
|
|
14
8
|
|
|
15
9
|
export { useClientIp };
|
|
@@ -2,18 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
require('../
|
|
7
|
-
require('../useThrow/index.js');
|
|
8
|
-
var useRequest = require('../useRequest/useRequest.js');
|
|
9
|
-
var useThrow = require('../useThrow/useThrow.js');
|
|
5
|
+
require('../useAction/index.js');
|
|
6
|
+
var useAction = require('../useAction/useAction.js');
|
|
10
7
|
|
|
11
8
|
function useClientIp() {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
useThrow.useThrow('<{type}> MUST be in <request> or <fallback>');
|
|
15
|
-
}
|
|
16
|
-
return requestIp.getClientIp(req);
|
|
9
|
+
const action = useAction.useAction();
|
|
10
|
+
return action.clientIp;
|
|
17
11
|
}
|
|
18
12
|
|
|
19
13
|
exports.useClientIp = useClientIp;
|
|
@@ -2,9 +2,9 @@ import { Context } from '@innet/jsx';
|
|
|
2
2
|
import { type EndpointProps } from '../../plugins';
|
|
3
3
|
import type { Endpoint, OperationObject } from '../../types';
|
|
4
4
|
export interface EndpointContext {
|
|
5
|
+
endpoint: Endpoint;
|
|
5
6
|
operation: OperationObject;
|
|
6
7
|
props: EndpointProps;
|
|
7
|
-
endpoint: Endpoint;
|
|
8
8
|
}
|
|
9
9
|
export declare const endpointContext: Context<EndpointContext, EndpointContext | undefined>;
|
|
10
10
|
export declare function useEndpoint(): EndpointContext;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Context, useContext } from '@innet/jsx';
|
|
2
|
+
import '../useThrow/index.es6.js';
|
|
3
|
+
import { useThrow } from '../useThrow/useThrow.es6.js';
|
|
2
4
|
|
|
3
5
|
const endpointContext = new Context();
|
|
4
6
|
function useEndpoint() {
|
|
5
7
|
const endpoint = useContext(endpointContext);
|
|
6
8
|
if (!endpoint) {
|
|
7
|
-
|
|
9
|
+
useThrow('Use <{type}> in <endpoint>');
|
|
8
10
|
}
|
|
9
11
|
return endpoint;
|
|
10
12
|
}
|
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var jsx = require('@innet/jsx');
|
|
6
|
+
require('../useThrow/index.js');
|
|
7
|
+
var useThrow = require('../useThrow/useThrow.js');
|
|
6
8
|
|
|
7
9
|
const endpointContext = new jsx.Context();
|
|
8
10
|
function useEndpoint() {
|
|
9
11
|
const endpoint = jsx.useContext(endpointContext);
|
|
10
12
|
if (!endpoint) {
|
|
11
|
-
|
|
13
|
+
useThrow.useThrow('Use <{type}> in <endpoint>');
|
|
12
14
|
}
|
|
13
15
|
return endpoint;
|
|
14
16
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useIsServerHttps';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { serverHttpsContext, useIsServerHttps } from './useIsServerHttps.es6.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var useIsServerHttps = require('./useIsServerHttps.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
exports.serverHttpsContext = useIsServerHttps.serverHttpsContext;
|
|
10
|
+
exports.useIsServerHttps = useIsServerHttps.useIsServerHttps;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Context, useContext } from '@innet/jsx';
|
|
2
|
+
import '../useThrow/index.es6.js';
|
|
3
|
+
import { useThrow } from '../useThrow/useThrow.es6.js';
|
|
4
|
+
|
|
5
|
+
const serverHttpsContext = new Context();
|
|
6
|
+
function useIsServerHttps() {
|
|
7
|
+
const https = useContext(serverHttpsContext);
|
|
8
|
+
if (https === undefined) {
|
|
9
|
+
useThrow('{type} MUST BE in <server>');
|
|
10
|
+
}
|
|
11
|
+
return https;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { serverHttpsContext, useIsServerHttps };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsx = require('@innet/jsx');
|
|
6
|
+
require('../useThrow/index.js');
|
|
7
|
+
var useThrow = require('../useThrow/useThrow.js');
|
|
8
|
+
|
|
9
|
+
const serverHttpsContext = new jsx.Context();
|
|
10
|
+
function useIsServerHttps() {
|
|
11
|
+
const https = jsx.useContext(serverHttpsContext);
|
|
12
|
+
if (https === undefined) {
|
|
13
|
+
useThrow.useThrow('{type} MUST BE in <server>');
|
|
14
|
+
}
|
|
15
|
+
return https;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
exports.serverHttpsContext = serverHttpsContext;
|
|
19
|
+
exports.useIsServerHttps = useIsServerHttps;
|
|
@@ -14,7 +14,7 @@ function useNewSchema(schema = Object.create(null)) {
|
|
|
14
14
|
else if (parentSchema.oneOf) {
|
|
15
15
|
parentSchema.oneOf.push(schema);
|
|
16
16
|
}
|
|
17
|
-
else if (parentSchema.type) {
|
|
17
|
+
else if (parentSchema.type || '$ref' in parentSchema) {
|
|
18
18
|
const oldSchema = Object.assign({}, parentSchema);
|
|
19
19
|
for (const key in parentSchema) {
|
|
20
20
|
// @ts-expect-error: FIXME
|
|
@@ -18,7 +18,7 @@ function useNewSchema(schema = Object.create(null)) {
|
|
|
18
18
|
else if (parentSchema.oneOf) {
|
|
19
19
|
parentSchema.oneOf.push(schema);
|
|
20
20
|
}
|
|
21
|
-
else if (parentSchema.type) {
|
|
21
|
+
else if (parentSchema.type || '$ref' in parentSchema) {
|
|
22
22
|
const oldSchema = Object.assign({}, parentSchema);
|
|
23
23
|
for (const key in parentSchema) {
|
|
24
24
|
// @ts-expect-error: FIXME
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useObjectSchemaContext';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { objectSchemaContext, useObjectSchemaContext } from './useObjectSchemaContext.es6.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var useObjectSchemaContext = require('./useObjectSchemaContext.js');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
exports.objectSchemaContext = useObjectSchemaContext.objectSchemaContext;
|
|
10
|
+
exports.useObjectSchemaContext = useObjectSchemaContext.useObjectSchemaContext;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Context } from '@innet/jsx';
|
|
2
|
+
export declare const objectSchemaContext: Context<import("openapi-types").OpenAPIV3_1.SchemaObject, import("openapi-types").OpenAPIV3_1.SchemaObject | undefined>;
|
|
3
|
+
export declare function useObjectSchemaContext(): import("openapi-types").OpenAPIV3_1.SchemaObject;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Context, useContext } from '@innet/jsx';
|
|
2
|
+
import '../useThrow/index.es6.js';
|
|
3
|
+
import { useThrow } from '../useThrow/useThrow.es6.js';
|
|
4
|
+
|
|
5
|
+
const objectSchemaContext = new Context();
|
|
6
|
+
function useObjectSchemaContext() {
|
|
7
|
+
const schema = useContext(objectSchemaContext);
|
|
8
|
+
if (!schema) {
|
|
9
|
+
useThrow('Use <{type}> in <object>');
|
|
10
|
+
}
|
|
11
|
+
return schema;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { objectSchemaContext, useObjectSchemaContext };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsx = require('@innet/jsx');
|
|
6
|
+
require('../useThrow/index.js');
|
|
7
|
+
var useThrow = require('../useThrow/useThrow.js');
|
|
8
|
+
|
|
9
|
+
const objectSchemaContext = new jsx.Context();
|
|
10
|
+
function useObjectSchemaContext() {
|
|
11
|
+
const schema = jsx.useContext(objectSchemaContext);
|
|
12
|
+
if (!schema) {
|
|
13
|
+
useThrow.useThrow('Use <{type}> in <object>');
|
|
14
|
+
}
|
|
15
|
+
return schema;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
exports.objectSchemaContext = objectSchemaContext;
|
|
19
|
+
exports.useObjectSchemaContext = useObjectSchemaContext;
|