@microsoft/power-apps-native-host 0.3.0 → 0.4.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 (66) hide show
  1. package/README.md +1 -9
  2. package/compatibility/current.json +31 -3
  3. package/lib/NOTICE.txt +1323 -16
  4. package/lib/commonjs/auth/AuthContext.js +36 -15
  5. package/lib/commonjs/config/babelConfig.js +13 -0
  6. package/lib/commonjs/config/expoConfig.js +71 -0
  7. package/lib/commonjs/config/metroConfig.js +70 -0
  8. package/lib/commonjs/config/metroLogger.js +182 -0
  9. package/lib/commonjs/config/tamaguiConfig.js +98 -0
  10. package/lib/commonjs/connections/resolveConnections.js +3 -2
  11. package/lib/commonjs/connections/useConnectionRefs.js +3 -1
  12. package/lib/commonjs/index.js +3 -2
  13. package/lib/commonjs/offline/useOfflineIntegrationWithStartupGate.js +3 -1
  14. package/lib/commonjs/platform/DataverseDataSources.js +4 -0
  15. package/lib/commonjs/platform/DataverseGlobalDiscoveryApi.js +45 -0
  16. package/lib/commonjs/provider/PowerAppsHostProvider.js +1 -0
  17. package/lib/commonjs/provider/PowerAppsProvider.js +13 -8
  18. package/lib/commonjs/provider/SessionDetailsGesture.js +1 -9
  19. package/lib/commonjs/telemetry/index.js +2 -2
  20. package/lib/module/auth/AuthContext.js +36 -15
  21. package/lib/module/config/babelConfig.js +9 -0
  22. package/lib/module/config/expoConfig.js +67 -0
  23. package/lib/module/config/metroConfig.js +65 -0
  24. package/{scripts/metro-logger.js → lib/module/config/metroLogger.js} +58 -96
  25. package/lib/module/config/tamaguiConfig.js +93 -0
  26. package/lib/module/connections/resolveConnections.js +3 -2
  27. package/lib/module/connections/useConnectionRefs.js +3 -1
  28. package/lib/module/index.js +5 -1
  29. package/lib/module/offline/useOfflineIntegrationWithStartupGate.js +3 -1
  30. package/lib/module/platform/DataverseDataSources.js +3 -0
  31. package/lib/module/platform/DataverseGlobalDiscoveryApi.js +44 -0
  32. package/lib/module/provider/PowerAppsHostProvider.js +2 -1
  33. package/lib/module/provider/PowerAppsProvider.js +14 -9
  34. package/lib/module/provider/SessionDetailsGesture.js +1 -9
  35. package/lib/module/telemetry/index.js +1 -1
  36. package/lib/typescript/commonjs/config/babelConfig.d.ts +12 -0
  37. package/lib/typescript/commonjs/config/expoConfig.d.ts +21 -0
  38. package/lib/typescript/commonjs/config/metroConfig.d.ts +6 -0
  39. package/lib/typescript/commonjs/config/metroLogger.d.ts +21 -0
  40. package/lib/typescript/commonjs/config/tamaguiConfig.d.ts +1792 -0
  41. package/lib/typescript/commonjs/connections/resolveConnections.d.ts +3 -1
  42. package/lib/typescript/commonjs/connections/useConnectionRefs.d.ts +3 -1
  43. package/lib/typescript/commonjs/index.d.ts +4 -3
  44. package/lib/typescript/commonjs/platform/DataverseDataSources.d.ts +1 -0
  45. package/lib/typescript/commonjs/provider/PowerAppsProvider.d.ts +28 -5
  46. package/lib/typescript/commonjs/telemetry/index.d.ts +2 -2
  47. package/lib/typescript/module/config/babelConfig.d.ts +12 -0
  48. package/lib/typescript/module/config/expoConfig.d.ts +21 -0
  49. package/lib/typescript/module/config/metroConfig.d.ts +6 -0
  50. package/lib/typescript/module/config/metroLogger.d.ts +21 -0
  51. package/lib/typescript/module/config/tamaguiConfig.d.ts +1792 -0
  52. package/lib/typescript/module/connections/resolveConnections.d.ts +3 -1
  53. package/lib/typescript/module/connections/useConnectionRefs.d.ts +3 -1
  54. package/lib/typescript/module/index.d.ts +4 -3
  55. package/lib/typescript/module/platform/DataverseDataSources.d.ts +1 -0
  56. package/lib/typescript/module/provider/PowerAppsProvider.d.ts +28 -5
  57. package/lib/typescript/module/telemetry/index.d.ts +2 -2
  58. package/package.json +47 -13
  59. package/scripts/build-codegen-package.js +283 -0
  60. package/scripts/start-web.mjs +9 -5
  61. package/scripts/upgrade/runtime.js +126 -17
  62. package/scripts/upgrade-authoring.js +274 -179
  63. package/scripts/upgrade.js +10 -16
  64. package/src/config/generated-config.d.ts +4 -0
  65. package/src/config/index.d.ts +3 -0
  66. package/src/config/tsconfig.json +26 -0
