Skip to content

Commit ec179bd

Browse files
committed
chore: cleanup types
1 parent 7e88994 commit ec179bd

5 files changed

Lines changed: 175 additions & 172 deletions

File tree

packages/credential-design-manager/src/agent/CredentialDesignManager.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import { IAgentPlugin } from '@veramo/core'
2-
import {
3-
AbstractCredentialDesignStore,
4-
CredentialDesign,
5-
GetCredentialDesignsArgs
6-
} from '@sphereon/ssi-sdk.data-store-types'
2+
import { AbstractCredentialDesignStore, CredentialDesign } from '@sphereon/ssi-sdk.data-store-types'
73
import { schema } from '../index'
84
import {
95
AddCredentialDesignArgs,
106
GetCredentialDesignArgs,
7+
GetCredentialDesignsArgs,
118
ICredentialDesignManager,
129
RemoveCredentialDesignArgs,
1310
RequiredContext,

packages/credential-design-manager/src/types/ICredentialDesignManager.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { contextHasPlugin } from '@sphereon/ssi-sdk.agent-config'
22
import { IAgentContext, IPluginMethodMap } from '@veramo/core'
3-
import { CredentialDesign } from '@sphereon/ssi-sdk.data-store-types'
3+
import { CredentialDesign, NonPersistedCredentialDesign } from '@sphereon/ssi-sdk.data-store-types'
44

55
export interface ICredentialDesignManager extends IPluginMethodMap {
66
cdmGetCredentialDesign(args: GetCredentialDesignArgs, context: RequiredContext): Promise<CredentialDesign>
@@ -19,18 +19,22 @@ export type GetCredentialDesignArgs = {
1919
}
2020

2121
export type GetCredentialDesignsArgs = {
22-
// TODO
22+
filter?: {
23+
tenantId?: string
24+
}
2325
}
2426

2527
export type AddCredentialDesignArgs = {
26-
// TODO: Define credential design properties
27-
[key: string]: any
28+
name: string
29+
tenantId?: string
30+
design?: NonPersistedCredentialDesign
2831
}
2932

3033
export type UpdateCredentialDesignArgs = {
3134
credentialDesignId: string
32-
// TODO: Define credential design properties
33-
[key: string]: any
35+
name?: string
36+
tenantId?: string
37+
design?: Partial<NonPersistedCredentialDesign>
3438
}
3539

3640
export type RemoveCredentialDesignArgs = {
Lines changed: 12 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -1,163 +1,28 @@
1-
// import {
2-
// CredentialDesign
3-
// } from './credentialDesign'
1+
import { NonPersistedCredentialDesign } from './credentialDesign'
42

53
export type GetCredentialDesignArgs = {
64
credentialDesignId: string
75
}
86

97
export type GetCredentialDesignsArgs = {
10-
8+
filter?: {
9+
tenantId?: string
10+
}
1111
}
1212

1313
export type AddCredentialDesignArgs = {
14-
14+
name: string
15+
tenantId?: string
16+
design?: NonPersistedCredentialDesign
1517
}
1618

1719
export type RemoveCredentialDesignArgs = {
18-
20+
credentialDesignId: string
1921
}
2022

2123
export type UpdateCredentialDesignArgs = {
22-
24+
credentialDesignId: string
25+
name?: string
26+
tenantId?: string
27+
design?: Partial<NonPersistedCredentialDesign>
2328
}
24-
25-
// export type FindPartyArgs = Array<PartialParty>
26-
// export type FindIdentityArgs = Array<PartialIdentity>
27-
// export type FindPartyTypeArgs = Array<PartialPartyType>
28-
// export type FindRelationshipArgs = Array<PartialPartyRelationship>
29-
// export type FindElectronicAddressArgs = Array<PartialElectronicAddress>
30-
// export type FindPhysicalAddressArgs = Array<PartialPhysicalAddress>
31-
32-
// export type GetPartyArgs = {
33-
// partyId: string
34-
// }
35-
//
36-
// export type GetPartiesArgs = {
37-
// filter?: FindPartyArgs
38-
// }
39-
//
40-
// export type AddPartyArgs = {
41-
// uri?: string
42-
// partyType: NonPersistedPartyType
43-
// contact: NonPersistedContact
44-
// identities?: Array<NonPersistedIdentity>
45-
// electronicAddresses?: Array<NonPersistedElectronicAddress>
46-
// physicalAddresses?: Array<NonPersistedPhysicalAddress>
47-
// }
48-
//
49-
// export type UpdatePartyArgs = {
50-
// party: Omit<Party, 'identities' | 'electronicAddresses' | 'partyType' | 'createdAt' | 'lastUpdatedAt'>
51-
// }
52-
//
53-
// export type RemovePartyArgs = {
54-
// partyId: string
55-
// }
56-
//
57-
// export type GetIdentityArgs = {
58-
// identityId: string
59-
// }
60-
//
61-
// export type GetIdentitiesArgs = {
62-
// filter?: FindIdentityArgs
63-
// }
64-
//
65-
// export type AddIdentityArgs = {
66-
// partyId: string
67-
// identity: NonPersistedIdentity
68-
// }
69-
//
70-
// export type UpdateIdentityArgs = {
71-
// identity: Identity
72-
// }
73-
//
74-
// export type RemoveIdentityArgs = {
75-
// identityId: string
76-
// }
77-
//
78-
// export type RemoveRelationshipArgs = {
79-
// relationshipId: string
80-
// }
81-
//
82-
// export type AddRelationshipArgs = {
83-
// leftId: string
84-
// rightId: string
85-
// }
86-
//
87-
// export type GetRelationshipArgs = {
88-
// relationshipId: string
89-
// }
90-
//
91-
// export type GetRelationshipsArgs = {
92-
// filter: FindRelationshipArgs
93-
// }
94-
//
95-
// export type UpdateRelationshipArgs = {
96-
// relationship: Omit<PartyRelationship, 'createdAt' | 'lastUpdatedAt'>
97-
// }
98-
//
99-
// export type AddPartyTypeArgs = {
100-
// type: PartyTypeType
101-
// origin: PartyOrigin
102-
// name: string
103-
// tenantId: string
104-
// description?: string
105-
// }
106-
//
107-
// export type GetPartyTypeArgs = {
108-
// partyTypeId: string
109-
// }
110-
//
111-
// export type GetPartyTypesArgs = {
112-
// filter?: FindPartyTypeArgs
113-
// }
114-
//
115-
// export type UpdatePartyTypeArgs = {
116-
// partyType: Omit<PartyType, 'createdAt' | 'lastUpdatedAt'>
117-
// }
118-
//
119-
// export type RemovePartyTypeArgs = {
120-
// partyTypeId: string
121-
// }
122-
//
123-
// export type GetElectronicAddressArgs = {
124-
// electronicAddressId: string
125-
// }
126-
//
127-
// export type GetElectronicAddressesArgs = {
128-
// filter?: FindElectronicAddressArgs
129-
// }
130-
//
131-
// export type AddElectronicAddressArgs = {
132-
// partyId: string
133-
// electronicAddress: NonPersistedElectronicAddress
134-
// }
135-
//
136-
// export type UpdateElectronicAddressArgs = {
137-
// electronicAddress: ElectronicAddress
138-
// }
139-
//
140-
// export type RemoveElectronicAddressArgs = {
141-
// electronicAddressId: string
142-
// }
143-
//
144-
// export type GetPhysicalAddressArgs = {
145-
// physicalAddressId: string
146-
// }
147-
//
148-
// export type GetPhysicalAddressesArgs = {
149-
// filter?: FindPhysicalAddressArgs
150-
// }
151-
//
152-
// export type AddPhysicalAddressArgs = {
153-
// partyId: string
154-
// physicalAddress: NonPersistedPhysicalAddress
155-
// }
156-
//
157-
// export type UpdatePhysicalAddressArgs = {
158-
// physicalAddress: PhysicalAddress
159-
// }
160-
//
161-
// export type RemovePhysicalAddressArgs = {
162-
// physicalAddressId: string
163-
// }
Lines changed: 67 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,70 @@
1+
import { IBasicImageAttributes, IImageAttributes } from '../issuanceBranding/issuanceBranding'
2+
3+
export enum ValueType {
4+
Text = 'Text',
5+
Number = 'Number',
6+
Boolean = 'Boolean',
7+
Date = 'Date',
8+
}
9+
10+
export type MetaDataValue = {
11+
id: string
12+
index?: number
13+
textValue?: string
14+
numberValue?: number
15+
booleanValue?: boolean
16+
timestampValue?: Date
17+
}
18+
19+
export type NonPersistedMetaDataValue = Omit<MetaDataValue, 'id'>
20+
21+
export type MetaDataKey = {
22+
id: string
23+
key: string
24+
valueType: ValueType
25+
metaDataValues: Array<MetaDataValue>
26+
}
27+
28+
export type NonPersistedMetaDataKey = Omit<MetaDataKey, 'id' | 'metaDataValues'> & {
29+
metaDataValues: Array<NonPersistedMetaDataValue>
30+
}
31+
32+
export type SchemaDefinition = {
33+
id: string
34+
tenantId?: string
35+
extendsId?: string
36+
correlationId?: string
37+
schemaType?: string
38+
entityType?: string
39+
schema: string
40+
}
41+
42+
export type NonPersistedSchemaDefinition = Omit<SchemaDefinition, 'id'>
43+
44+
export type CredentialDesignBranding = {
45+
id: string
46+
textColor?: string
47+
backgroundColor?: string
48+
logo?: IImageAttributes
49+
backgroundImage?: IImageAttributes
50+
}
51+
52+
export type NonPersistedCredentialDesignBranding = Omit<CredentialDesignBranding, 'id' | 'logo' | 'backgroundImage'> & {
53+
logo?: IBasicImageAttributes
54+
backgroundImage?: IBasicImageAttributes
55+
}
56+
157
export type CredentialDesign = {
2-
// TODO move to types
58+
id: string
359
label: string
4-
stringValue?: string
5-
numberValue?: number
6-
dateValue?: Date
7-
boolValue?: boolean
60+
tenantId?: string
61+
metaDataKeys: Array<MetaDataKey>
62+
schemaDefinitions: Array<SchemaDefinition>
63+
branding?: CredentialDesignBranding
64+
}
65+
66+
export type NonPersistedCredentialDesign = Omit<CredentialDesign, 'id' | 'metaDataKeys' | 'schemaDefinitions' | 'branding'> & {
67+
metaDataKeys?: Array<NonPersistedMetaDataKey>
68+
schemaDefinitions?: Array<NonPersistedSchemaDefinition>
69+
branding?: NonPersistedCredentialDesignBranding
870
}

0 commit comments

Comments
 (0)