@microsoft/power-apps-native-host 0.2.25 → 0.3.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 (129) hide show
  1. package/README.md +21 -2
  2. package/compatibility/current.json +0 -1
  3. package/lib/NOTICE.txt +6 -12
  4. package/lib/commonjs/auth/AuthContext.js +74 -18
  5. package/lib/commonjs/bridge/NativePowerAppsBridge.js +11 -18
  6. package/lib/commonjs/bridge/PowerPagesBridge.js +27 -8
  7. package/lib/commonjs/bridge/bridgeState.js +40 -0
  8. package/lib/commonjs/connections/ConnectionSetupScreen.js +459 -80
  9. package/lib/commonjs/connections/PowerPlatformConnectionApi.js +946 -0
  10. package/lib/commonjs/connections/connectionMetadata.js +127 -0
  11. package/lib/commonjs/connections/connectionState.js +96 -0
  12. package/lib/commonjs/connections/disambiguate.js +19 -11
  13. package/lib/commonjs/connections/resolveConnections.js +347 -0
  14. package/lib/commonjs/connections/types.js +106 -0
  15. package/lib/commonjs/{platform → connections}/useConnectionRefs.js +128 -65
  16. package/lib/commonjs/connections/useConnectionSetup.js +111 -52
  17. package/lib/commonjs/controls/FilePicker.js +6 -0
  18. package/lib/commonjs/controls/ImagePicker.js +8 -0
  19. package/lib/commonjs/index.js +166 -4
  20. package/lib/commonjs/logger.js +9 -6
  21. package/lib/commonjs/offline/createOfflineHostActivationCallbacks.js +61 -0
  22. package/lib/commonjs/offline/useOfflineIntegrationWithStartupGate.js +46 -0
  23. package/lib/commonjs/offline/useOfflineIntegrationWithStartupGate.web.js +13 -0
  24. package/lib/commonjs/platform/DataverseDataSources.js +14 -0
  25. package/lib/commonjs/platform/DataverseGlobalDiscoveryApi.js +49 -0
  26. package/lib/commonjs/platform/GlobalDiscovery.js +51 -0
  27. package/lib/commonjs/platform/PowerPlatformEnvironmentApi.js +6 -106
  28. package/lib/commonjs/provider/PowerAppsHostProvider.js +156 -25
  29. package/lib/commonjs/provider/PowerAppsProvider.js +173 -134
  30. package/lib/commonjs/provider/SessionDetailsGesture.js +216 -0
  31. package/lib/commonjs/telemetry/OfflineSdkTelemetry.js +95 -0
  32. package/lib/commonjs/telemetry/OfflineSdkTelemetry.web.js +9 -0
  33. package/lib/commonjs/telemetry/index.js +22 -3
  34. package/lib/module/auth/AuthContext.js +74 -18
  35. package/lib/module/bridge/NativePowerAppsBridge.js +12 -19
  36. package/lib/module/bridge/PowerPagesBridge.js +27 -8
  37. package/lib/module/bridge/bridgeState.js +34 -0
  38. package/lib/module/connections/ConnectionSetupScreen.js +460 -81
  39. package/lib/module/connections/PowerPlatformConnectionApi.js +932 -0
  40. package/lib/module/connections/connectionMetadata.js +112 -0
  41. package/lib/module/connections/connectionState.js +82 -0
  42. package/lib/module/connections/disambiguate.js +19 -12
  43. package/lib/module/connections/resolveConnections.js +342 -0
  44. package/lib/module/connections/types.js +91 -0
  45. package/lib/module/{platform → connections}/useConnectionRefs.js +129 -66
  46. package/lib/module/connections/useConnectionSetup.js +113 -54
  47. package/lib/module/controls/FilePicker.js +6 -0
  48. package/lib/module/controls/ImagePicker.js +8 -0
  49. package/lib/module/index.js +10 -4
  50. package/lib/module/logger.js +8 -6
  51. package/lib/module/offline/createOfflineHostActivationCallbacks.js +55 -0
  52. package/lib/module/offline/useOfflineIntegrationWithStartupGate.js +42 -0
  53. package/lib/module/offline/useOfflineIntegrationWithStartupGate.web.js +9 -0
  54. package/lib/module/platform/DataverseDataSources.js +10 -0
  55. package/lib/module/platform/DataverseGlobalDiscoveryApi.js +45 -0
  56. package/lib/module/platform/GlobalDiscovery.js +45 -0
  57. package/lib/module/platform/PowerPlatformEnvironmentApi.js +5 -104
  58. package/lib/module/provider/PowerAppsHostProvider.js +159 -28
  59. package/lib/module/provider/PowerAppsProvider.js +177 -138
  60. package/lib/module/provider/SessionDetailsGesture.js +211 -0
  61. package/lib/module/telemetry/OfflineSdkTelemetry.js +91 -0
  62. package/lib/module/telemetry/OfflineSdkTelemetry.web.js +5 -0
  63. package/lib/module/telemetry/index.js +15 -4
  64. package/lib/typescript/commonjs/auth/AuthContext.d.ts +3 -1
  65. package/lib/typescript/commonjs/auth/AuthContext.web.d.ts +1 -0
  66. package/lib/typescript/commonjs/bridge/bridgeState.d.ts +5 -0
  67. package/lib/typescript/commonjs/connections/ConnectionSetupScreen.d.ts +28 -7
  68. package/lib/typescript/commonjs/{platform → connections}/PowerPlatformConnectionApi.d.ts +52 -43
  69. package/lib/typescript/commonjs/connections/connectionMetadata.d.ts +66 -0
  70. package/lib/typescript/commonjs/connections/connectionState.d.ts +16 -0
  71. package/lib/typescript/commonjs/connections/disambiguate.d.ts +4 -2
  72. package/lib/typescript/commonjs/{platform → connections}/resolveConnections.d.ts +19 -19
  73. package/lib/typescript/commonjs/connections/types.d.ts +129 -1
  74. package/lib/typescript/commonjs/{platform → connections}/useConnectionRefs.d.ts +33 -24
  75. package/lib/typescript/commonjs/connections/useConnectionSetup.d.ts +12 -8
  76. package/lib/typescript/commonjs/controls/FilePicker.d.ts +7 -1
  77. package/lib/typescript/commonjs/controls/ImagePicker.d.ts +9 -1
  78. package/lib/typescript/commonjs/index.d.ts +17 -10
  79. package/lib/typescript/commonjs/logger.d.ts +4 -4
  80. package/lib/typescript/commonjs/offline/createOfflineHostActivationCallbacks.d.ts +12 -0
  81. package/lib/typescript/commonjs/offline/useOfflineIntegrationWithStartupGate.d.ts +15 -0
  82. package/lib/typescript/commonjs/offline/useOfflineIntegrationWithStartupGate.web.d.ts +6 -0
  83. package/lib/typescript/commonjs/platform/DataverseDataSources.d.ts +27 -0
  84. package/lib/typescript/commonjs/platform/DataverseGlobalDiscoveryApi.d.ts +3 -0
  85. package/lib/typescript/commonjs/platform/GlobalDiscovery.d.ts +4 -0
  86. package/lib/typescript/commonjs/platform/PowerPlatformEnvironmentApi.d.ts +3 -74
  87. package/lib/typescript/commonjs/provider/PowerAppsHostProvider.d.ts +29 -18
  88. package/lib/typescript/commonjs/provider/PowerAppsProvider.d.ts +30 -8
  89. package/lib/typescript/commonjs/provider/SessionDetailsGesture.d.ts +13 -0
  90. package/lib/typescript/commonjs/telemetry/OfflineSdkTelemetry.d.ts +15 -0
  91. package/lib/typescript/commonjs/telemetry/OfflineSdkTelemetry.web.d.ts +2 -0
  92. package/lib/typescript/commonjs/telemetry/index.d.ts +13 -1
  93. package/lib/typescript/module/auth/AuthContext.d.ts +3 -1
  94. package/lib/typescript/module/auth/AuthContext.web.d.ts +1 -0
  95. package/lib/typescript/module/bridge/bridgeState.d.ts +5 -0
  96. package/lib/typescript/module/connections/ConnectionSetupScreen.d.ts +28 -7
  97. package/lib/typescript/module/{platform → connections}/PowerPlatformConnectionApi.d.ts +52 -43
  98. package/lib/typescript/module/connections/connectionMetadata.d.ts +66 -0
  99. package/lib/typescript/module/connections/connectionState.d.ts +16 -0
  100. package/lib/typescript/module/connections/disambiguate.d.ts +4 -2
  101. package/lib/typescript/module/{platform → connections}/resolveConnections.d.ts +19 -19
  102. package/lib/typescript/module/connections/types.d.ts +129 -1
  103. package/lib/typescript/module/{platform → connections}/useConnectionRefs.d.ts +33 -24
  104. package/lib/typescript/module/connections/useConnectionSetup.d.ts +12 -8
  105. package/lib/typescript/module/controls/FilePicker.d.ts +7 -1
  106. package/lib/typescript/module/controls/ImagePicker.d.ts +9 -1
  107. package/lib/typescript/module/index.d.ts +17 -10
  108. package/lib/typescript/module/logger.d.ts +4 -4
  109. package/lib/typescript/module/offline/createOfflineHostActivationCallbacks.d.ts +12 -0
  110. package/lib/typescript/module/offline/useOfflineIntegrationWithStartupGate.d.ts +15 -0
  111. package/lib/typescript/module/offline/useOfflineIntegrationWithStartupGate.web.d.ts +6 -0
  112. package/lib/typescript/module/platform/DataverseDataSources.d.ts +27 -0
  113. package/lib/typescript/module/platform/DataverseGlobalDiscoveryApi.d.ts +3 -0
  114. package/lib/typescript/module/platform/GlobalDiscovery.d.ts +4 -0
  115. package/lib/typescript/module/platform/PowerPlatformEnvironmentApi.d.ts +3 -74
  116. package/lib/typescript/module/provider/PowerAppsHostProvider.d.ts +29 -18
  117. package/lib/typescript/module/provider/PowerAppsProvider.d.ts +30 -8
  118. package/lib/typescript/module/provider/SessionDetailsGesture.d.ts +13 -0
  119. package/lib/typescript/module/telemetry/OfflineSdkTelemetry.d.ts +15 -0
  120. package/lib/typescript/module/telemetry/OfflineSdkTelemetry.web.d.ts +2 -0
  121. package/lib/typescript/module/telemetry/index.d.ts +13 -1
  122. package/package.json +11 -6
  123. package/scripts/metro-logger.js +213 -0
  124. package/scripts/upgrade/runtime.js +13 -7
  125. package/scripts/upgrade-authoring.js +5 -6
  126. package/lib/commonjs/platform/PowerPlatformConnectionApi.js +0 -606
  127. package/lib/commonjs/platform/resolveConnections.js +0 -264
  128. package/lib/module/platform/PowerPlatformConnectionApi.js +0 -595
  129. package/lib/module/platform/resolveConnections.js +0 -259
