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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/README.md +89 -27
  2. package/dist/index.js +229 -35
  3. package/dist/index.js.map +1 -1
  4. package/dist-esm/src/confidentialLedger.js +15 -7
  5. package/dist-esm/src/confidentialLedger.js.map +1 -1
  6. package/dist-esm/src/generated/src/clientDefinitions.js +4 -0
  7. package/dist-esm/src/generated/src/clientDefinitions.js.map +1 -0
  8. package/dist-esm/src/generated/src/confidentialLedger.js +12 -4
  9. package/dist-esm/src/generated/src/confidentialLedger.js.map +1 -1
  10. package/dist-esm/src/generated/src/index.js +5 -1
  11. package/dist-esm/src/generated/src/index.js.map +1 -1
  12. package/dist-esm/src/generated/src/isUnexpected.js +77 -0
  13. package/dist-esm/src/generated/src/isUnexpected.js.map +1 -0
  14. package/dist-esm/src/generated/src/models.js.map +1 -1
  15. package/dist-esm/src/generated/src/outputModels.js +4 -0
  16. package/dist-esm/src/generated/src/outputModels.js.map +1 -0
  17. package/dist-esm/src/generated/src/paginateHelper.js +116 -0
  18. package/dist-esm/src/generated/src/paginateHelper.js.map +1 -0
  19. package/dist-esm/src/generated/src/parameters.js.map +1 -1
  20. package/dist-esm/src/generated/src/responses.js.map +1 -1
  21. package/dist-esm/src/getLedgerIdentity.js +9 -5
  22. package/dist-esm/src/getLedgerIdentity.js.map +1 -1
  23. package/dist-esm/src/index.js +4 -0
  24. package/dist-esm/src/index.js.map +1 -1
  25. package/package.json +10 -8
  26. package/types/confidential-ledger.d.ts +285 -164
  27. package/dist-esm/src/certificatePolicy.browser.js +0 -14
  28. package/dist-esm/src/certificatePolicy.browser.js.map +0 -1
  29. package/dist-esm/src/certificatePolicy.js +0 -23
  30. package/dist-esm/src/certificatePolicy.js.map +0 -1
@@ -1,13 +1,21 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
3
  import { getClient } from "@azure-rest/core-client";
