@azure-rest/confidential-ledger 1.0.0-alpha.20220518.1 → 1.0.0-alpha.20220712.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/README.md +89 -27
  2. package/dist/index.js +229 -35
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/src/confidentialLedger.js +15 -7
  5. package/dist-esm/src/confidentialLedger.js.map +1 -1
  6. package/dist-esm/src/generated/src/clientDefinitions.js +4 -0
  7. package/dist-esm/src/generated/src/clientDefinitions.js.map +1 -0
  8. package/dist-esm/src/generated/src/confidentialLedger.js +12 -4
  9. package/dist-esm/src/generated/src/confidentialLedger.js.map +1 -1
  10. package/dist-esm/src/generated/src/index.js +5 -1
  11. package/dist-esm/src/generated/src/index.js.map +1 -1
  12. package/dist-esm/src/generated/src/isUnexpected.js +77 -0
  13. package/dist-esm/src/generated/src/isUnexpected.js.map +1 -0
  14. package/dist-esm/src/generated/src/models.js.map +1 -1
  15. package/dist-esm/src/generated/src/outputModels.js +4 -0
  16. package/dist-esm/src/generated/src/outputModels.js.map +1 -0
  17. package/dist-esm/src/generated/src/paginateHelper.js +116 -0
  18. package/dist-esm/src/generated/src/paginateHelper.js.map +1 -0
  19. package/dist-esm/src/generated/src/parameters.js.map +1 -1
  20. package/dist-esm/src/generated/src/responses.js.map +1 -1
  21. package/dist-esm/src/getLedgerIdentity.js +9 -5
  22. package/dist-esm/src/getLedgerIdentity.js.map +1 -1
  23. package/dist-esm/src/index.js +4 -0
  24. package/dist-esm/src/index.js.map +1 -1
  25. package/package.json +10 -8
  26. package/types/confidential-ledger.d.ts +285 -164
  27. package/dist-esm/src/certificatePolicy.browser.js +0 -14
  28. package/dist-esm/src/certificatePolicy.browser.js.map +0 -1
  29. package/dist-esm/src/certificatePolicy.js +0 -23
  30. package/dist-esm/src/certificatePolicy.js.map +0 -1
@@ -1,102 +1,116 @@
1
- import { CertificateCredential } from '@azure-rest/core-client';
2
1
  import { Client } from '@azure-rest/core-client';
3
2
  import { ClientOptions } from '@azure-rest/core-client';
4
3
  import { HttpResponse } from '@azure-rest/core-client';
4
+ import { PagedAsyncIterableIterator } from '@azure/core-paging';
5
+ import { PathUncheckedResponse } from '@azure-rest/core-client';
5
6
  import { RawHttpHeaders } from '@azure/core-rest-pipeline';
6
7
  import { RequestParameters } from '@azure-rest/core-client';
8
+ import { StreamableMethod } from '@azure-rest/core-client';
7
9
  import { TokenCredential } from '@azure/core-auth';
8
10
 
9
- declare function ConfidentialLedger(ledgerBaseUrl: string, ledgerTlsCertificate: string, credentials: TokenCredential | CertificateCredential, options?: ClientOptions): ConfidentialLedgerRestClient;
11
+ export declare interface CollectionOutput {
12
+ collectionId: string;
13
+ }
14
+
15
+ export declare interface CollectionsOutput {
16
+ /** A list of identifiers for ledger collections. */
17
+ collections: Array<CollectionOutput>;
18
+ }
19
+
20
+ declare function ConfidentialLedger(ledgerBaseUrl: string, ledgerIdentityCertificate: string, options?: ClientOptions): ConfidentialLedgerClient;
21
+
22
+ declare function ConfidentialLedger(ledgerBaseUrl: string, ledgerIdentityCertificate: string, credentials: TokenCredential, options?: ClientOptions): ConfidentialLedgerClient;
10
23
  export default ConfidentialLedger;
11
24
 
