@microsoft/power-apps-native-host 0.4.0 → 0.5.1

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 (107) hide show
  1. package/README.md +60 -0
  2. package/compatibility/current.json +1 -1
  3. package/lib/NOTICE.txt +2957 -371
  4. package/lib/commonjs/auth/AuthContext.js +49 -22
  5. package/lib/commonjs/auth/targetAuthorization.js +53 -0
  6. package/lib/commonjs/bridge/NativePowerAppsBridge.js +33 -2
  7. package/lib/commonjs/bridge/PowerPagesBridge.js +1 -3
  8. package/lib/commonjs/bridge/setupNativeHost.js +6 -0
  9. package/lib/commonjs/config/expoConfig.js +14 -0
  10. package/lib/commonjs/config/runtimeTenantMode.js +16 -0
  11. package/lib/commonjs/config/runtimeTenantMode.web.js +9 -0
  12. package/lib/commonjs/config/tenantMode.js +68 -0
  13. package/lib/commonjs/connections/PowerPlatformConnectionApi.js +24 -27
  14. package/lib/commonjs/connections/connectionMetadata.js +2 -2
  15. package/lib/commonjs/connections/resolveConnections.js +8 -3
  16. package/lib/commonjs/connections/types.js +9 -2
  17. package/lib/commonjs/connections/useConnectionRefs.js +19 -10
  18. package/lib/commonjs/index.js +39 -0
  19. package/lib/commonjs/platform/CanvasAppResolution.js +33 -0
  20. package/lib/commonjs/platform/CanvasAppResolutionApi.js +69 -0
  21. package/lib/commonjs/platform/DataverseGlobalDiscoveryApi.js +50 -13
  22. package/lib/commonjs/platform/GlobalDiscovery.js +40 -1
  23. package/lib/commonjs/provider/PowerAppsHostProvider.js +47 -8
  24. package/lib/commonjs/provider/PowerAppsProvider.js +172 -6
  25. package/lib/commonjs/target/DefaultPowerAppsExperience.js +564 -0
  26. package/lib/commonjs/target/PowerAppsExperience.js +41 -0
  27. package/lib/commonjs/target/PowerAppsTargetBootstrap.js +534 -0
  28. package/lib/commonjs/target/errors.js +24 -0
  29. package/lib/commonjs/target/types.js +1 -0
  30. package/lib/module/auth/AuthContext.js +49 -22
  31. package/lib/module/auth/targetAuthorization.js +48 -0
  32. package/lib/module/bridge/NativePowerAppsBridge.js +33 -2
  33. package/lib/module/bridge/PowerPagesBridge.js +1 -3
  34. package/lib/module/bridge/setupNativeHost.js +5 -0
  35. package/lib/module/config/expoConfig.js +14 -0
  36. package/lib/module/config/runtimeTenantMode.js +12 -0
  37. package/lib/module/config/runtimeTenantMode.web.js +5 -0
  38. package/lib/module/config/tenantMode.js +61 -0
  39. package/lib/module/connections/PowerPlatformConnectionApi.js +24 -27
  40. package/lib/module/connections/connectionMetadata.js +2 -2
  41. package/lib/module/connections/resolveConnections.js +9 -4
  42. package/lib/module/connections/types.js +9 -2
  43. package/lib/module/connections/useConnectionRefs.js +20 -11
  44. package/lib/module/index.js +4 -1
  45. package/lib/module/platform/CanvasAppResolution.js +27 -0
  46. package/lib/module/platform/CanvasAppResolutionApi.js +65 -0
  47. package/lib/module/platform/DataverseGlobalDiscoveryApi.js +49 -14
  48. package/lib/module/platform/GlobalDiscovery.js +37 -1
  49. package/lib/module/provider/PowerAppsHostProvider.js +47 -8
  50. package/lib/module/provider/PowerAppsProvider.js +176 -10
  51. package/lib/module/target/DefaultPowerAppsExperience.js +559 -0
  52. package/lib/module/target/PowerAppsExperience.js +34 -0
  53. package/lib/module/target/PowerAppsTargetBootstrap.js +529 -0
  54. package/lib/module/target/errors.js +19 -0
  55. package/lib/module/target/types.js +1 -0
  56. package/lib/typescript/commonjs/auth/AuthContext.d.ts +11 -2
  57. package/lib/typescript/commonjs/auth/targetAuthorization.d.ts +15 -0
  58. package/lib/typescript/commonjs/bridge/NativePowerAppsBridge.d.ts +6 -0
  59. package/lib/typescript/commonjs/bridge/setupNativeHost.d.ts +2 -0
  60. package/lib/typescript/commonjs/config/runtimeTenantMode.d.ts +3 -0
  61. package/lib/typescript/commonjs/config/runtimeTenantMode.web.d.ts +3 -0
  62. package/lib/typescript/commonjs/config/tenantMode.d.ts +14 -0
  63. package/lib/typescript/commonjs/connections/PowerPlatformConnectionApi.d.ts +5 -2
  64. package/lib/typescript/commonjs/connections/connectionMetadata.d.ts +1 -1
  65. package/lib/typescript/commonjs/connections/types.d.ts +7 -1
  66. package/lib/typescript/commonjs/connections/useConnectionRefs.d.ts +11 -2
  67. package/lib/typescript/commonjs/index.d.ts +5 -1
  68. package/lib/typescript/commonjs/platform/CanvasAppResolution.d.ts +4 -0
  69. package/lib/typescript/commonjs/platform/CanvasAppResolutionApi.d.ts +6 -0
  70. package/lib/typescript/commonjs/platform/DataverseGlobalDiscoveryApi.d.ts +12 -2
  71. package/lib/typescript/commonjs/platform/GlobalDiscovery.d.ts +12 -0
  72. package/lib/typescript/commonjs/provider/PowerAppsHostProvider.d.ts +9 -1
  73. package/lib/typescript/commonjs/provider/PowerAppsProvider.d.ts +13 -15
  74. package/lib/typescript/commonjs/target/DefaultPowerAppsExperience.d.ts +6 -0
  75. package/lib/typescript/commonjs/target/PowerAppsExperience.d.ts +61 -0
  76. package/lib/typescript/commonjs/target/PowerAppsTargetBootstrap.d.ts +15 -0
  77. package/lib/typescript/commonjs/target/errors.d.ts +13 -0
  78. package/lib/typescript/commonjs/target/types.d.ts +34 -0
  79. package/lib/typescript/module/auth/AuthContext.d.ts +11 -2
  80. package/lib/typescript/module/auth/targetAuthorization.d.ts +15 -0
  81. package/lib/typescript/module/bridge/NativePowerAppsBridge.d.ts +6 -0
  82. package/lib/typescript/module/bridge/setupNativeHost.d.ts +2 -0
  83. package/lib/typescript/module/config/runtimeTenantMode.d.ts +3 -0
  84. package/lib/typescript/module/config/runtimeTenantMode.web.d.ts +3 -0
  85. package/lib/typescript/module/config/tenantMode.d.ts +14 -0
  86. package/lib/typescript/module/connections/PowerPlatformConnectionApi.d.ts +5 -2
  87. package/lib/typescript/module/connections/connectionMetadata.d.ts +1 -1
  88. package/lib/typescript/module/connections/types.d.ts +7 -1
  89. package/lib/typescript/module/connections/useConnectionRefs.d.ts +11 -2
  90. package/lib/typescript/module/index.d.ts +5 -1
  91. package/lib/typescript/module/platform/CanvasAppResolution.d.ts +4 -0
  92. package/lib/typescript/module/platform/CanvasAppResolutionApi.d.ts +6 -0
  93. package/lib/typescript/module/platform/DataverseGlobalDiscoveryApi.d.ts +12 -2
  94. package/lib/typescript/module/platform/GlobalDiscovery.d.ts +12 -0
  95. package/lib/typescript/module/provider/PowerAppsHostProvider.d.ts +9 -1
  96. package/lib/typescript/module/provider/PowerAppsProvider.d.ts +13 -15
  97. package/lib/typescript/module/target/DefaultPowerAppsExperience.d.ts +6 -0
  98. package/lib/typescript/module/target/PowerAppsExperience.d.ts +61 -0
  99. package/lib/typescript/module/target/PowerAppsTargetBootstrap.d.ts +15 -0
  100. package/lib/typescript/module/target/errors.d.ts +13 -0
  101. package/lib/typescript/module/target/types.d.ts +34 -0
  102. package/package.json +12 -5
  103. package/scripts/build-codegen-package.js +34 -3
  104. package/scripts/dev.js +405 -0
  105. package/scripts/upgrade-authoring.js +85 -28
  106. package/scripts/wrap.js +42 -5
  107. package/src/config/generated-config.d.ts +21 -0
