@azure-rest/confidential-ledger 1.0.1-alpha.20241125.1 → 1.0.1-alpha.20241127.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 (121) hide show
  1. package/dist/commonjs/confidentialLedger.d.ts +6 -0
  2. package/dist/commonjs/confidentialLedger.d.ts.map +1 -0
  3. package/dist/commonjs/confidentialLedger.js +25 -0
  4. package/dist/commonjs/confidentialLedger.js.map +1 -0
  5. package/dist/commonjs/generated/src/clientDefinitions.d.ts +75 -0
  6. package/dist/commonjs/generated/src/clientDefinitions.d.ts.map +1 -0
  7. package/dist/commonjs/generated/src/clientDefinitions.js +5 -0
  8. package/dist/commonjs/generated/src/clientDefinitions.js.map +1 -0
  9. package/dist/commonjs/generated/src/confidentialLedger.d.ts +11 -0
  10. package/dist/commonjs/generated/src/confidentialLedger.d.ts.map +1 -0
  11. package/dist/commonjs/generated/src/confidentialLedger.js +35 -0
  12. package/dist/commonjs/generated/src/confidentialLedger.js.map +1 -0
  13. package/dist/commonjs/generated/src/index.d.ts +11 -0
  14. package/dist/commonjs/generated/src/index.d.ts.map +1 -0
  15. package/dist/commonjs/generated/src/index.js +16 -0
  16. package/dist/commonjs/generated/src/index.js.map +1 -0
  17. package/dist/commonjs/generated/src/isUnexpected.d.ts +15 -0
  18. package/dist/commonjs/generated/src/isUnexpected.d.ts.map +1 -0
  19. package/dist/commonjs/generated/src/isUnexpected.js +86 -0
  20. package/dist/commonjs/generated/src/isUnexpected.js.map +1 -0
  21. package/dist/commonjs/generated/src/logger.d.ts +2 -0
  22. package/dist/commonjs/generated/src/logger.d.ts.map +1 -0
  23. package/dist/commonjs/generated/src/logger.js +8 -0
  24. package/dist/commonjs/generated/src/logger.js.map +1 -0
  25. package/dist/commonjs/generated/src/models.d.ts +11 -0
  26. package/dist/commonjs/generated/src/models.d.ts.map +1 -0
  27. package/dist/commonjs/generated/src/models.js +5 -0
  28. package/dist/commonjs/generated/src/models.js.map +1 -0
  29. package/dist/commonjs/generated/src/outputModels.d.ts +130 -0
  30. package/dist/commonjs/generated/src/outputModels.d.ts.map +1 -0
  31. package/dist/commonjs/generated/src/outputModels.js +5 -0
  32. package/dist/commonjs/generated/src/outputModels.js.map +1 -0
  33. package/dist/commonjs/generated/src/paginateHelper.d.ts +55 -0
  34. package/dist/commonjs/generated/src/paginateHelper.d.ts.map +1 -0
  35. package/dist/commonjs/generated/src/paginateHelper.js +119 -0
  36. package/dist/commonjs/generated/src/paginateHelper.js.map +1 -0
  37. package/dist/commonjs/generated/src/parameters.d.ts +66 -0
  38. package/dist/commonjs/generated/src/parameters.d.ts.map +1 -0
  39. package/dist/commonjs/generated/src/parameters.js +5 -0
  40. package/dist/commonjs/generated/src/parameters.js.map +1 -0
  41. package/dist/commonjs/generated/src/responses.d.ts +138 -0
  42. package/dist/commonjs/generated/src/responses.d.ts.map +1 -0
  43. package/dist/commonjs/generated/src/responses.js +5 -0
  44. package/dist/commonjs/generated/src/responses.js.map +1 -0
  45. package/dist/commonjs/getLedgerIdentity.d.ts +6 -0
  46. package/dist/commonjs/getLedgerIdentity.d.ts.map +1 -0
  47. package/dist/commonjs/getLedgerIdentity.js +22 -0
  48. package/dist/commonjs/getLedgerIdentity.js.map +1 -0
  49. package/dist/commonjs/index.d.ts +12 -0
  50. package/dist/commonjs/index.d.ts.map +1 -0
  51. package/dist/commonjs/index.js +19 -0
  52. package/dist/commonjs/index.js.map +1 -0
  53. package/dist/commonjs/package.json +3 -0
  54. package/dist/commonjs/tsdoc-metadata.json +11 -0
  55. package/dist/esm/confidentialLedger.d.ts +6 -0
  56. package/dist/esm/confidentialLedger.d.ts.map +1 -0
  57. package/{dist-esm/src → dist/esm}/confidentialLedger.js +1 -1
  58. package/dist/esm/confidentialLedger.js.map +1 -0
  59. package/dist/esm/generated/src/clientDefinitions.d.ts +75 -0
  60. package/dist/esm/generated/src/clientDefinitions.d.ts.map +1 -0
  61. package/dist/esm/generated/src/clientDefinitions.js.map +1 -0
  62. package/dist/esm/generated/src/confidentialLedger.d.ts +11 -0
  63. package/dist/esm/generated/src/confidentialLedger.d.ts.map +1 -0
  64. package/{dist-esm/src → dist/esm}/generated/src/confidentialLedger.js +1 -1
  65. package/dist/esm/generated/src/confidentialLedger.js.map +1 -0
  66. package/dist/esm/generated/src/index.d.ts +11 -0
  67. package/dist/esm/generated/src/index.d.ts.map +1 -0
  68. package/dist/esm/generated/src/index.js +13 -0
  69. package/dist/esm/generated/src/index.js.map +1 -0
  70. package/dist/esm/generated/src/isUnexpected.d.ts +15 -0
  71. package/dist/esm/generated/src/isUnexpected.d.ts.map +1 -0
  72. package/dist/esm/generated/src/isUnexpected.js.map +1 -0
  73. package/dist/esm/generated/src/logger.d.ts +2 -0
  74. package/dist/esm/generated/src/logger.d.ts.map +1 -0
  75. package/dist/esm/generated/src/models.d.ts +11 -0
  76. package/dist/esm/generated/src/models.d.ts.map +1 -0
  77. package/dist/esm/generated/src/outputModels.d.ts +130 -0
  78. package/dist/esm/generated/src/outputModels.d.ts.map +1 -0
  79. package/dist/esm/generated/src/paginateHelper.d.ts +55 -0
  80. package/dist/esm/generated/src/paginateHelper.d.ts.map +1 -0
  81. package/dist/esm/generated/src/parameters.d.ts +66 -0
  82. package/dist/esm/generated/src/parameters.d.ts.map +1 -0
  83. package/dist/esm/generated/src/parameters.js.map +1 -0
  84. package/dist/esm/generated/src/responses.d.ts +138 -0
  85. package/dist/esm/generated/src/responses.d.ts.map +1 -0
  86. package/dist/esm/generated/src/responses.js.map +1 -0
  87. package/dist/esm/getLedgerIdentity.d.ts +6 -0
  88. package/dist/esm/getLedgerIdentity.d.ts.map +1 -0
  89. package/dist/esm/index.d.ts +12 -0
  90. package/dist/esm/index.d.ts.map +1 -0
  91. package/dist/esm/index.js +14 -0
  92. package/dist/esm/index.js.map +1 -0
  93. package/dist/esm/package.json +3 -0
  94. package/package.json +48 -30
  95. package/dist/index.js +0 -285
  96. package/dist/index.js.map +0 -1
  97. package/dist-esm/src/confidentialLedger.js.map +0 -1
  98. package/dist-esm/src/generated/src/clientDefinitions.js.map +0 -1
  99. package/dist-esm/src/generated/src/confidentialLedger.js.map +0 -1
  100. package/dist-esm/src/generated/src/index.js +0 -13
  101. package/dist-esm/src/generated/src/index.js.map +0 -1
  102. package/dist-esm/src/generated/src/isUnexpected.js.map +0 -1
  103. package/dist-esm/src/generated/src/parameters.js.map +0 -1
  104. package/dist-esm/src/generated/src/responses.js.map +0 -1
  105. package/dist-esm/src/index.js +0 -14
  106. package/dist-esm/src/index.js.map +0 -1
  107. package/types/confidential-ledger.d.ts +0 -599
  108. /package/{dist-esm/src → dist/esm}/generated/src/clientDefinitions.js +0 -0
  109. /package/{dist-esm/src → dist/esm}/generated/src/isUnexpected.js +0 -0
  110. /package/{dist-esm/src → dist/esm}/generated/src/logger.js +0 -0
  111. /package/{dist-esm/src → dist/esm}/generated/src/logger.js.map +0 -0
  112. /package/{dist-esm/src → dist/esm}/generated/src/models.js +0 -0
  113. /package/{dist-esm/src → dist/esm}/generated/src/models.js.map +0 -0
  114. /package/{dist-esm/src → dist/esm}/generated/src/outputModels.js +0 -0
  115. /package/{dist-esm/src → dist/esm}/generated/src/outputModels.js.map +0 -0
  116. /package/{dist-esm/src → dist/esm}/generated/src/paginateHelper.js +0 -0
  117. /package/{dist-esm/src → dist/esm}/generated/src/paginateHelper.js.map +0 -0
  118. /package/{dist-esm/src → dist/esm}/generated/src/parameters.js +0 -0
  119. /package/{dist-esm/src → dist/esm}/generated/src/responses.js +0 -0
  120. /package/{dist-esm/src → dist/esm}/getLedgerIdentity.js +0 -0
  121. /package/{dist-esm/src → dist/esm}/getLedgerIdentity.js.map +0 -0
