@azure-rest/confidential-ledger 1.0.1-alpha.20230419.1 → 1.0.1-alpha.20230626.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.
- package/dist/index.js +53 -33
- package/dist/index.js.map +1 -1
- package/dist-esm/src/generated/src/clientDefinitions.js.map +1 -1
- package/dist-esm/src/generated/src/confidentialLedger.js +14 -3
- package/dist-esm/src/generated/src/confidentialLedger.js.map +1 -1
- package/dist-esm/src/generated/src/isUnexpected.js +36 -30
- package/dist-esm/src/generated/src/isUnexpected.js.map +1 -1
- package/dist-esm/src/generated/src/logger.js +5 -0
- package/dist-esm/src/generated/src/logger.js.map +1 -0
- package/dist-esm/src/generated/src/models.js.map +1 -1
- package/dist-esm/src/generated/src/outputModels.js.map +1 -1
- package/dist-esm/src/generated/src/parameters.js.map +1 -1
- package/dist-esm/src/generated/src/responses.js.map +1 -1
- package/package.json +14 -30
- package/types/confidential-ledger.d.ts +67 -52
package/dist/index.js
CHANGED
|
@@ -4,22 +4,36 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var coreAuth = require('@azure/core-auth');
|
|
6
6
|
var coreClient = require('@azure-rest/core-client');
|
|
7
|
+
var logger$1 = require('@azure/logger');
|
|
7
8
|
var corePaging = require('@azure/core-paging');
|
|
8
9
|
|
|
9
10
|
// Copyright (c) Microsoft Corporation.
|
|
11
|
+
const logger = logger$1.createClientLogger("confidential-ledger");
|
|
12
|
+
|
|
13
|
+
// Copyright (c) Microsoft Corporation.
|
|
14
|
+
/**
|
|
15
|
+
* Initialize a new instance of `ConfidentialLedgerClient`
|
|
16
|
+
* @param ledgerEndpoint - The Confidential Ledger URL, for example https://contoso.confidentialledger.azure.com
|
|
17
|
+
* @param credentials - uniquely identify client credential
|
|
18
|
+
* @param options - the parameter for all optional parameters
|
|
19
|
+
*/
|
|
10
20
|
function createClient(ledgerEndpoint, credentials, options = {}) {
|
|
11
|
-
var _a, _b;
|
|
21
|
+
var _a, _b, _c, _d, _e, _f;
|
|
12
22
|
const baseUrl = (_a = options.baseUrl) !== null && _a !== void 0 ? _a : `${ledgerEndpoint}`;
|
|
13
23
|
options.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : "2022-05-13";
|
|
14
24
|
options = Object.assign(Object.assign({}, options), { credentials: {
|
|
15
|
-
scopes:
|
|
25
|
+
scopes: (_d = (_c = options.credentials) === null || _c === void 0 ? void 0 : _c.scopes) !== null && _d !== void 0 ? _d : [
|
|
26
|
+
"https://confidential-ledger.azure.com/.default"
|
|
27
|
+
]
|
|
16
28
|
} });
|
|
17
|
-
const userAgentInfo = `azsdk-js-confidential-ledger-rest/1.0.
|
|
29
|
+
const userAgentInfo = `azsdk-js-confidential-ledger-rest/1.0.1`;
|
|
18
30
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
19
31
|
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
20
32
|
: `${userAgentInfo}`;
|
|
21
33
|
options = Object.assign(Object.assign({}, options), { userAgentOptions: {
|
|
22
34
|
userAgentPrefix
|
|
35
|
+
}, loggingOptions: {
|
|
36
|
+
logger: (_f = (_e = options.loggingOptions) === null || _e === void 0 ? void 0 : _e.logger) !== null && _f !== void 0 ? _f : logger.info
|
|
23
37
|
} });
|
|
24
38
|
const client = coreClient.getClient(baseUrl, credentials, options);
|
|
25
39
|
return client;
|
|
@@ -66,54 +80,60 @@ function isUnexpected(response) {
|
|
|
66
80
|
const method = response.request.method;
|
|
67
81
|
let pathDetails = responseMap[`${method} ${url.pathname}`];
|
|
68
82
|
if (!pathDetails) {
|
|
69
|
-
pathDetails =
|
|
83
|
+
pathDetails = getParametrizedPathSuccess(method, url.pathname);
|
|
70
84
|
}
|
|
71
85
|
return !pathDetails.includes(response.status);
|
|
72
86
|
}
|
|
73
|
-
function
|
|
87
|
+
function getParametrizedPathSuccess(method, path) {
|
|
88
|
+
var _a, _b, _c, _d;
|
|
74
89
|
const pathParts = path.split("/");
|
|
90
|
+
// Traverse list to match the longest candidate
|
|
91
|
+
// matchedLen: the length of candidate path
|
|
92
|
+
// matchedValue: the matched status code array
|
|
93
|
+
let matchedLen = -1, matchedValue = [];
|
|
75
94
|
// Iterate the responseMap to find a match
|
|
76
95
|
for (const [key, value] of Object.entries(responseMap)) {
|
|
77
96
|
// Extracting the path from the map key which is in format
|
|
78
97
|
// GET /path/foo
|
|
98
|
+
if (!key.startsWith(method)) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
79
101
|
const candidatePath = getPathFromMapKey(key);
|
|
80
102
|
// Get each part of the url path
|
|
81
103
|
const candidateParts = candidatePath.split("/");
|
|
82
|
-
//
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
continue;
|
|
95
|
-
}
|
|
96
|
-
// If the candidate part is not a template and
|
|
97
|
-
// the parts don't match mark the candidate as not found
|
|
98
|
-
// to move on with the next candidate path.
|
|
99
|
-
if (candidateParts[i] !== pathParts[i]) {
|
|
104
|
+
// track if we have found a match to return the values found.
|
|
105
|
+
let found = true;
|
|
106
|
+
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
|
|
107
|
+
if (((_a = candidateParts[i]) === null || _a === void 0 ? void 0 : _a.startsWith("{")) &&
|
|
108
|
+
((_b = candidateParts[i]) === null || _b === void 0 ? void 0 : _b.indexOf("}")) !== -1) {
|
|
109
|
+
const start = candidateParts[i].indexOf("}") + 1, end = (_c = candidateParts[i]) === null || _c === void 0 ? void 0 : _c.length;
|
|
110
|
+
// If the current part of the candidate is a "template" part
|
|
111
|
+
// Try to use the suffix of pattern to match the path
|
|
112
|
+
// {guid} ==> $
|
|
113
|
+
// {guid}:export ==> :export$
|
|
114
|
+
const isMatched = new RegExp(`${(_d = candidateParts[i]) === null || _d === void 0 ? void 0 : _d.slice(start, end)}`).test(pathParts[j] || "");
|
|
115
|
+
if (!isMatched) {
|
|
100
116
|
found = false;
|
|
101
117
|
break;
|
|
102
118
|
}
|
|
119
|
+
continue;
|
|
103
120
|
}
|
|
104
|
-
//
|
|
105
|
-
//
|
|
106
|
-
// the path
|
|
107
|
-
if (
|
|
108
|
-
|
|
121
|
+
// If the candidate part is not a template and
|
|
122
|
+
// the parts don't match mark the candidate as not found
|
|
123
|
+
// to move on with the next candidate path.
|
|
124
|
+
if (candidateParts[i] !== pathParts[j]) {
|
|
125
|
+
found = false;
|
|
126
|
+
break;
|
|
109
127
|
}
|
|
110
128
|
}
|
|
129
|
+
// We finished evaluating the current candidate parts
|
|
130
|
+
// Update the matched value if and only if we found the longer pattern
|
|
131
|
+
if (found && candidatePath.length > matchedLen) {
|
|
132
|
+
matchedLen = candidatePath.length;
|
|
133
|
+
matchedValue = value;
|
|
134
|
+
}
|
|
111
135
|
}
|
|
112
|
-
|
|
113
|
-
return [];
|
|
114
|
-
}
|
|
115
|
-
function hasParametrizedPath(path) {
|
|
116
|
-
return path.includes("/{");
|
|
136
|
+
return matchedValue;
|
|
117
137
|
}
|
|
118
138
|
function getPathFromMapKey(mapKey) {
|
|
119
139
|
const pathStart = mapKey.indexOf("/");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/generated/src/confidentialLedger.ts","../src/confidentialLedger.ts","../src/generated/src/isUnexpected.ts","../src/generated/src/paginateHelper.ts","../src/getLedgerIdentity.ts","../src/index.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { ConfidentialLedgerClient } from \"./clientDefinitions\";\n\nexport default function createClient(\n ledgerEndpoint: string,\n credentials: TokenCredential,\n options: ClientOptions = {}\n): ConfidentialLedgerClient {\n const baseUrl = options.baseUrl ?? `${ledgerEndpoint}`;\n options.apiVersion = options.apiVersion ?? \"2022-05-13\";\n options = {\n ...options,\n credentials: {\n scopes: [\"https://confidential-ledger.azure.com/.default\"]\n }\n };\n\n const userAgentInfo = `azsdk-js-confidential-ledger-rest/1.0.0`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix\n }\n };\n\n const client = getClient(\n baseUrl,\n credentials,\n options\n ) as ConfidentialLedgerClient;\n\n return client;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TokenCredential, isTokenCredential } from \"@azure/core-auth\";\n\nimport { ClientOptions } from \"@azure-rest/core-client\";\nimport { ConfidentialLedgerClient } from \"./generated/src/clientDefinitions\";\nimport GeneratedConfidentialLedger from \"./generated/src/confidentialLedger\";\n\nexport default function ConfidentialLedger(\n ledgerEndpoint: string,\n ledgerIdentityCertificate: string,\n options?: ClientOptions\n): ConfidentialLedgerClient;\nexport default function ConfidentialLedger(\n ledgerEndpoint: string,\n ledgerIdentityCertificate: string,\n credentials: TokenCredential,\n options?: ClientOptions\n): ConfidentialLedgerClient;\nexport default function ConfidentialLedger(\n ledgerEndpoint: string,\n ledgerIdentityCertificate: string,\n credentialsOrOptions?: TokenCredential | ClientOptions,\n opts?: ClientOptions\n): ConfidentialLedgerClient {\n let credentials: TokenCredential | undefined;\n let options: ClientOptions;\n\n if (isTokenCredential(credentialsOrOptions)) {\n credentials = credentialsOrOptions;\n options = opts ?? {};\n } else {\n options = credentialsOrOptions ?? {};\n }\n\n const tlsOptions = options?.tlsOptions ?? {};\n tlsOptions.ca = ledgerIdentityCertificate;\n const confidentialLedger = GeneratedConfidentialLedger(ledgerEndpoint, credentials!, {\n ...options,\n tlsOptions,\n });\n return confidentialLedger;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n GetConstitution200Response,\n GetConstitutiondefaultResponse,\n ListConsortiumMembers200Response,\n ListConsortiumMembersdefaultResponse,\n GetEnclaveQuotes200Response,\n GetEnclaveQuotesdefaultResponse,\n ListCollections200Response,\n ListCollectionsdefaultResponse,\n ListLedgerEntries200Response,\n ListLedgerEntriesdefaultResponse,\n CreateLedgerEntry200Response,\n CreateLedgerEntrydefaultResponse,\n GetLedgerEntry200Response,\n GetLedgerEntrydefaultResponse,\n GetReceipt200Response,\n GetReceiptdefaultResponse,\n GetTransactionStatus200Response,\n GetTransactionStatusdefaultResponse,\n GetCurrentLedgerEntry200Response,\n GetCurrentLedgerEntrydefaultResponse,\n DeleteUser204Response,\n DeleteUserdefaultResponse,\n GetUser200Response,\n GetUserdefaultResponse,\n CreateOrUpdateUser200Response,\n CreateOrUpdateUserdefaultResponse\n} from \"./responses\";\n\nconst responseMap: Record<string, string[]> = {\n \"GET /app/governance/constitution\": [\"200\"],\n \"GET /app/governance/members\": [\"200\"],\n \"GET /app/enclaveQuotes\": [\"200\"],\n \"GET /app/collections\": [\"200\"],\n \"GET /app/transactions\": [\"200\"],\n \"POST /app/transactions\": [\"200\"],\n \"GET /app/transactions/{transactionId}\": [\"200\"],\n \"GET /app/transactions/{transactionId}/receipt\": [\"200\"],\n \"GET /app/transactions/{transactionId}/status\": [\"200\"],\n \"GET /app/transactions/current\": [\"200\"],\n \"DELETE /app/users/{userId}\": [\"204\"],\n \"GET /app/users/{userId}\": [\"200\"],\n \"PATCH /app/users/{userId}\": [\"200\"]\n};\n\nexport function isUnexpected(\n response: GetConstitution200Response | GetConstitutiondefaultResponse\n): response is GetConstitutiondefaultResponse;\nexport function isUnexpected(\n response:\n | ListConsortiumMembers200Response\n | ListConsortiumMembersdefaultResponse\n): response is ListConsortiumMembersdefaultResponse;\nexport function isUnexpected(\n response: GetEnclaveQuotes200Response | GetEnclaveQuotesdefaultResponse\n): response is GetEnclaveQuotesdefaultResponse;\nexport function isUnexpected(\n response: ListCollections200Response | ListCollectionsdefaultResponse\n): response is ListCollectionsdefaultResponse;\nexport function isUnexpected(\n response: ListLedgerEntries200Response | ListLedgerEntriesdefaultResponse\n): response is ListLedgerEntriesdefaultResponse;\nexport function isUnexpected(\n response: CreateLedgerEntry200Response | CreateLedgerEntrydefaultResponse\n): response is CreateLedgerEntrydefaultResponse;\nexport function isUnexpected(\n response: GetLedgerEntry200Response | GetLedgerEntrydefaultResponse\n): response is GetLedgerEntrydefaultResponse;\nexport function isUnexpected(\n response: GetReceipt200Response | GetReceiptdefaultResponse\n): response is GetReceiptdefaultResponse;\nexport function isUnexpected(\n response:\n | GetTransactionStatus200Response\n | GetTransactionStatusdefaultResponse\n): response is GetTransactionStatusdefaultResponse;\nexport function isUnexpected(\n response:\n | GetCurrentLedgerEntry200Response\n | GetCurrentLedgerEntrydefaultResponse\n): response is GetCurrentLedgerEntrydefaultResponse;\nexport function isUnexpected(\n response: DeleteUser204Response | DeleteUserdefaultResponse\n): response is DeleteUserdefaultResponse;\nexport function isUnexpected(\n response: GetUser200Response | GetUserdefaultResponse\n): response is GetUserdefaultResponse;\nexport function isUnexpected(\n response: CreateOrUpdateUser200Response | CreateOrUpdateUserdefaultResponse\n): response is CreateOrUpdateUserdefaultResponse;\nexport function isUnexpected(\n response:\n | GetConstitution200Response\n | GetConstitutiondefaultResponse\n | ListConsortiumMembers200Response\n | ListConsortiumMembersdefaultResponse\n | GetEnclaveQuotes200Response\n | GetEnclaveQuotesdefaultResponse\n | ListCollections200Response\n | ListCollectionsdefaultResponse\n | ListLedgerEntries200Response\n | ListLedgerEntriesdefaultResponse\n | CreateLedgerEntry200Response\n | CreateLedgerEntrydefaultResponse\n | GetLedgerEntry200Response\n | GetLedgerEntrydefaultResponse\n | GetReceipt200Response\n | GetReceiptdefaultResponse\n | GetTransactionStatus200Response\n | GetTransactionStatusdefaultResponse\n | GetCurrentLedgerEntry200Response\n | GetCurrentLedgerEntrydefaultResponse\n | DeleteUser204Response\n | DeleteUserdefaultResponse\n | GetUser200Response\n | GetUserdefaultResponse\n | CreateOrUpdateUser200Response\n | CreateOrUpdateUserdefaultResponse\n): response is\n | GetConstitutiondefaultResponse\n | ListConsortiumMembersdefaultResponse\n | GetEnclaveQuotesdefaultResponse\n | ListCollectionsdefaultResponse\n | ListLedgerEntriesdefaultResponse\n | CreateLedgerEntrydefaultResponse\n | GetLedgerEntrydefaultResponse\n | GetReceiptdefaultResponse\n | GetTransactionStatusdefaultResponse\n | GetCurrentLedgerEntrydefaultResponse\n | DeleteUserdefaultResponse\n | GetUserdefaultResponse\n | CreateOrUpdateUserdefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = geParametrizedPathSuccess(url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction geParametrizedPathSuccess(path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // If the candidate and actual paths don't match in size\n // we move on to the next candidate path\n if (\n candidateParts.length === pathParts.length &&\n hasParametrizedPath(key)\n ) {\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = 0; i < candidateParts.length; i++) {\n if (\n candidateParts[i].startsWith(\"{\") &&\n candidateParts[i].endsWith(\"}\")\n ) {\n // If the current part of the candidate is a \"template\" part\n // it is a match with the actual path part on hand\n // skip as the parameterized part can match anything\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[i]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // if all parts matched we return the success values form\n // the path mapping.\n if (found) {\n return value;\n }\n }\n }\n\n // No match was found, return an empty array.\n return [];\n}\n\nfunction hasParametrizedPath(path: string): boolean {\n return path.includes(\"/{\");\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n getPagedAsyncIterator,\n PagedAsyncIterableIterator,\n PagedResult\n} from \"@azure/core-paging\";\nimport {\n Client,\n createRestError,\n PathUncheckedResponse\n} from \"@azure-rest/core-client\";\n\n/**\n * Helper type to extract the type of an array\n */\nexport type GetArrayType<T> = T extends Array<infer TData> ? TData : never;\n\n/**\n * The type of a custom function that defines how to get a page and a link to the next one if any.\n */\nexport type GetPage<TPage> = (\n pageLink: string,\n maxPageSize?: number\n) => Promise<{\n page: TPage;\n nextPageLink?: string;\n}>;\n\n/**\n * Options for the paging helper\n */\nexport interface PagingOptions<TResponse> {\n /**\n * Custom function to extract pagination details for crating the PagedAsyncIterableIterator\n */\n customGetPage?: GetPage<PaginateReturn<TResponse>[]>;\n}\n\n/**\n * Helper type to infer the Type of the paged elements from the response type\n * This type is generated based on the swagger information for x-ms-pageable\n * specifically on the itemName property which indicates the property of the response\n * where the page items are found. The default value is `value`.\n * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter\n */\nexport type PaginateReturn<TResult> = TResult extends\n | {\n body: { value?: infer TPage };\n }\n | {\n body: { members?: infer TPage };\n }\n | {\n body: { collections?: infer TPage };\n }\n | {\n body: { entries?: infer TPage };\n }\n ? GetArrayType<TPage>\n : Array<unknown>;\n\n/**\n * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension\n * @param client - Client to use for sending the next page requests\n * @param initialResponse - Initial response containing the nextLink and current page of elements\n * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results\n * @returns - PagedAsyncIterableIterator to iterate the elements\n */\nexport function paginate<TResponse extends PathUncheckedResponse>(\n client: Client,\n initialResponse: TResponse,\n options: PagingOptions<TResponse> = {}\n): PagedAsyncIterableIterator<PaginateReturn<TResponse>> {\n // Extract element type from initial response\n type TElement = PaginateReturn<TResponse>;\n let firstRun = true;\n // We need to check the response for success before trying to inspect it looking for\n // the properties to use for nextLink and itemName\n checkPagingRequest(initialResponse);\n const { itemName, nextLinkName } = getPaginationProperties(initialResponse);\n const { customGetPage } = options;\n const pagedResult: PagedResult<TElement[]> = {\n firstPageLink: \"\",\n getPage:\n typeof customGetPage === \"function\"\n ? customGetPage\n : async (pageLink: string) => {\n const result = firstRun\n ? initialResponse\n : await client.pathUnchecked(pageLink).get();\n firstRun = false;\n checkPagingRequest(result);\n const nextLink = getNextLink(result.body, nextLinkName);\n const values = getElements<TElement>(result.body, itemName);\n return {\n page: values,\n nextPageLink: nextLink\n };\n }\n };\n\n return getPagedAsyncIterator(pagedResult);\n}\n\n/**\n * Gets for the value of nextLink in the body\n */\nfunction getNextLink(body: unknown, nextLinkName?: string): string | undefined {\n if (!nextLinkName) {\n return undefined;\n }\n\n const nextLink = (body as Record<string, unknown>)[nextLinkName];\n\n if (typeof nextLink !== \"string\" && typeof nextLink !== \"undefined\") {\n throw new Error(\n `Body Property ${nextLinkName} should be a string or undefined`\n );\n }\n\n return nextLink;\n}\n\n/**\n * Gets the elements of the current request in the body.\n */\nfunction getElements<T = unknown>(body: unknown, itemName: string): T[] {\n const value = (body as Record<string, unknown>)[itemName] as T[];\n\n // value has to be an array according to the x-ms-pageable extension.\n // The fact that this must be an array is used above to calculate the\n // type of elements in the page in PaginateReturn\n if (!Array.isArray(value)) {\n throw new Error(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${itemName}`\n );\n }\n\n return value ?? [];\n}\n\n/**\n * Checks if a request failed\n */\nfunction checkPagingRequest(response: PathUncheckedResponse): void {\n const Http2xxStatusCodes = [\n \"200\",\n \"201\",\n \"202\",\n \"203\",\n \"204\",\n \"205\",\n \"206\",\n \"207\",\n \"208\",\n \"226\"\n ];\n if (!Http2xxStatusCodes.includes(response.status)) {\n throw createRestError(\n `Pagination failed with unexpected statusCode ${response.status}`,\n response\n );\n }\n}\n\n/**\n * Extracts the itemName and nextLinkName from the initial response to use them for pagination\n */\nfunction getPaginationProperties(initialResponse: PathUncheckedResponse) {\n // Build a set with the passed custom nextLinkNames\n const nextLinkNames = new Set([\"nextLink\", \"@nextLink\"]);\n\n // Build a set with the passed custom set of itemNames\n const itemNames = new Set([\"value\", \"members\", \"collections\", \"entries\"]);\n\n let nextLinkName: string | undefined;\n let itemName: string | undefined;\n\n for (const name of nextLinkNames) {\n const nextLink = (initialResponse.body as Record<string, unknown>)[\n name\n ] as string;\n if (nextLink) {\n nextLinkName = name;\n break;\n }\n }\n\n for (const name of itemNames) {\n const item = (initialResponse.body as Record<string, unknown>)[\n name\n ] as string;\n if (item) {\n itemName = name;\n break;\n }\n }\n\n if (!itemName) {\n throw new Error(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${[\n ...itemNames\n ].join(\" OR \")}`\n );\n }\n\n return { itemName, nextLinkName };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getClient } from \"@azure-rest/core-client\";\n\nexport interface LedgerIdentity {\n ledgerIdentityCertificate: string;\n ledgerId: string;\n}\n\nexport async function getLedgerIdentity(\n ledgerId: string,\n identityServiceBaseUrl: string = \"https://identity.confidential-ledger.core.azure.com\"\n): Promise<LedgerIdentity> {\n const client = getClient(identityServiceBaseUrl);\n\n const cert = await client.pathUnchecked(\"/ledgerIdentity/{ledgerId}\", ledgerId).get();\n\n const updatedCert = {\n ledgerIdentityCertificate: cert.body[\"ledgerTlsCertificate\"],\n ledgerId: cert.body[\"ledgerId\"],\n };\n\n if (!isLedgerIdentity(updatedCert)) {\n throw new Error(\n \"Body received from Confidential Ledger Identity is invalid. It must contain ledgerId and ledgerIdentityCertificate\"\n );\n }\n\n return updatedCert;\n}\n\nfunction isLedgerIdentity(identity: any): identity is LedgerIdentity {\n return identity.ledgerIdentityCertificate && identity.ledgerId;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport ConfidentialLedger from \"./confidentialLedger\";\nexport * from \"./generated/src/confidentialLedger\";\nexport * from \"./generated/src/models\";\nexport * from \"./generated/src/parameters\";\nexport * from \"./generated/src/responses\";\nexport * from \"./generated/src/clientDefinitions\";\nexport * from \"./generated/src/isUnexpected\";\nexport * from \"./generated/src/outputModels\";\nexport * from \"./generated/src/paginateHelper\";\nexport { LedgerIdentity, getLedgerIdentity } from \"./getLedgerIdentity\";\nexport default ConfidentialLedger;\n"],"names":["getClient","isTokenCredential","GeneratedConfidentialLedger","getPagedAsyncIterator","createRestError"],"mappings":";;;;;;;;AAAA;AAOc,SAAU,YAAY,CAClC,cAAsB,EACtB,WAA4B,EAC5B,OAAA,GAAyB,EAAE,EAAA;;IAE3B,MAAM,OAAO,GAAG,CAAA,EAAA,GAAA,OAAO,CAAC,OAAO,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,CAAA,EAAG,cAAc,CAAA,CAAE,CAAC;IACvD,OAAO,CAAC,UAAU,GAAG,CAAA,EAAA,GAAA,OAAO,CAAC,UAAU,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,YAAY,CAAC;AACxD,IAAA,OAAO,GACF,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,OAAO,CACV,EAAA,EAAA,WAAW,EAAE;YACX,MAAM,EAAE,CAAC,gDAAgD,CAAC;AAC3D,SAAA,EAAA,CACF,CAAC;IAEF,MAAM,aAAa,GAAG,CAAA,uCAAA,CAAyC,CAAC;IAChE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;UAChE,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,CAAI,CAAA,EAAA,aAAa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IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,EAAE;AAClC,QAAA,MAAM,IAAI,KAAK,CACb,oHAAoH,CACrH,CAAC;AACH,KAAA;AAED,IAAA,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,SAAS,gBAAgB,CAAC,QAAa,EAAA;AACrC,IAAA,OAAO,QAAQ,CAAC,yBAAyB,IAAI,QAAQ,CAAC,QAAQ,CAAC;AACjE;;AClCA;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/generated/src/logger.ts","../src/generated/src/confidentialLedger.ts","../src/confidentialLedger.ts","../src/generated/src/isUnexpected.ts","../src/generated/src/paginateHelper.ts","../src/getLedgerIdentity.ts","../src/index.ts"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"confidential-ledger\");\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger\";\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { ConfidentialLedgerClient } from \"./clientDefinitions\";\n\n/**\n * Initialize a new instance of `ConfidentialLedgerClient`\n * @param ledgerEndpoint - The Confidential Ledger URL, for example https://contoso.confidentialledger.azure.com\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n ledgerEndpoint: string,\n credentials: TokenCredential,\n options: ClientOptions = {}\n): ConfidentialLedgerClient {\n const baseUrl = options.baseUrl ?? `${ledgerEndpoint}`;\n options.apiVersion = options.apiVersion ?? \"2022-05-13\";\n options = {\n ...options,\n credentials: {\n scopes: options.credentials?.scopes ?? [\n \"https://confidential-ledger.azure.com/.default\"\n ]\n }\n };\n\n const userAgentInfo = `azsdk-js-confidential-ledger-rest/1.0.1`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info\n }\n };\n\n const client = getClient(\n baseUrl,\n credentials,\n options\n ) as ConfidentialLedgerClient;\n\n return client;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { TokenCredential, isTokenCredential } from \"@azure/core-auth\";\n\nimport { ClientOptions } from \"@azure-rest/core-client\";\nimport { ConfidentialLedgerClient } from \"./generated/src/clientDefinitions\";\nimport GeneratedConfidentialLedger from \"./generated/src/confidentialLedger\";\n\nexport default function ConfidentialLedger(\n ledgerEndpoint: string,\n ledgerIdentityCertificate: string,\n options?: ClientOptions\n): ConfidentialLedgerClient;\nexport default function ConfidentialLedger(\n ledgerEndpoint: string,\n ledgerIdentityCertificate: string,\n credentials: TokenCredential,\n options?: ClientOptions\n): ConfidentialLedgerClient;\nexport default function ConfidentialLedger(\n ledgerEndpoint: string,\n ledgerIdentityCertificate: string,\n credentialsOrOptions?: TokenCredential | ClientOptions,\n opts?: ClientOptions\n): ConfidentialLedgerClient {\n let credentials: TokenCredential | undefined;\n let options: ClientOptions;\n\n if (isTokenCredential(credentialsOrOptions)) {\n credentials = credentialsOrOptions;\n options = opts ?? {};\n } else {\n options = credentialsOrOptions ?? {};\n }\n\n const tlsOptions = options?.tlsOptions ?? {};\n tlsOptions.ca = ledgerIdentityCertificate;\n const confidentialLedger = GeneratedConfidentialLedger(ledgerEndpoint, credentials!, {\n ...options,\n tlsOptions,\n });\n return confidentialLedger;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n GetConstitution200Response,\n GetConstitutionDefaultResponse,\n ListConsortiumMembers200Response,\n ListConsortiumMembersDefaultResponse,\n GetEnclaveQuotes200Response,\n GetEnclaveQuotesDefaultResponse,\n ListCollections200Response,\n ListCollectionsDefaultResponse,\n ListLedgerEntries200Response,\n ListLedgerEntriesDefaultResponse,\n CreateLedgerEntry200Response,\n CreateLedgerEntryDefaultResponse,\n GetLedgerEntry200Response,\n GetLedgerEntryDefaultResponse,\n GetReceipt200Response,\n GetReceiptDefaultResponse,\n GetTransactionStatus200Response,\n GetTransactionStatusDefaultResponse,\n GetCurrentLedgerEntry200Response,\n GetCurrentLedgerEntryDefaultResponse,\n DeleteUser204Response,\n DeleteUserDefaultResponse,\n GetUser200Response,\n GetUserDefaultResponse,\n CreateOrUpdateUser200Response,\n CreateOrUpdateUserDefaultResponse\n} from \"./responses\";\n\nconst responseMap: Record<string, string[]> = {\n \"GET /app/governance/constitution\": [\"200\"],\n \"GET /app/governance/members\": [\"200\"],\n \"GET /app/enclaveQuotes\": [\"200\"],\n \"GET /app/collections\": [\"200\"],\n \"GET /app/transactions\": [\"200\"],\n \"POST /app/transactions\": [\"200\"],\n \"GET /app/transactions/{transactionId}\": [\"200\"],\n \"GET /app/transactions/{transactionId}/receipt\": [\"200\"],\n \"GET /app/transactions/{transactionId}/status\": [\"200\"],\n \"GET /app/transactions/current\": [\"200\"],\n \"DELETE /app/users/{userId}\": [\"204\"],\n \"GET /app/users/{userId}\": [\"200\"],\n \"PATCH /app/users/{userId}\": [\"200\"]\n};\n\nexport function isUnexpected(\n response: GetConstitution200Response | GetConstitutionDefaultResponse\n): response is GetConstitutionDefaultResponse;\nexport function isUnexpected(\n response:\n | ListConsortiumMembers200Response\n | ListConsortiumMembersDefaultResponse\n): response is ListConsortiumMembersDefaultResponse;\nexport function isUnexpected(\n response: GetEnclaveQuotes200Response | GetEnclaveQuotesDefaultResponse\n): response is GetEnclaveQuotesDefaultResponse;\nexport function isUnexpected(\n response: ListCollections200Response | ListCollectionsDefaultResponse\n): response is ListCollectionsDefaultResponse;\nexport function isUnexpected(\n response: ListLedgerEntries200Response | ListLedgerEntriesDefaultResponse\n): response is ListLedgerEntriesDefaultResponse;\nexport function isUnexpected(\n response: CreateLedgerEntry200Response | CreateLedgerEntryDefaultResponse\n): response is CreateLedgerEntryDefaultResponse;\nexport function isUnexpected(\n response: GetLedgerEntry200Response | GetLedgerEntryDefaultResponse\n): response is GetLedgerEntryDefaultResponse;\nexport function isUnexpected(\n response: GetReceipt200Response | GetReceiptDefaultResponse\n): response is GetReceiptDefaultResponse;\nexport function isUnexpected(\n response:\n | GetTransactionStatus200Response\n | GetTransactionStatusDefaultResponse\n): response is GetTransactionStatusDefaultResponse;\nexport function isUnexpected(\n response:\n | GetCurrentLedgerEntry200Response\n | GetCurrentLedgerEntryDefaultResponse\n): response is GetCurrentLedgerEntryDefaultResponse;\nexport function isUnexpected(\n response: DeleteUser204Response | DeleteUserDefaultResponse\n): response is DeleteUserDefaultResponse;\nexport function isUnexpected(\n response: GetUser200Response | GetUserDefaultResponse\n): response is GetUserDefaultResponse;\nexport function isUnexpected(\n response: CreateOrUpdateUser200Response | CreateOrUpdateUserDefaultResponse\n): response is CreateOrUpdateUserDefaultResponse;\nexport function isUnexpected(\n response:\n | GetConstitution200Response\n | GetConstitutionDefaultResponse\n | ListConsortiumMembers200Response\n | ListConsortiumMembersDefaultResponse\n | GetEnclaveQuotes200Response\n | GetEnclaveQuotesDefaultResponse\n | ListCollections200Response\n | ListCollectionsDefaultResponse\n | ListLedgerEntries200Response\n | ListLedgerEntriesDefaultResponse\n | CreateLedgerEntry200Response\n | CreateLedgerEntryDefaultResponse\n | GetLedgerEntry200Response\n | GetLedgerEntryDefaultResponse\n | GetReceipt200Response\n | GetReceiptDefaultResponse\n | GetTransactionStatus200Response\n | GetTransactionStatusDefaultResponse\n | GetCurrentLedgerEntry200Response\n | GetCurrentLedgerEntryDefaultResponse\n | DeleteUser204Response\n | DeleteUserDefaultResponse\n | GetUser200Response\n | GetUserDefaultResponse\n | CreateOrUpdateUser200Response\n | CreateOrUpdateUserDefaultResponse\n): response is\n | GetConstitutionDefaultResponse\n | ListConsortiumMembersDefaultResponse\n | GetEnclaveQuotesDefaultResponse\n | ListCollectionsDefaultResponse\n | ListLedgerEntriesDefaultResponse\n | CreateLedgerEntryDefaultResponse\n | GetLedgerEntryDefaultResponse\n | GetReceiptDefaultResponse\n | GetTransactionStatusDefaultResponse\n | GetCurrentLedgerEntryDefaultResponse\n | DeleteUserDefaultResponse\n | GetUserDefaultResponse\n | CreateOrUpdateUserDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (\n let i = candidateParts.length - 1, j = pathParts.length - 1;\n i >= 1 && j >= 1;\n i--, j--\n ) {\n if (\n candidateParts[i]?.startsWith(\"{\") &&\n candidateParts[i]?.indexOf(\"}\") !== -1\n ) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(\n `${candidateParts[i]?.slice(start, end)}`\n ).test(pathParts[j] || \"\");\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n getPagedAsyncIterator,\n PagedAsyncIterableIterator,\n PagedResult\n} from \"@azure/core-paging\";\nimport {\n Client,\n createRestError,\n PathUncheckedResponse\n} from \"@azure-rest/core-client\";\n\n/**\n * Helper type to extract the type of an array\n */\nexport type GetArrayType<T> = T extends Array<infer TData> ? TData : never;\n\n/**\n * The type of a custom function that defines how to get a page and a link to the next one if any.\n */\nexport type GetPage<TPage> = (\n pageLink: string,\n maxPageSize?: number\n) => Promise<{\n page: TPage;\n nextPageLink?: string;\n}>;\n\n/**\n * Options for the paging helper\n */\nexport interface PagingOptions<TResponse> {\n /**\n * Custom function to extract pagination details for crating the PagedAsyncIterableIterator\n */\n customGetPage?: GetPage<PaginateReturn<TResponse>[]>;\n}\n\n/**\n * Helper type to infer the Type of the paged elements from the response type\n * This type is generated based on the swagger information for x-ms-pageable\n * specifically on the itemName property which indicates the property of the response\n * where the page items are found. The default value is `value`.\n * This type will allow us to provide strongly typed Iterator based on the response we get as second parameter\n */\nexport type PaginateReturn<TResult> = TResult extends\n | {\n body: { value?: infer TPage };\n }\n | {\n body: { members?: infer TPage };\n }\n | {\n body: { collections?: infer TPage };\n }\n | {\n body: { entries?: infer TPage };\n }\n ? GetArrayType<TPage>\n : Array<unknown>;\n\n/**\n * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension\n * @param client - Client to use for sending the next page requests\n * @param initialResponse - Initial response containing the nextLink and current page of elements\n * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results\n * @returns - PagedAsyncIterableIterator to iterate the elements\n */\nexport function paginate<TResponse extends PathUncheckedResponse>(\n client: Client,\n initialResponse: TResponse,\n options: PagingOptions<TResponse> = {}\n): PagedAsyncIterableIterator<PaginateReturn<TResponse>> {\n // Extract element type from initial response\n type TElement = PaginateReturn<TResponse>;\n let firstRun = true;\n // We need to check the response for success before trying to inspect it looking for\n // the properties to use for nextLink and itemName\n checkPagingRequest(initialResponse);\n const { itemName, nextLinkName } = getPaginationProperties(initialResponse);\n const { customGetPage } = options;\n const pagedResult: PagedResult<TElement[]> = {\n firstPageLink: \"\",\n getPage:\n typeof customGetPage === \"function\"\n ? customGetPage\n : async (pageLink: string) => {\n const result = firstRun\n ? initialResponse\n : await client.pathUnchecked(pageLink).get();\n firstRun = false;\n checkPagingRequest(result);\n const nextLink = getNextLink(result.body, nextLinkName);\n const values = getElements<TElement>(result.body, itemName);\n return {\n page: values,\n nextPageLink: nextLink\n };\n }\n };\n\n return getPagedAsyncIterator(pagedResult);\n}\n\n/**\n * Gets for the value of nextLink in the body\n */\nfunction getNextLink(body: unknown, nextLinkName?: string): string | undefined {\n if (!nextLinkName) {\n return undefined;\n }\n\n const nextLink = (body as Record<string, unknown>)[nextLinkName];\n\n if (typeof nextLink !== \"string\" && typeof nextLink !== \"undefined\") {\n throw new Error(\n `Body Property ${nextLinkName} should be a string or undefined`\n );\n }\n\n return nextLink;\n}\n\n/**\n * Gets the elements of the current request in the body.\n */\nfunction getElements<T = unknown>(body: unknown, itemName: string): T[] {\n const value = (body as Record<string, unknown>)[itemName] as T[];\n\n // value has to be an array according to the x-ms-pageable extension.\n // The fact that this must be an array is used above to calculate the\n // type of elements in the page in PaginateReturn\n if (!Array.isArray(value)) {\n throw new Error(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${itemName}`\n );\n }\n\n return value ?? [];\n}\n\n/**\n * Checks if a request failed\n */\nfunction checkPagingRequest(response: PathUncheckedResponse): void {\n const Http2xxStatusCodes = [\n \"200\",\n \"201\",\n \"202\",\n \"203\",\n \"204\",\n \"205\",\n \"206\",\n \"207\",\n \"208\",\n \"226\"\n ];\n if (!Http2xxStatusCodes.includes(response.status)) {\n throw createRestError(\n `Pagination failed with unexpected statusCode ${response.status}`,\n response\n );\n }\n}\n\n/**\n * Extracts the itemName and nextLinkName from the initial response to use them for pagination\n */\nfunction getPaginationProperties(initialResponse: PathUncheckedResponse) {\n // Build a set with the passed custom nextLinkNames\n const nextLinkNames = new Set([\"nextLink\", \"@nextLink\"]);\n\n // Build a set with the passed custom set of itemNames\n const itemNames = new Set([\"value\", \"members\", \"collections\", \"entries\"]);\n\n let nextLinkName: string | undefined;\n let itemName: string | undefined;\n\n for (const name of nextLinkNames) {\n const nextLink = (initialResponse.body as Record<string, unknown>)[\n name\n ] as string;\n if (nextLink) {\n nextLinkName = name;\n break;\n }\n }\n\n for (const name of itemNames) {\n const item = (initialResponse.body as Record<string, unknown>)[\n name\n ] as string;\n if (item) {\n itemName = name;\n break;\n }\n }\n\n if (!itemName) {\n throw new Error(\n `Couldn't paginate response\\n Body doesn't contain an array property with name: ${[\n ...itemNames\n ].join(\" OR \")}`\n );\n }\n\n return { itemName, nextLinkName };\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getClient } from \"@azure-rest/core-client\";\n\nexport interface LedgerIdentity {\n ledgerIdentityCertificate: string;\n ledgerId: string;\n}\n\nexport async function getLedgerIdentity(\n ledgerId: string,\n identityServiceBaseUrl: string = \"https://identity.confidential-ledger.core.azure.com\"\n): Promise<LedgerIdentity> {\n const client = getClient(identityServiceBaseUrl);\n\n const cert = await client.pathUnchecked(\"/ledgerIdentity/{ledgerId}\", ledgerId).get();\n\n const updatedCert = {\n ledgerIdentityCertificate: cert.body[\"ledgerTlsCertificate\"],\n ledgerId: cert.body[\"ledgerId\"],\n };\n\n if (!isLedgerIdentity(updatedCert)) {\n throw new Error(\n \"Body received from Confidential Ledger Identity is invalid. It must contain ledgerId and ledgerIdentityCertificate\"\n );\n }\n\n return updatedCert;\n}\n\nfunction isLedgerIdentity(identity: any): identity is LedgerIdentity {\n return identity.ledgerIdentityCertificate && identity.ledgerId;\n}\n","// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport ConfidentialLedger from \"./confidentialLedger\";\nexport * from \"./generated/src/confidentialLedger\";\nexport * from \"./generated/src/models\";\nexport * from \"./generated/src/parameters\";\nexport * from \"./generated/src/responses\";\nexport * from \"./generated/src/clientDefinitions\";\nexport * from \"./generated/src/isUnexpected\";\nexport * from \"./generated/src/outputModels\";\nexport * from \"./generated/src/paginateHelper\";\nexport { LedgerIdentity, getLedgerIdentity } from \"./getLedgerIdentity\";\nexport default ConfidentialLedger;\n"],"names":["createClientLogger","getClient","isTokenCredential","GeneratedConfidentialLedger","getPagedAsyncIterator","createRestError"],"mappings":";;;;;;;;;AAAA;AAIO,MAAM,MAAM,GAAGA,2BAAkB,CAAC,qBAAqB,CAAC;;ACJ/D;AAQA;;;;;AAKG;AACW,SAAU,YAAY,CAClC,cAAsB,EACtB,WAA4B,EAC5B,OAAA,GAAyB,EAAE,EAAA;;IAE3B,MAAM,OAAO,GAAG,CAAA,EAAA,GAAA,OAAO,CAAC,OAAO,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,CAAA,EAAG,cAAc,CAAA,CAAE,CAAC;IACvD,OAAO,CAAC,UAAU,GAAG,CAAA,EAAA,GAAA,OAAO,CAAC,UAAU,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,EAAA,GAAA,YAAY,CAAC;AACxD,IAAA,OAAO,GACF,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,OAAO,CACV,EAAA,EAAA,WAAW,EAAE;YACX,MAAM,EAAE,MAAA,CAAA,EAAA,GAAA,OAAO,CAAC,WAAW,MAAA,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAE,MAAM,MAAI,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAA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AM,IAAI,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,4BAA4B,EAAE,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC;AAEtF,IAAA,MAAM,WAAW,GAAG;AAClB,QAAA,yBAAyB,EAAE,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC;AAC5D,QAAA,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;KAChC,CAAC;AAEF,IAAA,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,EAAE;AAClC,QAAA,MAAM,IAAI,KAAK,CACb,oHAAoH,CACrH,CAAC;AACH,KAAA;AAED,IAAA,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,SAAS,gBAAgB,CAAC,QAAa,EAAA;AACrC,IAAA,OAAO,QAAQ,CAAC,yBAAyB,IAAI,QAAQ,CAAC,QAAQ,CAAC;AACjE;;AClCA;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clientDefinitions.js","sourceRoot":"","sources":["../../../../src/generated/src/clientDefinitions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n GetConstitutionParameters,\n ListConsortiumMembersParameters,\n GetEnclaveQuotesParameters,\n ListCollectionsParameters,\n ListLedgerEntriesParameters,\n CreateLedgerEntryParameters,\n GetLedgerEntryParameters,\n GetReceiptParameters,\n GetTransactionStatusParameters,\n GetCurrentLedgerEntryParameters,\n DeleteUserParameters,\n GetUserParameters,\n CreateOrUpdateUserParameters\n} from \"./parameters\";\nimport {\n GetConstitution200Response,\n
|
|
1
|
+
{"version":3,"file":"clientDefinitions.js","sourceRoot":"","sources":["../../../../src/generated/src/clientDefinitions.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n GetConstitutionParameters,\n ListConsortiumMembersParameters,\n GetEnclaveQuotesParameters,\n ListCollectionsParameters,\n ListLedgerEntriesParameters,\n CreateLedgerEntryParameters,\n GetLedgerEntryParameters,\n GetReceiptParameters,\n GetTransactionStatusParameters,\n GetCurrentLedgerEntryParameters,\n DeleteUserParameters,\n GetUserParameters,\n CreateOrUpdateUserParameters\n} from \"./parameters\";\nimport {\n GetConstitution200Response,\n GetConstitutionDefaultResponse,\n ListConsortiumMembers200Response,\n ListConsortiumMembersDefaultResponse,\n GetEnclaveQuotes200Response,\n GetEnclaveQuotesDefaultResponse,\n ListCollections200Response,\n ListCollectionsDefaultResponse,\n ListLedgerEntries200Response,\n ListLedgerEntriesDefaultResponse,\n CreateLedgerEntry200Response,\n CreateLedgerEntryDefaultResponse,\n GetLedgerEntry200Response,\n GetLedgerEntryDefaultResponse,\n GetReceipt200Response,\n GetReceiptDefaultResponse,\n GetTransactionStatus200Response,\n GetTransactionStatusDefaultResponse,\n GetCurrentLedgerEntry200Response,\n GetCurrentLedgerEntryDefaultResponse,\n DeleteUser204Response,\n DeleteUserDefaultResponse,\n GetUser200Response,\n GetUserDefaultResponse,\n CreateOrUpdateUser200Response,\n CreateOrUpdateUserDefaultResponse\n} from \"./responses\";\nimport { Client, StreamableMethod } from \"@azure-rest/core-client\";\n\nexport interface GetConstitution {\n /** The constitution is a script that assesses and applies proposals from consortium members. */\n get(\n options?: GetConstitutionParameters\n ): StreamableMethod<\n GetConstitution200Response | GetConstitutionDefaultResponse\n >;\n}\n\nexport interface ListConsortiumMembers {\n /** Consortium members can manage the Confidential Ledger. */\n get(\n options?: ListConsortiumMembersParameters\n ): StreamableMethod<\n ListConsortiumMembers200Response | ListConsortiumMembersDefaultResponse\n >;\n}\n\nexport interface GetEnclaveQuotes {\n /** A quote is an SGX enclave measurement that can be used to verify the validity of a node and its enclave. */\n get(\n options?: GetEnclaveQuotesParameters\n ): StreamableMethod<\n GetEnclaveQuotes200Response | GetEnclaveQuotesDefaultResponse\n >;\n}\n\nexport interface ListCollections {\n /** Collection ids are user-created collections of ledger entries */\n get(\n options?: ListCollectionsParameters\n ): StreamableMethod<\n ListCollections200Response | ListCollectionsDefaultResponse\n >;\n}\n\nexport interface ListLedgerEntries {\n /** A collection id may optionally be specified. Only entries in the specified (or default) collection will be returned. */\n get(\n options?: ListLedgerEntriesParameters\n ): StreamableMethod<\n ListLedgerEntries200Response | ListLedgerEntriesDefaultResponse\n >;\n /** A collection id may optionally be specified. */\n post(\n options: CreateLedgerEntryParameters\n ): StreamableMethod<\n CreateLedgerEntry200Response | CreateLedgerEntryDefaultResponse\n >;\n}\n\nexport interface GetLedgerEntry {\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. */\n get(\n options?: GetLedgerEntryParameters\n ): StreamableMethod<\n GetLedgerEntry200Response | GetLedgerEntryDefaultResponse\n >;\n}\n\nexport interface GetReceipt {\n /** Gets a receipt certifying ledger contents at a particular transaction id. */\n get(\n options?: GetReceiptParameters\n ): StreamableMethod<GetReceipt200Response | GetReceiptDefaultResponse>;\n}\n\nexport interface GetTransactionStatus {\n /** Gets the status of an entry identified by a transaction id. */\n get(\n options?: GetTransactionStatusParameters\n ): StreamableMethod<\n GetTransactionStatus200Response | GetTransactionStatusDefaultResponse\n >;\n}\n\nexport interface GetCurrentLedgerEntry {\n /** A collection id may optionally be specified. */\n get(\n options?: GetCurrentLedgerEntryParameters\n ): StreamableMethod<\n GetCurrentLedgerEntry200Response | GetCurrentLedgerEntryDefaultResponse\n >;\n}\n\nexport interface DeleteUser {\n /** Deletes a user from the Confidential Ledger. */\n delete(\n options?: DeleteUserParameters\n ): StreamableMethod<DeleteUser204Response | DeleteUserDefaultResponse>;\n /** Gets a user. */\n get(\n options?: GetUserParameters\n ): StreamableMethod<GetUser200Response | GetUserDefaultResponse>;\n /** A JSON merge patch is applied for existing users */\n patch(\n options: CreateOrUpdateUserParameters\n ): StreamableMethod<\n CreateOrUpdateUser200Response | CreateOrUpdateUserDefaultResponse\n >;\n}\n\nexport interface Routes {\n /** Resource for '/app/governance/constitution' has methods for the following verbs: get */\n (path: \"/app/governance/constitution\"): GetConstitution;\n /** Resource for '/app/governance/members' has methods for the following verbs: get */\n (path: \"/app/governance/members\"): ListConsortiumMembers;\n /** Resource for '/app/enclaveQuotes' has methods for the following verbs: get */\n (path: \"/app/enclaveQuotes\"): GetEnclaveQuotes;\n /** Resource for '/app/collections' has methods for the following verbs: get */\n (path: \"/app/collections\"): ListCollections;\n /** Resource for '/app/transactions' has methods for the following verbs: get, post */\n (path: \"/app/transactions\"): ListLedgerEntries;\n /** Resource for '/app/transactions/\\{transactionId\\}' has methods for the following verbs: get */\n (\n path: \"/app/transactions/{transactionId}\",\n transactionId: string\n ): GetLedgerEntry;\n /** Resource for '/app/transactions/\\{transactionId\\}/receipt' has methods for the following verbs: get */\n (\n path: \"/app/transactions/{transactionId}/receipt\",\n transactionId: string\n ): GetReceipt;\n /** Resource for '/app/transactions/\\{transactionId\\}/status' has methods for the following verbs: get */\n (\n path: \"/app/transactions/{transactionId}/status\",\n transactionId: string\n ): GetTransactionStatus;\n /** Resource for '/app/transactions/current' has methods for the following verbs: get */\n (path: \"/app/transactions/current\"): GetCurrentLedgerEntry;\n /** Resource for '/app/users/\\{userId\\}' has methods for the following verbs: delete, get, patch */\n (path: \"/app/users/{userId}\", userId: string): DeleteUser;\n}\n\nexport type ConfidentialLedgerClient = Client & {\n path: Routes;\n};\n"]}
|
|
@@ -1,19 +1,30 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT license.
|
|
3
3
|
import { getClient } from "@azure-rest/core-client";
|
|
4
|
+
import { logger } from "./logger";
|
|
5
|
+
/**
|
|
6
|
+
* Initialize a new instance of `ConfidentialLedgerClient`
|
|
7
|
+
* @param ledgerEndpoint - The Confidential Ledger URL, for example https://contoso.confidentialledger.azure.com
|
|
8
|
+
* @param credentials - uniquely identify client credential
|
|
9
|
+
* @param options - the parameter for all optional parameters
|
|
10
|
+
*/
|
|
4
11
|
export default function createClient(ledgerEndpoint, credentials, options = {}) {
|
|
5
|
-
var _a, _b;
|
|
12
|
+
var _a, _b, _c, _d, _e, _f;
|
|
6
13
|
const baseUrl = (_a = options.baseUrl) !== null && _a !== void 0 ? _a : `${ledgerEndpoint}`;
|
|
7
14
|
options.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : "2022-05-13";
|
|
8
15
|
options = Object.assign(Object.assign({}, options), { credentials: {
|
|
9
|
-
scopes:
|
|
16
|
+
scopes: (_d = (_c = options.credentials) === null || _c === void 0 ? void 0 : _c.scopes) !== null && _d !== void 0 ? _d : [
|
|
17
|
+
"https://confidential-ledger.azure.com/.default"
|
|
18
|
+
]
|
|
10
19
|
} });
|
|
11
|
-
const userAgentInfo = `azsdk-js-confidential-ledger-rest/1.0.
|
|
20
|
+
const userAgentInfo = `azsdk-js-confidential-ledger-rest/1.0.1`;
|
|
12
21
|
const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
|
|
13
22
|
? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
|
|
14
23
|
: `${userAgentInfo}`;
|
|
15
24
|
options = Object.assign(Object.assign({}, options), { userAgentOptions: {
|
|
16
25
|
userAgentPrefix
|
|
26
|
+
}, loggingOptions: {
|
|
27
|
+
logger: (_f = (_e = options.loggingOptions) === null || _e === void 0 ? void 0 : _e.logger) !== null && _f !== void 0 ? _f : logger.info
|
|
17
28
|
} });
|
|
18
29
|
const client = getClient(baseUrl, credentials, options);
|
|
19
30
|
return client;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confidentialLedger.js","sourceRoot":"","sources":["../../../../src/generated/src/confidentialLedger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAiB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"confidentialLedger.js","sourceRoot":"","sources":["../../../../src/generated/src/confidentialLedger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAiB,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,cAAsB,EACtB,WAA4B,EAC5B,UAAyB,EAAE;;IAE3B,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,GAAG,cAAc,EAAE,CAAC;IACvD,OAAO,CAAC,UAAU,GAAG,MAAA,OAAO,CAAC,UAAU,mCAAI,YAAY,CAAC;IACxD,OAAO,mCACF,OAAO,KACV,WAAW,EAAE;YACX,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,WAAW,0CAAE,MAAM,mCAAI;gBACrC,gDAAgD;aACjD;SACF,GACF,CAAC;IAEF,MAAM,aAAa,GAAG,yCAAyC,CAAC;IAChE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;QAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,aAAa,EAAE;QAChE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC;IACzB,OAAO,mCACF,OAAO,KACV,gBAAgB,EAAE;YAChB,eAAe;SAChB,EACD,cAAc,EAAE;YACd,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,cAAc,0CAAE,MAAM,mCAAI,MAAM,CAAC,IAAI;SACtD,GACF,CAAC;IAEF,MAAM,MAAM,GAAG,SAAS,CACtB,OAAO,EACP,WAAW,EACX,OAAO,CACoB,CAAC;IAE9B,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { getClient, ClientOptions } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger\";\nimport { TokenCredential } from \"@azure/core-auth\";\nimport { ConfidentialLedgerClient } from \"./clientDefinitions\";\n\n/**\n * Initialize a new instance of `ConfidentialLedgerClient`\n * @param ledgerEndpoint - The Confidential Ledger URL, for example https://contoso.confidentialledger.azure.com\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n ledgerEndpoint: string,\n credentials: TokenCredential,\n options: ClientOptions = {}\n): ConfidentialLedgerClient {\n const baseUrl = options.baseUrl ?? `${ledgerEndpoint}`;\n options.apiVersion = options.apiVersion ?? \"2022-05-13\";\n options = {\n ...options,\n credentials: {\n scopes: options.credentials?.scopes ?? [\n \"https://confidential-ledger.azure.com/.default\"\n ]\n }\n };\n\n const userAgentInfo = `azsdk-js-confidential-ledger-rest/1.0.1`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info\n }\n };\n\n const client = getClient(\n baseUrl,\n credentials,\n options\n ) as ConfidentialLedgerClient;\n\n return client;\n}\n"]}
|
|
@@ -21,54 +21,60 @@ export function isUnexpected(response) {
|
|
|
21
21
|
const method = response.request.method;
|
|
22
22
|
let pathDetails = responseMap[`${method} ${url.pathname}`];
|
|
23
23
|
if (!pathDetails) {
|
|
24
|
-
pathDetails =
|
|
24
|
+
pathDetails = getParametrizedPathSuccess(method, url.pathname);
|
|
25
25
|
}
|
|
26
26
|
return !pathDetails.includes(response.status);
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function getParametrizedPathSuccess(method, path) {
|
|
29
|
+
var _a, _b, _c, _d;
|
|
29
30
|
const pathParts = path.split("/");
|
|
31
|
+
// Traverse list to match the longest candidate
|
|
32
|
+
// matchedLen: the length of candidate path
|
|
33
|
+
// matchedValue: the matched status code array
|
|
34
|
+
let matchedLen = -1, matchedValue = [];
|
|
30
35
|
// Iterate the responseMap to find a match
|
|
31
36
|
for (const [key, value] of Object.entries(responseMap)) {
|
|
32
37
|
// Extracting the path from the map key which is in format
|
|
33
38
|
// GET /path/foo
|
|
39
|
+
if (!key.startsWith(method)) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
34
42
|
const candidatePath = getPathFromMapKey(key);
|
|
35
43
|
// Get each part of the url path
|
|
36
44
|
const candidateParts = candidatePath.split("/");
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
// If the candidate part is not a template and
|
|
52
|
-
// the parts don't match mark the candidate as not found
|
|
53
|
-
// to move on with the next candidate path.
|
|
54
|
-
if (candidateParts[i] !== pathParts[i]) {
|
|
45
|
+
// track if we have found a match to return the values found.
|
|
46
|
+
let found = true;
|
|
47
|
+
for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {
|
|
48
|
+
if (((_a = candidateParts[i]) === null || _a === void 0 ? void 0 : _a.startsWith("{")) &&
|
|
49
|
+
((_b = candidateParts[i]) === null || _b === void 0 ? void 0 : _b.indexOf("}")) !== -1) {
|
|
50
|
+
const start = candidateParts[i].indexOf("}") + 1, end = (_c = candidateParts[i]) === null || _c === void 0 ? void 0 : _c.length;
|
|
51
|
+
// If the current part of the candidate is a "template" part
|
|
52
|
+
// Try to use the suffix of pattern to match the path
|
|
53
|
+
// {guid} ==> $
|
|
54
|
+
// {guid}:export ==> :export$
|
|
55
|
+
const isMatched = new RegExp(`${(_d = candidateParts[i]) === null || _d === void 0 ? void 0 : _d.slice(start, end)}`).test(pathParts[j] || "");
|
|
56
|
+
if (!isMatched) {
|
|
55
57
|
found = false;
|
|
56
58
|
break;
|
|
57
59
|
}
|
|
60
|
+
continue;
|
|
58
61
|
}
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
// the path
|
|
62
|
-
if (
|
|
63
|
-
|
|
62
|
+
// If the candidate part is not a template and
|
|
63
|
+
// the parts don't match mark the candidate as not found
|
|
64
|
+
// to move on with the next candidate path.
|
|
65
|
+
if (candidateParts[i] !== pathParts[j]) {
|
|
66
|
+
found = false;
|
|
67
|
+
break;
|
|
64
68
|
}
|
|
65
69
|
}
|
|
70
|
+
// We finished evaluating the current candidate parts
|
|
71
|
+
// Update the matched value if and only if we found the longer pattern
|
|
72
|
+
if (found && candidatePath.length > matchedLen) {
|
|
73
|
+
matchedLen = candidatePath.length;
|
|
74
|
+
matchedValue = value;
|
|
75
|
+
}
|
|
66
76
|
}
|
|
67
|
-
|
|
68
|
-
return [];
|
|
69
|
-
}
|
|
70
|
-
function hasParametrizedPath(path) {
|
|
71
|
-
return path.includes("/{");
|
|
77
|
+
return matchedValue;
|
|
72
78
|
}
|
|
73
79
|
function getPathFromMapKey(mapKey) {
|
|
74
80
|
const pathStart = mapKey.indexOf("/");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../../../src/generated/src/isUnexpected.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AA+BlC,MAAM,WAAW,GAA6B;IAC5C,kCAAkC,EAAE,CAAC,KAAK,CAAC;IAC3C,6BAA6B,EAAE,CAAC,KAAK,CAAC;IACtC,wBAAwB,EAAE,CAAC,KAAK,CAAC;IACjC,sBAAsB,EAAE,CAAC,KAAK,CAAC;IAC/B,uBAAuB,EAAE,CAAC,KAAK,CAAC;IAChC,wBAAwB,EAAE,CAAC,KAAK,CAAC;IACjC,uCAAuC,EAAE,CAAC,KAAK,CAAC;IAChD,+CAA+C,EAAE,CAAC,KAAK,CAAC;IACxD,8CAA8C,EAAE,CAAC,KAAK,CAAC;IACvD,+BAA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A,6DAA6D;YAC7D,IAAI,KAAK,GAAG,IAAI,CAAC;YACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC9C,IACE,cAAc,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC;oBACjC,cAAc,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAC/B;oBACA,4DAA4D;oBAC5D,kDAAkD;oBAClD,oDAAoD;oBACpD,SAAS;iBACV;gBAED,8CAA8C;gBAC9C,wDAAwD;gBACxD,2CAA2C;gBAC3C,IAAI,cAAc,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE;oBACtC,KAAK,GAAG,KAAK,CAAC;oBACd,MAAM;iBACP;aACF;YAED,qDAAqD;YACrD,yDAAyD;YACzD,oBAAoB;YACpB,IAAI,KAAK,EAAE;gBACT,OAAO,KAAK,CAAC;aACd;SACF;KACF;IAED,6CAA6C;IAC7C,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAS,mBAAmB,CAAC,IAAY;IACvC,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n GetConstitution200Response,\n GetConstitutiondefaultResponse,\n ListConsortiumMembers200Response,\n ListConsortiumMembersdefaultResponse,\n GetEnclaveQuotes200Response,\n GetEnclaveQuotesdefaultResponse,\n ListCollections200Response,\n ListCollectionsdefaultResponse,\n ListLedgerEntries200Response,\n ListLedgerEntriesdefaultResponse,\n CreateLedgerEntry200Response,\n CreateLedgerEntrydefaultResponse,\n GetLedgerEntry200Response,\n GetLedgerEntrydefaultResponse,\n GetReceipt200Response,\n GetReceiptdefaultResponse,\n GetTransactionStatus200Response,\n GetTransactionStatusdefaultResponse,\n GetCurrentLedgerEntry200Response,\n GetCurrentLedgerEntrydefaultResponse,\n DeleteUser204Response,\n DeleteUserdefaultResponse,\n GetUser200Response,\n GetUserdefaultResponse,\n CreateOrUpdateUser200Response,\n CreateOrUpdateUserdefaultResponse\n} from \"./responses\";\n\nconst responseMap: Record<string, string[]> = {\n \"GET /app/governance/constitution\": [\"200\"],\n \"GET /app/governance/members\": [\"200\"],\n \"GET /app/enclaveQuotes\": [\"200\"],\n \"GET /app/collections\": [\"200\"],\n \"GET /app/transactions\": [\"200\"],\n \"POST /app/transactions\": [\"200\"],\n \"GET /app/transactions/{transactionId}\": [\"200\"],\n \"GET /app/transactions/{transactionId}/receipt\": [\"200\"],\n \"GET /app/transactions/{transactionId}/status\": [\"200\"],\n \"GET /app/transactions/current\": [\"200\"],\n \"DELETE /app/users/{userId}\": [\"204\"],\n \"GET /app/users/{userId}\": [\"200\"],\n \"PATCH /app/users/{userId}\": [\"200\"]\n};\n\nexport function isUnexpected(\n response: GetConstitution200Response | GetConstitutiondefaultResponse\n): response is GetConstitutiondefaultResponse;\nexport function isUnexpected(\n response:\n | ListConsortiumMembers200Response\n | ListConsortiumMembersdefaultResponse\n): response is ListConsortiumMembersdefaultResponse;\nexport function isUnexpected(\n response: GetEnclaveQuotes200Response | GetEnclaveQuotesdefaultResponse\n): response is GetEnclaveQuotesdefaultResponse;\nexport function isUnexpected(\n response: ListCollections200Response | ListCollectionsdefaultResponse\n): response is ListCollectionsdefaultResponse;\nexport function isUnexpected(\n response: ListLedgerEntries200Response | ListLedgerEntriesdefaultResponse\n): response is ListLedgerEntriesdefaultResponse;\nexport function isUnexpected(\n response: CreateLedgerEntry200Response | CreateLedgerEntrydefaultResponse\n): response is CreateLedgerEntrydefaultResponse;\nexport function isUnexpected(\n response: GetLedgerEntry200Response | GetLedgerEntrydefaultResponse\n): response is GetLedgerEntrydefaultResponse;\nexport function isUnexpected(\n response: GetReceipt200Response | GetReceiptdefaultResponse\n): response is GetReceiptdefaultResponse;\nexport function isUnexpected(\n response:\n | GetTransactionStatus200Response\n | GetTransactionStatusdefaultResponse\n): response is GetTransactionStatusdefaultResponse;\nexport function isUnexpected(\n response:\n | GetCurrentLedgerEntry200Response\n | GetCurrentLedgerEntrydefaultResponse\n): response is GetCurrentLedgerEntrydefaultResponse;\nexport function isUnexpected(\n response: DeleteUser204Response | DeleteUserdefaultResponse\n): response is DeleteUserdefaultResponse;\nexport function isUnexpected(\n response: GetUser200Response | GetUserdefaultResponse\n): response is GetUserdefaultResponse;\nexport function isUnexpected(\n response: CreateOrUpdateUser200Response | CreateOrUpdateUserdefaultResponse\n): response is CreateOrUpdateUserdefaultResponse;\nexport function isUnexpected(\n response:\n | GetConstitution200Response\n | GetConstitutiondefaultResponse\n | ListConsortiumMembers200Response\n | ListConsortiumMembersdefaultResponse\n | GetEnclaveQuotes200Response\n | GetEnclaveQuotesdefaultResponse\n | ListCollections200Response\n | ListCollectionsdefaultResponse\n | ListLedgerEntries200Response\n | ListLedgerEntriesdefaultResponse\n | CreateLedgerEntry200Response\n | CreateLedgerEntrydefaultResponse\n | GetLedgerEntry200Response\n | GetLedgerEntrydefaultResponse\n | GetReceipt200Response\n | GetReceiptdefaultResponse\n | GetTransactionStatus200Response\n | GetTransactionStatusdefaultResponse\n | GetCurrentLedgerEntry200Response\n | GetCurrentLedgerEntrydefaultResponse\n | DeleteUser204Response\n | DeleteUserdefaultResponse\n | GetUser200Response\n | GetUserdefaultResponse\n | CreateOrUpdateUser200Response\n | CreateOrUpdateUserdefaultResponse\n): response is\n | GetConstitutiondefaultResponse\n | ListConsortiumMembersdefaultResponse\n | GetEnclaveQuotesdefaultResponse\n | ListCollectionsdefaultResponse\n | ListLedgerEntriesdefaultResponse\n | CreateLedgerEntrydefaultResponse\n | GetLedgerEntrydefaultResponse\n | GetReceiptdefaultResponse\n | GetTransactionStatusdefaultResponse\n | GetCurrentLedgerEntrydefaultResponse\n | DeleteUserdefaultResponse\n | GetUserdefaultResponse\n | CreateOrUpdateUserdefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = geParametrizedPathSuccess(url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction geParametrizedPathSuccess(path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // If the candidate and actual paths don't match in size\n // we move on to the next candidate path\n if (\n candidateParts.length === pathParts.length &&\n hasParametrizedPath(key)\n ) {\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = 0; i < candidateParts.length; i++) {\n if (\n candidateParts[i].startsWith(\"{\") &&\n candidateParts[i].endsWith(\"}\")\n ) {\n // If the current part of the candidate is a \"template\" part\n // it is a match with the actual path part on hand\n // skip as the parameterized part can match anything\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[i]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // if all parts matched we return the success values form\n // the path mapping.\n if (found) {\n return value;\n }\n }\n }\n\n // No match was found, return an empty array.\n return [];\n}\n\nfunction hasParametrizedPath(path: string): boolean {\n return path.includes(\"/{\");\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../../../src/generated/src/isUnexpected.ts"],"names":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,CAAC,CAAC,0CAAE,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,CAC1C,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;gBAE3B,IAAI,CAAC,SAAS,EAAE;oBACd,KAAK,GAAG,KAAK,CAAC;oBACd,MAAM;iBACP;gBACD,SAAS;aACV;YAED,8CAA8C;YAC9C,wDAAwD;YACxD,2CAA2C;YAC3C,IAAI,cAAc,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE;gBACtC,KAAK,GAAG,KAAK,CAAC;gBACd,MAAM;aACP;SACF;QAED,qDAAqD;QACrD,sEAAsE;QACtE,IAAI,KAAK,IAAI,aAAa,CAAC,MAAM,GAAG,UAAU,EAAE;YAC9C,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC;YAClC,YAAY,GAAG,KAAK,CAAC;SACtB;KACF;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n GetConstitution200Response,\n GetConstitutionDefaultResponse,\n ListConsortiumMembers200Response,\n ListConsortiumMembersDefaultResponse,\n GetEnclaveQuotes200Response,\n GetEnclaveQuotesDefaultResponse,\n ListCollections200Response,\n ListCollectionsDefaultResponse,\n ListLedgerEntries200Response,\n ListLedgerEntriesDefaultResponse,\n CreateLedgerEntry200Response,\n CreateLedgerEntryDefaultResponse,\n GetLedgerEntry200Response,\n GetLedgerEntryDefaultResponse,\n GetReceipt200Response,\n GetReceiptDefaultResponse,\n GetTransactionStatus200Response,\n GetTransactionStatusDefaultResponse,\n GetCurrentLedgerEntry200Response,\n GetCurrentLedgerEntryDefaultResponse,\n DeleteUser204Response,\n DeleteUserDefaultResponse,\n GetUser200Response,\n GetUserDefaultResponse,\n CreateOrUpdateUser200Response,\n CreateOrUpdateUserDefaultResponse\n} from \"./responses\";\n\nconst responseMap: Record<string, string[]> = {\n \"GET /app/governance/constitution\": [\"200\"],\n \"GET /app/governance/members\": [\"200\"],\n \"GET /app/enclaveQuotes\": [\"200\"],\n \"GET /app/collections\": [\"200\"],\n \"GET /app/transactions\": [\"200\"],\n \"POST /app/transactions\": [\"200\"],\n \"GET /app/transactions/{transactionId}\": [\"200\"],\n \"GET /app/transactions/{transactionId}/receipt\": [\"200\"],\n \"GET /app/transactions/{transactionId}/status\": [\"200\"],\n \"GET /app/transactions/current\": [\"200\"],\n \"DELETE /app/users/{userId}\": [\"204\"],\n \"GET /app/users/{userId}\": [\"200\"],\n \"PATCH /app/users/{userId}\": [\"200\"]\n};\n\nexport function isUnexpected(\n response: GetConstitution200Response | GetConstitutionDefaultResponse\n): response is GetConstitutionDefaultResponse;\nexport function isUnexpected(\n response:\n | ListConsortiumMembers200Response\n | ListConsortiumMembersDefaultResponse\n): response is ListConsortiumMembersDefaultResponse;\nexport function isUnexpected(\n response: GetEnclaveQuotes200Response | GetEnclaveQuotesDefaultResponse\n): response is GetEnclaveQuotesDefaultResponse;\nexport function isUnexpected(\n response: ListCollections200Response | ListCollectionsDefaultResponse\n): response is ListCollectionsDefaultResponse;\nexport function isUnexpected(\n response: ListLedgerEntries200Response | ListLedgerEntriesDefaultResponse\n): response is ListLedgerEntriesDefaultResponse;\nexport function isUnexpected(\n response: CreateLedgerEntry200Response | CreateLedgerEntryDefaultResponse\n): response is CreateLedgerEntryDefaultResponse;\nexport function isUnexpected(\n response: GetLedgerEntry200Response | GetLedgerEntryDefaultResponse\n): response is GetLedgerEntryDefaultResponse;\nexport function isUnexpected(\n response: GetReceipt200Response | GetReceiptDefaultResponse\n): response is GetReceiptDefaultResponse;\nexport function isUnexpected(\n response:\n | GetTransactionStatus200Response\n | GetTransactionStatusDefaultResponse\n): response is GetTransactionStatusDefaultResponse;\nexport function isUnexpected(\n response:\n | GetCurrentLedgerEntry200Response\n | GetCurrentLedgerEntryDefaultResponse\n): response is GetCurrentLedgerEntryDefaultResponse;\nexport function isUnexpected(\n response: DeleteUser204Response | DeleteUserDefaultResponse\n): response is DeleteUserDefaultResponse;\nexport function isUnexpected(\n response: GetUser200Response | GetUserDefaultResponse\n): response is GetUserDefaultResponse;\nexport function isUnexpected(\n response: CreateOrUpdateUser200Response | CreateOrUpdateUserDefaultResponse\n): response is CreateOrUpdateUserDefaultResponse;\nexport function isUnexpected(\n response:\n | GetConstitution200Response\n | GetConstitutionDefaultResponse\n | ListConsortiumMembers200Response\n | ListConsortiumMembersDefaultResponse\n | GetEnclaveQuotes200Response\n | GetEnclaveQuotesDefaultResponse\n | ListCollections200Response\n | ListCollectionsDefaultResponse\n | ListLedgerEntries200Response\n | ListLedgerEntriesDefaultResponse\n | CreateLedgerEntry200Response\n | CreateLedgerEntryDefaultResponse\n | GetLedgerEntry200Response\n | GetLedgerEntryDefaultResponse\n | GetReceipt200Response\n | GetReceiptDefaultResponse\n | GetTransactionStatus200Response\n | GetTransactionStatusDefaultResponse\n | GetCurrentLedgerEntry200Response\n | GetCurrentLedgerEntryDefaultResponse\n | DeleteUser204Response\n | DeleteUserDefaultResponse\n | GetUser200Response\n | GetUserDefaultResponse\n | CreateOrUpdateUser200Response\n | CreateOrUpdateUserDefaultResponse\n): response is\n | GetConstitutionDefaultResponse\n | ListConsortiumMembersDefaultResponse\n | GetEnclaveQuotesDefaultResponse\n | ListCollectionsDefaultResponse\n | ListLedgerEntriesDefaultResponse\n | CreateLedgerEntryDefaultResponse\n | GetLedgerEntryDefaultResponse\n | GetReceiptDefaultResponse\n | GetTransactionStatusDefaultResponse\n | GetCurrentLedgerEntryDefaultResponse\n | DeleteUserDefaultResponse\n | GetUserDefaultResponse\n | CreateOrUpdateUserDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (\n let i = candidateParts.length - 1, j = pathParts.length - 1;\n i >= 1 && j >= 1;\n i--, j--\n ) {\n if (\n candidateParts[i]?.startsWith(\"{\") &&\n candidateParts[i]?.indexOf(\"}\") !== -1\n ) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(\n `${candidateParts[i]?.slice(start, end)}`\n ).test(pathParts[j] || \"\");\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../../src/generated/src/logger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,MAAM,CAAC,MAAM,MAAM,GAAG,kBAAkB,CAAC,qBAAqB,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { createClientLogger } from \"@azure/logger\";\nexport const logger = createClientLogger(\"confidential-ledger\");\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/generated/src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport interface LedgerEntry {\n /** Contents of the ledger entry. */\n contents: string;\n
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../../../src/generated/src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/** An entry in the ledger. */\nexport interface LedgerEntry {\n /** Contents of the ledger entry. */\n contents: string;\n}\n\n/** Details about a Confidential Ledger user. */\nexport interface LedgerUser {\n /** Represents an assignable role. */\n assignedRole: \"Administrator\" | \"Contributor\" | \"Reader\";\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outputModels.js","sourceRoot":"","sources":["../../../../src/generated/src/outputModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nexport interface ConstitutionOutput {\n /** SHA256 digest of the constitution script. */\n digest: string;\n /** Contents of the constitution. */\n script: string;\n}\n\nexport interface ConfidentialLedgerErrorOutput {\n /** An error response from Confidential Ledger. */\n error?: ConfidentialLedgerErrorBodyOutput;\n}\n\nexport interface ConfidentialLedgerErrorBodyOutput {\n /** The error code. */\n code?: string;\n /** The error message. */\n message?: string;\n}\n\nexport interface ConsortiumOutput {\n members: Array<ConsortiumMemberOutput>;\n /** Path from which to retrieve the next page of results. */\n nextLink?: string;\n}\n\nexport interface ConsortiumMemberOutput {\n /** PEM-encoded certificate associated with the member. */\n certificate: string;\n /** Identifier assigned to the member. */\n id: string;\n}\n\nexport interface ConfidentialLedgerEnclavesOutput {\n /** Id of the Confidential Ledger node responding to the request. */\n currentNodeId: string;\n /** Dictionary of enclave quotes, indexed by node id. */\n enclaveQuotes: Record<string, EnclaveQuoteOutput>;\n}\n\nexport interface EnclaveQuoteOutput {\n /** ID assigned to this node. */\n nodeId: string;\n /** MRENCLAVE value of the code running in the enclave. */\n mrenclave?: string;\n /** Version of the quote presented. */\n quoteVersion: string;\n /** Raw SGX quote, parsable by tools like Open Enclave's oeverify. */\n raw: string;\n}\n\nexport interface PagedCollectionsOutput {\n collections: Array<CollectionOutput>;\n /** Path from which to retrieve the next page of results. */\n nextLink?: string;\n}\n\nexport interface CollectionOutput {\n collectionId: string;\n}\n\nexport interface PagedLedgerEntriesOutput {\n /** State of a ledger query. */\n state: \"Loading\" | \"Ready\";\n /** Path from which to retrieve the next page of results. */\n nextLink?: string;\n /** Array of ledger entries. */\n entries: Array<LedgerEntryOutput>;\n}\n\nexport interface LedgerEntryOutput {\n /** Contents of the ledger entry. */\n contents: string;\n collectionId?: string;\n /** 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. */\n transactionId?: string;\n}\n\nexport interface LedgerWriteResultOutput {\n collectionId: string;\n}\n\nexport interface LedgerQueryResultOutput {\n /** State of a ledger query. */\n state: \"Loading\" | \"Ready\";\n /** The ledger entry found as a result of the query. This is only available if the query is in Ready state. */\n entry?: LedgerEntryOutput;\n}\n\nexport interface TransactionReceiptOutput {\n receipt?: ReceiptContentsOutput;\n /** State of a ledger query. */\n state: \"Loading\" | \"Ready\";\n /** 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. */\n transactionId: string;\n}\n\nexport interface ReceiptContentsOutput {\n cert?: string;\n leaf?: string;\n leafComponents?: ReceiptLeafComponentsOutput;\n nodeId: string;\n proof: Array<ReceiptElementOutput>;\n root?: string;\n serviceEndorsements?: Array<string>;\n signature: string;\n}\n\nexport interface ReceiptLeafComponentsOutput {\n claimsDigest?: string;\n commitEvidence?: string;\n writeSetDigest?: string;\n}\n\nexport interface ReceiptElementOutput {\n left?: string;\n right?: string;\n}\n\nexport interface TransactionStatusOutput {\n /** Represents the state of the transaction. */\n state: \"Committed\" | \"Pending\";\n /** 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. */\n transactionId: string;\n}\n\nexport interface LedgerUserOutput {\n /** Represents an assignable role. */\n assignedRole: \"Administrator\" | \"Contributor\" | \"Reader\";\n /** Identifier for the user. This must either be an AAD object id or a certificate fingerprint. */\n userId?: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"outputModels.js","sourceRoot":"","sources":["../../../../src/generated/src/outputModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\n/** The governance script for the application. */\nexport interface ConstitutionOutput {\n /** SHA256 digest of the constitution script. */\n digest: string;\n /** Contents of the constitution. */\n script: string;\n}\n\n/** An error response from Confidential Ledger. */\nexport interface ConfidentialLedgerErrorOutput {\n /** An error response from Confidential Ledger. */\n readonly error?: ConfidentialLedgerErrorBodyOutput;\n}\n\n/** An error response from Confidential Ledger. */\nexport interface ConfidentialLedgerErrorBodyOutput {\n /** The error code. */\n readonly code?: string;\n /** The error message. */\n readonly message?: string;\n}\n\n/** List of members in the consortium. */\nexport interface ConsortiumOutput {\n members: Array<ConsortiumMemberOutput>;\n /** Path from which to retrieve the next page of results. */\n nextLink?: string;\n}\n\n/** Describes a member of the consortium. */\nexport interface ConsortiumMemberOutput {\n /** PEM-encoded certificate associated with the member. */\n certificate: string;\n /** Identifier assigned to the member. */\n id: string;\n}\n\n/** Information about the enclaves running the Confidential Ledger. */\nexport interface ConfidentialLedgerEnclavesOutput {\n /** Id of the Confidential Ledger node responding to the request. */\n currentNodeId: string;\n /** Dictionary of enclave quotes, indexed by node id. */\n enclaveQuotes: Record<string, EnclaveQuoteOutput>;\n}\n\n/** Contains the enclave quote. */\nexport interface EnclaveQuoteOutput {\n /** ID assigned to this node. */\n nodeId: string;\n /** MRENCLAVE value of the code running in the enclave. */\n mrenclave?: string;\n /** Version of the quote presented. */\n quoteVersion: string;\n /** Raw SGX quote, parsable by tools like Open Enclave's oeverify. */\n raw: string;\n}\n\n/** Paginated collections returned in response to a query. */\nexport interface PagedCollectionsOutput {\n collections: Array<CollectionOutput>;\n /** Path from which to retrieve the next page of results. */\n nextLink?: string;\n}\n\n/** Identifier for collections. */\nexport interface CollectionOutput {\n collectionId: string;\n}\n\n/** Paginated ledger entries returned in response to a query. */\nexport interface PagedLedgerEntriesOutput {\n /** State of a ledger query. */\n state: \"Loading\" | \"Ready\";\n /** Path from which to retrieve the next page of results. */\n nextLink?: string;\n /** Array of ledger entries. */\n entries: Array<LedgerEntryOutput>;\n}\n\n/** An entry in the ledger. */\nexport interface LedgerEntryOutput {\n /** Contents of the ledger entry. */\n contents: string;\n readonly collectionId?: string;\n /** 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. */\n readonly transactionId?: string;\n}\n\n/** Returned as a result of a write to the Confidential Ledger, the transaction id in the response indicates when the write will become durable. */\nexport interface LedgerWriteResultOutput {\n collectionId: string;\n}\n\n/** The result of querying for a ledger entry from an older transaction id. The ledger entry is available in the response only if the returned state is Ready. */\nexport interface LedgerQueryResultOutput {\n /** State of a ledger query. */\n state: \"Loading\" | \"Ready\";\n /** The ledger entry found as a result of the query. This is only available if the query is in Ready state. */\n entry?: LedgerEntryOutput;\n}\n\n/** A receipt certifying the transaction at the specified id. */\nexport interface TransactionReceiptOutput {\n receipt?: ReceiptContentsOutput;\n /** State of a ledger query. */\n state: \"Loading\" | \"Ready\";\n /** 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. */\n transactionId: string;\n}\n\nexport interface ReceiptContentsOutput {\n cert?: string;\n leaf?: string;\n leafComponents?: ReceiptLeafComponentsOutput;\n nodeId: string;\n proof: Array<ReceiptElementOutput>;\n root?: string;\n serviceEndorsements?: Array<string>;\n signature: string;\n}\n\nexport interface ReceiptLeafComponentsOutput {\n claimsDigest?: string;\n commitEvidence?: string;\n writeSetDigest?: string;\n}\n\nexport interface ReceiptElementOutput {\n left?: string;\n right?: string;\n}\n\n/** Response returned to a query for the transaction status */\nexport interface TransactionStatusOutput {\n /** Represents the state of the transaction. */\n state: \"Committed\" | \"Pending\";\n /** 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. */\n transactionId: string;\n}\n\n/** Details about a Confidential Ledger user. */\nexport interface LedgerUserOutput {\n /** Represents an assignable role. */\n assignedRole: \"Administrator\" | \"Contributor\" | \"Reader\";\n /** Identifier for the user. This must either be an AAD object id or a certificate fingerprint. */\n readonly userId?: string;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../../../src/generated/src/parameters.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { RequestParameters } from \"@azure-rest/core-client\";\nimport { LedgerEntry, LedgerUser } from \"./models\";\n\nexport type GetConstitutionParameters = RequestParameters;\nexport type ListConsortiumMembersParameters = RequestParameters;\nexport type GetEnclaveQuotesParameters = RequestParameters;\nexport type ListCollectionsParameters = RequestParameters;\n\nexport interface ListLedgerEntriesQueryParamProperties {\n /** The collection id. */\n collectionId?: string;\n /** Specify the first transaction ID in a range. */\n fromTransactionId?: string;\n /** Specify the last transaction ID in a range. */\n toTransactionId?: string;\n}\n\nexport interface ListLedgerEntriesQueryParam {\n queryParameters?: ListLedgerEntriesQueryParamProperties;\n}\n\nexport type ListLedgerEntriesParameters = ListLedgerEntriesQueryParam &\n RequestParameters;\n\nexport interface CreateLedgerEntryBodyParam {\n /** Ledger entry. */\n body: LedgerEntry;\n}\n\nexport interface CreateLedgerEntryQueryParamProperties {\n /** The collection id. */\n collectionId?: string;\n}\n\nexport interface CreateLedgerEntryQueryParam {\n queryParameters?: CreateLedgerEntryQueryParamProperties;\n}\n\nexport interface CreateLedgerEntryMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type CreateLedgerEntryParameters = CreateLedgerEntryQueryParam &\n CreateLedgerEntryMediaTypesParam &\n CreateLedgerEntryBodyParam &\n RequestParameters;\n\nexport interface GetLedgerEntryQueryParamProperties {\n /** The collection id. */\n collectionId?: string;\n}\n\nexport interface GetLedgerEntryQueryParam {\n queryParameters?: GetLedgerEntryQueryParamProperties;\n}\n\nexport type GetLedgerEntryParameters = GetLedgerEntryQueryParam &\n RequestParameters;\nexport type GetReceiptParameters = RequestParameters;\nexport type GetTransactionStatusParameters = RequestParameters;\n\nexport interface GetCurrentLedgerEntryQueryParamProperties {\n /** The collection id. */\n collectionId?: string;\n}\n\nexport interface GetCurrentLedgerEntryQueryParam {\n queryParameters?: GetCurrentLedgerEntryQueryParamProperties;\n}\n\nexport type GetCurrentLedgerEntryParameters = GetCurrentLedgerEntryQueryParam &\n RequestParameters;\nexport type DeleteUserParameters = RequestParameters;\nexport type GetUserParameters = RequestParameters;\n\nexport interface CreateOrUpdateUserBodyParam {\n /** Details about a Confidential Ledger user. */\n body:
|
|
1
|
+
{"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../../../src/generated/src/parameters.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { RequestParameters } from \"@azure-rest/core-client\";\nimport { LedgerEntry, LedgerUser } from \"./models\";\n\nexport type GetConstitutionParameters = RequestParameters;\nexport type ListConsortiumMembersParameters = RequestParameters;\nexport type GetEnclaveQuotesParameters = RequestParameters;\nexport type ListCollectionsParameters = RequestParameters;\n\nexport interface ListLedgerEntriesQueryParamProperties {\n /** The collection id. */\n collectionId?: string;\n /** Specify the first transaction ID in a range. */\n fromTransactionId?: string;\n /** Specify the last transaction ID in a range. */\n toTransactionId?: string;\n}\n\nexport interface ListLedgerEntriesQueryParam {\n queryParameters?: ListLedgerEntriesQueryParamProperties;\n}\n\nexport type ListLedgerEntriesParameters = ListLedgerEntriesQueryParam &\n RequestParameters;\n\nexport interface CreateLedgerEntryBodyParam {\n /** Ledger entry. */\n body: LedgerEntry;\n}\n\nexport interface CreateLedgerEntryQueryParamProperties {\n /** The collection id. */\n collectionId?: string;\n}\n\nexport interface CreateLedgerEntryQueryParam {\n queryParameters?: CreateLedgerEntryQueryParamProperties;\n}\n\nexport interface CreateLedgerEntryMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type CreateLedgerEntryParameters = CreateLedgerEntryQueryParam &\n CreateLedgerEntryMediaTypesParam &\n CreateLedgerEntryBodyParam &\n RequestParameters;\n\nexport interface GetLedgerEntryQueryParamProperties {\n /** The collection id. */\n collectionId?: string;\n}\n\nexport interface GetLedgerEntryQueryParam {\n queryParameters?: GetLedgerEntryQueryParamProperties;\n}\n\nexport type GetLedgerEntryParameters = GetLedgerEntryQueryParam &\n RequestParameters;\nexport type GetReceiptParameters = RequestParameters;\nexport type GetTransactionStatusParameters = RequestParameters;\n\nexport interface GetCurrentLedgerEntryQueryParamProperties {\n /** The collection id. */\n collectionId?: string;\n}\n\nexport interface GetCurrentLedgerEntryQueryParam {\n queryParameters?: GetCurrentLedgerEntryQueryParamProperties;\n}\n\nexport type GetCurrentLedgerEntryParameters = GetCurrentLedgerEntryQueryParam &\n RequestParameters;\nexport type DeleteUserParameters = RequestParameters;\nexport type GetUserParameters = RequestParameters;\n/** Details about a Confidential Ledger user. */\nexport type LedgerUserResourceMergeAndPatch = Partial<LedgerUser>;\n\nexport interface CreateOrUpdateUserBodyParam {\n /** Details about a Confidential Ledger user. */\n body: LedgerUserResourceMergeAndPatch;\n}\n\nexport interface CreateOrUpdateUserMediaTypesParam {\n /** Request content type */\n contentType?: \"application/merge-patch+json\";\n}\n\nexport type CreateOrUpdateUserParameters = CreateOrUpdateUserMediaTypesParam &\n CreateOrUpdateUserBodyParam &\n RequestParameters;\n"]}
|
|
@@ -1 +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\";\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
|
|
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\";\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"]}
|
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.
|
|
6
|
+
"version": "1.0.1-alpha.20230626.1",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"node",
|
|
9
9
|
"azure",
|
|
@@ -50,36 +50,32 @@
|
|
|
50
50
|
"disableDocsMs": true,
|
|
51
51
|
"apiRefLink": "https://docs.microsoft.com/azure/confidential-ledger"
|
|
52
52
|
},
|
|
53
|
-
"browser": {
|
|
54
|
-
"./dist-esm/test/public/utils/env.js": "./dist-esm/test/public/utils/env.browser.js",
|
|
55
|
-
"./dist-esm/src/certificatePolicy.js": "./dist-esm/src/certificatePolicy.browser.js"
|
|
56
|
-
},
|
|
57
53
|
"scripts": {
|
|
58
54
|
"audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit",
|
|
59
|
-
"build:browser": "
|
|
60
|
-
"build:node": "tsc -p . && dev-tool run bundle",
|
|
55
|
+
"build:browser": "echo \"Browser is not supported.\" && exit 0",
|
|
56
|
+
"build:node": "tsc -p . && dev-tool run bundle --browser-test=false",
|
|
61
57
|
"build:samples": "echo Obsolete.",
|
|
62
|
-
"build:test": "tsc -p . && dev-tool run bundle",
|
|
63
|
-
"build": "npm run clean && tsc -p . && dev-tool run bundle && api-extractor run --local",
|
|
58
|
+
"build:test": "tsc -p . && dev-tool run bundle --browser-test=false",
|
|
59
|
+
"build": "npm run clean && tsc -p . && dev-tool run bundle --browser-test=false && api-extractor run --local",
|
|
64
60
|
"build:debug": "tsc -p . && dev-tool run bundle && api-extractor run --local",
|
|
65
61
|
"check-format": "prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
|
|
66
|
-
"clean": "rimraf dist dist-browser dist-esm test
|
|
62
|
+
"clean": "rimraf dist dist-browser dist-esm dist-test temp types *.tgz *.log",
|
|
67
63
|
"execute:samples": "dev-tool samples run samples-dev",
|
|
68
64
|
"extract-api": "tsc -p . && api-extractor run --local",
|
|
69
65
|
"format": "prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.ts\" \"test/**/*.ts\" \"samples-dev/**/*.ts\" \"*.{js,json}\"",
|
|
70
66
|
"generate:client": "autorest --typescript swagger/README.md && rushx format",
|
|
71
|
-
"integration-test:browser": "echo
|
|
72
|
-
"integration-test:node": "
|
|
73
|
-
"integration-test": "npm run integration-test:node
|
|
67
|
+
"integration-test:browser": "echo \"Browser is not supported.\" && exit 0",
|
|
68
|
+
"integration-test:node": "dev-tool run test:node-js-input -- --timeout 5000000 'dist-esm/test/**/*.spec.js'",
|
|
69
|
+
"integration-test": "npm run integration-test:node",
|
|
74
70
|
"lint:fix": "eslint package.json api-extractor.json src test --ext .ts --fix --fix-type [problem,suggestion]",
|
|
75
71
|
"lint": "eslint package.json api-extractor.json src test --ext .ts",
|
|
76
72
|
"pack": "npm pack 2>&1",
|
|
77
73
|
"test:browser": "npm run clean && npm run build:test && npm run unit-test:browser",
|
|
78
74
|
"test:node": "npm run clean && npm run build:test && npm run unit-test:node",
|
|
79
75
|
"test": "npm run clean && npm run build:test && npm run unit-test",
|
|
80
|
-
"unit-test:browser": "echo
|
|
81
|
-
"unit-test:node": "
|
|
82
|
-
"unit-test": "npm run unit-test:node
|
|
76
|
+
"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'",
|
|
78
|
+
"unit-test": "npm run unit-test:node"
|
|
83
79
|
},
|
|
84
80
|
"sideEffects": false,
|
|
85
81
|
"autoPublish": false,
|
|
@@ -89,11 +85,11 @@
|
|
|
89
85
|
"@azure/core-paging": "^1.3.0",
|
|
90
86
|
"@azure/core-rest-pipeline": "^1.1.0",
|
|
91
87
|
"@azure/logger": "^1.0.0",
|
|
92
|
-
"autorest": "^3.6.1",
|
|
93
88
|
"tslib": "^2.2.0"
|
|
94
89
|
},
|
|
95
90
|
"devDependencies": {
|
|
96
|
-
"@azure-tools/test-recorder": "
|
|
91
|
+
"@azure-tools/test-recorder": ">=3.0.1-alpha <3.0.1-alphb",
|
|
92
|
+
"@azure-tools/test-credential": "^1.0.0",
|
|
97
93
|
"@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb",
|
|
98
94
|
"@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
|
|
99
95
|
"@azure/identity": "^2.0.1",
|
|
@@ -106,18 +102,6 @@
|
|
|
106
102
|
"cross-env": "^7.0.2",
|
|
107
103
|
"dotenv": "^16.0.0",
|
|
108
104
|
"eslint": "^8.0.0",
|
|
109
|
-
"karma": "^6.2.0",
|
|
110
|
-
"karma-chrome-launcher": "^3.0.0",
|
|
111
|
-
"karma-coverage": "^2.0.0",
|
|
112
|
-
"karma-env-preprocessor": "^0.1.1",
|
|
113
|
-
"karma-firefox-launcher": "^1.1.0",
|
|
114
|
-
"karma-json-preprocessor": "^0.3.3",
|
|
115
|
-
"karma-json-to-file-reporter": "^1.0.1",
|
|
116
|
-
"karma-junit-reporter": "^2.0.1",
|
|
117
|
-
"karma-mocha": "^2.0.1",
|
|
118
|
-
"karma-mocha-reporter": "^2.2.5",
|
|
119
|
-
"karma-source-map-support": "~1.4.0",
|
|
120
|
-
"karma-sourcemap-loader": "^0.3.8",
|
|
121
105
|
"mocha": "^7.1.1",
|
|
122
106
|
"mocha-junit-reporter": "^2.0.0",
|
|
123
107
|
"nyc": "^15.0.0",
|
|
@@ -8,6 +8,7 @@ import { RequestParameters } from '@azure-rest/core-client';
|
|
|
8
8
|
import { StreamableMethod } from '@azure-rest/core-client';
|
|
9
9
|
import { TokenCredential } from '@azure/core-auth';
|
|
10
10
|
|
|
11
|
+
/** Identifier for collections. */
|
|
11
12
|
export declare interface CollectionOutput {
|
|
12
13
|
collectionId: string;
|
|
13
14
|
}
|
|
@@ -21,6 +22,7 @@ export declare type ConfidentialLedgerClient = Client & {
|
|
|
21
22
|
path: Routes;
|
|
22
23
|
};
|
|
23
24
|
|
|
25
|
+
/** Information about the enclaves running the Confidential Ledger. */
|
|
24
26
|
export declare interface ConfidentialLedgerEnclavesOutput {
|
|
25
27
|
/** Id of the Confidential Ledger node responding to the request. */
|
|
26
28
|
currentNodeId: string;
|
|
@@ -28,18 +30,21 @@ export declare interface ConfidentialLedgerEnclavesOutput {
|
|
|
28
30
|
enclaveQuotes: Record<string, EnclaveQuoteOutput>;
|
|
29
31
|
}
|
|
30
32
|
|
|
33
|
+
/** An error response from Confidential Ledger. */
|
|
31
34
|
export declare interface ConfidentialLedgerErrorBodyOutput {
|
|
32
35
|
/** The error code. */
|
|
33
|
-
code?: string;
|
|
36
|
+
readonly code?: string;
|
|
34
37
|
/** The error message. */
|
|
35
|
-
message?: string;
|
|
38
|
+
readonly message?: string;
|
|
36
39
|
}
|
|
37
40
|
|
|
41
|
+
/** An error response from Confidential Ledger. */
|
|
38
42
|
export declare interface ConfidentialLedgerErrorOutput {
|
|
39
43
|
/** An error response from Confidential Ledger. */
|
|
40
|
-
error?: ConfidentialLedgerErrorBodyOutput;
|
|
44
|
+
readonly error?: ConfidentialLedgerErrorBodyOutput;
|
|
41
45
|
}
|
|
42
46
|
|
|
47
|
+
/** Describes a member of the consortium. */
|
|
43
48
|
export declare interface ConsortiumMemberOutput {
|
|
44
49
|
/** PEM-encoded certificate associated with the member. */
|
|
45
50
|
certificate: string;
|
|
@@ -47,12 +52,14 @@ export declare interface ConsortiumMemberOutput {
|
|
|
47
52
|
id: string;
|
|
48
53
|
}
|
|
49
54
|
|
|
55
|
+
/** List of members in the consortium. */
|
|
50
56
|
export declare interface ConsortiumOutput {
|
|
51
57
|
members: Array<ConsortiumMemberOutput>;
|
|
52
58
|
/** Path from which to retrieve the next page of results. */
|
|
53
59
|
nextLink?: string;
|
|
54
60
|
}
|
|
55
61
|
|
|
62
|
+
/** The governance script for the application. */
|
|
56
63
|
export declare interface ConstitutionOutput {
|
|
57
64
|
/** SHA256 digest of the constitution script. */
|
|
58
65
|
digest: string;
|
|
@@ -78,7 +85,7 @@ export declare interface CreateLedgerEntryBodyParam {
|
|
|
78
85
|
}
|
|
79
86
|
|
|
80
87
|
/** A collection id may optionally be specified. */
|
|
81
|
-
export declare interface
|
|
88
|
+
export declare interface CreateLedgerEntryDefaultResponse extends HttpResponse {
|
|
82
89
|
status: string;
|
|
83
90
|
body: ConfidentialLedgerErrorOutput;
|
|
84
91
|
}
|
|
@@ -107,11 +114,11 @@ export declare interface CreateOrUpdateUser200Response extends HttpResponse {
|
|
|
107
114
|
|
|
108
115
|
export declare interface CreateOrUpdateUserBodyParam {
|
|
109
116
|
/** Details about a Confidential Ledger user. */
|
|
110
|
-
body:
|
|
117
|
+
body: LedgerUserResourceMergeAndPatch;
|
|
111
118
|
}
|
|
112
119
|
|
|
113
120
|
/** A JSON merge patch is applied for existing users */
|
|
114
|
-
export declare interface
|
|
121
|
+
export declare interface CreateOrUpdateUserDefaultResponse extends HttpResponse {
|
|
115
122
|
status: string;
|
|
116
123
|
body: ConfidentialLedgerErrorOutput;
|
|
117
124
|
}
|
|
@@ -125,27 +132,27 @@ export declare type CreateOrUpdateUserParameters = CreateOrUpdateUserMediaTypesP
|
|
|
125
132
|
|
|
126
133
|
export declare interface DeleteUser {
|
|
127
134
|
/** Deletes a user from the Confidential Ledger. */
|
|
128
|
-
delete(options?: DeleteUserParameters): StreamableMethod<DeleteUser204Response |
|
|
135
|
+
delete(options?: DeleteUserParameters): StreamableMethod<DeleteUser204Response | DeleteUserDefaultResponse>;
|
|
129
136
|
/** Gets a user. */
|
|
130
|
-
get(options?: GetUserParameters): StreamableMethod<GetUser200Response |
|
|
137
|
+
get(options?: GetUserParameters): StreamableMethod<GetUser200Response | GetUserDefaultResponse>;
|
|
131
138
|
/** A JSON merge patch is applied for existing users */
|
|
132
|
-
patch(options: CreateOrUpdateUserParameters): StreamableMethod<CreateOrUpdateUser200Response |
|
|
139
|
+
patch(options: CreateOrUpdateUserParameters): StreamableMethod<CreateOrUpdateUser200Response | CreateOrUpdateUserDefaultResponse>;
|
|
133
140
|
}
|
|
134
141
|
|
|
135
142
|
/** Deletes a user from the Confidential Ledger. */
|
|
136
143
|
export declare interface DeleteUser204Response extends HttpResponse {
|
|
137
144
|
status: "204";
|
|
138
|
-
body: Record<string, unknown>;
|
|
139
145
|
}
|
|
140
146
|
|
|
141
147
|
/** Deletes a user from the Confidential Ledger. */
|
|
142
|
-
export declare interface
|
|
148
|
+
export declare interface DeleteUserDefaultResponse extends HttpResponse {
|
|
143
149
|
status: string;
|
|
144
150
|
body: ConfidentialLedgerErrorOutput;
|
|
145
151
|
}
|
|
146
152
|
|
|
147
153
|
export declare type DeleteUserParameters = RequestParameters;
|
|
148
154
|
|
|
155
|
+
/** Contains the enclave quote. */
|
|
149
156
|
export declare interface EnclaveQuoteOutput {
|
|
150
157
|
/** ID assigned to this node. */
|
|
151
158
|
nodeId: string;
|
|
@@ -164,7 +171,7 @@ export declare type GetArrayType<T> = T extends Array<infer TData> ? TData : nev
|
|
|
164
171
|
|
|
165
172
|
export declare interface GetConstitution {
|
|
166
173
|
/** The constitution is a script that assesses and applies proposals from consortium members. */
|
|
167
|
-
get(options?: GetConstitutionParameters): StreamableMethod<GetConstitution200Response |
|
|
174
|
+
get(options?: GetConstitutionParameters): StreamableMethod<GetConstitution200Response | GetConstitutionDefaultResponse>;
|
|
168
175
|
}
|
|
169
176
|
|
|
170
177
|
/** The constitution is a script that assesses and applies proposals from consortium members. */
|
|
@@ -174,7 +181,7 @@ export declare interface GetConstitution200Response extends HttpResponse {
|
|
|
174
181
|
}
|
|
175
182
|
|
|
176
183
|
/** The constitution is a script that assesses and applies proposals from consortium members. */
|
|
177
|
-
export declare interface
|
|
184
|
+
export declare interface GetConstitutionDefaultResponse extends HttpResponse {
|
|
178
185
|
status: string;
|
|
179
186
|
body: ConfidentialLedgerErrorOutput;
|
|
180
187
|
}
|
|
@@ -183,7 +190,7 @@ export declare type GetConstitutionParameters = RequestParameters;
|
|
|
183
190
|
|
|
184
191
|
export declare interface GetCurrentLedgerEntry {
|
|
185
192
|
/** A collection id may optionally be specified. */
|
|
186
|
-
get(options?: GetCurrentLedgerEntryParameters): StreamableMethod<GetCurrentLedgerEntry200Response |
|
|
193
|
+
get(options?: GetCurrentLedgerEntryParameters): StreamableMethod<GetCurrentLedgerEntry200Response | GetCurrentLedgerEntryDefaultResponse>;
|
|
187
194
|
}
|
|
188
195
|
|
|
189
196
|
/** A collection id may optionally be specified. */
|
|
@@ -193,7 +200,7 @@ export declare interface GetCurrentLedgerEntry200Response extends HttpResponse {
|
|
|
193
200
|
}
|
|
194
201
|
|
|
195
202
|
/** A collection id may optionally be specified. */
|
|
196
|
-
export declare interface
|
|
203
|
+
export declare interface GetCurrentLedgerEntryDefaultResponse extends HttpResponse {
|
|
197
204
|
status: string;
|
|
198
205
|
body: ConfidentialLedgerErrorOutput;
|
|
199
206
|
}
|
|
@@ -211,7 +218,7 @@ export declare interface GetCurrentLedgerEntryQueryParamProperties {
|
|
|
211
218
|
|
|
212
219
|
export declare interface GetEnclaveQuotes {
|
|
213
220
|
/** A quote is an SGX enclave measurement that can be used to verify the validity of a node and its enclave. */
|
|
214
|
-
get(options?: GetEnclaveQuotesParameters): StreamableMethod<GetEnclaveQuotes200Response |
|
|
221
|
+
get(options?: GetEnclaveQuotesParameters): StreamableMethod<GetEnclaveQuotes200Response | GetEnclaveQuotesDefaultResponse>;
|
|
215
222
|
}
|
|
216
223
|
|
|
217
224
|
/** A quote is an SGX enclave measurement that can be used to verify the validity of a node and its enclave. */
|
|
@@ -221,7 +228,7 @@ export declare interface GetEnclaveQuotes200Response extends HttpResponse {
|
|
|
221
228
|
}
|
|
222
229
|
|
|
223
230
|
/** A quote is an SGX enclave measurement that can be used to verify the validity of a node and its enclave. */
|
|
224
|
-
export declare interface
|
|
231
|
+
export declare interface GetEnclaveQuotesDefaultResponse extends HttpResponse {
|
|
225
232
|
status: string;
|
|
226
233
|
body: ConfidentialLedgerErrorOutput;
|
|
227
234
|
}
|
|
@@ -230,7 +237,7 @@ export declare type GetEnclaveQuotesParameters = RequestParameters;
|
|
|
230
237
|
|
|
231
238
|
export declare interface GetLedgerEntry {
|
|
232
239
|
/** 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. */
|
|
233
|
-
get(options?: GetLedgerEntryParameters): StreamableMethod<GetLedgerEntry200Response |
|
|
240
|
+
get(options?: GetLedgerEntryParameters): StreamableMethod<GetLedgerEntry200Response | GetLedgerEntryDefaultResponse>;
|
|
234
241
|
}
|
|
235
242
|
|
|
236
243
|
/** 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. */
|
|
@@ -240,7 +247,7 @@ export declare interface GetLedgerEntry200Response extends HttpResponse {
|
|
|
240
247
|
}
|
|
241
248
|
|
|
242
249
|
/** 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. */
|
|
243
|
-
export declare interface
|
|
250
|
+
export declare interface GetLedgerEntryDefaultResponse extends HttpResponse {
|
|
244
251
|
status: string;
|
|
245
252
|
body: ConfidentialLedgerErrorOutput;
|
|
246
253
|
}
|
|
@@ -268,7 +275,7 @@ export declare type GetPage<TPage> = (pageLink: string, maxPageSize?: number) =>
|
|
|
268
275
|
|
|
269
276
|
export declare interface GetReceipt {
|
|
270
277
|
/** Gets a receipt certifying ledger contents at a particular transaction id. */
|
|
271
|
-
get(options?: GetReceiptParameters): StreamableMethod<GetReceipt200Response |
|
|
278
|
+
get(options?: GetReceiptParameters): StreamableMethod<GetReceipt200Response | GetReceiptDefaultResponse>;
|
|
272
279
|
}
|
|
273
280
|
|
|
274
281
|
/** Gets a receipt certifying ledger contents at a particular transaction id. */
|
|
@@ -278,7 +285,7 @@ export declare interface GetReceipt200Response extends HttpResponse {
|
|
|
278
285
|
}
|
|
279
286
|
|
|
280
287
|
/** Gets a receipt certifying ledger contents at a particular transaction id. */
|
|
281
|
-
export declare interface
|
|
288
|
+
export declare interface GetReceiptDefaultResponse extends HttpResponse {
|
|
282
289
|
status: string;
|
|
283
290
|
body: ConfidentialLedgerErrorOutput;
|
|
284
291
|
}
|
|
@@ -287,7 +294,7 @@ export declare type GetReceiptParameters = RequestParameters;
|
|
|
287
294
|
|
|
288
295
|
export declare interface GetTransactionStatus {
|
|
289
296
|
/** Gets the status of an entry identified by a transaction id. */
|
|
290
|
-
get(options?: GetTransactionStatusParameters): StreamableMethod<GetTransactionStatus200Response |
|
|
297
|
+
get(options?: GetTransactionStatusParameters): StreamableMethod<GetTransactionStatus200Response | GetTransactionStatusDefaultResponse>;
|
|
291
298
|
}
|
|
292
299
|
|
|
293
300
|
/** Gets the status of an entry identified by a transaction id. */
|
|
@@ -297,7 +304,7 @@ export declare interface GetTransactionStatus200Response extends HttpResponse {
|
|
|
297
304
|
}
|
|
298
305
|
|
|
299
306
|
/** Gets the status of an entry identified by a transaction id. */
|
|
300
|
-
export declare interface
|
|
307
|
+
export declare interface GetTransactionStatusDefaultResponse extends HttpResponse {
|
|
301
308
|
status: string;
|
|
302
309
|
body: ConfidentialLedgerErrorOutput;
|
|
303
310
|
}
|
|
@@ -311,53 +318,52 @@ export declare interface GetUser200Response extends HttpResponse {
|
|
|
311
318
|
}
|
|
312
319
|
|
|
313
320
|
/** Gets a user. */
|
|
314
|
-
export declare interface
|
|
321
|
+
export declare interface GetUserDefaultResponse extends HttpResponse {
|
|
315
322
|
status: string;
|
|
316
323
|
body: ConfidentialLedgerErrorOutput;
|
|
317
324
|
}
|
|
318
325
|
|
|
319
326
|
export declare type GetUserParameters = RequestParameters;
|
|
320
327
|
|
|
321
|
-
export declare function isUnexpected(response: GetConstitution200Response |
|
|
328
|
+
export declare function isUnexpected(response: GetConstitution200Response | GetConstitutionDefaultResponse): response is GetConstitutionDefaultResponse;
|
|
322
329
|
|
|
323
|
-
export declare function isUnexpected(response: ListConsortiumMembers200Response |
|
|
330
|
+
export declare function isUnexpected(response: ListConsortiumMembers200Response | ListConsortiumMembersDefaultResponse): response is ListConsortiumMembersDefaultResponse;
|
|
324
331
|
|
|
325
|
-
export declare function isUnexpected(response: GetEnclaveQuotes200Response |
|
|
332
|
+
export declare function isUnexpected(response: GetEnclaveQuotes200Response | GetEnclaveQuotesDefaultResponse): response is GetEnclaveQuotesDefaultResponse;
|
|
326
333
|
|
|
327
|
-
export declare function isUnexpected(response: ListCollections200Response |
|
|
334
|
+
export declare function isUnexpected(response: ListCollections200Response | ListCollectionsDefaultResponse): response is ListCollectionsDefaultResponse;
|
|
328
335
|
|
|
329
|
-
export declare function isUnexpected(response: ListLedgerEntries200Response |
|
|
336
|
+
export declare function isUnexpected(response: ListLedgerEntries200Response | ListLedgerEntriesDefaultResponse): response is ListLedgerEntriesDefaultResponse;
|
|
330
337
|
|
|
331
|
-
export declare function isUnexpected(response: CreateLedgerEntry200Response |
|
|
338
|
+
export declare function isUnexpected(response: CreateLedgerEntry200Response | CreateLedgerEntryDefaultResponse): response is CreateLedgerEntryDefaultResponse;
|
|
332
339
|
|
|
333
|
-
export declare function isUnexpected(response: GetLedgerEntry200Response |
|
|
340
|
+
export declare function isUnexpected(response: GetLedgerEntry200Response | GetLedgerEntryDefaultResponse): response is GetLedgerEntryDefaultResponse;
|
|
334
341
|
|
|
335
|
-
export declare function isUnexpected(response: GetReceipt200Response |
|
|
342
|
+
export declare function isUnexpected(response: GetReceipt200Response | GetReceiptDefaultResponse): response is GetReceiptDefaultResponse;
|
|
336
343
|
|
|
337
|
-
export declare function isUnexpected(response: GetTransactionStatus200Response |
|
|
344
|
+
export declare function isUnexpected(response: GetTransactionStatus200Response | GetTransactionStatusDefaultResponse): response is GetTransactionStatusDefaultResponse;
|
|
338
345
|
|
|
339
|
-
export declare function isUnexpected(response: GetCurrentLedgerEntry200Response |
|
|
346
|
+
export declare function isUnexpected(response: GetCurrentLedgerEntry200Response | GetCurrentLedgerEntryDefaultResponse): response is GetCurrentLedgerEntryDefaultResponse;
|
|
340
347
|
|
|
341
|
-
export declare function isUnexpected(response: DeleteUser204Response |
|
|
348
|
+
export declare function isUnexpected(response: DeleteUser204Response | DeleteUserDefaultResponse): response is DeleteUserDefaultResponse;
|
|
342
349
|
|
|
343
|
-
export declare function isUnexpected(response: GetUser200Response |
|
|
350
|
+
export declare function isUnexpected(response: GetUser200Response | GetUserDefaultResponse): response is GetUserDefaultResponse;
|
|
344
351
|
|
|
345
|
-
export declare function isUnexpected(response: CreateOrUpdateUser200Response |
|
|
352
|
+
export declare function isUnexpected(response: CreateOrUpdateUser200Response | CreateOrUpdateUserDefaultResponse): response is CreateOrUpdateUserDefaultResponse;
|
|
346
353
|
|
|
354
|
+
/** An entry in the ledger. */
|
|
347
355
|
export declare interface LedgerEntry {
|
|
348
356
|
/** Contents of the ledger entry. */
|
|
349
357
|
contents: string;
|
|
350
|
-
collectionId?: string;
|
|
351
|
-
/** 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. */
|
|
352
|
-
transactionId?: string;
|
|
353
358
|
}
|
|
354
359
|
|
|
360
|
+
/** An entry in the ledger. */
|
|
355
361
|
export declare interface LedgerEntryOutput {
|
|
356
362
|
/** Contents of the ledger entry. */
|
|
357
363
|
contents: string;
|
|
358
|
-
collectionId?: string;
|
|
364
|
+
readonly collectionId?: string;
|
|
359
365
|
/** 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. */
|
|
360
|
-
transactionId?: string;
|
|
366
|
+
readonly transactionId?: string;
|
|
361
367
|
}
|
|
362
368
|
|
|
363
369
|
export declare interface LedgerIdentity {
|
|
@@ -365,6 +371,7 @@ export declare interface LedgerIdentity {
|
|
|
365
371
|
ledgerId: string;
|
|
366
372
|
}
|
|
367
373
|
|
|
374
|
+
/** The result of querying for a ledger entry from an older transaction id. The ledger entry is available in the response only if the returned state is Ready. */
|
|
368
375
|
export declare interface LedgerQueryResultOutput {
|
|
369
376
|
/** State of a ledger query. */
|
|
370
377
|
state: "Loading" | "Ready";
|
|
@@ -372,27 +379,31 @@ export declare interface LedgerQueryResultOutput {
|
|
|
372
379
|
entry?: LedgerEntryOutput;
|
|
373
380
|
}
|
|
374
381
|
|
|
382
|
+
/** Details about a Confidential Ledger user. */
|
|
375
383
|
export declare interface LedgerUser {
|
|
376
384
|
/** Represents an assignable role. */
|
|
377
385
|
assignedRole: "Administrator" | "Contributor" | "Reader";
|
|
378
|
-
/** Identifier for the user. This must either be an AAD object id or a certificate fingerprint. */
|
|
379
|
-
userId?: string;
|
|
380
386
|
}
|
|
381
387
|
|
|
388
|
+
/** Details about a Confidential Ledger user. */
|
|
382
389
|
export declare interface LedgerUserOutput {
|
|
383
390
|
/** Represents an assignable role. */
|
|
384
391
|
assignedRole: "Administrator" | "Contributor" | "Reader";
|
|
385
392
|
/** Identifier for the user. This must either be an AAD object id or a certificate fingerprint. */
|
|
386
|
-
userId?: string;
|
|
393
|
+
readonly userId?: string;
|
|
387
394
|
}
|
|
388
395
|
|
|
396
|
+
/** Details about a Confidential Ledger user. */
|
|
397
|
+
export declare type LedgerUserResourceMergeAndPatch = Partial<LedgerUser>;
|
|
398
|
+
|
|
399
|
+
/** Returned as a result of a write to the Confidential Ledger, the transaction id in the response indicates when the write will become durable. */
|
|
389
400
|
export declare interface LedgerWriteResultOutput {
|
|
390
401
|
collectionId: string;
|
|
391
402
|
}
|
|
392
403
|
|
|
393
404
|
export declare interface ListCollections {
|
|
394
405
|
/** Collection ids are user-created collections of ledger entries */
|
|
395
|
-
get(options?: ListCollectionsParameters): StreamableMethod<ListCollections200Response |
|
|
406
|
+
get(options?: ListCollectionsParameters): StreamableMethod<ListCollections200Response | ListCollectionsDefaultResponse>;
|
|
396
407
|
}
|
|
397
408
|
|
|
398
409
|
/** Collection ids are user-created collections of ledger entries */
|
|
@@ -402,7 +413,7 @@ export declare interface ListCollections200Response extends HttpResponse {
|
|
|
402
413
|
}
|
|
403
414
|
|
|
404
415
|
/** Collection ids are user-created collections of ledger entries */
|
|
405
|
-
export declare interface
|
|
416
|
+
export declare interface ListCollectionsDefaultResponse extends HttpResponse {
|
|
406
417
|
status: string;
|
|
407
418
|
body: ConfidentialLedgerErrorOutput;
|
|
408
419
|
}
|
|
@@ -411,7 +422,7 @@ export declare type ListCollectionsParameters = RequestParameters;
|
|
|
411
422
|
|
|
412
423
|
export declare interface ListConsortiumMembers {
|
|
413
424
|
/** Consortium members can manage the Confidential Ledger. */
|
|
414
|
-
get(options?: ListConsortiumMembersParameters): StreamableMethod<ListConsortiumMembers200Response |
|
|
425
|
+
get(options?: ListConsortiumMembersParameters): StreamableMethod<ListConsortiumMembers200Response | ListConsortiumMembersDefaultResponse>;
|
|
415
426
|
}
|
|
416
427
|
|
|
417
428
|
/** Consortium members can manage the Confidential Ledger. */
|
|
@@ -421,7 +432,7 @@ export declare interface ListConsortiumMembers200Response extends HttpResponse {
|
|
|
421
432
|
}
|
|
422
433
|
|
|
423
434
|
/** Consortium members can manage the Confidential Ledger. */
|
|
424
|
-
export declare interface
|
|
435
|
+
export declare interface ListConsortiumMembersDefaultResponse extends HttpResponse {
|
|
425
436
|
status: string;
|
|
426
437
|
body: ConfidentialLedgerErrorOutput;
|
|
427
438
|
}
|
|
@@ -430,9 +441,9 @@ export declare type ListConsortiumMembersParameters = RequestParameters;
|
|
|
430
441
|
|
|
431
442
|
export declare interface ListLedgerEntries {
|
|
432
443
|
/** A collection id may optionally be specified. Only entries in the specified (or default) collection will be returned. */
|
|
433
|
-
get(options?: ListLedgerEntriesParameters): StreamableMethod<ListLedgerEntries200Response |
|
|
444
|
+
get(options?: ListLedgerEntriesParameters): StreamableMethod<ListLedgerEntries200Response | ListLedgerEntriesDefaultResponse>;
|
|
434
445
|
/** A collection id may optionally be specified. */
|
|
435
|
-
post(options: CreateLedgerEntryParameters): StreamableMethod<CreateLedgerEntry200Response |
|
|
446
|
+
post(options: CreateLedgerEntryParameters): StreamableMethod<CreateLedgerEntry200Response | CreateLedgerEntryDefaultResponse>;
|
|
436
447
|
}
|
|
437
448
|
|
|
438
449
|
/** A collection id may optionally be specified. Only entries in the specified (or default) collection will be returned. */
|
|
@@ -442,7 +453,7 @@ export declare interface ListLedgerEntries200Response extends HttpResponse {
|
|
|
442
453
|
}
|
|
443
454
|
|
|
444
455
|
/** A collection id may optionally be specified. Only entries in the specified (or default) collection will be returned. */
|
|
445
|
-
export declare interface
|
|
456
|
+
export declare interface ListLedgerEntriesDefaultResponse extends HttpResponse {
|
|
446
457
|
status: string;
|
|
447
458
|
body: ConfidentialLedgerErrorOutput;
|
|
448
459
|
}
|
|
@@ -462,12 +473,14 @@ export declare interface ListLedgerEntriesQueryParamProperties {
|
|
|
462
473
|
toTransactionId?: string;
|
|
463
474
|
}
|
|
464
475
|
|
|
476
|
+
/** Paginated collections returned in response to a query. */
|
|
465
477
|
export declare interface PagedCollectionsOutput {
|
|
466
478
|
collections: Array<CollectionOutput>;
|
|
467
479
|
/** Path from which to retrieve the next page of results. */
|
|
468
480
|
nextLink?: string;
|
|
469
481
|
}
|
|
470
482
|
|
|
483
|
+
/** Paginated ledger entries returned in response to a query. */
|
|
471
484
|
export declare interface PagedLedgerEntriesOutput {
|
|
472
485
|
/** State of a ledger query. */
|
|
473
486
|
state: "Loading" | "Ready";
|
|
@@ -566,6 +579,7 @@ export declare interface Routes {
|
|
|
566
579
|
(path: "/app/users/{userId}", userId: string): DeleteUser;
|
|
567
580
|
}
|
|
568
581
|
|
|
582
|
+
/** A receipt certifying the transaction at the specified id. */
|
|
569
583
|
export declare interface TransactionReceiptOutput {
|
|
570
584
|
receipt?: ReceiptContentsOutput;
|
|
571
585
|
/** State of a ledger query. */
|
|
@@ -574,6 +588,7 @@ export declare interface TransactionReceiptOutput {
|
|
|
574
588
|
transactionId: string;
|
|
575
589
|
}
|
|
576
590
|
|
|
591
|
+
/** Response returned to a query for the transaction status */
|
|
577
592
|
export declare interface TransactionStatusOutput {
|
|
578
593
|
/** Represents the state of the transaction. */
|
|
579
594
|
state: "Committed" | "Pending";
|