@azure/arm-cognitiveservices 6.1.0 → 7.0.1-alpha.20211221.2

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 (249) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/{LICENSE.txt → LICENSE} +1 -1
  3. package/README.md +70 -82
  4. package/dist/index.js +4800 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/index.min.js +1 -0
  7. package/dist/index.min.js.map +1 -0
  8. package/dist-esm/src/cognitiveServicesManagementClient.d.ts +42 -0
  9. package/dist-esm/src/cognitiveServicesManagementClient.d.ts.map +1 -0
  10. package/dist-esm/src/cognitiveServicesManagementClient.js +133 -0
  11. package/dist-esm/src/cognitiveServicesManagementClient.js.map +1 -0
  12. package/dist-esm/src/index.d.ts +5 -0
  13. package/dist-esm/src/index.d.ts.map +1 -0
  14. package/dist-esm/src/index.js +12 -0
  15. package/dist-esm/src/index.js.map +1 -0
  16. package/dist-esm/src/lroImpl.d.ts +16 -0
  17. package/dist-esm/src/lroImpl.d.ts.map +1 -0
  18. package/dist-esm/src/lroImpl.js +29 -0
  19. package/dist-esm/src/lroImpl.js.map +1 -0
  20. package/dist-esm/src/models/index.d.ts +1310 -0
  21. package/dist-esm/src/models/index.d.ts.map +1 -0
  22. package/dist-esm/src/models/index.js +128 -0
  23. package/dist-esm/src/models/index.js.map +1 -0
  24. package/dist-esm/src/models/mappers.d.ts +68 -0
  25. package/dist-esm/src/models/mappers.d.ts.map +1 -0
  26. package/{esm → dist-esm/src}/models/mappers.js +964 -1092
  27. package/dist-esm/src/models/mappers.js.map +1 -0
  28. package/dist-esm/src/models/parameters.d.ts +26 -0
  29. package/dist-esm/src/models/parameters.d.ts.map +1 -0
  30. package/dist-esm/src/models/parameters.js +199 -0
  31. package/dist-esm/src/models/parameters.js.map +1 -0
  32. package/dist-esm/src/operations/accounts.d.ts +138 -0
  33. package/dist-esm/src/operations/accounts.d.ts.map +1 -0
  34. package/dist-esm/src/operations/accounts.js +628 -0
  35. package/dist-esm/src/operations/accounts.js.map +1 -0
  36. package/dist-esm/src/operations/commitmentPlans.d.ts +76 -0
  37. package/dist-esm/src/operations/commitmentPlans.d.ts.map +1 -0
  38. package/dist-esm/src/operations/commitmentPlans.js +293 -0
  39. package/dist-esm/src/operations/commitmentPlans.js.map +1 -0
  40. package/dist-esm/src/operations/commitmentTiers.d.ts +35 -0
  41. package/dist-esm/src/operations/commitmentTiers.d.ts.map +1 -0
  42. package/dist-esm/src/operations/commitmentTiers.js +132 -0
  43. package/dist-esm/src/operations/commitmentTiers.js.map +1 -0
  44. package/dist-esm/src/operations/deletedAccounts.d.ts +57 -0
  45. package/dist-esm/src/operations/deletedAccounts.d.ts.map +1 -0
  46. package/dist-esm/src/operations/deletedAccounts.js +232 -0
  47. package/dist-esm/src/operations/deletedAccounts.js.map +1 -0
  48. package/dist-esm/src/operations/deployments.d.ts +81 -0
  49. package/dist-esm/src/operations/deployments.d.ts.map +1 -0
  50. package/dist-esm/src/operations/deployments.js +331 -0
  51. package/dist-esm/src/operations/deployments.js.map +1 -0
  52. package/{esm → dist-esm/src}/operations/index.d.ts +0 -0
  53. package/dist-esm/src/operations/index.d.ts.map +1 -0
  54. package/{esm → dist-esm/src}/operations/index.js +1 -2
  55. package/dist-esm/src/operations/index.js.map +1 -0
  56. package/dist-esm/src/operations/operations.d.ts +32 -0
  57. package/dist-esm/src/operations/operations.d.ts.map +1 -0
  58. package/dist-esm/src/operations/operations.js +120 -0
  59. package/dist-esm/src/operations/operations.js.map +1 -0
  60. package/dist-esm/src/operations/privateEndpointConnections.d.ts +70 -0
  61. package/dist-esm/src/operations/privateEndpointConnections.d.ts.map +1 -0
  62. package/dist-esm/src/operations/privateEndpointConnections.js +271 -0
  63. package/dist-esm/src/operations/privateEndpointConnections.js.map +1 -0
  64. package/dist-esm/src/operations/privateLinkResources.d.ts +20 -0
  65. package/dist-esm/src/operations/privateLinkResources.d.ts.map +1 -0
  66. package/dist-esm/src/operations/privateLinkResources.js +53 -0
  67. package/dist-esm/src/operations/privateLinkResources.js.map +1 -0
  68. package/dist-esm/src/operations/resourceSkus.d.ts +32 -0
  69. package/dist-esm/src/operations/resourceSkus.d.ts.map +1 -0
  70. package/dist-esm/src/operations/resourceSkus.js +124 -0
  71. package/dist-esm/src/operations/resourceSkus.js.map +1 -0
  72. package/dist-esm/src/operationsInterfaces/accounts.d.ts +102 -0
  73. package/dist-esm/src/operationsInterfaces/accounts.d.ts.map +1 -0
  74. package/{esm/models/index.js → dist-esm/src/operationsInterfaces/accounts.js} +2 -1
  75. package/dist-esm/src/operationsInterfaces/accounts.js.map +1 -0
  76. package/dist-esm/src/operationsInterfaces/commitmentPlans.d.ts +51 -0
  77. package/dist-esm/src/operationsInterfaces/commitmentPlans.d.ts.map +1 -0
  78. package/{src/models/operationsMappers.ts → dist-esm/src/operationsInterfaces/commitmentPlans.js} +2 -9
  79. package/dist-esm/src/operationsInterfaces/commitmentPlans.js.map +1 -0
  80. package/dist-esm/src/operationsInterfaces/commitmentTiers.d.ts +12 -0
  81. package/dist-esm/src/operationsInterfaces/commitmentTiers.d.ts.map +1 -0
  82. package/{src/models/commitmentTiersMappers.ts → dist-esm/src/operationsInterfaces/commitmentTiers.js} +2 -10
  83. package/dist-esm/src/operationsInterfaces/commitmentTiers.js.map +1 -0
  84. package/dist-esm/src/operationsInterfaces/deletedAccounts.d.ts +36 -0
  85. package/dist-esm/src/operationsInterfaces/deletedAccounts.d.ts.map +1 -0
  86. package/{esm/models/operationsMappers.js → dist-esm/src/operationsInterfaces/deletedAccounts.js} +2 -2
  87. package/dist-esm/src/operationsInterfaces/deletedAccounts.js.map +1 -0
  88. package/dist-esm/src/operationsInterfaces/deployments.d.ts +56 -0
  89. package/dist-esm/src/operationsInterfaces/deployments.d.ts.map +1 -0
  90. package/dist-esm/src/operationsInterfaces/deployments.js +9 -0
  91. package/dist-esm/src/operationsInterfaces/deployments.js.map +1 -0
  92. package/dist-esm/src/operationsInterfaces/index.d.ts +10 -0
  93. package/dist-esm/src/operationsInterfaces/index.d.ts.map +1 -0
  94. package/dist-esm/src/operationsInterfaces/index.js +17 -0
  95. package/dist-esm/src/operationsInterfaces/index.js.map +1 -0
  96. package/dist-esm/src/operationsInterfaces/operations.d.ts +11 -0
  97. package/dist-esm/src/operationsInterfaces/operations.d.ts.map +1 -0
  98. package/dist-esm/src/operationsInterfaces/operations.js +9 -0
  99. package/dist-esm/src/operationsInterfaces/operations.js.map +1 -0
  100. package/dist-esm/src/operationsInterfaces/privateEndpointConnections.d.ts +62 -0
  101. package/dist-esm/src/operationsInterfaces/privateEndpointConnections.d.ts.map +1 -0
  102. package/dist-esm/src/operationsInterfaces/privateEndpointConnections.js +9 -0
  103. package/dist-esm/src/operationsInterfaces/privateEndpointConnections.js.map +1 -0
  104. package/dist-esm/src/operationsInterfaces/privateLinkResources.d.ts +12 -0
  105. package/dist-esm/src/operationsInterfaces/privateLinkResources.d.ts.map +1 -0
  106. package/dist-esm/src/operationsInterfaces/privateLinkResources.js +9 -0
  107. package/dist-esm/src/operationsInterfaces/privateLinkResources.js.map +1 -0
  108. package/dist-esm/src/operationsInterfaces/resourceSkus.d.ts +11 -0
  109. package/dist-esm/src/operationsInterfaces/resourceSkus.d.ts.map +1 -0
  110. package/dist-esm/src/operationsInterfaces/resourceSkus.js +9 -0
  111. package/dist-esm/src/operationsInterfaces/resourceSkus.js.map +1 -0
  112. package/dist-esm/test/cognitiveservices_examples.d.ts +4 -0
  113. package/dist-esm/test/cognitiveservices_examples.d.ts.map +1 -0
  114. package/dist-esm/test/cognitiveservices_examples.js +127 -0
  115. package/dist-esm/test/cognitiveservices_examples.js.map +1 -0
  116. package/package.json +65 -22
  117. package/review/arm-cognitiveservices.api.md +1150 -0
  118. package/rollup.config.js +181 -30
  119. package/src/cognitiveServicesManagementClient.ts +157 -153
  120. package/src/{models/resourceSkusMappers.ts → index.ts} +4 -9
  121. package/src/lroImpl.ts +34 -0
  122. package/src/models/index.ts +1063 -1831
  123. package/src/models/mappers.ts +1021 -1150
  124. package/src/models/parameters.ts +151 -54
  125. package/src/operations/accounts.ts +613 -497
  126. package/src/operations/commitmentPlans.ts +253 -203
  127. package/src/operations/commitmentTiers.ts +105 -80
  128. package/src/operations/deletedAccounts.ts +209 -161
  129. package/src/operations/deployments.ts +325 -193
  130. package/src/operations/index.ts +1 -2
  131. package/src/operations/operations.ts +85 -73
  132. package/src/operations/privateEndpointConnections.ts +257 -164
  133. package/src/operations/privateLinkResources.ts +37 -51
  134. package/src/operations/resourceSkus.ts +90 -76
  135. package/src/operationsInterfaces/accounts.ts +195 -0
  136. package/src/operationsInterfaces/commitmentPlans.ts +93 -0
  137. package/src/operationsInterfaces/commitmentTiers.ts +24 -0
  138. package/src/operationsInterfaces/deletedAccounts.ts +68 -0
  139. package/src/operationsInterfaces/deployments.ts +109 -0
  140. package/src/operationsInterfaces/index.ts +17 -0
  141. package/src/operationsInterfaces/operations.ts +22 -0
  142. package/src/operationsInterfaces/privateEndpointConnections.ts +115 -0
  143. package/src/operationsInterfaces/privateLinkResources.ts +27 -0
  144. package/src/operationsInterfaces/resourceSkus.ts +22 -0
  145. package/tsconfig.json +3 -3
  146. package/types/arm-cognitiveservices.d.ts +1860 -0
  147. package/types/tsdoc-metadata.json +11 -0
  148. package/dist/arm-cognitiveservices.js +0 -4713
  149. package/dist/arm-cognitiveservices.js.map +0 -1
  150. package/dist/arm-cognitiveservices.min.js +0 -1
  151. package/dist/arm-cognitiveservices.min.js.map +0 -1
  152. package/esm/cognitiveServicesManagementClient.d.ts +0 -80
  153. package/esm/cognitiveServicesManagementClient.d.ts.map +0 -1
  154. package/esm/cognitiveServicesManagementClient.js +0 -128
  155. package/esm/cognitiveServicesManagementClient.js.map +0 -1
  156. package/esm/cognitiveServicesManagementClientContext.d.ts +0 -22
  157. package/esm/cognitiveServicesManagementClientContext.d.ts.map +0 -1
  158. package/esm/cognitiveServicesManagementClientContext.js +0 -60
  159. package/esm/cognitiveServicesManagementClientContext.js.map +0 -1
  160. package/esm/models/accountsMappers.d.ts +0 -2
  161. package/esm/models/accountsMappers.d.ts.map +0 -1
  162. package/esm/models/accountsMappers.js +0 -9
  163. package/esm/models/accountsMappers.js.map +0 -1
  164. package/esm/models/commitmentPlansMappers.d.ts +0 -2
  165. package/esm/models/commitmentPlansMappers.d.ts.map +0 -1
  166. package/esm/models/commitmentPlansMappers.js +0 -9
  167. package/esm/models/commitmentPlansMappers.js.map +0 -1
  168. package/esm/models/commitmentTiersMappers.d.ts +0 -2
  169. package/esm/models/commitmentTiersMappers.d.ts.map +0 -1
  170. package/esm/models/commitmentTiersMappers.js +0 -9
  171. package/esm/models/commitmentTiersMappers.js.map +0 -1
  172. package/esm/models/deletedAccountsMappers.d.ts +0 -2
  173. package/esm/models/deletedAccountsMappers.d.ts.map +0 -1
  174. package/esm/models/deletedAccountsMappers.js +0 -9
  175. package/esm/models/deletedAccountsMappers.js.map +0 -1
  176. package/esm/models/deploymentsMappers.d.ts +0 -2
  177. package/esm/models/deploymentsMappers.d.ts.map +0 -1
  178. package/esm/models/deploymentsMappers.js +0 -9
  179. package/esm/models/deploymentsMappers.js.map +0 -1
  180. package/esm/models/index.d.ts +0 -2102
  181. package/esm/models/index.d.ts.map +0 -1
  182. package/esm/models/index.js.map +0 -1
  183. package/esm/models/mappers.d.ts +0 -71
  184. package/esm/models/mappers.d.ts.map +0 -1
  185. package/esm/models/mappers.js.map +0 -1
  186. package/esm/models/operationsMappers.d.ts +0 -2
  187. package/esm/models/operationsMappers.d.ts.map +0 -1
  188. package/esm/models/operationsMappers.js.map +0 -1
  189. package/esm/models/parameters.d.ts +0 -13
  190. package/esm/models/parameters.d.ts.map +0 -1
  191. package/esm/models/parameters.js +0 -137
  192. package/esm/models/parameters.js.map +0 -1
  193. package/esm/models/privateEndpointConnectionsMappers.d.ts +0 -2
  194. package/esm/models/privateEndpointConnectionsMappers.d.ts.map +0 -1
  195. package/esm/models/privateEndpointConnectionsMappers.js +0 -9
  196. package/esm/models/privateEndpointConnectionsMappers.js.map +0 -1
  197. package/esm/models/privateLinkResourcesMappers.d.ts +0 -2
  198. package/esm/models/privateLinkResourcesMappers.d.ts.map +0 -1
  199. package/esm/models/privateLinkResourcesMappers.js +0 -9
  200. package/esm/models/privateLinkResourcesMappers.js.map +0 -1
  201. package/esm/models/resourceSkusMappers.d.ts +0 -2
  202. package/esm/models/resourceSkusMappers.d.ts.map +0 -1
  203. package/esm/models/resourceSkusMappers.js +0 -9
  204. package/esm/models/resourceSkusMappers.js.map +0 -1
  205. package/esm/operations/accounts.d.ts +0 -245
  206. package/esm/operations/accounts.d.ts.map +0 -1
  207. package/esm/operations/accounts.js +0 -476
  208. package/esm/operations/accounts.js.map +0 -1
  209. package/esm/operations/commitmentPlans.d.ts +0 -130
  210. package/esm/operations/commitmentPlans.d.ts.map +0 -1
  211. package/esm/operations/commitmentPlans.js +0 -216
  212. package/esm/operations/commitmentPlans.js.map +0 -1
  213. package/esm/operations/commitmentTiers.d.ts +0 -49
  214. package/esm/operations/commitmentTiers.d.ts.map +0 -1
  215. package/esm/operations/commitmentTiers.js +0 -84
  216. package/esm/operations/commitmentTiers.js.map +0 -1
  217. package/esm/operations/deletedAccounts.d.ts +0 -89
  218. package/esm/operations/deletedAccounts.d.ts.map +0 -1
  219. package/esm/operations/deletedAccounts.js +0 -168
  220. package/esm/operations/deletedAccounts.js.map +0 -1
  221. package/esm/operations/deployments.d.ts +0 -115
  222. package/esm/operations/deployments.d.ts.map +0 -1
  223. package/esm/operations/deployments.js +0 -236
  224. package/esm/operations/deployments.js.map +0 -1
  225. package/esm/operations/index.d.ts.map +0 -1
  226. package/esm/operations/index.js.map +0 -1
  227. package/esm/operations/operations.d.ts +0 -46
  228. package/esm/operations/operations.d.ts.map +0 -1
  229. package/esm/operations/operations.js +0 -79
  230. package/esm/operations/operations.js.map +0 -1
  231. package/esm/operations/privateEndpointConnections.d.ts +0 -108
  232. package/esm/operations/privateEndpointConnections.d.ts.map +0 -1
  233. package/esm/operations/privateEndpointConnections.js +0 -215
  234. package/esm/operations/privateEndpointConnections.js.map +0 -1
  235. package/esm/operations/privateLinkResources.d.ts +0 -34
  236. package/esm/operations/privateLinkResources.d.ts.map +0 -1
  237. package/esm/operations/privateLinkResources.js +0 -57
  238. package/esm/operations/privateLinkResources.js.map +0 -1
  239. package/esm/operations/resourceSkus.d.ts +0 -46
  240. package/esm/operations/resourceSkus.d.ts.map +0 -1
  241. package/esm/operations/resourceSkus.js +0 -82
  242. package/esm/operations/resourceSkus.js.map +0 -1
  243. package/src/cognitiveServicesManagementClientContext.ts +0 -67
  244. package/src/models/accountsMappers.ts +0 -59
  245. package/src/models/commitmentPlansMappers.ts +0 -52
  246. package/src/models/deletedAccountsMappers.ts +0 -52
  247. package/src/models/deploymentsMappers.ts +0 -52
  248. package/src/models/privateEndpointConnectionsMappers.ts +0 -52
  249. package/src/models/privateLinkResourcesMappers.ts +0 -52