@@ -0,0 +1,138 @@
1
+ import { RawHttpHeaders } from "@azure/core-rest-pipeline";
2
+ import { HttpResponse } from "@azure-rest/core-client";
3
+ import { ConstitutionOutput, ConfidentialLedgerErrorOutput, ConsortiumOutput, ConfidentialLedgerEnclavesOutput, PagedCollectionsOutput, PagedLedgerEntriesOutput, LedgerWriteResultOutput, LedgerQueryResultOutput, TransactionReceiptOutput, TransactionStatusOutput, LedgerEntryOutput, LedgerUserOutput } from "./outputModels.js";
4
+ /** The constitution is a script that assesses and applies proposals from consortium members. */
5
+ export interface GetConstitution200Response extends HttpResponse {
6
+ status: "200";
7
+ body: ConstitutionOutput;
8
+ }
9
+ /** The constitution is a script that assesses and applies proposals from consortium members. */
10
+ export interface GetConstitutionDefaultResponse extends HttpResponse {
11
+ status: string;
12
+ body: ConfidentialLedgerErrorOutput;
13
+ }
14
+ /** Consortium members can manage the Confidential Ledger. */
15
+ export interface ListConsortiumMembers200Response extends HttpResponse {
16
+ status: "200";
17
+ body: ConsortiumOutput;
18
+ }
19
+ /** Consortium members can manage the Confidential Ledger. */
20
+ export interface ListConsortiumMembersDefaultResponse extends HttpResponse {
21
+ status: string;
22
+ body: ConfidentialLedgerErrorOutput;
23
+ }
24
+ /** A quote is an SGX enclave measurement that can be used to verify the validity of a node and its enclave. */
25
+ export interface GetEnclaveQuotes200Response extends HttpResponse {
26
+ status: "200";
27
+ body: ConfidentialLedgerEnclavesOutput;
28
+ }
29
+ /** A quote is an SGX enclave measurement that can be used to verify the validity of a node and its enclave. */
30
+ export interface GetEnclaveQuotesDefaultResponse extends HttpResponse {
31
+ status: string;
32
+ body: ConfidentialLedgerErrorOutput;
33
+ }
34
+ /** Collection ids are user-created collections of ledger entries */
35
+ export interface ListCollections200Response extends HttpResponse {
36
+ status: "200";
37
+ body: PagedCollectionsOutput;
38
+ }
39
+ /** Collection ids are user-created collections of ledger entries */
40
+ export interface ListCollectionsDefaultResponse extends HttpResponse {
41
+ status: string;
42
+ body: ConfidentialLedgerErrorOutput;
43
+ }
44
+ /** A collection id may optionally be specified. Only entries in the specified (or default) collection will be returned. */
45
+ export interface ListLedgerEntries200Response extends HttpResponse {
46
+ status: "200";
47
+ body: PagedLedgerEntriesOutput;
48
+ }
49
+ /** A collection id may optionally be specified. Only entries in the specified (or default) collection will be returned. */
50
+ export interface ListLedgerEntriesDefaultResponse extends HttpResponse {
51
+ status: string;
52
+ body: ConfidentialLedgerErrorOutput;
53
+ }
54
+ export interface CreateLedgerEntry200Headers {
55
+ /** The transaction id at which this write will become durable. */
56
+ "x-ms-ccf-transaction-id"?: string;
57
+ }
58
+ /** A collection id may optionally be specified. */
59
+ export interface CreateLedgerEntry200Response extends HttpResponse {
60
+ status: "200";
61
+ body: LedgerWriteResultOutput;
62
+ headers: RawHttpHeaders & CreateLedgerEntry200Headers;
63
+ }
64
+ /** A collection id may optionally be specified. */
65
+ export interface CreateLedgerEntryDefaultResponse extends HttpResponse {
66
+ status: string;
67
+ body: ConfidentialLedgerErrorOutput;
68
+ }
69
+ /** 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. */
70
+ export interface GetLedgerEntry200Response extends HttpResponse {
71
+ status: "200";
72
+ body: LedgerQueryResultOutput;
73
+ }
74
+ /** 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. */
75
+ export interface GetLedgerEntryDefaultResponse extends HttpResponse {
76
+ status: string;
77
+ body: ConfidentialLedgerErrorOutput;
78
+ }
79
+ /** Gets a receipt certifying ledger contents at a particular transaction id. */
80
+ export interface GetReceipt200Response extends HttpResponse {
81
+ status: "200";
82
+ body: TransactionReceiptOutput;
83
+ }
84
+ /** Gets a receipt certifying ledger contents at a particular transaction id. */
85
+ export interface GetReceiptDefaultResponse extends HttpResponse {
86
+ status: string;
87
+ body: ConfidentialLedgerErrorOutput;
88
+ }
89
+ /** Gets the status of an entry identified by a transaction id. */
90
+ export interface GetTransactionStatus200Response extends HttpResponse {
91
+ status: "200";
92
+ body: TransactionStatusOutput;
93
+ }
94
+ /** Gets the status of an entry identified by a transaction id. */
95
+ export interface GetTransactionStatusDefaultResponse extends HttpResponse {
96
+ status: string;
97
+ body: ConfidentialLedgerErrorOutput;
98
+ }
99
+ /** A collection id may optionally be specified. */
100
+ export interface GetCurrentLedgerEntry200Response extends HttpResponse {
101
+ status: "200";
102
+ body: LedgerEntryOutput;
103
+ }
104
+ /** A collection id may optionally be specified. */
105
+ export interface GetCurrentLedgerEntryDefaultResponse extends HttpResponse {
106
+ status: string;
107
+ body: ConfidentialLedgerErrorOutput;
108
+ }
109
+ /** Deletes a user from the Confidential Ledger. */
110
+ export interface DeleteUser204Response extends HttpResponse {
111
+ status: "204";
112
+ }
113
+ /** Deletes a user from the Confidential Ledger. */
114
+ export interface DeleteUserDefaultResponse extends HttpResponse {
115
+ status: string;
116
+ body: ConfidentialLedgerErrorOutput;
117
+ }
118
+ /** Gets a user. */
119
+ export interface GetUser200Response extends HttpResponse {
120
+ status: "200";
121
+ body: LedgerUserOutput;
122
+ }
123
+ /** Gets a user. */
124
+ export interface GetUserDefaultResponse extends HttpResponse {
125
+ status: string;
126
+ body: ConfidentialLedgerErrorOutput;
127
+ }
128
+ /** A JSON merge patch is applied for existing users */
129
+ export interface CreateOrUpdateUser200Response extends HttpResponse {
130
+ status: "200";
131
+ body: LedgerUserOutput;
132
+ }
133
+ /** A JSON merge patch is applied for existing users */
134
+ export interface CreateOrUpdateUserDefaultResponse extends HttpResponse {
135
+ status: string;
136
+ body: ConfidentialLedgerErrorOutput;
137
+ }
138
+ //# sourceMappingURL=responses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../../../src/generated/src/responses.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responses.js","sourceRoot":"","sources":["../../../../src/generated/src/responses.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { RawHttpHeaders } from \"@azure/core-rest-pipeline\";\nimport { HttpResponse } from \"@azure-rest/core-client\";\nimport {\n ConstitutionOutput,\n ConfidentialLedgerErrorOutput,\n ConsortiumOutput,\n ConfidentialLedgerEnclavesOutput,\n PagedCollectionsOutput,\n PagedLedgerEntriesOutput,\n LedgerWriteResultOutput,\n LedgerQueryResultOutput,\n TransactionReceiptOutput,\n TransactionStatusOutput,\n LedgerEntryOutput,\n LedgerUserOutput\n} from \"./outputModels.js\";\n\n/** The constitution is a script that assesses and applies proposals from consortium members. */\nexport interface GetConstitution200Response extends HttpResponse {\n status: \"200\";\n body: ConstitutionOutput;\n}\n\n/** The constitution is a script that assesses and applies proposals from consortium members. */\nexport interface GetConstitutionDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\n/** Consortium members can manage the Confidential Ledger. */\nexport interface ListConsortiumMembers200Response extends HttpResponse {\n status: \"200\";\n body: ConsortiumOutput;\n}\n\n/** Consortium members can manage the Confidential Ledger. */\nexport interface ListConsortiumMembersDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\n/** A quote is an SGX enclave measurement that can be used to verify the validity of a node and its enclave. */\nexport interface GetEnclaveQuotes200Response extends HttpResponse {\n status: \"200\";\n body: ConfidentialLedgerEnclavesOutput;\n}\n\n/** A quote is an SGX enclave measurement that can be used to verify the validity of a node and its enclave. */\nexport interface GetEnclaveQuotesDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\n/** Collection ids are user-created collections of ledger entries */\nexport interface ListCollections200Response extends HttpResponse {\n status: \"200\";\n body: PagedCollectionsOutput;\n}\n\n/** Collection ids are user-created collections of ledger entries */\nexport interface ListCollectionsDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\n/** A collection id may optionally be specified. Only entries in the specified (or default) collection will be returned. */\nexport interface ListLedgerEntries200Response extends HttpResponse {\n status: \"200\";\n body: PagedLedgerEntriesOutput;\n}\n\n/** A collection id may optionally be specified. Only entries in the specified (or default) collection will be returned. */\nexport interface ListLedgerEntriesDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\nexport interface CreateLedgerEntry200Headers {\n /** The transaction id at which this write will become durable. */\n \"x-ms-ccf-transaction-id\"?: string;\n}\n\n/** A collection id may optionally be specified. */\nexport interface CreateLedgerEntry200Response extends HttpResponse {\n status: \"200\";\n body: LedgerWriteResultOutput;\n headers: RawHttpHeaders & CreateLedgerEntry200Headers;\n}\n\n/** A collection id may optionally be specified. */\nexport interface CreateLedgerEntryDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\n/** 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. */\nexport interface GetLedgerEntry200Response extends HttpResponse {\n status: \"200\";\n body: LedgerQueryResultOutput;\n}\n\n/** 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. */\nexport interface GetLedgerEntryDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\n/** Gets a receipt certifying ledger contents at a particular transaction id. */\nexport interface GetReceipt200Response extends HttpResponse {\n status: \"200\";\n body: TransactionReceiptOutput;\n}\n\n/** Gets a receipt certifying ledger contents at a particular transaction id. */\nexport interface GetReceiptDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\n/** Gets the status of an entry identified by a transaction id. */\nexport interface GetTransactionStatus200Response extends HttpResponse {\n status: \"200\";\n body: TransactionStatusOutput;\n}\n\n/** Gets the status of an entry identified by a transaction id. */\nexport interface GetTransactionStatusDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\n/** A collection id may optionally be specified. */\nexport interface GetCurrentLedgerEntry200Response extends HttpResponse {\n status: \"200\";\n body: LedgerEntryOutput;\n}\n\n/** A collection id may optionally be specified. */\nexport interface GetCurrentLedgerEntryDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\n/** Deletes a user from the Confidential Ledger. */\nexport interface DeleteUser204Response extends HttpResponse {\n status: \"204\";\n}\n\n/** Deletes a user from the Confidential Ledger. */\nexport interface DeleteUserDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\n/** Gets a user. */\nexport interface GetUser200Response extends HttpResponse {\n status: \"200\";\n body: LedgerUserOutput;\n}\n\n/** Gets a user. */\nexport interface GetUserDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\n/** A JSON merge patch is applied for existing users */\nexport interface CreateOrUpdateUser200Response extends HttpResponse {\n status: \"200\";\n body: LedgerUserOutput;\n}\n\n/** A JSON merge patch is applied for existing users */\nexport interface CreateOrUpdateUserDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n"]}
@@ -0,0 +1,6 @@
1
+ export interface LedgerIdentity {
2
+ ledgerIdentityCertificate: string;
3
+ ledgerId: string;
4
+ }
5
+ export declare function getLedgerIdentity(ledgerId: string, identityServiceBaseUrl?: string): Promise<LedgerIdentity>;
6
+ //# sourceMappingURL=getLedgerIdentity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getLedgerIdentity.d.ts","sourceRoot":"","sources":["../../src/getLedgerIdentity.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,cAAc;IAC7B,yBAAyB,EAAE,MAAM,CAAC;IAClC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,sBAAsB,GAAE,MAA8D,GACrF,OAAO,CAAC,cAAc,CAAC,CAiBzB"}
@@ -0,0 +1,12 @@
1
+ import ConfidentialLedger from "./confidentialLedger.js";
2
+ export * from "./generated/src/confidentialLedger.js";
3
+ export * from "./generated/src/models.js";
4
+ export * from "./generated/src/parameters.js";
5
+ export * from "./generated/src/responses.js";
6
+ export * from "./generated/src/clientDefinitions.js";
7
+ export * from "./generated/src/isUnexpected.js";
8
+ export * from "./generated/src/outputModels.js";
9
+ export * from "./generated/src/paginateHelper.js";
10
+ export { LedgerIdentity, getLedgerIdentity } from "./getLedgerIdentity.js";
11
+ export default ConfidentialLedger;
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,cAAc,uCAAuC,CAAC;AACtD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3E,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,14 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import ConfidentialLedger from "./confidentialLedger.js";
4
+ export * from "./generated/src/confidentialLedger.js";
5
+ export * from "./generated/src/models.js";
6
+ export * from "./generated/src/parameters.js";
7
+ export * from "./generated/src/responses.js";
8
+ export * from "./generated/src/clientDefinitions.js";
9
+ export * from "./generated/src/isUnexpected.js";
10
+ export * from "./generated/src/outputModels.js";
11
+ export * from "./generated/src/paginateHelper.js";
12
+ export { getLedgerIdentity } from "./getLedgerIdentity.js";
13
+ export default ConfidentialLedger;
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,cAAc,uCAAuC,CAAC;AACtD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,OAAO,EAAkB,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3E,eAAe,kBAAkB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport ConfidentialLedger from \"./confidentialLedger.js\";\nexport * from \"./generated/src/confidentialLedger.js\";\nexport * from \"./generated/src/models.js\";\nexport * from \"./generated/src/parameters.js\";\nexport * from \"./generated/src/responses.js\";\nexport * from \"./generated/src/clientDefinitions.js\";\nexport * from \"./generated/src/isUnexpected.js\";\nexport * from \"./generated/src/outputModels.js\";\nexport * from \"./generated/src/paginateHelper.js\";\nexport { LedgerIdentity, getLedgerIdentity } from \"./getLedgerIdentity.js\";\nexport default ConfidentialLedger;\n"]}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "sdk-type": "client",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "An isomorphic rest level client library for the Azure Confidential Ledger service.",
6
- "version": "1.0.1-alpha.20241125.1",
6
+ "version": "1.0.1-alpha.20241127.1",
7
7
  "keywords": [
8
8
  "node",
9
9
  "azure",
@@ -13,9 +13,9 @@
13
13
  "isomorphic"
14
14
  ],
