@aeriajs/types 0.0.87 → 0.0.89

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.
@@ -3,7 +3,7 @@ export type FinalOperator = 'equal' | 'in' | 'gt' | 'lt' | 'gte' | 'lte';
3
3
  export type FinalCondition<TSchema extends JsonSchema> = {
4
4
  operator: FinalOperator;
5
5
  term1: PropertiesWithId<TSchema>;
6
- term2: unknown;
6
+ term2: string | boolean | number | Condition;
7
7
  fromState?: boolean;
8
8
  };
9
9
  export type RegexCondition<TSchema extends JsonSchema> = {
package/dist/config.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import type { RouteContext } from './context.js';
2
2
  import type { RouteUri } from './http.js';
3
3
  import type { RateLimitingParams } from './security.js';
4
+ import type { CollectionItem } from './collection.js';
4
5
  export type ApiConfig = {
6
+ name?: string;
5
7
  secret?: string;
6
8
  baseUrl?: RouteUri;
7
9
  publicUrl?: string;
@@ -21,16 +23,17 @@ export type ApiConfig = {
21
23
  password: string;
22
24
  };
23
25
  security: {
26
+ tokenExpiration?: number;
24
27
  logSuccessfulAuthentications?: boolean;
25
28
  authenticationRateLimiting?: RateLimitingParams | null;
26
29
  allowSignup?: boolean;
27
- signupDefaults?: Partial<{
28
- roles: string[];
29
- active: boolean;
30
- }>;
30
+ signupDefaults?: {
31
+ roles?: string[];
32
+ active?: boolean;
33
+ };
31
34
  paginationLimit?: number;
32
35
  exposeFunctionsByDefault?: boolean | 'unauthenticated';
33
36
  };
34
- tokenUserProperties?: string[];
37
+ tokenUserProperties?: (keyof CollectionItem<'user'>)[];
35
38
  errorHandler?: <TError>(context: RouteContext, error: TError) => unknown | Promise<unknown>;
36
39
  };
package/dist/context.d.ts CHANGED
@@ -54,7 +54,6 @@ export type RouteContext<TAcceptedRole extends AcceptedRole = null> = {
54
54
  }>>;
55
55
  config: ApiConfig;
56
56
  inherited: boolean;
57
- calledFunction: string;
58
57
  };
59
58
  export type CollectionContext<TDescription extends Description, TFunctions = Collection['functions']> = {
60
59
  description: TDescription;
@@ -63,6 +62,7 @@ export type CollectionContext<TDescription extends Description, TFunctions = Col
63
62
  description: TDescription;
64
63
  functions: TFunctions;
65
64
  }> : IndepthCollection<any>;
65
+ calledFunction?: string;
66
66
  };
67
67
  export type Context<TDescription extends Description = Description, TFunctions = Collection['functions']> = RouteContext & CollectionContext<TDescription, TFunctions>;
68
68
  export type StrictContext<TAcceptedRole extends AcceptedRole = null, TDescription extends Description = any, TFunctions = Collection['functions']> = RouteContext<TAcceptedRole> & CollectionContext<TDescription, TFunctions>;
@@ -69,7 +69,7 @@ export type RemoveFilePayload = UploadAuxProps & {
69
69
  _id: ObjectId | string;
70
70
  };
71
71
  };
72
- export type InsertReturnType<TDocument> = Result.Either<StrictEndpointError<ACError.InsecureOperator | ACError.OwnershipError | ACError.ResourceNotFound | ACError.TargetImmutable | ValidationErrorCode | TraverseError.InvalidDocumentId | TraverseError.InvalidTempfile, unknown, HTTPStatus.Forbidden | HTTPStatus.NotFound | HTTPStatus.UnprocessableContent>, TDocument>;
72
+ export type InsertReturnType<TDocument> = Result.Either<StrictEndpointError<ACError.InsecureOperator | ACError.OwnershipError | ACError.ResourceNotFound | ACError.TargetImmutable | ACError.MalformedInput | ValidationErrorCode | TraverseError.InvalidDocumentId | TraverseError.InvalidTempfile, unknown, HTTPStatus.Forbidden | HTTPStatus.NotFound | HTTPStatus.UnprocessableContent | HTTPStatus.BadRequest>, TDocument>;
73
73
  export type GetReturnType<TDocument> = Result.Either<StrictEndpointError<ACError.ResourceNotFound | ACError.OwnershipError | ACError.MalformedInput, unknown, HTTPStatus.Forbidden | HTTPStatus.NotFound | HTTPStatus.BadRequest>, TDocument>;
74
74
  export type CountReturnType = Result.Either<EndpointError, number>;
75
75
  export type GetAllReturnType<TDocument> = Result.Either<EndpointError, TDocument[]>;
package/dist/schema.d.ts CHANGED
@@ -43,8 +43,8 @@ export type InferProperty<T> = T extends TestType<{
43
43
  export type InferSchema<TSchema> = MergeReferences<TSchema> extends infer MappedTypes ? TSchema extends {
44
44
  Required: readonly [];
45
45
  } ? Partial<MappedTypes> : TSchema extends {
46
- required: infer RequiredPropNames;
47
- } ? RequiredPropNames extends readonly (keyof MappedTypes)[] ? Pick<MappedTypes, RequiredPropNames[number]> extends infer RequiredProps ? RequiredProps & Partial<Exclude<MappedTypes, keyof RequiredProps>> : never : MappedTypes : MappedTypes : never;
46
+ required: infer InferredRequired;
47
+ } ? InferredRequired extends readonly (keyof MappedTypes)[] ? Pick<MappedTypes, InferredRequired[number]> extends infer RequiredProps ? RequiredProps & Partial<Exclude<MappedTypes, keyof RequiredProps>> : never : MappedTypes : MappedTypes : never;
48
48
  export type Schema<TSchema> = CaseTimestamped<TSchema, CaseOwned<TSchema, InferSchema<TSchema>>>;
49
49
  export type SchemaWithId<TSchema> = Schema<TSchema> & {
50
50
  _id: ObjectId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/types",
3
- "version": "0.0.87",
3
+ "version": "0.0.89",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",