@@ -27,6 +27,7 @@ import type { NativeConnectionInstance, NativeConnectionResolution } from './typ
27
27
  export declare function disambiguateConnections(connectionReferences: Record<string, {
28
28
  id: string;
29
29
  dataSources: string[];
30
+ sharedConnectionId?: string;
30
31
  }>, allConnectionsByApiId: Record<string, NativeConnectionInstance[]>): NativeConnectionResolution[];
31
32
  /**
32
33
  * Extract the connection UUID from a raw connection name returned by the API.
@@ -36,8 +37,9 @@ export declare function disambiguateConnections(connectionReferences: Record<str
36
37
  * "abc12345def6789012345678901234ab" (bare UUID, no dashes)
37
38
  * "abc12345-def6-7890-1234-5678901234ab" (UUID with dashes)
38
39
  *
39
- * Returns the 32-char hex ID (dashes stripped) or the raw string if no UUID
40
- * pattern is found.
40
+ * Returns the terminal resource name exactly as supplied by Power Platform.
41
+ * Some connectors require dashed GUIDs while others use compact IDs.
41
42
  */
42
43
  export declare function extractConnectionId(rawName: string): string;
44
+ export declare function connectionIdsEqual(left: string, right: string): boolean;
43
45
  //# sourceMappingURL=disambiguate.d.ts.map