15
15
  "license": "MIT",
16
- "main": "./dist/index.js",
17
- "module": "./dist-esm/src/index.js",
18
- "types": "./types/confidential-ledger.d.ts",
16
+ "main": "./dist/commonjs/index.js",
17
+ "module": "./dist/esm/index.js",
18
+ "types": "./dist/commonjs/index.d.ts",
19
19
  "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/confidentialledger/confidential-ledger-rest/README.md",
20
20
  "repository": "github:Azure/azure-sdk-for-js",
21
21
  "bugs": {
@@ -23,8 +23,6 @@
23
23
  },
24
24
  "files": [
25
25
  "dist/",
26
- "dist-esm/src/",
27
- "types/confidential-ledger.d.ts",
28
26
  "README.md",
29
27
  "LICENSE"
30
28
  ],
@@ -51,16 +49,16 @@
51
49
  "apiRefLink": "https://docs.microsoft.com/azure/confidential-ledger"
52
50
  },
53
51
  "scripts": {
54
- "build": "npm run clean && tsc -p . && dev-tool run bundle --browser-test=false && dev-tool run extract-api",
52
+ "build": "npm run clean && dev-tool run build-package && dev-tool run extract-api",
55
53
  "build:browser": "echo \"Browser is not supported.\" && exit 0",
56
- "build:debug": "tsc -p . && dev-tool run bundle && dev-tool run extract-api",
57
- "build:node": "tsc -p . && dev-tool run bundle --browser-test=false",
54
+ "build:debug": "dev-tool run build-package && dev-tool run bundle && dev-tool run extract-api",
55
+ "build:node": "dev-tool run build-package && dev-tool run bundle --browser-test=false",
58
56
  "build:samples": "echo Obsolete.",
59
- "build:test": "tsc -p . && dev-tool run bundle --browser-test=false",
57
+ "build:test": "dev-tool run build-package && dev-tool run bundle --browser-test=false",
60
58
  "check-format": "dev-tool run vendored prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
61
59
  "clean": "dev-tool run vendored rimraf --glob dist dist-browser dist-esm dist-test temp types *.tgz *.log",
62
60
  "execute:samples": "dev-tool samples run samples-dev",
63
- "extract-api": "tsc -p . && dev-tool run extract-api",
61
+ "extract-api": "dev-tool run build-package && dev-tool run extract-api",
64
62
  "format": "dev-tool run vendored prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
65
63
  "generate:client": "autorest --typescript swagger/README.md && rushx format",
66
64
  "integration-test": "npm run integration-test:node",
@@ -74,36 +72,56 @@
74
72
  "test:node": "npm run clean && npm run build:test && npm run unit-test:node",
75
73
  "unit-test": "npm run unit-test:node",
76
74
  "unit-test:browser": "echo \"Browser is not supported.\" && exit 0",
77
- "unit-test:node": "dev-tool run test:node-ts-input -- --timeout 1200000 'test/**/*.spec.ts'",
75
+ "unit-test:node": "dev-tool run test:vitest",
78
76
  "update-snippets": "echo skipped"
79
77
  },