@@ -1,3 +1,13 @@
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>;
1
+ import type { TelemetryLocation } from '@microsoft/power-apps-native-common';
2
+ import type { PowerPlatformTarget } from '../target/types.js';
3
+ /** Enumerate enabled commercial-cloud Dataverse environments available to an authenticated tenant account. */
4
+ export declare function fetchAccessibleEnvironments(tenantId: string, appDisplayName: string, appName: string, acquireToken: (scopes: string[]) => Promise<string | null>): Promise<PowerPlatformTarget[]>;
5
+ export interface DataverseInstanceMetadata {
6
+ instanceUrl: string;
7
+ telemetryLocation?: TelemetryLocation;
8
+ }
9
+ /** Fetch Dataverse environment metadata from the Global Discovery Service. */
10
+ export declare function fetchInstanceMetadata(environmentId: string, region: string, acquireToken: (scopes: string[]) => Promise<string | null>, _bearerToken?: string): Promise<DataverseInstanceMetadata | undefined>;
11
+ /** Fetch only the Dataverse instance URL for callers that do not need region metadata. */
12
+ export declare function fetchInstanceUrl(environmentId: string, region: string, acquireToken: (scopes: string[]) => Promise<string | null>, bearerToken?: string): Promise<string | undefined>;
3
13
  //# sourceMappingURL=DataverseGlobalDiscoveryApi.d.ts.map