@@ -39,6 +39,8 @@ export interface StaticRefsOptions {
39
39
  * Shape: { [refId]: { id: string; dataSources: string[] } }
40
40
  */
41
41
  connectionReferences: Record<string, ConnectionReferenceConfig>;
42
+ /** Whether power.config.json contains Dataverse database references. */
43
+ hasDataverse: boolean;
42
44
  /** Connector schema map keyed by data source name. */
43
45
  schemaMap: Record<string, ConnectorSchema>;
44
46
  environmentId: string;
@@ -67,7 +69,7 @@ export interface StaticRefsOptions {
67
69
  * `true`.
68
70
  * 5. Build and return an `AppLaunchResult`-shaped object.
69
71
  */
70
- export declare function resolveViaStaticRefs({ connectionReferences, schemaMap, environmentId, region, acquireToken, token, isvClientId, onDisambiguationNeeded, onMissingConnection, }: StaticRefsOptions): Promise<AppLaunchResult>;
72
+ export declare function resolveViaStaticRefs({ connectionReferences, hasDataverse, schemaMap, environmentId, region, acquireToken, token, isvClientId, onDisambiguationNeeded, onMissingConnection, }: StaticRefsOptions): Promise<AppLaunchResult>;
71
73
  /**
72
74
  * Run idempotent post-resolution delegated consent grants for the calling app.
73
75
  *
@@ -59,6 +59,8 @@ export interface UseConnectionRefsOptions {
59
59
  * Shape: { [refId]: { id: string; dataSources: string[] } }
60
60
  */
61
61
  connectionReferences: Record<string, ConnectionReferenceConfig>;
62
+ /** Whether power.config.json contains Dataverse database references. */
63
+ hasDataverse: boolean;
62
64
  /**
63
65
  * Connector schema map keyed by data source name.
64
66
  * Used only in Dev Player for unpublished local apps.
@@ -131,5 +133,5 @@ export type ConnectionResolutionErrorKind = 'app-access-denied' | 'generic';
131
133
  * Both paths disambiguate candidates, pre-warm Dataverse authentication, and
132
134
  * return a fully populated bridge configuration.
133
135
  */
134
- export declare function useConnectionRefs({ isSignedIn, acquireToken, appId, environmentId, region, connectionReferences, schemaMap, onDisambiguationNeeded, onMissingConnection, isvClientId, }: UseConnectionRefsOptions): UseConnectionRefsResult;
136
+ export declare function useConnectionRefs({ isSignedIn, acquireToken, appId, environmentId, region, connectionReferences, hasDataverse, schemaMap, onDisambiguationNeeded, onMissingConnection, isvClientId, }: UseConnectionRefsOptions): UseConnectionRefsResult;
135
137
  //# sourceMappingURL=useConnectionRefs.d.ts.map
@@ -3,6 +3,7 @@
3
3
  * React Native host integration for @microsoft/power-apps
4
4
  *
5
5
  */
6
+ import '@microsoft/power-apps-native-assets';
6
7
  export { NativePowerAppsBridge } from './bridge/NativePowerAppsBridge';
7
8
  export { PowerPagesBridge, setupPowerPagesHost } from './bridge/PowerPagesBridge';
8
9
  export type { PowerPagesBridgeOptions } from './bridge/PowerPagesBridge';
@@ -17,7 +18,7 @@ export type { AuthConfig, MsalAuthConfig, IntuneConfig } from '@microsoft/power-
17
18
  export { PowerAppsHostProvider } from './provider/PowerAppsHostProvider';
18
19
  export type { PowerAppsHostProviderProps } from './provider/PowerAppsHostProvider';
19
20
  export { PowerAppsProvider } from './provider/PowerAppsProvider';
20
- export type { AppInsightsConfig, PowerAppsProviderProps, PowerConfig } from './provider/PowerAppsProvider';
21
+ export type { AppInsightsConfig, PowerAppsAppConfig, PowerAppsProviderProps, PowerConfig, } from './provider/PowerAppsProvider';
21
22
  export { buildEnvironmentEndpoint, POWER_PLATFORM_API_SCOPE } from './platform/PowerPlatformEnvironmentApi';
22
23
  export { fetchInstanceUrl } from './platform/DataverseGlobalDiscoveryApi';
23
24
  export { buildCdsDataSources } from './platform/DataverseDataSources';
@@ -46,7 +47,7 @@ export { ImagePicker } from './controls/ImagePicker';
46
47
  export type { ImagePickerProps, PickedImageInfo } from './controls/ImagePicker';
47
48
  export { isDevPlayer } from './utils/isDevPlayer';
48
49
  export { base64ToDataverseUploadFile, base64ToUint8Array, createDataverseUploadFile, } from './utils/dataverseUtils';
49
- export { getAppLogger, configureAppLogger, getCustomerTelemetryLogger, HostOperationNames, } from './telemetry';
50
- export type { ICustomerTelemetryLogger, ILogger, } from '@microsoft/power-apps-native-common';
50
+ export { getAppLogger, configureAppLogger, getCustomEventsLogger, HostOperationNames, } from './telemetry';
51
+ export type { ICustomEventsLogger, ILogger, } from '@microsoft/power-apps-native-common';
51
52
  export { ErrorBoundary } from './ErrorBoundary';
52
53
  //# sourceMappingURL=index.d.ts.map
@@ -18,6 +18,7 @@ export interface DatabaseReferenceDataSource {
18
18
  export interface DatabaseReference {
19
19
  dataSources?: Record<string, DatabaseReferenceDataSource>;
20
20
  }
21
+ export declare function hasDataverseDatabaseReferences<T>(databaseReferences?: Record<string, T>): boolean;
21
22
  export declare function buildCdsDataSources(databaseReferences: Record<string, DatabaseReference>, dataverseOrgUrl: string): Array<{
22
23
  runtimeUrl: string;
23
24
  entitySetName: string;
@@ -69,7 +69,25 @@ export interface AppInsightsConfig extends Omit<ApplicationInsightsTelemetryProv
69
69
  /** Explicit opt-in. Application Insights telemetry is disabled unless this is true. */
70
70
  enabled: boolean;
71
71
  }
72
+ export interface PowerAppsAppConfig {
73
+ expo?: {
74
+ extra?: {
75
+ appInsightsConfig?: unknown;
76
+ [key: string]: unknown;
77
+ };
78
+ [key: string]: unknown;
79
+ };
80
+ [key: string]: unknown;
81
+ }
72
82
  export interface PowerAppsProviderProps {
83
+ /**
84
+ * Contents of the generated app.json.
85
+ *
86
+ * Pass this when the app runs inside a host such as Dev Player, where
87
+ * `Constants.expoConfig` describes the host instead of the loaded app.
88
+ * The provider falls back to `Constants.expoConfig` when omitted.
89
+ */
90
+ appConfig?: PowerAppsAppConfig;
73
91
  /** MSAL configuration from auth.config.json (msal section). */
74
92
  msalConfig: AuthProviderProps['msalConfig'];
75
93
  /** Intune MAM configuration. Defaults to enabled in release builds. */
@@ -134,16 +152,21 @@ export interface PowerAppsProviderProps {
134
152
  */
135
153
  logger?: ILogger | null;
136
154
  /**
137
- * Show app and telemetry session details after a three-finger downward swipe.
155
+ * Show app and telemetry session details after a three-finger long press.
138
156
  * Available in both development and published native apps. @default true
139
157
  */
158
+ showSessionDetailsOnLongPress?: boolean;
159
+ /**
160
+ * @deprecated Use `showSessionDetailsOnLongPress` instead.
161
+ */
140
162
  showSessionDetailsOnSwipe?: boolean;
141
163
  /**
142
164
  * Optional customer-owned Application Insights destination.
143
165
  *
144
- * Events are sent directly to the selected C1-owned Application Insights
166
+ * Events are sent directly to the selected customer-owned Application Insights
145
167
  * resource and fan out alongside the default Microsoft OneDS provider.
146
- * Defaults to `expo.extra.appInsightsConfig` from app.json.
168
+ * Defaults to `appConfig.expo.extra.appInsightsConfig`, then falls back to
169
+ * `Constants.expoConfig.extra.appInsightsConfig`.
147
170
  * Ignored when `logger` is provided or `null`.
148
171
  */
149
172
  appInsightsConfig?: AppInsightsConfig;
@@ -164,7 +187,7 @@ export interface PowerAppsProviderProps {
164
187
  * component, eliminating all provider boilerplate from the consuming app's
165
188
  * root layout.
166
189
  */
167
- export declare function PowerAppsProvider({ msalConfig, intuneConfig, powerConfig, schemaMap, tamaguiConfig, // override with app's tamagui.config.ts
168
- defaultTheme, theme, darkTheme, followSystemTheme, renderOAuthWebView, onDisambiguationNeeded, onConnectionConsent, onResourceConsent, onConnectionConsentDeclined, appName, logger: loggerProp, showSessionDetailsOnSwipe, appInsightsConfig, offlineProfile, children, }: PowerAppsProviderProps): React.JSX.Element;
190
+ export declare function PowerAppsProvider({ appConfig, msalConfig, intuneConfig, powerConfig, schemaMap, tamaguiConfig, // override with app's tamagui.config.ts
191
+ defaultTheme, theme, darkTheme, followSystemTheme, renderOAuthWebView, onDisambiguationNeeded, onConnectionConsent, onResourceConsent, onConnectionConsentDeclined, appName, logger: loggerProp, showSessionDetailsOnLongPress, showSessionDetailsOnSwipe, appInsightsConfig, offlineProfile, children, }: PowerAppsProviderProps): React.JSX.Element;
169
192
  export {};
170
193
  //# sourceMappingURL=PowerAppsProvider.d.ts.map
@@ -8,8 +8,8 @@
8
8
  * alongside the canonical host operation-name constants.
9
9
  */
10
10
  import { HttpClient } from '@microsoft/power-apps-native-common/http';
11
- export { getAppLogger, configureAppLogger, getCustomerTelemetryLogger } from '@microsoft/power-apps-native-common';
12
- export type { ICustomerTelemetryLogger } from '@microsoft/power-apps-native-common';
11
+ export { getAppLogger, configureAppLogger, getCustomEventsLogger } from '@microsoft/power-apps-native-common';
12
+ export type { ICustomEventsLogger } from '@microsoft/power-apps-native-common';
13
13
  /**
14
14
  * Canonical operation names for host package telemetry.
15
15
  * Follow the `PowerAppsHost.<Subsystem>.<Action>` convention so events are
@@ -0,0 +1,12 @@
1
+ export interface BabelConfigApi {
2
+ cache(value: boolean): void;
3
+ }
4
+ export interface PowerAppsBabelConfigOptions {
5
+ presets?: unknown[];
6
+ plugins?: unknown[];
7
+ }
8
+ export declare function createPowerAppsBabelConfig(api: BabelConfigApi, options?: PowerAppsBabelConfigOptions): {
9
+ presets: unknown[];
10
+ plugins: unknown[];
11
+ };
12
+ //# sourceMappingURL=babelConfig.d.ts.map
@@ -0,0 +1,21 @@
1
+ import type { ConfigContext, ExpoConfig } from 'expo/config';
2
+ export interface PowerAppsExpoConfigSettings {
3
+ name: string;
4
+ slug: string;
5
+ scheme: string;
6
+ androidPackage: string;
7
+ iosBundleIdentifier: string;
8
+ version: string;
9
+ versionCode: number;
10
+ iconPath?: string | null;
11
+ /**
12
+ * Optional splash image. When omitted, falls back to the `APP_SPLASH_PATH`
13
+ * environment variable and then to the branding placeholder, so the template
14
+ * needs no wiring of its own and prebuild always emits replaceable slots.
15
+ */
16
+ splashPath?: string | null;
17
+ isDevClient?: boolean;
18
+ }
19
+ export type CustomizePowerAppsExpoConfig = (config: ExpoConfig) => ExpoConfig;
20
+ export declare function createPowerAppsExpoConfig(baseConfig: ConfigContext['config'], settings: PowerAppsExpoConfigSettings, customize?: CustomizePowerAppsExpoConfig): ExpoConfig;
21
+ //# sourceMappingURL=expoConfig.d.ts.map
@@ -0,0 +1,6 @@
1
+ import { getDefaultConfig } from 'expo/metro-config.js';
2
+ type PowerAppsMetroConfig = ReturnType<typeof getDefaultConfig>;
3
+ type CustomizeMetroConfig = (config: PowerAppsMetroConfig) => PowerAppsMetroConfig;
4
+ export declare function createPowerAppsMetroConfig(projectRoot: string, customize?: CustomizeMetroConfig): PowerAppsMetroConfig;
5
+ export {};
6
+ //# sourceMappingURL=metroConfig.d.ts.map
@@ -0,0 +1,21 @@
1
+ import type { IncomingMessage, ServerResponse } from 'node:http';
2
+ type InstrumentationContext = {
3
+ phase: string;
4
+ logPath: string;
5
+ };
6
+ type InstrumentationErrorHandler = (error: Error, context: InstrumentationContext) => void;
7
+ type MetroNext = (error?: Error) => void;
8
+ export type MetroMiddleware = (request: IncomingMessage, response: ServerResponse, next: MetroNext) => unknown;
9
+ export type MetroLoggingOptions = {
10
+ projectRoot?: string;
11
+ maxBodyBytes?: number;
12
+ onError?: InstrumentationErrorHandler;
13
+ };
14
+ export declare function redactMetroLog(value: unknown): string;
15
+ export declare function enablePowerNativeMetroLogging(options?: MetroLoggingOptions): {
16
+ logDir: string;
17
+ logPath: string;
18
+ };
19
+ export declare function withPowerNativeMetroLogging(middleware: MetroMiddleware, options?: MetroLoggingOptions): MetroMiddleware;
20
+ export {};
21
+ //# sourceMappingURL=metroLogger.d.ts.map