@azure-rest/purview-sharing 1.0.0-beta.1 → 1.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (207) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/LICENSE +4 -4
  3. package/README.md +74 -3
  4. package/dist/browser/clientDefinitions.d.ts +87 -0
  5. package/dist/browser/clientDefinitions.d.ts.map +1 -0
  6. package/dist/browser/clientDefinitions.js +4 -0
  7. package/dist/browser/clientDefinitions.js.map +1 -0
  8. package/dist/browser/index.d.ts +12 -0
  9. package/dist/browser/index.d.ts.map +1 -0
  10. package/dist/browser/index.js +15 -0
  11. package/dist/browser/index.js.map +1 -0
  12. package/dist/browser/isUnexpected.d.ts +19 -0
  13. package/dist/browser/isUnexpected.d.ts.map +1 -0
  14. package/{dist-esm/src → dist/browser}/isUnexpected.js +6 -6
  15. package/dist/browser/isUnexpected.js.map +1 -0
  16. package/dist/browser/logger.d.ts +2 -0
  17. package/dist/browser/logger.d.ts.map +1 -0
  18. package/dist/browser/logger.js +5 -0
  19. package/dist/browser/logger.js.map +1 -0
  20. package/dist/browser/models.d.ts +201 -0
  21. package/dist/browser/models.d.ts.map +1 -0
  22. package/dist/browser/models.js +4 -0
  23. package/dist/browser/models.js.map +1 -0
  24. package/dist/browser/outputModels.d.ts +352 -0
  25. package/dist/browser/outputModels.d.ts.map +1 -0
  26. package/dist/browser/outputModels.js +4 -0
  27. package/dist/browser/outputModels.js.map +1 -0
  28. package/dist/browser/package.json +3 -0
  29. package/dist/browser/paginateHelper.d.ts +68 -0
  30. package/dist/browser/paginateHelper.d.ts.map +1 -0
  31. package/{dist-esm/src → dist/browser}/paginateHelper.js +70 -3
  32. package/dist/browser/paginateHelper.js.map +1 -0
  33. package/dist/browser/parameters.d.ts +123 -0
  34. package/dist/browser/parameters.d.ts.map +1 -0
  35. package/dist/browser/parameters.js +4 -0
  36. package/dist/browser/parameters.js.map +1 -0
  37. package/dist/browser/pollingHelper.d.ts +76 -0
  38. package/dist/browser/pollingHelper.d.ts.map +1 -0
  39. package/dist/browser/pollingHelper.js +107 -0
  40. package/dist/browser/pollingHelper.js.map +1 -0
  41. package/dist/browser/purviewSharing.d.ts +16 -0
  42. package/dist/browser/purviewSharing.d.ts.map +1 -0
  43. package/dist/browser/purviewSharing.js +45 -0
  44. package/dist/browser/purviewSharing.js.map +1 -0
  45. package/dist/browser/responses.d.ts +304 -0
  46. package/dist/browser/responses.d.ts.map +1 -0
  47. package/dist/browser/responses.js +4 -0
  48. package/dist/browser/responses.js.map +1 -0
  49. package/dist/commonjs/clientDefinitions.d.ts +87 -0
  50. package/dist/commonjs/clientDefinitions.d.ts.map +1 -0
  51. package/dist/commonjs/clientDefinitions.js +5 -0
  52. package/dist/commonjs/clientDefinitions.js.map +1 -0
  53. package/dist/commonjs/index.d.ts +12 -0
  54. package/dist/commonjs/index.d.ts.map +1 -0
  55. package/dist/commonjs/index.js +18 -0
  56. package/dist/commonjs/index.js.map +1 -0
  57. package/dist/commonjs/isUnexpected.d.ts +19 -0
  58. package/dist/commonjs/isUnexpected.d.ts.map +1 -0
  59. package/dist/commonjs/isUnexpected.js +88 -0
  60. package/dist/commonjs/isUnexpected.js.map +1 -0
  61. package/dist/commonjs/logger.d.ts +2 -0
  62. package/dist/commonjs/logger.d.ts.map +1 -0
  63. package/dist/commonjs/logger.js +8 -0
  64. package/dist/commonjs/logger.js.map +1 -0
  65. package/dist/commonjs/models.d.ts +201 -0
  66. package/dist/commonjs/models.d.ts.map +1 -0
  67. package/dist/commonjs/models.js +5 -0
  68. package/dist/commonjs/models.js.map +1 -0
  69. package/dist/commonjs/outputModels.d.ts +352 -0
  70. package/dist/commonjs/outputModels.d.ts.map +1 -0
  71. package/dist/commonjs/outputModels.js +5 -0
  72. package/dist/commonjs/outputModels.js.map +1 -0
  73. package/dist/commonjs/package.json +3 -0
  74. package/dist/commonjs/paginateHelper.d.ts +68 -0
  75. package/dist/commonjs/paginateHelper.d.ts.map +1 -0
  76. package/dist/commonjs/paginateHelper.js +140 -0
  77. package/dist/commonjs/paginateHelper.js.map +1 -0
  78. package/dist/commonjs/parameters.d.ts +123 -0
  79. package/dist/commonjs/parameters.d.ts.map +1 -0
  80. package/dist/commonjs/parameters.js +5 -0
  81. package/dist/commonjs/parameters.js.map +1 -0
  82. package/dist/commonjs/pollingHelper.d.ts +76 -0
  83. package/dist/commonjs/pollingHelper.d.ts.map +1 -0
  84. package/dist/commonjs/pollingHelper.js +110 -0
  85. package/dist/commonjs/pollingHelper.js.map +1 -0
  86. package/dist/commonjs/purviewSharing.d.ts +16 -0
  87. package/dist/commonjs/purviewSharing.d.ts.map +1 -0
  88. package/dist/commonjs/purviewSharing.js +48 -0
  89. package/dist/commonjs/purviewSharing.js.map +1 -0
  90. package/dist/commonjs/responses.d.ts +304 -0
  91. package/dist/commonjs/responses.d.ts.map +1 -0
  92. package/dist/commonjs/responses.js +5 -0
  93. package/dist/commonjs/responses.js.map +1 -0
  94. package/dist/commonjs/tsdoc-metadata.json +11 -0
  95. package/dist/esm/clientDefinitions.d.ts +87 -0
  96. package/dist/esm/clientDefinitions.d.ts.map +1 -0
  97. package/dist/esm/clientDefinitions.js +4 -0
  98. package/dist/esm/clientDefinitions.js.map +1 -0
  99. package/dist/esm/index.d.ts +12 -0
  100. package/dist/esm/index.d.ts.map +1 -0
  101. package/dist/esm/index.js +15 -0
  102. package/dist/esm/index.js.map +1 -0
  103. package/dist/esm/isUnexpected.d.ts +19 -0
  104. package/dist/esm/isUnexpected.d.ts.map +1 -0
  105. package/dist/esm/isUnexpected.js +85 -0
  106. package/dist/esm/isUnexpected.js.map +1 -0
  107. package/dist/esm/logger.d.ts +2 -0
  108. package/dist/esm/logger.d.ts.map +1 -0
  109. package/dist/esm/logger.js +5 -0
  110. package/dist/esm/logger.js.map +1 -0
  111. package/dist/esm/models.d.ts +201 -0
  112. package/dist/esm/models.d.ts.map +1 -0
  113. package/dist/esm/models.js +4 -0
  114. package/dist/esm/models.js.map +1 -0
  115. package/dist/esm/outputModels.d.ts +352 -0
  116. package/dist/esm/outputModels.d.ts.map +1 -0
  117. package/dist/esm/outputModels.js +4 -0
  118. package/dist/esm/outputModels.js.map +1 -0
  119. package/dist/esm/package.json +3 -0
  120. package/dist/esm/paginateHelper.d.ts +68 -0
  121. package/dist/esm/paginateHelper.d.ts.map +1 -0
  122. package/dist/esm/paginateHelper.js +137 -0
  123. package/dist/esm/paginateHelper.js.map +1 -0
  124. package/dist/esm/parameters.d.ts +123 -0
  125. package/dist/esm/parameters.d.ts.map +1 -0
  126. package/dist/esm/parameters.js +4 -0
  127. package/dist/esm/parameters.js.map +1 -0
  128. package/dist/esm/pollingHelper.d.ts +76 -0
  129. package/dist/esm/pollingHelper.d.ts.map +1 -0
  130. package/dist/esm/pollingHelper.js +107 -0
  131. package/dist/esm/pollingHelper.js.map +1 -0
  132. package/dist/esm/purviewSharing.d.ts +16 -0
  133. package/dist/esm/purviewSharing.d.ts.map +1 -0
  134. package/dist/esm/purviewSharing.js +45 -0
  135. package/dist/esm/purviewSharing.js.map +1 -0
  136. package/dist/esm/responses.d.ts +304 -0
  137. package/dist/esm/responses.d.ts.map +1 -0
  138. package/dist/esm/responses.js +4 -0
  139. package/dist/esm/responses.js.map +1 -0
  140. package/dist/react-native/clientDefinitions.d.ts +87 -0
  141. package/dist/react-native/clientDefinitions.d.ts.map +1 -0
  142. package/dist/react-native/clientDefinitions.js +4 -0
  143. package/dist/react-native/clientDefinitions.js.map +1 -0
  144. package/dist/react-native/index.d.ts +12 -0
  145. package/dist/react-native/index.d.ts.map +1 -0
  146. package/dist/react-native/index.js +15 -0
  147. package/dist/react-native/index.js.map +1 -0
  148. package/dist/react-native/isUnexpected.d.ts +19 -0
  149. package/dist/react-native/isUnexpected.d.ts.map +1 -0
  150. package/dist/react-native/isUnexpected.js +85 -0
  151. package/dist/react-native/isUnexpected.js.map +1 -0
  152. package/dist/react-native/logger.d.ts +2 -0
  153. package/dist/react-native/logger.d.ts.map +1 -0
  154. package/dist/react-native/logger.js +5 -0
  155. package/dist/react-native/logger.js.map +1 -0
  156. package/dist/react-native/models.d.ts +201 -0
  157. package/dist/react-native/models.d.ts.map +1 -0
  158. package/dist/react-native/models.js +4 -0
  159. package/dist/react-native/models.js.map +1 -0
  160. package/dist/react-native/outputModels.d.ts +352 -0
  161. package/dist/react-native/outputModels.d.ts.map +1 -0
  162. package/dist/react-native/outputModels.js +4 -0
  163. package/dist/react-native/outputModels.js.map +1 -0
  164. package/dist/react-native/package.json +3 -0
  165. package/dist/react-native/paginateHelper.d.ts +68 -0
  166. package/dist/react-native/paginateHelper.d.ts.map +1 -0
  167. package/dist/react-native/paginateHelper.js +137 -0
  168. package/dist/react-native/paginateHelper.js.map +1 -0
  169. package/dist/react-native/parameters.d.ts +123 -0
  170. package/dist/react-native/parameters.d.ts.map +1 -0
  171. package/dist/react-native/parameters.js +4 -0
  172. package/dist/react-native/parameters.js.map +1 -0
  173. package/dist/react-native/pollingHelper.d.ts +76 -0
  174. package/dist/react-native/pollingHelper.d.ts.map +1 -0
  175. package/dist/react-native/pollingHelper.js +107 -0
  176. package/dist/react-native/pollingHelper.js.map +1 -0
  177. package/dist/react-native/purviewSharing.d.ts +16 -0
  178. package/dist/react-native/purviewSharing.d.ts.map +1 -0
  179. package/dist/react-native/purviewSharing.js +45 -0
  180. package/dist/react-native/purviewSharing.js.map +1 -0
  181. package/dist/react-native/responses.d.ts +304 -0
  182. package/dist/react-native/responses.d.ts.map +1 -0
  183. package/dist/react-native/responses.js +4 -0
  184. package/dist/react-native/responses.js.map +1 -0
  185. package/package.json +86 -78
  186. package/review/{purview-sharing.api.md → purview-sharing-node.api.md} +123 -19
  187. package/dist/index.js +0 -240
  188. package/dist/index.js.map +0 -1
  189. package/dist-esm/src/clientDefinitions.js +0 -4
  190. package/dist-esm/src/clientDefinitions.js.map +0 -1
  191. package/dist-esm/src/index.js +0 -14
  192. package/dist-esm/src/index.js.map +0 -1
  193. package/dist-esm/src/isUnexpected.js.map +0 -1
  194. package/dist-esm/src/models.js +0 -4
  195. package/dist-esm/src/models.js.map +0 -1
  196. package/dist-esm/src/outputModels.js +0 -4
  197. package/dist-esm/src/outputModels.js.map +0 -1
  198. package/dist-esm/src/paginateHelper.js.map +0 -1
  199. package/dist-esm/src/parameters.js +0 -4
  200. package/dist-esm/src/parameters.js.map +0 -1
  201. package/dist-esm/src/pollingHelper.js +0 -50
  202. package/dist-esm/src/pollingHelper.js.map +0 -1
  203. package/dist-esm/src/purviewSharing.js +0 -27
  204. package/dist-esm/src/purviewSharing.js.map +0 -1
  205. package/dist-esm/src/responses.js +0 -4
  206. package/dist-esm/src/responses.js.map +0 -1
  207. package/types/purview-sharing.d.ts +0 -1270
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paginateHelper.js","sourceRoot":"","sources":["../../src/paginateHelper.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AA2LlC,4BA8BC;AAtND,yDAA0D;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,WAAW,EAAE,MAAM;YAClB,CAAC,CAAC,QAAuB,EAAE,EAAE;gBAC5B,MAAM,EAAE,iBAAiB,EAAE,GAAG,QAAQ,IAAI,EAAE,CAAC;gBAC7C,OAAO,oBAAoB,CAAC,WAAW,EAAE;oBACvC,QAAQ,EAAE,iBAAiD;iBAC5D,CAAC,CAAC;YACL,CAAC,CAA2E;KAC/E,CAAC;AACJ,CAAC;AAED,KAAK,SAAS,CAAC,CAAC,oBAAoB,CAClC,WAAqD;IAErD,MAAM,KAAK,GAAG,oBAAoB,CAAC,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I,IAAgC,CAAC,YAAY,CAAC,CAAC;IAEjE,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE,CAAC;QACpE,MAAM,IAAI,KAAK,CAAC,iBAAiB,YAAY,kCAAkC,CAAC,CAAC;IACnF,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,SAAS,WAAW,CAAc,IAAa,EAAE,QAAgB;IAC/D,MAAM,KAAK,GAAI,IAAgC,CAAC,QAAQ,CAAQ,CAAC;IAEjE,qEAAqE;IACrE,qEAAqE;IACrE,iDAAiD;IACjD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,kFAAkF,QAAQ,EAAE,CAC7F,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,IAAI,EAAE,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,SAAS,kBAAkB,CAAC,QAA+B;IACzD,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAClG,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,MAAM,IAAA,6BAAe,EACnB,gDAAgD,QAAQ,CAAC,MAAM,EAAE,EACjE,QAAQ,CACT,CAAC;IACJ,CAAC;AACH,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 body: { value?: 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 const itemName = \"value\";\n const nextLinkName = \"nextLink\";\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"]}
@@ -0,0 +1,123 @@
1
+ import type { RawHttpHeadersInput } from "@azure/core-rest-pipeline";
2
+ import type { RequestParameters } from "@azure-rest/core-client";
3
+ import type { ReceivedShare, TenantEmailRegistration, SentShare, SentShareInvitation } from "./models.js";
4
+ export type ReceivedSharesGetReceivedShareParameters = RequestParameters;
5
+ export interface ReceivedSharesCreateOrReplaceBodyParam {
6
+ /** The received share to create or replace */
7
+ body: ReceivedShare;
8
+ }
9
+ export interface ReceivedSharesCreateOrReplaceMediaTypesParam {
10
+ /** Request content type */
11
+ contentType?: "application/json";
12
+ }
13
+ export type ReceivedSharesCreateOrReplaceParameters = ReceivedSharesCreateOrReplaceMediaTypesParam & ReceivedSharesCreateOrReplaceBodyParam & RequestParameters;
14
+ export type ReceivedSharesDeleteReceivedShareParameters = RequestParameters;
15
+ export interface ReceivedSharesGetAllAttachedReceivedSharesQueryParamProperties {
16
+ /** A name that references a data store. */
17
+ referenceName: string;
18
+ /** Filters the results using OData syntax */
19
+ filter?: string;
20
+ /** Sorts the results using OData syntax */
21
+ orderby?: string;
22
+ }
23
+ export interface ReceivedSharesGetAllAttachedReceivedSharesQueryParam {
24
+ queryParameters: ReceivedSharesGetAllAttachedReceivedSharesQueryParamProperties;
25
+ }
26
+ export type ReceivedSharesGetAllAttachedReceivedSharesParameters = ReceivedSharesGetAllAttachedReceivedSharesQueryParam & RequestParameters;
27
+ export interface ReceivedSharesGetAllDetachedReceivedSharesQueryParamProperties {
28
+ /** Filters the results using OData syntax */
29
+ filter?: string;
30
+ /** Sorts the results using OData syntax */
31
+ orderby?: string;
32
+ }
33
+ export interface ReceivedSharesGetAllDetachedReceivedSharesQueryParam {
34
+ queryParameters?: ReceivedSharesGetAllDetachedReceivedSharesQueryParamProperties;
35
+ }
36
+ export type ReceivedSharesGetAllDetachedReceivedSharesParameters = ReceivedSharesGetAllDetachedReceivedSharesQueryParam & RequestParameters;
37
+ export interface ReceivedSharesActivateTenantEmailRegistrationHeaders {
38
+ /** If specified, the client directs that the request is repeatable; that is, that the client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate response without the server executing the request multiple times. The value of the Repeatability-Request-Id is an opaque string representing a client-generated, globally unique for all time, identifier for the request. It is recommended to use version 4 (random) UUIDs. */
39
+ "repeatability-request-id"?: string;
40
+ }
41
+ export interface ReceivedSharesActivateTenantEmailRegistrationBodyParam {
42
+ /** The tenant email registration payload */
43
+ body: TenantEmailRegistration;
44
+ }
45
+ export interface ReceivedSharesActivateTenantEmailRegistrationHeaderParam {
46
+ headers?: RawHttpHeadersInput & ReceivedSharesActivateTenantEmailRegistrationHeaders;
47
+ }
48
+ export interface ReceivedSharesActivateTenantEmailRegistrationMediaTypesParam {
49
+ /** Request content type */
50
+ contentType?: "application/json";
51
+ }
52
+ export type ReceivedSharesActivateTenantEmailRegistrationParameters = ReceivedSharesActivateTenantEmailRegistrationHeaderParam & ReceivedSharesActivateTenantEmailRegistrationMediaTypesParam & ReceivedSharesActivateTenantEmailRegistrationBodyParam & RequestParameters;
53
+ export interface ReceivedSharesRegisterTenantEmailRegistrationHeaders {
54
+ /** If specified, the client directs that the request is repeatable; that is, that the client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate response without the server executing the request multiple times. The value of the Repeatability-Request-Id is an opaque string representing a client-generated, globally unique for all time, identifier for the request. It is recommended to use version 4 (random) UUIDs. */
55
+ "repeatability-request-id"?: string;
56
+ }
57
+ export interface ReceivedSharesRegisterTenantEmailRegistrationHeaderParam {
58
+ headers?: RawHttpHeadersInput & ReceivedSharesRegisterTenantEmailRegistrationHeaders;
59
+ }
60
+ export type ReceivedSharesRegisterTenantEmailRegistrationParameters = ReceivedSharesRegisterTenantEmailRegistrationHeaderParam & RequestParameters;
61
+ export interface SentSharesGetAllSentSharesQueryParamProperties {
62
+ /** A name that references a data store. */
63
+ referenceName: string;
64
+ /** Filters the results using OData syntax */
65
+ filter?: string;
66
+ /** Sorts the results using OData syntax */
67
+ orderby?: string;
68
+ }
69
+ export interface SentSharesGetAllSentSharesQueryParam {
70
+ queryParameters: SentSharesGetAllSentSharesQueryParamProperties;
71
+ }
72
+ export type SentSharesGetAllSentSharesParameters = SentSharesGetAllSentSharesQueryParam & RequestParameters;
73
+ export type SentSharesGetSentShareParameters = RequestParameters;
74
+ export interface SentSharesCreateOrReplaceBodyParam {
75
+ /** The sent share to create or replace. */
76
+ body: SentShare;
77
+ }
78
+ export interface SentSharesCreateOrReplaceMediaTypesParam {
79
+ /** Request content type */
80
+ contentType?: "application/json";
81
+ }
82
+ export type SentSharesCreateOrReplaceParameters = SentSharesCreateOrReplaceMediaTypesParam & SentSharesCreateOrReplaceBodyParam & RequestParameters;
83
+ export type SentSharesDeleteSentShareParameters = RequestParameters;
84
+ export interface SentSharesGetAllSentShareInvitationsQueryParamProperties {
85
+ /** Filters the results using OData syntax */
86
+ filter?: string;
87
+ /** Sorts the results using OData syntax */
88
+ orderby?: string;
89
+ }
90
+ export interface SentSharesGetAllSentShareInvitationsQueryParam {
91
+ queryParameters?: SentSharesGetAllSentShareInvitationsQueryParamProperties;
92
+ }
93
+ export type SentSharesGetAllSentShareInvitationsParameters = SentSharesGetAllSentShareInvitationsQueryParam & RequestParameters;
94
+ export type SentSharesGetSentShareInvitationParameters = RequestParameters;
95
+ export interface SentSharesCreateSentShareInvitationBodyParam {
96
+ /** The sent share invitation to create. */
97
+ body: SentShareInvitation;
98
+ }
99
+ export interface SentSharesCreateSentShareInvitationMediaTypesParam {
100
+ /** Request content type */
101
+ contentType?: "application/json";
102
+ }
103
+ export type SentSharesCreateSentShareInvitationParameters = SentSharesCreateSentShareInvitationMediaTypesParam & SentSharesCreateSentShareInvitationBodyParam & RequestParameters;
104
+ export type SentSharesDeleteSentShareInvitationParameters = RequestParameters;
105
+ export interface SentSharesNotifyUserSentShareInvitationHeaders {
106
+ /** If specified, the client directs that the request is repeatable; that is, that the client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate response without the server executing the request multiple times. The value of the Repeatability-Request-Id is an opaque string representing a client-generated, globally unique for all time, identifier for the request. It is recommended to use version 4 (random) UUIDs. */
107
+ "repeatability-request-id"?: string;
108
+ }
109
+ export interface SentSharesNotifyUserSentShareInvitationHeaderParam {
110
+ headers?: RawHttpHeadersInput & SentSharesNotifyUserSentShareInvitationHeaders;
111
+ }
112
+ export type SentSharesNotifyUserSentShareInvitationParameters = SentSharesNotifyUserSentShareInvitationHeaderParam & RequestParameters;
113
+ export interface ShareResourcesGetAllShareResourcesQueryParamProperties {
114
+ /** Filters the results using OData syntax */
115
+ filter?: string;
116
+ /** Sorts the results using OData syntax */
117
+ orderby?: string;
118
+ }
119
+ export interface ShareResourcesGetAllShareResourcesQueryParam {
120
+ queryParameters?: ShareResourcesGetAllShareResourcesQueryParamProperties;
121
+ }
122
+ export type ShareResourcesGetAllShareResourcesParameters = ShareResourcesGetAllShareResourcesQueryParam & RequestParameters;
123
+ //# sourceMappingURL=parameters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parameters.d.ts","sourceRoot":"","sources":["../../src/parameters.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EACV,aAAa,EACb,uBAAuB,EACvB,SAAS,EACT,mBAAmB,EACpB,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,wCAAwC,GAAG,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AAM,0CAA0C,GAAG,iBAAiB,CAAC;AAE3E,MAAM,WAAW,4CAA4C;IAC3D,2CAA2C;IAC3C,IAAI,EAAE,mBAAmB,CAAC;CAC3B;AAED,MAAM,WAAW,kDAAkD;IACjE,2BAA2B;IAC3B,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC;AAED,MAAM,MAAM,6CAA6C,GACvD,kDAAkD,GAChD,4CAA4C,GAC5C,iBAAiB,CAAC;AACtB,MAAM,MAAM,6CAA6C,GAAG,iBAAiB,CAAC;AAE9E,MAAM,WAAW,8CAA8C;IAC7D,qdAAqd;IACrd,0BAA0B,CAAC,EAAE,MAAM,CAAC;CACrC;AAED,MAAM,WAAW,kDAAkD;IACjE,OAAO,CAAC,EAAE,mBAAmB,GAAG,8CAA8C,CAAC;CAChF;AAED,MAAM,MAAM,iDAAiD,GAC3D,kDAAkD,GAAG,iBAAiB,CAAC;AAEzE,MAAM,WAAW,sDAAsD;IACrE,6CAA6C;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2CAA2C;IAC3C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,4CAA4C;IAC3D,eAAe,CAAC,EAAE,sDAAsD,CAAC;CAC1E;AAED,MAAM,MAAM,4CAA4C,GACtD,4CAA4C,GAAG,iBAAiB,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ //# sourceMappingURL=parameters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parameters.js","sourceRoot":"","sources":["../../src/parameters.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { RawHttpHeadersInput } from \"@azure/core-rest-pipeline\";\nimport type { RequestParameters } from \"@azure-rest/core-client\";\nimport type {\n ReceivedShare,\n TenantEmailRegistration,\n SentShare,\n SentShareInvitation,\n} from \"./models.js\";\n\nexport type ReceivedSharesGetReceivedShareParameters = RequestParameters;\n\nexport interface ReceivedSharesCreateOrReplaceBodyParam {\n /** The received share to create or replace */\n body: ReceivedShare;\n}\n\nexport interface ReceivedSharesCreateOrReplaceMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type ReceivedSharesCreateOrReplaceParameters = ReceivedSharesCreateOrReplaceMediaTypesParam &\n ReceivedSharesCreateOrReplaceBodyParam &\n RequestParameters;\nexport type ReceivedSharesDeleteReceivedShareParameters = RequestParameters;\n\nexport interface ReceivedSharesGetAllAttachedReceivedSharesQueryParamProperties {\n /** A name that references a data store. */\n referenceName: string;\n /** Filters the results using OData syntax */\n filter?: string;\n /** Sorts the results using OData syntax */\n orderby?: string;\n}\n\nexport interface ReceivedSharesGetAllAttachedReceivedSharesQueryParam {\n queryParameters: ReceivedSharesGetAllAttachedReceivedSharesQueryParamProperties;\n}\n\nexport type ReceivedSharesGetAllAttachedReceivedSharesParameters =\n ReceivedSharesGetAllAttachedReceivedSharesQueryParam & RequestParameters;\n\nexport interface ReceivedSharesGetAllDetachedReceivedSharesQueryParamProperties {\n /** Filters the results using OData syntax */\n filter?: string;\n /** Sorts the results using OData syntax */\n orderby?: string;\n}\n\nexport interface ReceivedSharesGetAllDetachedReceivedSharesQueryParam {\n queryParameters?: ReceivedSharesGetAllDetachedReceivedSharesQueryParamProperties;\n}\n\nexport type ReceivedSharesGetAllDetachedReceivedSharesParameters =\n ReceivedSharesGetAllDetachedReceivedSharesQueryParam & RequestParameters;\n\nexport interface ReceivedSharesActivateTenantEmailRegistrationHeaders {\n /** If specified, the client directs that the request is repeatable; that is, that the client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate response without the server executing the request multiple times. The value of the Repeatability-Request-Id is an opaque string representing a client-generated, globally unique for all time, identifier for the request. It is recommended to use version 4 (random) UUIDs. */\n \"repeatability-request-id\"?: string;\n}\n\nexport interface ReceivedSharesActivateTenantEmailRegistrationBodyParam {\n /** The tenant email registration payload */\n body: TenantEmailRegistration;\n}\n\nexport interface ReceivedSharesActivateTenantEmailRegistrationHeaderParam {\n headers?: RawHttpHeadersInput & ReceivedSharesActivateTenantEmailRegistrationHeaders;\n}\n\nexport interface ReceivedSharesActivateTenantEmailRegistrationMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type ReceivedSharesActivateTenantEmailRegistrationParameters =\n ReceivedSharesActivateTenantEmailRegistrationHeaderParam &\n ReceivedSharesActivateTenantEmailRegistrationMediaTypesParam &\n ReceivedSharesActivateTenantEmailRegistrationBodyParam &\n RequestParameters;\n\nexport interface ReceivedSharesRegisterTenantEmailRegistrationHeaders {\n /** If specified, the client directs that the request is repeatable; that is, that the client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate response without the server executing the request multiple times. The value of the Repeatability-Request-Id is an opaque string representing a client-generated, globally unique for all time, identifier for the request. It is recommended to use version 4 (random) UUIDs. */\n \"repeatability-request-id\"?: string;\n}\n\nexport interface ReceivedSharesRegisterTenantEmailRegistrationHeaderParam {\n headers?: RawHttpHeadersInput & ReceivedSharesRegisterTenantEmailRegistrationHeaders;\n}\n\nexport type ReceivedSharesRegisterTenantEmailRegistrationParameters =\n ReceivedSharesRegisterTenantEmailRegistrationHeaderParam & RequestParameters;\n\nexport interface SentSharesGetAllSentSharesQueryParamProperties {\n /** A name that references a data store. */\n referenceName: string;\n /** Filters the results using OData syntax */\n filter?: string;\n /** Sorts the results using OData syntax */\n orderby?: string;\n}\n\nexport interface SentSharesGetAllSentSharesQueryParam {\n queryParameters: SentSharesGetAllSentSharesQueryParamProperties;\n}\n\nexport type SentSharesGetAllSentSharesParameters = SentSharesGetAllSentSharesQueryParam &\n RequestParameters;\nexport type SentSharesGetSentShareParameters = RequestParameters;\n\nexport interface SentSharesCreateOrReplaceBodyParam {\n /** The sent share to create or replace. */\n body: SentShare;\n}\n\nexport interface SentSharesCreateOrReplaceMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type SentSharesCreateOrReplaceParameters = SentSharesCreateOrReplaceMediaTypesParam &\n SentSharesCreateOrReplaceBodyParam &\n RequestParameters;\nexport type SentSharesDeleteSentShareParameters = RequestParameters;\n\nexport interface SentSharesGetAllSentShareInvitationsQueryParamProperties {\n /** Filters the results using OData syntax */\n filter?: string;\n /** Sorts the results using OData syntax */\n orderby?: string;\n}\n\nexport interface SentSharesGetAllSentShareInvitationsQueryParam {\n queryParameters?: SentSharesGetAllSentShareInvitationsQueryParamProperties;\n}\n\nexport type SentSharesGetAllSentShareInvitationsParameters =\n SentSharesGetAllSentShareInvitationsQueryParam & RequestParameters;\nexport type SentSharesGetSentShareInvitationParameters = RequestParameters;\n\nexport interface SentSharesCreateSentShareInvitationBodyParam {\n /** The sent share invitation to create. */\n body: SentShareInvitation;\n}\n\nexport interface SentSharesCreateSentShareInvitationMediaTypesParam {\n /** Request content type */\n contentType?: \"application/json\";\n}\n\nexport type SentSharesCreateSentShareInvitationParameters =\n SentSharesCreateSentShareInvitationMediaTypesParam &\n SentSharesCreateSentShareInvitationBodyParam &\n RequestParameters;\nexport type SentSharesDeleteSentShareInvitationParameters = RequestParameters;\n\nexport interface SentSharesNotifyUserSentShareInvitationHeaders {\n /** If specified, the client directs that the request is repeatable; that is, that the client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate response without the server executing the request multiple times. The value of the Repeatability-Request-Id is an opaque string representing a client-generated, globally unique for all time, identifier for the request. It is recommended to use version 4 (random) UUIDs. */\n \"repeatability-request-id\"?: string;\n}\n\nexport interface SentSharesNotifyUserSentShareInvitationHeaderParam {\n headers?: RawHttpHeadersInput & SentSharesNotifyUserSentShareInvitationHeaders;\n}\n\nexport type SentSharesNotifyUserSentShareInvitationParameters =\n SentSharesNotifyUserSentShareInvitationHeaderParam & RequestParameters;\n\nexport interface ShareResourcesGetAllShareResourcesQueryParamProperties {\n /** Filters the results using OData syntax */\n filter?: string;\n /** Sorts the results using OData syntax */\n orderby?: string;\n}\n\nexport interface ShareResourcesGetAllShareResourcesQueryParam {\n queryParameters?: ShareResourcesGetAllShareResourcesQueryParamProperties;\n}\n\nexport type ShareResourcesGetAllShareResourcesParameters =\n ShareResourcesGetAllShareResourcesQueryParam & RequestParameters;\n"]}
@@ -0,0 +1,76 @@
1
+ import type { Client, HttpResponse } from "@azure-rest/core-client";
2
+ import type { AbortSignalLike } from "@azure/abort-controller";
3
+ import type { CancelOnProgress, CreateHttpPollerOptions, OperationState } from "@azure/core-lro";
4
+ /**
5
+ * A simple poller that can be used to poll a long running operation.
6
+ */
7
+ export interface SimplePollerLike<TState extends OperationState<TResult>, TResult> {
8
+ /**
9
+ * Returns true if the poller has finished polling.
10
+ */
11
+ isDone(): boolean;
12
+ /**
13
+ * Returns the state of the operation.
14
+ */
15
+ getOperationState(): TState;
16
+ /**
17
+ * Returns the result value of the operation,
18
+ * regardless of the state of the poller.
19
+ * It can return undefined or an incomplete form of the final TResult value
20
+ * depending on the implementation.
21
+ */
22
+ getResult(): TResult | undefined;
23
+ /**
24
+ * Returns a promise that will resolve once a single polling request finishes.
25
+ * It does this by calling the update method of the Poller's operation.
26
+ */
27
+ poll(options?: {
28
+ abortSignal?: AbortSignalLike;
29
+ }): Promise<TState>;
30
+ /**
31
+ * Returns a promise that will resolve once the underlying operation is completed.
32
+ */
33
+ pollUntilDone(pollOptions?: {
34
+ abortSignal?: AbortSignalLike;
35
+ }): Promise<TResult>;
36
+ /**
37
+ * Invokes the provided callback after each polling is completed,
38
+ * sending the current state of the poller's operation.
39
+ *
40
+ * It returns a method that can be used to stop receiving updates on the given callback function.
41
+ */
42
+ onProgress(callback: (state: TState) => void): CancelOnProgress;
43
+ /**
44
+ * Returns a promise that could be used for serialized version of the poller's operation
45
+ * by invoking the operation's serialize method.
46
+ */
47
+ serialize(): Promise<string>;
48
+ /**
49
+ * Wait the poller to be submitted.
50
+ */
51
+ submitted(): Promise<void>;
52
+ /**
53
+ * Returns a string representation of the poller's operation. Similar to serialize but returns a string.
54
+ * @deprecated Use serialize() instead.
55
+ */
56
+ toString(): string;
57
+ /**
58
+ * Stops the poller from continuing to poll. Please note this will only stop the client-side polling
59
+ * @deprecated Use abortSignal to stop polling instead.
60
+ */
61
+ stopPolling(): void;
62
+ /**
63
+ * Returns true if the poller is stopped.
64
+ * @deprecated Use abortSignal status to track this instead.
65
+ */
66
+ isStopped(): boolean;
67
+ }
68
+ /**
69
+ * Helper function that builds a Poller object to help polling a long running operation.
70
+ * @param client - Client to use for sending the request to get additional pages.
71
+ * @param initialResponse - The initial response.
72
+ * @param options - Options to set a resume state or custom polling interval.
73
+ * @returns - A poller object to poll for operation state updates and eventually get the final response.
74
+ */
75
+ export declare function getLongRunningPoller<TResult extends HttpResponse>(client: Client, initialResponse: TResult, options?: CreateHttpPollerOptions<TResult, OperationState<TResult>>): Promise<SimplePollerLike<OperationState<TResult>, TResult>>;
76
+ //# sourceMappingURL=pollingHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pollingHelper.d.ts","sourceRoot":"","sources":["../../src/pollingHelper.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,KAAK,EACV,gBAAgB,EAChB,uBAAuB,EAGvB,cAAc,EACf,MAAM,iBAAiB,CAAC;AAGzB;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,MAAM,SAAS,cAAc,CAAC,OAAO,CAAC,EAAE,OAAO;IAC/E;;OAEG;IACH,MAAM,IAAI,OAAO,CAAC;IAClB;;OAEG;IACH,iBAAiB,IAAI,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,SAAS,IAAI,OAAO,GAAG,SAAS,CAAC;IACjC;;;OAGG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,eAAe,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACnE;;OAEG;IACH,aAAa,CAAC,WAAW,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,eAAe,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjF;;;;;OAKG;IACH,UAAU,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAAG,gBAAgB,CAAC;IAEhE;;;OAGG;IACH,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAE7B;;OAEG;IACH,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3B;;;OAGG;IACH,QAAQ,IAAI,MAAM,CAAC;IAEnB;;;OAGG;IACH,WAAW,IAAI,IAAI,CAAC;IAEpB;;;OAGG;IACH,SAAS,IAAI,OAAO,CAAC;CACtB;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,SAAS,YAAY,EACrE,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,OAAO,EACxB,OAAO,GAAE,uBAAuB,CAAC,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,CAAM,GACtE,OAAO,CAAC,gBAAgB,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC,CAgF7D"}
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.getLongRunningPoller = getLongRunningPoller;
6
+ const core_lro_1 = require("@azure/core-lro");
7
+ /**
8
+ * Helper function that builds a Poller object to help polling a long running operation.
9
+ * @param client - Client to use for sending the request to get additional pages.
10
+ * @param initialResponse - The initial response.
11
+ * @param options - Options to set a resume state or custom polling interval.
12
+ * @returns - A poller object to poll for operation state updates and eventually get the final response.
13
+ */
14
+ async function getLongRunningPoller(client, initialResponse, options = {}) {
15
+ const abortController = new AbortController();
16
+ const poller = {
17
+ sendInitialRequest: async () => {
18
+ // In the case of Rest Clients we are building the LRO poller object from a response that's the reason
19
+ // we are not triggering the initial request here, just extracting the information from the
20
+ // response we were provided.
21
+ return getLroResponse(initialResponse);
22
+ },
23
+ sendPollRequest: async (path, pollOptions) => {
24
+ // This is the callback that is going to be called to poll the service
25
+ // to get the latest status. We use the client provided and the polling path
26
+ // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location
27
+ // depending on the lro pattern that the service implements. If non is provided we default to the initial path.
28
+ function abortListener() {
29
+ abortController.abort();
30
+ }
31
+ const inputAbortSignal = pollOptions?.abortSignal;
32
+ const abortSignal = abortController.signal;
33
+ if (inputAbortSignal?.aborted) {
34
+ abortController.abort();
35
+ }
36
+ else if (!abortSignal.aborted) {
37
+ inputAbortSignal?.addEventListener("abort", abortListener, {
38
+ once: true,
39
+ });
40
+ }
41
+ let response;
42
+ try {
43
+ response = await client
44
+ .pathUnchecked(path ?? initialResponse.request.url)
45
+ .get({ abortSignal });
46
+ }
47
+ finally {
48
+ inputAbortSignal?.removeEventListener("abort", abortListener);
49
+ }
50
+ const lroResponse = getLroResponse(response);
51
+ lroResponse.rawResponse.headers["x-ms-original-url"] = initialResponse.request.url;
52
+ return lroResponse;
53
+ },
54
+ };
55
+ options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true;
56
+ const httpPoller = (0, core_lro_1.createHttpPoller)(poller, options);
57
+ const simplePoller = {
58
+ isDone() {
59
+ return httpPoller.isDone;
60
+ },
61
+ isStopped() {
62
+ return abortController.signal.aborted;
63
+ },
64
+ getOperationState() {
65
+ if (!httpPoller.operationState) {
66
+ throw new Error("Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().");
67
+ }
68
+ return httpPoller.operationState;
69
+ },
70
+ getResult() {
71
+ return httpPoller.result;
72
+ },
73
+ toString() {
74
+ if (!httpPoller.operationState) {
75
+ throw new Error("Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().");
76
+ }
77
+ return JSON.stringify({
78
+ state: httpPoller.operationState,
79
+ });
80
+ },
81
+ stopPolling() {
82
+ abortController.abort();
83
+ },
84
+ onProgress: httpPoller.onProgress,
85
+ poll: httpPoller.poll,
86
+ pollUntilDone: httpPoller.pollUntilDone,
87
+ serialize: httpPoller.serialize,
88
+ submitted: httpPoller.submitted,
89
+ };
90
+ return simplePoller;
91
+ }
92
+ /**
93
+ * Converts a Rest Client response to a response that the LRO implementation understands
94
+ * @param response - a rest client http response
95
+ * @returns - An LRO response that the LRO implementation understands
96
+ */
97
+ function getLroResponse(response) {
98
+ if (Number.isNaN(response.status)) {
99
+ throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);
100
+ }
101
+ return {
102
+ flatResponse: response,
103
+ rawResponse: {
104
+ ...response,
105
+ statusCode: Number.parseInt(response.status),
106
+ body: response.body,
107
+ },
108
+ };
109
+ }
110
+ //# sourceMappingURL=pollingHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pollingHelper.js","sourceRoot":"","sources":["../../src/pollingHelper.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAsFlC,oDAoFC;AA/JD,8CAAmD;AAoEnD;;;;;;GAMG;AACI,KAAK,UAAU,oBAAoB,CACxC,MAAc,EACd,eAAwB,EACxB,UAAqE,EAAE;IAEvE,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC;IAC9C,MAAM,MAAM,GAA8B;QACxC,kBAAkB,EAAE,KAAK,IAAI,EAAE;YAC7B,sGAAsG;YACtG,2FAA2F;YAC3F,6BAA6B;YAC7B,OAAO,cAAc,CAAC,eAAe,CAAC,CAAC;QACzC,CAAC;QACD,eAAe,EAAE,KAAK,EAAE,IAAY,EAAE,WAA+C,EAAE,EAAE;YACvF,sEAAsE;YACtE,4EAA4E;YAC5E,0JAA0J;YAC1J,+GAA+G;YAC/G,SAAS,aAAa;gBACpB,eAAe,CAAC,KAAK,EAAE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;gBAC/B,MAAM,IAAI,KAAK,CACb,4IAA4I,CAC7I,CAAC;YACJ,CAAC;YACD,OAAO,UAAU,CAAC,cAAc,CAAC;QACnC,CAAC;QACD,SAAS;YACP,OAAO,UAAU,CAAC,MAAM,CAAC;QAC3B,CAAC;QACD,QAAQ;YACN,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC;gBAC/B,MAAM,IAAI,KAAK,CACb,4IAA4I,CAC7I,CAAC;YACJ,CAAC;YACD,OAAO,IAAI,CAAC,SAAS,CAAC;gBACpB,KAAK,EAAE,UAAU,CAAC,cAAc;aACjC,CAAC,CAAC;QACL,CAAC;QACD,WAAW;YACT,eAAe,CAAC,KAAK,EAAE,CAAC;QAC1B,CAAC;QACD,UAAU,EAAE,UAAU,CAAC,UAAU;QACjC,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,aAAa,EAAE,UAAU,CAAC,aAAa;QACvC,SAAS,EAAE,UAAU,CAAC,SAAS;QAC/B,SAAS,EAAE,UAAU,CAAC,SAAS;KAChC,CAAC;IACF,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;;GAIG;AACH,SAAS,cAAc,CACrB,QAAiB;IAEjB,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,SAAS,CAAC,uDAAuD,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAChG,CAAC;IAED,OAAO;QACL,YAAY,EAAE,QAAQ;QACtB,WAAW,EAAE;YACX,GAAG,QAAQ;YACX,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC5C,IAAI,EAAE,QAAQ,CAAC,IAAI;SACpB;KACF,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { Client, HttpResponse } from \"@azure-rest/core-client\";\nimport type { AbortSignalLike } from \"@azure/abort-controller\";\nimport type {\n CancelOnProgress,\n CreateHttpPollerOptions,\n RunningOperation,\n OperationResponse,\n OperationState,\n} from \"@azure/core-lro\";\nimport { createHttpPoller } from \"@azure/core-lro\";\n\n/**\n * A simple poller that can be used to poll a long running operation.\n */\nexport interface SimplePollerLike<TState extends OperationState<TResult>, TResult> {\n /**\n * Returns true if the poller has finished polling.\n */\n isDone(): boolean;\n /**\n * Returns the state of the operation.\n */\n getOperationState(): TState;\n /**\n * Returns the result value of the operation,\n * regardless of the state of the poller.\n * It can return undefined or an incomplete form of the final TResult value\n * depending on the implementation.\n */\n getResult(): TResult | undefined;\n /**\n * Returns a promise that will resolve once a single polling request finishes.\n * It does this by calling the update method of the Poller's operation.\n */\n poll(options?: { abortSignal?: AbortSignalLike }): Promise<TState>;\n /**\n * Returns a promise that will resolve once the underlying operation is completed.\n */\n pollUntilDone(pollOptions?: { abortSignal?: AbortSignalLike }): Promise<TResult>;\n /**\n * Invokes the provided callback after each polling is completed,\n * sending the current state of the poller's operation.\n *\n * It returns a method that can be used to stop receiving updates on the given callback function.\n */\n onProgress(callback: (state: TState) => void): CancelOnProgress;\n\n /**\n * Returns a promise that could be used for serialized version of the poller's operation\n * by invoking the operation's serialize method.\n */\n serialize(): Promise<string>;\n\n /**\n * Wait the poller to be submitted.\n */\n submitted(): Promise<void>;\n\n /**\n * Returns a string representation of the poller's operation. Similar to serialize but returns a string.\n * @deprecated Use serialize() instead.\n */\n toString(): string;\n\n /**\n * Stops the poller from continuing to poll. Please note this will only stop the client-side polling\n * @deprecated Use abortSignal to stop polling instead.\n */\n stopPolling(): void;\n\n /**\n * Returns true if the poller is stopped.\n * @deprecated Use abortSignal status to track this instead.\n */\n isStopped(): boolean;\n}\n\n/**\n * Helper function that builds a Poller object to help polling a long running operation.\n * @param client - Client to use for sending the request to get additional pages.\n * @param initialResponse - The initial response.\n * @param options - Options to set a resume state or custom polling interval.\n * @returns - A poller object to poll for operation state updates and eventually get the final response.\n */\nexport async function getLongRunningPoller<TResult extends HttpResponse>(\n client: Client,\n initialResponse: TResult,\n options: CreateHttpPollerOptions<TResult, OperationState<TResult>> = {},\n): Promise<SimplePollerLike<OperationState<TResult>, TResult>> {\n const abortController = new AbortController();\n const poller: RunningOperation<TResult> = {\n sendInitialRequest: async () => {\n // In the case of Rest Clients we are building the LRO poller object from a response that's the reason\n // we are not triggering the initial request here, just extracting the information from the\n // response we were provided.\n return getLroResponse(initialResponse);\n },\n sendPollRequest: async (path: string, pollOptions?: { abortSignal?: AbortSignalLike }) => {\n // This is the callback that is going to be called to poll the service\n // to get the latest status. We use the client provided and the polling path\n // which is an opaque URL provided by caller, the service sends this in one of the following headers: operation-location, azure-asyncoperation or location\n // depending on the lro pattern that the service implements. If non is provided we default to the initial path.\n function abortListener(): void {\n abortController.abort();\n }\n const inputAbortSignal = pollOptions?.abortSignal;\n const abortSignal = abortController.signal;\n if (inputAbortSignal?.aborted) {\n abortController.abort();\n } else if (!abortSignal.aborted) {\n inputAbortSignal?.addEventListener(\"abort\", abortListener, {\n once: true,\n });\n }\n let response;\n try {\n response = await client\n .pathUnchecked(path ?? initialResponse.request.url)\n .get({ abortSignal });\n } finally {\n inputAbortSignal?.removeEventListener(\"abort\", abortListener);\n }\n const lroResponse = getLroResponse(response as TResult);\n lroResponse.rawResponse.headers[\"x-ms-original-url\"] = initialResponse.request.url;\n return lroResponse;\n },\n };\n\n options.resolveOnUnsuccessful = options.resolveOnUnsuccessful ?? true;\n const httpPoller = createHttpPoller(poller, options);\n const simplePoller: SimplePollerLike<OperationState<TResult>, TResult> = {\n isDone() {\n return httpPoller.isDone;\n },\n isStopped() {\n return abortController.signal.aborted;\n },\n getOperationState() {\n if (!httpPoller.operationState) {\n throw new Error(\n \"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().\",\n );\n }\n return httpPoller.operationState;\n },\n getResult() {\n return httpPoller.result;\n },\n toString() {\n if (!httpPoller.operationState) {\n throw new Error(\n \"Operation state is not available. The poller may not have been started and you could await submitted() before calling getOperationState().\",\n );\n }\n return JSON.stringify({\n state: httpPoller.operationState,\n });\n },\n stopPolling() {\n abortController.abort();\n },\n onProgress: httpPoller.onProgress,\n poll: httpPoller.poll,\n pollUntilDone: httpPoller.pollUntilDone,\n serialize: httpPoller.serialize,\n submitted: httpPoller.submitted,\n };\n return simplePoller;\n}\n\n/**\n * Converts a Rest Client response to a response that the LRO implementation understands\n * @param response - a rest client http response\n * @returns - An LRO response that the LRO implementation understands\n */\nfunction getLroResponse<TResult extends HttpResponse>(\n response: TResult,\n): OperationResponse<TResult> {\n if (Number.isNaN(response.status)) {\n throw new TypeError(`Status code of the response is not a number. Value: ${response.status}`);\n }\n\n return {\n flatResponse: response,\n rawResponse: {\n ...response,\n statusCode: Number.parseInt(response.status),\n body: response.body,\n },\n };\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import type { ClientOptions } from "@azure-rest/core-client";
2
+ import type { TokenCredential } from "@azure/core-auth";
3
+ import type { PurviewSharingClient } from "./clientDefinitions.js";
4
+ /** The optional parameters for the client */
5
+ export interface PurviewSharingClientOptions extends ClientOptions {
6
+ /** The api version option of the client */
7
+ apiVersion?: string;
8
+ }
9
+ /**
10
+ * Initialize a new instance of `PurviewSharingClient`
11
+ * @param endpoint - The sharing endpoint of your purview account. Example: https://{accountName}.purview.azure.com/share
12
+ * @param credentials - uniquely identify client credential
13
+ * @param options - the parameter for all optional parameters
14
+ */
15
+ export default function createClient(endpoint: string, credentials: TokenCredential, { apiVersion, ...options }?: PurviewSharingClientOptions): PurviewSharingClient;
16
+ //# sourceMappingURL=purviewSharing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"purviewSharing.d.ts","sourceRoot":"","sources":["../../src/purviewSharing.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAEnE,6CAA6C;AAC7C,MAAM,WAAW,2BAA4B,SAAQ,aAAa;IAChE,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,eAAe,EAC5B,EAAE,UAAiC,EAAE,GAAG,OAAO,EAAE,GAAE,2BAAgC,GAClF,oBAAoB,CAuCtB"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ // Copyright (c) Microsoft Corporation.
3
+ // Licensed under the MIT License.
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.default = createClient;
6
+ const core_client_1 = require("@azure-rest/core-client");
7
+ const logger_js_1 = require("./logger.js");
8
+ /**
9
+ * Initialize a new instance of `PurviewSharingClient`
10
+ * @param endpoint - The sharing endpoint of your purview account. Example: https://{accountName}.purview.azure.com/share
11
+ * @param credentials - uniquely identify client credential
12
+ * @param options - the parameter for all optional parameters
13
+ */
14
+ function createClient(endpoint, credentials, { apiVersion = "2023-05-30-preview", ...options } = {}) {
15
+ const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpoint}`;
16
+ const userAgentInfo = `azsdk-js-purview-sharing-rest/1.0.0-beta.4`;
17
+ const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
18
+ ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
19
+ : `${userAgentInfo}`;
20
+ options = {
21
+ ...options,
22
+ userAgentOptions: {
23
+ userAgentPrefix,
24
+ },
25
+ loggingOptions: {
26
+ logger: options.loggingOptions?.logger ?? logger_js_1.logger.info,
27
+ },
28
+ credentials: {
29
+ scopes: ["https://purview.azure.net/.default"],
30
+ },
31
+ };
32
+ const client = (0, core_client_1.getClient)(endpointUrl, credentials, options);
33
+ client.pipeline.removePolicy({ name: "ApiVersionPolicy" });
34
+ client.pipeline.addPolicy({
35
+ name: "ClientApiVersionPolicy",
36
+ sendRequest: (req, next) => {
37
+ // Use the apiVersion defined in request url directly
38
+ // Append one if there is no apiVersion and we have one at client options
39
+ const url = new URL(req.url);
40
+ if (!url.searchParams.get("api-version") && apiVersion) {
41
+ req.url = `${req.url}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?"}api-version=${apiVersion}`;
42
+ }
43
+ return next(req);
44
+ },
45
+ });
46
+ return client;
47
+ }
48
+ //# sourceMappingURL=purviewSharing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"purviewSharing.js","sourceRoot":"","sources":["../../src/purviewSharing.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAoBlC,+BA2CC;AA5DD,yDAAoD;AACpD,2CAAqC;AAUrC;;;;;GAKG;AACH,SAAwB,YAAY,CAClC,QAAgB,EAChB,WAA4B,EAC5B,EAAE,UAAU,GAAG,oBAAoB,EAAE,GAAG,OAAO,KAAkC,EAAE;IAEnF,MAAM,WAAW,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,OAAO,IAAI,GAAG,QAAQ,EAAE,CAAC;IACzE,MAAM,aAAa,GAAG,4CAA4C,CAAC;IACnE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;QAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,aAAa,EAAE;QAChE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC;IACzB,OAAO,GAAG;QACR,GAAG,OAAO;QACV,gBAAgB,EAAE;YAChB,eAAe;SAChB;QACD,cAAc,EAAE;YACd,MAAM,EAAE,OAAO,CAAC,cAAc,EAAE,MAAM,IAAI,kBAAM,CAAC,IAAI;SACtD;QACD,WAAW,EAAE;YACX,MAAM,EAAE,CAAC,oCAAoC,CAAC;SAC/C;KACF,CAAC;IACF,MAAM,MAAM,GAAG,IAAA,uBAAS,EAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAAyB,CAAC;IAEpF,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC3D,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;QACxB,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACzB,qDAAqD;YACrD,yEAAyE;YACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,UAAU,EAAE,CAAC;gBACvD,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAClB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YAED,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport { getClient } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger.js\";\nimport type { TokenCredential } from \"@azure/core-auth\";\nimport type { PurviewSharingClient } from \"./clientDefinitions.js\";\n\n/** The optional parameters for the client */\nexport interface PurviewSharingClientOptions extends ClientOptions {\n /** The api version option of the client */\n apiVersion?: string;\n}\n\n/**\n * Initialize a new instance of `PurviewSharingClient`\n * @param endpoint - The sharing endpoint of your purview account. Example: https://{accountName}.purview.azure.com/share\n * @param credentials - uniquely identify client credential\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpoint: string,\n credentials: TokenCredential,\n { apiVersion = \"2023-05-30-preview\", ...options }: PurviewSharingClientOptions = {},\n): PurviewSharingClient {\n const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpoint}`;\n const userAgentInfo = `azsdk-js-purview-sharing-rest/1.0.0-beta.4`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info,\n },\n credentials: {\n scopes: [\"https://purview.azure.net/.default\"],\n },\n };\n const client = getClient(endpointUrl, credentials, options) as PurviewSharingClient;\n\n client.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n client.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n if (!url.searchParams.get(\"api-version\") && apiVersion) {\n req.url = `${req.url}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${apiVersion}`;\n }\n\n return next(req);\n },\n });\n\n return client;\n}\n"]}