@@ -5,19 +5,18 @@
5
5
  * useConnectionRefs:
6
6
  *
7
7
  * • resolveViaStaticRefs — per-connector resolution using the static
8
- * connectionReferences map from power.config.json. Used by the Dev Player
9
- * and during local development (no appId) or when the launch API is
10
- * unavailable. Handles pre-disambiguation ACL grants so inaccessible
11
- * connections are excluded before the user is asked to pick.
8
+ * connectionReferences map from power.config.json. Used only by Dev Player
9
+ * for unpublished local apps. Handles pre-disambiguation ACL grants so
10
+ * inaccessible connections are excluded before the user is asked to pick.
12
11
  *
13
- * • applyAclGrants — post-resolution ACL grants used by the fast path
12
+ * • applyAclGrants — post-resolution user consent used by the fast path
14
13
  * (production APKs via fetchAppLaunchData).
15
14
  *
16
15
  * Both helpers return / consume the shared AppLaunchResult shape so the
17
16
  * hook orchestrator can handle them uniformly.
18
17
  */
19
18
  import type { AppLaunchResult } from './PowerPlatformConnectionApi.js';
20
- import type { OnDisambiguationNeeded, OnMissingConnection } from '../connections/types.js';
19
+ import type { ConnectionReferenceConfig, ConnectionRequirement, OnDisambiguationNeeded, OnMissingConnection } from './types.js';
21
20
  import type { AppConnectionReference } from '../bridge/NativePowerAppsBridge.js';
22
21
  /**
23
22
  * Connector schema entry generated by `generate-connector-schemas`.
@@ -28,6 +27,10 @@ export interface ConnectorSchema {
28
27
  name: string;
29
28
  properties: {
30
29
  primaryRuntimeUrl: string;
30
+ scopes?: {
31
+ will?: string[];
32
+ wont?: string[];
33
+ };
31
34
  };
32
35
  }
33
36
  export interface StaticRefsOptions {
@@ -35,19 +38,16 @@ export interface StaticRefsOptions {
35
38
  * Static connectionReferences from power.config.json.
36
39
  * Shape: { [refId]: { id: string; dataSources: string[] } }
37
40
  */
38
- connectionReferences: Record<string, {
39
- id: string;
40
- dataSources: string[];
41
- }>;
41
+ connectionReferences: Record<string, ConnectionReferenceConfig>;
42
42
  /** Connector schema map keyed by data source name. */
43
43
  schemaMap: Record<string, ConnectorSchema>;
44
44
  environmentId: string;
45
45
  region: string;
46
- /** Used for ACL grants and the Dataverse instanceUrl fetch. */
46
+ /** Used for connection consent and the Dataverse instanceUrl fetch. */
47
47
  acquireToken: (scopes: string[]) => Promise<string | null>;
48
48
  /** Pre-acquired Power Platform API bearer token. */
49
49
  token: string;
50
- /** ISV client ID — when provided, runs pre-disambiguation ACL grants. */
50
+ /** ISV client ID — when provided, runs pre-disambiguation user consent. */
51
51
  isvClientId?: string;
52
52
  onDisambiguationNeeded?: OnDisambiguationNeeded;
53
53
  onMissingConnection?: OnMissingConnection;