12
- export declare interface ConfidentialLedgerEnclaves {
25
+ export declare type ConfidentialLedgerClient = Client & {
26
+ path: Routes;
27
+ };
28
+
29
+ export declare interface ConfidentialLedgerEnclavesOutput {
13
30
  /** Id of the Confidential Ledger node responding to the request. */
14
31
  currentNodeId: string;
15
32
  /** Dictionary of enclave quotes, indexed by node id. */
16
- enclaveQuotes: EnclaveQuotesDictionary;
17
- }
18
-
19
- export declare interface ConfidentialLedgerError {
20
- /** An error response from Confidential Ledger. */
21
- error?: ConfidentialLedgerErrorBody;
33
+ enclaveQuotes: Record<string, EnclaveQuoteOutput>;
22
34
  }
23
35
 
24
- export declare interface ConfidentialLedgerErrorBody {
36
+ export declare interface ConfidentialLedgerErrorBodyOutput {
25
37
  /** The error code. */
26
38
  code?: string;
27
39
  /** The error message. */
28
40
  message?: string;
29
- /** An error response from Confidential Ledger. */
30
- innerError?: ConfidentialLedgerErrorBody;
31
41
  }
32
42
 
33
- export declare type ConfidentialLedgerQueryState = "Loading" | "Ready";
34
-
35
- export declare type ConfidentialLedgerRestClient = Client & {
36
- path: Routes;
37
- };
38
-
39
- export declare type ConfidentialLedgerUserRoleName = "Administrator" | "Contributor" | "Reader";
40
-
41
- export declare interface Consortium {
42
- members: ConsortiumMember[];
43
+ export declare interface ConfidentialLedgerErrorOutput {
44
+ /** An error response from Confidential Ledger. */
45
+ error?: ConfidentialLedgerErrorBodyOutput;
43
46
  }
44
47
 
45
- export declare interface ConsortiumMember {
48
+ export declare interface ConsortiumMemberOutput {
46
49
  /** PEM-encoded certificate associated with the member. */
47
50
  certificate: string;
48
51
  /** Identifier assigned to the member. */
49
52
  id: string;
50
53
  }
51
54
 
52
- export declare interface Constitution {
55
+ export declare interface ConsortiumOutput {
56
+ members: Array<ConsortiumMemberOutput>;
57
+ }
58
+
59
+ export declare interface ConstitutionOutput {
53
60
  /** SHA256 digest of the constitution script. */
54
61
  digest: string;
55
62
  /** Contents of the constitution. */
56
63
  script: string;
57
64
  }
58
65
 
59
- export declare interface CreateOrUpdateUser {
60
- /** Deletes a user from the Confidential Ledger. */
61
- delete(options?: DeleteUserParameters): Promise<DeleteUser204Response | DeleteUserdefaultResponse>;
62
- /** Gets a user. */
63
- get(options?: GetUserParameters): Promise<GetUser200Response | GetUserdefaultResponse>;
64
- /** A JSON merge patch is applied for existing users */
65
- patch(options: CreateOrUpdateUserParameters): Promise<CreateOrUpdateUser200Response | CreateOrUpdateUserdefaultResponse>;
66
- }
67
-
68
66
  /** A JSON merge patch is applied for existing users */
69
67
  export declare interface CreateOrUpdateUser200Response extends HttpResponse {
70
68
  status: "200";
71
- body: LedgerUser;
69
+ body: LedgerUserOutput;
72
70
  }
73
71
 
74
72
  export declare interface CreateOrUpdateUserBodyParam {
73
+ /** Details about a Confidential Ledger user. */
75
74
  body: LedgerUser;
76
75
  }
77
76
 
78
77
  /** A JSON merge patch is applied for existing users */
79
78
  export declare interface CreateOrUpdateUserdefaultResponse extends HttpResponse {
80
- status: "500";
81
- body: ConfidentialLedgerError;
79
+ status: string;
80
+ body: ConfidentialLedgerErrorOutput;
81
+ }
82
+
83
+ export declare interface CreateOrUpdateUserMediaTypesParam {
84
+ /** Request content type */
85
+ contentType?: "application/merge-patch+json";
82
86
  }
83
87
 
84
- export declare type CreateOrUpdateUserParameters = RequestParameters & CreateOrUpdateUserBodyParam;
88
+ export declare type CreateOrUpdateUserParameters = CreateOrUpdateUserMediaTypesParam & CreateOrUpdateUserBodyParam & RequestParameters;
89
+
90
+ export declare interface DeleteUser {
91
+ /** Deletes a user from the Confidential Ledger. */
92
+ delete(options?: DeleteUserParameters): StreamableMethod<DeleteUser204Response | DeleteUserdefaultResponse>;
93
+ /** Gets a user. */
94
+ get(options?: GetUserParameters): StreamableMethod<GetUser200Response | GetUserdefaultResponse>;
95
+ /** A JSON merge patch is applied for existing users */
96
+ patch(options: CreateOrUpdateUserParameters): StreamableMethod<CreateOrUpdateUser200Response | CreateOrUpdateUserdefaultResponse>;
97
+ }
85
98
 
86
99
  /** Deletes a user from the Confidential Ledger. */
87
100
  export declare interface DeleteUser204Response extends HttpResponse {
88
101
  status: "204";
102
+ body: Record<string, unknown>;
89
103
  }
90
104
 
91
105
  /** Deletes a user from the Confidential Ledger. */
92
106
  export declare interface DeleteUserdefaultResponse extends HttpResponse {
93
- status: "500";
94
- body: ConfidentialLedgerError;
107
+ status: string;
108
+ body: ConfidentialLedgerErrorOutput;
95
109
  }
96
110
 
97
111
  export declare type DeleteUserParameters = RequestParameters;
98
112
 
99
- export declare interface EnclaveQuote {
113
+ export declare interface EnclaveQuoteOutput {
100
114
  /** ID assigned to this node. */
101
115
  nodeId: string;
102
116
  /** MRENCLAVE value of the code running in the enclave. */
@@ -107,184 +121,168 @@ export declare interface EnclaveQuote {
107
121
  raw: string;
108
122
  }
109
123
 
110
- export declare type EnclaveQuotesDictionary = Record<string, EnclaveQuote>;
124
+ /**
125
+ * Helper type to extract the type of an array
126
+ */
127
+ export declare type GetArrayType<T> = T extends Array<infer TData> ? TData : never;
111
128
 
112
129
  export declare interface GetConsortiumMembers {
113
130
  /** Consortium members can manage the Confidential Ledger. */
114
- get(options?: GetConsortiumMembersParameters): Promise<GetConsortiumMembers200Response | GetConsortiumMembersdefaultResponse>;
131
+ get(options?: GetConsortiumMembersParameters): StreamableMethod<GetConsortiumMembers200Response | GetConsortiumMembersdefaultResponse>;
115
132
  }
116
133
 
117
134
  /** Consortium members can manage the Confidential Ledger. */
118
135
  export declare interface GetConsortiumMembers200Response extends HttpResponse {
119
136
  status: "200";
120
- body: Consortium;
137
+ body: ConsortiumOutput;
121
138
  }
122
139
 
123
140
  /** Consortium members can manage the Confidential Ledger. */
124
141
  export declare interface GetConsortiumMembersdefaultResponse extends HttpResponse {
125
- status: "500";
126
- body: ConfidentialLedgerError;
142
+ status: string;
143
+ body: ConfidentialLedgerErrorOutput;
127
144
  }
128
145
 
129
146
  export declare type GetConsortiumMembersParameters = RequestParameters;
130
147
 
131
148
  export declare interface GetConstitution {
132
149
  /** The constitution is a script that assesses and applies proposals from consortium members. */
133
- get(options?: GetConstitutionParameters): Promise<GetConstitution200Response | GetConstitutiondefaultResponse>;
150
+ get(options?: GetConstitutionParameters): StreamableMethod<GetConstitution200Response | GetConstitutiondefaultResponse>;
134
151
  }
135
152
 
136
153
  /** The constitution is a script that assesses and applies proposals from consortium members. */
137
154
  export declare interface GetConstitution200Response extends HttpResponse {
138
155
  status: "200";
139
- body: Constitution;
156
+ body: ConstitutionOutput;
140
157
  }
141
158
 
142
159
  /** The constitution is a script that assesses and applies proposals from consortium members. */
143
160
  export declare interface GetConstitutiondefaultResponse extends HttpResponse {
144
- status: "500";
145
- body: ConfidentialLedgerError;
161
+ status: string;
162
+ body: ConfidentialLedgerErrorOutput;
146
163
  }
147
164
 
148
165
  export declare type GetConstitutionParameters = RequestParameters;
149
166
 
150
167
  export declare interface GetCurrentLedgerEntry {
151
- /** A sub-ledger id may optionally be specified. */
152
- get(options?: GetCurrentLedgerEntryParameters): Promise<GetCurrentLedgerEntry200Response | GetCurrentLedgerEntrydefaultResponse>;
168
+ /** A collection id may optionally be specified. */
169
+ get(options?: GetCurrentLedgerEntryParameters): StreamableMethod<GetCurrentLedgerEntry200Response | GetCurrentLedgerEntrydefaultResponse>;
153
170
  }
154
171
 
155
- /** A sub-ledger id may optionally be specified. */
172
+ /** A collection id may optionally be specified. */
156
173
  export declare interface GetCurrentLedgerEntry200Response extends HttpResponse {
157
174
  status: "200";
158
- body: LedgerEntry;
175
+ body: LedgerEntryOutput;
159
176
  }
160
177
 
161
- /** A sub-ledger id may optionally be specified. */
178
+ /** A collection id may optionally be specified. */
162
179
  export declare interface GetCurrentLedgerEntrydefaultResponse extends HttpResponse {
163
- status: "500";
164
- body: ConfidentialLedgerError;
180
+ status: string;
181
+ body: ConfidentialLedgerErrorOutput;
165
182
  }
166
183
 
167
- export declare type GetCurrentLedgerEntryParameters = RequestParameters & GetCurrentLedgerEntryQueryParam;
184
+ export declare type GetCurrentLedgerEntryParameters = GetCurrentLedgerEntryQueryParam & RequestParameters;
168
185
 
169
186
  export declare interface GetCurrentLedgerEntryQueryParam {
170
187
  queryParameters?: GetCurrentLedgerEntryQueryParamProperties;
171
188
  }
172
189
 
173
190
  export declare interface GetCurrentLedgerEntryQueryParamProperties {
174
- /** The sub-ledger id. */
175
- subLedgerId?: string;
191
+ /** The collection id. */
192
+ collectionId?: string;
176
193
  }
177
194
 
178
195
  export declare interface GetEnclaveQuotes {
179
196
  /** A quote is an SGX enclave measurement that can be used to verify the validity of a node and its enclave. */
180
- get(options?: GetEnclaveQuotesParameters): Promise<GetEnclaveQuotes200Response | GetEnclaveQuotesdefaultResponse>;
197
+ get(options?: GetEnclaveQuotesParameters): StreamableMethod<GetEnclaveQuotes200Response | GetEnclaveQuotesdefaultResponse>;
181
198
  }
182
199
 
183
200
  /** A quote is an SGX enclave measurement that can be used to verify the validity of a node and its enclave. */
184
201
  export declare interface GetEnclaveQuotes200Response extends HttpResponse {
185
202
  status: "200";
186
- body: ConfidentialLedgerEnclaves;
203
+ body: ConfidentialLedgerEnclavesOutput;
187
204
  }
188
205
 
189
206
  /** A quote is an SGX enclave measurement that can be used to verify the validity of a node and its enclave. */
190
207
  export declare interface GetEnclaveQuotesdefaultResponse extends HttpResponse {
191
- status: "500";
192
- body: ConfidentialLedgerError;
208
+ status: string;
209
+ body: ConfidentialLedgerErrorOutput;
193
210
  }
194
211
 
195
212
  export declare type GetEnclaveQuotesParameters = RequestParameters;
196
213
 
197
- /** A sub-ledger id may optionally be specified. Only entries in the specified (or default) sub-ledger will be returned. */
198
- export declare interface GetLedgerEntries200Response extends HttpResponse {
199
- status: "200";
200
- body: PagedLedgerEntries;
201
- }
202
-
203
- /** A sub-ledger id may optionally be specified. Only entries in the specified (or default) sub-ledger will be returned. */
204
- export declare interface GetLedgerEntriesdefaultResponse extends HttpResponse {
205
- status: "500";
206
- body: ConfidentialLedgerError;
207
- }
208
-
209
- export declare type GetLedgerEntriesParameters = RequestParameters & GetLedgerEntriesQueryParam;
210
-
211
- export declare interface GetLedgerEntriesQueryParam {
212
- queryParameters?: GetLedgerEntriesQueryParamProperties;
213
- }
214
-
215
- export declare interface GetLedgerEntriesQueryParamProperties {
216
- /** The sub-ledger id. */
217
- subLedgerId?: string;
218
- /** Specify the first transaction ID in a range. */
219
- fromTransactionId?: string;
220
- /** Specify the last transaction ID in a range. */
221
- toTransactionId?: string;
222
- }
223
-
224
214
  export declare interface GetLedgerEntry {
225
215
  /** To return older ledger entries, the relevant sections of the ledger must be read from disk and validated. To prevent blocking within the enclave, the response will indicate whether the entry is ready and part of the response, or if the loading is still ongoing. */
226
- get(options?: GetLedgerEntryParameters): Promise<GetLedgerEntry200Response | GetLedgerEntrydefaultResponse>;
216
+ get(options?: GetLedgerEntryParameters): StreamableMethod<GetLedgerEntry200Response | GetLedgerEntrydefaultResponse>;
227
217
  }
228
218
 
229
219
  /** To return older ledger entries, the relevant sections of the ledger must be read from disk and validated. To prevent blocking within the enclave, the response will indicate whether the entry is ready and part of the response, or if the loading is still ongoing. */
230
220
  export declare interface GetLedgerEntry200Response extends HttpResponse {
231
221
  status: "200";
232
- body: LedgerQueryResult;
222
+ body: LedgerQueryResultOutput;
233
223
  }
234
224
 
235
225
  /** To return older ledger entries, the relevant sections of the ledger must be read from disk and validated. To prevent blocking within the enclave, the response will indicate whether the entry is ready and part of the response, or if the loading is still ongoing. */
236
226
  export declare interface GetLedgerEntrydefaultResponse extends HttpResponse {
237
- status: "500";
238
- body: ConfidentialLedgerError;
227
+ status: string;
228
+ body: ConfidentialLedgerErrorOutput;
239
229
  }
240
230
 
241
- export declare type GetLedgerEntryParameters = RequestParameters & GetLedgerEntryQueryParam;
231
+ export declare type GetLedgerEntryParameters = GetLedgerEntryQueryParam & RequestParameters;
242
232
 
243
233
  export declare interface GetLedgerEntryQueryParam {
244
234
  queryParameters?: GetLedgerEntryQueryParamProperties;
245
235
  }
246
236
 
247
237
  export declare interface GetLedgerEntryQueryParamProperties {
248
- /** The sub-ledger id. */
249
- subLedgerId?: string;
238
+ /** The collection id. */
239
+ collectionId?: string;
250
240
  }
251
241
 
252
242
  export declare function getLedgerIdentity(ledgerId: string, identityServiceBaseUrl?: string): Promise<LedgerIdentity>;
253
243
 
244
+ /**
245
+ * The type of a custom function that defines how to get a page and a link to the next one if any.
246
+ */
247
+ export declare type GetPage<TPage> = (pageLink: string, maxPageSize?: number) => Promise<{
248
+ page: TPage;
249
+ nextPageLink?: string;
250
+ }>;
251
+
254
252
  export declare interface GetReceipt {
255
253
  /** Gets a receipt certifying ledger contents at a particular transaction id. */
256
- get(options?: GetReceiptParameters): Promise<GetReceipt200Response | GetReceiptdefaultResponse>;
254
+ get(options?: GetReceiptParameters): StreamableMethod<GetReceipt200Response | GetReceiptdefaultResponse>;
257
255
  }
258
256
 
259
257
  /** Gets a receipt certifying ledger contents at a particular transaction id. */
260
258
  export declare interface GetReceipt200Response extends HttpResponse {
261
259
  status: "200";
262
- body: TransactionReceipt;
260
+ body: TransactionReceiptOutput;
263
261
  }
264
262
 
265
263
  /** Gets a receipt certifying ledger contents at a particular transaction id. */
266
264
  export declare interface GetReceiptdefaultResponse extends HttpResponse {
267
- status: "500";
268
- body: ConfidentialLedgerError;
265
+ status: string;
266
+ body: ConfidentialLedgerErrorOutput;
269
267
  }
270
268
 
271
269
  export declare type GetReceiptParameters = RequestParameters;
272
270
 
273
271
  export declare interface GetTransactionStatus {
274
272
  /** Gets the status of an entry identified by a transaction id. */
275
- get(options?: GetTransactionStatusParameters): Promise<GetTransactionStatus200Response | GetTransactionStatusdefaultResponse>;
273
+ get(options?: GetTransactionStatusParameters): StreamableMethod<GetTransactionStatus200Response | GetTransactionStatusdefaultResponse>;
276
274
  }
277
275
 
278
276
  /** Gets the status of an entry identified by a transaction id. */
279
277
  export declare interface GetTransactionStatus200Response extends HttpResponse {
280
278
  status: "200";
281
- body: TransactionStatus;
279
+ body: TransactionStatusOutput;
282
280
  }
283
281
 
284
282
  /** Gets the status of an entry identified by a transaction id. */
285
283
  export declare interface GetTransactionStatusdefaultResponse extends HttpResponse {
286
- status: "500";
287
- body: ConfidentialLedgerError;
284
+ status: string;
285
+ body: ConfidentialLedgerErrorOutput;
288
286
  }
289
287
 
290
288
  export declare type GetTransactionStatusParameters = RequestParameters;
@@ -292,69 +290,185 @@ export declare type GetTransactionStatusParameters = RequestParameters;
292
290
  /** Gets a user. */
293
291
  export declare interface GetUser200Response extends HttpResponse {
294
292
  status: "200";
295
- body: LedgerUser;
293
+ body: LedgerUserOutput;
296
294
  }
297
295
 
298
296
  /** Gets a user. */
299
297
  export declare interface GetUserdefaultResponse extends HttpResponse {
300
- status: "500";
301
- body: ConfidentialLedgerError;
298
+ status: string;
299
+ body: ConfidentialLedgerErrorOutput;
302
300
  }
303
301
 
304
302
  export declare type GetUserParameters = RequestParameters;
305
303
 
304
+ export declare function isUnexpected(response: GetConstitution200Response | GetConstitutiondefaultResponse): response is GetConstitutiondefaultResponse;
305
+
306
+ export declare function isUnexpected(response: GetConsortiumMembers200Response | GetConsortiumMembersdefaultResponse): response is GetConsortiumMembersdefaultResponse;
307
+
308
+ export declare function isUnexpected(response: GetEnclaveQuotes200Response | GetEnclaveQuotesdefaultResponse): response is GetEnclaveQuotesdefaultResponse;
309
+
310
+ export declare function isUnexpected(response: ListCollections200Response | ListCollectionsdefaultResponse): response is ListCollectionsdefaultResponse;
311
+
312
+ export declare function isUnexpected(response: ListLedgerEntries200Response | ListLedgerEntriesdefaultResponse): response is ListLedgerEntriesdefaultResponse;
313
+
314
+ export declare function isUnexpected(response: PostLedgerEntry200Response | PostLedgerEntrydefaultResponse): response is PostLedgerEntrydefaultResponse;
315
+
316
+ export declare function isUnexpected(response: GetLedgerEntry200Response | GetLedgerEntrydefaultResponse): response is GetLedgerEntrydefaultResponse;
317
+
318
+ export declare function isUnexpected(response: GetReceipt200Response | GetReceiptdefaultResponse): response is GetReceiptdefaultResponse;
319
+
320
+ export declare function isUnexpected(response: GetTransactionStatus200Response | GetTransactionStatusdefaultResponse): response is GetTransactionStatusdefaultResponse;
321
+
322
+ export declare function isUnexpected(response: GetCurrentLedgerEntry200Response | GetCurrentLedgerEntrydefaultResponse): response is GetCurrentLedgerEntrydefaultResponse;
323
+
324
+ export declare function isUnexpected(response: DeleteUser204Response | DeleteUserdefaultResponse): response is DeleteUserdefaultResponse;
325
+
326
+ export declare function isUnexpected(response: GetUser200Response | GetUserdefaultResponse): response is GetUserdefaultResponse;
327
+
328
+ export declare function isUnexpected(response: CreateOrUpdateUser200Response | CreateOrUpdateUserdefaultResponse): response is CreateOrUpdateUserdefaultResponse;
329
+
306
330
  export declare interface LedgerEntry {
307
331
  /** Contents of the ledger entry. */
308
332
  contents: string;
309
- /** Identifier for sub-ledgers. */
310
- subLedgerId?: string;
333
+ collectionId?: string;
334
+ /** A unique identifier for the state of the ledger. If returned as part of a LedgerEntry, it indicates the state from which the entry was read. */
335
+ transactionId?: string;
336
+ }
337
+
338
+ export declare interface LedgerEntryOutput {
339
+ /** Contents of the ledger entry. */
340
+ contents: string;
341
+ collectionId?: string;
311
342
  /** A unique identifier for the state of the ledger. If returned as part of a LedgerEntry, it indicates the state from which the entry was read. */
312
343
  transactionId?: string;
313
344
  }
314
345
 
315
346
  export declare interface LedgerIdentity {
316
- ledgerTlsCertificate: string;
347
+ ledgerIdentityCertificate: string;
317
348
  ledgerId: string;
318
349
  }
319
350
 
320
- export declare interface LedgerQueryResult {
351
+ export declare interface LedgerQueryResultOutput {
321
352
  /** State of a ledger query. */
322
- state: ConfidentialLedgerQueryState;
353
+ state: "Loading" | "Ready";
323
354
  /** The ledger entry found as a result of the query. This is only available if the query is in Ready state. */
324
- entry?: LedgerEntry;
355
+ entry?: LedgerEntryOutput;
325
356
  }
326
357
 
327
358
  export declare interface LedgerUser {
328
359
  /** Represents an assignable role. */
329
- assignedRole: ConfidentialLedgerUserRoleName;
360
+ assignedRole: "Administrator" | "Contributor" | "Reader";
330
361
  /** Identifier for the user. This must either be an AAD object id or a certificate fingerprint. */
331
362
  userId?: string;
332
363
  }
333
364
 
334
- export declare interface LedgerWriteResult {
335
- /** Identifier for sub-ledgers. */
336
- subLedgerId: string;
365
+ export declare interface LedgerUserOutput {
366
+ /** Represents an assignable role. */
367
+ assignedRole: "Administrator" | "Contributor" | "Reader";
368
+ /** Identifier for the user. This must either be an AAD object id or a certificate fingerprint. */
369
+ userId?: string;
337
370
  }
338
371
 
339
- export declare interface MerkleProofElement {
340
- left?: string;
341
- right?: string;
372
+ export declare interface LedgerWriteResultOutput {
373
+ collectionId: string;
374
+ }
375
+
376
+ export declare interface ListCollections {
377
+ /** Collection ids are user-created collections of ledger entries */
378
+ get(options?: ListCollectionsParameters): StreamableMethod<ListCollections200Response | ListCollectionsdefaultResponse>;
379
+ }
380
+
381
+ /** Collection ids are user-created collections of ledger entries */
382
+ export declare interface ListCollections200Response extends HttpResponse {
383
+ status: "200";
384
+ body: CollectionsOutput;
385
+ }
386
+
387
+ /** Collection ids are user-created collections of ledger entries */
388
+ export declare interface ListCollectionsdefaultResponse extends HttpResponse {
389
+ status: string;
390
+ body: ConfidentialLedgerErrorOutput;
391
+ }
392
+
393
+ export declare type ListCollectionsParameters = RequestParameters;
394
+
395
+ export declare interface ListLedgerEntries {
396
+ /** A collection id may optionally be specified. Only entries in the specified (or default) collection will be returned. */
397
+ get(options?: ListLedgerEntriesParameters): StreamableMethod<ListLedgerEntries200Response | ListLedgerEntriesdefaultResponse>;
398
+ /** A collection id may optionally be specified. */
399
+ post(options: PostLedgerEntryParameters): StreamableMethod<PostLedgerEntry200Response | PostLedgerEntrydefaultResponse>;
400
+ }
401
+
402
+ /** A collection id may optionally be specified. Only entries in the specified (or default) collection will be returned. */
403
+ export declare interface ListLedgerEntries200Response extends HttpResponse {
404
+ status: "200";
405
+ body: PagedLedgerEntriesOutput;
406
+ }
407
+
408
+ /** A collection id may optionally be specified. Only entries in the specified (or default) collection will be returned. */
409
+ export declare interface ListLedgerEntriesdefaultResponse extends HttpResponse {
410
+ status: string;
411
+ body: ConfidentialLedgerErrorOutput;
342
412
  }
343
413
 
344
- export declare interface PagedLedgerEntries {
414
+ export declare type ListLedgerEntriesParameters = ListLedgerEntriesQueryParam & RequestParameters;
415
+
416
+ export declare interface ListLedgerEntriesQueryParam {
417
+ queryParameters?: ListLedgerEntriesQueryParamProperties;
418
+ }
419
+
420
+ export declare interface ListLedgerEntriesQueryParamProperties {
421
+ /** The collection id. */
422
+ collectionId?: string;
423
+ /** Specify the first transaction ID in a range. */
424
+ fromTransactionId?: string;
425
+ /** Specify the last transaction ID in a range. */
426
+ toTransactionId?: string;
427
+ }
428
+
429
+ export declare interface PagedLedgerEntriesOutput {
345
430
  /** State of a ledger query. */
346
- state: ConfidentialLedgerQueryState;
431
+ state: "Loading" | "Ready";
347
432
  /** Path from which to retrieve the next page of results. */
348
433
  nextLink?: string;
349
434
  /** Array of ledger entries. */
350
- entries: LedgerEntry[];
351
- }
352
-
353
- export declare interface PostLedgerEntry {
354
- /** A sub-ledger id may optionally be specified. Only entries in the specified (or default) sub-ledger will be returned. */
355
- get(options?: GetLedgerEntriesParameters): Promise<GetLedgerEntries200Response | GetLedgerEntriesdefaultResponse>;
356
- /** A sub-ledger id may optionally be specified. */
357
- post(options?: PostLedgerEntryParameters): Promise<PostLedgerEntry200Response | PostLedgerEntrydefaultResponse>;
435
+ entries: Array<LedgerEntryOutput>;
436
+ }
437
+
438
+ /**
439
+ * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
440
+ * @param client - Client to use for sending the next page requests
441
+ * @param initialResponse - Initial response containing the nextLink and current page of elements
442
+ * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results
443
+ * @returns - PagedAsyncIterableIterator to iterate the elements
444
+ */
445
+ export declare function paginate<TResponse extends PathUncheckedResponse>(client: Client, initialResponse: TResponse, options?: PagingOptions<TResponse>): PagedAsyncIterableIterator<PaginateReturn<TResponse>>;
446
+
447
+ /**
448
+ * Helper type to infer the Type of the paged elements from the response type
449
+ * This type is generated based on the swagger information for x-ms-pageable
450
+ * specifically on the itemName property which indicates the property of the response
451
+ * where the page items are found. The default value is `value`.
452
+ * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter
453
+ */
454
+ export declare type PaginateReturn<TResult> = TResult extends {
455
+ body: {
456
+ value?: infer TPage;
457
+ };
458
+ } | {
459
+ body: {
460
+ entries?: infer TPage;
461
+ };
462
+ } ? GetArrayType<TPage> : Array<unknown>;
463
+
464
+ /**
465
+ * Options for the paging helper
466
+ */
467
+ export declare interface PagingOptions<TResponse> {
468
+ /**
469
+ * Custom function to extract pagination details for crating the PagedAsyncIterableIterator
470
+ */
471
+ customGetPage?: GetPage<PaginateReturn<TResponse>[]>;
358
472
  }
359
473
 
360
474
  export declare interface PostLedgerEntry200Headers {
@@ -362,52 +476,60 @@ export declare interface PostLedgerEntry200Headers {
362
476
  "x-ms-ccf-transaction-id"?: string;
363
477
  }
364
478
 
365
- /** A sub-ledger id may optionally be specified. */
479
+ /** A collection id may optionally be specified. */
366
480
  export declare interface PostLedgerEntry200Response extends HttpResponse {
367
481
  status: "200";
368
- body: LedgerWriteResult;
482
+ body: LedgerWriteResultOutput;
369
483
  headers: RawHttpHeaders & PostLedgerEntry200Headers;
370
484
  }
371
485
 
372
486
  export declare interface PostLedgerEntryBodyParam {
373
- body?: LedgerEntry;
487
+ /** Ledger entry. */
488
+ body: LedgerEntry;
374
489
  }
375
490
 
376
- /** A sub-ledger id may optionally be specified. */
491
+ /** A collection id may optionally be specified. */
377
492
  export declare interface PostLedgerEntrydefaultResponse extends HttpResponse {
378
- status: "500";
379
- body: ConfidentialLedgerError;
493
+ status: string;
494
+ body: ConfidentialLedgerErrorOutput;
495
+ }
496
+
497
+ export declare interface PostLedgerEntryMediaTypesParam {
498
+ /** Request content type */
499
+ contentType?: "application/json";
380
500
  }
381
501
 
382
- export declare type PostLedgerEntryParameters = RequestParameters & PostLedgerEntryQueryParam & PostLedgerEntryBodyParam;
502
+ export declare type PostLedgerEntryParameters = PostLedgerEntryQueryParam & PostLedgerEntryMediaTypesParam & PostLedgerEntryBodyParam & RequestParameters;
383
503
 
384
504
  export declare interface PostLedgerEntryQueryParam {
385
505
  queryParameters?: PostLedgerEntryQueryParamProperties;
386
506
  }
387
507
 
388
508
  export declare interface PostLedgerEntryQueryParamProperties {
389
- /** The sub-ledger id. */
390
- subLedgerId?: string;
509
+ /** The collection id. */
510
+ collectionId?: string;
391
511
  }
392
512
 
393
- export declare interface ReceiptContents {
394
- /** Merkle tree leaf for this transaction. */
395
- leaf: string;
396
- /** Id of the node returning the receipt. */
513
+ export declare interface ReceiptContentsOutput {
514
+ cert?: string;
515
+ leaf?: string;
516
+ leafComponents?: ReceiptLeafComponentsOutput;
397
517
  nodeId: string;
398
- /** Merkle proof. */
399
- proof: MerkleProofElement[];
400
- /** Root of the Merkle tree at the time the transaction was recorded. */
401
- root: string;
402
- /** Signature by the node, with its certificate, over the Merkle root. */
518
+ proof: Array<ReceiptElementOutput>;
519
+ root?: string;
520
+ serviceEndorsements?: Array<string>;
403
521
  signature: string;
404
522
  }
405
523
 
406
- export declare interface RoleAssignment {
407
- /** Represents an assignable role. */
408
- roleName: ConfidentialLedgerUserRoleName;
409
- /** Description of the role. */
410
- description?: string;
524
+ export declare interface ReceiptElementOutput {
525
+ left?: string;
526
+ right?: string;
527
+ }
528
+
529
+ export declare interface ReceiptLeafComponentsOutput {
530
+ claimsDigest?: string;
531
+ commitEvidence?: string;
532
+ writeSetDigest?: string;
411
533
  }
412
534
 
413
535
  export declare interface Routes {
@@ -417,8 +539,10 @@ export declare interface Routes {
417
539
  (path: "/app/governance/members"): GetConsortiumMembers;
418
540
  /** Resource for '/app/enclaveQuotes' has methods for the following verbs: get */
419
541
  (path: "/app/enclaveQuotes"): GetEnclaveQuotes;
542
+ /** Resource for '/app/collections' has methods for the following verbs: get */
543
+ (path: "/app/collections"): ListCollections;
420
544
  /** Resource for '/app/transactions' has methods for the following verbs: get, post */
421
- (path: "/app/transactions"): PostLedgerEntry;
545
+ (path: "/app/transactions"): ListLedgerEntries;
422
546
  /** Resource for '/app/transactions/\{transactionId\}' has methods for the following verbs: get */
423
547
  (path: "/app/transactions/{transactionId}", transactionId: string): GetLedgerEntry;
424
548
  /** Resource for '/app/transactions/\{transactionId\}/receipt' has methods for the following verbs: get */
@@ -428,23 +552,20 @@ export declare interface Routes {
428
552
  /** Resource for '/app/transactions/current' has methods for the following verbs: get */
429
553
  (path: "/app/transactions/current"): GetCurrentLedgerEntry;
430
554
  /** Resource for '/app/users/\{userId\}' has methods for the following verbs: delete, get, patch */
431
- (path: "/app/users/{userId}", userId: string): CreateOrUpdateUser;
555
+ (path: "/app/users/{userId}", userId: string): DeleteUser;
432
556
  }
433
557
 
434
- export declare interface TransactionReceipt {
435
- /** A receipt certifying the transaction at the specified id. */
436
- receipt?: ReceiptContents;
558
+ export declare interface TransactionReceiptOutput {
559
+ receipt?: ReceiptContentsOutput;
437
560
  /** State of a ledger query. */
438
- state: ConfidentialLedgerQueryState;
561
+ state: "Loading" | "Ready";
439
562
  /** A unique identifier for the state of the ledger. If returned as part of a LedgerEntry, it indicates the state from which the entry was read. */
440
563
  transactionId: string;
441
564
  }
442
565
 
443
- export declare type TransactionState = "Committed" | "Pending";
444
-
445
- export declare interface TransactionStatus {
566
+ export declare interface TransactionStatusOutput {
446
567
  /** Represents the state of the transaction. */
447
- state: TransactionState;
568
+ state: "Committed" | "Pending";
448
569
  /** A unique identifier for the state of the ledger. If returned as part of a LedgerEntry, it indicates the state from which the entry was read. */
449
570
  transactionId: string;
450
571
  }