@@ -1,4 +1,16 @@
1
+ import type { PowerPlatformTarget } from '../target/types.js';
2
+ export type DiscoveryInstance = {
3
+ ApiUrl?: unknown;
4
+ EnvironmentId?: unknown;
5
+ FriendlyName?: unknown;
6
+ Region?: unknown;
7
+ State?: unknown;
8
+ TenantId?: unknown;
9
+ };
10
+ export declare function isEnabledDiscoveryState(state: unknown): boolean;
11
+ export declare function parseDiscoveredEnvironments(instances: DiscoveryInstance[], tenantId: string, appDisplayName: string, appName: string): PowerPlatformTarget[];
1
12
  export declare function globalDiscoveryEndpoint(region: string): string;
2
13
  export declare function globalDiscoveryScope(region: string): string;
3
14
  export declare function buildGlobalDiscoveryUrl(environmentId: string, region: string): string;
15
+ export declare function buildGlobalDiscoveryListUrl(region: string): string;
4
16
  //# sourceMappingURL=GlobalDiscovery.d.ts.map
@@ -31,6 +31,7 @@ import type { ConnectorSchema } from '../connections/useConnectionRefs.js';
31
31
  import type { DatabaseReference } from '../platform/DataverseDataSources.js';
32
32
  import type { OnDisambiguationNeeded } from '../connections/types.js';