4
- export default function ConfidentialLedger(ledgerUri, credentials, options = {}) {
4
+ export default function createClient(ledgerUri, credentials, options = {}) {
5
5
  var _a, _b;
6
6
  const baseUrl = (_a = options.baseUrl) !== null && _a !== void 0 ? _a : `${ledgerUri}`;
7
- options.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : "0.1-preview";
7
+ options.apiVersion = (_b = options.apiVersion) !== null && _b !== void 0 ? _b : "2022-05-13";
8
8
  options = Object.assign(Object.assign({}, options), { credentials: {
9
- scopes: ["https://confidential-ledger.azure.com/.default"],
9
+ scopes: ["https://confidential-ledger.azure.com/.default"]
10
10
  } });
11
- return getClient(baseUrl, credentials, options);
11
+ const userAgentInfo = `azsdk-js-confidential-ledger-rest/1.0.0-beta.3`;
12
+ const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
13
+ ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
14
+ : `${userAgentInfo}`;
15
+ options = Object.assign(Object.assign({}, options), { userAgentOptions: {
16
+ userAgentPrefix
17
+ } });
18
+ const client = getClient(baseUrl, credentials, options);
19
+ return client;
12
20
  }
13
21
  //# sourceMappingURL=confidentialLedger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"confidentialLedger.js","sourceRoot":"","sources":["../../../../src/generated/src/confidentialLedger.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AA0ClC,OAAO,EAAE,SAAS,EAAyB,MAAM,yBAAyB,CAAC;AAmG3E,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,SAAiB,EACjB,WAA6B,EAC7B,UAAyB,EAAE;;IAE3B,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,GAAG,SAAS,EAAE,CAAC;IAClD,OAAO,CAAC,UAAU,GAAG,MAAA,OAAO,CAAC,UAAU,mCAAI,aAAa,CAAC;IACzD,OAAO,mCACF,OAAO,KACV,WAAW,EAAE;YACX,MAAM,EAAE,CAAC,gDAAgD,CAAC;SAC3D,GACF,CAAC;IAEF,OAAO,SAAS,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAiC,CAAC;AAClF,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n GetConstitutionParameters,\n GetConsortiumMembersParameters,\n GetEnclaveQuotesParameters,\n GetLedgerEntriesParameters,\n PostLedgerEntryParameters,\n GetLedgerEntryParameters,\n GetReceiptParameters,\n GetTransactionStatusParameters,\n GetCurrentLedgerEntryParameters,\n DeleteUserParameters,\n GetUserParameters,\n CreateOrUpdateUserParameters,\n} from \"./parameters\";\nimport {\n GetConstitution200Response,\n GetConstitutiondefaultResponse,\n GetConsortiumMembers200Response,\n GetConsortiumMembersdefaultResponse,\n GetEnclaveQuotes200Response,\n GetEnclaveQuotesdefaultResponse,\n GetLedgerEntries200Response,\n GetLedgerEntriesdefaultResponse,\n PostLedgerEntry200Response,\n PostLedgerEntrydefaultResponse,\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 { getClient, ClientOptions, Client } from \"@azure-rest/core-client\";\nimport { TokenCredential } from \"@azure/core-auth\";\n\nexport interface GetConstitution {\n /** The constitution is a script that assesses and applies proposals from consortium members. */\n get(\n options?: GetConstitutionParameters\n ): Promise<GetConstitution200Response | GetConstitutiondefaultResponse>;\n}\n\nexport interface GetConsortiumMembers {\n /** Consortium members can manage the Confidential Ledger. */\n get(\n options?: GetConsortiumMembersParameters\n ): Promise<GetConsortiumMembers200Response | GetConsortiumMembersdefaultResponse>;\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 ): Promise<GetEnclaveQuotes200Response | GetEnclaveQuotesdefaultResponse>;\n}\n\nexport interface PostLedgerEntry {\n /** A sub-ledger id may optionally be specified. Only entries in the specified (or default) sub-ledger will be returned. */\n get(\n options?: GetLedgerEntriesParameters\n ): Promise<GetLedgerEntries200Response | GetLedgerEntriesdefaultResponse>;\n /** A sub-ledger id may optionally be specified. */\n post(\n options?: PostLedgerEntryParameters\n ): Promise<PostLedgerEntry200Response | PostLedgerEntrydefaultResponse>;\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 ): Promise<GetLedgerEntry200Response | GetLedgerEntrydefaultResponse>;\n}\n\nexport interface GetReceipt {\n /** Gets a receipt certifying ledger contents at a particular transaction id. */\n get(options?: GetReceiptParameters): Promise<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 ): Promise<GetTransactionStatus200Response | GetTransactionStatusdefaultResponse>;\n}\n\nexport interface GetCurrentLedgerEntry {\n /** A sub-ledger id may optionally be specified. */\n get(\n options?: GetCurrentLedgerEntryParameters\n ): Promise<GetCurrentLedgerEntry200Response | GetCurrentLedgerEntrydefaultResponse>;\n}\n\nexport interface CreateOrUpdateUser {\n /** Deletes a user from the Confidential Ledger. */\n delete(\n options?: DeleteUserParameters\n ): Promise<DeleteUser204Response | DeleteUserdefaultResponse>;\n /** Gets a user. */\n get(options?: GetUserParameters): Promise<GetUser200Response | GetUserdefaultResponse>;\n /** A JSON merge patch is applied for existing users */\n patch(\n options: CreateOrUpdateUserParameters\n ): Promise<CreateOrUpdateUser200Response | CreateOrUpdateUserdefaultResponse>;\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\"): GetConsortiumMembers;\n /** Resource for '/app/enclaveQuotes' has methods for the following verbs: get */\n (path: \"/app/enclaveQuotes\"): GetEnclaveQuotes;\n /** Resource for '/app/transactions' has methods for the following verbs: get, post */\n (path: \"/app/transactions\"): PostLedgerEntry;\n /** Resource for '/app/transactions/\\{transactionId\\}' has methods for the following verbs: get */\n (path: \"/app/transactions/{transactionId}\", transactionId: string): GetLedgerEntry;\n /** Resource for '/app/transactions/\\{transactionId\\}/receipt' has methods for the following verbs: get */\n (path: \"/app/transactions/{transactionId}/receipt\", transactionId: string): GetReceipt;\n /** Resource for '/app/transactions/\\{transactionId\\}/status' has methods for the following verbs: get */\n (path: \"/app/transactions/{transactionId}/status\", transactionId: string): 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): CreateOrUpdateUser;\n}\n\nexport type ConfidentialLedgerRestClient = Client & {\n path: Routes;\n};\n\nexport default function ConfidentialLedger(\n ledgerUri: string,\n credentials?: TokenCredential,\n options: ClientOptions = {}\n): ConfidentialLedgerRestClient {\n const baseUrl = options.baseUrl ?? `${ledgerUri}`;\n options.apiVersion = options.apiVersion ?? \"0.1-preview\";\n options = {\n ...options,\n credentials: {\n scopes: [\"https://confidential-ledger.azure.com/.default\"],\n },\n };\n\n return getClient(baseUrl, credentials, options) as ConfidentialLedgerRestClient;\n}\n"]}
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;AAInE,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,SAAiB,EACjB,WAA4B,EAC5B,UAAyB,EAAE;;IAE3B,MAAM,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,GAAG,SAAS,EAAE,CAAC;IAClD,OAAO,CAAC,UAAU,GAAG,MAAA,OAAO,CAAC,UAAU,mCAAI,YAAY,CAAC;IACxD,OAAO,mCACF,OAAO,KACV,WAAW,EAAE;YACX,MAAM,EAAE,CAAC,gDAAgD,CAAC;SAC3D,GACF,CAAC;IAEF,MAAM,aAAa,GAAG,gDAAgD,CAAC;IACvE,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,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 { TokenCredential } from \"@azure/core-auth\";\nimport { ConfidentialLedgerClient } from \"./clientDefinitions\";\n\nexport default function createClient(\n ledgerUri: string,\n credentials: TokenCredential,\n options: ClientOptions = {}\n): ConfidentialLedgerClient {\n const baseUrl = options.baseUrl ?? `${ledgerUri}`;\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-beta.3`;\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"]}
@@ -2,8 +2,12 @@
2
2
  // Licensed under the MIT license.