package/rollup.config.js CHANGED
@@ -1,37 +1,188 @@
1
- import rollup from "rollup";
2
- import nodeResolve from "rollup-plugin-node-resolve";
3
- import sourcemaps from "rollup-plugin-sourcemaps";
4
-
5
- /**
6
- * @type {rollup.RollupFileOptions}
7
- */
8
- const config = {
9
- input: "./esm/cognitiveServicesManagementClient.js",
10
- external: [
11
- "@azure/ms-rest-js",
12
- "@azure/ms-rest-azure-js"
13
- ],
14
- output: {
15
- file: "./dist/arm-cognitiveservices.js",
16
- format: "umd",
17
- name: "Azure.ArmCognitiveservices",
18
- sourcemap: true,
19
- globals: {
20
- "@azure/ms-rest-js": "msRest",
21
- "@azure/ms-rest-azure-js": "msRestAzure"
22
- },
23
- banner: `/*
1
+ /*
24
2
  * Copyright (c) Microsoft Corporation.
25
3
  * Licensed under the MIT License.
26
4
  *
27
5
  * Code generated by Microsoft (R) AutoRest Code Generator.
28
6
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
29
- */`
30
- },
31
- plugins: [
32
- nodeResolve({ mainFields: ['module', 'main'] }),
33
- sourcemaps()
34
- ]
7
+ */
8
+
9
+ import nodeResolve from "@rollup/plugin-node-resolve";
10
+ import cjs from "@rollup/plugin-commonjs";
11
+ import sourcemaps from "rollup-plugin-sourcemaps";
12
+ import multiEntry from "@rollup/plugin-multi-entry";
13
+ import json from "@rollup/plugin-json";
14
+
15
+ import nodeBuiltins from "builtin-modules";
16
+
17
+ /**
18
+ * Gets the proper configuration needed for rollup's commonJS plugin for @opentelemetry/api.
19
+ *
20
+ * NOTE: this manual configuration is only needed because OpenTelemetry uses an
21
+ * __exportStar downleveled helper function to declare its exports which confuses
22
+ * rollup's automatic discovery mechanism.
23
+ *
24
+ * @returns an object reference that can be `...`'d into your cjs() configuration.
25
+ */
26
+ export function openTelemetryCommonJs() {
27
+ const namedExports = {};
28
+
29
+ for (const key of [
30
+ "@opentelemetry/api",
31
+ "@azure/core-tracing/node_modules/@opentelemetry/api"
32
+ ]) {
33
+ namedExports[key] = [
34
+ "SpanKind",
35
+ "TraceFlags",
36
+ "getSpan",
37
+ "setSpan",
38
+ "SpanStatusCode",
39
+ "getSpanContext",
40
+ "setSpanContext"
41
+ ];
42
+ }
43
+
44
+ const releasedOpenTelemetryVersions = ["0.10.2", "1.0.0-rc.0"];
45
+
46
+ for (const version of releasedOpenTelemetryVersions) {
47
+ namedExports[
48
+ // working around a limitation in the rollup common.js plugin - it's not able to resolve these modules so the named exports listed above will not get applied. We have to drill down to the actual path.
49
+ `../../../common/temp/node_modules/.pnpm/@opentelemetry/api@${version}/node_modules/@opentelemetry/api/build/src/index.js`
50
+ ] = [
51
+ "SpanKind",
52
+ "TraceFlags",
53
+ "getSpan",
54
+ "setSpan",
55
+ "StatusCode",
56
+ "CanonicalCode",
57
+ "getSpanContext",
58
+ "setSpanContext"
59
+ ];
60
+ }
61
+
62
+ return namedExports;
63
+ }
64
+
65
+ // #region Warning Handler
66
+
67
+ /**
68
+ * A function that can determine whether a rollupwarning should be ignored. If
69
+ * the function returns `true`, then the warning will not be displayed.
70
+ */
71
+
72
+ function ignoreNiseSinonEvalWarnings(warning) {
73
+ return (
74
+ warning.code === "EVAL" &&
75
+ warning.id &&
76
+ (warning.id.includes("node_modules/nise") ||
77
+ warning.id.includes("node_modules/sinon")) === true
78
+ );
79
+ }
80
+
81
+ function ignoreChaiCircularDependencyWarnings(warning) {
82
+ return (
83
+ warning.code === "CIRCULAR_DEPENDENCY" &&
84
+ warning.importer && warning.importer.includes("node_modules/chai") === true
85
+ );
86
+ }
87
+
88
+ const warningInhibitors = [
89
+ ignoreChaiCircularDependencyWarnings,
90
+ ignoreNiseSinonEvalWarnings
91
+ ];
92
+
93
+ /**
94
+ * Construct a warning handler for the shared rollup configuration
95
+ * that ignores certain warnings that are not relevant to testing.
96
+ */
97
+ function makeOnWarnForTesting() {
98
+ return (warning, warn) => {
99
+ // If every inhibitor returns false (i.e. no inhibitors), then show the warning
100
+ if (warningInhibitors.every((inhib) => !inhib(warning))) {
101
+ warn(warning);
102
+ }
103
+ };
104
+ }
105
+
106
+ // #endregion
107
+
108
+ function makeBrowserTestConfig() {
109
+ const config = {
110
+ input: {
111
+ include: ["dist-esm/test/**/*.spec.js"],
112
+ exclude: ["dist-esm/test/**/node/**"]
113
+ },
114
+ output: {
115
+ file: `dist-test/index.browser.js`,
116
+ format: "umd",
117
+ sourcemap: true
118
+ },
119
+ preserveSymlinks: false,
120
+ plugins: [
121
+ multiEntry({ exports: false }),
122
+ nodeResolve({
123
+ mainFields: ["module", "browser"]
124
+ }),
125
+ cjs({
126
+ namedExports: {
127
+ // Chai's strange internal architecture makes it impossible to statically
128
+ // analyze its exports.
129
+ chai: [
130
+ "version",
131
+ "use",
132
+ "util",
133
+ "config",
134
+ "expect",
135
+ "should",
136
+ "assert"
137
+ ],
138
+ ...openTelemetryCommonJs()
139
+ }
140
+ }),
141
+ json(),
142
+ sourcemaps()
143
+ //viz({ filename: "dist-test/browser-stats.html", sourcemap: true })
144
+ ],
145
+ onwarn: makeOnWarnForTesting(),
146
+ // Disable tree-shaking of test code. In rollup-plugin-node-resolve@5.0.0,
147
+ // rollup started respecting the "sideEffects" field in package.json. Since
148
+ // our package.json sets "sideEffects=false", this also applies to test
149
+ // code, which causes all tests to be removed by tree-shaking.
150
+ treeshake: false
151
+ };
152
+
153
+ return config;
154
+ }
155
+
156
+ const defaultConfigurationOptions = {
157
+ disableBrowserBundle: false
35
158
  };
36
159
 
37
- export default config;
160
+ export function makeConfig(pkg, options) {
161
+ options = {
162
+ ...defaultConfigurationOptions,
163
+ ...(options || {})
164
+ };
165
+
166
+ const baseConfig = {
167
+ // Use the package's module field if it has one
168
+ input: pkg["module"] || "dist-esm/src/index.js",
169
+ external: [
170
+ ...nodeBuiltins,
171
+ ...Object.keys(pkg.dependencies),
172
+ ...Object.keys(pkg.devDependencies)
173
+ ],
174
+ output: { file: "dist/index.js", format: "cjs", sourcemap: true },
175
+ preserveSymlinks: false,
176
+ plugins: [sourcemaps(), nodeResolve(), cjs()]
177
+ };
178
+
179
+ const config = [baseConfig];
180
+
181
+ if (!options.disableBrowserBundle) {
182
+ config.push(makeBrowserTestConfig());
183
+ }
184
+
185
+ return config;
186
+ }
187
+
188
+ export default makeConfig(require("./package.json"));
@@ -3,53 +3,108 @@
3
3
  * Licensed under the MIT License.
4
4
  *
5
5
  * Code generated by Microsoft (R) AutoRest Code Generator.
6
- * Changes may cause incorrect behavior and will be lost if the code is
7
- * regenerated.
6
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
7
  */
9
8
 
10
- import * as msRest from "@azure/ms-rest-js";
11
- import { TokenCredential } from "@azure/core-auth";
12
- import * as Models from "./models";
13
- import * as Mappers from "./models/mappers";
9
+ import * as coreClient from "@azure/core-client";
10
+ import * as coreAuth from "@azure/core-auth";
11
+ import {
12
+ AccountsImpl,
13
+ DeletedAccountsImpl,
14
+ ResourceSkusImpl,
15
+ OperationsImpl,
16
+ CommitmentTiersImpl,
17
+ PrivateEndpointConnectionsImpl,
18
+ PrivateLinkResourcesImpl,
19
+ DeploymentsImpl,
20
+ CommitmentPlansImpl
21
+ } from "./operations";
22
+ import {
23
+ Accounts,
24
+ DeletedAccounts,
25
+ ResourceSkus,
26
+ Operations,
27
+ CommitmentTiers,
28
+ PrivateEndpointConnections,
29
+ PrivateLinkResources,
30
+ Deployments,
31
+ CommitmentPlans
32
+ } from "./operationsInterfaces";
14
33
  import * as Parameters from "./models/parameters";
15
- import * as operations from "./operations";
16
- import { CognitiveServicesManagementClientContext } from "./cognitiveServicesManagementClientContext";
17
-
34
+ import * as Mappers from "./models/mappers";
35
+ import {
36
+ CognitiveServicesManagementClientOptionalParams,
37
+ CheckSkuAvailabilityOptionalParams,
38
+ CheckSkuAvailabilityResponse,
39
+ CheckDomainAvailabilityOptionalParams,
40
+ CheckDomainAvailabilityResponse
41
+ } from "./models";
18
42
 
19
- class CognitiveServicesManagementClient extends CognitiveServicesManagementClientContext {
20
- // Operation groups
21
- accounts: operations.Accounts;
22
- deletedAccounts: operations.DeletedAccounts;
23
- resourceSkus: operations.ResourceSkus;
24
- operations: operations.Operations;
25
- commitmentTiers: operations.CommitmentTiers;
26
- privateEndpointConnections: operations.PrivateEndpointConnections;
27
- privateLinkResources: operations.PrivateLinkResources;
28
- deployments: operations.Deployments;
29
- commitmentPlans: operations.CommitmentPlans;
43
+ export class CognitiveServicesManagementClient extends coreClient.ServiceClient {
44
+ $host: string;
45
+ apiVersion: string;
46
+ subscriptionId: string;
30
47
 
31
48
  /**
32
49
  * Initializes a new instance of the CognitiveServicesManagementClient class.
33
- * @param credentials Credentials needed for the client to connect to Azure. Credentials
34
- * implementing the TokenCredential interface from the @azure/identity package are recommended. For
35
- * more information about these credentials, see
36
- * {@link https://www.npmjs.com/package/@azure/identity}. Credentials implementing the
37
- * ServiceClientCredentials interface from the older packages @azure/ms-rest-nodeauth and
38
- * @azure/ms-rest-browserauth are also supported.
50
+ * @param credentials Subscription credentials which uniquely identify client subscription.
39
51
  * @param subscriptionId The ID of the target subscription.
40
- * @param [options] The parameter options
52
+ * @param options The parameter options
41
53
  */
42
- constructor(credentials: msRest.ServiceClientCredentials | TokenCredential, subscriptionId: string, options?: Models.CognitiveServicesManagementClientOptions) {
43
- super(credentials, subscriptionId, options);
44
- this.accounts = new operations.Accounts(this);
45
- this.deletedAccounts = new operations.DeletedAccounts(this);
46
- this.resourceSkus = new operations.ResourceSkus(this);
47
- this.operations = new operations.Operations(this);
48
- this.commitmentTiers = new operations.CommitmentTiers(this);
49
- this.privateEndpointConnections = new operations.PrivateEndpointConnections(this);
50
- this.privateLinkResources = new operations.PrivateLinkResources(this);
51
- this.deployments = new operations.Deployments(this);
52
- this.commitmentPlans = new operations.CommitmentPlans(this);
54
+ constructor(
55
+ credentials: coreAuth.TokenCredential,
56
+ subscriptionId: string,
57
+ options?: CognitiveServicesManagementClientOptionalParams
58
+ ) {
59
+ if (credentials === undefined) {
60
+ throw new Error("'credentials' cannot be null");
61
+ }
62
+ if (subscriptionId === undefined) {
63
+ throw new Error("'subscriptionId' cannot be null");
64
+ }
65
+
66
+ // Initializing default values for options
67
+ if (!options) {
68
+ options = {};
69
+ }
70
+ const defaults: CognitiveServicesManagementClientOptionalParams = {
71
+ requestContentType: "application/json; charset=utf-8",
72
+ credential: credentials
73
+ };
74
+
75
+ const packageDetails = `azsdk-js-arm-cognitiveservices/7.0.0`;
76
+ const userAgentPrefix =
77
+ options.userAgentOptions && options.userAgentOptions.userAgentPrefix
78
+ ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
79
+ : `${packageDetails}`;
80
+
81
+ if (!options.credentialScopes) {
82
+ options.credentialScopes = ["https://management.azure.com/.default"];
83
+ }
84
+ const optionsWithDefaults = {
85
+ ...defaults,
86
+ ...options,
87
+ userAgentOptions: {
88
+ userAgentPrefix
89
+ },
90
+ baseUri: options.endpoint || "https://management.azure.com"
91
+ };
92
+ super(optionsWithDefaults);
93
+ // Parameter assignments
94
+ this.subscriptionId = subscriptionId;
95
+
96
+ // Assigning values to Constant parameters
97
+ this.$host = options.$host || "https://management.azure.com";
98
+ this.apiVersion = options.apiVersion || "2021-10-01";
99
+ this.accounts = new AccountsImpl(this);
100
+ this.deletedAccounts = new DeletedAccountsImpl(this);
101
+ this.resourceSkus = new ResourceSkusImpl(this);
102
+ this.operations = new OperationsImpl(this);
103
+ this.commitmentTiers = new CommitmentTiersImpl(this);
104
+ this.privateEndpointConnections = new PrivateEndpointConnectionsImpl(this);
105
+ this.privateLinkResources = new PrivateLinkResourcesImpl(this);
106
+ this.deployments = new DeploymentsImpl(this);
107
+ this.commitmentPlans = new CommitmentPlansImpl(this);
53
108
  }
54
109
 
55
110
  /**
@@ -57,100 +112,56 @@ class CognitiveServicesManagementClient extends CognitiveServicesManagementClien
57
112
  * @param location Resource location.
58
113
  * @param skus The SKU of the resource.
59
114
  * @param kind The Kind of the resource.
60
- * @param type The Type of the resource.
61
- * @param [options] The optional parameters
62
- * @returns Promise<Models.CheckSkuAvailabilityResponse>
63
- */
64
- checkSkuAvailability(location: string, skus: string[], kind: string, type: string, options?: msRest.RequestOptionsBase): Promise<Models.CheckSkuAvailabilityResponse>;
65
- /**
66
- * @param location Resource location.
67
- * @param skus The SKU of the resource.
68
- * @param kind The Kind of the resource.
69
- * @param type The Type of the resource.
70
- * @param callback The callback
115
+ * @param typeParam The Type of the resource.
116
+ * @param options The options parameters.
71
117
  */
72
- checkSkuAvailability(location: string, skus: string[], kind: string, type: string, callback: msRest.ServiceCallback<Models.SkuAvailabilityListResult>): void;
73
- /**
74
- * @param location Resource location.
75
- * @param skus The SKU of the resource.
76
- * @param kind The Kind of the resource.
77
- * @param type The Type of the resource.
78
- * @param options The optional parameters
79
- * @param callback The callback
80
- */
81
- checkSkuAvailability(location: string, skus: string[], kind: string, type: string, options: msRest.RequestOptionsBase, callback: msRest.ServiceCallback<Models.SkuAvailabilityListResult>): void;
82
- checkSkuAvailability(location: string, skus: string[], kind: string, type: string, options?: msRest.RequestOptionsBase | msRest.ServiceCallback<Models.SkuAvailabilityListResult>, callback?: msRest.ServiceCallback<Models.SkuAvailabilityListResult>): Promise<Models.CheckSkuAvailabilityResponse> {
118
+ checkSkuAvailability(
119
+ location: string,
120
+ skus: string[],
121
+ kind: string,
122
+ typeParam: string,
123
+ options?: CheckSkuAvailabilityOptionalParams
124
+ ): Promise<CheckSkuAvailabilityResponse> {
83
125
  return this.sendOperationRequest(
84
- {
85
- location,
86
- skus,
87
- kind,
88
- type,
89
- options
90
- },
91
- checkSkuAvailabilityOperationSpec,
92
- callback) as Promise<Models.CheckSkuAvailabilityResponse>;
126
+ { location, skus, kind, typeParam, options },
127
+ checkSkuAvailabilityOperationSpec
128
+ );
93
129
  }
94
130
 
95
131
  /**
96
132
  * Check whether a domain is available.
97
133
  * @param subdomainName The subdomain name to use.
98
- * @param type The Type of the resource.
99
- * @param [options] The optional parameters
100
- * @returns Promise<Models.CheckDomainAvailabilityResponse>
101
- */
102
- checkDomainAvailability(subdomainName: string, type: string, options?: Models.CognitiveServicesManagementClientCheckDomainAvailabilityOptionalParams): Promise<Models.CheckDomainAvailabilityResponse>;
103
- /**
104
- * @param subdomainName The subdomain name to use.
105
- * @param type The Type of the resource.
106
- * @param callback The callback
107
- */
108
- checkDomainAvailability(subdomainName: string, type: string, callback: msRest.ServiceCallback<Models.DomainAvailability>): void;
109
- /**
110
- * @param subdomainName The subdomain name to use.
111
- * @param type The Type of the resource.
112
- * @param options The optional parameters
113
- * @param callback The callback
134
+ * @param typeParam The Type of the resource.
135
+ * @param options The options parameters.
114
136
  */
115
- checkDomainAvailability(subdomainName: string, type: string, options: Models.CognitiveServicesManagementClientCheckDomainAvailabilityOptionalParams, callback: msRest.ServiceCallback<Models.DomainAvailability>): void;
116
- checkDomainAvailability(subdomainName: string, type: string, options?: Models.CognitiveServicesManagementClientCheckDomainAvailabilityOptionalParams | msRest.ServiceCallback<Models.DomainAvailability>, callback?: msRest.ServiceCallback<Models.DomainAvailability>): Promise<Models.CheckDomainAvailabilityResponse> {
137
+ checkDomainAvailability(
138
+ subdomainName: string,
139
+ typeParam: string,
140
+ options?: CheckDomainAvailabilityOptionalParams
141
+ ): Promise<CheckDomainAvailabilityResponse> {
117
142
  return this.sendOperationRequest(
118
- {
119
- subdomainName,
120
- type,
121
- options
122
- },
123
- checkDomainAvailabilityOperationSpec,
124
- callback) as Promise<Models.CheckDomainAvailabilityResponse>;
143
+ { subdomainName, typeParam, options },
144
+ checkDomainAvailabilityOperationSpec
145
+ );
125
146
  }
126
- }
127
147
 
148
+ accounts: Accounts;
149
+ deletedAccounts: DeletedAccounts;
150
+ resourceSkus: ResourceSkus;
151
+ operations: Operations;
152
+ commitmentTiers: CommitmentTiers;
153
+ privateEndpointConnections: PrivateEndpointConnections;
154
+ privateLinkResources: PrivateLinkResources;
155
+ deployments: Deployments;
156
+ commitmentPlans: CommitmentPlans;
157
+ }
128
158
  // Operation Specifications
129
- const serializer = new msRest.Serializer(Mappers);
130
- const checkSkuAvailabilityOperationSpec: msRest.OperationSpec = {
159
+ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
160
+
161
+ const checkSkuAvailabilityOperationSpec: coreClient.OperationSpec = {
162
+ path:
163
+ "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkSkuAvailability",
131
164
  httpMethod: "POST",
132
- path: "subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/locations/{location}/checkSkuAvailability",
133
- urlParameters: [
134
- Parameters.subscriptionId,
135
- Parameters.location
136
- ],
137
- queryParameters: [
138
- Parameters.apiVersion
139
- ],
140
- headerParameters: [
141
- Parameters.acceptLanguage
142
- ],
143
- requestBody: {
144
- parameterPath: {
145
- skus: "skus",
146
- kind: "kind",
147
- type: "type"
148
- },
149
- mapper: {
150
- ...Mappers.CheckSkuAvailabilityParameter,
151
- required: true
152
- }
153
- },
154
165
  responses: {
155
166
  200: {
156
167
  bodyMapper: Mappers.SkuAvailabilityListResult
@@ -159,35 +170,24 @@ const checkSkuAvailabilityOperationSpec: msRest.OperationSpec = {
159
170
  bodyMapper: Mappers.ErrorResponse
160
171
  }
161
172
  },
173
+ requestBody: {
174
+ parameterPath: { skus: ["skus"], kind: ["kind"], typeParam: ["typeParam"] },
175
+ mapper: { ...Mappers.CheckSkuAvailabilityParameter, required: true }
176
+ },
177
+ queryParameters: [Parameters.apiVersion],
178
+ urlParameters: [
179
+ Parameters.$host,
180
+ Parameters.subscriptionId,
181
+ Parameters.location
182
+ ],
183
+ headerParameters: [Parameters.contentType, Parameters.accept],
184
+ mediaType: "json",
162
185
  serializer
163
186
  };
164
-
165
- const checkDomainAvailabilityOperationSpec: msRest.OperationSpec = {
187
+ const checkDomainAvailabilityOperationSpec: coreClient.OperationSpec = {
188
+ path:
189
+ "/subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/checkDomainAvailability",
166
190
  httpMethod: "POST",
167
- path: "subscriptions/{subscriptionId}/providers/Microsoft.CognitiveServices/checkDomainAvailability",
168
- urlParameters: [
169
- Parameters.subscriptionId
170
- ],
171
- queryParameters: [
172
- Parameters.apiVersion
173
- ],
174
- headerParameters: [
175
- Parameters.acceptLanguage
176
- ],
177
- requestBody: {
178
- parameterPath: {
179
- subdomainName: "subdomainName",
180
- type: "type",
181
- kind: [
182
- "options",
183
- "kind"
184
- ]
185
- },
186
- mapper: {
187
- ...Mappers.CheckDomainAvailabilityParameter,
188
- required: true
189
- }
190
- },
191
191
  responses: {
192
192
  200: {
193
193
  bodyMapper: Mappers.DomainAvailability
@@ -196,13 +196,17 @@ const checkDomainAvailabilityOperationSpec: msRest.OperationSpec = {
196
196
  bodyMapper: Mappers.ErrorResponse
197
197
  }
198
198
  },
199
+ requestBody: {
200
+ parameterPath: {
201
+ subdomainName: ["subdomainName"],
202
+ typeParam: ["typeParam"],
203
+ kind: ["options", "kind"]
204
+ },
205
+ mapper: { ...Mappers.CheckDomainAvailabilityParameter, required: true }
206
+ },
207
+ queryParameters: [Parameters.apiVersion],
208
+ urlParameters: [Parameters.$host, Parameters.subscriptionId],
209
+ headerParameters: [Parameters.contentType, Parameters.accept],
210
+ mediaType: "json",
199
211
  serializer
200
212
  };
201
-
202
- export {
203
- CognitiveServicesManagementClient,
204
- CognitiveServicesManagementClientContext,
205
- Models as CognitiveServicesManagementModels,
206
- Mappers as CognitiveServicesManagementMappers
207
- };
208
- export * from "./operations";
@@ -6,12 +6,7 @@
6
6
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  */
8
8
 
9
- export {
10
- ErrorAdditionalInfo,
11
- ErrorDetail,
12
- ErrorResponse,
13
- ResourceSku,
14
- ResourceSkuListResult,
15
- ResourceSkuRestrictionInfo,
16
- ResourceSkuRestrictions
17
- } from "../models/mappers";
9
+ /// <reference lib="esnext.asynciterable" />
10
+ export * from "./models";
11
+ export { CognitiveServicesManagementClient } from "./cognitiveServicesManagementClient";
12
+ export * from "./operationsInterfaces";
package/src/lroImpl.ts ADDED
@@ -0,0 +1,34 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation.
3
+ * Licensed under the MIT License.
4
+ *
5
+ * Code generated by Microsoft (R) AutoRest Code Generator.
6
+ * Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
+ */
8
+
9
+ import { LongRunningOperation, LroResponse } from "@azure/core-lro";
10
+
11
+ export class LroImpl<T> implements LongRunningOperation<T> {
12
+ constructor(
13
+ private sendOperationFn: (args: any, spec: any) => Promise<LroResponse<T>>,
14
+ private args: Record<string, unknown>,
15
+ private spec: {
16
+ readonly requestBody?: unknown;
17
+ readonly path?: string;
18
+ readonly httpMethod: string;
19
+ } & Record<string, any>,
20
+ public requestPath: string = spec.path!,
21
+ public requestMethod: string = spec.httpMethod
22
+ ) {}
23
+ public async sendInitialRequest(): Promise<LroResponse<T>> {
24
+ return this.sendOperationFn(this.args, this.spec);
25
+ }
26
+ public async sendPollRequest(path: string): Promise<LroResponse<T>> {
27
+ const { requestBody, ...restSpec } = this.spec;
28
+ return this.sendOperationFn(this.args, {
29
+ ...restSpec,
30
+ path,
31
+ httpMethod: "GET"
32
+ });
33
+ }
34
+ }