@forestadmin/datasource-customizer 1.5.7 → 1.5.9
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-customizer.js +4 -4
- package/dist/context/agent-context.d.ts +1 -1
- package/dist/context/agent-context.js +4 -4
- package/dist/context/collection-context.d.ts +1 -1
- package/dist/context/collection-context.js +4 -4
- package/dist/context/relaxed-wrappers/datasource.d.ts +1 -1
- package/dist/context/relaxed-wrappers/datasource.js +1 -1
- package/dist/datasource-customizer.js +5 -5
- package/dist/decorators/actions/collection.d.ts +1 -1
- package/dist/decorators/actions/collection.js +2 -2
- package/dist/decorators/actions/context/single.d.ts +1 -1
- package/dist/decorators/actions/context/single.js +1 -1
- package/dist/decorators/actions/types/actions.d.ts +5 -5
- package/dist/decorators/actions/types/actions.js +1 -1
- package/dist/decorators/actions/types/fields.d.ts +10 -10
- package/dist/decorators/chart/collection.d.ts +1 -1
- package/dist/decorators/chart/collection.js +2 -2
- package/dist/decorators/chart/context.js +5 -5
- package/dist/decorators/chart/datasource.d.ts +1 -1
- package/dist/decorators/chart/datasource.js +7 -7
- package/dist/decorators/chart/types.d.ts +4 -4
- package/dist/decorators/collection-decorator.js +12 -12
- package/dist/decorators/computed/collection.d.ts +1 -1
- package/dist/decorators/computed/collection.js +3 -3
- package/dist/decorators/computed/utils/deduplication.js +1 -1
- package/dist/decorators/datasource-decorator.d.ts +1 -1
- package/dist/decorators/datasource-decorator.js +4 -4
- package/dist/decorators/hook/collection.d.ts +1 -1
- package/dist/decorators/hook/collection.js +2 -2
- package/dist/decorators/hook/context/aggregate.d.ts +1 -1
- package/dist/decorators/hook/context/aggregate.js +1 -1
- package/dist/decorators/hook/context/create.d.ts +1 -1
- package/dist/decorators/hook/context/create.js +1 -1
- package/dist/decorators/hook/context/delete.d.ts +1 -1
- package/dist/decorators/hook/context/delete.js +1 -1
- package/dist/decorators/hook/context/list.d.ts +1 -1
- package/dist/decorators/hook/context/list.js +1 -1
- package/dist/decorators/hook/context/update.d.ts +1 -1
- package/dist/decorators/hook/context/update.js +1 -1
- package/dist/decorators/hook/types.d.ts +5 -5
- package/dist/decorators/hook/types.js +1 -1
- package/dist/decorators/operators-emulate/collection.d.ts +1 -1
- package/dist/decorators/operators-emulate/collection.js +1 -1
- package/dist/decorators/operators-emulate/types.d.ts +1 -1
- package/dist/decorators/relation/collection.d.ts +1 -1
- package/dist/decorators/relation/collection.js +1 -1
- package/dist/decorators/relation/types.d.ts +2 -2
- package/dist/decorators/rename-collection/collection.d.ts +1 -1
- package/dist/decorators/rename-collection/collection.js +1 -1
- package/dist/decorators/rename-collection/datasource.d.ts +1 -1
- package/dist/decorators/rename-collection/datasource.js +2 -2
- package/dist/decorators/search/collection.d.ts +1 -1
- package/dist/decorators/search/collection.js +1 -1
- package/dist/decorators/search/types.d.ts +1 -1
- package/dist/decorators/segment/collection.d.ts +1 -1
- package/dist/decorators/segment/collection.js +1 -1
- package/dist/decorators/segment/types.d.ts +1 -1
- package/dist/decorators/validation/collection.d.ts +1 -1
- package/dist/decorators/write/datasource.d.ts +1 -1
- package/dist/decorators/write/datasource.js +2 -2
- package/dist/decorators/write/write-replace/collection.d.ts +1 -1
- package/dist/decorators/write/write-replace/collection.js +2 -2
- package/dist/decorators/write/write-replace/types.d.ts +2 -2
- package/dist/templates.d.ts +18 -18
- package/dist/types.d.ts +3 -3
- package/package.json +7 -7
package/dist/templates.d.ts
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
import { AggregationOperation, Aggregator, DateOperation, Operator, PlainPage, RecordData } from '@forestadmin/datasource-toolkit';
|
|
2
|
-
|
|
2
|
+
type RecursivePartial<T> = {
|
|
3
3
|
[P in keyof T]?: T[P] extends (infer U)[] ? RecursivePartial<U>[] : T[P] extends object ? RecursivePartial<T[P]> : T[P];
|
|
4
4
|
};
|
|
5
5
|
/** Global schema which is generated by agent */
|
|
6
|
-
export
|
|
6
|
+
export type TSchema = Record<string, {
|
|
7
7
|
plain: RecordData;
|
|
8
8
|
nested: RecordData;
|
|
9
9
|
flat: RecordData;
|
|
10
10
|
}>;
|
|
11
11
|
/** Collection name */
|
|
12
|
-
export
|
|
12
|
+
export type TCollectionName<S extends TSchema> = Extract<keyof S, string>;
|
|
13
13
|
/** Column name (no relations) */
|
|
14
|
-
export
|
|
14
|
+
export type TColumnName<S extends TSchema, N extends TCollectionName<S>> = Extract<keyof S[N]['plain'], string>;
|
|
15
15
|
/** Field name (with relations) */
|
|
16
|
-
export
|
|
16
|
+
export type TFieldName<S extends TSchema, N extends TCollectionName<S>> = Extract<keyof S[N]['plain'] | keyof S[N]['flat'], string>;
|
|
17
17
|
/** Type of a given field */
|
|
18
|
-
export
|
|
18
|
+
export type TFieldType<S extends TSchema = TSchema, N extends TCollectionName<S> = TCollectionName<S>, C extends TFieldName<S, N> = TFieldName<S, N>> = (S[N]['plain'] & S[N]['flat'])[C];
|
|
19
19
|
/** Row type only with columns (all required) */
|
|
20
|
-
export
|
|
20
|
+
export type TSimpleRow<S extends TSchema = TSchema, N extends TCollectionName<S> = TCollectionName<S>> = S[N]['plain'];
|
|
21
21
|
/** Row type only with columns (all optional) */
|
|
22
|
-
export
|
|
22
|
+
export type TPartialSimpleRow<S extends TSchema = TSchema, N extends TCollectionName<S> = TCollectionName<S>> = RecursivePartial<TSimpleRow<S, N>>;
|
|
23
23
|
/** Row type with columns and relationships (all required) */
|
|
24
|
-
export
|
|
24
|
+
export type TRow<S extends TSchema = TSchema, N extends TCollectionName<S> = TCollectionName<S>> = S[N]['plain'] & S[N]['nested'];
|
|
25
25
|
/** Row type with columns and relationships (all optional) */
|
|
26
|
-
export
|
|
27
|
-
export
|
|
28
|
-
export
|
|
26
|
+
export type TPartialRow<S extends TSchema = TSchema, N extends TCollectionName<S> = TCollectionName<S>> = RecursivePartial<TRow<S, N>>;
|
|
27
|
+
export type TPartialFlatRow<S extends TSchema = TSchema, N extends TCollectionName<S> = TCollectionName<S>> = RecursivePartial<S[N]['plain'] & S[N]['flat']>;
|
|
28
|
+
export type TConditionTreeLeaf<S extends TSchema = TSchema, N extends TCollectionName<S> = TCollectionName<S>> = {
|
|
29
29
|
field: TFieldName<S, N>;
|
|
30
30
|
operator: Operator;
|
|
31
31
|
value?: unknown;
|
|
32
32
|
};
|
|
33
|
-
export
|
|
33
|
+
export type TConditionTreeBranch<S extends TSchema = TSchema, N extends TCollectionName<S> = TCollectionName<S>> = {
|
|
34
34
|
aggregator: Aggregator;
|
|
35
35
|
conditions: Array<TConditionTreeBranch<S, N> | TConditionTreeLeaf<S, N>>;
|
|
36
36
|
};
|
|
37
|
-
export
|
|
38
|
-
export
|
|
37
|
+
export type TConditionTree<S extends TSchema = TSchema, N extends TCollectionName<S> = TCollectionName<S>> = TConditionTreeBranch<S, N> | TConditionTreeLeaf<S, N>;
|
|
38
|
+
export type TPaginatedFilter<S extends TSchema = TSchema, N extends TCollectionName<S> = TCollectionName<S>> = TFilter<S, N> & {
|
|
39
39
|
sort?: Array<TSortClause<S, N>>;
|
|
40
40
|
page?: PlainPage;
|
|
41
41
|
};
|
|
42
|
-
export
|
|
42
|
+
export type TSortClause<S extends TSchema = TSchema, N extends TCollectionName<S> = TCollectionName<S>> = {
|
|
43
43
|
field: TFieldName<S, N>;
|
|
44
44
|
ascending: boolean;
|
|
45
45
|
};
|
|
46
|
-
export
|
|
46
|
+
export type TAggregateResult<S extends TSchema = TSchema, N extends TCollectionName<S> = TCollectionName<S>> = {
|
|
47
47
|
value: unknown;
|
|
48
48
|
group: TPartialFlatRow<S, N>;
|
|
49
49
|
};
|
|
@@ -55,7 +55,7 @@ export interface TAggregation<S extends TSchema = TSchema, N extends TCollection
|
|
|
55
55
|
operation?: DateOperation;
|
|
56
56
|
}>;
|
|
57
57
|
}
|
|
58
|
-
export
|
|
58
|
+
export type TFilter<S extends TSchema = TSchema, N extends TCollectionName<S> = TCollectionName<S>> = {
|
|
59
59
|
conditionTree?: TConditionTree<S, N>;
|
|
60
60
|
search?: string;
|
|
61
61
|
searchExtended?: boolean;
|
package/dist/types.d.ts
CHANGED
|
@@ -3,17 +3,17 @@ import CollectionCustomizer from './collection-customizer';
|
|
|
3
3
|
import CollectionCustomizationContext from './context/collection-context';
|
|
4
4
|
import DataSourceCustomizer from './datasource-customizer';
|
|
5
5
|
import { TCollectionName, TFieldName, TRow, TSchema } from './templates';
|
|
6
|
-
export
|
|
6
|
+
export type OneToManyEmbeddedDefinition<S extends TSchema = TSchema, N extends TCollectionName<S> = TCollectionName<S>> = {
|
|
7
7
|
schema: Record<string, PrimitiveTypes>;
|
|
8
8
|
dependencies?: TFieldName<S, N>[];
|
|
9
9
|
listRecords(records: TRow<S, N>, context: CollectionCustomizationContext<S, N>): Promise<unknown[]> | unknown[];
|
|
10
10
|
};
|
|
11
|
-
export
|
|
11
|
+
export type DataSourceOptions = {
|
|
12
12
|
rename?: ((oldName: string) => string) | {
|
|
13
13
|
[oldName: string]: string;
|
|
14
14
|
};
|
|
15
15
|
include?: string[];
|
|
16
16
|
exclude?: string[];
|
|
17
17
|
};
|
|
18
|
-
export
|
|
18
|
+
export type Plugin<Options> = (dataSourceCustomizer: DataSourceCustomizer<any>, collectionCustomizer: CollectionCustomizer<any, any>, options?: Options) => Promise<void>;
|
|
19
19
|
//# sourceMappingURL=types.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forestadmin/datasource-customizer",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.9",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"license": "GPL-3.0",
|
|
6
6
|
"publishConfig": {
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"test": "jest"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@types/luxon": "^2.0
|
|
27
|
-
"@types/object-hash": "^
|
|
28
|
-
"@types/uuid": "^
|
|
26
|
+
"@types/luxon": "^3.2.0",
|
|
27
|
+
"@types/object-hash": "^3.0.2",
|
|
28
|
+
"@types/uuid": "^9.0.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@forestadmin/datasource-toolkit": "1.2.
|
|
32
|
-
"luxon": "^2.
|
|
31
|
+
"@forestadmin/datasource-toolkit": "1.2.2",
|
|
32
|
+
"luxon": "^3.2.1",
|
|
33
33
|
"object-hash": "^3.0.0",
|
|
34
|
-
"uuid": "^
|
|
34
|
+
"uuid": "^9.0.0"
|
|
35
35
|
}
|
|
36
36
|
}
|