3
3
  import ConfidentialLedger from "./confidentialLedger";
4
4
  export * from "./confidentialLedger";
5
- export * from "./models";
6
5
  export * from "./parameters";
7
6
  export * from "./responses";
7
+ export * from "./clientDefinitions";
8
+ export * from "./isUnexpected";
9
+ export * from "./models";
10
+ export * from "./outputModels";
11
+ export * from "./paginateHelper";
8
12
  export default ConfidentialLedger;
9
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/generated/src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,cAAc,sBAAsB,CAAC;AACrC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAE5B,eAAe,kBAAkB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport ConfidentialLedger from \"./confidentialLedger\";\n\nexport * from \"./confidentialLedger\";\nexport * from \"./models\";\nexport * from \"./parameters\";\nexport * from \"./responses\";\n\nexport default ConfidentialLedger;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/generated/src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AAEtD,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AAEjC,eAAe,kBAAkB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport ConfidentialLedger from \"./confidentialLedger\";\n\nexport * from \"./confidentialLedger\";\nexport * from \"./parameters\";\nexport * from \"./responses\";\nexport * from \"./clientDefinitions\";\nexport * from \"./isUnexpected\";\nexport * from \"./models\";\nexport * from \"./outputModels\";\nexport * from \"./paginateHelper\";\n\nexport default ConfidentialLedger;\n"]}
@@ -0,0 +1,77 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ const responseMap = {
4
+ "GET /app/governance/constitution": ["200"],
5
+ "GET /app/governance/members": ["200"],
6
+ "GET /app/enclaveQuotes": ["200"],
7
+ "GET /app/collections": ["200"],
8
+ "GET /app/transactions": ["200"],
9
+ "POST /app/transactions": ["200"],
10
+ "GET /app/transactions/{transactionId}": ["200"],
11
+ "GET /app/transactions/{transactionId}/receipt": ["200"],
12
+ "GET /app/transactions/{transactionId}/status": ["200"],
13
+ "GET /app/transactions/current": ["200"],
14
+ "DELETE /app/users/{userId}": ["204"],
15
+ "GET /app/users/{userId}": ["200"],
16
+ "PATCH /app/users/{userId}": ["200"]
17
+ };
18
+ export function isUnexpected(response) {
19
+ const lroOriginal = response.headers["x-ms-original-url"];
20
+ const url = new URL(lroOriginal !== null && lroOriginal !== void 0 ? lroOriginal : response.request.url);
21
+ const method = response.request.method;
22
+ let pathDetails = responseMap[`${method} ${url.pathname}`];
23
+ if (!pathDetails) {
24
+ pathDetails = geParametrizedPathSuccess(url.pathname);
25
+ }
26
+ return !pathDetails.includes(response.status);
27
+ }
28
+ function geParametrizedPathSuccess(path) {
29
+ const pathParts = path.split("/");
30
+ // Iterate the responseMap to find a match
31
+ for (const [key, value] of Object.entries(responseMap)) {
32
+ // Extracting the path from the map key which is in format
33
+ // GET /path/foo
34
+ const candidatePath = getPathFromMapKey(key);
35
+ // Get each part of the url path
36
+ const candidateParts = candidatePath.split("/");
37
+ // If the candidate and actual paths don't match in size
38
+ // we move on to the next candidate path
39
+ if (candidateParts.length === pathParts.length &&
40
+ hasParametrizedPath(key)) {
41
+ // track if we have found a match to return the values found.
42
+ let found = true;
43
+ for (let i = 0; i < candidateParts.length; i++) {
44
+ if (candidateParts[i].startsWith("{") &&
45
+ candidateParts[i].endsWith("}")) {
46
+ // If the current part of the candidate is a "template" part
47
+ // it is a match with the actual path part on hand
48
+ // skip as the parameterized part can match anything
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]) {
55
+ found = false;
56
+ break;
57
+ }
58
+ }
59
+ // We finished evaluating the current candidate parts
60
+ // if all parts matched we return the success values form
61
+ // the path mapping.
62
+ if (found) {
63
+ return value;
64
+ }
65
+ }
66
+ }
67
+ // No match was found, return an empty array.
68
+ return [];
69
+ }
70
+ function hasParametrizedPath(path) {
71
+ return path.includes("/{");
72
+ }
73
+ function getPathFromMapKey(mapKey) {
74
+ const pathStart = mapKey.indexOf("/");
75
+ return mapKey.slice(pathStart);
76
+ }
77
+ //# sourceMappingURL=isUnexpected.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../../../src/generated/src/isUnexpected.ts"],"names":[],"mappings":"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","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport {\n GetConstitution200Response,\n GetConstitutiondefaultResponse,\n GetConsortiumMembers200Response,\n GetConsortiumMembersdefaultResponse,\n GetEnclaveQuotes200Response,\n GetEnclaveQuotesdefaultResponse,\n ListCollections200Response,\n ListCollectionsdefaultResponse,\n ListLedgerEntries200Response,\n ListLedgerEntriesdefaultResponse,\n PostLedgerEntry200Response,\n PostLedgerEntrydefaultResponse,\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 | GetConsortiumMembers200Response\n | GetConsortiumMembersdefaultResponse\n): response is GetConsortiumMembersdefaultResponse;\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: PostLedgerEntry200Response | PostLedgerEntrydefaultResponse\n): response is PostLedgerEntrydefaultResponse;\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 | GetConsortiumMembers200Response\n | GetConsortiumMembersdefaultResponse\n | GetEnclaveQuotes200Response\n | GetEnclaveQuotesdefaultResponse\n | ListCollections200Response\n | ListCollectionsdefaultResponse\n | ListLedgerEntries200Response\n | ListLedgerEntriesdefaultResponse\n | PostLedgerEntry200Response\n | PostLedgerEntrydefaultResponse\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 | GetConsortiumMembersdefaultResponse\n | GetEnclaveQuotesdefaultResponse\n | ListCollectionsdefaultResponse\n | ListLedgerEntriesdefaultResponse\n | PostLedgerEntrydefaultResponse\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 +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 Constitution {\n /** SHA256 digest of the constitution script. */\n digest: string;\n /** Contents of the constitution. */\n script: string;\n}\n\nexport interface ConfidentialLedgerError {\n /** An error response from Confidential Ledger. */\n error?: ConfidentialLedgerErrorBody;\n}\n\nexport interface ConfidentialLedgerErrorBody {\n /** The error code. */\n code?: string;\n /** The error message. */\n message?: string;\n /** An error response from Confidential Ledger. */\n innerError?: ConfidentialLedgerErrorBody;\n}\n\nexport interface Consortium {\n members: ConsortiumMember[];\n}\n\nexport interface ConsortiumMember {\n /** PEM-encoded certificate associated with the member. */\n certificate: string;\n /** Identifier assigned to the member. */\n id: string;\n}\n\nexport interface ConfidentialLedgerEnclaves {\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: EnclaveQuotesDictionary;\n}\n\nexport interface EnclaveQuote {\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 PagedLedgerEntries {\n /** State of a ledger query. */\n state: ConfidentialLedgerQueryState;\n /** Path from which to retrieve the next page of results. */\n nextLink?: string;\n /** Array of ledger entries. */\n entries: LedgerEntry[];\n}\n\nexport interface LedgerEntry {\n /** Contents of the ledger entry. */\n contents: string;\n /** Identifier for sub-ledgers. */\n subLedgerId?: 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 LedgerWriteResult {\n /** Identifier for sub-ledgers. */\n subLedgerId: string;\n}\n\nexport interface LedgerQueryResult {\n /** State of a ledger query. */\n state: ConfidentialLedgerQueryState;\n /** The ledger entry found as a result of the query. This is only available if the query is in Ready state. */\n entry?: LedgerEntry;\n}\n\nexport interface TransactionReceipt {\n /** A receipt certifying the transaction at the specified id. */\n receipt?: ReceiptContents;\n /** State of a ledger query. */\n state: ConfidentialLedgerQueryState;\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 ReceiptContents {\n /** Merkle tree leaf for this transaction. */\n leaf: string;\n /** Id of the node returning the receipt. */\n nodeId: string;\n /** Merkle proof. */\n proof: MerkleProofElement[];\n /** Root of the Merkle tree at the time the transaction was recorded. */\n root: string;\n /** Signature by the node, with its certificate, over the Merkle root. */\n signature: string;\n}\n\nexport interface MerkleProofElement {\n left?: string;\n right?: string;\n}\n\nexport interface TransactionStatus {\n /** Represents the state of the transaction. */\n state: TransactionState;\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 LedgerUser {\n /** Represents an assignable role. */\n assignedRole: ConfidentialLedgerUserRoleName;\n /** Identifier for the user. This must either be an AAD object id or a certificate fingerprint. */\n userId?: string;\n}\n\nexport interface RoleAssignment {\n /** Represents an assignable role. */\n roleName: ConfidentialLedgerUserRoleName;\n /** Description of the role. */\n description?: string;\n}\n\nexport type ConfidentialLedgerQueryState = \"Loading\" | \"Ready\";\nexport type TransactionState = \"Committed\" | \"Pending\";\nexport type ConfidentialLedgerUserRoleName =\n | \"Administrator\"\n | \"Contributor\"\n | \"Reader\";\nexport type EnclaveQuotesDictionary = Record<string, EnclaveQuote>;\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\nexport interface LedgerEntry {\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 LedgerUser {\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"]}
@@ -0,0 +1,4 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ export {};
4
+ //# sourceMappingURL=outputModels.js.map
@@ -0,0 +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}\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 CollectionsOutput {\n /** A list of identifiers for ledger collections. */\n collections: Array<CollectionOutput>;\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"]}
@@ -0,0 +1,116 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT license.
3
+ import { getPagedAsyncIterator } from "@azure/core-paging";
4
+ import { createRestError } from "@azure-rest/core-client";
5
+ /**
6
+ * Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
7
+ * @param client - Client to use for sending the next page requests
8
+ * @param initialResponse - Initial response containing the nextLink and current page of elements
9
+ * @param customGetPage - Optional - Function to define how to extract the page and next link to be used to paginate the results
10
+ * @returns - PagedAsyncIterableIterator to iterate the elements
11
+ */
12
+ export function paginate(client, initialResponse, options = {}) {
13
+ let firstRun = true;
14
+ // We need to check the response for success before trying to inspect it looking for
15
+ // the properties to use for nextLink and itemName
16
+ checkPagingRequest(initialResponse);
17
+ const { itemName, nextLinkName } = getPaginationProperties(initialResponse);
18
+ const { customGetPage } = options;
19
+ const pagedResult = {
20
+ firstPageLink: "",
21
+ getPage: typeof customGetPage === "function"
22
+ ? customGetPage
23
+ : async (pageLink) => {
24
+ const result = firstRun
25
+ ? initialResponse
26
+ : await client.pathUnchecked(pageLink).get();
27
+ firstRun = false;
28
+ checkPagingRequest(result);
29
+ const nextLink = getNextLink(result.body, nextLinkName);
30
+ const values = getElements(result.body, itemName);
31
+ return {
32
+ page: values,
33
+ nextPageLink: nextLink
34
+ };
35
+ }
36
+ };
37
+ return getPagedAsyncIterator(pagedResult);
38
+ }
39
+ /**
40
+ * Gets for the value of nextLink in the body
41
+ */
42
+ function getNextLink(body, nextLinkName) {
43
+ if (!nextLinkName) {
44
+ return undefined;
45
+ }
46
+ const nextLink = body[nextLinkName];
47
+ if (typeof nextLink !== "string" && typeof nextLink !== "undefined") {
48
+ throw new Error(`Body Property ${nextLinkName} should be a string or undefined`);
49
+ }
50
+ return nextLink;
51
+ }
52
+ /**
53
+ * Gets the elements of the current request in the body.
54
+ */
55
+ function getElements(body, itemName) {
56
+ const value = body[itemName];
57
+ // value has to be an array according to the x-ms-pageable extension.
58
+ // The fact that this must be an array is used above to calculate the
59
+ // type of elements in the page in PaginateReturn
60
+ if (!Array.isArray(value)) {
61
+ throw new Error(`Couldn't paginate response\n Body doesn't contain an array property with name: ${itemName}`);
62
+ }
63
+ return value !== null && value !== void 0 ? value : [];
64
+ }
65
+ /**
66
+ * Checks if a request failed
67
+ */
68
+ function checkPagingRequest(response) {
69
+ const Http2xxStatusCodes = [
70
+ "200",
71
+ "201",
72
+ "202",
73
+ "203",
74
+ "204",
75
+ "205",
76
+ "206",
77
+ "207",
78
+ "208",
79
+ "226"
80
+ ];
81
+ if (!Http2xxStatusCodes.includes(response.status)) {
82
+ throw createRestError(`Pagination failed with unexpected statusCode ${response.status}`, response);
83
+ }
84
+ }
85
+ /**
86
+ * Extracts the itemName and nextLinkName from the initial response to use them for pagination
87
+ */
88
+ function getPaginationProperties(initialResponse) {
89
+ // Build a set with the passed custom nextLinkNames
90
+ const nextLinkNames = new Set(["nextLink", "@nextLink"]);
91
+ // Build a set with the passed custom set of itemNames
92
+ const itemNames = new Set(["value", "entries"]);
93
+ let nextLinkName;
94
+ let itemName;
95
+ for (const name of nextLinkNames) {
96
+ const nextLink = initialResponse.body[name];
97
+ if (nextLink) {
98
+ nextLinkName = name;
99
+ break;
100
+ }
101
+ }
102
+ for (const name of itemNames) {
103
+ const item = initialResponse.body[name];
104
+ if (item) {
105
+ itemName = name;
106
+ break;
107
+ }
108
+ }
109
+ if (!itemName) {
110
+ throw new Error(`Couldn't paginate response\n Body doesn't contain an array property with name: ${[
111
+ ...itemNames
112
+ ].join(" OR ")}`);
113
+ }
114
+ return { itemName, nextLinkName };
115
+ }
116
+ //# sourceMappingURL=paginateHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paginateHelper.js","sourceRoot":"","sources":["../../../../src/generated/src/paginateHelper.ts"],"names":[],"mappings":"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","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: { 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\", \"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"]}
@@ -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 GetConsortiumMembersParameters = RequestParameters;\nexport type GetEnclaveQuotesParameters = RequestParameters;\n\nexport interface GetLedgerEntriesQueryParamProperties {\n /** The sub-ledger id. */\n subLedgerId?: 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 GetLedgerEntriesQueryParam {\n queryParameters?: GetLedgerEntriesQueryParamProperties;\n}\n\nexport type GetLedgerEntriesParameters = RequestParameters &\n GetLedgerEntriesQueryParam;\n\nexport interface PostLedgerEntryQueryParamProperties {\n /** The sub-ledger id. */\n subLedgerId?: string;\n}\n\nexport interface PostLedgerEntryQueryParam {\n queryParameters?: PostLedgerEntryQueryParamProperties;\n}\n\nexport interface PostLedgerEntryBodyParam {\n body?: LedgerEntry;\n}\n\nexport type PostLedgerEntryParameters = RequestParameters &\n PostLedgerEntryQueryParam &\n PostLedgerEntryBodyParam;\n\nexport interface GetLedgerEntryQueryParamProperties {\n /** The sub-ledger id. */\n subLedgerId?: string;\n}\n\nexport interface GetLedgerEntryQueryParam {\n queryParameters?: GetLedgerEntryQueryParamProperties;\n}\n\nexport type GetLedgerEntryParameters = RequestParameters &\n GetLedgerEntryQueryParam;\nexport type GetReceiptParameters = RequestParameters;\nexport type GetTransactionStatusParameters = RequestParameters;\n\nexport interface GetCurrentLedgerEntryQueryParamProperties {\n /** The sub-ledger id. */\n subLedgerId?: string;\n}\n\nexport interface GetCurrentLedgerEntryQueryParam {\n queryParameters?: GetCurrentLedgerEntryQueryParamProperties;\n}\n\nexport type GetCurrentLedgerEntryParameters = RequestParameters &\n GetCurrentLedgerEntryQueryParam;\nexport type DeleteUserParameters = RequestParameters;\nexport type GetUserParameters = RequestParameters;\n\nexport interface CreateOrUpdateUserBodyParam {\n body: LedgerUser;\n}\n\nexport type CreateOrUpdateUserParameters = RequestParameters &\n CreateOrUpdateUserBodyParam;\n"]}
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 GetConsortiumMembersParameters = 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 PostLedgerEntryBodyParam {\n /** Ledger entry. */\n body: LedgerEntry;\n}\n\nexport interface PostLedgerEntryQueryParamProperties {\n /** The collection id. */\n collectionId?: string;\n}\n\nexport interface PostLedgerEntryQueryParam {\n queryParameters?: PostLedgerEntryQueryParamProperties;\n}\n\nexport interface PostLedgerEntryMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type PostLedgerEntryParameters = PostLedgerEntryQueryParam &\n PostLedgerEntryMediaTypesParam &\n PostLedgerEntryBodyParam &\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: LedgerUser;\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 {\n Constitution,\n ConfidentialLedgerError,\n Consortium,\n ConfidentialLedgerEnclaves,\n PagedLedgerEntries,\n LedgerWriteResult,\n LedgerQueryResult,\n TransactionReceipt,\n TransactionStatus,\n LedgerEntry,\n LedgerUser\n} from \"./models\";\nimport { HttpResponse } from \"@azure-rest/core-client\";\nimport { RawHttpHeaders } from \"@azure/core-rest-pipeline\";\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: Constitution;\n}\n\n/** The constitution is a script that assesses and applies proposals from consortium members. */\nexport interface GetConstitutiondefaultResponse extends HttpResponse {\n status: \"500\";\n body: ConfidentialLedgerError;\n}\n\n/** Consortium members can manage the Confidential Ledger. */\nexport interface GetConsortiumMembers200Response extends HttpResponse {\n status: \"200\";\n body: Consortium;\n}\n\n/** Consortium members can manage the Confidential Ledger. */\nexport interface GetConsortiumMembersdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ConfidentialLedgerError;\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: ConfidentialLedgerEnclaves;\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: \"500\";\n body: ConfidentialLedgerError;\n}\n\n/** A sub-ledger id may optionally be specified. Only entries in the specified (or default) sub-ledger will be returned. */\nexport interface GetLedgerEntries200Response extends HttpResponse {\n status: \"200\";\n body: PagedLedgerEntries;\n}\n\n/** A sub-ledger id may optionally be specified. Only entries in the specified (or default) sub-ledger will be returned. */\nexport interface GetLedgerEntriesdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ConfidentialLedgerError;\n}\n\nexport interface PostLedgerEntry200Headers {\n /** The transaction id at which this write will become durable. */\n \"x-ms-ccf-transaction-id\"?: string;\n}\n\n/** A sub-ledger id may optionally be specified. */\nexport interface PostLedgerEntry200Response extends HttpResponse {\n status: \"200\";\n body: LedgerWriteResult;\n headers: RawHttpHeaders & PostLedgerEntry200Headers;\n}\n\n/** A sub-ledger id may optionally be specified. */\nexport interface PostLedgerEntrydefaultResponse extends HttpResponse {\n status: \"500\";\n body: ConfidentialLedgerError;\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: LedgerQueryResult;\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: \"500\";\n body: ConfidentialLedgerError;\n}\n\n/** Gets a receipt certifying ledger contents at a particular transaction id. */\nexport interface GetReceipt200Response extends HttpResponse {\n status: \"200\";\n body: TransactionReceipt;\n}\n\n/** Gets a receipt certifying ledger contents at a particular transaction id. */\nexport interface GetReceiptdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ConfidentialLedgerError;\n}\n\n/** Gets the status of an entry identified by a transaction id. */\nexport interface GetTransactionStatus200Response extends HttpResponse {\n status: \"200\";\n body: TransactionStatus;\n}\n\n/** Gets the status of an entry identified by a transaction id. */\nexport interface GetTransactionStatusdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ConfidentialLedgerError;\n}\n\n/** A sub-ledger id may optionally be specified. */\nexport interface GetCurrentLedgerEntry200Response extends HttpResponse {\n status: \"200\";\n body: LedgerEntry;\n}\n\n/** A sub-ledger id may optionally be specified. */\nexport interface GetCurrentLedgerEntrydefaultResponse extends HttpResponse {\n status: \"500\";\n body: ConfidentialLedgerError;\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: \"500\";\n body: ConfidentialLedgerError;\n}\n\n/** Gets a user. */\nexport interface GetUser200Response extends HttpResponse {\n status: \"200\";\n body: LedgerUser;\n}\n\n/** Gets a user. */\nexport interface GetUserdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ConfidentialLedgerError;\n}\n\n/** A JSON merge patch is applied for existing users */\nexport interface CreateOrUpdateUser200Response extends HttpResponse {\n status: \"200\";\n body: LedgerUser;\n}\n\n/** A JSON merge patch is applied for existing users */\nexport interface CreateOrUpdateUserdefaultResponse extends HttpResponse {\n status: \"500\";\n body: ConfidentialLedgerError;\n}\n"]}
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 CollectionsOutput,\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 GetConsortiumMembers200Response extends HttpResponse {\n status: \"200\";\n body: ConsortiumOutput;\n}\n\n/** Consortium members can manage the Confidential Ledger. */\nexport interface GetConsortiumMembersdefaultResponse 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: CollectionsOutput;\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 PostLedgerEntry200Headers {\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 PostLedgerEntry200Response extends HttpResponse {\n status: \"200\";\n body: LedgerWriteResultOutput;\n headers: RawHttpHeaders & PostLedgerEntry200Headers;\n}\n\n/** A collection id may optionally be specified. */\nexport interface PostLedgerEntrydefaultResponse 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 body: Record<string, unknown>;\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"]}
@@ -1,15 +1,19 @@
1
1
  // Copyright (c) Microsoft Corporation.