80
78
  "sideEffects": false,
81
79
  "autoPublish": false,
82
80
  "dependencies": {
83
- "@azure-rest/core-client": "^1.0.0",
84
- "@azure/core-auth": "^1.3.0",
85
- "@azure/core-paging": "^1.3.0",
86
- "@azure/core-rest-pipeline": "^1.1.0",
87
- "@azure/logger": "^1.0.0",
88
- "tslib": "^2.2.0"
81
+ "@azure-rest/core-client": "^2.3.1",
82
+ "@azure/core-auth": "^1.9.0",
83
+ "@azure/core-paging": "^1.6.2",
84
+ "@azure/core-rest-pipeline": "^1.18.0",
85
+ "@azure/logger": "^1.1.4",
86
+ "tslib": "^2.8.1"
89
87
  },
90
88
  "devDependencies": {
91
- "@azure-tools/test-credential": "^1.0.0",
92
- "@azure-tools/test-recorder": "^3.0.0",
93
- "@azure-tools/test-utils": "^1.0.1",
89
+ "@azure-tools/test-credential": "^2.0.0",
90
+ "@azure-tools/test-recorder": ">=4.1.0-alpha <4.1.0-alphb",
91
+ "@azure-tools/test-utils-vitest": ">=1.0.0-alpha <1.0.0-alphb",
94
92
  "@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb",
95
93
  "@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
96
- "@azure/identity": "^4.0.1",
97
- "@types/chai": "^4.1.6",
98
- "@types/mocha": "^10.0.0",
94
+ "@azure/identity": "^4.5.0",
99
95
  "@types/node": "^18.0.0",
100
- "chai": "^4.2.0",
96
+ "@vitest/coverage-istanbul": "^2.1.5",
101
97
  "dotenv": "^16.0.0",
102
98
  "eslint": "^9.9.0",
103
- "mocha": "^10.0.0",
104
- "nyc": "^17.0.0",
105
- "source-map-support": "^0.5.9",
106
- "ts-node": "^10.0.0",
107
- "typescript": "~5.6.2"
99
+ "typescript": "~5.6.2",
100
+ "vitest": "^2.1.5"
101
+ },
102
+ "type": "module",
103
+ "tshy": {
104
+ "exports": {
105
+ "./package.json": "./package.json",
106
+ ".": "./src/index.ts"
107
+ },
108
+ "dialects": [
109
+ "esm",
110
+ "commonjs"
111
+ ],
112
+ "selfLink": false
113
+ },
114
+ "exports": {
115
+ "./package.json": "./package.json",
116
+ ".": {
117
+ "import": {
118
+ "types": "./dist/esm/index.d.ts",
119
+ "default": "./dist/esm/index.js"
120
+ },
121
+ "require": {
122
+ "types": "./dist/commonjs/index.d.ts",
123
+ "default": "./dist/commonjs/index.js"
124
+ }
125
+ }
108
126
  }