33
33
  import type { ConnectionReferenceConfig, ConnectionUsageInput, ResourceConsentRequirement } from '../connections/types.js';
34
+ import type { TelemetryLocation } from '@microsoft/power-apps-native-common';
34
35
  export interface PowerAppsHostProviderProps {
35
36
  /**
36
37
  * Callback to acquire an access token for the given scopes.
@@ -104,6 +105,13 @@ export interface PowerAppsHostProviderProps {
104
105
  * appid at runtime (prevents 403 "missing connection ACL" for third-party tokens).
105
106
  */
106
107
  isvClientId: string;
108
+ targetGeneration?: number;
109
+ targetTenantId?: string;
110
+ targetAppName?: string;
111
+ targetAccountIdentifier?: string;
112
+ expectedDataverseOrigin?: string;
113
+ /** Receives geography resolved from API responses already used during startup. */
114
+ onTelemetryLocationResolved?: (location: TelemetryLocation) => void;
107
115
  /**
108
116
  * Called when multiple Connected connections exist for the same connector.
109
117
  * Present a native picker UI and return the chosen connectionId, or null to
@@ -130,5 +138,5 @@ export interface PowerAppsHostProviderProps {
130
138
  *
131
139
  * Children are never rendered until all required connections are resolved.
132
140
  */
133
- export declare function PowerAppsHostProvider({ acquireToken, isSignedIn, onSignOut, appId, environmentId, region, connectionReferences, schemaMap, databaseReferences, renderOAuthWebView, isvClientId, onDisambiguationNeeded, onConnectionConsent, onResourceConsent, onConnectionConsentDeclined, children, }: PowerAppsHostProviderProps): React.JSX.Element;
141
+ export declare function PowerAppsHostProvider({ acquireToken, isSignedIn, onSignOut, appId, environmentId, region, connectionReferences, schemaMap, databaseReferences, renderOAuthWebView, isvClientId, onTelemetryLocationResolved, targetGeneration, targetTenantId, targetAppName, targetAccountIdentifier, expectedDataverseOrigin, onDisambiguationNeeded, onConnectionConsent, onResourceConsent, onConnectionConsentDeclined, children, }: PowerAppsHostProviderProps): React.JSX.Element;
134
142
  //# sourceMappingURL=PowerAppsHostProvider.d.ts.map
@@ -34,6 +34,7 @@ import type { ConnectionReferenceConfig, OnDisambiguationNeeded } from '../conne
34
34
  import type { ThemeTokens } from '../theme/tokens.js';
35
35
  import type { ILogger } from '@microsoft/power-apps-native-common';
36
36
  import type { ApplicationInsightsTelemetryProviderConfig } from '@microsoft/power-apps-native-common';
37
+ import type { PowerAppsExperienceComponent } from '../target/PowerAppsExperience.js';
37
38
  /** Shape of power.config.json consumed by the provider. */
38
39
  export interface PowerConfig {
39
40
  /**
@@ -46,14 +47,6 @@ export interface PowerConfig {
46
47
  appId?: string | null;
47
48
  environmentId?: string;
48
49
  region?: string;
49
- /**
50
- * BAP environment `location` value (`environment.properties.location` from the
51
- * Get Environments API). EU locations — `"europe"`, `"unitedkingdom"`,
52
- * `"france"`, `"germany"`, `"italy"`, `"poland"`, `"norway"`, `"sweden"`,
53
- * `"switzerland"` — route telemetry to the EU 1DS collector.
54
- * Omit for the default global collector.
55
- */
56
- geoRegion?: string;
57
50
  connectionReferences?: Record<string, ConnectionReferenceConfig>;
58
51
  databaseReferences?: Record<string, DatabaseReference>;
59
52
  /**
@@ -79,7 +72,7 @@ export interface PowerAppsAppConfig {
79
72
  };
80
73
  [key: string]: unknown;
81
74
  }
82
- export interface PowerAppsProviderProps {
75
+ interface PowerAppsProviderCommonProps {
83
76
  /**
84
77
  * Contents of the generated app.json.
85
78
  *
@@ -88,10 +81,6 @@ export interface PowerAppsProviderProps {
88
81
  * The provider falls back to `Constants.expoConfig` when omitted.
89
82
  */
90
83
  appConfig?: PowerAppsAppConfig;
91
- /** MSAL configuration from auth.config.json (msal section). */
92
- msalConfig: AuthProviderProps['msalConfig'];
93
- /** Intune MAM configuration. Defaults to enabled in release builds. */
94
- intuneConfig?: AuthProviderProps['intuneConfig'];
95
84
  /** Contents of power.config.json. */
96
85
  powerConfig: PowerConfig;
97
86
  /**
@@ -177,8 +166,18 @@ export interface PowerAppsProviderProps {
177
166
  * if you want to pass the profile programmatically (e.g., tests).
178
167
  */
179
168
  offlineProfile?: Record<string, unknown>;
169
+ /**
170
+ * Customer-owned UI for multi-tenant sign-in, discovery, environment
171
+ * selection, loading, and errors. The built-in experience is used when
172
+ * omitted. Ignored in single-tenant mode.
173
+ */
174
+ multiTenantExperience?: PowerAppsExperienceComponent;
180
175
  children: React.ReactNode;
181
176
  }
177
+ export type PowerAppsProviderProps = PowerAppsProviderCommonProps & {
178
+ msalConfig: AuthProviderProps['msalConfig'];
179
+ intuneConfig?: AuthProviderProps['intuneConfig'];
180
+ };
182
181
  /**
183
182
  * Top-level provider for Power Apps canvas apps running inside an Expo shell.
184
183
  *
@@ -187,7 +186,6 @@ export interface PowerAppsProviderProps {
187
186
  * component, eliminating all provider boilerplate from the consuming app's
188
187
  * root layout.
189
188
  */
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;
189
+ export declare function PowerAppsProvider({ ...props }: PowerAppsProviderProps): React.JSX.Element;
192
190
  export {};
193
191
  //# sourceMappingURL=PowerAppsProvider.d.ts.map
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import type { PropsWithChildren } from 'react';
3
+ export declare function DefaultPowerAppsExperience({ appDisplayName, children, }: PropsWithChildren<{
4
+ appDisplayName: string;
5
+ }>): React.JSX.Element;
6
+ //# sourceMappingURL=DefaultPowerAppsExperience.d.ts.map
@@ -0,0 +1,61 @@
1
+ import React from 'react';
2
+ export interface PowerAppsEnvironmentSummary {
3
+ id: string;
4
+ label: string;
5
+ }
6
+ export interface PowerAppsExperienceError {
7
+ code: string;
8
+ message: string;
9
+ retryable: boolean;
10
+ }
11
+ export type PowerAppsExperience = {
12
+ status: 'preparing';
13
+ } | {
14
+ status: 'signIn';
15
+ error?: string;
16
+ signIn: () => Promise<void>;
17
+ goBack?: () => void;
18
+ } | {
19
+ status: 'discovering';
20
+ } | {
21
+ status: 'selectEnvironment';
22
+ environments: readonly PowerAppsEnvironmentSummary[];
23
+ selectEnvironment: (environmentId: string) => void;
24
+ signOut: () => Promise<void>;
25
+ } | {
26
+ status: 'connecting';
27
+ environment: PowerAppsEnvironmentSummary;
28
+ } | {
29
+ status: 'resolvingApp';
30
+ environment: PowerAppsEnvironmentSummary;
31
+ } | {
32
+ status: 'empty';
33
+ retry: () => void;
34
+ signOut: () => Promise<void>;
35
+ } | {
36
+ status: 'error';
37
+ error: PowerAppsExperienceError;
38
+ retry?: () => void;
39
+ goBack?: () => void;
40
+ signOut?: () => Promise<void>;
41
+ } | {
42
+ status: 'ready';
43
+ environment: PowerAppsEnvironmentSummary;
44
+ };
45
+ export interface PowerAppsExperienceComponentProps {
46
+ appDisplayName: string;
47
+ children: React.ReactNode;
48
+ }
49
+ export type PowerAppsExperienceComponent = React.ComponentType<PowerAppsExperienceComponentProps>;
50
+ export declare function usePowerAppsExperience(): PowerAppsExperience;
51
+ export declare function PowerAppsRuntimeGate({ children }: {
52
+ children: React.ReactNode;
53
+ }): React.JSX.Element | null;
54
+ export declare function PowerAppsExperienceBoundary({ experience, appDisplayName, component: Component, children, fallback, }: {
55
+ experience: PowerAppsExperience;
56
+ appDisplayName: string;
57
+ component?: PowerAppsExperienceComponent;
58
+ children?: React.ReactNode;
59
+ fallback: React.ReactNode;
60
+ }): React.JSX.Element;
61
+ //# sourceMappingURL=PowerAppsExperience.d.ts.map
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import type { MsalAuthConfig } from '@microsoft/power-apps-native-auth';
3
+ import { type PowerAppsTenantPolicy } from '../config/tenantMode.js';
4
+ import { type PowerAppsExperienceComponent } from './PowerAppsExperience.js';
5
+ import type { ResolvedPowerPlatformTarget, TargetAuthSession } from './types.js';
6
+ export interface PowerAppsTargetBootstrapProps {
7
+ msalConfig: MsalAuthConfig;
8
+ appDisplayName: string;
9
+ appName: string;
10
+ tenantPolicy: PowerAppsTenantPolicy;
11
+ experienceComponent?: PowerAppsExperienceComponent;
12
+ children: (target: ResolvedPowerPlatformTarget, authSession: TargetAuthSession) => React.ReactNode;
13
+ }
14
+ export declare function PowerAppsTargetBootstrap({ msalConfig, appDisplayName, appName, tenantPolicy, experienceComponent, children }: PowerAppsTargetBootstrapProps): React.JSX.Element;
15
+ //# sourceMappingURL=PowerAppsTargetBootstrap.d.ts.map
@@ -0,0 +1,13 @@
1
+ export type TargetErrorCode = 'invalid-build-config' | 'catalog-invalid' | 'stored-target-invalid' | 'authentication-cancelled' | 'authentication-failed' | 'tenant-mismatch' | 'environment-unavailable' | 'discovery-failed' | 'dataverse-access-denied' | 'app-metadata-missing' | 'app-metadata-ambiguous' | 'app-metadata-access-denied' | 'app-not-found' | 'app-access-denied' | 'launch-target-mismatch' | 'connection-setup-failed' | 'offline-switch-unsupported' | 'switch-blocked' | 'stale-operation' | 'service-unavailable';
2
+ export type TargetErrorStage = 'configuration' | 'authentication' | 'discovery' | 'app-resolution' | 'launch' | 'connections' | 'switching';
3
+ export declare class TargetRuntimeError extends Error {
4
+ readonly code: TargetErrorCode;
5
+ readonly stage: TargetErrorStage;
6
+ readonly retryable: boolean;
7
+ readonly userMessage: string;
8
+ readonly targetId?: string | undefined;
9
+ readonly name = "TargetRuntimeError";
10
+ readonly cause?: unknown;
11
+ constructor(code: TargetErrorCode, stage: TargetErrorStage, retryable: boolean, userMessage: string, targetId?: string | undefined, cause?: unknown);
12
+ }
13
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1,34 @@
1
+ export type PowerPlatformTarget = {
2
+ id: string;
3
+ label: string;
4
+ tenantId: string;
5
+ environmentId: string;
6
+ appDisplayName: string;
7
+ appName: string;
8
+ region: string;
9
+ cloud?: 'commercial';
10
+ dataverseApiUrl: string;
11
+ };
12
+ export type ResolvedPowerPlatformTarget = PowerPlatformTarget & {
13
+ appId: string;
14
+ dataverseApiUrl: string;
15
+ };
16
+ export type TargetRuntimeState = 'bootstrapping' | 'selecting' | 'switching' | 'authenticating' | 'resolving' | 'configuring-connections' | 'ready' | 'error';
17
+ export interface TargetTokenBroker {
18
+ readonly tenantId: string;
19
+ readonly generation: number;
20
+ acquireGlobalDiscoveryToken(): Promise<string>;
21
+ acquireDataverseToken(apiUrl: string): Promise<string>;
22
+ acquirePowerPlatformToken(region: string): Promise<string>;
23
+ acquireConnectionUserConsentToken(region: string): Promise<string>;
24
+ acquireApiHubToken(): Promise<string>;
25
+ }
26
+ export interface TargetAuthSession {
27
+ readonly clientId: string;
28
+ readonly accountIdentifier: string;
29
+ readonly accountTenantId: string;
30
+ readonly generation: number;
31
+ readonly tokenBroker: TargetTokenBroker;
32
+ signOut(): Promise<void>;
33
+ }
34
+ //# sourceMappingURL=types.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/power-apps-native-host",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "description": "React Native host integration for @microsoft/power-apps",
5
5
  "author": "Microsoft Corporation",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -47,6 +47,7 @@
47
47
  "./app.plugin.js": "./app.plugin.js"
48
48
  },
