@aeriajs/types 0.0.33 → 0.0.35

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.
@@ -4,6 +4,7 @@ export declare enum ACErrors {
4
4
  AuthenticationError = "AUTHENTICATION_ERROR",
5
5
  AuthorizationError = "AUTHORIZATION_ERROR",
6
6
  FunctionNotFound = "FUNCTION_NOT_FOUND",
7
+ FunctionNotExposed = "FUNCTION_NOT_EXPOSED",
7
8
  ImmutabilityIncorrectChild = "IMMUTABILITY_INCORRECT_CHILD",
8
9
  ImmutabilityParentNotFound = "IMMUTABILITY_PARENT_NOT_FOUND",
9
10
  ImmutabilityTargetImmutable = "IMMUTABILITY_TARGET_IMMUTABLE",
@@ -7,6 +7,7 @@ var ACErrors;
7
7
  ACErrors["AuthenticationError"] = "AUTHENTICATION_ERROR";
8
8
  ACErrors["AuthorizationError"] = "AUTHORIZATION_ERROR";
9
9
  ACErrors["FunctionNotFound"] = "FUNCTION_NOT_FOUND";
10
+ ACErrors["FunctionNotExposed"] = "FUNCTION_NOT_EXPOSED";
10
11
  ACErrors["ImmutabilityIncorrectChild"] = "IMMUTABILITY_INCORRECT_CHILD";
11
12
  ACErrors["ImmutabilityParentNotFound"] = "IMMUTABILITY_PARENT_NOT_FOUND";
12
13
  ACErrors["ImmutabilityTargetImmutable"] = "IMMUTABILITY_TARGET_IMMUTABLE";
@@ -19,6 +20,7 @@ exports.ACErrorMessages = {
19
20
  [ACErrors.AuthenticationError]: 'you have insufficient privileges',
20
21
  [ACErrors.AuthorizationError]: 'you have insufficient privileges',
21
22
  [ACErrors.FunctionNotFound]: 'function not found',
23
+ [ACErrors.FunctionNotExposed]: 'function not exposed',
22
24
  [ACErrors.ImmutabilityIncorrectChild]: 'specified limit is invalid',
23
25
  [ACErrors.ImmutabilityParentNotFound]: 'specified limit is invalid',
24
26
  [ACErrors.ImmutabilityTargetImmutable]: 'specified limit is invalid',
@@ -4,6 +4,7 @@ export var ACErrors = /* @__PURE__ */ ((ACErrors2) => {
4
4
  ACErrors2["AuthenticationError"] = "AUTHENTICATION_ERROR";
5
5
  ACErrors2["AuthorizationError"] = "AUTHORIZATION_ERROR";
6
6
  ACErrors2["FunctionNotFound"] = "FUNCTION_NOT_FOUND";
7
+ ACErrors2["FunctionNotExposed"] = "FUNCTION_NOT_EXPOSED";
7
8
  ACErrors2["ImmutabilityIncorrectChild"] = "IMMUTABILITY_INCORRECT_CHILD";
8
9
  ACErrors2["ImmutabilityParentNotFound"] = "IMMUTABILITY_PARENT_NOT_FOUND";
9
10
  ACErrors2["ImmutabilityTargetImmutable"] = "IMMUTABILITY_TARGET_IMMUTABLE";
@@ -17,6 +18,7 @@ export const ACErrorMessages = {
17
18
  ["AUTHENTICATION_ERROR" /* AuthenticationError */]: "you have insufficient privileges",
18
19
  ["AUTHORIZATION_ERROR" /* AuthorizationError */]: "you have insufficient privileges",
19
20
  ["FUNCTION_NOT_FOUND" /* FunctionNotFound */]: "function not found",
21
+ ["FUNCTION_NOT_EXPOSED" /* FunctionNotExposed */]: "function not exposed",
20
22
  ["IMMUTABILITY_INCORRECT_CHILD" /* ImmutabilityIncorrectChild */]: "specified limit is invalid",
21
23
  ["IMMUTABILITY_PARENT_NOT_FOUND" /* ImmutabilityParentNotFound */]: "specified limit is invalid",
22
24
  ["IMMUTABILITY_TARGET_IMMUTABLE" /* ImmutabilityTargetImmutable */]: "specified limit is invalid",
package/dist/api.d.ts CHANGED
@@ -1,13 +1,14 @@
1
1
  import type { ObjectId } from 'mongodb';
2
- import type { Context, Contract, Description, CollectionSecurityPolicy, AccessControl, PackReferences } from '.';
2
+ import type { Context, Contract, Description, CollectionSecurityPolicy, AccessControl, PackReferences, FunctionAttributes } from '.';
3
3
  export type AcceptedRole = UserRole | UserRole[] | null | unknown;
4
4
  export type Collection<TCollection extends Collection = any> = {
5
5
  description: Description;
6
6
  item?: any;
7
7
  security?: CollectionSecurityPolicy<TCollection>;
8
8
  accessControl?: AccessControl<TCollection>;
9
- functions?: Record<string, (payload: any, context: Context, ...args: any[]) => any>;
9
+ functions?: Record<string, ((payload: any, context: Context, ...args: any[]) => any) & Partial<FunctionAttributes>>;
10
10
  functionContracts?: Record<string, Contract>;
11
+ exposedFunctions?: string[];
11
12
  };
12
13
  export type AssetType = keyof Collection;
13
14
  export type FunctionPath = `/${string}/${string}`;
package/dist/config.d.ts CHANGED
@@ -18,14 +18,14 @@ export type ApiConfig = {
18
18
  username: string;
19
19
  password: string;
20
20
  };
21
- allowSignup?: boolean;
22
- signupDefaults?: Partial<{
23
- roles: string[];
24
- active: boolean;
25
- }>;
26
- security?: {
21
+ security: {
27
22
  logSuccessfulAuthentications?: boolean;
28
23
  authenticationRateLimiting?: RateLimitingParams | null;
24
+ allowSignup?: boolean;
25
+ signupDefaults?: Partial<{
26
+ roles: string[];
27
+ active: boolean;
28
+ }>;
29
29
  };
30
30
  tokenUserProperties?: string[];
31
31
  errorHandler?: <TError extends Error>(context: RouteContext, error: TError) => any | Promise<any>;
package/dist/context.d.ts CHANGED
@@ -9,7 +9,7 @@ type UnionFunctions<TFunctions, TSchema extends CollectionDocument<any>> = {
9
9
  };
10
10
  export type IndepthCollection<TCollection> = TCollection extends {
11
11
  description: infer InferredDescription;
12
- functions: infer CollFunctions;
12
+ functions?: infer CollFunctions;
13
13
  } ? Omit<TCollection, 'functions'> & {
14
14
  functions: UnionFunctions<CollFunctions, SchemaWithId<InferredDescription>>;
15
15
  originalFunctions: CollFunctions;
@@ -80,4 +80,7 @@ export type CollectionFunctionsPaginated<TDocument extends CollectionDocument<Op
80
80
  pagination: Pagination;
81
81
  }>;
82
82
  };
83
+ export type FunctionAttributes = {
84
+ exposed?: boolean;
85
+ };
83
86
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/types",
3
- "version": "0.0.33",
3
+ "version": "0.0.35",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",