@aeriajs/types 0.0.134 → 0.0.136
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/dist/accessControl.js +1 -4
- package/dist/collection.js +1 -2
- package/dist/condition.js +1 -2
- package/dist/config.d.ts +7 -3
- package/dist/config.js +1 -2
- package/dist/context.js +1 -2
- package/dist/contract.js +1 -5
- package/dist/description.js +2 -5
- package/dist/endpointError.js +2 -5
- package/dist/functionSchemas.js +38 -45
- package/dist/functions.js +1 -2
- package/dist/http.js +4 -7
- package/dist/index.js +18 -35
- package/dist/property.js +4 -7
- package/dist/result.js +2 -5
- package/dist/resultSchemas.js +4 -11
- package/dist/schema.js +1 -2
- package/dist/security.js +1 -4
- package/dist/token.js +1 -2
- package/dist/validation.js +3 -6
- package/package.json +4 -8
- package/dist/accessControl.mjs +0 -16
- package/dist/collection.mjs +0 -1
- package/dist/condition.mjs +0 -1
- package/dist/config.mjs +0 -1
- package/dist/context.mjs +0 -1
- package/dist/contract.mjs +0 -4
- package/dist/description.mjs +0 -16
- package/dist/endpointError.mjs +0 -3
- package/dist/functionSchemas.mjs +0 -55
- package/dist/functions.mjs +0 -1
- package/dist/http.mjs +0 -31
- package/dist/index.mjs +0 -19
- package/dist/property.mjs +0 -23
- package/dist/result.mjs +0 -14
- package/dist/resultSchemas.mjs +0 -105
- package/dist/schema.mjs +0 -1
- package/dist/security.mjs +0 -5
- package/dist/token.mjs +0 -1
- package/dist/validation.mjs +0 -21
package/dist/accessControl.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ACError = void 0;
|
|
4
|
-
exports.ACError = {
|
|
1
|
+
export const ACError = {
|
|
5
2
|
AuthenticationError: 'AUTHENTICATION_ERROR',
|
|
6
3
|
AuthorizationError: 'AUTHORIZATION_ERROR',
|
|
7
4
|
FunctionNotFound: 'FUNCTION_NOT_FOUND',
|
package/dist/collection.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/condition.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/config.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { RouteContext } from './context.js';
|
|
2
|
-
import type { RouteUri } from './http.js';
|
|
2
|
+
import type { GenericRequest, GenericResponse, RouteUri } from './http.js';
|
|
3
3
|
import type { RateLimitingParams } from './security.js';
|
|
4
4
|
import type { CollectionItem } from './collection.js';
|
|
5
|
-
import type { UserRole } from './token.js';
|
|
5
|
+
import type { Token, UserRole } from './token.js';
|
|
6
|
+
import type { Result } from './result.js';
|
|
6
7
|
export type RolesHierarchy = Record<UserRole, readonly UserRole[] | boolean>;
|
|
8
|
+
export type GetTokenFunction = (request: GenericRequest, context: RouteContext) => Promise<Result.Either<unknown, Token>>;
|
|
9
|
+
export type CorsFunction = (req: GenericRequest, res: GenericResponse, config: CorsConfig) => Promise<null | undefined>;
|
|
7
10
|
export type CorsConfig = {
|
|
8
11
|
allowOrigin?: readonly string[];
|
|
9
12
|
allowMethods?: readonly string[];
|
|
@@ -15,7 +18,8 @@ export type ServerOptions = {
|
|
|
15
18
|
port?: number;
|
|
16
19
|
enableLogging?: boolean;
|
|
17
20
|
noWarmup?: boolean;
|
|
18
|
-
cors?: CorsConfig |
|
|
21
|
+
cors?: null | CorsConfig | CorsFunction;
|
|
22
|
+
getToken?: GetTokenFunction;
|
|
19
23
|
};
|
|
20
24
|
export type ApiConfig = {
|
|
21
25
|
name?: string;
|
package/dist/config.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/context.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/contract.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defineContract = void 0;
|
|
4
|
-
const defineContract = (contract) => {
|
|
1
|
+
export const defineContract = (contract) => {
|
|
5
2
|
return contract;
|
|
6
3
|
};
|
|
7
|
-
exports.defineContract = defineContract;
|
package/dist/description.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LAYOUT_NAMES = exports.DESCRIPTION_PRESETS = void 0;
|
|
4
|
-
exports.DESCRIPTION_PRESETS = [
|
|
1
|
+
export const DESCRIPTION_PRESETS = [
|
|
5
2
|
'add',
|
|
6
3
|
'crud',
|
|
7
4
|
'duplicate',
|
|
@@ -11,7 +8,7 @@ exports.DESCRIPTION_PRESETS = [
|
|
|
11
8
|
'timestamped',
|
|
12
9
|
'view',
|
|
13
10
|
];
|
|
14
|
-
|
|
11
|
+
export const LAYOUT_NAMES = [
|
|
15
12
|
'tabular',
|
|
16
13
|
'grid',
|
|
17
14
|
'list',
|
package/dist/endpointError.js
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ERROR_SYMBOL = exports.ERROR_SYMBOL_DESCRIPTION = void 0;
|
|
4
|
-
exports.ERROR_SYMBOL_DESCRIPTION = '#__ERROR_SYMBOL__';
|
|
5
|
-
exports.ERROR_SYMBOL = Symbol(exports.ERROR_SYMBOL_DESCRIPTION);
|
|
1
|
+
export const ERROR_SYMBOL_DESCRIPTION = '#__ERROR_SYMBOL__';
|
|
2
|
+
export const ERROR_SYMBOL = Symbol(ERROR_SYMBOL_DESCRIPTION);
|
package/dist/functionSchemas.js
CHANGED
|
@@ -1,61 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const resultSchemas_js_1 = require("./resultSchemas.js");
|
|
7
|
-
const validation_js_1 = require("./validation.js");
|
|
8
|
-
const insertError = () => (0, resultSchemas_js_1.endpointErrorSchema)({
|
|
1
|
+
import { ACError } from './accessControl.js';
|
|
2
|
+
import { HTTPStatus } from './http.js';
|
|
3
|
+
import { endpointErrorSchema } from './resultSchemas.js';
|
|
4
|
+
import { ValidationErrorCode, TraverseError } from './validation.js';
|
|
5
|
+
export const insertError = () => endpointErrorSchema({
|
|
9
6
|
httpStatus: [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
HTTPStatus.Forbidden,
|
|
8
|
+
HTTPStatus.NotFound,
|
|
9
|
+
HTTPStatus.UnprocessableContent,
|
|
10
|
+
HTTPStatus.BadRequest,
|
|
11
|
+
HTTPStatus.InternalServerError,
|
|
15
12
|
],
|
|
16
13
|
code: [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
ACError.InsecureOperator,
|
|
15
|
+
ACError.OwnershipError,
|
|
16
|
+
ACError.ResourceNotFound,
|
|
17
|
+
ACError.TargetImmutable,
|
|
18
|
+
ACError.MalformedInput,
|
|
19
|
+
ACError.UniquenessViolated,
|
|
20
|
+
ValidationErrorCode.EmptyTarget,
|
|
21
|
+
ValidationErrorCode.InvalidProperties,
|
|
22
|
+
ValidationErrorCode.MissingProperties,
|
|
23
|
+
TraverseError.InvalidDocumentId,
|
|
24
|
+
TraverseError.InvalidTempfile,
|
|
28
25
|
],
|
|
29
26
|
});
|
|
30
|
-
|
|
31
|
-
const getError = () => (0, resultSchemas_js_1.endpointErrorSchema)({
|
|
27
|
+
export const getError = () => endpointErrorSchema({
|
|
32
28
|
httpStatus: [
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
HTTPStatus.Forbidden,
|
|
30
|
+
HTTPStatus.NotFound,
|
|
31
|
+
HTTPStatus.BadRequest,
|
|
36
32
|
],
|
|
37
33
|
code: [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
ACError.ResourceNotFound,
|
|
35
|
+
ACError.OwnershipError,
|
|
36
|
+
ACError.InsecureOperator,
|
|
37
|
+
ACError.MalformedInput,
|
|
42
38
|
],
|
|
43
39
|
});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
httpStatus: [http_js_1.HTTPStatus.Forbidden],
|
|
40
|
+
export const getAllError = () => endpointErrorSchema({
|
|
41
|
+
httpStatus: [HTTPStatus.Forbidden],
|
|
47
42
|
code: [
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
ACError.OwnershipError,
|
|
44
|
+
ACError.InsecureOperator,
|
|
45
|
+
ACError.InvalidLimit,
|
|
51
46
|
],
|
|
52
47
|
});
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
httpStatus: [http_js_1.HTTPStatus.Forbidden],
|
|
48
|
+
export const countError = () => endpointErrorSchema({
|
|
49
|
+
httpStatus: [HTTPStatus.Forbidden],
|
|
56
50
|
code: [
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
ACError.OwnershipError,
|
|
52
|
+
ACError.InvalidLimit,
|
|
59
53
|
],
|
|
60
54
|
});
|
|
61
|
-
exports.countError = countError;
|
package/dist/functions.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/http.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.STREAMED_RESPONSE = exports.HTTPStatus = exports.METHOD_COLORS = exports.REQUEST_METHODS = void 0;
|
|
4
|
-
exports.REQUEST_METHODS = [
|
|
1
|
+
export const REQUEST_METHODS = [
|
|
5
2
|
'GET',
|
|
6
3
|
'HEAD',
|
|
7
4
|
'POST',
|
|
@@ -12,13 +9,13 @@ exports.REQUEST_METHODS = [
|
|
|
12
9
|
'TRACE',
|
|
13
10
|
'SEARCH',
|
|
14
11
|
];
|
|
15
|
-
|
|
12
|
+
export const METHOD_COLORS = {
|
|
16
13
|
GET: 'green',
|
|
17
14
|
PUT: 'blue',
|
|
18
15
|
POST: 'white',
|
|
19
16
|
DELETE: 'red',
|
|
20
17
|
};
|
|
21
|
-
|
|
18
|
+
export const HTTPStatus = {
|
|
22
19
|
Ok: 200,
|
|
23
20
|
NoContent: 204,
|
|
24
21
|
BadRequest: 400,
|
|
@@ -30,4 +27,4 @@ exports.HTTPStatus = {
|
|
|
30
27
|
TooManyRequests: 429,
|
|
31
28
|
InternalServerError: 500,
|
|
32
29
|
};
|
|
33
|
-
|
|
30
|
+
export const STREAMED_RESPONSE = Symbol('StreamedResponse');
|
package/dist/index.js
CHANGED
|
@@ -1,35 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
__exportStar(require("./accessControl.js"), exports);
|
|
20
|
-
__exportStar(require("./collection.js"), exports);
|
|
21
|
-
__exportStar(require("./condition.js"), exports);
|
|
22
|
-
__exportStar(require("./config.js"), exports);
|
|
23
|
-
__exportStar(require("./context.js"), exports);
|
|
24
|
-
__exportStar(require("./contract.js"), exports);
|
|
25
|
-
__exportStar(require("./description.js"), exports);
|
|
26
|
-
__exportStar(require("./endpointError.js"), exports);
|
|
27
|
-
__exportStar(require("./functions.js"), exports);
|
|
28
|
-
__exportStar(require("./http.js"), exports);
|
|
29
|
-
__exportStar(require("./property.js"), exports);
|
|
30
|
-
__exportStar(require("./result.js"), exports);
|
|
31
|
-
__exportStar(require("./resultSchemas.js"), exports);
|
|
32
|
-
__exportStar(require("./schema.js"), exports);
|
|
33
|
-
__exportStar(require("./security.js"), exports);
|
|
34
|
-
__exportStar(require("./token.js"), exports);
|
|
35
|
-
__exportStar(require("./validation.js"), exports);
|
|
1
|
+
export * as functionSchemas from './functionSchemas.js';
|
|
2
|
+
export * from './accessControl.js';
|
|
3
|
+
export * from './collection.js';
|
|
4
|
+
export * from './condition.js';
|
|
5
|
+
export * from './config.js';
|
|
6
|
+
export * from './context.js';
|
|
7
|
+
export * from './contract.js';
|
|
8
|
+
export * from './description.js';
|
|
9
|
+
export * from './endpointError.js';
|
|
10
|
+
export * from './functions.js';
|
|
11
|
+
export * from './http.js';
|
|
12
|
+
export * from './property.js';
|
|
13
|
+
export * from './result.js';
|
|
14
|
+
export * from './resultSchemas.js';
|
|
15
|
+
export * from './schema.js';
|
|
16
|
+
export * from './security.js';
|
|
17
|
+
export * from './token.js';
|
|
18
|
+
export * from './validation.js';
|
package/dist/property.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PROPERTY_FORMATS = exports.PROPERTY_INPUT_ELEMENTS = exports.PROPERTY_INPUT_TYPES = exports.PROPERTY_ARRAY_ELEMENTS = void 0;
|
|
4
|
-
exports.PROPERTY_ARRAY_ELEMENTS = [
|
|
1
|
+
export const PROPERTY_ARRAY_ELEMENTS = [
|
|
5
2
|
'checkbox',
|
|
6
3
|
'radio',
|
|
7
4
|
'select',
|
|
8
5
|
];
|
|
9
|
-
|
|
6
|
+
export const PROPERTY_INPUT_TYPES = [
|
|
10
7
|
'text',
|
|
11
8
|
'email',
|
|
12
9
|
'password',
|
|
@@ -14,11 +11,11 @@ exports.PROPERTY_INPUT_TYPES = [
|
|
|
14
11
|
'time',
|
|
15
12
|
'month',
|
|
16
13
|
];
|
|
17
|
-
|
|
14
|
+
export const PROPERTY_INPUT_ELEMENTS = [
|
|
18
15
|
'input',
|
|
19
16
|
'textarea',
|
|
20
17
|
];
|
|
21
|
-
|
|
18
|
+
export const PROPERTY_FORMATS = [
|
|
22
19
|
'date',
|
|
23
20
|
'date-time',
|
|
24
21
|
'objectid',
|
package/dist/result.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Result = void 0;
|
|
4
|
-
var Result;
|
|
1
|
+
export var Result;
|
|
5
2
|
(function (Result) {
|
|
6
3
|
Result.error = (value) => ({
|
|
7
4
|
_tag: 'Error',
|
|
@@ -13,4 +10,4 @@ var Result;
|
|
|
13
10
|
error: undefined,
|
|
14
11
|
result: value,
|
|
15
12
|
});
|
|
16
|
-
})(Result || (
|
|
13
|
+
})(Result || (Result = {}));
|
package/dist/resultSchemas.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.genericEndpointErrorSchema = exports.endpointErrorSchema = exports.resultSchema = exports.errorSchema = void 0;
|
|
4
|
-
const errorSchema = (error) => {
|
|
1
|
+
export const errorSchema = (error) => {
|
|
5
2
|
const schema = {
|
|
6
3
|
type: 'object',
|
|
7
4
|
properties: {
|
|
@@ -17,8 +14,7 @@ const errorSchema = (error) => {
|
|
|
17
14
|
};
|
|
18
15
|
return schema;
|
|
19
16
|
};
|
|
20
|
-
|
|
21
|
-
const resultSchema = (result) => {
|
|
17
|
+
export const resultSchema = (result) => {
|
|
22
18
|
const schema = {
|
|
23
19
|
type: 'object',
|
|
24
20
|
properties: {
|
|
@@ -34,8 +30,7 @@ const resultSchema = (result) => {
|
|
|
34
30
|
};
|
|
35
31
|
return schema;
|
|
36
32
|
};
|
|
37
|
-
|
|
38
|
-
const endpointErrorSchema = (error) => {
|
|
33
|
+
export const endpointErrorSchema = (error) => {
|
|
39
34
|
return {
|
|
40
35
|
type: 'object',
|
|
41
36
|
properties: {
|
|
@@ -71,8 +66,7 @@ const endpointErrorSchema = (error) => {
|
|
|
71
66
|
},
|
|
72
67
|
};
|
|
73
68
|
};
|
|
74
|
-
|
|
75
|
-
const genericEndpointErrorSchema = () => {
|
|
69
|
+
export const genericEndpointErrorSchema = () => {
|
|
76
70
|
return {
|
|
77
71
|
type: 'object',
|
|
78
72
|
properties: {
|
|
@@ -108,4 +102,3 @@ const genericEndpointErrorSchema = () => {
|
|
|
108
102
|
},
|
|
109
103
|
};
|
|
110
104
|
};
|
|
111
|
-
exports.genericEndpointErrorSchema = genericEndpointErrorSchema;
|
package/dist/schema.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/security.js
CHANGED
package/dist/token.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
package/dist/validation.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TraverseError = exports.PropertyValidationErrorCode = exports.ValidationErrorCode = void 0;
|
|
4
|
-
exports.ValidationErrorCode = {
|
|
1
|
+
export const ValidationErrorCode = {
|
|
5
2
|
InvalidProperties: 'INVALID_PROPERTIES',
|
|
6
3
|
MissingProperties: 'MISSING_PROPERTIES',
|
|
7
4
|
EmptyTarget: 'EMPTY_TARGET',
|
|
8
5
|
};
|
|
9
|
-
|
|
6
|
+
export const PropertyValidationErrorCode = {
|
|
10
7
|
Missing: 'MISSING_PROPERTY',
|
|
11
8
|
Extraneous: 'EXTRANEOUS_PROPERTY',
|
|
12
9
|
Unmatching: 'UNMATCHING_PROPERTIES',
|
|
@@ -17,7 +14,7 @@ exports.PropertyValidationErrorCode = {
|
|
|
17
14
|
StringConstraint: 'STRING_CONSTRAINT',
|
|
18
15
|
ReferenceConstraint: 'REFERENCE_CONSTRAINT',
|
|
19
16
|
};
|
|
20
|
-
|
|
17
|
+
export const TraverseError = {
|
|
21
18
|
InvalidDocumentId: 'INVALID_DOCUMENT_ID',
|
|
22
19
|
InvalidTempfile: 'INVALID_TEMPFILE',
|
|
23
20
|
};
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/types",
|
|
3
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.136",
|
|
4
5
|
"description": "",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public"
|
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
|
-
"
|
|
15
|
-
"require": "./dist/index.js"
|
|
14
|
+
"default": "./dist/index.js"
|
|
16
15
|
}
|
|
17
16
|
},
|
|
18
17
|
"keywords": [],
|
|
@@ -28,9 +27,6 @@
|
|
|
28
27
|
"test": "echo skipping",
|
|
29
28
|
"lint": "eslint .",
|
|
30
29
|
"lint:fix": "eslint . --fix",
|
|
31
|
-
"build": "
|
|
32
|
-
"build:cjs": "tsc",
|
|
33
|
-
"build:esm": "esbuild './src/**/*.ts' --outdir=dist --out-extension:.js=.mjs && pnpm build:esm-transform",
|
|
34
|
-
"build:esm-transform": "pnpm -w esm-transform $PWD/dist"
|
|
30
|
+
"build": "tsc"
|
|
35
31
|
}
|
|
36
32
|
}
|
package/dist/accessControl.mjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
export const ACError = {
|
|
3
|
-
AuthenticationError: "AUTHENTICATION_ERROR",
|
|
4
|
-
AuthorizationError: "AUTHORIZATION_ERROR",
|
|
5
|
-
FunctionNotFound: "FUNCTION_NOT_FOUND",
|
|
6
|
-
FunctionNotExposed: "FUNCTION_NOT_EXPOSED",
|
|
7
|
-
TargetImmutable: "TARGET_IMMUTABLE",
|
|
8
|
-
InvalidLimit: "INVALID_LIMIT",
|
|
9
|
-
InvalidToken: "INVALID_TOKEN",
|
|
10
|
-
OwnershipError: "OWNERSHIP_ERROR",
|
|
11
|
-
ResourceNotFound: "RESOURCE_NOT_FOUND",
|
|
12
|
-
InsecureOperator: "INSECURE_OPERATOR",
|
|
13
|
-
MalformedInput: "MALFORMED_INPUT",
|
|
14
|
-
UniquenessViolated: "UNIQUENESS_VIOLATED",
|
|
15
|
-
UnknownError: "UNKNOWN_ERROR"
|
|
16
|
-
};
|
package/dist/collection.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/dist/condition.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/dist/config.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/dist/context.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/dist/contract.mjs
DELETED
package/dist/description.mjs
DELETED
package/dist/endpointError.mjs
DELETED
package/dist/functionSchemas.mjs
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
import { ACError } from "./accessControl.mjs";
|
|
3
|
-
import { HTTPStatus } from "./http.mjs";
|
|
4
|
-
import { endpointErrorSchema } from "./resultSchemas.mjs";
|
|
5
|
-
import { ValidationErrorCode, TraverseError } from "./validation.mjs";
|
|
6
|
-
export const insertError = () => endpointErrorSchema({
|
|
7
|
-
httpStatus: [
|
|
8
|
-
HTTPStatus.Forbidden,
|
|
9
|
-
HTTPStatus.NotFound,
|
|
10
|
-
HTTPStatus.UnprocessableContent,
|
|
11
|
-
HTTPStatus.BadRequest,
|
|
12
|
-
HTTPStatus.InternalServerError
|
|
13
|
-
],
|
|
14
|
-
code: [
|
|
15
|
-
ACError.InsecureOperator,
|
|
16
|
-
ACError.OwnershipError,
|
|
17
|
-
ACError.ResourceNotFound,
|
|
18
|
-
ACError.TargetImmutable,
|
|
19
|
-
ACError.MalformedInput,
|
|
20
|
-
ACError.UniquenessViolated,
|
|
21
|
-
ValidationErrorCode.EmptyTarget,
|
|
22
|
-
ValidationErrorCode.InvalidProperties,
|
|
23
|
-
ValidationErrorCode.MissingProperties,
|
|
24
|
-
TraverseError.InvalidDocumentId,
|
|
25
|
-
TraverseError.InvalidTempfile
|
|
26
|
-
]
|
|
27
|
-
});
|
|
28
|
-
export const getError = () => endpointErrorSchema({
|
|
29
|
-
httpStatus: [
|
|
30
|
-
HTTPStatus.Forbidden,
|
|
31
|
-
HTTPStatus.NotFound,
|
|
32
|
-
HTTPStatus.BadRequest
|
|
33
|
-
],
|
|
34
|
-
code: [
|
|
35
|
-
ACError.ResourceNotFound,
|
|
36
|
-
ACError.OwnershipError,
|
|
37
|
-
ACError.InsecureOperator,
|
|
38
|
-
ACError.MalformedInput
|
|
39
|
-
]
|
|
40
|
-
});
|
|
41
|
-
export const getAllError = () => endpointErrorSchema({
|
|
42
|
-
httpStatus: [HTTPStatus.Forbidden],
|
|
43
|
-
code: [
|
|
44
|
-
ACError.OwnershipError,
|
|
45
|
-
ACError.InsecureOperator,
|
|
46
|
-
ACError.InvalidLimit
|
|
47
|
-
]
|
|
48
|
-
});
|
|
49
|
-
export const countError = () => endpointErrorSchema({
|
|
50
|
-
httpStatus: [HTTPStatus.Forbidden],
|
|
51
|
-
code: [
|
|
52
|
-
ACError.OwnershipError,
|
|
53
|
-
ACError.InvalidLimit
|
|
54
|
-
]
|
|
55
|
-
});
|
package/dist/functions.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/dist/http.mjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
export const REQUEST_METHODS = [
|
|
3
|
-
"GET",
|
|
4
|
-
"HEAD",
|
|
5
|
-
"POST",
|
|
6
|
-
"PUT",
|
|
7
|
-
"DELETE",
|
|
8
|
-
"OPTIONS",
|
|
9
|
-
"PATCH",
|
|
10
|
-
"TRACE",
|
|
11
|
-
"SEARCH"
|
|
12
|
-
];
|
|
13
|
-
export const METHOD_COLORS = {
|
|
14
|
-
GET: "green",
|
|
15
|
-
PUT: "blue",
|
|
16
|
-
POST: "white",
|
|
17
|
-
DELETE: "red"
|
|
18
|
-
};
|
|
19
|
-
export const HTTPStatus = {
|
|
20
|
-
Ok: 200,
|
|
21
|
-
NoContent: 204,
|
|
22
|
-
BadRequest: 400,
|
|
23
|
-
Unauthorized: 401,
|
|
24
|
-
Forbidden: 403,
|
|
25
|
-
NotFound: 404,
|
|
26
|
-
RangeNotSatisfiable: 416,
|
|
27
|
-
UnprocessableContent: 422,
|
|
28
|
-
TooManyRequests: 429,
|
|
29
|
-
InternalServerError: 500
|
|
30
|
-
};
|
|
31
|
-
export const STREAMED_RESPONSE = Symbol("StreamedResponse");
|
package/dist/index.mjs
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
export * as functionSchemas from "./functionSchemas.mjs";
|
|
3
|
-
export * from "./accessControl.mjs";
|
|
4
|
-
export * from "./collection.mjs";
|
|
5
|
-
export * from "./condition.mjs";
|
|
6
|
-
export * from "./config.mjs";
|
|
7
|
-
export * from "./context.mjs";
|
|
8
|
-
export * from "./contract.mjs";
|
|
9
|
-
export * from "./description.mjs";
|
|
10
|
-
export * from "./endpointError.mjs";
|
|
11
|
-
export * from "./functions.mjs";
|
|
12
|
-
export * from "./http.mjs";
|
|
13
|
-
export * from "./property.mjs";
|
|
14
|
-
export * from "./result.mjs";
|
|
15
|
-
export * from "./resultSchemas.mjs";
|
|
16
|
-
export * from "./schema.mjs";
|
|
17
|
-
export * from "./security.mjs";
|
|
18
|
-
export * from "./token.mjs";
|
|
19
|
-
export * from "./validation.mjs";
|
package/dist/property.mjs
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
export const PROPERTY_ARRAY_ELEMENTS = [
|
|
3
|
-
"checkbox",
|
|
4
|
-
"radio",
|
|
5
|
-
"select"
|
|
6
|
-
];
|
|
7
|
-
export const PROPERTY_INPUT_TYPES = [
|
|
8
|
-
"text",
|
|
9
|
-
"email",
|
|
10
|
-
"password",
|
|
11
|
-
"search",
|
|
12
|
-
"time",
|
|
13
|
-
"month"
|
|
14
|
-
];
|
|
15
|
-
export const PROPERTY_INPUT_ELEMENTS = [
|
|
16
|
-
"input",
|
|
17
|
-
"textarea"
|
|
18
|
-
];
|
|
19
|
-
export const PROPERTY_FORMATS = [
|
|
20
|
-
"date",
|
|
21
|
-
"date-time",
|
|
22
|
-
"objectid"
|
|
23
|
-
];
|
package/dist/result.mjs
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
export var Result;
|
|
3
|
-
((Result2) => {
|
|
4
|
-
Result2.error = (value) => ({
|
|
5
|
-
_tag: "Error",
|
|
6
|
-
error: value,
|
|
7
|
-
result: void 0
|
|
8
|
-
});
|
|
9
|
-
Result2.result = (value) => ({
|
|
10
|
-
_tag: "Result",
|
|
11
|
-
error: void 0,
|
|
12
|
-
result: value
|
|
13
|
-
});
|
|
14
|
-
})(Result || (Result = {}));
|
package/dist/resultSchemas.mjs
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
export const errorSchema = (error) => {
|
|
3
|
-
const schema = {
|
|
4
|
-
type: "object",
|
|
5
|
-
properties: {
|
|
6
|
-
_tag: {
|
|
7
|
-
const: "Error"
|
|
8
|
-
},
|
|
9
|
-
error,
|
|
10
|
-
result: {
|
|
11
|
-
const: void 0,
|
|
12
|
-
isConstUndefined: true
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
return schema;
|
|
17
|
-
};
|
|
18
|
-
export const resultSchema = (result) => {
|
|
19
|
-
const schema = {
|
|
20
|
-
type: "object",
|
|
21
|
-
properties: {
|
|
22
|
-
_tag: {
|
|
23
|
-
const: "Result"
|
|
24
|
-
},
|
|
25
|
-
error: {
|
|
26
|
-
const: void 0,
|
|
27
|
-
isConstUndefined: true
|
|
28
|
-
},
|
|
29
|
-
result
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
return schema;
|
|
33
|
-
};
|
|
34
|
-
export const endpointErrorSchema = (error) => {
|
|
35
|
-
return {
|
|
36
|
-
type: "object",
|
|
37
|
-
properties: {
|
|
38
|
-
_tag: {
|
|
39
|
-
const: "Error"
|
|
40
|
-
},
|
|
41
|
-
result: {
|
|
42
|
-
const: void 0,
|
|
43
|
-
isConstUndefined: true
|
|
44
|
-
},
|
|
45
|
-
error: {
|
|
46
|
-
type: "object",
|
|
47
|
-
required: [
|
|
48
|
-
"httpStatus",
|
|
49
|
-
"code"
|
|
50
|
-
],
|
|
51
|
-
properties: {
|
|
52
|
-
httpStatus: {
|
|
53
|
-
enum: error.httpStatus
|
|
54
|
-
},
|
|
55
|
-
code: {
|
|
56
|
-
enum: error.code
|
|
57
|
-
},
|
|
58
|
-
message: {
|
|
59
|
-
type: "string"
|
|
60
|
-
},
|
|
61
|
-
details: {
|
|
62
|
-
type: "object",
|
|
63
|
-
additionalProperties: true
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
export const genericEndpointErrorSchema = () => {
|
|
71
|
-
return {
|
|
72
|
-
type: "object",
|
|
73
|
-
properties: {
|
|
74
|
-
_tag: {
|
|
75
|
-
const: "Error"
|
|
76
|
-
},
|
|
77
|
-
result: {
|
|
78
|
-
const: void 0,
|
|
79
|
-
isConstUndefined: true
|
|
80
|
-
},
|
|
81
|
-
error: {
|
|
82
|
-
type: "object",
|
|
83
|
-
required: [
|
|
84
|
-
"httpStatus",
|
|
85
|
-
"code"
|
|
86
|
-
],
|
|
87
|
-
properties: {
|
|
88
|
-
httpStatus: {
|
|
89
|
-
type: "number"
|
|
90
|
-
},
|
|
91
|
-
code: {
|
|
92
|
-
type: "string"
|
|
93
|
-
},
|
|
94
|
-
message: {
|
|
95
|
-
type: "string"
|
|
96
|
-
},
|
|
97
|
-
details: {
|
|
98
|
-
type: "object",
|
|
99
|
-
additionalProperties: true
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
};
|
package/dist/schema.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/dist/security.mjs
DELETED
package/dist/token.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|
package/dist/validation.mjs
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
export const ValidationErrorCode = {
|
|
3
|
-
InvalidProperties: "INVALID_PROPERTIES",
|
|
4
|
-
MissingProperties: "MISSING_PROPERTIES",
|
|
5
|
-
EmptyTarget: "EMPTY_TARGET"
|
|
6
|
-
};
|
|
7
|
-
export const PropertyValidationErrorCode = {
|
|
8
|
-
Missing: "MISSING_PROPERTY",
|
|
9
|
-
Extraneous: "EXTRANEOUS_PROPERTY",
|
|
10
|
-
Unmatching: "UNMATCHING_PROPERTIES",
|
|
11
|
-
ExtraneousElement: "EXTRANEOUS_ELEMENT",
|
|
12
|
-
MoreItemsExpected: "MORE_ITEMS_EXPECTED",
|
|
13
|
-
LessItemsExpected: "LESS_ITEMS_EXPECTED",
|
|
14
|
-
NumericConstraint: "NUMERIC_CONSTRAINT",
|
|
15
|
-
StringConstraint: "STRING_CONSTRAINT",
|
|
16
|
-
ReferenceConstraint: "REFERENCE_CONSTRAINT"
|
|
17
|
-
};
|
|
18
|
-
export const TraverseError = {
|
|
19
|
-
InvalidDocumentId: "INVALID_DOCUMENT_ID",
|
|
20
|
-
InvalidTempfile: "INVALID_TEMPFILE"
|
|
21
|
-
};
|