@azure-rest/confidential-ledger 1.1.2-beta.2 → 1.1.2-beta.3
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/clientDefinitions.d.ts +10 -10
- package/dist/commonjs/clientDefinitions.d.ts.map +1 -1
- package/dist/commonjs/clientDefinitions.js.map +1 -1
- package/dist/commonjs/confidentialLedger.d.ts +2 -2
- package/dist/commonjs/confidentialLedger.d.ts.map +1 -1
- package/dist/commonjs/confidentialLedger.js +5 -5
- package/dist/commonjs/confidentialLedger.js.map +1 -1
- package/dist/commonjs/isUnexpected.d.ts +19 -1
- package/dist/commonjs/isUnexpected.d.ts.map +1 -1
- package/dist/commonjs/isUnexpected.js +18 -0
- package/dist/commonjs/isUnexpected.js.map +1 -1
- package/dist/commonjs/models.d.ts +31 -31
- package/dist/commonjs/models.d.ts.map +1 -1
- package/dist/commonjs/models.js.map +1 -1
- package/dist/commonjs/outputModels.d.ts +25 -25
- package/dist/commonjs/outputModels.d.ts.map +1 -1
- package/dist/commonjs/outputModels.js.map +1 -1
- package/dist/commonjs/paginateHelper.d.ts +4 -0
- package/dist/commonjs/paginateHelper.d.ts.map +1 -1
- package/dist/commonjs/paginateHelper.js +8 -1
- package/dist/commonjs/paginateHelper.js.map +1 -1
- package/dist/commonjs/parameters.d.ts +44 -40
- package/dist/commonjs/parameters.d.ts.map +1 -1
- package/dist/commonjs/parameters.js.map +1 -1
- package/dist/commonjs/responses.d.ts +36 -36
- package/dist/commonjs/responses.d.ts.map +1 -1
- package/dist/commonjs/responses.js.map +1 -1
- package/dist/commonjs/tsdoc-metadata.json +1 -1
- package/dist/esm/clientDefinitions.d.ts +10 -10
- package/dist/esm/clientDefinitions.d.ts.map +1 -1
- package/dist/esm/clientDefinitions.js.map +1 -1
- package/dist/esm/confidentialLedger.d.ts +2 -2
- package/dist/esm/confidentialLedger.d.ts.map +1 -1
- package/dist/esm/confidentialLedger.js +5 -5
- package/dist/esm/confidentialLedger.js.map +1 -1
- package/dist/esm/isUnexpected.d.ts +19 -1
- package/dist/esm/isUnexpected.d.ts.map +1 -1
- package/dist/esm/isUnexpected.js +18 -0
- package/dist/esm/isUnexpected.js.map +1 -1
- package/dist/esm/models.d.ts +31 -31
- package/dist/esm/models.d.ts.map +1 -1
- package/dist/esm/models.js.map +1 -1
- package/dist/esm/outputModels.d.ts +25 -25
- package/dist/esm/outputModels.d.ts.map +1 -1
- package/dist/esm/outputModels.js.map +1 -1
- package/dist/esm/paginateHelper.d.ts +4 -0
- package/dist/esm/paginateHelper.d.ts.map +1 -1
- package/dist/esm/paginateHelper.js +8 -1
- package/dist/esm/paginateHelper.js.map +1 -1
- package/dist/esm/parameters.d.ts +44 -40
- package/dist/esm/parameters.d.ts.map +1 -1
- package/dist/esm/parameters.js.map +1 -1
- package/dist/esm/responses.d.ts +36 -36
- package/dist/esm/responses.d.ts.map +1 -1
- package/dist/esm/responses.js.map +1 -1
- package/package.json +9 -17
- package/CHANGELOG.md +0 -28
- package/dist/commonjs/generated/clientDefinitions.d.ts +0 -153
- package/dist/commonjs/generated/clientDefinitions.d.ts.map +0 -1
- package/dist/commonjs/generated/clientDefinitions.js +0 -5
- package/dist/commonjs/generated/clientDefinitions.js.map +0 -1
- package/dist/commonjs/generated/confidentialLedger.d.ts +0 -16
- package/dist/commonjs/generated/confidentialLedger.d.ts.map +0 -1
- package/dist/commonjs/generated/confidentialLedger.js +0 -48
- package/dist/commonjs/generated/confidentialLedger.js.map +0 -1
- package/dist/commonjs/generated/index.d.ts +0 -11
- package/dist/commonjs/generated/index.d.ts.map +0 -1
- package/dist/commonjs/generated/index.js +0 -16
- package/dist/commonjs/generated/index.js.map +0 -1
- package/dist/commonjs/generated/isUnexpected.d.ts +0 -34
- package/dist/commonjs/generated/isUnexpected.d.ts.map +0 -1
- package/dist/commonjs/generated/isUnexpected.js +0 -105
- package/dist/commonjs/generated/isUnexpected.js.map +0 -1
- package/dist/commonjs/generated/logger.d.ts +0 -2
- package/dist/commonjs/generated/logger.d.ts.map +0 -1
- package/dist/commonjs/generated/logger.js +0 -8
- package/dist/commonjs/generated/logger.js.map +0 -1
- package/dist/commonjs/generated/models.d.ts +0 -87
- package/dist/commonjs/generated/models.d.ts.map +0 -1
- package/dist/commonjs/generated/models.js +0 -5
- package/dist/commonjs/generated/models.js.map +0 -1
- package/dist/commonjs/generated/outputModels.d.ts +0 -280
- package/dist/commonjs/generated/outputModels.d.ts.map +0 -1
- package/dist/commonjs/generated/outputModels.js +0 -5
- package/dist/commonjs/generated/outputModels.js.map +0 -1
- package/dist/commonjs/generated/paginateHelper.d.ts +0 -88
- package/dist/commonjs/generated/paginateHelper.d.ts.map +0 -1
- package/dist/commonjs/generated/paginateHelper.js +0 -223
- package/dist/commonjs/generated/paginateHelper.js.map +0 -1
- package/dist/commonjs/generated/parameters.d.ts +0 -168
- package/dist/commonjs/generated/parameters.d.ts.map +0 -1
- package/dist/commonjs/generated/parameters.js +0 -5
- package/dist/commonjs/generated/parameters.js.map +0 -1
- package/dist/commonjs/generated/responses.d.ts +0 -337
- package/dist/commonjs/generated/responses.d.ts.map +0 -1
- package/dist/commonjs/generated/responses.js +0 -5
- package/dist/commonjs/generated/responses.js.map +0 -1
- package/dist/esm/generated/clientDefinitions.d.ts +0 -153
- package/dist/esm/generated/clientDefinitions.d.ts.map +0 -1
- package/dist/esm/generated/clientDefinitions.js +0 -4
- package/dist/esm/generated/clientDefinitions.js.map +0 -1
- package/dist/esm/generated/confidentialLedger.d.ts +0 -16
- package/dist/esm/generated/confidentialLedger.d.ts.map +0 -1
- package/dist/esm/generated/confidentialLedger.js +0 -45
- package/dist/esm/generated/confidentialLedger.js.map +0 -1
- package/dist/esm/generated/index.d.ts +0 -11
- package/dist/esm/generated/index.d.ts.map +0 -1
- package/dist/esm/generated/index.js +0 -13
- package/dist/esm/generated/index.js.map +0 -1
- package/dist/esm/generated/isUnexpected.d.ts +0 -34
- package/dist/esm/generated/isUnexpected.d.ts.map +0 -1
- package/dist/esm/generated/isUnexpected.js +0 -102
- package/dist/esm/generated/isUnexpected.js.map +0 -1
- package/dist/esm/generated/logger.d.ts +0 -2
- package/dist/esm/generated/logger.d.ts.map +0 -1
- package/dist/esm/generated/logger.js +0 -5
- package/dist/esm/generated/logger.js.map +0 -1
- package/dist/esm/generated/models.d.ts +0 -87
- package/dist/esm/generated/models.d.ts.map +0 -1
- package/dist/esm/generated/models.js +0 -4
- package/dist/esm/generated/models.js.map +0 -1
- package/dist/esm/generated/outputModels.d.ts +0 -280
- package/dist/esm/generated/outputModels.d.ts.map +0 -1
- package/dist/esm/generated/outputModels.js +0 -4
- package/dist/esm/generated/outputModels.js.map +0 -1
- package/dist/esm/generated/paginateHelper.d.ts +0 -88
- package/dist/esm/generated/paginateHelper.d.ts.map +0 -1
- package/dist/esm/generated/paginateHelper.js +0 -220
- package/dist/esm/generated/paginateHelper.js.map +0 -1
- package/dist/esm/generated/parameters.d.ts +0 -168
- package/dist/esm/generated/parameters.d.ts.map +0 -1
- package/dist/esm/generated/parameters.js +0 -4
- package/dist/esm/generated/parameters.js.map +0 -1
- package/dist/esm/generated/responses.d.ts +0 -337
- package/dist/esm/generated/responses.d.ts.map +0 -1
- package/dist/esm/generated/responses.js +0 -4
- package/dist/esm/generated/responses.js.map +0 -1
- package/review/confidential-ledger.api.md +0 -1494
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isUnexpected.js","sourceRoot":"","sources":["../../src/isUnexpected.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAiClC,MAAM,WAAW,GAA6B;IAC5C,kCAAkC,EAAE,CAAC,KAAK,CAAC;IAC3C,6BAA6B,EAAE,CAAC,KAAK,CAAC;IACtC,wBAAwB,EAAE,CAAC,KAAK,CAAC;IACjC,sBAAsB,EAAE,CAAC,KAAK,CAAC;IAC/B,uBAAuB,EAAE,CAAC,KAAK,CAAC;IAChC,wBAAwB,EAAE,CAAC,KAAK,CAAC;IACjC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R,CAAC;gBACD,SAAS;YACX,CAAC;YAED,8CAA8C;YAC9C,wDAAwD;YACxD,2CAA2C;YAC3C,IAAI,cAAc,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;gBACvC,KAAK,GAAG,KAAK,CAAC;gBACd,MAAM;YACR,CAAC;QACH,CAAC;QAED,qDAAqD;QACrD,sEAAsE;QACtE,IAAI,KAAK,IAAI,aAAa,CAAC,MAAM,GAAG,UAAU,EAAE,CAAC;YAC/C,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC;YAClC,YAAY,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n GetConstitution200Response,\n GetConstitutionDefaultResponse,\n ListConsortiumMembers200Response,\n ListConsortiumMembersDefaultResponse,\n GetEnclaveQuotes200Response,\n GetEnclaveQuotesDefaultResponse,\n ListCollections200Response,\n ListCollectionsDefaultResponse,\n ListLedgerEntries200Response,\n ListLedgerEntriesDefaultResponse,\n CreateLedgerEntry200Response,\n CreateLedgerEntryDefaultResponse,\n GetLedgerEntry200Response,\n GetLedgerEntryDefaultResponse,\n GetReceipt200Response,\n GetReceiptDefaultResponse,\n GetTransactionStatus200Response,\n GetTransactionStatusDefaultResponse,\n GetCurrentLedgerEntry200Response,\n GetCurrentLedgerEntryDefaultResponse,\n ListUsers200Response,\n ListUsersDefaultResponse,\n DeleteUser204Response,\n DeleteUserDefaultResponse,\n GetUser200Response,\n GetUserDefaultResponse,\n CreateOrUpdateUser200Response,\n CreateOrUpdateUserDefaultResponse,\n} from \"./responses.js\";\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 \"GET /app/users\": [\"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: ListConsortiumMembers200Response | ListConsortiumMembersDefaultResponse,\n): response is ListConsortiumMembersDefaultResponse;\nexport function isUnexpected(\n response: GetEnclaveQuotes200Response | GetEnclaveQuotesDefaultResponse,\n): response is GetEnclaveQuotesDefaultResponse;\nexport function isUnexpected(\n response: ListCollections200Response | ListCollectionsDefaultResponse,\n): response is ListCollectionsDefaultResponse;\nexport function isUnexpected(\n response: ListLedgerEntries200Response | ListLedgerEntriesDefaultResponse,\n): response is ListLedgerEntriesDefaultResponse;\nexport function isUnexpected(\n response: CreateLedgerEntry200Response | CreateLedgerEntryDefaultResponse,\n): response is CreateLedgerEntryDefaultResponse;\nexport function isUnexpected(\n response: GetLedgerEntry200Response | GetLedgerEntryDefaultResponse,\n): response is GetLedgerEntryDefaultResponse;\nexport function isUnexpected(\n response: GetReceipt200Response | GetReceiptDefaultResponse,\n): response is GetReceiptDefaultResponse;\nexport function isUnexpected(\n response: GetTransactionStatus200Response | GetTransactionStatusDefaultResponse,\n): response is GetTransactionStatusDefaultResponse;\nexport function isUnexpected(\n response: GetCurrentLedgerEntry200Response | GetCurrentLedgerEntryDefaultResponse,\n): response is GetCurrentLedgerEntryDefaultResponse;\nexport function isUnexpected(\n response: ListUsers200Response | ListUsersDefaultResponse,\n): response is ListUsersDefaultResponse;\nexport function isUnexpected(\n response: DeleteUser204Response | DeleteUserDefaultResponse,\n): response is DeleteUserDefaultResponse;\nexport function isUnexpected(\n response: GetUser200Response | GetUserDefaultResponse,\n): response is GetUserDefaultResponse;\nexport function isUnexpected(\n response: CreateOrUpdateUser200Response | CreateOrUpdateUserDefaultResponse,\n): response is CreateOrUpdateUserDefaultResponse;\nexport function isUnexpected(\n response:\n | GetConstitution200Response\n | GetConstitutionDefaultResponse\n | ListConsortiumMembers200Response\n | ListConsortiumMembersDefaultResponse\n | GetEnclaveQuotes200Response\n | GetEnclaveQuotesDefaultResponse\n | ListCollections200Response\n | ListCollectionsDefaultResponse\n | ListLedgerEntries200Response\n | ListLedgerEntriesDefaultResponse\n | CreateLedgerEntry200Response\n | CreateLedgerEntryDefaultResponse\n | GetLedgerEntry200Response\n | GetLedgerEntryDefaultResponse\n | GetReceipt200Response\n | GetReceiptDefaultResponse\n | GetTransactionStatus200Response\n | GetTransactionStatusDefaultResponse\n | GetCurrentLedgerEntry200Response\n | GetCurrentLedgerEntryDefaultResponse\n | ListUsers200Response\n | ListUsersDefaultResponse\n | DeleteUser204Response\n | DeleteUserDefaultResponse\n | GetUser200Response\n | GetUserDefaultResponse\n | CreateOrUpdateUser200Response\n | CreateOrUpdateUserDefaultResponse,\n): response is\n | GetConstitutionDefaultResponse\n | ListConsortiumMembersDefaultResponse\n | GetEnclaveQuotesDefaultResponse\n | ListCollectionsDefaultResponse\n | ListLedgerEntriesDefaultResponse\n | CreateLedgerEntryDefaultResponse\n | GetLedgerEntryDefaultResponse\n | GetReceiptDefaultResponse\n | GetTransactionStatusDefaultResponse\n | GetCurrentLedgerEntryDefaultResponse\n | ListUsersDefaultResponse\n | DeleteUserDefaultResponse\n | GetUserDefaultResponse\n | CreateOrUpdateUserDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\",\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"isUnexp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,KAAK,CAAC;gBACd,MAAM;YACR,CAAC;QACH,CAAC;QAED,qDAAqD;QACrD,sEAAsE;QACtE,IAAI,KAAK,IAAI,aAAa,CAAC,MAAM,GAAG,UAAU,EAAE,CAAC;YAC/C,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC;YAClC,YAAY,GAAG,KAAK,CAAC;QACvB,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,iBAAiB,CAAC,MAAc;IACvC,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n GetConstitution200Response,\n GetConstitutionDefaultResponse,\n ListConsortiumMembers200Response,\n ListConsortiumMembersDefaultResponse,\n GetEnclaveQuotes200Response,\n GetEnclaveQuotesDefaultResponse,\n ListCollections200Response,\n ListCollectionsDefaultResponse,\n ListLedgerEntries200Response,\n ListLedgerEntriesDefaultResponse,\n CreateLedgerEntry200Response,\n CreateLedgerEntryDefaultResponse,\n GetLedgerEntry200Response,\n GetLedgerEntryDefaultResponse,\n GetReceipt200Response,\n GetReceiptDefaultResponse,\n GetTransactionStatus200Response,\n GetTransactionStatusDefaultResponse,\n GetCurrentLedgerEntry200Response,\n GetCurrentLedgerEntryDefaultResponse,\n ListUsers200Response,\n ListUsersDefaultResponse,\n ListLedgerUsers200Response,\n ListLedgerUsersDefaultResponse,\n DeleteUser204Response,\n DeleteUserDefaultResponse,\n GetUser200Response,\n GetUserDefaultResponse,\n CreateOrUpdateUser200Response,\n CreateOrUpdateUserDefaultResponse,\n DeleteLedgerUser204Response,\n DeleteLedgerUserDefaultResponse,\n GetLedgerUser200Response,\n GetLedgerUserDefaultResponse,\n CreateOrUpdateLedgerUser200Response,\n CreateOrUpdateLedgerUserDefaultResponse,\n GetUserDefinedEndpoint200Response,\n GetUserDefinedEndpointDefaultResponse,\n CreateUserDefinedEndpoint201Response,\n CreateUserDefinedEndpointDefaultResponse,\n GetRuntimeOptions200Response,\n GetRuntimeOptionsDefaultResponse,\n UpdateRuntimeOptions200Response,\n UpdateRuntimeOptionsDefaultResponse,\n GetUserDefinedEndpointsModule200Response,\n GetUserDefinedEndpointsModuleDefaultResponse,\n ListUserDefinedFunctions200Response,\n ListUserDefinedFunctionsDefaultResponse,\n DeleteUserDefinedFunction204Response,\n DeleteUserDefinedFunctionDefaultResponse,\n GetUserDefinedFunction200Response,\n GetUserDefinedFunctionDefaultResponse,\n CreateUserDefinedFunction200Response,\n CreateUserDefinedFunction201Response,\n CreateUserDefinedFunctionDefaultResponse,\n ExecuteUserDefinedFunction200Response,\n ExecuteUserDefinedFunctionDefaultResponse,\n GetUserDefinedRole200Response,\n GetUserDefinedRoleDefaultResponse,\n CreateUserDefinedRole200Response,\n CreateUserDefinedRoleDefaultResponse,\n UpdateUserDefinedRole200Response,\n UpdateUserDefinedRoleDefaultResponse,\n DeleteUserDefinedRole200Response,\n DeleteUserDefinedRoleDefaultResponse,\n} from \"./responses.js\";\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 \"GET /app/users\": [\"200\"],\n \"GET /app/ledgerUsers\": [\"200\"],\n \"DELETE /app/users/{userId}\": [\"204\"],\n \"GET /app/users/{userId}\": [\"200\"],\n \"PATCH /app/users/{userId}\": [\"200\"],\n \"DELETE /app/ledgerUsers/{userId}\": [\"204\"],\n \"GET /app/ledgerUsers/{userId}\": [\"200\"],\n \"PATCH /app/ledgerUsers/{userId}\": [\"200\"],\n \"GET /app/userDefinedEndpoints\": [\"200\"],\n \"PUT /app/userDefinedEndpoints\": [\"201\"],\n \"GET /app/userDefinedEndpoints/runtimeOptions\": [\"200\"],\n \"PATCH /app/userDefinedEndpoints/runtimeOptions\": [\"200\"],\n \"GET /app/userDefinedEndpoints/modules\": [\"200\"],\n \"GET /app/userDefinedFunctions\": [\"200\"],\n \"DELETE /app/userDefinedFunctions/{functionId}\": [\"204\"],\n \"GET /app/userDefinedFunctions/{functionId}\": [\"200\"],\n \"PUT /app/userDefinedFunctions/{functionId}\": [\"200\", \"201\"],\n \"POST /app/userDefinedFunctions/{functionId}:execute\": [\"200\"],\n \"GET /app/roles\": [\"200\"],\n \"PUT /app/roles\": [\"200\"],\n \"PATCH /app/roles\": [\"200\"],\n \"DELETE /app/roles\": [\"200\"],\n};\n\nexport function isUnexpected(\n response: GetConstitution200Response | GetConstitutionDefaultResponse,\n): response is GetConstitutionDefaultResponse;\nexport function isUnexpected(\n response: ListConsortiumMembers200Response | ListConsortiumMembersDefaultResponse,\n): response is ListConsortiumMembersDefaultResponse;\nexport function isUnexpected(\n response: GetEnclaveQuotes200Response | GetEnclaveQuotesDefaultResponse,\n): response is GetEnclaveQuotesDefaultResponse;\nexport function isUnexpected(\n response: ListCollections200Response | ListCollectionsDefaultResponse,\n): response is ListCollectionsDefaultResponse;\nexport function isUnexpected(\n response: ListLedgerEntries200Response | ListLedgerEntriesDefaultResponse,\n): response is ListLedgerEntriesDefaultResponse;\nexport function isUnexpected(\n response: CreateLedgerEntry200Response | CreateLedgerEntryDefaultResponse,\n): response is CreateLedgerEntryDefaultResponse;\nexport function isUnexpected(\n response: GetLedgerEntry200Response | GetLedgerEntryDefaultResponse,\n): response is GetLedgerEntryDefaultResponse;\nexport function isUnexpected(\n response: GetReceipt200Response | GetReceiptDefaultResponse,\n): response is GetReceiptDefaultResponse;\nexport function isUnexpected(\n response: GetTransactionStatus200Response | GetTransactionStatusDefaultResponse,\n): response is GetTransactionStatusDefaultResponse;\nexport function isUnexpected(\n response: GetCurrentLedgerEntry200Response | GetCurrentLedgerEntryDefaultResponse,\n): response is GetCurrentLedgerEntryDefaultResponse;\nexport function isUnexpected(\n response: ListUsers200Response | ListUsersDefaultResponse,\n): response is ListUsersDefaultResponse;\nexport function isUnexpected(\n response: ListLedgerUsers200Response | ListLedgerUsersDefaultResponse,\n): response is ListLedgerUsersDefaultResponse;\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: DeleteLedgerUser204Response | DeleteLedgerUserDefaultResponse,\n): response is DeleteLedgerUserDefaultResponse;\nexport function isUnexpected(\n response: GetLedgerUser200Response | GetLedgerUserDefaultResponse,\n): response is GetLedgerUserDefaultResponse;\nexport function isUnexpected(\n response: CreateOrUpdateLedgerUser200Response | CreateOrUpdateLedgerUserDefaultResponse,\n): response is CreateOrUpdateLedgerUserDefaultResponse;\nexport function isUnexpected(\n response: GetUserDefinedEndpoint200Response | GetUserDefinedEndpointDefaultResponse,\n): response is GetUserDefinedEndpointDefaultResponse;\nexport function isUnexpected(\n response: CreateUserDefinedEndpoint201Response | CreateUserDefinedEndpointDefaultResponse,\n): response is CreateUserDefinedEndpointDefaultResponse;\nexport function isUnexpected(\n response: GetRuntimeOptions200Response | GetRuntimeOptionsDefaultResponse,\n): response is GetRuntimeOptionsDefaultResponse;\nexport function isUnexpected(\n response: UpdateRuntimeOptions200Response | UpdateRuntimeOptionsDefaultResponse,\n): response is UpdateRuntimeOptionsDefaultResponse;\nexport function isUnexpected(\n response: GetUserDefinedEndpointsModule200Response | GetUserDefinedEndpointsModuleDefaultResponse,\n): response is GetUserDefinedEndpointsModuleDefaultResponse;\nexport function isUnexpected(\n response: ListUserDefinedFunctions200Response | ListUserDefinedFunctionsDefaultResponse,\n): response is ListUserDefinedFunctionsDefaultResponse;\nexport function isUnexpected(\n response: DeleteUserDefinedFunction204Response | DeleteUserDefinedFunctionDefaultResponse,\n): response is DeleteUserDefinedFunctionDefaultResponse;\nexport function isUnexpected(\n response: GetUserDefinedFunction200Response | GetUserDefinedFunctionDefaultResponse,\n): response is GetUserDefinedFunctionDefaultResponse;\nexport function isUnexpected(\n response:\n | CreateUserDefinedFunction200Response\n | CreateUserDefinedFunction201Response\n | CreateUserDefinedFunctionDefaultResponse,\n): response is CreateUserDefinedFunctionDefaultResponse;\nexport function isUnexpected(\n response: ExecuteUserDefinedFunction200Response | ExecuteUserDefinedFunctionDefaultResponse,\n): response is ExecuteUserDefinedFunctionDefaultResponse;\nexport function isUnexpected(\n response: GetUserDefinedRole200Response | GetUserDefinedRoleDefaultResponse,\n): response is GetUserDefinedRoleDefaultResponse;\nexport function isUnexpected(\n response: CreateUserDefinedRole200Response | CreateUserDefinedRoleDefaultResponse,\n): response is CreateUserDefinedRoleDefaultResponse;\nexport function isUnexpected(\n response: UpdateUserDefinedRole200Response | UpdateUserDefinedRoleDefaultResponse,\n): response is UpdateUserDefinedRoleDefaultResponse;\nexport function isUnexpected(\n response: DeleteUserDefinedRole200Response | DeleteUserDefinedRoleDefaultResponse,\n): response is DeleteUserDefinedRoleDefaultResponse;\nexport function isUnexpected(\n response:\n | GetConstitution200Response\n | GetConstitutionDefaultResponse\n | ListConsortiumMembers200Response\n | ListConsortiumMembersDefaultResponse\n | GetEnclaveQuotes200Response\n | GetEnclaveQuotesDefaultResponse\n | ListCollections200Response\n | ListCollectionsDefaultResponse\n | ListLedgerEntries200Response\n | ListLedgerEntriesDefaultResponse\n | CreateLedgerEntry200Response\n | CreateLedgerEntryDefaultResponse\n | GetLedgerEntry200Response\n | GetLedgerEntryDefaultResponse\n | GetReceipt200Response\n | GetReceiptDefaultResponse\n | GetTransactionStatus200Response\n | GetTransactionStatusDefaultResponse\n | GetCurrentLedgerEntry200Response\n | GetCurrentLedgerEntryDefaultResponse\n | ListUsers200Response\n | ListUsersDefaultResponse\n | ListLedgerUsers200Response\n | ListLedgerUsersDefaultResponse\n | DeleteUser204Response\n | DeleteUserDefaultResponse\n | GetUser200Response\n | GetUserDefaultResponse\n | CreateOrUpdateUser200Response\n | CreateOrUpdateUserDefaultResponse\n | DeleteLedgerUser204Response\n | DeleteLedgerUserDefaultResponse\n | GetLedgerUser200Response\n | GetLedgerUserDefaultResponse\n | CreateOrUpdateLedgerUser200Response\n | CreateOrUpdateLedgerUserDefaultResponse\n | GetUserDefinedEndpoint200Response\n | GetUserDefinedEndpointDefaultResponse\n | CreateUserDefinedEndpoint201Response\n | CreateUserDefinedEndpointDefaultResponse\n | GetRuntimeOptions200Response\n | GetRuntimeOptionsDefaultResponse\n | UpdateRuntimeOptions200Response\n | UpdateRuntimeOptionsDefaultResponse\n | GetUserDefinedEndpointsModule200Response\n | GetUserDefinedEndpointsModuleDefaultResponse\n | ListUserDefinedFunctions200Response\n | ListUserDefinedFunctionsDefaultResponse\n | DeleteUserDefinedFunction204Response\n | DeleteUserDefinedFunctionDefaultResponse\n | GetUserDefinedFunction200Response\n | GetUserDefinedFunctionDefaultResponse\n | CreateUserDefinedFunction200Response\n | CreateUserDefinedFunction201Response\n | CreateUserDefinedFunctionDefaultResponse\n | ExecuteUserDefinedFunction200Response\n | ExecuteUserDefinedFunctionDefaultResponse\n | GetUserDefinedRole200Response\n | GetUserDefinedRoleDefaultResponse\n | CreateUserDefinedRole200Response\n | CreateUserDefinedRoleDefaultResponse\n | UpdateUserDefinedRole200Response\n | UpdateUserDefinedRoleDefaultResponse\n | DeleteUserDefinedRole200Response\n | DeleteUserDefinedRoleDefaultResponse,\n): response is\n | GetConstitutionDefaultResponse\n | ListConsortiumMembersDefaultResponse\n | GetEnclaveQuotesDefaultResponse\n | ListCollectionsDefaultResponse\n | ListLedgerEntriesDefaultResponse\n | CreateLedgerEntryDefaultResponse\n | GetLedgerEntryDefaultResponse\n | GetReceiptDefaultResponse\n | GetTransactionStatusDefaultResponse\n | GetCurrentLedgerEntryDefaultResponse\n | ListUsersDefaultResponse\n | ListLedgerUsersDefaultResponse\n | DeleteUserDefaultResponse\n | GetUserDefaultResponse\n | CreateOrUpdateUserDefaultResponse\n | DeleteLedgerUserDefaultResponse\n | GetLedgerUserDefaultResponse\n | CreateOrUpdateLedgerUserDefaultResponse\n | GetUserDefinedEndpointDefaultResponse\n | CreateUserDefinedEndpointDefaultResponse\n | GetRuntimeOptionsDefaultResponse\n | UpdateRuntimeOptionsDefaultResponse\n | GetUserDefinedEndpointsModuleDefaultResponse\n | ListUserDefinedFunctionsDefaultResponse\n | DeleteUserDefinedFunctionDefaultResponse\n | GetUserDefinedFunctionDefaultResponse\n | CreateUserDefinedFunctionDefaultResponse\n | ExecuteUserDefinedFunctionDefaultResponse\n | GetUserDefinedRoleDefaultResponse\n | CreateUserDefinedRoleDefaultResponse\n | UpdateUserDefinedRoleDefaultResponse\n | DeleteUserDefinedRoleDefaultResponse {\n const lroOriginal = response.headers[\"x-ms-original-url\"];\n const url = new URL(lroOriginal ?? response.request.url);\n const method = response.request.method;\n let pathDetails = responseMap[`${method} ${url.pathname}`];\n if (!pathDetails) {\n pathDetails = getParametrizedPathSuccess(method, url.pathname);\n }\n return !pathDetails.includes(response.status);\n}\n\nfunction getParametrizedPathSuccess(method: string, path: string): string[] {\n const pathParts = path.split(\"/\");\n\n // Traverse list to match the longest candidate\n // matchedLen: the length of candidate path\n // matchedValue: the matched status code array\n let matchedLen = -1,\n matchedValue: string[] = [];\n\n // Iterate the responseMap to find a match\n for (const [key, value] of Object.entries(responseMap)) {\n // Extracting the path from the map key which is in format\n // GET /path/foo\n if (!key.startsWith(method)) {\n continue;\n }\n const candidatePath = getPathFromMapKey(key);\n // Get each part of the url path\n const candidateParts = candidatePath.split(\"/\");\n\n // track if we have found a match to return the values found.\n let found = true;\n for (let i = candidateParts.length - 1, j = pathParts.length - 1; i >= 1 && j >= 1; i--, j--) {\n if (candidateParts[i]?.startsWith(\"{\") && candidateParts[i]?.indexOf(\"}\") !== -1) {\n const start = candidateParts[i]!.indexOf(\"}\") + 1,\n end = candidateParts[i]?.length;\n // If the current part of the candidate is a \"template\" part\n // Try to use the suffix of pattern to match the path\n // {guid} ==> $\n // {guid}:export ==> :export$\n const isMatched = new RegExp(`${candidateParts[i]?.slice(start, end)}`).test(\n pathParts[j] || \"\",\n );\n\n if (!isMatched) {\n found = false;\n break;\n }\n continue;\n }\n\n // If the candidate part is not a template and\n // the parts don't match mark the candidate as not found\n // to move on with the next candidate path.\n if (candidateParts[i] !== pathParts[j]) {\n found = false;\n break;\n }\n }\n\n // We finished evaluating the current candidate parts\n // Update the matched value if and only if we found the longer pattern\n if (found && candidatePath.length > matchedLen) {\n matchedLen = candidatePath.length;\n matchedValue = value;\n }\n }\n\n return matchedValue;\n}\n\nfunction getPathFromMapKey(mapKey: string): string {\n const pathStart = mapKey.indexOf(\"/\");\n return mapKey.slice(pathStart);\n}\n"]}
|
package/dist/esm/models.d.ts
CHANGED
|
@@ -14,6 +14,24 @@ export interface UserDefinedFunctionHook {
|
|
|
14
14
|
/** The properties for executing a user defined function. */
|
|
15
15
|
properties?: UserDefinedFunctionExecutionProperties;
|
|
16
16
|
}
|
|
17
|
+
/** The properties for executing a user defined function. */
|
|
18
|
+
export interface UserDefinedFunctionExecutionProperties {
|
|
19
|
+
/** Runtime arguments of the user defined function. Defaults to an empty list. */
|
|
20
|
+
arguments?: Array<string>;
|
|
21
|
+
/** Name of the exported function to execute in the code of the user defined function. Defaults to main. */
|
|
22
|
+
exportedFunctionName?: string;
|
|
23
|
+
/** JS runtime options for user defined endpoints and functions */
|
|
24
|
+
runtimeOptions?: JSRuntimeOptions;
|
|
25
|
+
}
|
|
26
|
+
/** JS runtime options for user defined endpoints and functions */
|
|
27
|
+
export interface JSRuntimeOptions {
|
|
28
|
+
log_exception_details?: boolean;
|
|
29
|
+
max_cached_interpreters?: number;
|
|
30
|
+
max_execution_time_ms?: number;
|
|
31
|
+
max_heap_bytes?: number;
|
|
32
|
+
max_stack_bytes?: number;
|
|
33
|
+
return_exception_details?: boolean;
|
|
34
|
+
}
|
|
17
35
|
/** Details about a Confidential Ledger user. */
|
|
18
36
|
export interface LedgerUser {
|
|
19
37
|
/** Represents an assignable role. */
|
|
@@ -24,12 +42,21 @@ export interface LedgerUserMultipleRoles {
|
|
|
24
42
|
/** Represents an assignable role. */
|
|
25
43
|
assignedRoles: Array<"Administrator" | "Contributor" | "Reader">;
|
|
26
44
|
}
|
|
45
|
+
/** bundle for the user defined endpoints */
|
|
46
|
+
export interface Bundle {
|
|
47
|
+
metadata: Metadata;
|
|
48
|
+
/** Any object */
|
|
49
|
+
modules: Record<string, unknown>;
|
|
50
|
+
}
|
|
27
51
|
export interface Metadata {
|
|
28
52
|
/** A map of path to method endpoints for the path */
|
|
29
53
|
endpoints: Record<string, MethodToEndpointProperties>;
|
|
30
54
|
}
|
|
31
|
-
export interface
|
|
32
|
-
|
|
55
|
+
export interface MethodToEndpointProperties {
|
|
56
|
+
get?: EndpointProperties;
|
|
57
|
+
put?: EndpointProperties;
|
|
58
|
+
patch?: EndpointProperties;
|
|
59
|
+
delete?: EndpointProperties;
|
|
33
60
|
}
|
|
34
61
|
export interface EndpointProperties {
|
|
35
62
|
authn_policies: Array<any>;
|
|
@@ -43,41 +70,14 @@ export interface EndpointProperties {
|
|
|
43
70
|
openapi_hidden?: boolean;
|
|
44
71
|
redirection_strategy?: "none" | "to_primary" | "to_backup";
|
|
45
72
|
}
|
|
46
|
-
export interface
|
|
47
|
-
|
|
48
|
-
put?: EndpointProperties;
|
|
49
|
-
patch?: EndpointProperties;
|
|
50
|
-
delete?: EndpointProperties;
|
|
51
|
-
}
|
|
52
|
-
/** bundle for the user defined endpoints */
|
|
53
|
-
export interface Bundle {
|
|
54
|
-
metadata: Metadata;
|
|
55
|
-
/** Any object */
|
|
56
|
-
modules: Record<string, unknown>;
|
|
73
|
+
export interface InterpreterReusePolicy {
|
|
74
|
+
key: string;
|
|
57
75
|
}
|
|
58
76
|
/** A user defined function in the ledger. */
|
|
59
77
|
export interface UserDefinedFunction {
|
|
60
78
|
/** Code of the user defined function in JavaScript. */
|
|
61
79
|
code: string;
|
|
62
80
|
}
|
|
63
|
-
/** The properties for executing a user defined function. */
|
|
64
|
-
export interface UserDefinedFunctionExecutionProperties {
|
|
65
|
-
/** Runtime arguments of the user defined function. Defaults to an empty list. */
|
|
66
|
-
arguments?: Array<string>;
|
|
67
|
-
/** Name of the exported function to execute in the code of the user defined function. Defaults to main. */
|
|
68
|
-
exportedFunctionName?: string;
|
|
69
|
-
/** JS runtime options for user defined endpoints and functions */
|
|
70
|
-
runtimeOptions?: JSRuntimeOptions;
|
|
71
|
-
}
|
|
72
|
-
/** JS runtime options for user defined endpoints and functions */
|
|
73
|
-
export interface JSRuntimeOptions {
|
|
74
|
-
log_exception_details?: boolean;
|
|
75
|
-
max_cached_interpreters?: number;
|
|
76
|
-
max_execution_time_ms?: number;
|
|
77
|
-
max_heap_bytes?: number;
|
|
78
|
-
max_stack_bytes?: number;
|
|
79
|
-
return_exception_details?: boolean;
|
|
80
|
-
}
|
|
81
81
|
/** Definition for roles */
|
|
82
82
|
export interface Role {
|
|
83
83
|
/** name of the user defined role */
|
package/dist/esm/models.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAGA,8BAA8B;AAC9B,MAAM,WAAW,WAAW;IAC1B,oCAAoC;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,6FAA6F;IAC7F,QAAQ,CAAC,EAAE,KAAK,CAAC,uBAAuB,CAAC,CAAC;IAC1C,4FAA4F;IAC5F,SAAS,CAAC,EAAE,KAAK,CAAC,uBA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AAW,IAAI;IACnB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC7B"}
|
package/dist/esm/models.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/** An entry in the ledger. */\nexport interface LedgerEntry {\n /** Contents of the ledger entry. */\n contents: string;\n /** List of user defined function hooks to be executed before the ledger entry is written. */\n preHooks?: Array<UserDefinedFunctionHook>;\n /** List of user defined function hooks to be executed after the ledger entry is written. */\n postHooks?: Array<UserDefinedFunctionHook>;\n}\n\n/** Hook for a user defined function execution. */\nexport interface UserDefinedFunctionHook {\n /** ID of the user defined function to execute. */\n functionId: string;\n /** The properties for executing a user defined function. */\n properties?: UserDefinedFunctionExecutionProperties;\n}\n\n/** Details about a Confidential Ledger user. */\nexport interface LedgerUser {\n /** Represents an assignable role. */\n assignedRole: \"Administrator\" | \"Contributor\" | \"Reader\";\n}\n\n/** Details about a Confidential Ledger user. */\nexport interface LedgerUserMultipleRoles {\n /** Represents an assignable role. */\n assignedRoles: Array<\"Administrator\" | \"Contributor\" | \"Reader\">;\n}\n\nexport interface Metadata {\n /** A map of path to method endpoints for the path */\n endpoints: Record<string, MethodToEndpointProperties>;\n}\n\nexport interface
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/** An entry in the ledger. */\nexport interface LedgerEntry {\n /** Contents of the ledger entry. */\n contents: string;\n /** List of user defined function hooks to be executed before the ledger entry is written. */\n preHooks?: Array<UserDefinedFunctionHook>;\n /** List of user defined function hooks to be executed after the ledger entry is written. */\n postHooks?: Array<UserDefinedFunctionHook>;\n}\n\n/** Hook for a user defined function execution. */\nexport interface UserDefinedFunctionHook {\n /** ID of the user defined function to execute. */\n functionId: string;\n /** The properties for executing a user defined function. */\n properties?: UserDefinedFunctionExecutionProperties;\n}\n\n/** The properties for executing a user defined function. */\nexport interface UserDefinedFunctionExecutionProperties {\n /** Runtime arguments of the user defined function. Defaults to an empty list. */\n arguments?: Array<string>;\n /** Name of the exported function to execute in the code of the user defined function. Defaults to main. */\n exportedFunctionName?: string;\n /** JS runtime options for user defined endpoints and functions */\n runtimeOptions?: JSRuntimeOptions;\n}\n\n/** JS runtime options for user defined endpoints and functions */\nexport interface JSRuntimeOptions {\n log_exception_details?: boolean;\n max_cached_interpreters?: number;\n max_execution_time_ms?: number;\n max_heap_bytes?: number;\n max_stack_bytes?: number;\n return_exception_details?: boolean;\n}\n\n/** Details about a Confidential Ledger user. */\nexport interface LedgerUser {\n /** Represents an assignable role. */\n assignedRole: \"Administrator\" | \"Contributor\" | \"Reader\";\n}\n\n/** Details about a Confidential Ledger user. */\nexport interface LedgerUserMultipleRoles {\n /** Represents an assignable role. */\n assignedRoles: Array<\"Administrator\" | \"Contributor\" | \"Reader\">;\n}\n\n/** bundle for the user defined endpoints */\nexport interface Bundle {\n metadata: Metadata;\n /** Any object */\n modules: Record<string, unknown>;\n}\n\nexport interface Metadata {\n /** A map of path to method endpoints for the path */\n endpoints: Record<string, MethodToEndpointProperties>;\n}\n\nexport interface MethodToEndpointProperties {\n get?: EndpointProperties;\n put?: EndpointProperties;\n patch?: EndpointProperties;\n delete?: EndpointProperties;\n}\n\nexport interface EndpointProperties {\n authn_policies: Array<any>;\n forwarding_required: \"sometimes\" | \"always\" | \"never\";\n interpreter_reuse?: InterpreterReusePolicy;\n js_function?: string;\n js_module?: string;\n mode?: \"readwrite\" | \"readonly\" | \"historical\";\n /** Anything */\n openapi?: any;\n openapi_hidden?: boolean;\n redirection_strategy?: \"none\" | \"to_primary\" | \"to_backup\";\n}\n\nexport interface InterpreterReusePolicy {\n key: string;\n}\n\n/** A user defined function in the ledger. */\nexport interface UserDefinedFunction {\n /** Code of the user defined function in JavaScript. */\n code: string;\n}\n\n/** Definition for roles */\nexport interface Role {\n /** name of the user defined role */\n roleName?: string;\n roleActions?: Array<string>;\n}\n"]}
|
|
@@ -79,6 +79,31 @@ export interface LedgerEntryOutput {
|
|
|
79
79
|
/** List of user defined function hooks to be executed after the ledger entry is written. */
|
|
80
80
|
postHooks?: Array<UserDefinedFunctionHookOutput>;
|
|
81
81
|
}
|
|
82
|
+
/** Hook for a user defined function execution. */
|
|
83
|
+
export interface UserDefinedFunctionHookOutput {
|
|
84
|
+
/** ID of the user defined function to execute. */
|
|
85
|
+
functionId: string;
|
|
86
|
+
/** The properties for executing a user defined function. */
|
|
87
|
+
properties?: UserDefinedFunctionExecutionPropertiesOutput;
|
|
88
|
+
}
|
|
89
|
+
/** The properties for executing a user defined function. */
|
|
90
|
+
export interface UserDefinedFunctionExecutionPropertiesOutput {
|
|
91
|
+
/** Runtime arguments of the user defined function. Defaults to an empty list. */
|
|
92
|
+
arguments?: Array<string>;
|
|
93
|
+
/** Name of the exported function to execute in the code of the user defined function. Defaults to main. */
|
|
94
|
+
exportedFunctionName?: string;
|
|
95
|
+
/** JS runtime options for user defined endpoints and functions */
|
|
96
|
+
runtimeOptions?: JSRuntimeOptionsOutput;
|
|
97
|
+
}
|
|
98
|
+
/** JS runtime options for user defined endpoints and functions */
|
|
99
|
+
export interface JSRuntimeOptionsOutput {
|
|
100
|
+
log_exception_details?: boolean;
|
|
101
|
+
max_cached_interpreters?: number;
|
|
102
|
+
max_execution_time_ms?: number;
|
|
103
|
+
max_heap_bytes?: number;
|
|
104
|
+
max_stack_bytes?: number;
|
|
105
|
+
return_exception_details?: boolean;
|
|
106
|
+
}
|
|
82
107
|
/** Returned as a result of a write to the Confidential Ledger, the transaction id in the response indicates when the write will become durable. */
|
|
83
108
|
export interface LedgerWriteResultOutput {
|
|
84
109
|
collectionId: string;
|
|
@@ -214,31 +239,6 @@ export interface ModuleDefOutput {
|
|
|
214
239
|
module: string;
|
|
215
240
|
name: string;
|
|
216
241
|
}
|
|
217
|
-
/** Hook for a user defined function execution. */
|
|
218
|
-
export interface UserDefinedFunctionHookOutput {
|
|
219
|
-
/** ID of the user defined function to execute. */
|
|
220
|
-
functionId: string;
|
|
221
|
-
/** The properties for executing a user defined function. */
|
|
222
|
-
properties?: UserDefinedFunctionExecutionPropertiesOutput;
|
|
223
|
-
}
|
|
224
|
-
/** The properties for executing a user defined function. */
|
|
225
|
-
export interface UserDefinedFunctionExecutionPropertiesOutput {
|
|
226
|
-
/** Runtime arguments of the user defined function. Defaults to an empty list. */
|
|
227
|
-
arguments?: Array<string>;
|
|
228
|
-
/** Name of the exported function to execute in the code of the user defined function. Defaults to main. */
|
|
229
|
-
exportedFunctionName?: string;
|
|
230
|
-
/** JS runtime options for user defined endpoints and functions */
|
|
231
|
-
runtimeOptions?: JSRuntimeOptionsOutput;
|
|
232
|
-
}
|
|
233
|
-
/** JS runtime options for user defined endpoints and functions */
|
|
234
|
-
export interface JSRuntimeOptionsOutput {
|
|
235
|
-
log_exception_details?: boolean;
|
|
236
|
-
max_cached_interpreters?: number;
|
|
237
|
-
max_execution_time_ms?: number;
|
|
238
|
-
max_heap_bytes?: number;
|
|
239
|
-
max_stack_bytes?: number;
|
|
240
|
-
return_exception_details?: boolean;
|
|
241
|
-
}
|
|
242
242
|
/** Paginated user defined functions returned in response to a query. */
|
|
243
243
|
export interface PagedUserDefinedFunctionsOutput {
|
|
244
244
|
functions: Array<UserDefinedFunctionOutput>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outputModels.d.ts","sourceRoot":"","sources":["../../src/outputModels.ts"],"names":[],"mappings":"AAGA,iDAAiD;AACjD,MAAM,WAAW,kBAAkB;IACjC,gDAAgD;IAChD,MAAM,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,MAAM,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,EAAE,MAAM,CAAC;CACtB;AAED,2BAA2B;AAC3B,MAAM,WAAW,UAAU;IACzB,oCAAoC;IACpC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outputModels.js","sourceRoot":"","sources":["../../src/outputModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/** The governance script for the application. */\nexport interface ConstitutionOutput {\n /** SHA256 digest of the constitution script. */\n digest: string;\n /** Contents of the constitution. */\n script: string;\n}\n\n/** An error response from Confidential Ledger. */\nexport interface ConfidentialLedgerErrorOutput {\n /** An error response from Confidential Ledger. */\n readonly error?: ConfidentialLedgerErrorBodyOutput;\n}\n\n/** An error response from Confidential Ledger. */\nexport interface ConfidentialLedgerErrorBodyOutput {\n /** The error code. */\n readonly code?: string;\n /** The error message. */\n readonly message?: string;\n}\n\n/** List of members in the consortium. */\nexport interface ConsortiumOutput {\n members: Array<ConsortiumMemberOutput>;\n /** Path from which to retrieve the next page of results. */\n nextLink?: string;\n}\n\n/** Describes a member of the consortium. */\nexport interface ConsortiumMemberOutput {\n /** PEM-encoded certificate associated with the member. */\n certificate: string;\n /** Identifier assigned to the member. */\n id: string;\n}\n\n/** Information about the enclaves running the Confidential Ledger. */\nexport interface ConfidentialLedgerEnclavesOutput {\n /** Id of the Confidential Ledger node responding to the request. */\n currentNodeId: string;\n /** Dictionary of enclave quotes, indexed by node id. */\n enclaveQuotes: Record<string, EnclaveQuoteOutput>;\n}\n\n/** Contains the enclave quote. */\nexport interface EnclaveQuoteOutput {\n /** ID assigned to this node. */\n nodeId: string;\n /** MRENCLAVE value of the code running in the enclave. */\n mrenclave?: string;\n /** Version of the quote presented. */\n quoteVersion: string;\n /** Raw SGX quote, parsable by tools like Open Enclave's oeverify. */\n raw: string;\n}\n\n/** Paginated collections returned in response to a query. */\nexport interface PagedCollectionsOutput {\n collections: Array<CollectionOutput>;\n /** Path from which to retrieve the next page of results. */\n nextLink?: string;\n}\n\n/** Identifier for collections. */\nexport interface CollectionOutput {\n collectionId: string;\n}\n\n/** Paginated ledger entries returned in response to a query. */\nexport interface PagedLedgerEntriesOutput {\n /** State of a ledger query. */\n state: \"Loading\" | \"Ready\";\n /** Path from which to retrieve the next page of results. */\n nextLink?: string;\n /** Array of ledger entries. */\n entries: Array<LedgerEntryOutput>;\n}\n\n/** An entry in the ledger. */\nexport interface LedgerEntryOutput {\n /** Contents of the ledger entry. */\n contents: string;\n readonly collectionId?: string;\n /** A unique identifier for the state of the ledger. If returned as part of a LedgerEntry, it indicates the state from which the entry was read. */\n readonly transactionId?: string;\n /** List of user defined function hooks to be executed before the ledger entry is written. */\n preHooks?: Array<UserDefinedFunctionHookOutput>;\n /** List of user defined function hooks to be executed after the ledger entry is written. */\n postHooks?: Array<UserDefinedFunctionHookOutput>;\n}\n\n/** Returned as a result of a write to the Confidential Ledger, the transaction id in the response indicates when the write will become durable. */\nexport interface LedgerWriteResultOutput {\n collectionId: string;\n}\n\n/** The result of querying for a ledger entry from an older transaction id. The ledger entry is available in the response only if the returned state is Ready. */\nexport interface LedgerQueryResultOutput {\n /** State of a ledger query. */\n state: \"Loading\" | \"Ready\";\n /** The ledger entry found as a result of the query. This is only available if the query is in Ready state. */\n entry?: LedgerEntryOutput;\n}\n\n/** A receipt certifying the transaction at the specified id. */\nexport interface TransactionReceiptOutput {\n /** List of application claims. */\n applicationClaims?: Array<ApplicationClaimOutput>;\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\n/** A claim of a ledger application. */\nexport interface ApplicationClaimOutput {\n /** An application claim in digested form. */\n digest?: ClaimDigestOutput;\n /** Represents the kind of an application claim. */\n kind: \"LedgerEntry\" | \"ClaimDigest\";\n /** An application claim derived from ledger entry data. */\n ledgerEntry?: LedgerEntryClaimOutput;\n}\n\n/** An application claim in digested form. */\nexport interface ClaimDigestOutput {\n /** The digest of the application claim, in hexadecimal form. */\n value?: string;\n /** Represents the protocol to be used to compute the digest of a claim from the given claim data. */\n protocol: \"LedgerEntryV1\";\n}\n\n/** An application claim derived from ledger entry data. */\nexport interface LedgerEntryClaimOutput {\n /** Identifier of a collection. */\n collectionId?: string;\n /** Contents of a ledger entry. */\n contents?: string;\n /** Base64-encoded secret key. */\n secretKey?: string;\n /** Represents the protocol to be used to compute the digest of a claim from the given claim data. */\n protocol: \"LedgerEntryV1\";\n}\n\nexport interface ReceiptContentsOutput {\n cert?: string;\n leaf?: string;\n leafComponents?: ReceiptLeafComponentsOutput;\n nodeId: string;\n proof: Array<ReceiptElementOutput>;\n root?: string;\n serviceEndorsements?: Array<string>;\n signature: string;\n}\n\nexport interface ReceiptLeafComponentsOutput {\n claimsDigest?: string;\n commitEvidence?: string;\n writeSetDigest?: string;\n}\n\nexport interface ReceiptElementOutput {\n left?: string;\n right?: string;\n}\n\n/** Response returned to a query for the transaction status */\nexport interface TransactionStatusOutput {\n /** Represents the state of the transaction. */\n state: \"Committed\" | \"Pending\";\n /** A unique identifier for the state of the ledger. If returned as part of a LedgerEntry, it indicates the state from which the entry was read. */\n transactionId: string;\n}\n\n/** Paginated users returned in response to a query. */\nexport interface PagedUsersOutput {\n ledgerUsers?: Array<LedgerUserOutput>;\n /** Path from which to retrieve the next page of results. */\n nextLink?: string;\n}\n\n/** Details about a Confidential Ledger user. */\nexport interface LedgerUserOutput {\n /** Represents an assignable role. */\n assignedRole: \"Administrator\" | \"Contributor\" | \"Reader\";\n /** Identifier for the user. This must either be an AAD object id or a certificate fingerprint. */\n readonly userId?: string;\n}\n\n/** Paginated users returned in response to a query. */\nexport interface PagedLedgerUsersOutput {\n ledgerUsers?: Array<LedgerUserMultipleRolesOutput>;\n /** Path from which to retrieve the next page of results. */\n nextLink?: string;\n}\n\n/** Details about a Confidential Ledger user. */\nexport interface LedgerUserMultipleRolesOutput {\n /** Represents an assignable role. */\n assignedRoles: Array<\"Administrator\" | \"Contributor\" | \"Reader\">;\n /** Identifier for the user. This must either be an AAD object id or a certificate fingerprint. */\n readonly userId?: string;\n}\n\n/** bundle for the user defined endpoints */\nexport interface BundleOutput {\n metadata: MetadataOutput;\n /** Any object */\n modules: Record<string, unknown>;\n}\n\nexport interface MetadataOutput {\n /** A map of path to method endpoints for the path */\n endpoints: Record<string, MethodToEndpointPropertiesOutput>;\n}\n\nexport interface MethodToEndpointPropertiesOutput {\n get?: EndpointPropertiesOutput;\n put?: EndpointPropertiesOutput;\n patch?: EndpointPropertiesOutput;\n delete?: EndpointPropertiesOutput;\n}\n\nexport interface EndpointPropertiesOutput {\n authn_policies: Array<any>;\n forwarding_required: \"sometimes\" | \"always\" | \"never\";\n interpreter_reuse?: InterpreterReusePolicyOutput;\n js_function?: string;\n js_module?: string;\n mode?: \"readwrite\" | \"readonly\" | \"historical\";\n /** Anything */\n openapi?: any;\n openapi_hidden?: boolean;\n redirection_strategy?: \"none\" | \"to_primary\" | \"to_backup\";\n}\n\nexport interface InterpreterReusePolicyOutput {\n key: string;\n}\n\nexport interface ModuleDefOutput {\n module: string;\n name: string;\n}\n\n/** Hook for a user defined function execution. */\nexport interface UserDefinedFunctionHookOutput {\n /** ID of the user defined function to execute. */\n functionId: string;\n /** The properties for executing a user defined function. */\n properties?: UserDefinedFunctionExecutionPropertiesOutput;\n}\n\n/** The properties for executing a user defined function. */\nexport interface UserDefinedFunctionExecutionPropertiesOutput {\n /** Runtime arguments of the user defined function. Defaults to an empty list. */\n arguments?: Array<string>;\n /** Name of the exported function to execute in the code of the user defined function. Defaults to main. */\n exportedFunctionName?: string;\n /** JS runtime options for user defined endpoints and functions */\n runtimeOptions?: JSRuntimeOptionsOutput;\n}\n\n/** JS runtime options for user defined endpoints and functions */\nexport interface JSRuntimeOptionsOutput {\n log_exception_details?: boolean;\n max_cached_interpreters?: number;\n max_execution_time_ms?: number;\n max_heap_bytes?: number;\n max_stack_bytes?: number;\n return_exception_details?: boolean;\n}\n\n/** Paginated user defined functions returned in response to a query. */\nexport interface PagedUserDefinedFunctionsOutput {\n functions: Array<UserDefinedFunctionOutput>;\n /** Path from which to retrieve the next page of results. */\n nextLink?: string;\n}\n\n/** A user defined function in the ledger. */\nexport interface UserDefinedFunctionOutput {\n /** Code of the user defined function in JavaScript. */\n code: string;\n /** ID of the user defined function. */\n readonly id?: string;\n}\n\n/** The result of a user defined function execution. */\nexport interface UserDefinedFunctionExecutionResponseOutput {\n /** The error object of a user defined function execution. This is returned only when the user defined function execution throws an exception. */\n error?: UserDefinedFunctionExecutionErrorOutput;\n /** The result object of a user defined function execution. This is returned only when the user defined function executes successfully. */\n result?: UserDefinedFunctionExecutionResultOutput;\n /** Represents the status of a user defined function execution. */\n status: \"Succeeded\" | \"Failed\";\n}\n\n/** The error object of a user defined function execution. This is returned only when the user defined function execution throws an exception. */\nexport interface UserDefinedFunctionExecutionErrorOutput {\n /** Message indicating the error thrown when executing the function. */\n message?: string;\n}\n\n/** The result object of a user defined function execution. This is returned only when the user defined function executes successfully. */\nexport interface UserDefinedFunctionExecutionResultOutput {\n /** String-encoded value returned by the user defined function execution. If the function does not return any value, this is set to an empty string. */\n returnValue?: string;\n}\n\n/** Definition for roles */\nexport interface RoleOutput {\n /** name of the user defined role */\n roleName?: string;\n roleActions?: Array<string>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"outputModels.js","sourceRoot":"","sources":["../../src/outputModels.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/** The governance script for the application. */\nexport interface ConstitutionOutput {\n /** SHA256 digest of the constitution script. */\n digest: string;\n /** Contents of the constitution. */\n script: string;\n}\n\n/** An error response from Confidential Ledger. */\nexport interface ConfidentialLedgerErrorOutput {\n /** An error response from Confidential Ledger. */\n readonly error?: ConfidentialLedgerErrorBodyOutput;\n}\n\n/** An error response from Confidential Ledger. */\nexport interface ConfidentialLedgerErrorBodyOutput {\n /** The error code. */\n readonly code?: string;\n /** The error message. */\n readonly message?: string;\n}\n\n/** List of members in the consortium. */\nexport interface ConsortiumOutput {\n members: Array<ConsortiumMemberOutput>;\n /** Path from which to retrieve the next page of results. */\n nextLink?: string;\n}\n\n/** Describes a member of the consortium. */\nexport interface ConsortiumMemberOutput {\n /** PEM-encoded certificate associated with the member. */\n certificate: string;\n /** Identifier assigned to the member. */\n id: string;\n}\n\n/** Information about the enclaves running the Confidential Ledger. */\nexport interface ConfidentialLedgerEnclavesOutput {\n /** Id of the Confidential Ledger node responding to the request. */\n currentNodeId: string;\n /** Dictionary of enclave quotes, indexed by node id. */\n enclaveQuotes: Record<string, EnclaveQuoteOutput>;\n}\n\n/** Contains the enclave quote. */\nexport interface EnclaveQuoteOutput {\n /** ID assigned to this node. */\n nodeId: string;\n /** MRENCLAVE value of the code running in the enclave. */\n mrenclave?: string;\n /** Version of the quote presented. */\n quoteVersion: string;\n /** Raw SGX quote, parsable by tools like Open Enclave's oeverify. */\n raw: string;\n}\n\n/** Paginated collections returned in response to a query. */\nexport interface PagedCollectionsOutput {\n collections: Array<CollectionOutput>;\n /** Path from which to retrieve the next page of results. */\n nextLink?: string;\n}\n\n/** Identifier for collections. */\nexport interface CollectionOutput {\n collectionId: string;\n}\n\n/** Paginated ledger entries returned in response to a query. */\nexport interface PagedLedgerEntriesOutput {\n /** State of a ledger query. */\n state: \"Loading\" | \"Ready\";\n /** Path from which to retrieve the next page of results. */\n nextLink?: string;\n /** Array of ledger entries. */\n entries: Array<LedgerEntryOutput>;\n}\n\n/** An entry in the ledger. */\nexport interface LedgerEntryOutput {\n /** Contents of the ledger entry. */\n contents: string;\n readonly collectionId?: string;\n /** A unique identifier for the state of the ledger. If returned as part of a LedgerEntry, it indicates the state from which the entry was read. */\n readonly transactionId?: string;\n /** List of user defined function hooks to be executed before the ledger entry is written. */\n preHooks?: Array<UserDefinedFunctionHookOutput>;\n /** List of user defined function hooks to be executed after the ledger entry is written. */\n postHooks?: Array<UserDefinedFunctionHookOutput>;\n}\n\n/** Hook for a user defined function execution. */\nexport interface UserDefinedFunctionHookOutput {\n /** ID of the user defined function to execute. */\n functionId: string;\n /** The properties for executing a user defined function. */\n properties?: UserDefinedFunctionExecutionPropertiesOutput;\n}\n\n/** The properties for executing a user defined function. */\nexport interface UserDefinedFunctionExecutionPropertiesOutput {\n /** Runtime arguments of the user defined function. Defaults to an empty list. */\n arguments?: Array<string>;\n /** Name of the exported function to execute in the code of the user defined function. Defaults to main. */\n exportedFunctionName?: string;\n /** JS runtime options for user defined endpoints and functions */\n runtimeOptions?: JSRuntimeOptionsOutput;\n}\n\n/** JS runtime options for user defined endpoints and functions */\nexport interface JSRuntimeOptionsOutput {\n log_exception_details?: boolean;\n max_cached_interpreters?: number;\n max_execution_time_ms?: number;\n max_heap_bytes?: number;\n max_stack_bytes?: number;\n return_exception_details?: boolean;\n}\n\n/** Returned as a result of a write to the Confidential Ledger, the transaction id in the response indicates when the write will become durable. */\nexport interface LedgerWriteResultOutput {\n collectionId: string;\n}\n\n/** The result of querying for a ledger entry from an older transaction id. The ledger entry is available in the response only if the returned state is Ready. */\nexport interface LedgerQueryResultOutput {\n /** State of a ledger query. */\n state: \"Loading\" | \"Ready\";\n /** The ledger entry found as a result of the query. This is only available if the query is in Ready state. */\n entry?: LedgerEntryOutput;\n}\n\n/** A receipt certifying the transaction at the specified id. */\nexport interface TransactionReceiptOutput {\n /** List of application claims. */\n applicationClaims?: Array<ApplicationClaimOutput>;\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\n/** A claim of a ledger application. */\nexport interface ApplicationClaimOutput {\n /** An application claim in digested form. */\n digest?: ClaimDigestOutput;\n /** Represents the kind of an application claim. */\n kind: \"LedgerEntry\" | \"ClaimDigest\";\n /** An application claim derived from ledger entry data. */\n ledgerEntry?: LedgerEntryClaimOutput;\n}\n\n/** An application claim in digested form. */\nexport interface ClaimDigestOutput {\n /** The digest of the application claim, in hexadecimal form. */\n value?: string;\n /** Represents the protocol to be used to compute the digest of a claim from the given claim data. */\n protocol: \"LedgerEntryV1\";\n}\n\n/** An application claim derived from ledger entry data. */\nexport interface LedgerEntryClaimOutput {\n /** Identifier of a collection. */\n collectionId?: string;\n /** Contents of a ledger entry. */\n contents?: string;\n /** Base64-encoded secret key. */\n secretKey?: string;\n /** Represents the protocol to be used to compute the digest of a claim from the given claim data. */\n protocol: \"LedgerEntryV1\";\n}\n\nexport interface ReceiptContentsOutput {\n cert?: string;\n leaf?: string;\n leafComponents?: ReceiptLeafComponentsOutput;\n nodeId: string;\n proof: Array<ReceiptElementOutput>;\n root?: string;\n serviceEndorsements?: Array<string>;\n signature: string;\n}\n\nexport interface ReceiptLeafComponentsOutput {\n claimsDigest?: string;\n commitEvidence?: string;\n writeSetDigest?: string;\n}\n\nexport interface ReceiptElementOutput {\n left?: string;\n right?: string;\n}\n\n/** Response returned to a query for the transaction status */\nexport interface TransactionStatusOutput {\n /** Represents the state of the transaction. */\n state: \"Committed\" | \"Pending\";\n /** A unique identifier for the state of the ledger. If returned as part of a LedgerEntry, it indicates the state from which the entry was read. */\n transactionId: string;\n}\n\n/** Paginated users returned in response to a query. */\nexport interface PagedUsersOutput {\n ledgerUsers?: Array<LedgerUserOutput>;\n /** Path from which to retrieve the next page of results. */\n nextLink?: string;\n}\n\n/** Details about a Confidential Ledger user. */\nexport interface LedgerUserOutput {\n /** Represents an assignable role. */\n assignedRole: \"Administrator\" | \"Contributor\" | \"Reader\";\n /** Identifier for the user. This must either be an AAD object id or a certificate fingerprint. */\n readonly userId?: string;\n}\n\n/** Paginated users returned in response to a query. */\nexport interface PagedLedgerUsersOutput {\n ledgerUsers?: Array<LedgerUserMultipleRolesOutput>;\n /** Path from which to retrieve the next page of results. */\n nextLink?: string;\n}\n\n/** Details about a Confidential Ledger user. */\nexport interface LedgerUserMultipleRolesOutput {\n /** Represents an assignable role. */\n assignedRoles: Array<\"Administrator\" | \"Contributor\" | \"Reader\">;\n /** Identifier for the user. This must either be an AAD object id or a certificate fingerprint. */\n readonly userId?: string;\n}\n\n/** bundle for the user defined endpoints */\nexport interface BundleOutput {\n metadata: MetadataOutput;\n /** Any object */\n modules: Record<string, unknown>;\n}\n\nexport interface MetadataOutput {\n /** A map of path to method endpoints for the path */\n endpoints: Record<string, MethodToEndpointPropertiesOutput>;\n}\n\nexport interface MethodToEndpointPropertiesOutput {\n get?: EndpointPropertiesOutput;\n put?: EndpointPropertiesOutput;\n patch?: EndpointPropertiesOutput;\n delete?: EndpointPropertiesOutput;\n}\n\nexport interface EndpointPropertiesOutput {\n authn_policies: Array<any>;\n forwarding_required: \"sometimes\" | \"always\" | \"never\";\n interpreter_reuse?: InterpreterReusePolicyOutput;\n js_function?: string;\n js_module?: string;\n mode?: \"readwrite\" | \"readonly\" | \"historical\";\n /** Anything */\n openapi?: any;\n openapi_hidden?: boolean;\n redirection_strategy?: \"none\" | \"to_primary\" | \"to_backup\";\n}\n\nexport interface InterpreterReusePolicyOutput {\n key: string;\n}\n\nexport interface ModuleDefOutput {\n module: string;\n name: string;\n}\n\n/** Paginated user defined functions returned in response to a query. */\nexport interface PagedUserDefinedFunctionsOutput {\n functions: Array<UserDefinedFunctionOutput>;\n /** Path from which to retrieve the next page of results. */\n nextLink?: string;\n}\n\n/** A user defined function in the ledger. */\nexport interface UserDefinedFunctionOutput {\n /** Code of the user defined function in JavaScript. */\n code: string;\n /** ID of the user defined function. */\n readonly id?: string;\n}\n\n/** The result of a user defined function execution. */\nexport interface UserDefinedFunctionExecutionResponseOutput {\n /** The error object of a user defined function execution. This is returned only when the user defined function execution throws an exception. */\n error?: UserDefinedFunctionExecutionErrorOutput;\n /** The result object of a user defined function execution. This is returned only when the user defined function executes successfully. */\n result?: UserDefinedFunctionExecutionResultOutput;\n /** Represents the status of a user defined function execution. */\n status: \"Succeeded\" | \"Failed\";\n}\n\n/** The error object of a user defined function execution. This is returned only when the user defined function execution throws an exception. */\nexport interface UserDefinedFunctionExecutionErrorOutput {\n /** Message indicating the error thrown when executing the function. */\n message?: string;\n}\n\n/** The result object of a user defined function execution. This is returned only when the user defined function executes successfully. */\nexport interface UserDefinedFunctionExecutionResultOutput {\n /** String-encoded value returned by the user defined function execution. If the function does not return any value, this is set to an empty string. */\n returnValue?: string;\n}\n\n/** Definition for roles */\nexport interface RoleOutput {\n /** name of the user defined role */\n roleName?: string;\n roleActions?: Array<string>;\n}\n"]}
|
|
@@ -72,6 +72,10 @@ export type PaginateReturn<TResult> = TResult extends {
|
|
|
72
72
|
body: {
|
|
73
73
|
ledgerUsers?: infer TPage;
|
|
74
74
|
};
|
|
75
|
+
} | {
|
|
76
|
+
body: {
|
|
77
|
+
functions?: infer TPage;
|
|
78
|
+
};
|
|
75
79
|
} ? GetArrayType<TPage> : Array<unknown>;
|
|
76
80
|
/**
|
|
77
81
|
* Helper to paginate results from an initial response that follows the specification of Autorest `x-ms-pageable` extension
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginateHelper.d.ts","sourceRoot":"","sources":["../../src/paginateHelper.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAuF7E;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B,CACzC,QAAQ,EACR,KAAK,GAAG,QAAQ,EAAE,EAClB,aAAa,GAAG,YAAY;IAE5B;;OAEG;IACH,IAAI,IAAI,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC,CA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;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;CACtD;AAED;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,CAAC,OAAO,IAAI,OAAO,SACzC;IACE,IAAI,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,KAAK,CAAA;KAAE,CAAC;CAC/B,GACD;IACE,IAAI,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,KAAK,CAAA;KAAE,CAAC;CACjC,GACD;IACE,IAAI,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,KAAK,CAAA;KAAE,CAAC;CACrC,GACD;IACE,IAAI,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,KAAK,CAAA;KAAE,CAAC;CACjC,GACD;IACE,IAAI,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,KAAK,CAAA;KAAE,CAAC;CACrC,GACD;IACE,IAAI,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,KAAK,CAAA;KAAE,CAAC;CACnC,GACD,YAAY,CAAC,KAAK,CAAC,GACnB,KAAK,CAAC,OAAO,CAAC,CAAC;AAEnB;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,SAAS,SAAS,qBAAqB,EAC9D,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,SAAS,EAC1B,OAAO,GAAE,aAAa,CAAC,SAAS,CAAM,GACrC,0BAA0B,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CA4BvD"}
|
|
@@ -173,7 +173,14 @@ function getPaginationProperties(initialResponse) {
|
|
|
173
173
|
// Build a set with the passed custom nextLinkNames
|
|
174
174
|
const nextLinkNames = new Set(["nextLink", "@nextLink"]);
|
|
175
175
|
// Build a set with the passed custom set of itemNames
|
|
176
|
-
const itemNames = new Set([
|
|
176
|
+
const itemNames = new Set([
|
|
177
|
+
"value",
|
|
178
|
+
"members",
|
|
179
|
+
"collections",
|
|
180
|
+
"entries",
|
|
181
|
+
"ledgerUsers",
|
|
182
|
+
"functions",
|
|
183
|
+
]);
|
|
177
184
|
let nextLinkName;
|
|
178
185
|
let itemName;
|
|
179
186
|
for (const name of nextLinkNames) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginateHelper.js","sourceRoot":"","sources":["../../src/paginateHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAGlC,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D;;;;;;GAMG;AACH,SAAS,qBAAqB,CAM5B,WAAqD;;IAErD,MAAM,IAAI,GAAG,oBAAoB,CAAwC,WAAW,CAAC,CAAC;IACtF,OAAO;QACL,IAAI;YACF,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;QACrB,CAAC;QACD,CAAC,MAAM,CAAC,aAAa,CAAC;YACpB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,EACJ,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM,mCAClB,CAAC,CAAC,QAAuB,EAAE,EAAE;YAC5B,MAAM,EAAE,iBAAiB,EAAE,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE,CAAC;YAC7C,OAAO,oBAAoB,CAAC,WAAW,EAAE;gBACvC,QAAQ,EAAE,iBAAiD;aAC5D,CAAC,CAAC;QACL,CAAC,CAA2E;KAC/E,CAAC;AACJ,CAAC;AAED,SAAgB,oBAAoB,CAClC,WAAqD;;;QAErD,MAAM,KAAK,GAAG,oBAAoB,CAAC,WAAW,CAAC,CAAC;QAChD,MAAM,QAAQ,GAAG,cAAM,KAAK,CAAC,IAAI,EAAE,CAAA,CAAC;QACpC,6FAA6F;QAC7F,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YACnC,sCAAsC;YACtC,MAAM,EAAE,UAAU,EAAE,GAAG,WAAW,CAAC;YACnC,IAAI,UAAU,EAAE,CAAC;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AS,uBAAuB,CAAC,eAAsC;IAIrE,mDAAmD;IACnD,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;IAEzD,sDAAsD;IACtD,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC,CAAC;IAEzF,IAAI,YAAgC,CAAC;IACrC,IAAI,QAA4B,CAAC;IAEjC,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAI,eAAe,CAAC,IAAgC,CAAC,IAAI,CAAW,CAAC;QACnF,IAAI,QAAQ,EAAE,CAAC;YACb,YAAY,GAAG,IAAI,CAAC;YACpB,MAAM;QACR,CAAC;IACH,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAI,eAAe,CAAC,IAAgC,CAAC,IAAI,CAAW,CAAC;QAC/E,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 type { Client, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { createRestError } from \"@azure-rest/core-client\";\n\n/**\n * returns an async iterator that iterates over results. It also has a `byPage`\n * method that returns pages of items at once.\n *\n * @param pagedResult - an object that specifies how to get pages.\n * @returns a paged async iterator that iterates over results.\n */\nfunction getPagedAsyncIterator<\n TElement,\n TPage = TElement[],\n TPageSettings = PageSettings,\n TLink = string,\n>(\n pagedResult: PagedResult<TPage, TPageSettings, TLink>,\n): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {\n const iter = getItemAsyncIterator<TElement, TPage, TLink, TPageSettings>(pagedResult);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage:\n pagedResult?.byPage ??\n (((settings?: PageSettings) => {\n const { continuationToken } = settings ?? {};\n return getPageAsyncIterator(pagedResult, {\n pageLink: continuationToken as unknown as TLink | undefined,\n });\n }) as unknown as (settings?: TPageSettings) => AsyncIterableIterator<TPage>),\n };\n}\n\nasync function* getItemAsyncIterator<TElement, TPage, TLink, TPageSettings>(\n pagedResult: PagedResult<TPage, TPageSettings, TLink>,\n): AsyncIterableIterator<TElement> {\n const pages = getPageAsyncIterator(pagedResult);\n const firstVal = await pages.next();\n // if the result does not have an array shape, i.e. TPage = TElement, then we return it as is\n if (!Array.isArray(firstVal.value)) {\n // can extract elements from this page\n const { toElements } = pagedResult;\n if (toElements) {\n yield* toElements(firstVal.value) as TElement[];\n for await (const page of pages) {\n yield* toElements(page) as TElement[];\n }\n } else {\n yield firstVal.value;\n // `pages` is of type `AsyncIterableIterator<TPage>` but TPage = TElement in this case\n yield* pages as unknown as AsyncIterableIterator<TElement>;\n }\n } else {\n yield* firstVal.value;\n for await (const page of pages) {\n // pages is of type `AsyncIterableIterator<TPage>` so `page` is of type `TPage`. In this branch,\n // it must be the case that `TPage = TElement[]`\n yield* page as unknown as TElement[];\n }\n }\n}\n\nasync function* getPageAsyncIterator<TPage, TLink, TPageSettings>(\n pagedResult: PagedResult<TPage, TPageSettings, TLink>,\n options: {\n pageLink?: TLink;\n } = {},\n): AsyncIterableIterator<TPage> {\n const { pageLink } = options;\n let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink);\n if (!response) {\n return;\n }\n yield response.page;\n while (response.nextPageLink) {\n response = await pagedResult.getPage(response.nextPageLink);\n if (!response) {\n return;\n }\n yield response.page;\n }\n}\n\n/**\n * An interface that tracks the settings for paged iteration\n */\nexport interface PageSettings {\n /**\n * The token that keeps track of where to continue the iterator\n */\n continuationToken?: string;\n}\n\n/**\n * An interface that allows async iterable iteration both to completion and by page.\n */\nexport interface PagedAsyncIterableIterator<\n TElement,\n TPage = TElement[],\n TPageSettings = PageSettings,\n> {\n /**\n * The next method, part of the iteration protocol\n */\n next(): Promise<IteratorResult<TElement>>;\n /**\n * The connection to the async iterator, part of the iteration protocol\n */\n [Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;\n /**\n * Return an AsyncIterableIterator that works a page at a time\n */\n byPage: (settings?: TPageSettings) => AsyncIterableIterator<TPage>;\n}\n\n/**\n * An interface that describes how to communicate with the service.\n */\ninterface PagedResult<TPage, TPageSettings = PageSettings, TLink = string> {\n /**\n * Link to the first page of results.\n */\n firstPageLink: TLink;\n /**\n * A method that returns a page of results.\n */\n getPage: (pageLink: TLink) => Promise<{ page: TPage; nextPageLink?: TLink } | undefined>;\n /**\n * a function to implement the `byPage` method on the paged async iterator.\n */\n byPage?: (settings?: TPageSettings) => AsyncIterableIterator<TPage>;\n\n /**\n * A function to extract elements from a page.\n */\n toElements?: (page: TPage) => unknown[];\n}\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> = (pageLink: string) => 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 | {\n body: { ledgerUsers?: 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 ? initialResponse : 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(`Body Property ${nextLinkName} should be a string or undefined`);\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 = [\"200\", \"201\", \"202\", \"203\", \"204\", \"205\", \"206\", \"207\", \"208\", \"226\"];\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 itemName: string;\n nextLinkName: string | undefined;\n} {\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\", \"ledgerUsers\"]);\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>)[name] 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>)[name] 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
|
+
{"version":3,"file":"paginateHelper.js","sourceRoot":"","sources":["../../src/paginateHelper.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAGlC,OAAO,EAAE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;IAEH,IAAI,YAAgC,CAAC;IACrC,IAAI,QAA4B,CAAC;IAEjC,KAAK,MAAM,IAAI,IAAI,aAAa,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAI,eAAe,CAAC,IAAgC,CAAC,IAAI,CAAW,CAAC;QACnF,IAAI,QAAQ,EAAE,CAAC;YACb,YAAY,GAAG,IAAI,CAAC;YACpB,MAAM;QACR,CAAC;IACH,CAAC;IAED,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;QAC7B,MAAM,IAAI,GAAI,eAAe,CAAC,IAAgC,CAAC,IAAI,CAAW,CAAC;QAC/E,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 type { Client, PathUncheckedResponse } from \"@azure-rest/core-client\";\nimport { createRestError } from \"@azure-rest/core-client\";\n\n/**\n * returns an async iterator that iterates over results. It also has a `byPage`\n * method that returns pages of items at once.\n *\n * @param pagedResult - an object that specifies how to get pages.\n * @returns a paged async iterator that iterates over results.\n */\nfunction getPagedAsyncIterator<\n TElement,\n TPage = TElement[],\n TPageSettings = PageSettings,\n TLink = string,\n>(\n pagedResult: PagedResult<TPage, TPageSettings, TLink>,\n): PagedAsyncIterableIterator<TElement, TPage, TPageSettings> {\n const iter = getItemAsyncIterator<TElement, TPage, TLink, TPageSettings>(pagedResult);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage:\n pagedResult?.byPage ??\n (((settings?: PageSettings) => {\n const { continuationToken } = settings ?? {};\n return getPageAsyncIterator(pagedResult, {\n pageLink: continuationToken as unknown as TLink | undefined,\n });\n }) as unknown as (settings?: TPageSettings) => AsyncIterableIterator<TPage>),\n };\n}\n\nasync function* getItemAsyncIterator<TElement, TPage, TLink, TPageSettings>(\n pagedResult: PagedResult<TPage, TPageSettings, TLink>,\n): AsyncIterableIterator<TElement> {\n const pages = getPageAsyncIterator(pagedResult);\n const firstVal = await pages.next();\n // if the result does not have an array shape, i.e. TPage = TElement, then we return it as is\n if (!Array.isArray(firstVal.value)) {\n // can extract elements from this page\n const { toElements } = pagedResult;\n if (toElements) {\n yield* toElements(firstVal.value) as TElement[];\n for await (const page of pages) {\n yield* toElements(page) as TElement[];\n }\n } else {\n yield firstVal.value;\n // `pages` is of type `AsyncIterableIterator<TPage>` but TPage = TElement in this case\n yield* pages as unknown as AsyncIterableIterator<TElement>;\n }\n } else {\n yield* firstVal.value;\n for await (const page of pages) {\n // pages is of type `AsyncIterableIterator<TPage>` so `page` is of type `TPage`. In this branch,\n // it must be the case that `TPage = TElement[]`\n yield* page as unknown as TElement[];\n }\n }\n}\n\nasync function* getPageAsyncIterator<TPage, TLink, TPageSettings>(\n pagedResult: PagedResult<TPage, TPageSettings, TLink>,\n options: {\n pageLink?: TLink;\n } = {},\n): AsyncIterableIterator<TPage> {\n const { pageLink } = options;\n let response = await pagedResult.getPage(pageLink ?? pagedResult.firstPageLink);\n if (!response) {\n return;\n }\n yield response.page;\n while (response.nextPageLink) {\n response = await pagedResult.getPage(response.nextPageLink);\n if (!response) {\n return;\n }\n yield response.page;\n }\n}\n\n/**\n * An interface that tracks the settings for paged iteration\n */\nexport interface PageSettings {\n /**\n * The token that keeps track of where to continue the iterator\n */\n continuationToken?: string;\n}\n\n/**\n * An interface that allows async iterable iteration both to completion and by page.\n */\nexport interface PagedAsyncIterableIterator<\n TElement,\n TPage = TElement[],\n TPageSettings = PageSettings,\n> {\n /**\n * The next method, part of the iteration protocol\n */\n next(): Promise<IteratorResult<TElement>>;\n /**\n * The connection to the async iterator, part of the iteration protocol\n */\n [Symbol.asyncIterator](): PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;\n /**\n * Return an AsyncIterableIterator that works a page at a time\n */\n byPage: (settings?: TPageSettings) => AsyncIterableIterator<TPage>;\n}\n\n/**\n * An interface that describes how to communicate with the service.\n */\ninterface PagedResult<TPage, TPageSettings = PageSettings, TLink = string> {\n /**\n * Link to the first page of results.\n */\n firstPageLink: TLink;\n /**\n * A method that returns a page of results.\n */\n getPage: (pageLink: TLink) => Promise<{ page: TPage; nextPageLink?: TLink } | undefined>;\n /**\n * a function to implement the `byPage` method on the paged async iterator.\n */\n byPage?: (settings?: TPageSettings) => AsyncIterableIterator<TPage>;\n\n /**\n * A function to extract elements from a page.\n */\n toElements?: (page: TPage) => unknown[];\n}\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> = (pageLink: string) => 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 | {\n body: { ledgerUsers?: infer TPage };\n }\n | {\n body: { functions?: 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 ? initialResponse : 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(`Body Property ${nextLinkName} should be a string or undefined`);\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 = [\"200\", \"201\", \"202\", \"203\", \"204\", \"205\", \"206\", \"207\", \"208\", \"226\"];\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 itemName: string;\n nextLinkName: string | undefined;\n} {\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([\n \"value\",\n \"members\",\n \"collections\",\n \"entries\",\n \"ledgerUsers\",\n \"functions\",\n ]);\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>)[name] 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>)[name] 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"]}
|