49
49
  "bin": {
50
+ "power-apps-dev": "scripts/dev.js",
50
51
  "generate-connector-schemas": "scripts/generate-connector-schemas.js",
51
52
  "js-bundle": "scripts/bundle.js",
52
53
  "build-codegen-package": "scripts/build-codegen-package.js",
@@ -74,10 +75,14 @@
74
75
  "test:offline-compatibility": "bob build && node --test test/OfflineSdkCompatibility.test.js"
75
76
  },
76
77
  "dependencies": {
78
+ "@azure/identity": "^4.13.3",
77
79
  "@expo/config-plugins": "55.0.11",
80
+ "@microsoft/dev-tunnels-connections": "^1.3.60",
81
+ "@microsoft/dev-tunnels-contracts": "^1.3.60",
82
+ "@microsoft/dev-tunnels-management": "^1.3.60",
78
83
  "@microsoft/power-apps-native-assets": "^0.3.0",
79
- "@microsoft/power-apps-native-auth": "^0.3.8",
80
- "@microsoft/power-apps-native-common": "^0.3.0",
84
+ "@microsoft/power-apps-native-auth": "^0.4.0",
85
+ "@microsoft/power-apps-native-common": "^0.3.2",
81
86
  "@ster5/global-mutex": "3.3.0",
82
87
  "@tamagui/config": "2.4.5",
83
88
  "@tamagui/core": "2.4.5",
@@ -85,6 +90,8 @@
85
90
  "@tamagui/toast": "2.4.5",
86
91
  "@tanstack/react-query": "5.62.0",
87
92
  "diff": "9.0.0",
93
+ "lan-network": "0.2.1",
94
+ "qrcode-terminal": "^0.12.0",
88
95
  "resolve-workspace-root": "2.0.1",
89
96
  "write-file-atomic": "7.0.1"
90
97
  },
