@aeriajs/types 0.0.110 → 0.0.112

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.
@@ -12,5 +12,6 @@ export declare enum ACError {
12
12
  ResourceNotFound = "RESOURCE_NOT_FOUND",
13
13
  InsecureOperator = "INSECURE_OPERATOR",
14
14
  MalformedInput = "MALFORMED_INPUT",
15
+ UniquenessViolated = "UNIQUENESS_VIOLATED",
15
16
  UnknownError = "UNKNOWN_ERROR"
16
17
  }
@@ -13,5 +13,6 @@ var ACError;
13
13
  ACError["ResourceNotFound"] = "RESOURCE_NOT_FOUND";
14
14
  ACError["InsecureOperator"] = "INSECURE_OPERATOR";
15
15
  ACError["MalformedInput"] = "MALFORMED_INPUT";
16
+ ACError["UniquenessViolated"] = "UNIQUENESS_VIOLATED";
16
17
  ACError["UnknownError"] = "UNKNOWN_ERROR";
17
18
  })(ACError || (exports.ACError = ACError = {}));
@@ -10,6 +10,7 @@ export var ACError = /* @__PURE__ */ ((ACError2) => {
10
10
  ACError2["ResourceNotFound"] = "RESOURCE_NOT_FOUND";
11
11
  ACError2["InsecureOperator"] = "INSECURE_OPERATOR";
12
12
  ACError2["MalformedInput"] = "MALFORMED_INPUT";
13
+ ACError2["UniquenessViolated"] = "UNIQUENESS_VIOLATED";
13
14
  ACError2["UnknownError"] = "UNKNOWN_ERROR";
14
15
  return ACError2;
15
16
  })(ACError || {});
