forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdkim.js
More file actions
58 lines (56 loc) · 1.88 KB
/
dkim.js
File metadata and controls
58 lines (56 loc) · 1.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import { GraphQLObjectType } from 'graphql'
import { connectionArgs, globalIdField } from 'graphql-relay'
import { GraphQLDate } from 'graphql-scalars'
import { dkimResultConnection } from './dkim-result-connection'
import { dkimResultOrder } from '../inputs'
import { domainType } from '../../domain/objects'
import { nodeInterface } from '../../node'
export const dkimType = new GraphQLObjectType({
name: 'DKIM',
fields: () => ({
id: globalIdField('dkim'),
domain: {
type: domainType,
description: `The domain the scan was ran on.`,
resolve: async ({ domainId }, _, { loaders: { loadDomainByKey } }) => {
const domainKey = domainId.split('/')[1]
const domain = await loadDomainByKey.load(domainKey)
domain.id = domain._key
return domain
},
},
timestamp: {
type: GraphQLDate,
description: `The time when the scan was initiated.`,
resolve: ({ timestamp }) => new Date(timestamp),
},
results: {
type: dkimResultConnection.connectionType,
args: {
orderBy: {
type: dkimResultOrder,
description: 'Ordering options for DKIM result connections.',
},
...connectionArgs,
},
description: 'Individual scans results for each DKIM selector.',
resolve: async (
{ _id },
args,
{ loaders: { loadDkimResultConnectionsByDkimId } },
) => {
const dkimResults = await loadDkimResultConnectionsByDkimId({
dkimId: _id,
...args,
})
return dkimResults
},
},
}),
interfaces: [nodeInterface],
description: `DomainKeys Identified Mail (DKIM) permits a person, role, or
organization that owns the signing domain to claim some
responsibility for a message by associating the domain with the
message. This can be an author's organization, an operational relay,
or one of their agents.`,
})