@microsoft/power-apps 1.0.0

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 (275) hide show
  1. package/LICENSE +153 -0
  2. package/README.md +43 -0
  3. package/lib/__tests__/connectorDataOperation.spec.d.ts +5 -0
  4. package/lib/__tests__/connectorDataOperation.spec.d.ts.map +1 -0
  5. package/lib/__tests__/connectorDataOperation.spec.js +509 -0
  6. package/lib/__tests__/connectorDataOperation.spec.js.map +1 -0
  7. package/lib/__tests__/dataverseDataOperation.spec.d.ts +5 -0
  8. package/lib/__tests__/dataverseDataOperation.spec.d.ts.map +1 -0
  9. package/lib/__tests__/dataverseDataOperation.spec.js +349 -0
  10. package/lib/__tests__/dataverseDataOperation.spec.js.map +1 -0
  11. package/lib/__tests__/helpers/testHelpers.d.ts +27 -0
  12. package/lib/__tests__/helpers/testHelpers.d.ts.map +1 -0
  13. package/lib/__tests__/helpers/testHelpers.js +67 -0
  14. package/lib/__tests__/helpers/testHelpers.js.map +1 -0
  15. package/lib/__tests__/index.spec.d.ts +5 -0
  16. package/lib/__tests__/index.spec.d.ts.map +1 -0
  17. package/lib/__tests__/index.spec.js +10 -0
  18. package/lib/__tests__/index.spec.js.map +1 -0
  19. package/lib/__tests__/mocks/mockDataverseRetrieveMultipleResponse.d.ts +17 -0
  20. package/lib/__tests__/mocks/mockDataverseRetrieveMultipleResponse.d.ts.map +1 -0
  21. package/lib/__tests__/mocks/mockDataverseRetrieveMultipleResponse.js +35 -0
  22. package/lib/__tests__/mocks/mockDataverseRetrieveMultipleResponse.js.map +1 -0
  23. package/lib/__tests__/mocks/mockLog.d.ts +31 -0
  24. package/lib/__tests__/mocks/mockLog.d.ts.map +1 -0
  25. package/lib/__tests__/mocks/mockLog.js +53 -0
  26. package/lib/__tests__/mocks/mockLog.js.map +1 -0
  27. package/lib/__tests__/mocks/mockTeamsConnectorResponse.d.ts +76 -0
  28. package/lib/__tests__/mocks/mockTeamsConnectorResponse.d.ts.map +1 -0
  29. package/lib/__tests__/mocks/mockTeamsConnectorResponse.js +81 -0
  30. package/lib/__tests__/mocks/mockTeamsConnectorResponse.js.map +1 -0
  31. package/lib/__tests__/mocks/silenceConsole.d.ts +37 -0
  32. package/lib/__tests__/mocks/silenceConsole.d.ts.map +1 -0
  33. package/lib/__tests__/mocks/silenceConsole.js +58 -0
  34. package/lib/__tests__/mocks/silenceConsole.js.map +1 -0
  35. package/lib/__tests__/powerDataRuntimeInstance.test.d.ts +5 -0
  36. package/lib/__tests__/powerDataRuntimeInstance.test.d.ts.map +1 -0
  37. package/lib/__tests__/powerDataRuntimeInstance.test.js +179 -0
  38. package/lib/__tests__/powerDataRuntimeInstance.test.js.map +1 -0
  39. package/lib/__tests__/powerDataSourcesInfoProvider.test.d.ts +5 -0
  40. package/lib/__tests__/powerDataSourcesInfoProvider.test.d.ts.map +1 -0
  41. package/lib/__tests__/powerDataSourcesInfoProvider.test.js +153 -0
  42. package/lib/__tests__/powerDataSourcesInfoProvider.test.js.map +1 -0
  43. package/lib/__tests__/runtimeClientProvider.test.d.ts +5 -0
  44. package/lib/__tests__/runtimeClientProvider.test.d.ts.map +1 -0
  45. package/lib/__tests__/runtimeClientProvider.test.js +248 -0
  46. package/lib/__tests__/runtimeClientProvider.test.js.map +1 -0
  47. package/lib/__tests__/runtimeDataClient.spec.d.ts +2 -0
  48. package/lib/__tests__/runtimeDataClient.spec.d.ts.map +1 -0
  49. package/lib/__tests__/runtimeDataClient.spec.js +351 -0
  50. package/lib/__tests__/runtimeDataClient.spec.js.map +1 -0
  51. package/lib/__tests__/runtimeDataClient.test.d.ts +2 -0
  52. package/lib/__tests__/runtimeDataClient.test.d.ts.map +1 -0
  53. package/lib/__tests__/runtimeDataClient.test.js +351 -0
  54. package/lib/__tests__/runtimeDataClient.test.js.map +1 -0
  55. package/lib/__tests__/runtimeDataOperation.test.d.ts +5 -0
  56. package/lib/__tests__/runtimeDataOperation.test.d.ts.map +1 -0
  57. package/lib/__tests__/runtimeDataOperation.test.js +234 -0
  58. package/lib/__tests__/runtimeDataOperation.test.js.map +1 -0
  59. package/lib/__tests__/runtimeMetadataClient.test.d.ts +5 -0
  60. package/lib/__tests__/runtimeMetadataClient.test.d.ts.map +1 -0
  61. package/lib/__tests__/runtimeMetadataClient.test.js +271 -0
  62. package/lib/__tests__/runtimeMetadataClient.test.js.map +1 -0
  63. package/lib/__tests__/runtimeMetadataOperations.test.d.ts +5 -0
  64. package/lib/__tests__/runtimeMetadataOperations.test.d.ts.map +1 -0
  65. package/lib/__tests__/runtimeMetadataOperations.test.js +286 -0
  66. package/lib/__tests__/runtimeMetadataOperations.test.js.map +1 -0
  67. package/lib/__tests__/serviceSchemaModelSnapshot.test.d.ts +2 -0
  68. package/lib/__tests__/serviceSchemaModelSnapshot.test.d.ts.map +1 -0
  69. package/lib/__tests__/serviceSchemaModelSnapshot.test.js +98 -0
  70. package/lib/__tests__/serviceSchemaModelSnapshot.test.js.map +1 -0
  71. package/lib/__tests__/types.spec.d.ts +5 -0
  72. package/lib/__tests__/types.spec.d.ts.map +1 -0
  73. package/lib/__tests__/types.spec.js +104 -0
  74. package/lib/__tests__/types.spec.js.map +1 -0
  75. package/lib/__tests__/utils.test.d.ts +5 -0
  76. package/lib/__tests__/utils.test.d.ts.map +1 -0
  77. package/lib/__tests__/utils.test.js +33 -0
  78. package/lib/__tests__/utils.test.js.map +1 -0
  79. package/lib/app/Lifecycle.d.ts +9 -0
  80. package/lib/app/Lifecycle.d.ts.map +1 -0
  81. package/lib/app/Lifecycle.js +36 -0
  82. package/lib/app/Lifecycle.js.map +1 -0
  83. package/lib/app/index.d.ts +5 -0
  84. package/lib/app/index.d.ts.map +1 -0
  85. package/lib/app/index.js +5 -0
  86. package/lib/app/index.js.map +1 -0
  87. package/lib/data/Data.types.d.ts +20 -0
  88. package/lib/data/Data.types.d.ts.map +1 -0
  89. package/lib/data/Data.types.js +5 -0
  90. package/lib/data/Data.types.js.map +1 -0
  91. package/lib/data/index.d.ts +7 -0
  92. package/lib/data/index.d.ts.map +1 -0
  93. package/lib/data/index.js +5 -0
  94. package/lib/data/index.js.map +1 -0
  95. package/lib/data/powerAppsData.d.ts +8 -0
  96. package/lib/data/powerAppsData.d.ts.map +1 -0
  97. package/lib/data/powerAppsData.js +38 -0
  98. package/lib/data/powerAppsData.js.map +1 -0
  99. package/lib/index.d.ts +8 -0
  100. package/lib/index.d.ts.map +1 -0
  101. package/lib/index.js +8 -0
  102. package/lib/index.js.map +1 -0
  103. package/lib/internal/communication/CompatibleMessageReceiver.d.ts +12 -0
  104. package/lib/internal/communication/CompatibleMessageReceiver.d.ts.map +1 -0
  105. package/lib/internal/communication/CompatibleMessageReceiver.js +92 -0
  106. package/lib/internal/communication/CompatibleMessageReceiver.js.map +1 -0
  107. package/lib/internal/communication/IncompatibleMessageReceiver.d.ts +10 -0
  108. package/lib/internal/communication/IncompatibleMessageReceiver.d.ts.map +1 -0
  109. package/lib/internal/communication/IncompatibleMessageReceiver.js +13 -0
  110. package/lib/internal/communication/IncompatibleMessageReceiver.js.map +1 -0
  111. package/lib/internal/communication/MessageReceiver.Types.d.ts +18 -0
  112. package/lib/internal/communication/MessageReceiver.Types.d.ts.map +1 -0
  113. package/lib/internal/communication/MessageReceiver.Types.js +5 -0
  114. package/lib/internal/communication/MessageReceiver.Types.js.map +1 -0
  115. package/lib/internal/communication/SendMessage.d.ts +11 -0
  116. package/lib/internal/communication/SendMessage.d.ts.map +1 -0
  117. package/lib/internal/communication/SendMessage.js +32 -0
  118. package/lib/internal/communication/SendMessage.js.map +1 -0
  119. package/lib/internal/communication/SendMessageOperation.d.ts +15 -0
  120. package/lib/internal/communication/SendMessageOperation.d.ts.map +1 -0
  121. package/lib/internal/communication/SendMessageOperation.js +18 -0
  122. package/lib/internal/communication/SendMessageOperation.js.map +1 -0
  123. package/lib/internal/data/ConnectionUtils.d.ts +5 -0
  124. package/lib/internal/data/ConnectionUtils.d.ts.map +1 -0
  125. package/lib/internal/data/ConnectionUtils.js +20 -0
  126. package/lib/internal/data/ConnectionUtils.js.map +1 -0
  127. package/lib/internal/data/OperationExecutor.d.ts +18 -0
  128. package/lib/internal/data/OperationExecutor.d.ts.map +1 -0
  129. package/lib/internal/data/OperationExecutor.js +35 -0
  130. package/lib/internal/data/OperationExecutor.js.map +1 -0
  131. package/lib/internal/data/core/api/createRecord.d.ts +13 -0
  132. package/lib/internal/data/core/api/createRecord.d.ts.map +1 -0
  133. package/lib/internal/data/core/api/createRecord.js +15 -0
  134. package/lib/internal/data/core/api/createRecord.js.map +1 -0
  135. package/lib/internal/data/core/api/deleteRecord.d.ts +13 -0
  136. package/lib/internal/data/core/api/deleteRecord.d.ts.map +1 -0
  137. package/lib/internal/data/core/api/deleteRecord.js +15 -0
  138. package/lib/internal/data/core/api/deleteRecord.js.map +1 -0
  139. package/lib/internal/data/core/api/execute.d.ts +11 -0
  140. package/lib/internal/data/core/api/execute.d.ts.map +1 -0
  141. package/lib/internal/data/core/api/execute.js +13 -0
  142. package/lib/internal/data/core/api/execute.js.map +1 -0
  143. package/lib/internal/data/core/api/retrieveMultipleRecords.d.ts +13 -0
  144. package/lib/internal/data/core/api/retrieveMultipleRecords.d.ts.map +1 -0
  145. package/lib/internal/data/core/api/retrieveMultipleRecords.js +15 -0
  146. package/lib/internal/data/core/api/retrieveMultipleRecords.js.map +1 -0
  147. package/lib/internal/data/core/api/retrieveRecord.d.ts +13 -0
  148. package/lib/internal/data/core/api/retrieveRecord.d.ts.map +1 -0
  149. package/lib/internal/data/core/api/retrieveRecord.js +15 -0
  150. package/lib/internal/data/core/api/retrieveRecord.js.map +1 -0
  151. package/lib/internal/data/core/api/updateRecord.d.ts +14 -0
  152. package/lib/internal/data/core/api/updateRecord.d.ts.map +1 -0
  153. package/lib/internal/data/core/api/updateRecord.js +16 -0
  154. package/lib/internal/data/core/api/updateRecord.js.map +1 -0
  155. package/lib/internal/data/core/common/types.d.ts +230 -0
  156. package/lib/internal/data/core/common/types.d.ts.map +1 -0
  157. package/lib/internal/data/core/common/types.js +25 -0
  158. package/lib/internal/data/core/common/types.js.map +1 -0
  159. package/lib/internal/data/core/common/utils.d.ts +19 -0
  160. package/lib/internal/data/core/common/utils.d.ts.map +1 -0
  161. package/lib/internal/data/core/common/utils.js +47 -0
  162. package/lib/internal/data/core/common/utils.js.map +1 -0
  163. package/lib/internal/data/core/data/connectorDataOperation.d.ts +160 -0
  164. package/lib/internal/data/core/data/connectorDataOperation.d.ts.map +1 -0
  165. package/lib/internal/data/core/data/connectorDataOperation.js +500 -0
  166. package/lib/internal/data/core/data/connectorDataOperation.js.map +1 -0
  167. package/lib/internal/data/core/data/dataverseDataOperation.d.ts +164 -0
  168. package/lib/internal/data/core/data/dataverseDataOperation.d.ts.map +1 -0
  169. package/lib/internal/data/core/data/dataverseDataOperation.js +508 -0
  170. package/lib/internal/data/core/data/dataverseDataOperation.js.map +1 -0
  171. package/lib/internal/data/core/data/runtimeDataOperations.d.ts +93 -0
  172. package/lib/internal/data/core/data/runtimeDataOperations.d.ts.map +1 -0
  173. package/lib/internal/data/core/data/runtimeDataOperations.js +244 -0
  174. package/lib/internal/data/core/data/runtimeDataOperations.js.map +1 -0
  175. package/lib/internal/data/core/error/codes.d.ts +31 -0
  176. package/lib/internal/data/core/error/codes.d.ts.map +1 -0
  177. package/lib/internal/data/core/error/codes.js +39 -0
  178. package/lib/internal/data/core/error/codes.js.map +1 -0
  179. package/lib/internal/data/core/error/constants.d.ts +30 -0
  180. package/lib/internal/data/core/error/constants.d.ts.map +1 -0
  181. package/lib/internal/data/core/error/constants.js +33 -0
  182. package/lib/internal/data/core/error/constants.js.map +1 -0
  183. package/lib/internal/data/core/error/error.d.ts +8 -0
  184. package/lib/internal/data/core/error/error.d.ts.map +1 -0
  185. package/lib/internal/data/core/error/error.js +8 -0
  186. package/lib/internal/data/core/error/error.js.map +1 -0
  187. package/lib/internal/data/core/error/messages.d.ts +24 -0
  188. package/lib/internal/data/core/error/messages.d.ts.map +1 -0
  189. package/lib/internal/data/core/error/messages.js +55 -0
  190. package/lib/internal/data/core/error/messages.js.map +1 -0
  191. package/lib/internal/data/core/error/types.d.ts +30 -0
  192. package/lib/internal/data/core/error/types.d.ts.map +1 -0
  193. package/lib/internal/data/core/error/types.js +28 -0
  194. package/lib/internal/data/core/error/types.js.map +1 -0
  195. package/lib/internal/data/core/error/util.d.ts +24 -0
  196. package/lib/internal/data/core/error/util.d.ts.map +1 -0
  197. package/lib/internal/data/core/error/util.js +71 -0
  198. package/lib/internal/data/core/error/util.js.map +1 -0
  199. package/lib/internal/data/core/metadata/runtimeDataSourceService.d.ts +65 -0
  200. package/lib/internal/data/core/metadata/runtimeDataSourceService.d.ts.map +1 -0
  201. package/lib/internal/data/core/metadata/runtimeDataSourceService.js +101 -0
  202. package/lib/internal/data/core/metadata/runtimeDataSourceService.js.map +1 -0
  203. package/lib/internal/data/core/metadata/runtimeMetadataOperations.d.ts +17 -0
  204. package/lib/internal/data/core/metadata/runtimeMetadataOperations.d.ts.map +1 -0
  205. package/lib/internal/data/core/metadata/runtimeMetadataOperations.js +34 -0
  206. package/lib/internal/data/core/metadata/runtimeMetadataOperations.js.map +1 -0
  207. package/lib/internal/data/core/runtime/getRuntimeContext.d.ts +11 -0
  208. package/lib/internal/data/core/runtime/getRuntimeContext.d.ts.map +1 -0
  209. package/lib/internal/data/core/runtime/getRuntimeContext.js +16 -0
  210. package/lib/internal/data/core/runtime/getRuntimeContext.js.map +1 -0
  211. package/lib/internal/data/core/runtime/initializeRuntime.d.ts +13 -0
  212. package/lib/internal/data/core/runtime/initializeRuntime.d.ts.map +1 -0
  213. package/lib/internal/data/core/runtime/initializeRuntime.js +38 -0
  214. package/lib/internal/data/core/runtime/initializeRuntime.js.map +1 -0
  215. package/lib/internal/data/core/runtime/powerDataRuntime.d.ts +68 -0
  216. package/lib/internal/data/core/runtime/powerDataRuntime.d.ts.map +1 -0
  217. package/lib/internal/data/core/runtime/powerDataRuntime.js +116 -0
  218. package/lib/internal/data/core/runtime/powerDataRuntime.js.map +1 -0
  219. package/lib/internal/data/core/runtime/powerDataRuntimeInstance.d.ts +20 -0
  220. package/lib/internal/data/core/runtime/powerDataRuntimeInstance.d.ts.map +1 -0
  221. package/lib/internal/data/core/runtime/powerDataRuntimeInstance.js +36 -0
  222. package/lib/internal/data/core/runtime/powerDataRuntimeInstance.js.map +1 -0
  223. package/lib/internal/data/core/runtime/powerDataSourcesInfoProvider.d.ts +34 -0
  224. package/lib/internal/data/core/runtime/powerDataSourcesInfoProvider.d.ts.map +1 -0
  225. package/lib/internal/data/core/runtime/powerDataSourcesInfoProvider.js +45 -0
  226. package/lib/internal/data/core/runtime/powerDataSourcesInfoProvider.js.map +1 -0
  227. package/lib/internal/data/core/runtimeClient/runtimeClientProvider.d.ts +43 -0
  228. package/lib/internal/data/core/runtimeClient/runtimeClientProvider.d.ts.map +1 -0
  229. package/lib/internal/data/core/runtimeClient/runtimeClientProvider.js +87 -0
  230. package/lib/internal/data/core/runtimeClient/runtimeClientProvider.js.map +1 -0
  231. package/lib/internal/data/core/runtimeClient/runtimeDataClient.d.ts +112 -0
  232. package/lib/internal/data/core/runtimeClient/runtimeDataClient.d.ts.map +1 -0
  233. package/lib/internal/data/core/runtimeClient/runtimeDataClient.js +457 -0
  234. package/lib/internal/data/core/runtimeClient/runtimeDataClient.js.map +1 -0
  235. package/lib/internal/data/core/runtimeClient/runtimeMetadataClient.d.ts +40 -0
  236. package/lib/internal/data/core/runtimeClient/runtimeMetadataClient.d.ts.map +1 -0
  237. package/lib/internal/data/core/runtimeClient/runtimeMetadataClient.js +94 -0
  238. package/lib/internal/data/core/runtimeClient/runtimeMetadataClient.js.map +1 -0
  239. package/lib/internal/data/core/telemetry/log.d.ts +20 -0
  240. package/lib/internal/data/core/telemetry/log.d.ts.map +1 -0
  241. package/lib/internal/data/core/telemetry/log.js +85 -0
  242. package/lib/internal/data/core/telemetry/log.js.map +1 -0
  243. package/lib/internal/data/core/types/index.d.ts +138 -0
  244. package/lib/internal/data/core/types/index.d.ts.map +1 -0
  245. package/lib/internal/data/core/types/index.js +7 -0
  246. package/lib/internal/data/core/types/index.js.map +1 -0
  247. package/lib/internal/plugin/PluginCommon.d.ts +16 -0
  248. package/lib/internal/plugin/PluginCommon.d.ts.map +1 -0
  249. package/lib/internal/plugin/PluginCommon.js +114 -0
  250. package/lib/internal/plugin/PluginCommon.js.map +1 -0
  251. package/lib/internal/plugin/PluginMobile.d.ts +13 -0
  252. package/lib/internal/plugin/PluginMobile.d.ts.map +1 -0
  253. package/lib/internal/plugin/PluginMobile.js +109 -0
  254. package/lib/internal/plugin/PluginMobile.js.map +1 -0
  255. package/lib/telemetry/Logger.types.d.ts +8 -0
  256. package/lib/telemetry/Logger.types.d.ts.map +1 -0
  257. package/lib/telemetry/Logger.types.js +5 -0
  258. package/lib/telemetry/Logger.types.js.map +1 -0
  259. package/lib/telemetry/LoggerManager.d.ts +6 -0
  260. package/lib/telemetry/LoggerManager.d.ts.map +1 -0
  261. package/lib/telemetry/LoggerManager.js +28 -0
  262. package/lib/telemetry/LoggerManager.js.map +1 -0
  263. package/lib/telemetry/Metrics.types.d.ts +53 -0
  264. package/lib/telemetry/Metrics.types.d.ts.map +1 -0
  265. package/lib/telemetry/Metrics.types.js +5 -0
  266. package/lib/telemetry/Metrics.types.js.map +1 -0
  267. package/lib/telemetry/Performance.d.ts +5 -0
  268. package/lib/telemetry/Performance.d.ts.map +1 -0
  269. package/lib/telemetry/Performance.js +47 -0
  270. package/lib/telemetry/Performance.js.map +1 -0
  271. package/lib/telemetry/index.d.ts +5 -0
  272. package/lib/telemetry/index.d.ts.map +1 -0
  273. package/lib/telemetry/index.js +5 -0
  274. package/lib/telemetry/index.js.map +1 -0
  275. package/package.json +40 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"powerDataRuntime.d.ts","sourceRoot":"","sources":["../../../../../src/internal/data/core/runtime/powerDataRuntime.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,mBAAmB,EACnB,6BAA6B,EAE7B,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIhD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAIvF;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,4BAA4B,EAAE,6BAA6B,CAAC;IAC5D,sBAAsB,EAAE,uBAAuB,CAAC;IAChD,GAAG,EAAE,WAAW,CAAC;IACjB,YAAY,CAAC,EAAE,aAAa,CAAC;CAC9B;AAED;;;GAGG;AACH,qBAAa,gBAAiB,YAAW,iBAAiB;IACxD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAyB;IACzD,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA2B;IAC9D,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAc;IACnC,OAAO,CAAC,eAAe,CAAC,CAAkB;IAC1C,OAAO,CAAC,mBAAmB,CAAC,CAAsB;IAClD,OAAO,CAAC,cAAc,CAAU;IAEhC;;;;OAIG;gBACS,MAAM,EAAE,2BAA2B;IAoB/C;;;OAGG;IACH,IAAW,IAAI,IAAI,eAAe,CAMjC;IAED;;;OAGG;IACH,IAAW,QAAQ,IAAI,mBAAmB,CAMzC;IAED;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAM3B;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAM1B;;;OAGG;IACH,OAAO,CAAC,WAAW;IAUnB;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAU7B;;OAEG;IACH,OAAO,CAAC,yBAAyB;CAGlC"}
