@aeriajs/types 0.0.73 → 0.0.74
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/collection.d.ts +2 -1
- package/dist/description.d.ts +1 -1
- package/dist/property.d.ts +2 -1
- package/dist/security.d.ts +14 -0
- package/package.json +1 -1
package/dist/collection.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AccessCondition } from './accessControl.js';
|
|
2
|
-
import type { CollectionSecurityPolicy } from './security.js';
|
|
2
|
+
import type { CollectionSecurityPolicy, CollectionMiddleware } from './security.js';
|
|
3
3
|
import type { Context } from './context.js';
|
|
4
4
|
import type { Contract } from './contract.js';
|
|
5
5
|
import type { Description } from './description.js';
|
|
@@ -10,6 +10,7 @@ export type Collection<TCollection extends Collection = any> = {
|
|
|
10
10
|
contracts?: Record<string, Contract>;
|
|
11
11
|
exposedFunctions?: Record<string, AccessCondition>;
|
|
12
12
|
security?: CollectionSecurityPolicy<TCollection>;
|
|
13
|
+
middlewares?: CollectionMiddleware | CollectionMiddleware[];
|
|
13
14
|
};
|
|
14
15
|
export type CollectionItem<TCollectionName extends keyof Collections> = Omit<Collections[TCollectionName]['item'], '_id'>;
|
|
15
16
|
export type CollectionItemWithId<TCollectionName extends keyof Collections> = Collections[TCollectionName]['item'];
|
package/dist/description.d.ts
CHANGED
|
@@ -63,8 +63,8 @@ export type FiltersPreset<TDescription extends Description> = {
|
|
|
63
63
|
};
|
|
64
64
|
export type LayoutName = 'tabular' | 'grid' | 'list';
|
|
65
65
|
export type LayoutOptions<TDescription extends Description = any> = {
|
|
66
|
-
picture?: PropertiesWithId<TDescription>;
|
|
67
66
|
title?: PropertiesWithId<TDescription>;
|
|
67
|
+
picture?: PropertiesWithId<TDescription>;
|
|
68
68
|
badge?: PropertiesWithId<TDescription>;
|
|
69
69
|
information?: PropertiesWithId<TDescription>;
|
|
70
70
|
active?: PropertiesWithId<TDescription>;
|
package/dist/property.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { PhosphorIcon } from '@phosphor-icons/core';
|
|
|
2
2
|
import type { Condition } from './condition.js';
|
|
3
3
|
export type PropertyArrayElement = 'checkbox' | 'radio' | 'select';
|
|
4
4
|
export type PropertyInputType = 'text' | 'email' | 'password' | 'search' | 'time' | 'month';
|
|
5
|
+
export type PropertyInputElement = 'input' | 'textarea';
|
|
5
6
|
export type PropertyFormat = 'date' | 'date-time';
|
|
6
7
|
export type PropertiesWithId<TSchema extends JsonSchema> = keyof TSchema['properties'] | '_id';
|
|
7
8
|
export type RequiredProperties<TSchema extends JsonSchema> = readonly PropertiesWithId<TSchema>[] | Partial<Record<PropertiesWithId<TSchema>, Condition<TSchema> | boolean>>;
|
|
@@ -70,7 +71,7 @@ export type StringProperty = {
|
|
|
70
71
|
mask?: string | readonly string[];
|
|
71
72
|
maskedValue?: boolean;
|
|
72
73
|
placeholder?: string;
|
|
73
|
-
element?:
|
|
74
|
+
element?: PropertyInputElement;
|
|
74
75
|
inputType?: PropertyInputType;
|
|
75
76
|
};
|
|
76
77
|
export type NumberProperty = {
|
package/dist/security.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { Result } from './result.js';
|
|
2
|
+
import type { Context } from './context.js';
|
|
3
|
+
import type { ACError } from './accessControl.js';
|
|
1
4
|
export type OwnershipMode = boolean | 'always' | 'on-write';
|
|
2
5
|
export declare enum RateLimitingError {
|
|
3
6
|
Unauthenticated = "UNAUTHENTICATED",
|
|
@@ -29,3 +32,14 @@ export type CollectionSecurityPolicy<TCollection extends {
|
|
|
29
32
|
}> = {
|
|
30
33
|
functions?: Partial<Record<keyof TCollection['functions'], SecurityPolicy>>;
|
|
31
34
|
};
|
|
35
|
+
export type CollectionHookProps<TPayload = any> = {
|
|
36
|
+
propertyName?: string;
|
|
37
|
+
parentId?: string;
|
|
38
|
+
childId?: string;
|
|
39
|
+
payload: TPayload;
|
|
40
|
+
};
|
|
41
|
+
export type CollectionHook<TPayload = any> = (props: CollectionHookProps, context: Context) => Promise<Result.Either<ACError, TPayload>>;
|
|
42
|
+
export type CollectionMiddleware = {
|
|
43
|
+
beforeRead: CollectionHook;
|
|
44
|
+
beforeWrite: CollectionHook;
|
|
45
|
+
};
|