@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,55 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { ErrorCodes } from './codes';
5
+ export const UnknownErrorMessage = 'An unknown error occurred';
6
+ export const ErrorMessages = {
7
+ // PowerDataRuntime specific errors
8
+ [ErrorCodes.InitializationFailed]: 'Failed to initialize PowerDataRuntime',
9
+ [ErrorCodes.InvalidXrmInfo]: 'Xrm info is required',
10
+ [ErrorCodes.OperationsNotInitialized]: 'PowerDataRuntime is not initialized',
11
+ // RuntimeDataSourceService specific errors
12
+ [ErrorCodes.DataSourceNotFound]: 'Data source not found',
13
+ [ErrorCodes.DuplicateDataSource]: 'Duplicate data source',
14
+ [ErrorCodes.InitializationError]: 'Failed to initialize RuntimeDataSourceService',
15
+ [ErrorCodes.InvalidDataSource]: 'Invalid data source',
16
+ // PowerDataSourcesInfoProvider specific errors
17
+ [ErrorCodes.DataSourcesInfoNotFound]: 'DataSourcesInfo must be provided to initialize the singleton instance.',
18
+ // DataClientProvider specific errors
19
+ [ErrorCodes.DataClientInitFailed]: 'Failed to initialize PowerDataClient',
20
+ [ErrorCodes.DataClientNotInitialized]: 'PowerDataClient is not initialized',
21
+ [ErrorCodes.MetadataClientInitFailed]: 'Failed to initialize PowerMetadataClient',
22
+ [ErrorCodes.MetadataClientNotInitialized]: 'PowerMetadataClient is not initialized',
23
+ // DataOperation specific errors
24
+ [ErrorCodes.ClientProviderNotAvailable]: 'Client provider is not available',
25
+ [ErrorCodes.ConnectionReferenceNotFound]: 'Connection reference not found',
26
+ [ErrorCodes.DataClientNotAvailable]: 'PowerDataClient is not available',
27
+ [ErrorCodes.DataSourceServiceNotAvailable]: 'Data source service is not available',
28
+ [ErrorCodes.MetadataClientNotAvailable]: 'PowerMetadataClient is not available',
29
+ // MetadataClient specific errors
30
+ [ErrorCodes.ConnectionConfigFetchFailed]: 'Failed to fetch connection configurations',
31
+ [ErrorCodes.DataSourceConfigFetchFailed]: 'Failed to fetch data source configurations',
32
+ [ErrorCodes.InvalidMetadataResponse]: 'Invalid metadata response format',
33
+ // RuntimeDataClient specific errors
34
+ [ErrorCodes.TokenAcquisitionFailed]: 'Failed to acquire access token',
35
+ };
36
+ // The following error messages are returned to the client whenever a data
37
+ // operation fails. They are not explicitly logged to telemetry as exceptions,
38
+ // but are logged as part of the http pipeline.
39
+ export var DataOperationErrorMessages;
40
+ (function (DataOperationErrorMessages) {
41
+ DataOperationErrorMessages["CreateFailed"] = "Create operation failure";
42
+ DataOperationErrorMessages["DeleteFailed"] = "Delete operation failure";
43
+ DataOperationErrorMessages["ExecuteFailed"] = "Execute operation failure";
44
+ DataOperationErrorMessages["InvalidOperationParameters"] = "Invalid operation parameters";
45
+ DataOperationErrorMessages["InvalidRequest"] = "Invalid request";
46
+ DataOperationErrorMessages["InvalidResponse"] = "Invalid response format";
47
+ DataOperationErrorMessages["MissingConnectorOperation"] = "Connector operation is required";
48
+ DataOperationErrorMessages["MissingDataverseRequest"] = "Dataverse request is required";
49
+ DataOperationErrorMessages["MissingOperationName"] = "Operation name is required";
50
+ DataOperationErrorMessages["MissingRequestBody"] = "Request body is required";
51
+ DataOperationErrorMessages["RetrieveFailed"] = "Retrieve operation failure";
52
+ DataOperationErrorMessages["RetrieveMultipleFailed"] = "Retrieve multiple records operation failure";
53
+ DataOperationErrorMessages["UpdateFailed"] = "Update operation failure";
54
+ })(DataOperationErrorMessages || (DataOperationErrorMessages = {}));
55
+ //# sourceMappingURL=messages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.js","sourceRoot":"","sources":["../../../../../src/internal/data/core/error/messages.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,MAAM,CAAC,MAAM,mBAAmB,GAAG,2BAA2B,CAAC;AAE/D,MAAM,CAAC,MAAM,aAAa,GAAqC;IAC7D,mCAAmC;IACnC,CAAC,UAAU,CAAC,oBAAoB,CAAC,EAAE,uCAAuC;IAC1E,CAAC,UAAU,CAAC,cAAc,CAAC,EAAE,sBAAsB;IACnD,CAAC,UAAU,CAAC,wBAAwB,CAAC,EAAE,qCAAqC;IAE5E,2CAA2C;IAC3C,CAAC,UAAU,CAAC,kBAAkB,C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AA;IAC3C,2FAA6D,CAAA;IAC7D,uFAAyD,CAAA;IACzD,iFAAmD,CAAA;IACnD,6EAA+C,CAAA;IAC/C,2EAA6C,CAAA;IAC7C,oGAAsE,CAAA;IACtE,uEAAyC,CAAA;AAC3C,CAAC,EAdW,0BAA0B,KAA1B,0BAA0B,QAcrC"}
@@ -0,0 +1,30 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { ErrorCodes } from './codes';
5
+ /**
6
+ * Base error class for PowerDataRuntime operations
7
+ */
8
+ export declare class PowerDataRuntimeError extends Error {
9
+ readonly code: ErrorCodes;
10
+ /**
11
+ * Creates an instance of PowerDataRuntimeError.
12
+ * @param code - The error code associated with the error.
13
+ * @param additionalInfo - Optional additional information to include in the error message.
14
+ * @param messageOverride - Optional override for the default error message.
15
+ */
16
+ constructor(code: ErrorCodes, additionalInfo?: string, messageOverride?: string);
17
+ }
18
+ export interface PowerDataRuntimeHttpError {
19
+ message: string;
20
+ status?: number;
21
+ requestId?: string;
22
+ stack?: string;
23
+ }
24
+ export interface HttpErrorResponse {
25
+ status?: number;
26
+ headers?: {
27
+ [key: string]: string;
28
+ };
29
+ }
30
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/internal/data/core/error/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;aAOlB,IAAI,EAAE,UAAU;IAN5C;;;;;OAKG;gBACyB,IAAI,EAAE,UAAU,EAAE,cAAc,CAAC,EAAE,MAAM,EAAE,eAAe,CAAC,EAAE,MAAM;CAShG;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE;QACR,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC;CACH"}
@@ -0,0 +1,28 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { Log } from '../telemetry/log';
5
+ import { ErrorMessages, UnknownErrorMessage } from './messages';
6
+ /**
7
+ * Base error class for PowerDataRuntime operations
8
+ */
9
+ export class PowerDataRuntimeError extends Error {
10
+ code;
11
+ /**
12
+ * Creates an instance of PowerDataRuntimeError.
13
+ * @param code - The error code associated with the error.
14
+ * @param additionalInfo - Optional additional information to include in the error message.
15
+ * @param messageOverride - Optional override for the default error message.
16
+ */
17
+ constructor(code, additionalInfo, messageOverride) {
18
+ let message = messageOverride || ErrorMessages[code] || UnknownErrorMessage;
19
+ if (additionalInfo) {
20
+ message += `: ${additionalInfo}`;
21
+ }
22
+ super(message);
23
+ this.code = code;
24
+ this.name = 'PowerDataRuntimeError';
25
+ Log.trackException(this);
26
+ }
27
+ }
28
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/internal/data/core/error/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGhE;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAOlB;IAN5B;;;;;OAKG;IACH,YAA4B,IAAgB,EAAE,cAAuB,EAAE,eAAwB;QAC7F,IAAI,OAAO,GAAG,eAAe,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC;QAC5E,IAAI,cAAc,EAAE;YAClB,OAAO,IAAI,KAAK,cAAc,EAAE,CAAC;SAClC;QACD,KAAK,CAAC,OAAO,CAAC,CAAC;QALW,SAAI,GAAJ,IAAI,CAAY;QAM1C,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QACpC,GAAG,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;CACF"}
@@ -0,0 +1,24 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { IOperationResult } from '../types';
5
+ import { PowerDataRuntimeError, PowerDataRuntimeHttpError } from './types';
6
+ /**
7
+ * Retrieves the error message from an error object.
8
+ * @param error - The error to handle, which can be an instance of Error or IOperationResult.
9
+ * @returns The error message if applicable, or throws the error if it's a PowerDataRuntimeError.
10
+ */
11
+ export declare function getErrorMessage(error: Error | IOperationResult<unknown> | object | PowerDataRuntimeHttpError | string | unknown | unknown[]): string;
12
+ /**
13
+ * Handles operation errors and creates an error OperationResult
14
+ * @param error - The error object or OperationResult
15
+ * @param friendlyMessage - A friendly message to include in the error
16
+ */
17
+ export declare function createErrorResponse<T>(error: Error | PowerDataRuntimeError | IOperationResult<T> | unknown, friendlyMessage: string): IOperationResult<T>;
18
+ /**
19
+ * Parses an error from the HTTP plugin and returns a PowerDataRuntimeHttpError object.
20
+ * @param error - The error to parse, which should be an array with a nested array.
21
+ * @returns A PowerDataRuntimeHttpError object containing the message and response.
22
+ */
23
+ export declare function parseHttpPluginError(error: unknown): PowerDataRuntimeHttpError;
24
+ //# sourceMappingURL=util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../../../src/internal/data/core/error/util.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,gBAAgB,EAAqB,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAqB,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAI9F;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,KAAK,GAAG,gBAAgB,CAAC,OAAO,CAAC,GAAG,MAAM,GAAG,yBAAyB,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,EAAE,GAC3G,MAAM,CAcR;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,KAAK,EAAE,KAAK,GAAG,qBAAqB,GAAG,gBAAgB,CAAC,CAAC,CAAC,GAAG,OAAO,EACpE,eAAe,EAAE,MAAM,GACtB,gBAAgB,CAAC,CAAC,CAAC,CAmBrB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,yBAAyB,CAmB9E"}
@@ -0,0 +1,71 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { isOperationResult } from '../types';
5
+ import { PowerDataRuntimeError } from './types';
6
+ import { UnknownErrorMessage } from './messages';
7
+ import { HeaderNames } from './constants';
8
+ /**
9
+ * Retrieves the error message from an error object.
10
+ * @param error - The error to handle, which can be an instance of Error or IOperationResult.
11
+ * @returns The error message if applicable, or throws the error if it's a PowerDataRuntimeError.
12
+ */
13
+ export function getErrorMessage(error) {
14
+ if (typeof error === 'string') {
15
+ return error;
16
+ }
17
+ if (error instanceof Error || error instanceof PowerDataRuntimeError) {
18
+ return error.message || UnknownErrorMessage;
19
+ }
20
+ if (isOperationResult(error)) {
21
+ return error.error?.message || UnknownErrorMessage;
22
+ }
23
+ if (typeof error === 'object') {
24
+ return JSON.stringify(error);
25
+ }
26
+ return UnknownErrorMessage;
27
+ }
28
+ /**
29
+ * Handles operation errors and creates an error OperationResult
30
+ * @param error - The error object or OperationResult
31
+ * @param friendlyMessage - A friendly message to include in the error
32
+ */
33
+ export function createErrorResponse(error, friendlyMessage) {
34
+ const message = getErrorMessage(error);
35
+ let data;
36
+ if (isOperationResult(error)) {
37
+ data = error.data;
38
+ }
39
+ const errorData = new Error(`${friendlyMessage}: ${message}`);
40
+ if (error instanceof Error) {
41
+ errorData.stack = error.stack;
42
+ }
43
+ return {
44
+ success: false,
45
+ error: errorData,
46
+ data: data,
47
+ };
48
+ }
49
+ /**
50
+ * Parses an error from the HTTP plugin and returns a PowerDataRuntimeHttpError object.
51
+ * @param error - The error to parse, which should be an array with a nested array.
52
+ * @returns A PowerDataRuntimeHttpError object containing the message and response.
53
+ */
54
+ export function parseHttpPluginError(error) {
55
+ let message = UnknownErrorMessage;
56
+ let response;
57
+ if (Array.isArray(error)) {
58
+ if (Array.isArray(error[0])) {
59
+ message = error[0][0] || UnknownErrorMessage;
60
+ response = error[0][2];
61
+ }
62
+ }
63
+ const status = response?.status;
64
+ const requestId = response?.headers?.[HeaderNames.RequestId];
65
+ return {
66
+ message,
67
+ status,
68
+ requestId,
69
+ };
70
+ }
71
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../../../../../src/internal/data/core/error/util.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAoB,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC/D,OAAO,EAAqB,qBAAqB,EAA6B,MAAM,SAAS,CAAC;AAC9F,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,KAA4G;IAE5G,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC7B,OAAO,KAAK,CAAC;KACd;IACD,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,YAAY,qBAAqB,EAAE;QACpE,OAAO,KAAK,CAAC,OAAO,IAAI,mBAAmB,CAAC;KAC7C;IACD,IAAI,iBAAiB,CAAC,KAAK,CAAC,EAAE;QAC5B,OAAO,KAAK,CAAC,KAAK,EAAE,OAAO,IAAI,mBAAmB,CAAC;KACpD;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;Q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,CAAC"}
@@ -0,0 +1,65 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { IPowerDataSourcesInfoProvider } from '../common/types';
5
+ import { DataSourcesInfo, IDataSourceInfo } from '../types';
6
+ /**
7
+ * Error types specific to RuntimeDataSourceService
8
+ */
9
+ export declare enum DataSourceServiceError {
10
+ }
11
+ /**
12
+ * RuntimeDataSourceService provides functionality for managing and retrieving
13
+ * data source information.
14
+ */
15
+ export declare class RuntimeDataSourceService {
16
+ private _powerDataSourcesInfoProvider;
17
+ /**
18
+ * Data source information
19
+ */
20
+ private _dataSourcesInfo;
21
+ /**
22
+ * Indicates whether the service has been initialized
23
+ */
24
+ private _isInitialized;
25
+ /**
26
+ * Creates a new instance of RuntimeDataSourceService
27
+ */
28
+ constructor(_powerDataSourcesInfoProvider: IPowerDataSourcesInfoProvider);
29
+ /**
30
+ * Initializes the service by loading user data sources
31
+ * @throws PowerDataRuntimeError if initialization fails
32
+ */
33
+ initialize(): Promise<void>;
34
+ /**
35
+ * Gets all user data sources
36
+ * @returns Array of data source information
37
+ * @throws PowerDataRuntimeError if service is not initialized
38
+ */
39
+ getUserDataSources(): Promise<DataSourcesInfo>;
40
+ /**
41
+ * Gets information for a specific data source
42
+ * @param dataSource - The ID of the data source
43
+ * @returns Data source information
44
+ * @throws PowerDataRuntimeError if data source is not found or service is not initialized
45
+ */
46
+ getDataSource(dataSource: string): Promise<IDataSourceInfo>;
47
+ /**
48
+ * Checks if a data source exists
49
+ * @param dataSourceId - The ID of the data source to check
50
+ * @returns True if the data source exists, false otherwise
51
+ * @throws PowerDataRuntimeError if service is not initialized
52
+ */
53
+ hasDataSource(dataSource: string): Promise<boolean>;
54
+ /**
55
+ * Ensures the service is initialized
56
+ * @throws PowerDataRuntimeError if service is not initialized
57
+ */
58
+ private _ensureInitialized;
59
+ /**
60
+ * Gets user data sources from the provided data source schemas
61
+ * @returns Promise resolving to array of data source information
62
+ */
63
+ private _getUserDataSources;
64
+ }
65
+ //# sourceMappingURL=runtimeDataSourceService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeDataSourceService.d.ts","sourceRoot":"","sources":["../../../../../src/internal/data/core/metadata/runtimeDataSourceService.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,6BAA6B,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE5D;;GAEG;AACH,oBAAY,sBAAsB;CAAG;AAErC;;;GAGG;AACH,qBAAa,wBAAwB;IAavB,OAAO,CAAC,6BAA6B;IAZjD;;OAEG;IACH,OAAO,CAAC,gBAAgB,CAAkB;IAC1C;;OAEG;IACH,OAAO,CAAC,cAAc,CAAU;IAEhC;;OAEG;gBACiB,6BAA6B,EAAE,6BAA6B;IAKhF;;;OAGG;IACU,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAexC;;;;OAIG;IACU,kBAAkB,IAAI,OAAO,CAAC,eAAe,CAAC;IAM3D;;;;;OAKG;IACU,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAWxE;;;;;OAKG;IACU,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAMhE;;;OAGG;YACW,kBAAkB;IAMhC;;;OAGG;YACW,mBAAmB;CAIlC"}
@@ -0,0 +1,101 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { ErrorCodes, getErrorMessage, PowerDataRuntimeError } from '../error/error';
5
+ /**
6
+ * Error types specific to RuntimeDataSourceService
7
+ */
8
+ export var DataSourceServiceError;
9
+ (function (DataSourceServiceError) {
10
+ })(DataSourceServiceError || (DataSourceServiceError = {}));
11
+ /**
12
+ * RuntimeDataSourceService provides functionality for managing and retrieving
13
+ * data source information.
14
+ */
15
+ export class RuntimeDataSourceService {
16
+ _powerDataSourcesInfoProvider;
17
+ /**
18
+ * Data source information
19
+ */
20
+ _dataSourcesInfo;
21
+ /**
22
+ * Indicates whether the service has been initialized
23
+ */
24
+ _isInitialized;
25
+ /**
26
+ * Creates a new instance of RuntimeDataSourceService
27
+ */
28
+ constructor(_powerDataSourcesInfoProvider) {
29
+ this._powerDataSourcesInfoProvider = _powerDataSourcesInfoProvider;
30
+ this._dataSourcesInfo = {};
31
+ this._isInitialized = false;
32
+ }
33
+ /**
34
+ * Initializes the service by loading user data sources
35
+ * @throws PowerDataRuntimeError if initialization fails
36
+ */
37
+ async initialize() {
38
+ try {
39
+ const userDataSources = await this._getUserDataSources();
40
+ this._dataSourcesInfo = {};
41
+ Object.keys(userDataSources).forEach((key) => {
42
+ this._dataSourcesInfo[key] = userDataSources[key];
43
+ });
44
+ this._isInitialized = true;
45
+ }
46
+ catch (error) {
47
+ throw new PowerDataRuntimeError(ErrorCodes.InitializationError, getErrorMessage(error));
48
+ }
49
+ }
50
+ /**
51
+ * Gets all user data sources
52
+ * @returns Array of data source information
53
+ * @throws PowerDataRuntimeError if service is not initialized
54
+ */
55
+ async getUserDataSources() {
56
+ await this._ensureInitialized();
57
+ return this._dataSourcesInfo;
58
+ }
59
+ /**
60
+ * Gets information for a specific data source
61
+ * @param dataSource - The ID of the data source
62
+ * @returns Data source information
63
+ * @throws PowerDataRuntimeError if data source is not found or service is not initialized
64
+ */
65
+ async getDataSource(dataSource) {
66
+ await this._ensureInitialized();
67
+ const dataSourceInfo = this._dataSourcesInfo[dataSource];
68
+ if (!dataSourceInfo) {
69
+ throw new PowerDataRuntimeError(ErrorCodes.DataSourceNotFound, dataSource);
70
+ }
71
+ return dataSourceInfo;
72
+ }
73
+ /**
74
+ * Checks if a data source exists
75
+ * @param dataSourceId - The ID of the data source to check
76
+ * @returns True if the data source exists, false otherwise
77
+ * @throws PowerDataRuntimeError if service is not initialized
78
+ */
79
+ async hasDataSource(dataSource) {
80
+ await this._ensureInitialized();
81
+ return dataSource in this._dataSourcesInfo;
82
+ }
83
+ /**
84
+ * Ensures the service is initialized
85
+ * @throws PowerDataRuntimeError if service is not initialized
86
+ */
87
+ async _ensureInitialized() {
88
+ if (!this._isInitialized) {
89
+ await this.initialize();
90
+ }
91
+ }
92
+ /**
93
+ * Gets user data sources from the provided data source schemas
94
+ * @returns Promise resolving to array of data source information
95
+ */
96
+ async _getUserDataSources() {
97
+ const dataSourcesInfo = await this._powerDataSourcesInfoProvider.getDataSourcesInfo();
98
+ return Promise.resolve(dataSourcesInfo);
99
+ }
100
+ }
101
+ //# sourceMappingURL=runtimeDataSourceService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeDataSourceService.js","sourceRoot":"","sources":["../../../../../src/internal/data/core/metadata/runtimeDataSourceService.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAIpF;;GAEG;AACH,MAAM,CAAN,IAAY,sBAAyB;AAArC,WAAY,sBAAsB;AAAE,CAAC,EAAzB,sBAAsB,KAAtB,sBAAsB,QAAG;AAErC;;;GAGG;AACH,MAAM,OAAO,wBAAwB;IAaf;IAZpB;;OAEG;IACK,gBAAgB,CAAkB;IAC1C;;OAEG;IACK,cAAc,CAAU;IAEhC;;OAEG;IACH,YAAoB,6BAA4D;QAA5D,kCAA6B,GAA7B,6BAA6B,CAA+B;QAC9E,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACI,KAAK,CAAC,UAAU;QACrB,IAAI;YACF,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAEzD,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;YAC3B,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;gBAC3C,I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@ -0,0 +1,17 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { IRuntimeClientProvider } from '../common/types';
5
+ import { IConnectionApi, IConnectionReference, IMetadataOperations, IOperationContext } from '../common/types';
6
+ import { IOperationResult } from '../types';
7
+ /**
8
+ * RuntimeMetadataOperations provides functionality for retrieving metadata
9
+ * about connections and APIs.
10
+ */
11
+ export declare class RuntimeMetadataOperations implements IMetadataOperations {
12
+ private readonly _clientProvider;
13
+ constructor(_clientProvider: IRuntimeClientProvider);
14
+ getConnections(context?: IOperationContext): Promise<IOperationResult<IConnectionReference[]>>;
15
+ getConnectionApis(_connectionId: string, context?: IOperationContext): Promise<IOperationResult<IConnectionApi[]>>;
16
+ }
17
+ //# sourceMappingURL=runtimeMetadataOperations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeMetadataOperations.d.ts","sourceRoot":"","sources":["../../../../../src/internal/data/core/metadata/runtimeMetadataOperations.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C;;;GAGG;AACH,qBAAa,yBAA0B,YAAW,mBAAmB;IAGvD,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAAf,eAAe,EAAE,sBAAsB;IAEvD,cAAc,CACzB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,gBAAgB,CAAC,oBAAoB,EAAE,CAAC,CAAC;IAUvC,iBAAiB,CAC5B,aAAa,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,gBAAgB,CAAC,cAAc,EAAE,CAAC,CAAC;CAS/C"}
@@ -0,0 +1,34 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ /**
5
+ * RuntimeMetadataOperations provides functionality for retrieving metadata
6
+ * about connections and APIs.
7
+ */
8
+ export class RuntimeMetadataOperations {
9
+ _clientProvider;
10
+ // Static identifiers for services and actions
11
+ // Used to identify specific services and actions within the PowerApps environment
12
+ constructor(_clientProvider) {
13
+ this._clientProvider = _clientProvider;
14
+ }
15
+ async getConnections(context) {
16
+ const client = await this._clientProvider.getMetadataClientAsync();
17
+ const response = await client.getAppConnectionConfigsAsync(context);
18
+ return {
19
+ success: response.success,
20
+ data: response.data ? [response.data] : [],
21
+ error: response.error,
22
+ };
23
+ }
24
+ async getConnectionApis(_connectionId, context) {
25
+ const client = await this._clientProvider.getMetadataClientAsync();
26
+ const response = await client.getAppDataSourceConfigsAsync(context);
27
+ return {
28
+ success: response.success,
29
+ data: response.data ? [response.data] : [],
30
+ error: response.error,
31
+ };
32
+ }
33
+ }
34
+ //# sourceMappingURL=runtimeMetadataOperations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeMetadataOperations.js","sourceRoot":"","sources":["../../../../../src/internal/data/core/metadata/runtimeMetadataOperations.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH;;;GAGG;AACH,MAAM,OAAO,yBAAyB;IAGP;IAF7B,8CAA8C;IAC9C,kFAAkF;IAClF,YAA6B,eAAuC;QAAvC,oBAAe,GAAf,eAAe,CAAwB;IAAG,CAAC;IAEjE,KAAK,CAAC,cAAc,CACzB,OAA2B;QAE3B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,sBAAsB,EAAE,CAAC;QACnE,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC;QACpE,OAAO;YACL,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE;YAC1C,KAAK,EAAE,QAAQ,CAAC,KAAK;SACtB,CAAC;IACJ,CAAC;IAEM,KAAK,CAAC,iBAAiB,CAC5B,aAAqB,EACrB,OAA2B;QAE3B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,sBAAsB,EAAE,CAAC;QACnE,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,4BAA4B,CAAC,OAAO,CAAC,CAAC;QACpE,OAAO;YACL,OAAO,EAAE,QAAQ,CAAC,OAAO;YACzB,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAsB,CAAC,CAAC,CAAC,CAAC,EAAE;YAC5D,KAAK,EAAE,QAAQ,CAAC,KAAK;SACtB,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,11 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import type { DataSourcesInfo } from '../types';
5
+ import { PowerDataRuntime } from './powerDataRuntime';
6
+ /**
7
+ * Builds (or retrieves) a singleton runtime context based on provided data sources.
8
+ * Must be called after initializeRuntime() has injected the OperationExecutor.
9
+ */
10
+ export declare function getPowerSdkInstance(dataSourcesInfo: DataSourcesInfo): PowerDataRuntime;
11
+ //# sourceMappingURL=getRuntimeContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRuntimeContext.d.ts","sourceRoot":"","sources":["../../../../../src/internal/data/core/runtime/getRuntimeContext.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,eAAe,EAAE,eAAe,GAAG,gBAAgB,CAKtF"}
@@ -0,0 +1,16 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { getPowerDataRuntime } from './powerDataRuntimeInstance';
5
+ import { getExecutor } from './initializeRuntime';
6
+ import PowerDataSourcesInfoProvider from './powerDataSourcesInfoProvider';
7
+ /**
8
+ * Builds (or retrieves) a singleton runtime context based on provided data sources.
9
+ * Must be called after initializeRuntime() has injected the OperationExecutor.
10
+ */
11
+ export function getPowerSdkInstance(dataSourcesInfo) {
12
+ const executor = getExecutor(); // from initializeRuntime.ts
13
+ const provider = PowerDataSourcesInfoProvider.getInstance(dataSourcesInfo);
14
+ return getPowerDataRuntime(provider, executor);
15
+ }
16
+ //# sourceMappingURL=getRuntimeContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRuntimeContext.js","sourceRoot":"","sources":["../../../../../src/internal/data/core/runtime/getRuntimeContext.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,4BAA4B,MAAM,gCAAgC,CAAC;AAI1E;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,eAAgC;IAClE,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC,CAAC,4BAA4B;IAC5D,MAAM,QAAQ,GAAG,4BAA4B,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IAE3E,OAAO,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,13 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { IPowerOperationExecutor } from '../types';
5
+ /**
6
+ * Initializes the PowerDataRuntime with the provided executor.
7
+ * This function should be called once at the start of the application.
8
+ * @param executor - The executor to be used for operations.
9
+ * @throws Will throw an error if the executor is already initialized.
10
+ */
11
+ export declare function initializeRuntime(executor: IPowerOperationExecutor): void;
12
+ export declare function getExecutor(): IPowerOperationExecutor;
13
+ //# sourceMappingURL=initializeRuntime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initializeRuntime.d.ts","sourceRoot":"","sources":["../../../../../src/internal/data/core/runtime/initializeRuntime.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAOnD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,uBAAuB,GAAG,IAAI,CAczE;AASD,wBAAgB,WAAW,IAAI,uBAAuB,CAQrD"}
@@ -0,0 +1,38 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { ErrorCodes, PowerDataRuntimeError } from '../error/error';
5
+ // _executor is a private variable that holds the instance of IPowerOperationExecutor.
6
+ let _executor;
7
+ // _initialized is a private variable that indicates whether the runtime has been initialized.
8
+ let _initialized = false;
9
+ /**
10
+ * Initializes the PowerDataRuntime with the provided executor.
11
+ * This function should be called once at the start of the application.
12
+ * @param executor - The executor to be used for operations.
13
+ * @throws Will throw an error if the executor is already initialized.
14
+ */
15
+ export function initializeRuntime(executor) {
16
+ if (_initialized) {
17
+ return;
18
+ }
19
+ if (!executor) {
20
+ throw new PowerDataRuntimeError(ErrorCodes.InvalidOperationExecutor, 'PowerDataRuntime is not initialized. Please call initializeRuntime() first.');
21
+ }
22
+ _executor = executor;
23
+ _initialized = true;
24
+ }
25
+ /*
26
+ * Retrieves the current executor.
27
+ * This function should be called after initializeRuntime() to get the executor.
28
+ *
29
+ * @returns The current executor.
30
+ * @throws Will throw an error if the executor is not initialized.
31
+ */
32
+ export function getExecutor() {
33
+ if (!_executor) {
34
+ throw new PowerDataRuntimeError(ErrorCodes.InvalidOperationExecutor, 'PowerDataRuntime is not initialized. Please call initializeRuntime() first.');
35
+ }
36
+ return _executor;
37
+ }
38
+ //# sourceMappingURL=initializeRuntime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initializeRuntime.js","sourceRoot":"","sources":["../../../../../src/internal/data/core/runtime/initializeRuntime.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAGnE,sFAAsF;AACtF,IAAI,SAA8C,CAAC;AACnD,8FAA8F;AAC9F,IAAI,YAAY,GAAG,KAAK,CAAC;AAEzB;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAiC;IACjE,IAAI,YAAY,EAAE;QAChB,OAAO;KACR;IAED,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,qBAAqB,CAC7B,UAAU,CAAC,wBAAwB,EACnC,6EAA6E,CAC9E,CAAC;KACH;IAED,SAAS,GAAG,QAAQ,CAAC;IACrB,YAAY,GAAG,IAAI,CAAC;AACtB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW;IACzB,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,qBAAqB,CAC7B,UAAU,CAAC,wBAAwB,EACnC,6EAA6E,CAC9E,CAAC;KACH;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,68 @@
1
+ /*!
2
+ * Copyright (C) Microsoft Corporation. All rights reserved.
3
+ */
4
+ import { IMetadataOperations, IPowerDataSourcesInfoProvider, IXrmContext } from '../common/types';
5
+ import { IClientConfig } from '../common/types';
6
+ import { IDataOperations, IPowerDataRuntime, IPowerOperationExecutor } from '../types';
7
+ /**
8
+ * Interface for PowerDataRuntime initialization parameters
9
+ */
10
+ export interface IPowerDataRuntimeInitParams {
11
+ powerDataSourcesInfoProvider: IPowerDataSourcesInfoProvider;
12
+ powerOperationExecutor: IPowerOperationExecutor;
13
+ xrm: IXrmContext;
14
+ clientConfig?: IClientConfig;
15
+ }
16
+ /**
17
+ * PowerDataRuntime provides a unified interface for data and metadata operations
18
+ * in the Power runtime environment.
19
+ */
20
+ export declare class PowerDataRuntime implements IPowerDataRuntime {
21
+ private readonly _clientProvider;
22
+ private readonly _dataSourceService;
23
+ private readonly _xrm;
24
+ private _dataOperations?;
25
+ private _metadataOperations?;
26
+ private _isInitialized;
27
+ /**
28
+ * Creates a new instance of PowerDataRuntime
29
+ * @param params - Initialization parameters
30
+ * @throws DataRuntimeError if initialization fails
31
+ */
32
+ constructor(params: IPowerDataRuntimeInitParams);
33
+ /**
34
+ * Gets the Data operations interface
35
+ * @throws PowerDataRuntimeError if operations are not initialized
36
+ */
37
+ get Data(): IDataOperations;
38
+ /**
39
+ * Gets the Metadata operations interface
40
+ * @throws PowerDataRuntimeError if operations are not initialized
41
+ */
42
+ get Metadata(): IMetadataOperations;
43
+ /**
44
+ * Validates initialization parameters
45
+ * @param params - Parameters to validate
46
+ * @throws PowerDataRuntimeError if validation fails
47
+ */
48
+ private _validateInitParams;
49
+ /**
50
+ * Ensures the PowerDataRuntime is initialized
51
+ * @throws PowerDataRuntimeError if not initialized
52
+ */
53
+ private _ensureInitialized;
54
+ /**
55
+ * Initializes the PowerDataRuntime components
56
+ * @throws PowerDataRuntimeError if initialization fails
57
+ */
58
+ private _initialize;
59
+ /**
60
+ * Creates a new instance of DataOperations
61
+ */
62
+ private _createDataOperations;
63
+ /**
64
+ * Creates a new instance of MetadataOperations
65
+ */
66
+ private _createMetadataOperations;
67
+ }
68
+ //# sourceMappingURL=powerDataRuntime.d.ts.map