@@ -2,34 +2,36 @@ import { entries } from '@seedcompany/common';
2
2
import { node , Query , relation } from 'cypher-query-builder' ;
3
3
import { DateTime } from 'luxon' ;
4
4
import {
5
- // eslint-disable-next-line @seedcompany/no-unused-vars -- used in jsdoc
6
- DbLabel ,
7
5
EnhancedResource ,
8
6
generateId ,
9
7
ID ,
8
+ MaybeUnsecuredInstance ,
9
+ Resource ,
10
10
ResourceShape ,
11
- UnsecuredDto ,
12
- } from '../../../common' ;
11
+ } from '~/common' ;
13
12
import { FileId } from '../../../components/file' ;
14
13
import { Variable } from '../query-augmentation/condition-variables' ;
15
14
16
15
export interface CreateNodeOptions < TResourceStatic extends ResourceShape < any > > {
17
- initialProps ?: InitialPropsOf < UnsecuredDto < TResourceStatic [ 'prototype' ] > > ;
16
+ initialProps ?: InitialPropsOf <
17
+ MaybeUnsecuredInstance < TResourceStatic > &
18
+ Partial < Pick < Resource , 'id' | 'createdAt' > >
19
+ > ;
18
20
baseNodeProps ?: Record < string , any > ;
19
21
}
20
22
21
23
type InitialPropsOf < T > = {
22
- [ K in keyof T ] ?: Variable | ( T [ K ] extends FileId ? ID : T [ K ] ) ;
24
+ [ K in keyof T & string ] ?: Variable | ( T [ K ] extends FileId ? ID : T [ K ] ) ;
23
25
} ;
24
26
25
27
/**
26
28
* This aids in composing create statements for a new base node and its initial properties.
27
29
*
28
30
* id & createdAt properties are generated and applied automatically.
29
31
* BaseNode labels are pulled from the resource's class hierarchy or manually
30
- * defined with {@link DbLabel @DbLabel()}
32
+ * defined with {@link import('~/common'). DbLabel @DbLabel()}
31
33
*
32
- * Any unique labels for properties are pulled from {@link DbLabel @DbLabel()}
34
+ * Any unique labels for properties are pulled from {@link import('~/common'). DbLabel @DbLabel()}
33
35
* decoration on the resource's properties.
34
36
*
35
37
* Note that we need to define all properties at create even if they are null/undefined.
0 commit comments