2
2
  // Licensed under the MIT license.
3
3
  import { getClient } from "@azure-rest/core-client";
4
- export async function getLedgerIdentity(ledgerId, identityServiceBaseUrl = "https://identity.accledger.azure.com") {
4
+ export async function getLedgerIdentity(ledgerId, identityServiceBaseUrl = "https://identity.confidential-ledger.core.azure.com") {
5
5
  const client = getClient(identityServiceBaseUrl);
6
6
  const cert = await client.pathUnchecked("/ledgerIdentity/{ledgerId}", ledgerId).get();
7
- if (!isLedgerIdentity(cert.body)) {
8
- throw new Error("Body received from Confidential Ledger Identity is invalid. It must contain ledgerId and ledgerTlsCertificate");
7
+ const updatedCert = {
8
+ ledgerIdentityCertificate: cert.body["ledgerTlsCertificate"],
9
+ ledgerId: cert.body["ledgerId"],
10
+ };
11
+ if (!isLedgerIdentity(updatedCert)) {
12
+ throw new Error("Body received from Confidential Ledger Identity is invalid. It must contain ledgerId and ledgerIdentityCertificate");
9
13
  }
10
- return cert.body;
14
+ return updatedCert;
11
15
  }
12
16
  function isLedgerIdentity(identity) {
13
- return identity.ledgerTlsCertificate && identity.ledgerId;
17
+ return identity.ledgerIdentityCertificate && identity.ledgerId;
14
18
  }
15
19
  //# sourceMappingURL=getLedgerIdentity.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getLedgerIdentity.js","sourceRoot":"","sources":["../../src/getLedgerIdentity.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAOpD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,QAAgB,EAChB,yBAAiC,sCAAsC;IAEvE,MAAM,MAAM,GAAG,SAAS,CAAC,sBAAsB,CAAC,CAAC;IAEjD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,4BAA4B,EAAE,QAAQ,CAAC,CAAC,GAAG,EAAE,CAAC;IAEtF,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;QAChC,MAAM,IAAI,KAAK,CACb,+GAA+G,CAChH,CAAC;KACH;IAED,OAAO,IAAI,CAAC,IAAI,CAAC;AACnB,CAAC;AAED,SAAS,gBAAgB,CAAC,QAAa;IACrC,OAAO,QAAQ,CAAC,oBAAoB,IAAI,QAAQ,CAAC,QAAQ,CAAC;AAC5D,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 ledgerTlsCertificate: string;\n ledgerId: string;\n}\n\nexport async function getLedgerIdentity(\n ledgerId: string,\n identityServiceBaseUrl: string = \"https://identity.accledger.azure.com\"\n): Promise<LedgerIdentity> {\n const client = getClient(identityServiceBaseUrl);\n\n const cert = await client.pathUnchecked(\"/ledgerIdentity/{ledgerId}\", ledgerId).get();\n\n if (!isLedgerIdentity(cert.body)) {\n throw new Error(\n \"Body received from Confidential Ledger Identity is invalid. It must contain ledgerId and ledgerTlsCertificate\"\n );\n }\n\n return cert.body;\n}\n\nfunction isLedgerIdentity(identity: any): identity is LedgerIdentity {\n return identity.ledgerTlsCertificate && identity.ledgerId;\n}\n"]}
1
+ {"version":3,"file":"getLedgerIdentity.js","sourceRoot":"","sources":["../../src/getLedgerIdentity.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAOpD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,QAAgB,EAChB,yBAAiC,qDAAqD;IAEtF,MAAM,MAAM,GAAG,SAAS,CAAC,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;QAClC,MAAM,IAAI,KAAK,CACb,oHAAoH,CACrH,CAAC;KACH;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"]}
@@ -5,6 +5,10 @@ export * from "./generated/src/confidentialLedger";
5
5
  export * from "./generated/src/models";
6
6
  export * from "./generated/src/parameters";
7
7
  export * from "./generated/src/responses";
8
+ export * from "./generated/src/clientDefinitions";
9
+ export * from "./generated/src/isUnexpected";
10
+ export * from "./generated/src/outputModels";
11
+ export * from "./generated/src/paginateHelper";
8
12
  export { getLedgerIdentity } from "./getLedgerIdentity";
9
13
  export default ConfidentialLedger;
10
14
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,cAAc,oCAAoC,CAAC;AACnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAkB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxE,eAAe,kBAAkB,CAAC","sourcesContent":["// 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 { LedgerIdentity, getLedgerIdentity } from \"./getLedgerIdentity\";\nexport default ConfidentialLedger;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,OAAO,kBAAkB,MAAM,sBAAsB,CAAC;AACtD,cAAc,oCAAoC,CAAC;AACnD,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mCAAmC,CAAC;AAClD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,OAAO,EAAkB,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxE,eAAe,kBAAkB,CAAC","sourcesContent":["// 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"]}
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.0-alpha.20220518.1",
6
+ "version": "1.0.0-alpha.20220712.1",
7
7
  "keywords": [
8
8
  "node",
9
9
  "azure",
@@ -37,7 +37,7 @@
37
37
  ]
38
38
  },
39
39
  "engines": {
40
- "node": ">=14.0.0"
40
+ "node": ">=12.0.0"
41
41
  },
42
42
  "//sampleConfiguration": {
43
43
  "productName": "Azure Confidential Ledger rest",
@@ -84,18 +84,20 @@
84
84
  "sideEffects": false,
85
85
  "autoPublish": false,
86
86
  "dependencies": {
87
- "@azure/core-auth": "^1.3.0",
88
87
  "@azure-rest/core-client": ">=1.0.0-alpha <1.0.0-alphb",
88
+ "@azure/core-auth": "^1.3.0",
89
+ "@azure/core-paging": "^1.3.0",
89
90
  "@azure/core-rest-pipeline": "^1.1.0",
90
91
  "@azure/logger": "^1.0.0",
92
+ "autorest": "^3.6.1",
91
93
  "tslib": "^2.2.0"
92
94
  },
93
95
  "devDependencies": {
96
+ "@azure-tools/test-recorder": "^1.0.0",
94
97
  "@azure/dev-tool": ">=1.0.0-alpha <1.0.0-alphb",
95
98
  "@azure/eslint-plugin-azure-sdk": ">=3.0.0-alpha <3.0.0-alphb",
96
99
  "@azure/identity": "^2.0.1",
97
100
  "@azure/test-utils": ">=1.0.0-alpha <1.0.0-alphb",
98
- "@azure-tools/test-recorder": "^1.0.0",
99
101
  "@microsoft/api-extractor": "7.18.11",
100
102
  "@types/chai": "^4.1.6",
101
103
  "@types/mocha": "^7.0.2",
@@ -103,7 +105,8 @@
103
105
  "chai": "^4.2.0",
104
106
  "cross-env": "^7.0.2",
105
107
  "dotenv": "^8.2.0",
106
- "eslint": "^7.15.0",
108
+ "eslint": "^8.0.0",
109
+ "karma": "^6.2.0",
107
110
  "karma-chrome-launcher": "^3.0.0",
108
111
  "karma-coverage": "^2.0.0",
109
112
  "karma-edge-launcher": "^0.4.2",
@@ -113,13 +116,12 @@
113
116
  "karma-json-preprocessor": "^0.3.3",
114
117
  "karma-json-to-file-reporter": "^1.0.1",
115
118
  "karma-junit-reporter": "^2.0.1",
116
- "karma-mocha-reporter": "^2.2.5",
117
119
  "karma-mocha": "^2.0.1",
120
+ "karma-mocha-reporter": "^2.2.5",
118
121
  "karma-source-map-support": "~1.4.0",
119
122
  "karma-sourcemap-loader": "^0.3.8",
120
- "karma": "^6.2.0",
121
- "mocha-junit-reporter": "^2.0.0",
122
123
  "mocha": "^7.1.1",
124
+ "mocha-junit-reporter": "^2.0.0",
123
125
  "nyc": "^15.0.0",
124
126
  "prettier": "^2.5.1",
125
127
  "rimraf": "^3.0.0",