@azure-rest/confidential-ledger 1.0.1-alpha.20241125.1 → 1.0.1-alpha.20241126.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/commonjs/confidentialLedger.d.ts +6 -0
- package/dist/commonjs/confidentialLedger.d.ts.map +1 -0
- package/dist/commonjs/confidentialLedger.js +25 -0
- package/dist/commonjs/confidentialLedger.js.map +1 -0
- package/dist/commonjs/generated/src/clientDefinitions.d.ts +75 -0
- package/dist/commonjs/generated/src/clientDefinitions.d.ts.map +1 -0
- package/dist/commonjs/generated/src/clientDefinitions.js +5 -0
- package/dist/commonjs/generated/src/clientDefinitions.js.map +1 -0
- package/dist/commonjs/generated/src/confidentialLedger.d.ts +11 -0
- package/dist/commonjs/generated/src/confidentialLedger.d.ts.map +1 -0
- package/dist/commonjs/generated/src/confidentialLedger.js +35 -0
- package/dist/commonjs/generated/src/confidentialLedger.js.map +1 -0
- package/dist/commonjs/generated/src/index.d.ts +11 -0
- package/dist/commonjs/generated/src/index.d.ts.map +1 -0
- package/dist/commonjs/generated/src/index.js +16 -0
- package/dist/commonjs/generated/src/index.js.map +1 -0
- package/dist/commonjs/generated/src/isUnexpected.d.ts +15 -0
- package/dist/commonjs/generated/src/isUnexpected.d.ts.map +1 -0
- package/dist/commonjs/generated/src/isUnexpected.js +86 -0
- package/dist/commonjs/generated/src/isUnexpected.js.map +1 -0
- package/dist/commonjs/generated/src/logger.d.ts +2 -0
- package/dist/commonjs/generated/src/logger.d.ts.map +1 -0
- package/dist/commonjs/generated/src/logger.js +8 -0
- package/dist/commonjs/generated/src/logger.js.map +1 -0
- package/dist/commonjs/generated/src/models.d.ts +11 -0
- package/dist/commonjs/generated/src/models.d.ts.map +1 -0
- package/dist/commonjs/generated/src/models.js +5 -0
- package/dist/commonjs/generated/src/models.js.map +1 -0
- package/dist/commonjs/generated/src/outputModels.d.ts +130 -0
- package/dist/commonjs/generated/src/outputModels.d.ts.map +1 -0
- package/dist/commonjs/generated/src/outputModels.js +5 -0
- package/dist/commonjs/generated/src/outputModels.js.map +1 -0
- package/dist/commonjs/generated/src/paginateHelper.d.ts +55 -0
- package/dist/commonjs/generated/src/paginateHelper.d.ts.map +1 -0
- package/dist/commonjs/generated/src/paginateHelper.js +119 -0
- package/dist/commonjs/generated/src/paginateHelper.js.map +1 -0
- package/dist/commonjs/generated/src/parameters.d.ts +66 -0
- package/dist/commonjs/generated/src/parameters.d.ts.map +1 -0
- package/dist/commonjs/generated/src/parameters.js +5 -0
- package/dist/commonjs/generated/src/parameters.js.map +1 -0
- package/dist/commonjs/generated/src/responses.d.ts +138 -0
- package/dist/commonjs/generated/src/responses.d.ts.map +1 -0
- package/dist/commonjs/generated/src/responses.js +5 -0
- package/dist/commonjs/generated/src/responses.js.map +1 -0
- package/dist/commonjs/getLedgerIdentity.d.ts +6 -0
- package/dist/commonjs/getLedgerIdentity.d.ts.map +1 -0
- package/dist/commonjs/getLedgerIdentity.js +22 -0
- package/dist/commonjs/getLedgerIdentity.js.map +1 -0
- package/dist/commonjs/index.d.ts +12 -0
- package/dist/commonjs/index.d.ts.map +1 -0
- package/dist/commonjs/index.js +19 -0
- package/dist/commonjs/index.js.map +1 -0
- package/dist/commonjs/package.json +3 -0
- package/dist/commonjs/tsdoc-metadata.json +11 -0
- package/dist/esm/confidentialLedger.d.ts +6 -0
- package/dist/esm/confidentialLedger.d.ts.map +1 -0
- package/{dist-esm/src → dist/esm}/confidentialLedger.js +1 -1
- package/dist/esm/confidentialLedger.js.map +1 -0
- package/dist/esm/generated/src/clientDefinitions.d.ts +75 -0
- package/dist/esm/generated/src/clientDefinitions.d.ts.map +1 -0
- package/dist/esm/generated/src/clientDefinitions.js.map +1 -0
- package/dist/esm/generated/src/confidentialLedger.d.ts +11 -0
- package/dist/esm/generated/src/confidentialLedger.d.ts.map +1 -0
- package/{dist-esm/src → dist/esm}/generated/src/confidentialLedger.js +1 -1
- package/dist/esm/generated/src/confidentialLedger.js.map +1 -0
- package/dist/esm/generated/src/index.d.ts +11 -0
- package/dist/esm/generated/src/index.d.ts.map +1 -0
- package/dist/esm/generated/src/index.js +13 -0
- package/dist/esm/generated/src/index.js.map +1 -0
- package/dist/esm/generated/src/isUnexpected.d.ts +15 -0
- package/dist/esm/generated/src/isUnexpected.d.ts.map +1 -0
- package/dist/esm/generated/src/isUnexpected.js.map +1 -0
- package/dist/esm/generated/src/logger.d.ts +2 -0
- package/dist/esm/generated/src/logger.d.ts.map +1 -0
- package/dist/esm/generated/src/models.d.ts +11 -0
- package/dist/esm/generated/src/models.d.ts.map +1 -0
- package/dist/esm/generated/src/outputModels.d.ts +130 -0
- package/dist/esm/generated/src/outputModels.d.ts.map +1 -0
- package/dist/esm/generated/src/paginateHelper.d.ts +55 -0
- package/dist/esm/generated/src/paginateHelper.d.ts.map +1 -0
- package/dist/esm/generated/src/parameters.d.ts +66 -0
- package/dist/esm/generated/src/parameters.d.ts.map +1 -0
- package/dist/esm/generated/src/parameters.js.map +1 -0
- package/dist/esm/generated/src/responses.d.ts +138 -0
- package/dist/esm/generated/src/responses.d.ts.map +1 -0
- package/dist/esm/generated/src/responses.js.map +1 -0
- package/dist/esm/getLedgerIdentity.d.ts +6 -0
- package/dist/esm/getLedgerIdentity.d.ts.map +1 -0
- package/dist/esm/index.d.ts +12 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +14 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/package.json +48 -30
- package/dist/index.js +0 -285
- package/dist/index.js.map +0 -1
- package/dist-esm/src/confidentialLedger.js.map +0 -1
- package/dist-esm/src/generated/src/clientDefinitions.js.map +0 -1
- package/dist-esm/src/generated/src/confidentialLedger.js.map +0 -1
- package/dist-esm/src/generated/src/index.js +0 -13
- package/dist-esm/src/generated/src/index.js.map +0 -1
- package/dist-esm/src/generated/src/isUnexpected.js.map +0 -1
- package/dist-esm/src/generated/src/parameters.js.map +0 -1
- package/dist-esm/src/generated/src/responses.js.map +0 -1
- package/dist-esm/src/index.js +0 -14
- package/dist-esm/src/index.js.map +0 -1
- /package/{types → dist}/confidential-ledger.d.ts +0 -0
- /package/{dist-esm/src → dist/esm}/generated/src/clientDefinitions.js +0 -0
- /package/{dist-esm/src → dist/esm}/generated/src/isUnexpected.js +0 -0
- /package/{dist-esm/src → dist/esm}/generated/src/logger.js +0 -0
- /package/{dist-esm/src → dist/esm}/generated/src/logger.js.map +0 -0
- /package/{dist-esm/src → dist/esm}/generated/src/models.js +0 -0
- /package/{dist-esm/src → dist/esm}/generated/src/models.js.map +0 -0
- /package/{dist-esm/src → dist/esm}/generated/src/outputModels.js +0 -0
- /package/{dist-esm/src → dist/esm}/generated/src/outputModels.js.map +0 -0
- /package/{dist-esm/src → dist/esm}/generated/src/paginateHelper.js +0 -0
- /package/{dist-esm/src → dist/esm}/generated/src/paginateHelper.js.map +0 -0
- /package/{dist-esm/src → dist/esm}/generated/src/parameters.js +0 -0
- /package/{dist-esm/src → dist/esm}/generated/src/responses.js +0 -0
- /package/{dist-esm/src → dist/esm}/getLedgerIdentity.js +0 -0
- /package/{dist-esm/src → dist/esm}/getLedgerIdentity.js.map +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { PagedAsyncIterableIterator } from "@azure/core-paging";
|
|
2
|
+
import { Client, PathUncheckedResponse } from "@azure-rest/core-client";
|
|
3
|
+
/**
|
|
4
|
+
* Helper type to extract the type of an array
|
|
5
|
+
*/
|
|
6
|
+
export type GetArrayType<T> = T extends Array<infer TData> ? TData : never;
|
|
7
|
+
/**
|
|
8
|
+
* The type of a custom function that defines how to get a page and a link to the next one if any.
|
|
9
|
+
*/
|
|
10
|
+
export type GetPage<TPage> = (pageLink: string, maxPageSize?: number) => Promise<{
|
|
11
|
+
page: TPage;
|
|
12
|
+
nextPageLink?: string;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Options for the paging helper
|
|
16
|
+
*/
|
|
17
|
+
export interface PagingOptions<TResponse> {
|
|
18
|
+
/**
|
|
19
|
+
* Custom function to extract pagination details for crating the PagedAsyncIterableIterator
|
|
20
|
+
*/
|
|
21
|
+
customGetPage?: GetPage<PaginateReturn<TResponse>[]>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Helper type to infer the Type of the paged elements from the response type
|
|
25
|
+
* This type is generated based on the swagger information for x-ms-pageable
|
|
26
|
+
* specifically on the itemName property which indicates the property of the response
|
|
27
|
+
* where the page items are found. The default value is `value`.
|
|
28
|
+
* This type will allow us to provide strongly typed Iterator based on the response we get as second parameter
|
|
29
|
+
*/
|
|
30
|
+
export type PaginateReturn<TResult> = TResult extends {
|
|
31
|
+
body: {
|
|
32
|
+
value?: infer TPage;
|
|
33
|
+
};
|
|
34
|
+
} | {
|
|
35
|
+
body: {
|
|
36
|
+
members?: infer TPage;
|
|
37
|
+
};
|
|
38
|
+
} | {
|
|
39
|
+
body: {
|
|
40
|
+
collections?: infer TPage;
|
|
41
|
+
};
|
|
42
|
+
} | {
|
|
43
|
+
body: {
|
|
44
|
+
entries?: infer TPage;
|
|
45
|
+
};
|
|
46
|
+
} ? GetArrayType<TPage> : Array<unknown>;
|
|
47
|
+
/**
|
|
48
|
+
* Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
|
|
49
|
+
* @param client - Client to use for sending the next page requests
|
|
50
|
+
* @param initialResponse - Initial response containing the nextLink and current page of elements
|
|
51
|
+
* @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results
|
|
52
|
+
* @returns - PagedAsyncIterableIterator to iterate the elements
|
|
53
|
+
*/
|
|
54
|
+
export declare function paginate<TResponse extends PathUncheckedResponse>(client: Client, initialResponse: TResponse, options?: PagingOptions<TResponse>): PagedAsyncIterableIterator<PaginateReturn<TResponse>>;
|
|
55
|
+
//# sourceMappingURL=paginateHelper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paginateHelper.d.ts","s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AC1B,OAAO,GAAE,aAAa,CAAC,SAAS,CAAM,GACrC,0BAA0B,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CA8BvD"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.paginate = paginate;
|
|
6
|
+
const core_paging_1 = require("@azure/core-paging");
|
|
7
|
+
const core_client_1 = require("@azure-rest/core-client");
|
|
8
|
+
/**
|
|
9
|
+
* Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
|
|
10
|
+
* @param client - Client to use for sending the next page requests
|
|
11
|
+
* @param initialResponse - Initial response containing the nextLink and current page of elements
|
|
12
|
+
* @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results
|
|
13
|
+
* @returns - PagedAsyncIterableIterator to iterate the elements
|
|
14
|
+
*/
|
|
15
|
+
function paginate(client, initialResponse, options = {}) {
|
|
16
|
+
let firstRun = true;
|
|
17
|
+
// We need to check the response for success before trying to inspect it looking for
|
|
18
|
+
// the properties to use for nextLink and itemName
|
|
19
|
+
checkPagingRequest(initialResponse);
|
|
20
|
+
const { itemName, nextLinkName } = getPaginationProperties(initialResponse);
|
|
21
|
+
const { customGetPage } = options;
|
|
22
|
+
const pagedResult = {
|
|
23
|
+
firstPageLink: "",
|
|
24
|
+
getPage: typeof customGetPage === "function"
|
|
25
|
+
? customGetPage
|
|
26
|
+
: async (pageLink) => {
|
|
27
|
+
const result = firstRun
|
|
28
|
+
? initialResponse
|
|
29
|
+
: await client.pathUnchecked(pageLink).get();
|
|
30
|
+
firstRun = false;
|
|
31
|
+
checkPagingRequest(result);
|
|
32
|
+
const nextLink = getNextLink(result.body, nextLinkName);
|
|
33
|
+
const values = getElements(result.body, itemName);
|
|
34
|
+
return {
|
|
35
|
+
page: values,
|
|
36
|
+
nextPageLink: nextLink
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
return (0, core_paging_1.getPagedAsyncIterator)(pagedResult);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Gets for the value of nextLink in the body
|
|
44
|
+
*/
|
|
45
|
+
function getNextLink(body, nextLinkName) {
|
|
46
|
+
if (!nextLinkName) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
const nextLink = body[nextLinkName];
|
|
50
|
+
if (typeof nextLink !== "string" && typeof nextLink !== "undefined") {
|
|
51
|
+
throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);
|
|
52
|
+
}
|
|
53
|
+
return nextLink;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Gets the elements of the current request in the body.
|
|
57
|
+
*/
|
|
58
|
+
function getElements(body, itemName) {
|
|
59
|
+
const value = body[itemName];
|
|
60
|
+
// value has to be an array according to the x-ms-pageable extension.
|
|
61
|
+
// The fact that this must be an array is used above to calculate the
|
|
62
|
+
// type of elements in the page in PaginateReturn
|
|
63
|
+
if (!Array.isArray(value)) {
|
|
64
|
+
throw new Error(`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`);
|
|
65
|
+
}
|
|
66
|
+
return value !== null && value !== void 0 ? value : [];
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Checks if a request failed
|
|
70
|
+
*/
|
|
71
|
+
function checkPagingRequest(response) {
|
|
72
|
+
const Http2xxStatusCodes = [
|
|
73
|
+
"200",
|
|
74
|
+
"201",
|
|
75
|
+
"202",
|
|
76
|
+
"203",
|
|
77
|
+
"204",
|
|
78
|
+
"205",
|
|
79
|
+
"206",
|
|
80
|
+
"207",
|
|
81
|
+
"208",
|
|
82
|
+
"226"
|
|
83
|
+
];
|
|
84
|
+
if (!Http2xxStatusCodes.includes(response.status)) {
|
|
85
|
+
throw (0, core_client_1.createRestError)(`Pagination failed with unexpected statusCode ${response.status}`, response);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Extracts the itemName and nextLinkName from the initial response to use them for pagination
|
|
90
|
+
*/
|
|
91
|
+
function getPaginationProperties(initialResponse) {
|
|
92
|
+
// Build a set with the passed custom nextLinkNames
|
|
93
|
+
const nextLinkNames = new Set(["nextLink", "@nextLink"]);
|
|
94
|
+
// Build a set with the passed custom set of itemNames
|
|
95
|
+
const itemNames = new Set(["value", "members", "collections", "entries"]);
|
|
96
|
+
let nextLinkName;
|
|
97
|
+
let itemName;
|
|
98
|
+
for (const name of nextLinkNames) {
|
|
99
|
+
const nextLink = initialResponse.body[name];
|
|
100
|
+
if (nextLink) {
|
|
101
|
+
nextLinkName = name;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
for (const name of itemNames) {
|
|
106
|
+
const item = initialResponse.body[name];
|
|
107
|
+
if (item) {
|
|
108
|
+
itemName = name;
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (!itemName) {
|
|
113
|
+
throw new Error(`Couldn't paginate response\n Body doesn't contain an array property with name: ${[
|
|
114
|
+
...itemNames
|
|
115
|
+
].join(" OR ")}`);
|
|
116
|
+
}
|
|
117
|
+
return { itemName, nextLinkName };
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=paginateHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paginateHelper.js","sourceRoot":"","sources":["../../../../src/generated/src/paginateHelper.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAqElC,4BAkCC;AArGD,oDAI4B;AAC5B,yDAIiC;AAmDjC;;;;;;GAMG;AACH,SAAgB,QAAQ,CACtB,MAAc,EACd,eAA0B,EAC1B,UAAoC,EAAE;IAItC,IAAI,QAAQ,GAAG,IAAI,CAAC;IACpB,oFAAoF;IACpF,kDAAkD;IAClD,kBAAkB,CAAC,eAAe,CAAC,CAAC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CAAC;YACpB,MAAM;QACR,CAAC;IACH,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAI,eAAe,CAAC,IAAgC,CAC5D,IAAI,CACK,CAAC;QACZ,IAAI,IAAI,EAAE,CAAC;YACT,QAAQ,GAAG,IAAI,CAAC;YAChB,MAAM;QACR,CAAC;IACH,CAAC;IAED,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CACb,kFAAkF;YAChF,GAAG,SAAS;SACb,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CACjB,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;AACpC,CAAC","sourcesContent":["// 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"]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { RequestParameters } from "@azure-rest/core-client";
|
|
2
|
+
import { LedgerEntry, LedgerUser } from "./models.js";
|
|
3
|
+
export type GetConstitutionParameters = RequestParameters;
|
|
4
|
+
export type ListConsortiumMembersParameters = RequestParameters;
|
|
5
|
+
export type GetEnclaveQuotesParameters = RequestParameters;
|
|
6
|
+
export type ListCollectionsParameters = RequestParameters;
|
|
7
|
+
export interface ListLedgerEntriesQueryParamProperties {
|
|
8
|
+
/** The collection id. */
|
|
9
|
+
collectionId?: string;
|
|
10
|
+
/** Specify the first transaction ID in a range. */
|
|
11
|
+
fromTransactionId?: string;
|
|
12
|
+
/** Specify the last transaction ID in a range. */
|
|
13
|
+
toTransactionId?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ListLedgerEntriesQueryParam {
|
|
16
|
+
queryParameters?: ListLedgerEntriesQueryParamProperties;
|
|
17
|
+
}
|
|
18
|
+
export type ListLedgerEntriesParameters = ListLedgerEntriesQueryParam & RequestParameters;
|
|
19
|
+
export interface CreateLedgerEntryBodyParam {
|
|
20
|
+
/** Ledger entry. */
|
|
21
|
+
body: LedgerEntry;
|
|
22
|
+
}
|
|
23
|
+
export interface CreateLedgerEntryQueryParamProperties {
|
|
24
|
+
/** The collection id. */
|
|
25
|
+
collectionId?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface CreateLedgerEntryQueryParam {
|
|
28
|
+
queryParameters?: CreateLedgerEntryQueryParamProperties;
|
|
29
|
+
}
|
|
30
|
+
export interface CreateLedgerEntryMediaTypesParam {
|
|
31
|
+
/** Request content type */
|
|
32
|
+
contentType?: "application/json";
|
|
33
|
+
}
|
|
34
|
+
export type CreateLedgerEntryParameters = CreateLedgerEntryQueryParam & CreateLedgerEntryMediaTypesParam & CreateLedgerEntryBodyParam & RequestParameters;
|
|
35
|
+
export interface GetLedgerEntryQueryParamProperties {
|
|
36
|
+
/** The collection id. */
|
|
37
|
+
collectionId?: string;
|
|
38
|
+
}
|
|
39
|
+
export interface GetLedgerEntryQueryParam {
|
|
40
|
+
queryParameters?: GetLedgerEntryQueryParamProperties;
|
|
41
|
+
}
|
|
42
|
+
export type GetLedgerEntryParameters = GetLedgerEntryQueryParam & RequestParameters;
|
|
43
|
+
export type GetReceiptParameters = RequestParameters;
|
|
44
|
+
export type GetTransactionStatusParameters = RequestParameters;
|
|
45
|
+
export interface GetCurrentLedgerEntryQueryParamProperties {
|
|
46
|
+
/** The collection id. */
|
|
47
|
+
collectionId?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface GetCurrentLedgerEntryQueryParam {
|
|
50
|
+
queryParameters?: GetCurrentLedgerEntryQueryParamProperties;
|
|
51
|
+
}
|
|
52
|
+
export type GetCurrentLedgerEntryParameters = GetCurrentLedgerEntryQueryParam & RequestParameters;
|
|
53
|
+
export type DeleteUserParameters = RequestParameters;
|
|
54
|
+
export type GetUserParameters = RequestParameters;
|
|
55
|
+
/** Details about a Confidential Ledger user. */
|
|
56
|
+
export type LedgerUserResourceMergeAndPatch = Partial<LedgerUser>;
|
|
57
|
+
export interface CreateOrUpdateUserBodyParam {
|
|
58
|
+
/** Details about a Confidential Ledger user. */
|
|
59
|
+
body: LedgerUserResourceMergeAndPatch;
|
|
60
|
+
}
|
|
61
|
+
export interface CreateOrUpdateUserMediaTypesParam {
|
|
62
|
+
/** Request content type */
|
|
63
|
+
contentType?: "application/merge-patch+json";
|
|
64
|
+
}
|
|
65
|
+
export type CreateOrUpdateUserParameters = CreateOrUpdateUserMediaTypesParam & CreateOrUpdateUserBodyParam & RequestParameters;
|
|
66
|
+
//# sourceMappingURL=parameters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../../../src/generated/src/parameters.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;AAC1D,MAAM,MAAM,+BAA+B,GAAG,iBAAiB,CAAC;AAChE,MAAM,MAAM,0BAA0B,GAAG,iBAAiB,CAAC;AAC3D,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,CAAC;AAE1D,MAAM,WAAW,qCAAqC;IACpD,yBAAyB;IACzB,YAAY,CAAC,EAAE,MAAM,CAA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,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,CAAC;AAClD,gDAAgD;AAChD,MAAM,MAAM,+BAA+B,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAElE,MAAM,WAAW,2BAA2B;IAC1C,gDAAgD;IAChD,IAAI,EAAE,+BAA+B,CAAC;CACvC;AAED,MAAM,WAAW,iCAAiC;IAChD,2BAA2B;IAC3B,WAAW,CAAC,EAAE,8BAA8B,CAAC;CAC9C;AAED,MAAM,MAAM,4BAA4B,GAAG,iCAAiC,GAC1E,2BAA2B,GAC3B,iBAAiB,CAAC"}
|
|
@@ -0,0 +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.js\";\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"]}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { RawHttpHeaders } from "@azure/core-rest-pipeline";
|
|
2
|
+
import { HttpResponse } from "@azure-rest/core-client";
|
|
3
|
+
import { ConstitutionOutput, ConfidentialLedgerErrorOutput, ConsortiumOutput, ConfidentialLedgerEnclavesOutput, PagedCollectionsOutput, PagedLedgerEntriesOutput, LedgerWriteResultOutput, LedgerQueryResultOutput, TransactionReceiptOutput, TransactionStatusOutput, LedgerEntryOutput, LedgerUserOutput } from "./outputModels.js";
|
|
4
|
+
/** The constitution is a script that assesses and applies proposals from consortium members. */
|
|
5
|
+
export interface GetConstitution200Response extends HttpResponse {
|
|
6
|
+
status: "200";
|
|
7
|
+
body: ConstitutionOutput;
|
|
8
|
+
}
|
|
9
|
+
/** The constitution is a script that assesses and applies proposals from consortium members. */
|
|
10
|
+
export interface GetConstitutionDefaultResponse extends HttpResponse {
|
|
11
|
+
status: string;
|
|
12
|
+
body: ConfidentialLedgerErrorOutput;
|
|
13
|
+
}
|
|
14
|
+
/** Consortium members can manage the Confidential Ledger. */
|
|
15
|
+
export interface ListConsortiumMembers200Response extends HttpResponse {
|
|
16
|
+
status: "200";
|
|
17
|
+
body: ConsortiumOutput;
|
|
18
|
+
}
|
|
19
|
+
/** Consortium members can manage the Confidential Ledger. */
|
|
20
|
+
export interface ListConsortiumMembersDefaultResponse extends HttpResponse {
|
|
21
|
+
status: string;
|
|
22
|
+
body: ConfidentialLedgerErrorOutput;
|
|
23
|
+
}
|
|
24
|
+
/** A quote is an SGX enclave measurement that can be used to verify the validity of a node and its enclave. */
|
|
25
|
+
export interface GetEnclaveQuotes200Response extends HttpResponse {
|
|
26
|
+
status: "200";
|
|
27
|
+
body: ConfidentialLedgerEnclavesOutput;
|
|
28
|
+
}
|
|
29
|
+
/** A quote is an SGX enclave measurement that can be used to verify the validity of a node and its enclave. */
|
|
30
|
+
export interface GetEnclaveQuotesDefaultResponse extends HttpResponse {
|
|
31
|
+
status: string;
|
|
32
|
+
body: ConfidentialLedgerErrorOutput;
|
|
33
|
+
}
|
|
34
|
+
/** Collection ids are user-created collections of ledger entries */
|
|
35
|
+
export interface ListCollections200Response extends HttpResponse {
|
|
36
|
+
status: "200";
|
|
37
|
+
body: PagedCollectionsOutput;
|
|
38
|
+
}
|
|
39
|
+
/** Collection ids are user-created collections of ledger entries */
|
|
40
|
+
export interface ListCollectionsDefaultResponse extends HttpResponse {
|
|
41
|
+
status: string;
|
|
42
|
+
body: ConfidentialLedgerErrorOutput;
|
|
43
|
+
}
|
|
44
|
+
/** A collection id may optionally be specified. Only entries in the specified (or default) collection will be returned. */
|
|
45
|
+
export interface ListLedgerEntries200Response extends HttpResponse {
|
|
46
|
+
status: "200";
|
|
47
|
+
body: PagedLedgerEntriesOutput;
|
|
48
|
+
}
|
|
49
|
+
/** A collection id may optionally be specified. Only entries in the specified (or default) collection will be returned. */
|
|
50
|
+
export interface ListLedgerEntriesDefaultResponse extends HttpResponse {
|
|
51
|
+
status: string;
|
|
52
|
+
body: ConfidentialLedgerErrorOutput;
|
|
53
|
+
}
|
|
54
|
+
export interface CreateLedgerEntry200Headers {
|
|
55
|
+
/** The transaction id at which this write will become durable. */
|
|
56
|
+
"x-ms-ccf-transaction-id"?: string;
|
|
57
|
+
}
|
|
58
|
+
/** A collection id may optionally be specified. */
|
|
59
|
+
export interface CreateLedgerEntry200Response extends HttpResponse {
|
|
60
|
+
status: "200";
|
|
61
|
+
body: LedgerWriteResultOutput;
|
|
62
|
+
headers: RawHttpHeaders & CreateLedgerEntry200Headers;
|
|
63
|
+
}
|
|
64
|
+
/** A collection id may optionally be specified. */
|
|
65
|
+
export interface CreateLedgerEntryDefaultResponse extends HttpResponse {
|
|
66
|
+
status: string;
|
|
67
|
+
body: ConfidentialLedgerErrorOutput;
|
|
68
|
+
}
|
|
69
|
+
/** To return older ledger entries, the relevant sections of the ledger must be read from disk and validated. To prevent blocking within the enclave, the response will indicate whether the entry is ready and part of the response, or if the loading is still ongoing. */
|
|
70
|
+
export interface GetLedgerEntry200Response extends HttpResponse {
|
|
71
|
+
status: "200";
|
|
72
|
+
body: LedgerQueryResultOutput;
|
|
73
|
+
}
|
|
74
|
+
/** To return older ledger entries, the relevant sections of the ledger must be read from disk and validated. To prevent blocking within the enclave, the response will indicate whether the entry is ready and part of the response, or if the loading is still ongoing. */
|
|
75
|
+
export interface GetLedgerEntryDefaultResponse extends HttpResponse {
|
|
76
|
+
status: string;
|
|
77
|
+
body: ConfidentialLedgerErrorOutput;
|
|
78
|
+
}
|
|
79
|
+
/** Gets a receipt certifying ledger contents at a particular transaction id. */
|
|
80
|
+
export interface GetReceipt200Response extends HttpResponse {
|
|
81
|
+
status: "200";
|
|
82
|
+
body: TransactionReceiptOutput;
|
|
83
|
+
}
|
|
84
|
+
/** Gets a receipt certifying ledger contents at a particular transaction id. */
|
|
85
|
+
export interface GetReceiptDefaultResponse extends HttpResponse {
|
|
86
|
+
status: string;
|
|
87
|
+
body: ConfidentialLedgerErrorOutput;
|
|
88
|
+
}
|
|
89
|
+
/** Gets the status of an entry identified by a transaction id. */
|
|
90
|
+
export interface GetTransactionStatus200Response extends HttpResponse {
|
|
91
|
+
status: "200";
|
|
92
|
+
body: TransactionStatusOutput;
|
|
93
|
+
}
|
|
94
|
+
/** Gets the status of an entry identified by a transaction id. */
|
|
95
|
+
export interface GetTransactionStatusDefaultResponse extends HttpResponse {
|
|
96
|
+
status: string;
|
|
97
|
+
body: ConfidentialLedgerErrorOutput;
|
|
98
|
+
}
|
|
99
|
+
/** A collection id may optionally be specified. */
|
|
100
|
+
export interface GetCurrentLedgerEntry200Response extends HttpResponse {
|
|
101
|
+
status: "200";
|
|
102
|
+
body: LedgerEntryOutput;
|
|
103
|
+
}
|
|
104
|
+
/** A collection id may optionally be specified. */
|
|
105
|
+
export interface GetCurrentLedgerEntryDefaultResponse extends HttpResponse {
|
|
106
|
+
status: string;
|
|
107
|
+
body: ConfidentialLedgerErrorOutput;
|
|
108
|
+
}
|
|
109
|
+
/** Deletes a user from the Confidential Ledger. */
|
|
110
|
+
export interface DeleteUser204Response extends HttpResponse {
|
|
111
|
+
status: "204";
|
|
112
|
+
}
|
|
113
|
+
/** Deletes a user from the Confidential Ledger. */
|
|
114
|
+
export interface DeleteUserDefaultResponse extends HttpResponse {
|
|
115
|
+
status: string;
|
|
116
|
+
body: ConfidentialLedgerErrorOutput;
|
|
117
|
+
}
|
|
118
|
+
/** Gets a user. */
|
|
119
|
+
export interface GetUser200Response extends HttpResponse {
|
|
120
|
+
status: "200";
|
|
121
|
+
body: LedgerUserOutput;
|
|
122
|
+
}
|
|
123
|
+
/** Gets a user. */
|
|
124
|
+
export interface GetUserDefaultResponse extends HttpResponse {
|
|
125
|
+
status: string;
|
|
126
|
+
body: ConfidentialLedgerErrorOutput;
|
|
127
|
+
}
|
|
128
|
+
/** A JSON merge patch is applied for existing users */
|
|
129
|
+
export interface CreateOrUpdateUser200Response extends HttpResponse {
|
|
130
|
+
status: "200";
|
|
131
|
+
body: LedgerUserOutput;
|
|
132
|
+
}
|
|
133
|
+
/** A JSON merge patch is applied for existing users */
|
|
134
|
+
export interface CreateOrUpdateUserDefaultResponse extends HttpResponse {
|
|
135
|
+
status: string;
|
|
136
|
+
body: ConfidentialLedgerErrorOutput;
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=responses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../../../src/generated/src/responses.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EACL,kBAAkB,EAClB,6BAA6B,EAC7B,gBAAgB,EAChB,gCAAgC,EAChC,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,mBAAmB,CAAC;AAE3B,gGAAgG;AAChG,MAAM,WAAW,0BAA2B,SAAQ,YAAY;IAC9D,MAAM,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,kBAAkB,CAAC;CAC1B;AAED,gGAAgG;AAChG,MAAM,WAAW,8BAA+B,SAAQ,YAAY;IAClE,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,6BAA6B,CAAC;CACrC;AAED,6DAA6D;AAC7D,MAAM,WAAW,gCAAiC,SAAQ,YA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B,CAAC;CACrC;AAED,mBAAmB;AACnB,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACtD,MAAM,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED,mBAAmB;AACnB,MAAM,WAAW,sBAAuB,SAAQ,YAAY;IAC1D,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,6BAA6B,CAAC;CACrC;AAED,uDAAuD;AACvD,MAAM,WAAW,6BAA8B,SAAQ,YAAY;IACjE,MAAM,EAAE,KAAK,CAAC;IACd,IAAI,EAAE,gBAAgB,CAAC;CACxB;AAED,uDAAuD;AACvD,MAAM,WAAW,iCAAkC,SAAQ,YAAY;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,6BAA6B,CAAC;CACrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responses.js","sourceRoot":"","sources":["../../../../src/generated/src/responses.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport { RawHttpHeaders } from \"@azure/core-rest-pipeline\";\nimport { HttpResponse } from \"@azure-rest/core-client\";\nimport {\n ConstitutionOutput,\n ConfidentialLedgerErrorOutput,\n ConsortiumOutput,\n ConfidentialLedgerEnclavesOutput,\n PagedCollectionsOutput,\n PagedLedgerEntriesOutput,\n LedgerWriteResultOutput,\n LedgerQueryResultOutput,\n TransactionReceiptOutput,\n TransactionStatusOutput,\n LedgerEntryOutput,\n LedgerUserOutput\n} from \"./outputModels.js\";\n\n/** The constitution is a script that assesses and applies proposals from consortium members. */\nexport interface GetConstitution200Response extends HttpResponse {\n status: \"200\";\n body: ConstitutionOutput;\n}\n\n/** The constitution is a script that assesses and applies proposals from consortium members. */\nexport interface GetConstitutionDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\n/** Consortium members can manage the Confidential Ledger. */\nexport interface ListConsortiumMembers200Response extends HttpResponse {\n status: \"200\";\n body: ConsortiumOutput;\n}\n\n/** Consortium members can manage the Confidential Ledger. */\nexport interface ListConsortiumMembersDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\n/** A quote is an SGX enclave measurement that can be used to verify the validity of a node and its enclave. */\nexport interface GetEnclaveQuotes200Response extends HttpResponse {\n status: \"200\";\n body: ConfidentialLedgerEnclavesOutput;\n}\n\n/** A quote is an SGX enclave measurement that can be used to verify the validity of a node and its enclave. */\nexport interface GetEnclaveQuotesDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\n/** Collection ids are user-created collections of ledger entries */\nexport interface ListCollections200Response extends HttpResponse {\n status: \"200\";\n body: PagedCollectionsOutput;\n}\n\n/** Collection ids are user-created collections of ledger entries */\nexport interface ListCollectionsDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\n/** A collection id may optionally be specified. Only entries in the specified (or default) collection will be returned. */\nexport interface ListLedgerEntries200Response extends HttpResponse {\n status: \"200\";\n body: PagedLedgerEntriesOutput;\n}\n\n/** A collection id may optionally be specified. Only entries in the specified (or default) collection will be returned. */\nexport interface ListLedgerEntriesDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\nexport interface CreateLedgerEntry200Headers {\n /** The transaction id at which this write will become durable. */\n \"x-ms-ccf-transaction-id\"?: string;\n}\n\n/** A collection id may optionally be specified. */\nexport interface CreateLedgerEntry200Response extends HttpResponse {\n status: \"200\";\n body: LedgerWriteResultOutput;\n headers: RawHttpHeaders & CreateLedgerEntry200Headers;\n}\n\n/** A collection id may optionally be specified. */\nexport interface CreateLedgerEntryDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\n/** To return older ledger entries, the relevant sections of the ledger must be read from disk and validated. To prevent blocking within the enclave, the response will indicate whether the entry is ready and part of the response, or if the loading is still ongoing. */\nexport interface GetLedgerEntry200Response extends HttpResponse {\n status: \"200\";\n body: LedgerQueryResultOutput;\n}\n\n/** To return older ledger entries, the relevant sections of the ledger must be read from disk and validated. To prevent blocking within the enclave, the response will indicate whether the entry is ready and part of the response, or if the loading is still ongoing. */\nexport interface GetLedgerEntryDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\n/** Gets a receipt certifying ledger contents at a particular transaction id. */\nexport interface GetReceipt200Response extends HttpResponse {\n status: \"200\";\n body: TransactionReceiptOutput;\n}\n\n/** Gets a receipt certifying ledger contents at a particular transaction id. */\nexport interface GetReceiptDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\n/** Gets the status of an entry identified by a transaction id. */\nexport interface GetTransactionStatus200Response extends HttpResponse {\n status: \"200\";\n body: TransactionStatusOutput;\n}\n\n/** Gets the status of an entry identified by a transaction id. */\nexport interface GetTransactionStatusDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\n/** A collection id may optionally be specified. */\nexport interface GetCurrentLedgerEntry200Response extends HttpResponse {\n status: \"200\";\n body: LedgerEntryOutput;\n}\n\n/** A collection id may optionally be specified. */\nexport interface GetCurrentLedgerEntryDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\n/** Deletes a user from the Confidential Ledger. */\nexport interface DeleteUser204Response extends HttpResponse {\n status: \"204\";\n}\n\n/** Deletes a user from the Confidential Ledger. */\nexport interface DeleteUserDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\n/** Gets a user. */\nexport interface GetUser200Response extends HttpResponse {\n status: \"200\";\n body: LedgerUserOutput;\n}\n\n/** Gets a user. */\nexport interface GetUserDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n\n/** A JSON merge patch is applied for existing users */\nexport interface CreateOrUpdateUser200Response extends HttpResponse {\n status: \"200\";\n body: LedgerUserOutput;\n}\n\n/** A JSON merge patch is applied for existing users */\nexport interface CreateOrUpdateUserDefaultResponse extends HttpResponse {\n status: string;\n body: ConfidentialLedgerErrorOutput;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLedgerIdentity.d.ts","sourceRoot":"","sources":["../../src/getLedgerIdentity.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,cAAc;IAC7B,yBAAyB,EAAE,MAAM,CAAC;IAClC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,sBAAsB,GAAE,MAA8D,GACrF,OAAO,CAAC,cAAc,CAAC,CAiBzB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.getLedgerIdentity = getLedgerIdentity;
|
|
6
|
+
const core_client_1 = require("@azure-rest/core-client");
|
|
7
|
+
async function getLedgerIdentity(ledgerId, identityServiceBaseUrl = "https://identity.confidential-ledger.core.azure.com") {
|
|
8
|
+
const client = (0, core_client_1.getClient)(identityServiceBaseUrl);
|
|
9
|
+
const cert = await client.pathUnchecked("/ledgerIdentity/{ledgerId}", ledgerId).get();
|
|
10
|
+
const updatedCert = {
|
|
11
|
+
ledgerIdentityCertificate: cert.body["ledgerTlsCertificate"],
|
|
12
|
+
ledgerId: cert.body["ledgerId"],
|
|
13
|
+
};
|
|
14
|
+
if (!isLedgerIdentity(updatedCert)) {
|
|
15
|
+
throw new Error("Body received from Confidential Ledger Identity is invalid. It must contain ledgerId and ledgerIdentityCertificate");
|
|
16
|
+
}
|
|
17
|
+
return updatedCert;
|
|
18
|
+
}
|
|
19
|
+
function isLedgerIdentity(identity) {
|
|
20
|
+
return identity.ledgerIdentityCertificate && identity.ledgerId;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=getLedgerIdentity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getLedgerIdentity.js","sourceRoot":"","sources":["../../src/getLedgerIdentity.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AASlC,8CAoBC;AA3BD,yDAAoD;AAO7C,KAAK,UAAU,iBAAiB,CACrC,QAAgB,EAChB,yBAAiC,qDAAqD;IAEtF,MAAM,MAAM,GAAG,IAAA,uBAAS,EAAC,sBAAsB,CAAC,CAAC;IAEjD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,4BAA4B,EAAE,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC;IAEtF,MAAM,WAAW,GAAG;QAClB,yBAAyB,EAAE,IAAI,CAAC,IAAI,CAAC,sBAAsB,CAAC;QAC5D,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;KAChC,CAAC;IAEF,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CACb,oHAAoH,CACrH,CAAC;IACJ,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,SAAS,gBAAgB,CAAC,QAAa;IACrC,OAAO,QAAQ,CAAC,yBAAyB,IAAI,QAAQ,CAAC,QAAQ,CAAC;AACjE,CAAC","sourcesContent":["// 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"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import ConfidentialLedger from "./confidentialLedger.js";
|
|
2
|
+
export * from "./generated/src/confidentialLedger.js";
|
|
3
|
+
export * from "./generated/src/models.js";
|
|
4
|
+
export * from "./generated/src/parameters.js";
|
|
5
|
+
export * from "./generated/src/responses.js";
|
|
6
|
+
export * from "./generated/src/clientDefinitions.js";
|
|
7
|
+
export * from "./generated/src/isUnexpected.js";
|
|
8
|
+
export * from "./generated/src/outputModels.js";
|
|
9
|
+
export * from "./generated/src/paginateHelper.js";
|
|
10
|
+
export { LedgerIdentity, getLedgerIdentity } from "./getLedgerIdentity.js";
|
|
11
|
+
export default ConfidentialLedger;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,kBAAkB,MAAM,yBAAyB,CAAC;AACzD,cAAc,uCAAuC,CAAC;AACtD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3E,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright (c) Microsoft Corporation.
|
|
3
|
+
// Licensed under the MIT License.
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.getLedgerIdentity = void 0;
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
7
|
+
const confidentialLedger_js_1 = tslib_1.__importDefault(require("./confidentialLedger.js"));
|
|
8
|
+
tslib_1.__exportStar(require("./generated/src/confidentialLedger.js"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./generated/src/models.js"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./generated/src/parameters.js"), exports);
|
|
11
|
+
tslib_1.__exportStar(require("./generated/src/responses.js"), exports);
|
|
12
|
+
tslib_1.__exportStar(require("./generated/src/clientDefinitions.js"), exports);
|
|
13
|
+
tslib_1.__exportStar(require("./generated/src/isUnexpected.js"), exports);
|
|
14
|
+
tslib_1.__exportStar(require("./generated/src/outputModels.js"), exports);
|
|
15
|
+
tslib_1.__exportStar(require("./generated/src/paginateHelper.js"), exports);
|
|
16
|
+
var getLedgerIdentity_js_1 = require("./getLedgerIdentity.js");
|
|
17
|
+
Object.defineProperty(exports, "getLedgerIdentity", { enumerable: true, get: function () { return getLedgerIdentity_js_1.getLedgerIdentity; } });
|
|
18
|
+
exports.default = confidentialLedger_js_1.default;
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;;AAElC,4FAAyD;AACzD,gFAAsD;AACtD,oEAA0C;AAC1C,wEAA8C;AAC9C,uEAA6C;AAC7C,+EAAqD;AACrD,0EAAgD;AAChD,0EAAgD;AAChD,4EAAkD;AAClD,+DAA2E;AAAlD,yHAAA,iBAAiB,OAAA;AAC1C,kBAAe,+BAAkB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport ConfidentialLedger from \"./confidentialLedger.js\";\nexport * from \"./generated/src/confidentialLedger.js\";\nexport * from \"./generated/src/models.js\";\nexport * from \"./generated/src/parameters.js\";\nexport * from \"./generated/src/responses.js\";\nexport * from \"./generated/src/clientDefinitions.js\";\nexport * from \"./generated/src/isUnexpected.js\";\nexport * from \"./generated/src/outputModels.js\";\nexport * from \"./generated/src/paginateHelper.js\";\nexport { LedgerIdentity, getLedgerIdentity } from \"./getLedgerIdentity.js\";\nexport default ConfidentialLedger;\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.48.0"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TokenCredential } from "@azure/core-auth";
|
|
2
|
+
import type { ClientOptions } from "@azure-rest/core-client";
|
|
3
|
+
import type { ConfidentialLedgerClient } from "./generated/src/clientDefinitions.js";
|
|
4
|
+
export default function ConfidentialLedger(ledgerEndpoint: string, ledgerIdentityCertificate: string, options?: ClientOptions): ConfidentialLedgerClient;
|
|
5
|
+
export default function ConfidentialLedger(ledgerEndpoint: string, ledgerIdentityCertificate: string, credentials: TokenCredential, options?: ClientOptions): ConfidentialLedgerClient;
|
|
6
|
+
//# sourceMappingURL=confidentialLedger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confidentialLedger.d.ts","sourceRoot":"","sources":["../../src/confidentialLedger.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAGxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAGrF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,cAAc,EAAE,MAAM,EACtB,yBAAyB,EAAE,MAAM,EACjC,OAAO,CAAC,EAAE,aAAa,GACtB,wBAAwB,CAAC;AAC5B,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,cAAc,EAAE,MAAM,EACtB,yBAAyB,EAAE,MAAM,EACjC,WAAW,EAAE,eAAe,EAC5B,OAAO,CAAC,EAAE,aAAa,GACtB,wBAAwB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
import { isTokenCredential } from "@azure/core-auth";
|
|
4
|
-
import GeneratedConfidentialLedger from "./generated/src/confidentialLedger";
|
|
4
|
+
import GeneratedConfidentialLedger from "./generated/src/confidentialLedger.js";
|
|
5
5
|
export default function ConfidentialLedger(ledgerEndpoint, ledgerIdentityCertificate, credentialsOrOptions, opts) {
|
|
6
6
|
var _a;
|
|
7
7
|
let credentials;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confidentialLedger.js","sourceRoot":"","sources":["../../src/confidentialLedger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAIrD,OAAO,2BAA2B,MAAM,uCAAuC,CAAC;AAahF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,cAAsB,EACtB,yBAAiC,EACjC,oBAAsD,EACtD,IAAoB;;IAEpB,IAAI,WAAwC,CAAC;IAC7C,IAAI,OAAsB,CAAC;IAE3B,IAAI,iBAAiB,CAAC,oBAAoB,CAAC,EAAE,CAAC;QAC5C,WAAW,GAAG,oBAAoB,CAAC;QACnC,OAAO,GAAG,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,EAAE,CAAC;IACvB,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,oBAAoB,aAApB,oBAAoB,cAApB,oBAAoB,GAAI,EAAE,CAAC;IACvC,CAAC;IAED,MAAM,UAAU,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,UAAU,mCAAI,EAAE,CAAC;IAC7C,UAAU,CAAC,EAAE,GAAG,yBAAyB,CAAC;IAC1C,MAAM,kBAAkB,GAAG,2BAA2B,CAAC,cAAc,EAAE,WAAY,kCAC9E,OAAO,KACV,UAAU,IACV,CAAC;IACH,OAAO,kBAAkB,CAAC;AAC5B,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport { isTokenCredential } from \"@azure/core-auth\";\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport type { ConfidentialLedgerClient } from \"./generated/src/clientDefinitions.js\";\nimport GeneratedConfidentialLedger from \"./generated/src/confidentialLedger.js\";\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"]}
|