@innet/server 2.0.0-beta.8 → 2.0.0-beta.9
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/constants.d.ts +4 -0
- package/handler/handler.d.ts +106 -0
- package/handler/index.d.ts +1 -0
- package/hooks/index.d.ts +33 -0
- package/hooks/useAction/index.d.ts +1 -0
- package/hooks/useAction/useAction.d.ts +4 -0
- package/hooks/useApi/index.d.ts +1 -0
- package/hooks/useApi/useApi.d.ts +11 -0
- package/hooks/useBlock/index.d.ts +1 -0
- package/hooks/useBlock/useBlock.d.ts +2 -0
- package/hooks/useBody/index.d.ts +1 -0
- package/hooks/useBody/useBody.d.ts +1 -0
- package/hooks/useBodyFile/index.d.ts +1 -0
- package/hooks/useBodyFile/useBodyFile.d.ts +3 -0
- package/hooks/useClientIp/index.d.ts +1 -0
- package/hooks/useClientIp/useClientIp.d.ts +1 -0
- package/hooks/useComponentName/index.d.ts +1 -0
- package/hooks/useComponentName/useComponentName.d.ts +1 -0
- package/hooks/useCookies/index.d.ts +1 -0
- package/hooks/useCookies/useCookies.d.ts +1 -0
- package/hooks/useEffect/index.d.ts +1 -0
- package/hooks/useEffect/useEffect.d.ts +2 -0
- package/hooks/useEndpoint/index.d.ts +1 -0
- package/hooks/useEndpoint/useEndpoint.d.ts +10 -0
- package/hooks/useHeaders/index.d.ts +1 -0
- package/hooks/useHeaders/useHeaders.d.ts +2 -0
- package/hooks/useHost/index.d.ts +1 -0
- package/hooks/useHost/useHost.d.ts +7 -0
- package/hooks/useIsServerHttps/index.d.ts +1 -0
- package/hooks/useIsServerHttps/useIsServerHttps.d.ts +3 -0
- package/hooks/useNewSchema/index.d.ts +1 -0
- package/hooks/useNewSchema/useNewSchema.d.ts +2 -0
- package/hooks/useNewSchema/useNewSchema.es6.js +1 -0
- package/hooks/useNewSchema/useNewSchema.js +1 -0
- package/hooks/useObjectRule/index.d.ts +1 -0
- package/hooks/useObjectRule/useObjectRule.d.ts +4 -0
- package/hooks/useObjectSchemaContext/index.d.ts +1 -0
- package/hooks/useObjectSchemaContext/useObjectSchemaContext.d.ts +3 -0
- package/hooks/useOneElementError/index.d.ts +1 -0
- package/hooks/useOneElementError/useOneElementError.d.ts +1 -0
- package/hooks/useParam/index.d.ts +1 -0
- package/hooks/useParam/useParam.d.ts +7 -0
- package/hooks/useParams/index.d.ts +1 -0
- package/hooks/useParams/useParams.d.ts +3 -0
- package/hooks/useParentRule/index.d.ts +1 -0
- package/hooks/useParentRule/useParentRule.d.ts +4 -0
- package/hooks/usePath/index.d.ts +1 -0
- package/hooks/usePath/usePath.d.ts +1 -0
- package/hooks/useRequest/index.d.ts +1 -0
- package/hooks/useRequest/useRequest.d.ts +1 -0
- package/hooks/useRequestHandler/index.d.ts +1 -0
- package/hooks/useRequestHandler/useRequestHandler.d.ts +4 -0
- package/hooks/useResponse/index.d.ts +1 -0
- package/hooks/useResponse/useResponse.d.ts +1 -0
- package/hooks/useRule/index.d.ts +1 -0
- package/hooks/useRule/useRule.d.ts +6 -0
- package/hooks/useSchemaContext/index.d.ts +1 -0
- package/hooks/useSchemaContext/useSchemaContext.d.ts +5 -0
- package/hooks/useSchemaType/index.d.ts +1 -0
- package/hooks/useSchemaType/useSchemaType.d.ts +5 -0
- package/hooks/useSearch/index.d.ts +1 -0
- package/hooks/useSearch/useSearch.d.ts +1 -0
- package/hooks/useServer/index.d.ts +1 -0
- package/hooks/useServer/useServer.d.ts +10 -0
- package/hooks/useServerPlugin/index.d.ts +1 -0
- package/hooks/useServerPlugin/useServerPlugin.d.ts +2 -0
- package/hooks/useServerPlugins/index.d.ts +1 -0
- package/hooks/useServerPlugins/useServerPlugins.d.ts +4 -0
- package/hooks/useServerPort/index.d.ts +1 -0
- package/hooks/useServerPort/useServerPort.d.ts +3 -0
- package/hooks/useTag/index.d.ts +1 -0
- package/hooks/useTag/useTag.d.ts +3 -0
- package/hooks/useThrow/index.d.ts +1 -0
- package/hooks/useThrow/useThrow.d.ts +1 -0
- package/index.d.ts +6 -0
- package/package.json +1 -1
- package/plugins/handler/index.d.ts +1 -0
- package/plugins/handler/serverFn/index.d.ts +1 -0
- package/plugins/handler/serverFn/serverFn.d.ts +2 -0
- package/plugins/index.d.ts +5 -0
- package/plugins/main/api/api.d.ts +25 -0
- package/plugins/main/api/index.d.ts +1 -0
- package/plugins/main/body/body.d.ts +5 -0
- package/plugins/main/body/index.d.ts +1 -0
- package/plugins/main/contact/contact.d.ts +10 -0
- package/plugins/main/contact/index.d.ts +1 -0
- package/plugins/main/endpoint/endpoint.d.ts +43 -0
- package/plugins/main/endpoint/endpoint.es6.js +2 -0
- package/plugins/main/endpoint/endpoint.js +2 -0
- package/plugins/main/endpoint/index.d.ts +1 -0
- package/plugins/main/host/host.d.ts +16 -0
- package/plugins/main/host/host.es6.js +1 -0
- package/plugins/main/host/host.js +1 -0
- package/plugins/main/host/index.d.ts +1 -0
- package/plugins/main/index.d.ts +13 -0
- package/plugins/main/license/index.d.ts +1 -0
- package/plugins/main/license/license.d.ts +21 -0
- package/plugins/main/param/index.d.ts +1 -0
- package/plugins/main/param/param.d.ts +36 -0
- package/plugins/main/preset/index.d.ts +1 -0
- package/plugins/main/preset/preset.d.ts +3 -0
- package/plugins/main/response/index.d.ts +1 -0
- package/plugins/main/response/response.d.ts +21 -0
- package/plugins/main/return/index.d.ts +1 -0
- package/plugins/main/return/return.d.ts +4 -0
- package/plugins/main/server/index.d.ts +1 -0
- package/plugins/main/server/server.d.ts +13 -0
- package/plugins/main/tag/index.d.ts +1 -0
- package/plugins/main/tag/tag.d.ts +19 -0
- package/plugins/main/tag/tag.es6.js +1 -0
- package/plugins/main/tag/tag.js +1 -0
- package/plugins/main/variable/index.d.ts +1 -0
- package/plugins/main/variable/variable.d.ts +24 -0
- package/plugins/main/variable/variable.es6.js +4 -1
- package/plugins/main/variable/variable.js +4 -1
- package/plugins/request/cms/cms.d.ts +6 -0
- package/plugins/request/cms/index.d.ts +1 -0
- package/plugins/request/cookie/cookie.d.ts +7 -0
- package/plugins/request/cookie/index.d.ts +1 -0
- package/plugins/request/error/error.d.ts +61 -0
- package/plugins/request/error/index.d.ts +1 -0
- package/plugins/request/file/file.d.ts +5 -0
- package/plugins/request/file/index.d.ts +1 -0
- package/plugins/request/header/header.d.ts +6 -0
- package/plugins/request/header/index.d.ts +1 -0
- package/plugins/request/index.d.ts +8 -0
- package/plugins/request/proxy/index.d.ts +1 -0
- package/plugins/request/proxy/proxy.d.ts +8 -0
- package/plugins/request/redirect/index.d.ts +1 -0
- package/plugins/request/redirect/redirect.d.ts +18 -0
- package/plugins/request/redirect/redirect.es6.js +1 -0
- package/plugins/request/redirect/redirect.js +1 -0
- package/plugins/request/success/index.d.ts +1 -0
- package/plugins/request/success/success.d.ts +19 -0
- package/plugins/schema/any/any.d.ts +5 -0
- package/plugins/schema/any/index.d.ts +1 -0
- package/plugins/schema/array/array.d.ts +9 -0
- package/plugins/schema/array/index.d.ts +1 -0
- package/plugins/schema/binary/binary.d.ts +9 -0
- package/plugins/schema/binary/index.d.ts +1 -0
- package/plugins/schema/boolean/boolean.d.ts +5 -0
- package/plugins/schema/boolean/index.d.ts +1 -0
- package/plugins/schema/date/date.d.ts +8 -0
- package/plugins/schema/date/date.es6.js +6 -0
- package/plugins/schema/date/date.js +6 -0
- package/plugins/schema/date/index.d.ts +1 -0
- package/plugins/schema/field/field.d.ts +10 -0
- package/plugins/schema/field/index.d.ts +1 -0
- package/plugins/schema/index.d.ts +13 -0
- package/plugins/schema/integer/index.d.ts +1 -0
- package/plugins/schema/integer/integer.d.ts +45 -0
- package/plugins/schema/null/index.d.ts +1 -0
- package/plugins/schema/null/null.d.ts +5 -0
- package/plugins/schema/number/index.d.ts +1 -0
- package/plugins/schema/number/number.d.ts +41 -0
- package/plugins/schema/object/index.d.ts +1 -0
- package/plugins/schema/object/object.d.ts +6 -0
- package/plugins/schema/string/index.d.ts +1 -0
- package/plugins/schema/string/string.d.ts +36 -0
- package/plugins/schema/tuple/index.d.ts +1 -0
- package/plugins/schema/tuple/tuple.d.ts +6 -0
- package/plugins/schema/tuple/tuple.es6.js +1 -0
- package/plugins/schema/tuple/tuple.js +1 -0
- package/plugins/schema/uuid/index.d.ts +1 -0
- package/plugins/schema/uuid/uuid.d.ts +6 -0
- package/plugins/schema/uuid/uuid.es6.js +2 -0
- package/plugins/schema/uuid/uuid.js +2 -0
- package/plugins/utils/blacklist/blacklist.d.ts +5 -0
- package/plugins/utils/blacklist/index.d.ts +1 -0
- package/plugins/utils/dts/dts.d.ts +6 -0
- package/plugins/utils/dts/index.d.ts +1 -0
- package/plugins/utils/env/env.d.ts +7 -0
- package/plugins/utils/env/index.d.ts +1 -0
- package/plugins/utils/index.d.ts +7 -0
- package/plugins/utils/protection/index.d.ts +1 -0
- package/plugins/utils/protection/protection.d.ts +9 -0
- package/plugins/utils/swagger/index.d.ts +1 -0
- package/plugins/utils/swagger/swagger.d.ts +6 -0
- package/plugins/utils/swagger/swagger.es6.js +1 -0
- package/plugins/utils/swagger/swagger.js +1 -0
- package/plugins/utils/ui/index.d.ts +1 -0
- package/plugins/utils/ui/ui.d.ts +13 -0
- package/plugins/utils/whitelist/index.d.ts +1 -0
- package/plugins/utils/whitelist/whitelist.d.ts +5 -0
- package/types.d.ts +69 -0
- package/utils/FileData/Bin.d.ts +47 -0
- package/utils/FileData/index.d.ts +1 -0
- package/utils/JSONString/JSONString.d.ts +1 -0
- package/utils/JSONString/index.d.ts +1 -0
- package/utils/action/Action.d.ts +31 -0
- package/utils/action/index.d.ts +1 -0
- package/utils/dateFormat/dateFormat.d.ts +2 -0
- package/utils/dateFormat/index.d.ts +1 -0
- package/utils/decorators/index.d.ts +1 -0
- package/utils/decorators/once/index.d.ts +1 -0
- package/utils/decorators/once/once.d.ts +4 -0
- package/utils/decorators/once/once.es6.js +4 -0
- package/utils/decorators/once/once.js +4 -0
- package/utils/generateTypes/generateTypes.d.ts +3 -0
- package/utils/generateTypes/generateTypes.es6.js +1 -0
- package/utils/generateTypes/generateTypes.js +1 -0
- package/utils/generateTypes/index.d.ts +1 -0
- package/utils/getEndpoint/getEndpoint.d.ts +2 -0
- package/utils/getEndpoint/index.d.ts +1 -0
- package/utils/getOrAdd/getOrAdd.d.ts +1 -0
- package/utils/getOrAdd/index.d.ts +1 -0
- package/utils/getSafeSchema/getSafeSchema.d.ts +2 -0
- package/utils/getSafeSchema/index.d.ts +1 -0
- package/utils/httpOnStart/httpOnStart.d.ts +2 -0
- package/utils/httpOnStart/index.d.ts +1 -0
- package/utils/index.d.ts +14 -0
- package/utils/parseBody/index.d.ts +1 -0
- package/utils/parseBody/parseBody.d.ts +2 -0
- package/utils/parseFormBody/index.d.ts +1 -0
- package/utils/parseFormBody/parseFormBody.d.ts +2 -0
- package/utils/parseSearch/index.d.ts +1 -0
- package/utils/parseSearch/parseSearch.d.ts +3 -0
- package/utils/rules/arrayOf/arrayOf.d.ts +2 -0
- package/utils/rules/arrayOf/index.d.ts +1 -0
- package/utils/rules/bin/bin.d.ts +2 -0
- package/utils/rules/bin/index.d.ts +1 -0
- package/utils/rules/binaryAccept/binaryAccept.d.ts +2 -0
- package/utils/rules/binaryAccept/index.d.ts +1 -0
- package/utils/rules/constants.d.ts +1 -0
- package/utils/rules/dateTo/dateTo.d.ts +2 -0
- package/utils/rules/dateTo/index.d.ts +1 -0
- package/utils/rules/defaultTo/defaultTo.d.ts +1 -0
- package/utils/rules/defaultTo/index.d.ts +1 -0
- package/utils/rules/helpers.d.ts +8 -0
- package/utils/rules/index.d.ts +28 -0
- package/utils/rules/int/index.d.ts +1 -0
- package/utils/rules/int/int.d.ts +2 -0
- package/utils/rules/max/index.d.ts +1 -0
- package/utils/rules/max/max.d.ts +1 -0
- package/utils/rules/maxBin/index.d.ts +1 -0
- package/utils/rules/maxBin/maxBin.d.ts +2 -0
- package/utils/rules/maxDate/index.d.ts +1 -0
- package/utils/rules/maxDate/maxDate.d.ts +1 -0
- package/utils/rules/maxLength/index.d.ts +1 -0
- package/utils/rules/maxLength/maxLength.d.ts +1 -0
- package/utils/rules/min/index.d.ts +1 -0
- package/utils/rules/min/min.d.ts +1 -0
- package/utils/rules/minBin/index.d.ts +1 -0
- package/utils/rules/minBin/minBin.d.ts +2 -0
- package/utils/rules/minDate/index.d.ts +1 -0
- package/utils/rules/minDate/minDate.d.ts +1 -0
- package/utils/rules/minLength/index.d.ts +1 -0
- package/utils/rules/minLength/minLength.d.ts +1 -0
- package/utils/rules/nullable/index.d.ts +1 -0
- package/utils/rules/nullable/nullable.d.ts +1 -0
- package/utils/rules/num/index.d.ts +1 -0
- package/utils/rules/num/num.d.ts +1 -0
- package/utils/rules/objectOf/index.d.ts +1 -0
- package/utils/rules/objectOf/objectOf.d.ts +3 -0
- package/utils/rules/oneOf/index.d.ts +1 -0
- package/utils/rules/oneOf/oneOf.d.ts +2 -0
- package/utils/rules/optional/index.d.ts +1 -0
- package/utils/rules/optional/optional.d.ts +2 -0
- package/utils/rules/pattern/index.d.ts +1 -0
- package/utils/rules/pattern/pattern.d.ts +1 -0
- package/utils/rules/pipe/index.d.ts +1 -0
- package/utils/rules/pipe/pipe.d.ts +2 -0
- package/utils/rules/required/index.d.ts +1 -0
- package/utils/rules/required/required.d.ts +2 -0
- package/utils/rules/tupleOf/index.d.ts +1 -0
- package/utils/rules/tupleOf/tupleOf.d.ts +2 -0
- package/utils/rules/types.d.ts +4 -0
- package/utils/rules/uuidTo/index.d.ts +1 -0
- package/utils/rules/uuidTo/uuidTo.d.ts +1 -0
- package/utils/rules/values/index.d.ts +1 -0
- package/utils/rules/values/values.d.ts +1 -0
- package/utils/stringifySearch/index.d.ts +1 -0
- package/utils/stringifySearch/stringifySearch.d.ts +2 -0
|
@@ -46,7 +46,9 @@ const endpoint = () => {
|
|
|
46
46
|
endpoints[method] = { key: '', plugins: new Set() };
|
|
47
47
|
}
|
|
48
48
|
const endpoint = getEndpoint(path, endpoints[method]);
|
|
49
|
+
// @ts-expect-error: it's always an object
|
|
49
50
|
endpointContext.set(handler, { endpoint, operation, props });
|
|
51
|
+
// @ts-expect-error: it's always an object
|
|
50
52
|
serverPlugins.set(handler, endpoint.plugins);
|
|
51
53
|
innet(children, handler);
|
|
52
54
|
};
|
|
@@ -50,7 +50,9 @@ const endpoint = () => {
|
|
|
50
50
|
endpoints[method] = { key: '', plugins: new Set() };
|
|
51
51
|
}
|
|
52
52
|
const endpoint = getEndpoint.getEndpoint(path, endpoints[method]);
|
|
53
|
+
// @ts-expect-error: it's always an object
|
|
53
54
|
useEndpoint.endpointContext.set(handler, { endpoint, operation, props });
|
|
55
|
+
// @ts-expect-error: it's always an object
|
|
54
56
|
useServerPlugins.serverPlugins.set(handler, endpoint.plugins);
|
|
55
57
|
innet.innet(children, handler);
|
|
56
58
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './endpoint';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type HandlerPlugin } from 'innet';
|
|
2
|
+
export interface HostProps {
|
|
3
|
+
/**
|
|
4
|
+
* An optional string describing the host designated by the URL.
|
|
5
|
+
* [CommonMark syntax](https://spec.commonmark.org/) MAY be used for rich text representation.
|
|
6
|
+
* */
|
|
7
|
+
description?: string;
|
|
8
|
+
/**
|
|
9
|
+
* A URL to the target host.
|
|
10
|
+
* This URL supports Server Variables and MAY be relative,
|
|
11
|
+
* to indicate that the host location is relative to the location where the OpenAPI document is being served.
|
|
12
|
+
* Variable substitutions will be made when a variable is named in {brackets}.
|
|
13
|
+
* */
|
|
14
|
+
url: string;
|
|
15
|
+
}
|
|
16
|
+
export declare const host: HandlerPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './host';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './api';
|
|
2
|
+
export * from './body';
|
|
3
|
+
export * from './contact';
|
|
4
|
+
export * from './endpoint';
|
|
5
|
+
export * from './host';
|
|
6
|
+
export * from './license';
|
|
7
|
+
export * from './param';
|
|
8
|
+
export * from './preset';
|
|
9
|
+
export * from './response';
|
|
10
|
+
export * from './return';
|
|
11
|
+
export * from './server';
|
|
12
|
+
export * from './tag';
|
|
13
|
+
export * from './variable';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './license';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type HandlerPlugin } from 'innet';
|
|
2
|
+
export interface LicenseProps {
|
|
3
|
+
/**
|
|
4
|
+
* An [SPDX](https://spdx.org/spdx-specification-21-web-version#h.jxpfx0ykyb60) license expression for the API.
|
|
5
|
+
* The `identifier` field is mutually exclusive of the `url` field.
|
|
6
|
+
* @example: Apache-2.0
|
|
7
|
+
* */
|
|
8
|
+
identifier?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The license name used for the API.
|
|
11
|
+
* @example: Apache 2.0
|
|
12
|
+
* */
|
|
13
|
+
name: string;
|
|
14
|
+
/**
|
|
15
|
+
* A URL to the license used for the API.
|
|
16
|
+
* This MUST be in the form of a URL.
|
|
17
|
+
* The `url` field is mutually exclusive of the `identifier` field.
|
|
18
|
+
* */
|
|
19
|
+
url?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const license: HandlerPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './param';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type HandlerPlugin } from 'innet';
|
|
2
|
+
import { type InParam } from '../../../types';
|
|
3
|
+
export interface ParamProps {
|
|
4
|
+
children?: any;
|
|
5
|
+
/**
|
|
6
|
+
* Specifies that a parameter is deprecated and SHOULD be transitioned out of usage.
|
|
7
|
+
* Default value is `false`.
|
|
8
|
+
* */
|
|
9
|
+
deprecated?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* A brief description of the parameter.
|
|
12
|
+
* This could contain examples of use.
|
|
13
|
+
* [CommonMark syntax](https://spec.commonmark.org) MAY be used for rich text representation.
|
|
14
|
+
* */
|
|
15
|
+
description?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The location of the parameter.
|
|
18
|
+
* Possible values are "query", "header", "path" or "cookie".
|
|
19
|
+
* */
|
|
20
|
+
in: InParam;
|
|
21
|
+
/**
|
|
22
|
+
* The name of the parameter. Parameter names are *case sensitive*.
|
|
23
|
+
*
|
|
24
|
+
* - If `in` is "path", the `name` field MUST correspond to a template expression occurring within the `path` field in the `endpoint`. See [Path Templating](https://swagger.io/specification/#path-templating) for further information.
|
|
25
|
+
* - If `in` is "header" and the `name` field is "Accept", "Content-Type" or "Authorization", the parameter definition SHALL be ignored.
|
|
26
|
+
* - For all other cases, the `name` corresponds to the parameter name used by the `in` property.
|
|
27
|
+
* */
|
|
28
|
+
name: string;
|
|
29
|
+
/**
|
|
30
|
+
* Determines whether this parameter is mandatory.
|
|
31
|
+
* If the parameter location is "path", this property is `true` and its value MUST be `true`.
|
|
32
|
+
* Otherwise, the property MAY be included and its default value is `false`.
|
|
33
|
+
* */
|
|
34
|
+
required?: boolean;
|
|
35
|
+
}
|
|
36
|
+
export declare const param: HandlerPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './preset';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './response';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type HandlerPlugin } from 'innet';
|
|
2
|
+
import { type ErrorStatuses, type RedirectStatuses, type SuccessStatuses } from '../../request';
|
|
3
|
+
export type StatusKey = ErrorStatuses | RedirectStatuses | SuccessStatuses;
|
|
4
|
+
export interface ResponseProps {
|
|
5
|
+
children?: any;
|
|
6
|
+
/**
|
|
7
|
+
* A description of the response.
|
|
8
|
+
* [CommonMark syntax](https://spec.commonmark.org) MAY be used for rich text representation.
|
|
9
|
+
* */
|
|
10
|
+
description?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Any [HTTP status code](https://swagger.io/specification/#http-codes) can be used as the property.
|
|
13
|
+
* To define a range of response codes, this field MAY contain the uppercase wildcard character X.
|
|
14
|
+
* For example, 2XX represents all response codes between [200-299].
|
|
15
|
+
* Only the following range definitions are allowed: 1XX, 2XX, 3XX, 4XX, and 5XX.
|
|
16
|
+
* */
|
|
17
|
+
status?: 'default' | `${1 | 2 | 3 | 4 | 5}XX` | StatusKey | number;
|
|
18
|
+
type?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const statuses: Record<StatusKey, number>;
|
|
21
|
+
export declare const response: HandlerPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './return';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './server';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type HandlerPlugin } from 'innet';
|
|
2
|
+
import { type IncomingMessage, type ServerResponse } from 'http';
|
|
3
|
+
import { type ServerStartParams, type SSL } from '../../../types';
|
|
4
|
+
export interface ServerProps {
|
|
5
|
+
children?: any;
|
|
6
|
+
onClose?: () => any;
|
|
7
|
+
onError?: (e: Error) => any;
|
|
8
|
+
onRequest?: (req: IncomingMessage, res: ServerResponse) => any;
|
|
9
|
+
onStart?: (params: ServerStartParams) => any;
|
|
10
|
+
port?: number;
|
|
11
|
+
ssl?: SSL;
|
|
12
|
+
}
|
|
13
|
+
export declare const server: HandlerPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './tag';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type HandlerPlugin } from 'innet';
|
|
2
|
+
export interface TagGroup {
|
|
3
|
+
name: string;
|
|
4
|
+
tags: string[];
|
|
5
|
+
}
|
|
6
|
+
export declare const TAG_GROUP_NAME = "x-tagGroups";
|
|
7
|
+
export interface TagProps {
|
|
8
|
+
children?: any;
|
|
9
|
+
/**
|
|
10
|
+
* A description for the tag.
|
|
11
|
+
* [CommonMark syntax](https://spec.commonmark.org) MAY be used for rich text representation.
|
|
12
|
+
* */
|
|
13
|
+
description?: string;
|
|
14
|
+
/** A name of the tag group. */
|
|
15
|
+
group?: string;
|
|
16
|
+
/** A name of the tag. */
|
|
17
|
+
name: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const tag: HandlerPlugin;
|
package/plugins/main/tag/tag.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './variable';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type HandlerPlugin } from 'innet';
|
|
2
|
+
export interface VariableProps {
|
|
3
|
+
/**
|
|
4
|
+
* An optional description for the server variable.
|
|
5
|
+
* [CommonMark syntax](https://spec.commonmark.org) MAY be used for rich text representation.
|
|
6
|
+
* */
|
|
7
|
+
description?: string;
|
|
8
|
+
/**
|
|
9
|
+
* A server url parameter
|
|
10
|
+
* */
|
|
11
|
+
key: string;
|
|
12
|
+
/**
|
|
13
|
+
* The default value to use for substitution,
|
|
14
|
+
* which SHALL be sent if an alternate value is not supplied.
|
|
15
|
+
* If the `values` is defined, the `value` MUST exist in the `values`.
|
|
16
|
+
* */
|
|
17
|
+
value?: string;
|
|
18
|
+
/**
|
|
19
|
+
* An enumeration of string values to be used if the substitution options are from a limited set.
|
|
20
|
+
* The array MUST NOT be empty.
|
|
21
|
+
* */
|
|
22
|
+
values?: [string, string, ...string[]];
|
|
23
|
+
}
|
|
24
|
+
export declare const variable: HandlerPlugin;
|
|
@@ -4,10 +4,13 @@ import { useHost } from '../../../hooks/useHost/useHost.es6.js';
|
|
|
4
4
|
|
|
5
5
|
const variable = () => {
|
|
6
6
|
const { server } = useHost();
|
|
7
|
-
const { key, values,
|
|
7
|
+
const { key, values,
|
|
8
|
+
// predefine
|
|
9
|
+
value = values === null || values === void 0 ? void 0 : values[0], ...rest } = useProps();
|
|
8
10
|
if (!server.variables) {
|
|
9
11
|
server.variables = {};
|
|
10
12
|
}
|
|
13
|
+
// @ts-expect-error: FIXME
|
|
11
14
|
server.variables[key] = { ...rest, default: value, enum: values };
|
|
12
15
|
};
|
|
13
16
|
|
|
@@ -8,10 +8,13 @@ var useHost = require('../../../hooks/useHost/useHost.js');
|
|
|
8
8
|
|
|
9
9
|
const variable = () => {
|
|
10
10
|
const { server } = useHost.useHost();
|
|
11
|
-
const { key, values,
|
|
11
|
+
const { key, values,
|
|
12
|
+
// predefine
|
|
13
|
+
value = values === null || values === void 0 ? void 0 : values[0], ...rest } = jsx.useProps();
|
|
12
14
|
if (!server.variables) {
|
|
13
15
|
server.variables = {};
|
|
14
16
|
}
|
|
17
|
+
// @ts-expect-error: FIXME
|
|
15
18
|
server.variables[key] = { ...rest, default: value, enum: values };
|
|
16
19
|
};
|
|
17
20
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './cms';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './cookie';
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { type HandlerPlugin } from 'innet';
|
|
2
|
+
export declare const errorStatuses: {
|
|
3
|
+
readonly aTimeoutOccurred: 524;
|
|
4
|
+
readonly authenticationTimeout: 419;
|
|
5
|
+
readonly badGateway: 502;
|
|
6
|
+
readonly badRequest: 400;
|
|
7
|
+
readonly bandwidthLimitExceeded: 509;
|
|
8
|
+
readonly clientClosedRequest: 499;
|
|
9
|
+
readonly conflict: 409;
|
|
10
|
+
readonly connectionTimedOut: 522;
|
|
11
|
+
readonly expectationFailed: 417;
|
|
12
|
+
readonly failedDependency: 424;
|
|
13
|
+
readonly forbidden: 403;
|
|
14
|
+
readonly gatewayTimeout: 504;
|
|
15
|
+
readonly gone: 410;
|
|
16
|
+
readonly HTTPVersionNotSupported: 505;
|
|
17
|
+
readonly imATeapot: 418;
|
|
18
|
+
readonly insufficientStorage: 507;
|
|
19
|
+
readonly internalServerError: 500;
|
|
20
|
+
readonly invalidSSLCertificate: 526;
|
|
21
|
+
readonly lengthRequired: 411;
|
|
22
|
+
readonly locked: 423;
|
|
23
|
+
readonly loopDetected: 508;
|
|
24
|
+
readonly methodNotAllowed: 405;
|
|
25
|
+
readonly misdirectedRequest: 421;
|
|
26
|
+
readonly networkAuthenticationRequired: 511;
|
|
27
|
+
readonly notAcceptable: 406;
|
|
28
|
+
readonly notExtended: 510;
|
|
29
|
+
readonly notFound: 404;
|
|
30
|
+
readonly notImplemented: 501;
|
|
31
|
+
readonly originIsUnreachable: 523;
|
|
32
|
+
readonly payloadTooLarge: 413;
|
|
33
|
+
readonly paymentRequired: 402;
|
|
34
|
+
readonly preconditionFailed: 412;
|
|
35
|
+
readonly preconditionRequired: 428;
|
|
36
|
+
readonly proxyAuthenticationRequired: 407;
|
|
37
|
+
readonly rangeNotSatisfiable: 416;
|
|
38
|
+
readonly requestHeaderFieldsTooLarge: 431;
|
|
39
|
+
readonly requestTimeout: 408;
|
|
40
|
+
readonly retryWith: 449;
|
|
41
|
+
readonly serviceUnavailable: 503;
|
|
42
|
+
readonly SSLHandshakeFailed: 525;
|
|
43
|
+
readonly tooEarly: 425;
|
|
44
|
+
readonly tooManyRequests: 429;
|
|
45
|
+
readonly unauthorized: 401;
|
|
46
|
+
readonly unavailableForLegalReasons: 451;
|
|
47
|
+
readonly unknownError: 520;
|
|
48
|
+
readonly unprocessableEntity: 422;
|
|
49
|
+
readonly unsupportedMediaType: 415;
|
|
50
|
+
readonly upgradeRequired: 426;
|
|
51
|
+
readonly URITooLong: 414;
|
|
52
|
+
readonly variantAlsoNegotiates: 506;
|
|
53
|
+
readonly webServerIsDown: 521;
|
|
54
|
+
};
|
|
55
|
+
export type ErrorStatuses = keyof typeof errorStatuses;
|
|
56
|
+
export interface ErrorProps {
|
|
57
|
+
children?: any;
|
|
58
|
+
code?: string;
|
|
59
|
+
status?: ErrorStatuses | number;
|
|
60
|
+
}
|
|
61
|
+
export declare const error: HandlerPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './error';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './file';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './header';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './proxy';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './redirect';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type HandlerPlugin } from 'innet';
|
|
2
|
+
export declare const redirectStatuses: {
|
|
3
|
+
found: number;
|
|
4
|
+
movedPermanently: number;
|
|
5
|
+
multipleChoices: number;
|
|
6
|
+
notModified: number;
|
|
7
|
+
permanentRedirect: number;
|
|
8
|
+
seeOther: number;
|
|
9
|
+
temporaryRedirect: number;
|
|
10
|
+
useProxy: number;
|
|
11
|
+
};
|
|
12
|
+
export type RedirectStatuses = keyof typeof redirectStatuses;
|
|
13
|
+
export interface RedirectProps {
|
|
14
|
+
encode?: boolean;
|
|
15
|
+
status?: RedirectStatuses | number;
|
|
16
|
+
to: string;
|
|
17
|
+
}
|
|
18
|
+
export declare const redirect: HandlerPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './success';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type HandlerPlugin } from 'innet';
|
|
2
|
+
export declare const successStatuses: {
|
|
3
|
+
readonly accepted: 202;
|
|
4
|
+
readonly alreadyReported: 208;
|
|
5
|
+
readonly created: 201;
|
|
6
|
+
readonly multiStatus: 207;
|
|
7
|
+
readonly noContent: 204;
|
|
8
|
+
readonly ok: 200;
|
|
9
|
+
readonly outside: 203;
|
|
10
|
+
readonly partialContent: 206;
|
|
11
|
+
readonly resetContent: 205;
|
|
12
|
+
};
|
|
13
|
+
export type SuccessStatuses = keyof typeof successStatuses;
|
|
14
|
+
export interface SuccessProps {
|
|
15
|
+
children?: any;
|
|
16
|
+
status?: SuccessStatuses | number;
|
|
17
|
+
type?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare const success: HandlerPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './any';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type HandlerPlugin } from 'innet';
|
|
2
|
+
import { type BaseSchemaProps } from '../../../types';
|
|
3
|
+
export interface ArrayProps extends BaseSchemaProps<any[]> {
|
|
4
|
+
children?: any;
|
|
5
|
+
maxItems?: number;
|
|
6
|
+
minItems?: number;
|
|
7
|
+
uniqueItems?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare const array: HandlerPlugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './array';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './binary';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './boolean';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type HandlerPlugin } from 'innet';
|
|
2
|
+
import { type ValuesSchemaProps } from '../../../types';
|
|
3
|
+
import { type DateFormat } from '../../../utils';
|
|
4
|
+
export interface DateProps extends ValuesSchemaProps<DateFormat> {
|
|
5
|
+
max?: DateFormat;
|
|
6
|
+
min?: DateFormat;
|
|
7
|
+
}
|
|
8
|
+
export declare const date: HandlerPlugin;
|
|
@@ -21,12 +21,14 @@ const date = () => {
|
|
|
21
21
|
const normDefault = dateFormat(defaultValue);
|
|
22
22
|
const normExample = dateFormat(example);
|
|
23
23
|
const normValues = values$1 === null || values$1 === void 0 ? void 0 : values$1.map(dateFormat);
|
|
24
|
+
// @ts-expect-error: FIXME
|
|
24
25
|
const stringValues = normValues === null || normValues === void 0 ? void 0 : normValues.map(value => value.toISOString());
|
|
25
26
|
const normExamples = examples === null || examples === void 0 ? void 0 : examples.map(dateFormat);
|
|
26
27
|
const schema = useSchemaType('string', {
|
|
27
28
|
...props,
|
|
28
29
|
default: defaultValue === 'now' ? undefined : normDefault === null || normDefault === void 0 ? void 0 : normDefault.toISOString(),
|
|
29
30
|
example: normExample === null || normExample === void 0 ? void 0 : normExample.toISOString(),
|
|
31
|
+
// @ts-expect-error: FIXME
|
|
30
32
|
examples: normExamples === null || normExamples === void 0 ? void 0 : normExamples.map(example => example.toISOString()),
|
|
31
33
|
values: stringValues,
|
|
32
34
|
});
|
|
@@ -38,16 +40,20 @@ const date = () => {
|
|
|
38
40
|
if (stringValues) {
|
|
39
41
|
rules.push((value, data) => values(stringValues)(value.toISOString(), data));
|
|
40
42
|
}
|
|
43
|
+
// @ts-expect-error: FIXME
|
|
41
44
|
schema.format = 'date-time';
|
|
42
45
|
if (normMin) {
|
|
46
|
+
// @ts-expect-error: FIXME
|
|
43
47
|
schema['x-minimum'] = normMin.toISOString();
|
|
44
48
|
rules.push(minDate(normMin));
|
|
45
49
|
}
|
|
46
50
|
if (normMax) {
|
|
51
|
+
// @ts-expect-error: FIXME
|
|
47
52
|
schema['x-maximum'] = normMax.toISOString();
|
|
48
53
|
rules.push(maxDate(normMax));
|
|
49
54
|
}
|
|
50
55
|
if (defaultValue === 'now') {
|
|
56
|
+
// @ts-expect-error: FIXME
|
|
51
57
|
schema['x-default'] = 'now';
|
|
52
58
|
}
|
|
53
59
|
if (defaultValue === undefined) {
|
|
@@ -25,12 +25,14 @@ const date = () => {
|
|
|
25
25
|
const normDefault = dateFormat.dateFormat(defaultValue);
|
|
26
26
|
const normExample = dateFormat.dateFormat(example);
|
|
27
27
|
const normValues = values$1 === null || values$1 === void 0 ? void 0 : values$1.map(dateFormat.dateFormat);
|
|
28
|
+
// @ts-expect-error: FIXME
|
|
28
29
|
const stringValues = normValues === null || normValues === void 0 ? void 0 : normValues.map(value => value.toISOString());
|
|
29
30
|
const normExamples = examples === null || examples === void 0 ? void 0 : examples.map(dateFormat.dateFormat);
|
|
30
31
|
const schema = useSchemaType.useSchemaType('string', {
|
|
31
32
|
...props,
|
|
32
33
|
default: defaultValue === 'now' ? undefined : normDefault === null || normDefault === void 0 ? void 0 : normDefault.toISOString(),
|
|
33
34
|
example: normExample === null || normExample === void 0 ? void 0 : normExample.toISOString(),
|
|
35
|
+
// @ts-expect-error: FIXME
|
|
34
36
|
examples: normExamples === null || normExamples === void 0 ? void 0 : normExamples.map(example => example.toISOString()),
|
|
35
37
|
values: stringValues,
|
|
36
38
|
});
|
|
@@ -42,16 +44,20 @@ const date = () => {
|
|
|
42
44
|
if (stringValues) {
|
|
43
45
|
rules.push((value, data) => values.values(stringValues)(value.toISOString(), data));
|
|
44
46
|
}
|
|
47
|
+
// @ts-expect-error: FIXME
|
|
45
48
|
schema.format = 'date-time';
|
|
46
49
|
if (normMin) {
|
|
50
|
+
// @ts-expect-error: FIXME
|
|
47
51
|
schema['x-minimum'] = normMin.toISOString();
|
|
48
52
|
rules.push(minDate.minDate(normMin));
|
|
49
53
|
}
|
|
50
54
|
if (normMax) {
|
|
55
|
+
// @ts-expect-error: FIXME
|
|
51
56
|
schema['x-maximum'] = normMax.toISOString();
|
|
52
57
|
rules.push(maxDate.maxDate(normMax));
|
|
53
58
|
}
|
|
54
59
|
if (defaultValue === 'now') {
|
|
60
|
+
// @ts-expect-error: FIXME
|
|
55
61
|
schema['x-default'] = 'now';
|
|
56
62
|
}
|
|
57
63
|
if (defaultValue === undefined) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './date';
|