@aeriajs/types 0.0.42 → 0.0.43

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.
@@ -1,3 +1,6 @@
1
+ export type UserRole = Collections['user']['item']['roles'][number] | 'root' | 'guest';
2
+ export type AccessCondition = readonly UserRole[] | boolean | 'unauthenticated' | 'unauthenticated-only';
3
+ export type AcceptedRole = UserRole | UserRole[] | null | unknown;
1
4
  export declare enum ACErrors {
2
5
  AssetNotFound = "ASSET_NOT_FOUND",
3
6
  AuthenticationError = "AUTHENTICATION_ERROR",
package/dist/api.d.ts CHANGED
@@ -1,17 +1,15 @@
1
1
  import type { ObjectId } from 'mongodb';
2
- import type { Context, Contract, Description, CollectionSecurityPolicy, PackReferences } from '.';
3
- export type AcceptedRole = UserRole | UserRole[] | null | unknown;
2
+ import type { Context, Contract, Description, CollectionSecurityPolicy, PackReferences, AcceptedRole, AccessCondition } from '.';
4
3
  export type Collection<TCollection extends Collection = any> = {
5
4
  description: Description;
6
5
  item?: any;
7
6
  security?: CollectionSecurityPolicy<TCollection>;
8
7
  functions?: Record<string, (payload: any, context: Context, ...args: any[]) => any>;
9
8
  functionContracts?: Record<string, Contract>;
10
- exposedFunctions?: Record<string, readonly string[] | boolean | 'unauthenticated' | 'unauthenticated-only'>;
9
+ exposedFunctions?: Record<string, AccessCondition>;
11
10
  };
12
11
  export type AssetType = keyof Collection;
13
12
  export type FunctionPath = `/${string}/${string}`;
14
- export type UserRole = Collections['user']['item']['roles'][number] | 'root' | 'guest';
15
13
  export type AuthenticatedToken<TAcceptedRole extends AcceptedRole = null> = {
16
14
  authenticated: true;
17
15
  sub: ObjectId;
@@ -3,7 +3,7 @@ export type ContractBase = {
3
3
  builtin?: boolean;
4
4
  };
5
5
  export type ContractRoles = {
6
- roles?: UserRole[];
6
+ roles?: readonly UserRole[] | boolean | 'unauthenticated' | 'unauthenticated-only';
7
7
  };
8
8
  export type Contract = ContractBase & ({
9
9
  response: Property | Property[];
@@ -40,7 +40,7 @@ export type TableLayout<TDescription extends Description> = {
40
40
  }>>;
41
41
  };
42
42
  export type FiltersPreset<TDescription extends Description> = {
43
- name?: string;
43
+ label?: string;
44
44
  icon?: Icon;
45
45
  filters?: Partial<Record<PropertiesWithId<TDescription> | `$${string}`, any>>;
46
46
  table?: readonly PropertiesWithId<TDescription>[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/types",
3
- "version": "0.0.42",
3
+ "version": "0.0.43",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",