@aeriajs/types 0.0.66 → 0.0.68
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/functions.d.ts +3 -3
- package/dist/validation.d.ts +4 -0
- package/dist/validation.js +6 -1
- package/dist/validation.mjs +5 -0
- package/package.json +1 -1
package/dist/functions.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Result } from './result.js';
|
|
|
3
3
|
import type { EndpointError, StrictEndpointError } from './endpointError.js';
|
|
4
4
|
import type { PackReferences } from './schema.js';
|
|
5
5
|
import type { ACError } from './accessControl.js';
|
|
6
|
-
import type { ValidationErrorCode } from './validation.js';
|
|
6
|
+
import type { ValidationErrorCode, TraverseError } from './validation.js';
|
|
7
7
|
import type { HTTPStatus, WithACErrors } from './http.js';
|
|
8
8
|
export type UploadAuxProps = {
|
|
9
9
|
parentId: string;
|
|
@@ -36,7 +36,7 @@ export type What<TDocument> = ({
|
|
|
36
36
|
} & Omit<PackReferences<TDocument>, '_id'>) extends infer Document ? {
|
|
37
37
|
[P in keyof Document]: Document[P] | null;
|
|
38
38
|
} : never;
|
|
39
|
-
export type Projection<TDocument> = keyof TDocument | '_id' extends infer DocumentProp ? DocumentProp extends string ? DocumentProp[] : string[] : never;
|
|
39
|
+
export type Projection<TDocument> = keyof TDocument | '_id' extends infer DocumentProp ? [DocumentProp] extends [string] ? DocumentProp[] : string[] : never;
|
|
40
40
|
export type QuerySort<TDocument> = Partial<Record<keyof WithId<TDocument>, 1 | -1>>;
|
|
41
41
|
export type CollectionDocument<TDocument> = TDocument;
|
|
42
42
|
export type CountPayload<TDocument extends CollectionDocument<OptionalId<any>>> = {
|
|
@@ -70,7 +70,7 @@ export type RemoveFilePayload = UploadAuxProps & {
|
|
|
70
70
|
_id: any;
|
|
71
71
|
};
|
|
72
72
|
};
|
|
73
|
-
export type InsertReturnType<TDocument> = Result.Either<StrictEndpointError<ACError.InsecureOperator | ACError.OwnershipError | ACError.ResourceNotFound | ACError.TargetImmutable | ValidationErrorCode, unknown, HTTPStatus.NotFound | HTTPStatus.UnprocessableContent>, TDocument>;
|
|
73
|
+
export type InsertReturnType<TDocument> = Result.Either<StrictEndpointError<ACError.InsecureOperator | ACError.OwnershipError | ACError.ResourceNotFound | ACError.TargetImmutable | ValidationErrorCode | TraverseError.InvalidDocumentId | TraverseError.InvalidTempfile, unknown, HTTPStatus.NotFound | HTTPStatus.UnprocessableContent>, TDocument>;
|
|
74
74
|
export type GetReturnType<TDocument> = Result.Either<StrictEndpointError<ACError.ResourceNotFound | ACError.MalformedInput, unknown, HTTPStatus.NotFound | HTTPStatus.BadRequest>, TDocument>;
|
|
75
75
|
export type CountReturnType = Result.Either<EndpointError, number>;
|
|
76
76
|
export type GetAllReturnType<TDocument> = Result.Either<EndpointError, TDocument[]>;
|
package/dist/validation.d.ts
CHANGED
|
@@ -10,6 +10,10 @@ export declare enum PropertyValidationErrorCode {
|
|
|
10
10
|
ExtraneousElement = "EXTRANEOUS_ELEMENT",
|
|
11
11
|
NumericConstraint = "NUMERIC_CONSTRAINT"
|
|
12
12
|
}
|
|
13
|
+
export declare enum TraverseError {
|
|
14
|
+
InvalidDocumentId = "INVALID_DOCUMENT_ID",
|
|
15
|
+
InvalidTempfile = "INVALID_TEMPFILE"
|
|
16
|
+
}
|
|
13
17
|
export type PropertyValidationError = {
|
|
14
18
|
type: PropertyValidationErrorCode;
|
|
15
19
|
index?: number;
|
package/dist/validation.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PropertyValidationErrorCode = exports.ValidationErrorCode = void 0;
|
|
3
|
+
exports.TraverseError = exports.PropertyValidationErrorCode = exports.ValidationErrorCode = void 0;
|
|
4
4
|
var ValidationErrorCode;
|
|
5
5
|
(function (ValidationErrorCode) {
|
|
6
6
|
ValidationErrorCode["InvalidProperties"] = "INVALID_PROPERTIES";
|
|
@@ -15,3 +15,8 @@ var PropertyValidationErrorCode;
|
|
|
15
15
|
PropertyValidationErrorCode["ExtraneousElement"] = "EXTRANEOUS_ELEMENT";
|
|
16
16
|
PropertyValidationErrorCode["NumericConstraint"] = "NUMERIC_CONSTRAINT";
|
|
17
17
|
})(PropertyValidationErrorCode || (exports.PropertyValidationErrorCode = PropertyValidationErrorCode = {}));
|
|
18
|
+
var TraverseError;
|
|
19
|
+
(function (TraverseError) {
|
|
20
|
+
TraverseError["InvalidDocumentId"] = "INVALID_DOCUMENT_ID";
|
|
21
|
+
TraverseError["InvalidTempfile"] = "INVALID_TEMPFILE";
|
|
22
|
+
})(TraverseError || (exports.TraverseError = TraverseError = {}));
|
package/dist/validation.mjs
CHANGED
|
@@ -13,3 +13,8 @@ export var PropertyValidationErrorCode = /* @__PURE__ */ ((PropertyValidationErr
|
|
|
13
13
|
PropertyValidationErrorCode2["NumericConstraint"] = "NUMERIC_CONSTRAINT";
|
|
14
14
|
return PropertyValidationErrorCode2;
|
|
15
15
|
})(PropertyValidationErrorCode || {});
|
|
16
|
+
export var TraverseError = /* @__PURE__ */ ((TraverseError2) => {
|
|
17
|
+
TraverseError2["InvalidDocumentId"] = "INVALID_DOCUMENT_ID";
|
|
18
|
+
TraverseError2["InvalidTempfile"] = "INVALID_TEMPFILE";
|
|
19
|
+
return TraverseError2;
|
|
20
|
+
})(TraverseError || {});
|