@@ -95,14 +102,14 @@
95
102
  "@react-native-community/netinfo": ">=11.0.0",
96
103
  "burnt": ">=0.12.2",
97
104
  "expo-application": ">=55.0.0 <56",
98
- "expo-constants": ">=55.0.0 <56",
99
105
  "expo-clipboard": ">=55.0.0 <56",
106
+ "expo-constants": ">=55.0.0 <56",
100
107
  "expo-document-picker": ">=55.0.13 <56",
101
108
  "expo-file-system": ">=55.0.19 <56",
102
109
  "expo-image-picker": ">=55.0.20 <56",
103
110
  "expo-linking": ">=55.0.14 <56",
104
- "expo-sharing": ">=55.0.18 <56",
105
111
  "expo-secure-store": ">=55.0.0 <56",
112
+ "expo-sharing": ">=55.0.18 <56",
106
113
  "expo-web-browser": ">=55.0.14 <56",
107
114
  "react": ">=19.2.0 <20",
108
115
  "react-dom": ">=19.2.0 <19.3.0",
@@ -23,10 +23,12 @@
23
23
  * under the neutral name `powerapps-customer-assets/`, which the native module
24
24
  * reads at runtime.
25
25
  *
26
- * manifest.json shape (schemaVersion 1):
26
+ * manifest.json shape (schemaVersion 2):
27
27
  * {
28
- * "schemaVersion": 1,
28
+ * "schemaVersion": 2,
29
29
  * "platform": "android" | "ios",
30
+ * "tenantMode": "single" | "multi",
31
+ * "multiTenantConfig": null | { "appDisplayName": "...", "appName": "...", "tenantPolicy": ... },
30
32
  * "bundle": { "path": "index.android.bundle.hbc" },
31
33
  * "assets": [
32
34
  * { "fileHash": "<md5>", "type": "png", "path": "assets/<md5>.png",
@@ -46,6 +48,10 @@ const path = require('path');
46
48
  const fs = require('fs');
47
49
  const os = require('os');
48
50
  const crypto = require('crypto');
51
+ const {
52
+ resolveMultiTenantConfig,
53
+ resolveTenantMode,
54
+ } = require('../lib/commonjs/config/tenantMode.js');
49
55
 
50
56
  const platform = process.argv[2];
51
57
  if (platform !== 'android' && platform !== 'ios') {
@@ -104,6 +110,29 @@ function sha256File(filePath) {
104
110
  .digest('hex');
105
111
  }
106
112
 
113
+ function canonicalizeJson(value) {
114
+ if (Array.isArray(value)) return value.map(canonicalizeJson);
115
+ if (value && typeof value === 'object') {
116
+ return Object.fromEntries(
117
+ Object.keys(value).sort().map((key) => [key, canonicalizeJson(value[key])]),
118
+ );
119
+ }
120
+ return value;
121
+ }
122
+
123
+ function resolveBuildContract() {
124
+ const appConfigPath = path.join(projectRoot, 'app.json');
125
+ if (!fs.existsSync(appConfigPath)) throw new Error('app.json not found');
126
+ const appConfig = JSON.parse(fs.readFileSync(appConfigPath, 'utf8'));
127
+ const tenantMode = resolveTenantMode(appConfig);
128
+ return {
129
+ tenantMode,
130
+ multiTenantConfig: tenantMode === 'multi'
131
+ ? canonicalizeJson(resolveMultiTenantConfig(appConfig))
132
+ : null,
133
+ };
134
+ }
135
+
107
136
  function isHermesBytecode(filePath) {
108
137
  const fd = fs.openSync(filePath, 'r');
109
138
  try {
@@ -194,9 +223,11 @@ function buildAssetPackage(exportDir, distDir, bundlePath) {
194
223
  const assetsOutDir = path.join(distDir, ASSET_DIR_NAME, 'assets');
195
224
  const manifestPath = path.join(distDir, ASSET_DIR_NAME, 'manifest.json');
196
225
 
226
+ const buildContract = resolveBuildContract();
197
227
  const manifest = {
198
- schemaVersion: 1,
228
+ schemaVersion: 2,
199
229
  platform,
230
+ ...buildContract,
200
231
  // BIN-3: sha256 pins every artifact the wrap pipeline injects. The wrap
201
232
  // recomputes these before use, so a truncated or swapped blob fails the
202
233
  // build instead of shipping inside a signed app.