File tree 2 files changed +11
-0
lines changed
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ import {
37
37
intersectStringArrays ,
38
38
getKeyByValue ,
39
39
toCamel ,
40
+ generateUniqueId ,
40
41
} from './utils'
41
42
import {
42
43
mergeSchemas ,
@@ -55,6 +56,7 @@ export {
55
56
getSchemaFromFolder ,
56
57
generateSchemaMapDynamically ,
57
58
generateEntityMutations ,
59
+ generateUniqueId ,
58
60
}
59
61
60
62
export { PluginModule , PluginType , Result , pluginMap }
Original file line number Diff line number Diff line change
1
+ import crypto from 'crypto'
1
2
import camelCase from 'lodash/camelCase'
2
3
3
4
export const toCamel = ( o : any ) : any => {
@@ -67,3 +68,11 @@ export const sortResourcesDependencies = (
67
68
}
68
69
return 0
69
70
} )
71
+
72
+ /**
73
+ * Create an unique hash identifier
74
+ * @param entity entire entity to create identifier
75
+ * @returns unique identifier
76
+ */
77
+ export const generateUniqueId = ( entity : any ) : string =>
78
+ crypto . createHash ( 'md5' ) . update ( JSON . stringify ( entity ) ) . digest ( 'hex' )
You can’t perform that action at this time.
0 commit comments