109
127
  }
package/dist/index.js DELETED
@@ -1,285 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var coreAuth = require('@azure/core-auth');
6
- var coreClient = require('@azure-rest/core-client');
7
- var logger$1 = require('@azure/logger');
8
- var corePaging = require('@azure/core-paging');
9
-
10
- // Copyright (c) Microsoft Corporation.
11
- // Licensed under the MIT License.
12
- const logger = logger$1.createClientLogger("confidential-ledger");
13
-
14
- // Copyright (c) Microsoft Corporation.
15
- // Licensed under the MIT License.
16
- /**
17
- * Initialize a new instance of `ConfidentialLedgerClient`
18
- * @param ledgerEndpoint - The Confidential Ledger URL, for example https://contoso.confidentialledger.azure.com
19
- * @param credentials - uniquely identify client credential
20
- * @param options - the parameter for all optional parameters
21
- */
22
- function createClient(ledgerEndpoint, credentials, options = {}) {
23
- var _a, _b, _c, _d, _e, _f;
24
- const baseUrl = (_a = options.baseUrl) !== null && _a !== void 0 ? _a : `${ledgerEndpoint}`;
25
- options.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : "2022-05-13";
26
- options = Object.assign(Object.assign({}, options), { credentials: {
27
- scopes: (_d = (_c = options.credentials) === null || _c === void 0 ? void 0 : _c.scopes) !== null && _d !== void 0 ? _d : [
28
- "https://confidential-ledger.azure.com/.default"
29
- ]
30
- } });
31
- const userAgentInfo = `azsdk-js-confidential-ledger-rest/1.0.1`;
32
- const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
33
- ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
34
- : `${userAgentInfo}`;
35
- options = Object.assign(Object.assign({}, options), { userAgentOptions: {
36
- userAgentPrefix
37
- }, loggingOptions: {
38
- logger: (_f = (_e = options.loggingOptions) === null || _e === void 0 ? void 0 : _e.logger) !== null && _f !== void 0 ? _f : logger.info
39
- } });
40
- const client = coreClient.getClient(baseUrl, credentials, options);
41
- return client;
42
- }
43
-
44
- // Copyright (c) Microsoft Corporation.
45
- // Licensed under the MIT License.
46
- function ConfidentialLedger(ledgerEndpoint, ledgerIdentityCertificate, credentialsOrOptions, opts) {
47
- var _a;
48
- let credentials;
49
- let options;
50
- if (coreAuth.isTokenCredential(credentialsOrOptions)) {
51
- credentials = credentialsOrOptions;
52
- options = opts !== null && opts !== void 0 ? opts : {};
53
- }
54
- else {
55
- options = credentialsOrOptions !== null && credentialsOrOptions !== void 0 ? credentialsOrOptions : {};
56
- }
57
- const tlsOptions = (_a = options === null || options === void 0 ? void 0 : options.tlsOptions) !== null && _a !== void 0 ? _a : {};
58
- tlsOptions.ca = ledgerIdentityCertificate;
59
- const confidentialLedger = createClient(ledgerEndpoint, credentials, Object.assign(Object.assign({}, options), { tlsOptions }));
60
- return confidentialLedger;
61
- }
62
-
63
- // Copyright (c) Microsoft Corporation.
64
- // Licensed under the MIT License.
65
- const responseMap = {
66
- "GET /app/governance/constitution": ["200"],
67
- "GET /app/governance/members": ["200"],
68
- "GET /app/enclaveQuotes": ["200"],
69
- "GET /app/collections": ["200"],
70
- "GET /app/transactions": ["200"],
71
- "POST /app/transactions": ["200"],
72
- "GET /app/transactions/{transactionId}": ["200"],
73
- "GET /app/transactions/{transactionId}/receipt": ["200"],
74
- "GET /app/transactions/{transactionId}/status": ["200"],
75
- "GET /app/transactions/current": ["200"],
76
- "DELETE /app/users/{userId}": ["204"],
77
- "GET /app/users/{userId}": ["200"],
78
- "PATCH /app/users/{userId}": ["200"]
79
- };
80
- function isUnexpected(response) {
81
- const lroOriginal = response.headers["x-ms-original-url"];
82
- const url = new URL(lroOriginal !== null && lroOriginal !== void 0 ? lroOriginal : response.request.url);
83
- const method = response.request.method;
84
- let pathDetails = responseMap[`${method} ${url.pathname}`];
85
- if (!pathDetails) {
86
- pathDetails = getParametrizedPathSuccess(method, url.pathname);
87
- }
88
- return !pathDetails.includes(response.status);
89
- }
90
- function getParametrizedPathSuccess(method, path) {
91
- var _a, _b, _c, _d;
92
- const pathParts = path.split("/");
93
- // Traverse list to match the longest candidate
94
- // matchedLen: the length of candidate path
95
- // matchedValue: the matched status code array
96
- let matchedLen = -1, matchedValue = [];
97
- // Iterate the responseMap to find a match
98
- for (const [key, value] of Object.entries(responseMap)) {
99
- // Extracting the path from the map key which is in format
100
- // GET /path/foo
101
- if (!key.startsWith(method)) {
102
- continue;
103
- }
104
- const candidatePath = getPathFromMapKey(key);
105
- // Get each part of the url path
106
- const candidateParts = candidatePath.split("/");
107
- // track if we have found a match to return the values found.
108
- let found = true;
109
- for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
110
- if (((_a = candidateParts[i]) === null || _a === void 0 ? void 0 : _a.startsWith("{")) &&
111
- ((_b = candidateParts[i]) === null || _b === void 0 ? void 0 : _b.indexOf("}")) !== -1) {
112
- const start = candidateParts[i].indexOf("}") + 1, end = (_c = candidateParts[i]) === null || _c === void 0 ? void 0 : _c.length;
113
- // If the current part of the candidate is a "template" part
114
- // Try to use the suffix of pattern to match the path
115
- // {guid} ==> $
116
- // {guid}:export ==> :export$
117
- const isMatched = new RegExp(`${(_d = candidateParts[i]) === null || _d === void 0 ? void 0 : _d.slice(start, end)}`).test(pathParts[j] || "");
118
- if (!isMatched) {
119
- found = false;
120
- break;
121
- }
122
- continue;
123
- }
124
- // If the candidate part is not a template and
125
- // the parts don't match mark the candidate as not found
126
- // to move on with the next candidate path.
127
- if (candidateParts[i] !== pathParts[j]) {
128
- found = false;
129
- break;
130
- }
131
- }
132
- // We finished evaluating the current candidate parts
133
- // Update the matched value if and only if we found the longer pattern
134
- if (found && candidatePath.length > matchedLen) {
135
- matchedLen = candidatePath.length;
136
- matchedValue = value;
137
- }
138
- }
139
- return matchedValue;
140
- }
141
- function getPathFromMapKey(mapKey) {
142
- const pathStart = mapKey.indexOf("/");
143
- return mapKey.slice(pathStart);
144
- }
145
-
146
- // Copyright (c) Microsoft Corporation.
147
- // Licensed under the MIT License.
148
- /**
149
- * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
150
- * @param client - Client to use for sending the next page requests
151
- * @param initialResponse - Initial response containing the nextLink and current page of elements
152
- * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results
153
- * @returns - PagedAsyncIterableIterator to iterate the elements
154
- */
155
- function paginate(client, initialResponse, options = {}) {
156
- let firstRun = true;
157
- // We need to check the response for success before trying to inspect it looking for
158
- // the properties to use for nextLink and itemName
159
- checkPagingRequest(initialResponse);
160
- const { itemName, nextLinkName } = getPaginationProperties(initialResponse);
161
- const { customGetPage } = options;
162
- const pagedResult = {
163
- firstPageLink: "",
164
- getPage: typeof customGetPage === "function"
165
- ? customGetPage
166
- : async (pageLink) => {
167
- const result = firstRun
168
- ? initialResponse
169
- : await client.pathUnchecked(pageLink).get();
170
- firstRun = false;
171
- checkPagingRequest(result);
172
- const nextLink = getNextLink(result.body, nextLinkName);
173
- const values = getElements(result.body, itemName);
174
- return {
175
- page: values,
176
- nextPageLink: nextLink
177
- };
178
- }
179
- };
180
- return corePaging.getPagedAsyncIterator(pagedResult);
181
- }
182
- /**
183
- * Gets for the value of nextLink in the body
184
- */
185
- function getNextLink(body, nextLinkName) {
186
- if (!nextLinkName) {
187
- return undefined;
188
- }
189
- const nextLink = body[nextLinkName];
190
- if (typeof nextLink !== "string" && typeof nextLink !== "undefined") {
191
- throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);
192
- }
193
- return nextLink;
194
- }
195
- /**
196
- * Gets the elements of the current request in the body.
197
- */
198
- function getElements(body, itemName) {
199
- const value = body[itemName];
200
- // value has to be an array according to the x-ms-pageable extension.
201
- // The fact that this must be an array is used above to calculate the
202
- // type of elements in the page in PaginateReturn
203
- if (!Array.isArray(value)) {
204
- throw new Error(`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`);
205
- }
206
- return value !== null && value !== void 0 ? value : [];
207
- }
208
- /**
209
- * Checks if a request failed
210
- */
211
- function checkPagingRequest(response) {
212
- const Http2xxStatusCodes = [
213
- "200",
214
- "201",
215
- "202",
216
- "203",
217
- "204",
218
- "205",
219
- "206",
220
- "207",
221
- "208",
222
- "226"
223
- ];
224
- if (!Http2xxStatusCodes.includes(response.status)) {
225
- throw coreClient.createRestError(`Pagination failed with unexpected statusCode ${response.status}`, response);
226
- }
227
- }
228
- /**
229
- * Extracts the itemName and nextLinkName from the initial response to use them for pagination
230
- */
231
- function getPaginationProperties(initialResponse) {
232
- // Build a set with the passed custom nextLinkNames
233
- const nextLinkNames = new Set(["nextLink", "@nextLink"]);
234
- // Build a set with the passed custom set of itemNames
235
- const itemNames = new Set(["value", "members", "collections", "entries"]);
236
- let nextLinkName;
237
- let itemName;
238
- for (const name of nextLinkNames) {
239
- const nextLink = initialResponse.body[name];
240
- if (nextLink) {
241
- nextLinkName = name;
242
- break;
243
- }
244
- }
245
- for (const name of itemNames) {
246
- const item = initialResponse.body[name];
247
- if (item) {
248
- itemName = name;
249
- break;
250
- }
251
- }
252
- if (!itemName) {
253
- throw new Error(`Couldn't paginate response\n Body doesn't contain an array property with name: ${[
254
- ...itemNames
255
- ].join(" OR ")}`);
256
- }
257
- return { itemName, nextLinkName };
258
- }
259
-
260
- // Copyright (c) Microsoft Corporation.
261
- // Licensed under the MIT License.
262
- async function getLedgerIdentity(ledgerId, identityServiceBaseUrl = "https://identity.confidential-ledger.core.azure.com") {
263
- const client = coreClient.getClient(identityServiceBaseUrl);
264
- const cert = await client.pathUnchecked("/ledgerIdentity/{ledgerId}", ledgerId).get();
265
- const updatedCert = {
266
- ledgerIdentityCertificate: cert.body["ledgerTlsCertificate"],
267
- ledgerId: cert.body["ledgerId"],
268
- };
269
- if (!isLedgerIdentity(updatedCert)) {
270
- throw new Error("Body received from Confidential Ledger Identity is invalid. It must contain ledgerId and ledgerIdentityCertificate");
271
- }
272
- return updatedCert;
273
- }
274
- function isLedgerIdentity(identity) {
275
- return identity.ledgerIdentityCertificate && identity.ledgerId;
276
- }
277
-
278
- // Copyright (c) Microsoft Corporation.
279
- // Licensed under the MIT License.
280
-
281
- exports.default = ConfidentialLedger;
282
- exports.getLedgerIdentity = getLedgerIdentity;
283
- exports.isUnexpected = isUnexpected;
284
- exports.paginate = paginate;
285
- //# sourceMappingURL=index.js.map