@@ -3,6 +3,29 @@ import { IIdentifier } from './IIdentifier.js'
33import { IAgentContext , IPluginMethodMap } from './IAgent.js'
44import { IMessage } from './IMessage.js'
55
6+ /**
7+ * The allowed columns for querying different data types in the {@link IDataStoreORM} interface.
8+ * @internal
9+ */
10+ export const ALLOWED_COLUMNS = {
11+ message : [ 'from' , 'to' , 'id' , 'createdAt' , 'expiresAt' , 'threadId' , 'type' , 'raw' , 'replyTo' , 'replyUrl' ] ,
12+ claim : [
13+ 'context' ,
14+ 'credentialType' ,
15+ 'type' ,
16+ 'value' ,
17+ 'isObj' ,
18+ 'id' ,
19+ 'issuer' ,
20+ 'subject' ,
21+ 'expirationDate' ,
22+ 'issuanceDate' ,
23+ ] ,
24+ credential : [ 'context' , 'type' , 'id' , 'issuer' , 'subject' , 'expirationDate' , 'issuanceDate' , 'hash' ] ,
25+ presentation : [ 'context' , 'type' , 'id' , 'holder' , 'verifier' , 'expirationDate' , 'issuanceDate' ] ,
26+ identifier : [ 'did' , 'alias' , 'provider' ] ,
27+ } as const
28+
629/**
730 * Represents the sort order of results from a {@link FindArgs} query.
831 *
@@ -70,25 +93,15 @@ export interface FindArgs<TColumns> {
7093 * @deprecated This type will be removed in future versions of this plugin interface.
7194 * @beta This API may change without a BREAKING CHANGE notice.
7295 */
73- export type TIdentifiersColumns = 'did' | 'alias' | 'provider'
96+ export type TIdentifiersColumns = ( typeof ALLOWED_COLUMNS . identifier ) [ number ]
7497
7598/**
7699 * The columns that can be queried for an {@link IMessage}
77100 *
78101 * See {@link IDataStoreORM.dataStoreORMGetMessagesCount}
79102 * @beta This API may change without a BREAKING CHANGE notice.
80103 */
81- export type TMessageColumns =
82- | 'from'
83- | 'to'
84- | 'id'
85- | 'createdAt'
86- | 'expiresAt'
87- | 'threadId'
88- | 'type'
89- | 'raw'
90- | 'replyTo'
91- | 'replyUrl'
104+ export type TMessageColumns = ( typeof ALLOWED_COLUMNS . message ) [ number ]
92105
93106/**
94107 * The columns that can be searched for a {@link VerifiableCredential}
@@ -98,15 +111,7 @@ export type TMessageColumns =
98111 *
99112 * @beta This API may change without a BREAKING CHANGE notice.
100113 */
101- export type TCredentialColumns =
102- | 'context'
103- | 'type'
104- | 'id'
105- | 'issuer'
106- | 'subject'
107- | 'expirationDate'
108- | 'issuanceDate'
109- | 'hash'
114+ export type TCredentialColumns = ( typeof ALLOWED_COLUMNS . credential ) [ number ]
110115
111116/**
112117 * The columns that can be searched for the claims of a {@link VerifiableCredential}
@@ -116,17 +121,7 @@ export type TCredentialColumns =
116121 *
117122 * @beta This API may change without a BREAKING CHANGE notice.
118123 */
119- export type TClaimsColumns =
120- | 'context'
121- | 'credentialType'
122- | 'type'
123- | 'value'
124- | 'isObj'
125- | 'id'
126- | 'issuer'
127- | 'subject'
128- | 'expirationDate'
129- | 'issuanceDate'
124+ export type TClaimsColumns = ( typeof ALLOWED_COLUMNS . claim ) [ number ]
130125
131126/**
132127 * The columns that can be searched for a {@link VerifiablePresentation}
@@ -136,14 +131,7 @@ export type TClaimsColumns =
136131 *
137132 * @beta This API may change without a BREAKING CHANGE notice.
138133 */
139- export type TPresentationColumns =
140- | 'context'
141- | 'type'
142- | 'id'
143- | 'holder'
144- | 'verifier'
145- | 'expirationDate'
146- | 'issuanceDate'
134+ export type TPresentationColumns = ( typeof ALLOWED_COLUMNS . presentation ) [ number ]
147135
148136/**
149137 * This context can be used for Veramo Agents that are created behind an authorization mechanism, that attaches a DID
0 commit comments