@@ -0,0 +1,116 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { RuntimeDataOperations } from '../data/runtimeDataOperations';
5
+ import { RuntimeMetadataOperations } from '../metadata/runtimeMetadataOperations';
6
+ import { RuntimeClientProvider } from '../runtimeClient/runtimeClientProvider';
7
+ import { DataverseDataOperation } from '../data/dataverseDataOperation';
8
+ import { ConnectorDataOperation } from '../data/connectorDataOperation';
9
+ import { RuntimeDataSourceService } from '../metadata/runtimeDataSourceService';
10
+ import { Log } from '../telemetry/log';
11
+ import { ErrorCodes, getErrorMessage, PowerDataRuntimeError } from '../error/error';
12
+ /**
13
+ * PowerDataRuntime provides a unified interface for data and metadata operations
14
+ * in the Power runtime environment.
15
+ */
16
+ export class PowerDataRuntime {
17
+ _clientProvider;
18
+ _dataSourceService;
19
+ _xrm;
20
+ _dataOperations;
21
+ _metadataOperations;
22
+ _isInitialized;
23
+ /**
24
+ * Creates a new instance of PowerDataRuntime
25
+ * @param params - Initialization parameters
26
+ * @throws DataRuntimeError if initialization fails
27
+ */
28
+ constructor(params) {
29
+ try {
30
+ this._validateInitParams(params);
31
+ // Initialize the telemetry logger
32
+ Log.createInstance(params.powerOperationExecutor);
33
+ this._clientProvider = new RuntimeClientProvider(params.powerOperationExecutor);
34
+ this._dataSourceService = new RuntimeDataSourceService(params.powerDataSourcesInfoProvider);
35
+ this._xrm = params.xrm;
36
+ this._isInitialized = false;
37
+ this._initialize();
38
+ }
39
+ catch (error) {
40
+ if (error instanceof Error) {
41
+ Log.trackException(error);
42
+ }
43
+ throw error;
44
+ }
45
+ }
46
+ /**
47
+ * Gets the Data operations interface
48
+ * @throws PowerDataRuntimeError if operations are not initialized
49
+ */
50
+ get Data() {
51
+ this._ensureInitialized();
52
+ if (!this._dataOperations) {
53
+ this._dataOperations = this._createDataOperations();
54
+ }
55
+ return this._dataOperations;
56
+ }
57
+ /**
58
+ * Gets the Metadata operations interface
59
+ * @throws PowerDataRuntimeError if operations are not initialized
60
+ */
61
+ get Metadata() {
62
+ this._ensureInitialized();
63
+ if (!this._metadataOperations) {
64
+ this._metadataOperations = this._createMetadataOperations();
65
+ }
66
+ return this._metadataOperations;
67
+ }
68
+ /**
69
+ * Validates initialization parameters
70
+ * @param params - Parameters to validate
71
+ * @throws PowerDataRuntimeError if validation fails
72
+ */
73
+ _validateInitParams(params) {
74
+ if (!params.xrm) {
75
+ throw new PowerDataRuntimeError(ErrorCodes.InvalidXrmInfo);
76
+ }
77
+ }
78
+ /**
79
+ * Ensures the PowerDataRuntime is initialized
80
+ * @throws PowerDataRuntimeError if not initialized
81
+ */
82
+ _ensureInitialized() {
83
+ if (!this._isInitialized) {
84
+ throw new PowerDataRuntimeError(ErrorCodes.OperationsNotInitialized);
85
+ }
86
+ }
87
+ /**
88
+ * Initializes the PowerDataRuntime components
89
+ * @throws PowerDataRuntimeError if initialization fails
90
+ */
91
+ _initialize() {
92
+ try {
93
+ this._dataOperations = this._createDataOperations();
94
+ this._metadataOperations = this._createMetadataOperations();
95
+ this._isInitialized = true;
96
+ }
97
+ catch (error) {
98
+ throw new PowerDataRuntimeError(ErrorCodes.InitializationFailed, getErrorMessage(error));
99
+ }
100
+ }
101
+ /**
102
+ * Creates a new instance of DataOperations
103
+ */
104
+ _createDataOperations() {
105
+ const dataverseOperation = new DataverseDataOperation(this._xrm, this._dataSourceService, this._clientProvider);
106
+ const connectorOperation = new ConnectorDataOperation(this._clientProvider, this._dataSourceService);
107
+ return new RuntimeDataOperations(dataverseOperation, connectorOperation, this._dataSourceService);
108
+ }
109
+ /**
110
+ * Creates a new instance of MetadataOperations
111
+ */
112
+ _createMetadataOperations() {
113
+ return new RuntimeMetadataOperations(this._clientProvider);
114
+ }
115
+ }
116
+ //# sourceMappingURL=powerDataRuntime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"powerDataRuntime.js","sourceRoot":"","sources":["../../../../../src/internal/data/core/runtime/powerDataRuntime.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAE/E,OAAO,EAAE,sBAAsB,EAAE,MAAM,gCAA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AAkB,EAAE,kBAAkB,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACpG,CAAC;IAED;;OAEG;IACK,yBAAyB;QAC/B,OAAO,IAAI,yBAAyB,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC7D,CAAC;CACF"}
@@ -0,0 +1,20 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { PowerDataRuntime } from './powerDataRuntime';
5
+ import { IPowerDataSourcesInfoProvider, IXrmContext } from '../common/types';
6
+ import { IPowerOperationExecutor } from '../types';
7
+ /**
8
+ * Gets or creates a singleton instance of PowerDataRuntime
9
+ * @param powerDataSourcesInfoProvider - Data sources info provider to initialize the PowerDataRuntime
10
+ * @param powerOperationExecutor - Optional power operation executor to initialize the PowerDataRuntime
11
+ * @param xrm - Optional xrm object to initialize the PowerDataRuntime
12
+ * @returns PowerDataRuntime instance
13
+ */
14
+ export declare function getPowerDataRuntime(powerDataSourcesInfoProvider: IPowerDataSourcesInfoProvider, powerOperationExecutor: IPowerOperationExecutor, xrm?: IXrmContext): PowerDataRuntime;
15
+ /**
16
+ * Resets the PowerDataRuntime singleton instance.
17
+ * Useful for testing or reinitialization.
18
+ */
19
+ export declare function resetPowerDataRuntimeInstance(): void;
20
+ //# sourceMappingURL=powerDataRuntimeInstance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"powerDataRuntimeInstance.d.ts","sourceRoot":"","sources":["../../../../../src/internal/data/core/runtime/powerDataRuntimeInstance.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAQnD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,4BAA4B,EAAE,6BAA6B,EAC3D,sBAAsB,EAAE,uBAAuB,EAC/C,GAAG,CAAC,EAAE,WAAW,GAChB,gBAAgB,CASlB;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,IAAI,IAAI,CAIpD"}
@@ -0,0 +1,36 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { PowerDataRuntime } from './powerDataRuntime';
5
+ import { Log } from '../telemetry/log';
6
+ /**
7
+ * Singleton instance of PowerDataRuntime
8
+ */
9
+ let powerDataRuntimeInstance;
10
+ /**
11
+ * Gets or creates a singleton instance of PowerDataRuntime
12
+ * @param powerDataSourcesInfoProvider - Data sources info provider to initialize the PowerDataRuntime
13
+ * @param powerOperationExecutor - Optional power operation executor to initialize the PowerDataRuntime
14
+ * @param xrm - Optional xrm object to initialize the PowerDataRuntime
15
+ * @returns PowerDataRuntime instance
16
+ */
17
+ export function getPowerDataRuntime(powerDataSourcesInfoProvider, powerOperationExecutor, xrm) {
18
+ if (!powerDataRuntimeInstance) {
19
+ powerDataRuntimeInstance = new PowerDataRuntime({
20
+ powerDataSourcesInfoProvider,
21
+ powerOperationExecutor,
22
+ xrm: xrm ?? { WebApi: {} },
23
+ });
24
+ }
25
+ return powerDataRuntimeInstance;
26
+ }
27
+ /**
28
+ * Resets the PowerDataRuntime singleton instance.
29
+ * Useful for testing or reinitialization.
30
+ */
31
+ export function resetPowerDataRuntimeInstance() {
32
+ powerDataRuntimeInstance = undefined;
33
+ // Reset the Log instance as well to ensure a clean state
34
+ Log.resetInstance();
35
+ }
36
+ //# sourceMappingURL=powerDataRuntimeInstance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"powerDataRuntimeInstance.js","sourceRoot":"","sources":["../../../../../src/internal/data/core/runtime/powerDataRuntimeInstance.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEvC;;GAEG;AACH,IAAI,wBAAsD,CAAC;AAE3D;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,4BAA2D,EAC3D,sBAA+C,EAC/C,GAAiB;IAEjB,IAAI,CAAC,wBAAwB,EAAE;QAC7B,wBAAwB,GAAG,IAAI,gBAAgB,CAAC;YAC9C,4BAA4B;YAC5B,sBAAsB;YACtB,GAAG,EAAE,GAAG,IAAK,EAAE,MAAM,EAAE,EAAE,EAAkB;SAC5C,CAAC,CAAC;KACJ;IACD,OAAO,wBAAwB,CAAC;AAClC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,6BAA6B;IAC3C,wBAAwB,GAAG,SAAS,CAAC;IACrC,yDAAyD;IACzD,GAAG,CAAC,aAAa,EAAE,CAAC;AACtB,CAAC"}
@@ -0,0 +1,34 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { IPowerDataSourcesInfoProvider } from '../common/types';
5
+ import { DataSourcesInfo } from '../types';
6
+ /**
7
+ * Singleton provider for managing data sources information.
8
+ */
9
+ declare class PowerDataSourcesInfoProvider implements IPowerDataSourcesInfoProvider {
10
+ private static instance;
11
+ private dataSourcesInfo;
12
+ /**
13
+ * Private constructor to enforce the singleton pattern.
14
+ * @param dataSourcesInfo The data sources information to initialize the provider with.
15
+ */
16
+ private constructor();
17
+ /**
18
+ * Retrieves the singleton instance of PowerDataSourcesInfoProvider.
19
+ * If the instance does not exist, it initializes it with the provided data sources info.
20
+ *
21
+ * @param dataSourcesInfo Optional parameter to initialize the instance if it doesn't exist.
22
+ * @returns The singleton instance of PowerDataSourcesInfoProvider.
23
+ * @throws Error if the instance is not initialized and no dataSourcesInfo is provided.
24
+ */
25
+ static getInstance(dataSourcesInfo?: DataSourcesInfo): PowerDataSourcesInfoProvider;
26
+ /**
27
+ * Retrieves the data sources information.
28
+ *
29
+ * @returns A promise resolving to the data sources information.
30
+ */
31
+ getDataSourcesInfo(): Promise<DataSourcesInfo>;
32
+ }
33
+ export default PowerDataSourcesInfoProvider;
34
+ //# sourceMappingURL=powerDataSourcesInfoProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"powerDataSourcesInfoProvider.d.ts","sourceRoot":"","sources":["../../../../../src/internal/data/core/runtime/powerDataSourcesInfoProvider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C;;GAEG;AACH,cAAM,4BAA6B,YAAW,6BAA6B;IACzE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAA6C;IACpE,OAAO,CAAC,eAAe,CAAkB;IAEzC;;;OAGG;IACH,OAAO;IAIP;;;;;;;OAOG;WACW,WAAW,CAAC,eAAe,CAAC,EAAE,eAAe,GAAG,4BAA4B;IAU1F;;;;OAIG;IACU,kBAAkB,IAAI,OAAO,CAAC,eAAe,CAAC;CAG5D;AAED,eAAe,4BAA4B,CAAC"}
@@ -0,0 +1,45 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { ErrorCodes, PowerDataRuntimeError } from '../error/error';
5
+ /**
6
+ * Singleton provider for managing data sources information.
7
+ */
8
+ class PowerDataSourcesInfoProvider {
9
+ static instance = null;
10
+ dataSourcesInfo;
11
+ /**
12
+ * Private constructor to enforce the singleton pattern.
13
+ * @param dataSourcesInfo The data sources information to initialize the provider with.
14
+ */
15
+ constructor(dataSourcesInfo) {
16
+ this.dataSourcesInfo = dataSourcesInfo;
17
+ }
18
+ /**
19
+ * Retrieves the singleton instance of PowerDataSourcesInfoProvider.
20
+ * If the instance does not exist, it initializes it with the provided data sources info.
21
+ *
22
+ * @param dataSourcesInfo Optional parameter to initialize the instance if it doesn't exist.
23
+ * @returns The singleton instance of PowerDataSourcesInfoProvider.
24
+ * @throws Error if the instance is not initialized and no dataSourcesInfo is provided.
25
+ */
26
+ static getInstance(dataSourcesInfo) {
27
+ if (!this.instance) {
28
+ if (!dataSourcesInfo) {
29
+ throw new PowerDataRuntimeError(ErrorCodes.DataSourcesInfoNotFound);
30
+ }
31
+ this.instance = new PowerDataSourcesInfoProvider(dataSourcesInfo);
32
+ }
33
+ return this.instance;
34
+ }
35
+ /**
36
+ * Retrieves the data sources information.
37
+ *
38
+ * @returns A promise resolving to the data sources information.
39
+ */
40
+ async getDataSourcesInfo() {
41
+ return this.dataSourcesInfo;
42
+ }
43
+ }
44
+ export default PowerDataSourcesInfoProvider;
45
+ //# sourceMappingURL=powerDataSourcesInfoProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"powerDataSourcesInfoProvider.js","sourceRoot":"","sources":["../../../../../src/internal/data/core/runtime/powerDataSourcesInfoProvider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAEnE;;GAEG;AACH,MAAM,4BAA4B;IACxB,MAAM,CAAC,QAAQ,GAAwC,IAAI,CAAC;IAC5D,eAAe,CAAkB;IAEzC;;;OAGG;IACH,YAAoB,eAAgC;QAClD,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;IAED;;;;;;;OAOG;IACI,MAAM,CAAC,WAAW,CAAC,eAAiC;QACzD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YAClB,IAAI,CAAC,eAAe,EAAE;gBACpB,MAAM,IAAI,qBAAqB,CAAC,UAAU,CAAC,uBAAuB,CAAC,CAAC;aACrE;YACD,IAAI,CAAC,QAAQ,GAAG,IAAI,4BAA4B,CAAC,eAAe,CAAC,CAAC;SACnE;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,kBAAkB;QAC7B,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;;AAGH,eAAe,4BAA4B,CAAC"}
@@ -0,0 +1,43 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { IRuntimeClientProvider, IRuntimeDataClient, IRuntimeMetadataClient } from '../common/types';
5
+ import { IPowerOperationExecutor } from '../types';
6
+ /**
7
+ * RuntimeClientProvider manages the lifecycle of runtime clients for data and metadata operations.
8
+ * Implements a lazy initialization pattern for clients and ensures proper error handling.
9
+ */
10
+ export declare class RuntimeClientProvider implements IRuntimeClientProvider {
11
+ private _dataClient;
12
+ private _metadataClient;
13
+ private readonly _operationExecutor;
14
+ constructor(powerOperationExecutor: IPowerOperationExecutor);
15
+ /**
16
+ * Gets or initializes the data client
17
+ * @throws Error if client initialization fails
18
+ * @returns Promise resolving to IRuntimeDataClient
19
+ */
20
+ getDataClientAsync(): Promise<IRuntimeDataClient>;
21
+ /**
22
+ * Gets or initializes the metadata client
23
+ * @throws Error if client initialization fails
24
+ * @returns Promise resolving to IRuntimeMetadataClient
25
+ */
26
+ getMetadataClientAsync(): Promise<IRuntimeMetadataClient>;
27
+ /**
28
+ * Initializes the data client
29
+ * @returns Promise resolving to IRuntimeDataClient
30
+ */
31
+ private _initializeDataClient;
32
+ /**
33
+ * Initializes the metadata client
34
+ * @returns Promise resolving to IRuntimeMetadataClient
35
+ */
36
+ private _initializeMetadataClient;
37
+ /**
38
+ * Resets both clients, forcing re-initialization on next use
39
+ * Useful for testing or recovering from error states
40
+ */
41
+ reset(): void;
42
+ }
43
+ //# sourceMappingURL=runtimeClientProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeClientProvider.d.ts","sourceRoot":"","sources":["../../../../../src/internal/data/core/runtimeClient/runtimeClientProvider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACrG,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAKnD;;;GAGG;AACH,qBAAa,qBAAsB,YAAW,sBAAsB;IAGlE,OAAO,CAAC,WAAW,CAAiC;IAGpD,OAAO,CAAC,eAAe,CAAqC;IAI5D,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA0B;gBAKjD,sBAAsB,EAAE,uBAAuB;IAI3D;;;;OAIG;IACU,kBAAkB,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAgB9D;;;;OAIG;IACU,sBAAsB,IAAI,OAAO,CAAC,sBAAsB,CAAC;IAgBtE;;;OAGG;YACW,qBAAqB;IAInC;;;OAGG;YACW,yBAAyB;IAIvC;;;OAGG;IACI,KAAK,IAAI,IAAI;CAIrB"}
@@ -0,0 +1,87 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { RuntimeDataClient } from './runtimeDataClient';
5
+ import { RuntimeMetadataClient } from './runtimeMetadataClient';
6
+ import { ErrorCodes, getErrorMessage, PowerDataRuntimeError } from '../error/error';
7
+ /**
8
+ * RuntimeClientProvider manages the lifecycle of runtime clients for data and metadata operations.
9
+ * Implements a lazy initialization pattern for clients and ensures proper error handling.
10
+ */
11
+ export class RuntimeClientProvider {
12
+ // Private members for data and metadata clients
13
+ // The data client is responsible for handling data operations
14
+ _dataClient;
15
+ // The metadata client is responsible for handling metadata operations
16
+ _metadataClient;
17
+ // The operation executor is used to execute operations on the clients
18
+ // It is an instance of IPowerOperationExecutor, which provides the necessary methods for executing operations
19
+ _operationExecutor;
20
+ // Constructor for RuntimeClientProvider
21
+ // Accepts an optional IPowerOperationExecutor instance for executing operations
22
+ // If not provided, uses the default PowerOperationExecutor instance
23
+ constructor(powerOperationExecutor) {
24
+ this._operationExecutor = powerOperationExecutor;
25
+ }
26
+ /**
27
+ * Gets or initializes the data client
28
+ * @throws Error if client initialization fails
29
+ * @returns Promise resolving to IRuntimeDataClient
30
+ */
31
+ async getDataClientAsync() {
32
+ try {
33
+ if (!this._dataClient) {
34
+ this._dataClient = await this._initializeDataClient();
35
+ }
36
+ if (!this._dataClient) {
37
+ throw new PowerDataRuntimeError(ErrorCodes.DataClientNotInitialized);
38
+ }
39
+ return this._dataClient;
40
+ }
41
+ catch (error) {
42
+ throw new PowerDataRuntimeError(ErrorCodes.DataClientInitFailed, getErrorMessage(error));
43
+ }
44
+ }
45
+ /**
46
+ * Gets or initializes the metadata client
47
+ * @throws Error if client initialization fails
48
+ * @returns Promise resolving to IRuntimeMetadataClient
49
+ */
50
+ async getMetadataClientAsync() {
51
+ try {
52
+ if (!this._metadataClient) {
53
+ this._metadataClient = await this._initializeMetadataClient();
54
+ }
55
+ if (!this._metadataClient) {
56
+ throw new PowerDataRuntimeError(ErrorCodes.MetadataClientNotInitialized);
57
+ }
58
+ return this._metadataClient;
59
+ }
60
+ catch (error) {
61
+ throw new PowerDataRuntimeError(ErrorCodes.MetadataClientInitFailed, getErrorMessage(error));
62
+ }
63
+ }
64
+ /**
65
+ * Initializes the data client
66
+ * @returns Promise resolving to IRuntimeDataClient
67
+ */
68
+ async _initializeDataClient() {
69
+ return RuntimeDataClient.createInstanceAsync(this._operationExecutor);
70
+ }
71
+ /**
72
+ * Initializes the metadata client
73
+ * @returns Promise resolving to IRuntimeMetadataClient
74
+ */
75
+ async _initializeMetadataClient() {
76
+ return RuntimeMetadataClient.createInstanceAsync(this._operationExecutor);
77
+ }
78
+ /**
79
+ * Resets both clients, forcing re-initialization on next use
80
+ * Useful for testing or recovering from error states
81
+ */
82
+ reset() {
83
+ this._dataClient = undefined;
84
+ this._metadataClient = undefined;
85
+ }
86
+ }
87
+ //# sourceMappingURL=runtimeClientProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeClientProvider.js","sourceRoot":"","sources":["../../../../../src/internal/data/core/runtimeClient/runtimeClientProvider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EA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eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;SAC9F;IACH,CAAC;IAED;;;OAGG;IACK,KAAK,CAAC,qBAAqB;QACjC,OAAO,iBAAiB,CAAC,mBAAmB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACxE,CAAC;IAED;;;OAGG;IACK,KAAK,CAAC,yBAAyB;QACrC,OAAO,qBAAqB,CAAC,mBAAmB,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAC5E,CAAC;IAED;;;OAGG;IACI,KAAK;QACV,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;QAC7B,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;IACnC,CAAC;CACF"}
@@ -0,0 +1,112 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { IOperationContext, IRuntimeDataClient } from '../common/types';
5
+ import { HttpMethod } from '../common/types';
6
+ import { IOperationResult, IPowerOperationExecutor } from '../types';
7
+ /**
8
+ * RuntimeDataClient handles data operations through PowerOperationExecutor
9
+ */
10
+ export declare class RuntimeDataClient implements IRuntimeDataClient {
11
+ private readonly _powerOperationExecutor;
12
+ private static readonly SERVICES;
13
+ private static readonly ACTIONS;
14
+ private static readonly REQUEST_SOURCE;
15
+ constructor(_powerOperationExecutor: IPowerOperationExecutor);
16
+ /**
17
+ * Creates a new instance of RuntimeDataClient
18
+ */
19
+ static createInstanceAsync(powerOperationExecutor: IPowerOperationExecutor): Promise<IRuntimeDataClient>;
20
+ /**
21
+ * Creates data using POST method
22
+ * @param url - The URL for the request
23
+ * @param apiId - The API ID for authentication
24
+ * @param tableName - The name of the table to access
25
+ * @param body - The request body for the POST method
26
+ * @param operationName - Optional operation name for telemetry
27
+ * @return Promise resolving to the response data
28
+ * @throws Error if the request fails or the response is invalid
29
+ * @throws Error if the request body is invalid
30
+ */
31
+ createDataAsync<TRequest, TResponse>(url: string, apiId: string, tableName: string, body: TRequest, context?: IOperationContext): Promise<IOperationResult<TResponse>>;
32
+ /**
33
+ * Updates data using PATCH method
34
+ * @param url - The URL for the request
35
+ * @param apiId - The API ID for authentication
36
+ * @param tableName - The name of the table to access
37
+ * @param body - The request body for the PATCH method
38
+ * @param operationName - Optional operation name for telemetry
39
+ * @return Promise resolving to the response data
40
+ * @throws Error if the request fails or the response is invalid
41
+ * @throws Error if the request body is invalid
42
+ */
43
+ updateDataAsync<TRequest, TResponse>(url: string, apiId: string, tableName: string, body: TRequest, context?: IOperationContext): Promise<IOperationResult<TResponse>>;
44
+ /**
45
+ * Deletes data using DELETE method
46
+ * @param url - The URL for the request
47
+ * @param connectionApi - The API ID for authentication
48
+ * @param serviceNamespace - The name of the service namespace
49
+ * @param operationName - Optional operation name for telemetry
50
+ * @return Promise resolving to the response data
51
+ * @throws Error if the request fails or the response is invalid
52
+ */
53
+ deleteDataAsync(url: string, connectionApi: string, serviceNamespace: string, context?: IOperationContext): Promise<IOperationResult<void>>;
54
+ /**
55
+ * Retrieves data using GET or POST method
56
+ * @param url - The URL for the request
57
+ * @param apiId - The API ID for authentication
58
+ * @param tableName - The name of the table to access
59
+ * @param method - The HTTP method
60
+ * @param body - Optional request body for POST method
61
+ * @param context - Optional operation context
62
+ * @param operationName - Optional operation name for telemetry
63
+ * @return Promise resolving to the response data
64
+ * @throws Error if the request fails or the response is invalid
65
+ */
66
+ retrieveDataAsync<TRequest, TResponse>(url: string, apiId: string, tableName: string, method: HttpMethod, headers?: {
67
+ [key: string]: string;
68
+ }, body?: unknown, context?: IOperationContext): Promise<IOperationResult<TResponse>>;
69
+ /**
70
+ * Gets an access token for the specified API.
71
+ * If the API is Dataverse, retrieves a dynamic resource token; otherwise, retrieves a standard appservice API token.
72
+ * @param apiId - The API ID for authentication
73
+ * @param datasetName - Optional dataset name for Dataverse
74
+ * @returns Promise resolving to the access token
75
+ * @throws Error if token acquisition fails
76
+ */
77
+ private _getAccessToken;
78
+ private _mergePreferHeaders;
79
+ /**
80
+ * Creates headers for the HTTP request.
81
+ * Combines default headers with any custom headers provided in the config.
82
+ * Custom headers are optional and take precedence over default headers.
83
+ * @param token - The access token for authentication
84
+ * @param config - The HTTP request configuration
85
+ * @return The headers for the request
86
+ * @throws Error if header creation fails
87
+ */
88
+ private _createHeaders;
89
+ /**
90
+ * Executes an HTTP request with the given configuration
91
+ * @param config - The HTTP request configuration
92
+ * @param context - Optional operation context
93
+ * @return Promise resolving to the response data
94
+ * @throws Error if the request fails or the response is invalid
95
+ * @throws Error if the response content type is invalid
96
+ */
97
+ private _executeRequest;
98
+ private _ensureContext;
99
+ /**
100
+ * Checks if the given URL is a Dataverse API call
101
+ * @param url - The URL to check
102
+ * @returns True if the URL is a Dataverse API call, false otherwise
103
+ */
104
+ private _isDataverseCall;
105
+ /**
106
+ * Decodes ArrayBuffer to string, handling both browser and Node.js environments
107
+ * @param buffer - The ArrayBuffer to decode
108
+ * @returns The decoded string
109
+ */
110
+ private _decodeArrayBuffer;
111
+ }
112
+ //# sourceMappingURL=runtimeDataClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeDataClient.d.ts","sourceRoot":"","sources":["../../../../../src/internal/data/core/runtimeClient/runtimeDataClient.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAIL,iBAAiB,EACjB,kBAAkB,EAGnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAqB,MAAM,UAAU,CAAC;AAWxF;;GAEG;AACH,qBAAa,iBAAkB,YAAW,kBAAkB;IAuB9C,OAAO,CAAC,QAAQ,CAAC,uBAAuB;IApBpD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAG9B;IAKF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAI7B;IAIF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAkB;gBAI3B,uBAAuB,EAAE,uBA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