package/dist/config.d.ts CHANGED
@@ -31,6 +31,7 @@ export type ApiConfig = {
31
31
  logSuccessfulAuthentications?: boolean;
32
32
  authenticationRateLimiting?: RateLimitingParams | null;
33
33
  allowSignup?: boolean;
34
+ mutableUserProperties: (keyof CollectionItem<'user'>)[];
34
35
  signupDefaults?: {
35
36
  roles?: string[];
36
37
  active?: boolean;
@@ -3,7 +3,7 @@ import type { PhosphorIcon } from '@phosphor-icons/core';
3
3
  import type { Condition } from './condition.js';
4
4
  import type { JsonSchema, PropertiesWithId } from './property.js';
5
5
  import type { OwnershipMode } from './security.js';
6
- export type DescriptionPreset = 'crud' | 'duplicate' | 'remove' | 'removeAll' | 'owned' | 'timestamped' | 'view';
6
+ export type DescriptionPreset = 'add' | 'crud' | 'duplicate' | 'remove' | 'removeAll' | 'owned' | 'timestamped' | 'view';
7
7
  export type Icon = PhosphorIcon['name'];
8
8
  export type CollectionActionRoute = {
9
9
  route: {
@@ -92,8 +92,9 @@ export type Description<TDescription extends Description = any> = JsonSchema<TDe
92
92
  indexes?: readonly PropertiesWithId<TDescription>[];
93
93
  defaults?: Record<string, unknown>;
94
94
  owned?: OwnershipMode;
95
+ unique?: readonly Extract<keyof TDescription['properties'], string>[];
95
96
  temporary?: {
96
- index: keyof TDescription['properties'];
97
+ index: Extract<keyof TDescription['properties'], string>;
97
98
  expireAfterSeconds: number;
98
99
  };
99
100
  timestamps?: false;
@@ -15,10 +15,10 @@ export declare const insertError: () => {
15
15
  readonly required: readonly ["httpStatus", "code"];
16
16
  readonly properties: {
17
17
  readonly httpStatus: {
18
- readonly enum: [HTTPStatus.Forbidden, HTTPStatus.NotFound, HTTPStatus.UnprocessableContent, HTTPStatus.BadRequest];
18
+ readonly enum: [HTTPStatus.Forbidden, HTTPStatus.NotFound, HTTPStatus.UnprocessableContent, HTTPStatus.BadRequest, HTTPStatus.InternalServerError];
19
19
  };
20
20
  readonly code: {
21
- readonly enum: [ACError.InsecureOperator, ACError.OwnershipError, ACError.ResourceNotFound, ACError.TargetImmutable, ACError.MalformedInput, ValidationErrorCode.EmptyTarget, ValidationErrorCode.InvalidProperties, ValidationErrorCode.MissingProperties, TraverseError.InvalidDocumentId, TraverseError.InvalidTempfile];
21
+ readonly enum: [ACError.InsecureOperator, ACError.OwnershipError, ACError.ResourceNotFound, ACError.TargetImmutable, ACError.MalformedInput, ACError.UniquenessViolated, ValidationErrorCode.EmptyTarget, ValidationErrorCode.InvalidProperties, ValidationErrorCode.MissingProperties, TraverseError.InvalidDocumentId, TraverseError.InvalidTempfile];
22
22
  };
23
23
  readonly message: {
24
24
  readonly type: "string";
@@ -11,6 +11,7 @@ const insertError = () => (0, resultSchemas_js_1.endpointErrorSchema)({
11
11
  http_js_1.HTTPStatus.NotFound,
12
12
  http_js_1.HTTPStatus.UnprocessableContent,
13
13
  http_js_1.HTTPStatus.BadRequest,
14
+ http_js_1.HTTPStatus.InternalServerError,
14
15
  ],
15
16
  code: [
16
17
  accessControl_js_1.ACError.InsecureOperator,
@@ -18,6 +19,7 @@ const insertError = () => (0, resultSchemas_js_1.endpointErrorSchema)({
18
19
  accessControl_js_1.ACError.ResourceNotFound,
19
20
  accessControl_js_1.ACError.TargetImmutable,
20
21
  accessControl_js_1.ACError.MalformedInput,
22
+ accessControl_js_1.ACError.UniquenessViolated,
21
23
  validation_js_1.ValidationErrorCode.EmptyTarget,
22
24
  validation_js_1.ValidationErrorCode.InvalidProperties,
23
25
  validation_js_1.ValidationErrorCode.MissingProperties,
@@ -8,7 +8,8 @@ export const insertError = () => endpointErrorSchema({
8
8
  HTTPStatus.Forbidden,
9
9
  HTTPStatus.NotFound,
10
10
  HTTPStatus.UnprocessableContent,
11
- HTTPStatus.BadRequest
11
+ HTTPStatus.BadRequest,
12
+ HTTPStatus.InternalServerError
12
13
  ],
13
14
  code: [
14
15
  ACError.InsecureOperator,
@@ -16,6 +17,7 @@ export const insertError = () => endpointErrorSchema({
16
17
  ACError.ResourceNotFound,
17
18
  ACError.TargetImmutable,
18
19
  ACError.MalformedInput,
20
+ ACError.UniquenessViolated,
19
21
  ValidationErrorCode.EmptyTarget,
20
22
  ValidationErrorCode.InvalidProperties,
21
23
  ValidationErrorCode.MissingProperties,
@@ -6,8 +6,8 @@ export type PropertyArrayElement = 'checkbox' | 'radio' | 'select';
6
6
  export type PropertyInputType = 'text' | 'email' | 'password' | 'search' | 'time' | 'month';
7
7
  export type PropertyInputElement = 'input' | 'textarea';
8
8
  export type PropertyFormat = 'date' | 'date-time' | 'objectid';
9
- export type PropertiesWithId<TSchema extends JsonSchema> = Extract<keyof TSchema['properties'], string> | '_id';
10
- export type RequiredProperties<TSchema extends JsonSchema> = readonly PropertiesWithId<TSchema>[] | Partial<Record<PropertiesWithId<TSchema>, Condition<TSchema> | boolean>>;
9
+ export type PropertiesWithId<TJsonSchema extends JsonSchema> = Extract<keyof TJsonSchema['properties'], string> | '_id';
10
+ export type RequiredProperties<TJsonSchema extends JsonSchema> = readonly PropertiesWithId<TJsonSchema>[] | Partial<Record<PropertiesWithId<TJsonSchema>, Condition<TJsonSchema> | boolean>>;
11
11
  export type JsonSchema<TJsonSchema extends JsonSchema = any> = {
12
12
  $id: string;
13
13
  type?: 'object';
@@ -111,7 +111,6 @@ export type PropertyBase = {
111
111
  noForm?: boolean;
112
112
  noLabel?: boolean;
113
113
  hidden?: boolean;
114
- unique?: boolean;
115
114
  isTimestamp?: boolean;
116
115
  };
117
116
  export type Property = PropertyBase & MixedProperty;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/types",
3
- "version": "0.0.110",
3
+ "version": "0.0.112",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",