@@ -59,7 +59,7 @@ export interface StaticRefsOptions {
59
59
  * 1. Build an apiId → schema lookup.
60
60
  * 2. In parallel: fetch the Dataverse instanceUrl and all connection instances
61
61
  * for every connector.
62
- * 3. If `isvClientId` is set, run pre-disambiguation ACL grants — connections
62
+ * 3. If `isvClientId` is set, run pre-disambiguation user consent — connections
63
63
  * where the grant fails are marked `NeedsAclGrant` and excluded from
64
64
  * resolution, prompting the user to create a new connection.
65
65
  * 4. Disambiguate: resolve single matches, invoke callbacks for ambiguous /
@@ -69,18 +69,18 @@ export interface StaticRefsOptions {
69
69
  */
70
70
  export declare function resolveViaStaticRefs({ connectionReferences, schemaMap, environmentId, region, acquireToken, token, isvClientId, onDisambiguationNeeded, onMissingConnection, }: StaticRefsOptions): Promise<AppLaunchResult>;
71
71
  /**
72
- * Run idempotent post-resolution ACL grants on behalf of the ISV app.
72
+ * Run idempotent post-resolution delegated consent grants for the calling app.
73
73
  *
74
74
  * Used by the fast path (production APKs via `fetchAppLaunchData`) where the
75
- * launch API has already resolved the user's connections — grants are applied
76
- * after the fact so APIM accepts tokens issued to the ISV's AAD app.
75
+ * launch API has already resolved the user's connections. Grants are applied
76
+ * only to user-selected connections; fixed shared connections are already
77
+ * authorized by their owner and must not receive delegated user consent.
77
78
  *
78
79
  * For the slow path the grants run before disambiguation inside
79
80
  * `resolveViaStaticRefs`, where they can still influence which connections
80
81
  * are considered available.
81
82
  *
82
- * Failures are swallowed — a failed grant will surface as a 403 at runtime
83
- * when the connector is called.
83
+ * Returns the connection names whose ACL grants failed so callers can fail closed.
84
84
  */
85
- export declare function applyAclGrants(connectionRefs: Record<string, AppConnectionReference>, environmentId: string, isvClientId: string, acquireToken: (scopes: string[]) => Promise<string | null>): Promise<void>;
85
+ export declare function applyAclGrants(connectionRefs: Record<string, AppConnectionReference>, connectionRequirements: ConnectionRequirement[], environmentId: string, region: string, acquireToken: (scopes: string[]) => Promise<string | null>): Promise<Set<string>>;
86
86
  //# sourceMappingURL=resolveConnections.d.ts.map
@@ -17,18 +17,146 @@ export declare enum ConnectionStatus {
17
17
  NeedsAclGrant = "NeedsAclGrant",
18
18
  NotConnected = "NotConnected"
19
19
  }
20
+ export interface ConnectionReferenceConfig {
21
+ id: string;
22
+ dataSources: string[];
23
+ displayName?: string;
24
+ iconUri?: string;
25
+ appActions?: string[];
26
+ sharedConnectionId?: string;
27
+ gatewayObjectIdHint?: string;
28
+ authenticationType?: string;
29
+ parameterSetName?: string;
30
+ workflowDetails?: {
31
+ workflowEntityId?: string;
32
+ workflowDisplayName?: string;
33
+ workflowName?: string;
34
+ };
35
+ dataSets?: Record<string, unknown>;
36
+ dependencies?: Record<string, unknown>;
37
+ dependents?: string[];
38
+ nestedActions?: Array<{
39
+ actionName?: string;
40
+ apiName?: string;
41
+ flowConnectionRef?: string;
42
+ }>;
43
+ parameterHintsV2?: Record<string, {
44
+ value?: unknown;
45
+ }>;
46
+ [key: string]: unknown;
47
+ }
48
+ export interface ConnectionRequirement {
49
+ localRefId: string;
50
+ apiId: string;
51
+ connectorId: string;
52
+ dataSources: string[];
53
+ displayName?: string;
54
+ iconUri?: string;
55
+ appActions?: string[];
56
+ sharedConnectionId?: string;
57
+ gatewayObjectIdHint?: string;
58
+ authenticationType?: string;
59
+ parameterSetName?: string;
60
+ apiScopes: {
61
+ will: string[];
62
+ wont: string[];
63
+ };
64
+ isFlowDependent: boolean;
65
+ }
66
+ export type ConnectionParameterType = 'string' | 'securestring' | 'boolean' | 'integer' | 'clientcertificate';
67
+ export interface ConnectionParameterDefinition {
68
+ name: string;
69
+ displayName: string;
70
+ type: ConnectionParameterType;
71
+ required: boolean;
72
+ hidden: boolean;
73
+ capabilities?: string[];
74
+ allowedValues?: Array<{
75
+ value: string;
76
+ displayName: string;
77
+ }>;
78
+ defaultValue?: string | boolean | number;
79
+ }
80
+ export interface ConnectionParameterSet {
81
+ /** Undefined for a connector's single, non-parameter-set authentication definition. */
82
+ name?: string;
83
+ displayName: string;
84
+ parameters: ConnectionParameterDefinition[];
85
+ requiresApiConsent: boolean;
86
+ gatewayParameterName?: string;
87
+ }
88
+ export type ConnectionParameterValue = string | boolean | number | {
89
+ pfx: string;
90
+ password: string;
91
+ } | {
92
+ gatewayObjectId: string;
93
+ };
94
+ export interface ConnectionInput {
95
+ parameterSetName?: string;
96
+ gatewayObjectId?: string;
97
+ gatewayParameterName?: string;
98
+ parameters: Record<string, ConnectionParameterValue>;
99
+ }
100
+ export interface ConnectionConsentDetails {
101
+ localRefId: string;
102
+ connectorId: string;
103
+ displayName: string;
104
+ description: string;
105
+ appActions: string[];
106
+ }
107
+ export interface ResourceConsentRequirement {
108
+ resourceId: string;
109
+ displayName: string;
110
+ }
111
+ export interface ConnectionUsageInput {
112
+ localRefId: string;
113
+ apiId: string;
114
+ connectionId: string;
115
+ dataSources: string[];
116
+ appActions: string[];
117
+ apiScopes: {
118
+ will: string[];
119
+ wont: string[];
120
+ };
121
+ }
122
+ export declare function normalizeApiId(apiId: string): string;
123
+ export declare function getConnectorId(apiId: string): string;
124
+ export declare function getConnectionDatasetName(reference: {
125
+ dataSets?: Record<string, unknown>;
126
+ }): string;
127
+ export declare function getFlowConnectionName(reference: ConnectionReferenceConfig): string;
128
+ export declare function getFlowDataSourceNames(reference: ConnectionReferenceConfig): string[];
129
+ export declare function buildConnectionRequirements(connectionReferences: Record<string, ConnectionReferenceConfig>, scopesByApiId?: Record<string, {
130
+ will: string[];
131
+ wont: string[];
132
+ }>): ConnectionRequirement[];
133
+ export declare function isCompositeConnectionApiId(apiId: string): boolean;
134
+ export declare function findConnectionDataSourceConflicts(requirements: ConnectionRequirement[]): string[];
135
+ export declare function hasCompleteStaticConnectionConfig(connectionReferences: Record<string, ConnectionReferenceConfig>, schemaMap: Record<string, {
136
+ name: string;
137
+ properties: {
138
+ primaryRuntimeUrl: string;
139
+ };
140
+ }>): boolean;
141
+ export declare function buildConnectionResolutionKey(appId: string | undefined, environmentId: string, connectionReferences: Record<string, ConnectionReferenceConfig>): string;
20
142
  /** A single connection instance returned by the Power Platform connectivity API. */
21
143
  export interface NativeConnectionInstance {
22
- /** Extracted connection UUID (hex, no dashes). */
144
+ /** Terminal connection resource name exactly as returned by Power Platform. */
23
145
  id: string;
24
146
  /** Full resource name from the API (connector-prefixed, e.g. "shared_office365users/abc123"). */
25
147
  name: string;
26
148
  /** Connector API identifier (e.g. "/providers/Microsoft.PowerApps/apis/shared_office365users"). */
27
149
  apiId: string;
150
+ /** Object ID of the connection owner when returned by the connectivity API. */
151
+ ownerId?: string;
28
152
  /** Resolved authorization status of this connection. */
29
153
  status: ConnectionStatus;
30
154
  /** Optional human-readable display name from the API. */
31
155
  displayName?: string;
156
+ accountName?: string;
157
+ parameterSetName?: string;
158
+ isAuthenticated?: boolean;
159
+ statusErrorCode?: string;
32
160
  }
33
161
  /**
34
162
  * Result of attempting to match a single connection reference to an instance.
@@ -30,9 +30,12 @@
30
30
  * },
31
31
  * });
32
32
  */
33
- import { type OnDisambiguationNeeded, type OnMissingConnection } from '../connections/types.js';
33
+ import type { DatabaseReference } from '../platform/DataverseDataSources.js';
34
+ import type { OnDisambiguationNeeded, OnMissingConnection } from '../connections/types.js';
34
35
  import type { ConnectorSchema } from './resolveConnections.js';
35
36
  import type { AppConnectionReference } from '../bridge/NativePowerAppsBridge.js';
37
+ import type { ConnectionRequirement, ResourceConsentRequirement } from './types.js';
38
+ import type { ConnectionReferenceConfig } from './types.js';
36
39
  export type { ConnectorSchema } from './resolveConnections.js';
37
40
  export interface UseConnectionRefsOptions {
38
41
  isSignedIn: boolean;
@@ -46,23 +49,19 @@ export interface UseConnectionRefsOptions {
46
49
  region?: string;
47
50
  /**
48
51
  * PowerApps app GUID (from power.config.json `appId`).
49
- * When provided (and not running inside the Dev Player), connection
50
- * references are fetched at runtime from the PowerApps RP
51
- * `/apps/{appId}/launch` endpoint and take precedence over the static
52
- * `connectionReferences` object below.
53
- * Leave undefined during local development to use the static fallback.
52
+ * Outside Dev Player, app and connection metadata is fetched exclusively
53
+ * from the PowerApps RP `/apps/{appId}/launch` endpoint.
54
54
  */
55
55
  appId?: string;
56
56
  /**
57
57
  * The connectionReferences map from power.config.json.
58
+ * Used only in Dev Player for unpublished local apps.
58
59
  * Shape: { [refId]: { id: string; dataSources: string[] } }
59
60
  */
60
- connectionReferences: Record<string, {
61
- id: string;
62
- dataSources: string[];
63
- }>;
61
+ connectionReferences: Record<string, ConnectionReferenceConfig>;
64
62
  /**
65
63
  * Connector schema map keyed by data source name.
64
+ * Used only in Dev Player for unpublished local apps.
66
65
  * Generated automatically by generate-connector-schemas.
67
66
  * Shape: { [dataSourceName]: ConnectorSchema }
68
67
  */
@@ -80,10 +79,11 @@ export interface UseConnectionRefsOptions {
80
79
  */
81
80
  onMissingConnection?: OnMissingConnection;
82
81
  /**
83
- * The ISV's AAD application (client) ID. When provided, each resolved
84
- * `Connected` connection is checked via `addAadAppToConnectionAcl`.
82
+ * The ISV's AAD application (client) ID. When provided, each user-selected
83
+ * `Connected` connection is granted through delegated user consent. Fixed
84
+ * shared connections skip this grant in published apps.
85
85
  * Connections where the grant fails are marked `NeedsAclGrant` and treated
86
- * as missing so the setup screen can guide the user to create a new one.
86
+ * as missing so the setup screen can guide the user to create a new one.
87
87
  */
88
88
  isvClientId?: string;
89
89
  }
@@ -91,12 +91,25 @@ export interface UseConnectionRefsResult {
91
91
  connectionRefs: Record<string, AppConnectionReference>;
92
92
  isReady: boolean;
93
93
  error: string | null;
94
+ errorKind: ConnectionResolutionErrorKind | null;
94
95
  /**
95
96
  * API IDs of connectors for which no connection was found (or the user did
96
97
  * not resolve during disambiguation). Useful for surfacing a "Set up
97
98
  * connections" prompt in the app UI.
98
99
  */
99
100
  missingConnectors: string[];
101
+ /** Unresolved requirements keyed by the app's local connection-reference ID. */
102
+ missingConnectionReferences: ConnectionRequirement[];
103
+ /** Every connection reference required by the app. */
104
+ connectionRequirements: ConnectionRequirement[];
105
+ /** Non-connector protected resources returned by app launch metadata. */
106
+ resourceConsents: ResourceConsentRequirement[];
107
+ /** Blocking connection configuration errors. */
108
+ configurationErrors: string[];
109
+ /** Whether selected connection references still need durable app usage consent. */
110
+ requiresConnectionConsent: boolean;
111
+ /** Identity of the app/environment/config represented by this result. */
112
+ resolvedConfigKey: string | null;
100
113
  /**
101
114
  * The Dataverse org URL for this environment (e.g. "https://org12345.crm.dynamics.com").
102
115
  * Fetched from the Power Platform environment metadata independently of whether a
@@ -104,23 +117,19 @@ export interface UseConnectionRefsResult {
104
117
  * Empty string until isReady is true or if the environment has no linked Dataverse database.
105
118
  */
106
119
  dataverseOrgUrl: string;
120
+ /** Database references resolved from the RP launch response. */
121
+ databaseReferences: Record<string, DatabaseReference>;
107
122
  }
123
+ export type ConnectionResolutionErrorKind = 'app-access-denied' | 'generic';
108
124
  /**
109
125
  * Resolves Power Platform connection references for the current user, with
110
126
  * disambiguation support for environments where multiple connections exist for
111
127
  * the same connector.
112
128
  *
113
- * On sign-in this hook:
114
- * 1. If `appId` is set (production template), fetches connection references
115
- * from the PowerApps RP `/apps/{appId}/launch` endpoint and uses those
116
- * in place of the static `connectionReferences` from power.config.json.
117
- * 2. Acquires a Power Platform API token.
118
- * 3. In parallel: fetches the Dataverse instanceUrl and ALL connections for
119
- * each configured connector.
120
- * 4. Runs disambiguation: resolves single matches, invokes `onDisambiguationNeeded`
121
- * for multiple matches, and invokes `onMissingConnection` for absent ones.
122
- * 5. Pre-warms the Dataverse token in the MSAL cache.
123
- * 6. Sets isReady=true with the fully-populated connections map.
129
+ * Outside Dev Player, the published app launch endpoint is authoritative.
130
+ * Dev Player resolves unpublished local references through per-connector APIs.
131
+ * Both paths disambiguate candidates, pre-warm Dataverse authentication, and
132
+ * return a fully populated bridge configuration.
124
133
  */
125
134
  export declare function useConnectionRefs({ isSignedIn, acquireToken, appId, environmentId, region, connectionReferences, schemaMap, onDisambiguationNeeded, onMissingConnection, isvClientId, }: UseConnectionRefsOptions): UseConnectionRefsResult;
126
135
  //# sourceMappingURL=useConnectionRefs.d.ts.map
@@ -17,7 +17,7 @@
17
17
  * // Call setup.startCreate() to trigger connection creation
18
18
  * // Call setup.checkNow() to re-poll after WebView finishes
19
19
  */
20
- import type { NativeConnectionInstance } from '../connections/types.js';
20
+ import type { ConnectionInput, NativeConnectionInstance } from './types.js';
21
21
  /**
22
22
  * The current phase of the connection setup flow for one connector.
23
23
  *
@@ -43,12 +43,12 @@ export interface UseConnectionSetupOptions {
43
43
  onConnected?: (instance: NativeConnectionInstance) => void;
44
44
  /**
45
45
  * The ISV/wrap-app AAD client ID (from auth.config.json `msal.clientId`).
46
- * After connection creation, `addAadAppToConnectionAcl` is called to append
47
- * the ISV's client ID to the connection ACE's AppIds list. This is required
48
- * so that APIM accepts tokens bearing this appid at runtime (otherwise APIM
49
- * returns 403 "missing connection ACL" for all third-party app tokens).
46
+ * After connection creation, delegated user consent adds the calling app ID
47
+ * to the most specific applicable connection ACL.
50
48
  */
51
- isvClientId?: string;
49
+ isvClientId: string;
50
+ /** Fixed shared connection resource ID. */
51
+ sharedConnectionId?: string;
52
52
  /**
53
53
  * Redirect URL passed to the getConsentLink API call.
54
54
  * Defaults to the standard native-client redirect accepted by Power Platform.
@@ -71,7 +71,11 @@ export interface UseConnectionSetupResult {
71
71
  * Start the connection creation flow.
72
72
  * Transitions: idle/error → creating → (oauth | connected | error).
73
73
  */
74
- startCreate: () => Promise<void>;
74
+ startCreate: (input?: ConnectionInput) => Promise<void>;
75
+ /** Update and re-consent an existing unauthenticated connection. */
76
+ startRepair: (instance: NativeConnectionInstance, input?: ConnectionInput, requiresApiConsent?: boolean) => Promise<void>;
77
+ /** Verify third-party ACL access before accepting an existing connection. */
78
+ useExisting: (instance: NativeConnectionInstance) => Promise<void>;
75
79
  /**
76
80
  * Call after the OAuth WebView is dismissed (or anytime during 'oauth' phase)
77
81
  * to immediately poll the connection status instead of waiting for the next
@@ -92,5 +96,5 @@ export interface UseConnectionSetupResult {
92
96
  /** Reset the flow back to idle (e.g., for a retry). */
93
97
  reset: () => void;
94
98
  }
95
- export declare function useConnectionSetup({ connectorId, environmentId, region, acquireToken, onConnected, isvClientId, oauthRedirectUrl, polling, }: UseConnectionSetupOptions): UseConnectionSetupResult;
99
+ export declare function useConnectionSetup({ connectorId, environmentId, region, acquireToken, onConnected, sharedConnectionId, oauthRedirectUrl, polling, }: UseConnectionSetupOptions): UseConnectionSetupResult;
96
100
  //# sourceMappingURL=useConnectionSetup.d.ts.map
@@ -11,6 +11,12 @@ export interface PickedFileInfo {
11
11
  }
12
12
  export interface FilePickerProps {
13
13
  label?: string;
14
+ /** Optional test ID for the outer container. */
15
+ testID?: string;
16
+ /** Optional test ID for the selected file row. */
17
+ fileRowTestID?: string;
18
+ /** Optional test ID for the pick/replace button. */
19
+ pickButtonTestID?: string;
14
20
  /**
15
21
  * The file name to display.
16
22
  * - In view mode: the name of the existing Dataverse file.
@@ -61,5 +67,5 @@ export interface FilePickerProps {
61
67
  * - Pass both to show the existing file name (tappable to download) alongside a
62
68
  * replace button — useful when the edit screen should also allow previewing.
63
69
  */
64
- export declare function FilePicker({ label, fileName, onDownload, shareTitle, onChange, acceptedTypes, pickButtonLabel, replaceButtonLabel, readingLabel, containerStyle, labelStyle, fileRowStyle, fileNameStyle, buttonStyle, buttonTextStyle, accentColor, }: FilePickerProps): React.JSX.Element;
70
+ export declare function FilePicker({ label, testID, fileRowTestID, pickButtonTestID, fileName, onDownload, shareTitle, onChange, acceptedTypes, pickButtonLabel, replaceButtonLabel, readingLabel, containerStyle, labelStyle, fileRowStyle, fileNameStyle, buttonStyle, buttonTextStyle, accentColor, }: FilePickerProps): React.JSX.Element;
65
71
  //# sourceMappingURL=FilePicker.d.ts.map
@@ -13,6 +13,14 @@ export interface PickedImageInfo {
13
13
  }
14
14
  export interface ImagePickerProps {
15
15
  label?: string;
16
+ /** Optional test ID for the outer container. */
17
+ testID?: string;
18
+ /** Optional test ID for the camera button. */
19
+ cameraButtonTestID?: string;
20
+ /** Optional test ID for the image-library button. */
21
+ selectButtonTestID?: string;
22
+ /** Optional test ID for the selected image preview. */
23
+ previewTestID?: string;
16
24
  /**
17
25
  * Base64 string from Dataverse (the `cr_assetimage` thumbnail).
18
26
  * The component builds the preview data URI internally.
@@ -72,5 +80,5 @@ export interface ImagePickerProps {
72
80
  * - On pick, the image is returned as base64 for legacy callers and as a
73
81
  * File-compatible object for generated Dataverse upload methods.
74
82
  */
75
- export declare function ImagePicker({ label, initialBase64, onChange, containerStyle, labelStyle, buttonRowStyle, buttonStyle, buttonTextStyle, previewStyle, accentColor, onImageChange, imageFileName, quality, allowsEditing, aspect, cropShape, exif, legacy, cameraButtonLabel, selectButtonLabel, changeButtonLabel, readingLabel, }: ImagePickerProps): React.JSX.Element;
83
+ export declare function ImagePicker({ label, testID, cameraButtonTestID, selectButtonTestID, previewTestID, initialBase64, onChange, containerStyle, labelStyle, buttonRowStyle, buttonStyle, buttonTextStyle, previewStyle, accentColor, onImageChange, imageFileName, quality, allowsEditing, aspect, cropShape, exif, legacy, cameraButtonLabel, selectButtonLabel, changeButtonLabel, readingLabel, }: ImagePickerProps): React.JSX.Element;
76
84
  //# sourceMappingURL=ImagePicker.d.ts.map
@@ -9,6 +9,7 @@ export type { PowerPagesBridgeOptions } from './bridge/PowerPagesBridge.js';
9
9
  export type { NativeBridgeOptions, CdsDataSourceConfig, AppConnection, AppConnectionReference } from './bridge/NativePowerAppsBridge.js';
10
10
  export { buildConnectionReferences } from './bridge/NativePowerAppsBridge.js';
11
11
  export { setupNativeHost } from './bridge/setupNativeHost.js';
12
+ export { updateBridgeOptionsInPlace } from './bridge/bridgeState.js';
12
13
  export { AuthProvider, useAuth } from './auth/AuthContext';
13
14
  export type { AuthState, AuthProviderProps } from './auth/AuthContext';
14
15
  export { completePowerAppsAuthSession } from './auth/completePowerAppsAuthSession.js';
@@ -16,15 +17,21 @@ export type { AuthConfig, MsalAuthConfig, IntuneConfig } from '@microsoft/power-
16
17
  export { PowerAppsHostProvider } from './provider/PowerAppsHostProvider';
17
18
  export type { PowerAppsHostProviderProps } from './provider/PowerAppsHostProvider';
18
19
  export { PowerAppsProvider } from './provider/PowerAppsProvider.js';
19
- export type { PowerAppsProviderProps, PowerConfig } from './provider/PowerAppsProvider.js';
20
- export { fetchInstanceUrl, buildCdsDataSources, buildEnvironmentEndpoint, POWER_PLATFORM_API_SCOPE } from './platform/PowerPlatformEnvironmentApi.js';
21
- export type { LinkedEnvironmentMetadata, DatabaseReference, DatabaseReferenceDataSource } from './platform/PowerPlatformEnvironmentApi.js';
22
- export { useConnectionRefs } from './platform/useConnectionRefs.js';
23
- export type { UseConnectionRefsOptions, UseConnectionRefsResult, ConnectorSchema } from './platform/useConnectionRefs.js';
24
- export { fetchConnectorMetadata, fetchConnectionsForConnector, createConnection, pollConnectionStatus, confirmConsentCode, fetchAppLaunchData, } from './platform/PowerPlatformConnectionApi.js';
25
- export type { ConnectorMetadata, CreateConnectionResult, AppLaunchResult, } from './platform/PowerPlatformConnectionApi.js';
20
+ export type { AppInsightsConfig, PowerAppsProviderProps, PowerConfig } from './provider/PowerAppsProvider.js';
21
+ export { buildEnvironmentEndpoint, POWER_PLATFORM_API_SCOPE } from './platform/PowerPlatformEnvironmentApi.js';
22
+ export { fetchInstanceUrl } from './platform/DataverseGlobalDiscoveryApi.js';
23
+ export { buildCdsDataSources } from './platform/DataverseDataSources.js';
24
+ export type { LinkedEnvironmentMetadata, DatabaseReference, DatabaseReferenceDataSource } from './platform/DataverseDataSources.js';
25
+ export { useConnectionRefs } from './connections/useConnectionRefs.js';
26
+ export type { UseConnectionRefsOptions, UseConnectionRefsResult, ConnectorSchema } from './connections/useConnectionRefs.js';
27
+ export { fetchConnectorMetadata, fetchConnectionsForConnector, deleteConnection, createConnection, pollConnectionStatus, confirmConsentCode, repairConnection, fetchAppLaunchData, fetchAppConnectionUsages, postConnectionUsage, reportScopeConsents, } from './connections/PowerPlatformConnectionApi.js';
28
+ export type { ConnectorMetadata, CreateConnectionResult, AppLaunchResult, RegisteredConnectionUsage, } from './connections/PowerPlatformConnectionApi.js';
26
29
  export { disambiguateConnections, extractConnectionId } from './connections/disambiguate.js';
27
- export type { NativeConnectionInstance, NativeConnectionResolution, NativeDisambiguationResult, OnDisambiguationNeeded, OnMissingConnection, } from './connections/types.js';
30
+ export { shouldPersistConnectionUsages, shouldShowConnectionReview, } from './connections/connectionState.js';
31
+ export { buildConnectionRequirements, buildConnectionResolutionKey, findConnectionDataSourceConflicts, hasCompleteStaticConnectionConfig, isCompositeConnectionApiId, getConnectorId, normalizeApiId, } from './connections/types.js';
32
+ export { buildConnectionUserConsentUrl, buildConsentLinkDefinition, buildConnectionParameterSets, buildConnectionUsageRequest, buildConnectionUsageUrl, buildScopeConsentRequest, buildScopeConsentUrl, hasOAuthParameter, parseConnectionParameters, serializeConnectionParameters, } from './connections/connectionMetadata.js';
33
+ export type { ConsentLinkDefinition, RawConnectionParameter, RawConnectionParameterSet, SerializedConnectionParameters, } from './connections/connectionMetadata.js';
34
+ export type { ConnectionConsentDetails, ConnectionInput, ConnectionParameterDefinition, ConnectionParameterSet, ConnectionParameterType, ConnectionParameterValue, ConnectionReferenceConfig, ConnectionRequirement, ConnectionUsageInput, ResourceConsentRequirement, NativeConnectionInstance, NativeConnectionResolution, NativeDisambiguationResult, OnDisambiguationNeeded, OnMissingConnection, } from './connections/types.js';
28
35
  export { useConnectionSetup } from './connections/useConnectionSetup.js';
29
36
  export type { ConnectionSetupPhase, UseConnectionSetupOptions, UseConnectionSetupResult, } from './connections/useConnectionSetup.js';
30
37
  export { ConnectionSetupScreen } from './connections/ConnectionSetupScreen.js';
@@ -39,7 +46,7 @@ export { ImagePicker } from './controls/ImagePicker.js';
39
46
  export type { ImagePickerProps, PickedImageInfo } from './controls/ImagePicker.js';
40
47
  export { isDevPlayer } from './utils/isDevPlayer.js';
41
48
  export { base64ToDataverseUploadFile, base64ToUint8Array, createDataverseUploadFile, } from './utils/dataverseUtils.js';
42
- export { getAppLogger, configureAppLogger, HostOperationNames } from './telemetry/index.js';
43
- export type { ILogger } from '@microsoft/power-apps-native-common';
49
+ export { getAppLogger, configureAppLogger, getCustomerTelemetryLogger, HostOperationNames, } from './telemetry/index.js';
50
+ export type { ICustomerTelemetryLogger, ILogger, } from '@microsoft/power-apps-native-common';
44
51
  export { ErrorBoundary } from './ErrorBoundary.js';
45
52
  //# sourceMappingURL=index.d.ts.map
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * Conditional debug logger for power-apps-native-host.
3
3
  *
4
- * Debug logs (debugLog / debugWarn) are only emitted when the JS bundle
5
- * is running inside the Power Apps Dev Player (detected via
6
- * `Constants.expoConfig.extra.isDevPlayer`). They are silenced in release
7
- * APKs generated from the template so the production log stream stays clean.
4
+ * Debug logs (debugLog / debugWarn) are emitted in development bundles or when
5
+ * running inside Power Apps Dev Player. They remain silent in wrapped release
6
+ * apps so the production log stream stays clean.
8
7
  */
8
+ export declare function isDebugLoggingEnabled(): boolean;
9
9
  export declare function debugLog(...args: unknown[]): void;
10
10
  export declare function debugWarn(...args: unknown[]): void;
11
11
  //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1,12 @@
1
+ import { QueryClient } from '@tanstack/react-query';
2
+ export declare function createHostQueryClient(): QueryClient;
3
+ export declare function createOfflineHostActivationCallbacks(queryClient: QueryClient): {
4
+ prepareForOfflineActivation: () => Promise<void>;
5
+ completeOfflineActivation: () => Promise<void>;
6
+ rollbackOfflineActivation: () => Promise<void>;
7
+ };
8
+ export declare function resolveSdkMountDecision(value: unknown): {
9
+ shouldMountChildren: boolean;
10
+ contractSupported: boolean;
11
+ };
12
+ //# sourceMappingURL=createOfflineHostActivationCallbacks.d.ts.map
@@ -0,0 +1,15 @@
1
+ import { useOfflineIntegration } from './useOfflineIntegration';
2
+ type Options = {
3
+ powerConfig: Parameters<typeof useOfflineIntegration>[0]['powerConfig'];
4
+ offlineProfile?: Record<string, unknown>;
5
+ acquireToken: (scopes: string[]) => Promise<string | null>;
6
+ hasRealAccount: boolean;
7
+ isAuthReady: boolean;
8
+ };
9
+ export declare function useOfflineIntegrationWithStartupGate({ powerConfig, offlineProfile, acquireToken, hasRealAccount, isAuthReady, }: Options): {
10
+ isEnabled: boolean;
11
+ StatusOverlay: import("react").ComponentType<Record<string, never>> | null;
12
+ shouldMountChildren: boolean;
13
+ };
14
+ export {};
15
+ //# sourceMappingURL=useOfflineIntegrationWithStartupGate.d.ts.map
@@ -0,0 +1,6 @@
1
+ export declare function useOfflineIntegrationWithStartupGate(_options: unknown): {
2
+ isEnabled: false;
3
+ StatusOverlay: null;
4
+ shouldMountChildren: true;
5
+ };
6
+ //# sourceMappingURL=useOfflineIntegrationWithStartupGate.web.d.ts.map
@@ -0,0 +1,27 @@
1
+ export interface LinkedEnvironmentMetadata {
2
+ resourceId?: string;
3
+ friendlyName?: string;
4
+ uniqueName?: string;
5
+ domainName?: string;
6
+ version?: string;
7
+ instanceUrl?: string;
8
+ instanceApiUrl?: string;
9
+ baseLanguage?: number;
10
+ instanceState?: string;
11
+ createdTime?: string;
12
+ platformSku?: string;
13
+ }
14
+ export interface DatabaseReferenceDataSource {
15
+ entitySetName?: string;
16
+ logicalName?: string;
17
+ }
18
+ export interface DatabaseReference {
19
+ dataSources?: Record<string, DatabaseReferenceDataSource>;
20
+ }
21
+ export declare function buildCdsDataSources(databaseReferences: Record<string, DatabaseReference>, dataverseOrgUrl: string): Array<{
22
+ runtimeUrl: string;
23
+ entitySetName: string;
24
+ logicalName: string;
25
+ version: string;
26
+ }>;
27
+ //# sourceMappingURL=DataverseDataSources.d.ts.map
@@ -0,0 +1,3 @@
1
+ /** Fetch the Dataverse instance URL from the Dataverse Global Discovery Service. */
2
+ export declare function fetchInstanceUrl(environmentId: string, region: string, acquireToken: (scopes: string[]) => Promise<string | null>, _bearerToken?: string): Promise<string | undefined>;
3
+ //# sourceMappingURL=DataverseGlobalDiscoveryApi.d.ts.map
@@ -0,0 +1,4 @@
1
+ export declare function globalDiscoveryEndpoint(region: string): string;
2
+ export declare function globalDiscoveryScope(region: string): string;
3
+ export declare function buildGlobalDiscoveryUrl(environmentId: string, region: string): string;
4
+ //# sourceMappingURL=GlobalDiscovery.d.ts.map