@microsoft/managed-apps-common
v0.6.0
Published
Shared types, utilities, and services for Power Platform Managed Host packages
Readme
@microsoft/managed-apps-common
Shared types, utilities, and services for Managed Apps packages.
Note: This package is published internally via Azure Artifacts. It is subject to frequent breaking changes and is not intended for standalone production use outside of the Managed Apps ecosystem.
Subpaths
| Subpath | Purpose |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ./communication | JSON-RPC channel primitives, Methods.* definitions, MessagePortChannel, transfer helpers |
| ./dataClient | Transport-agnostic data client (createDataClient, DataClientHost). Consumed by @microsoft/managed-apps's browser binding and the future function-runtime SDK. See docs/architecture/packages/managed-apps-common/dataClient.md |
| ./errors | Structured error types |
| ./gateway | Gateway path constants |
| ./http | Fetch wrapper with middleware pipeline |
| ./metrics | Metric type definitions |
| ./services | Managed governance, region helpers, API discovery |
| ./telemetry | Logger, OneDS telemetry provider |
| ./testUtils | Shared mock factories |
| ./types | Cross-package type definitions |
| ./utils | Base64, GUID, JWT, promise, string helpers |
| ./vfs | Virtual file system utilities |
Exports
Constants
AppConfigFileName(./config) — the canonical config filename'ms.config.json'AppArtifactDirName(./config) — the canonical artifact directory name'.ms'
Types
AppMetadata,App,AppProperties,Environment- App metadata typesAppConfig(./config) - App configuration schema typeClusterCategory- Cluster environment enum (Production, Test, Dev)ConnectionReference,RpConnection- Connection reference typesHostError,HostErrorCode- Structured error typesConnectionInstance,ConnectionUsage- Connection domain types (shared with host)UserConsent,AuthResource- Consent domain types (shared with host)AppConnectionContext- Context passed to connection loadingCdsDatabaseReference,DatasetReference,DataSourceInfo- Data source typesApi,NestedAction,ParameterHint,ListAppPackageOperationDetails- API metadata types
Plugin Definitions
PluginMap- Central type mapping action keys to typed function signaturesPluginKey,PluginParams<K>,PluginResponse<K>,PluginHandler<K>- Utility types for typed plugin handlersPluginAction- Action name constants (derived from definition keys)PluginDefinition- Generic mapped type for defining plugin entriesGetContextKey,GetCdsKey,GetAppConnectionsKey,HttpSendKey,MessagingGetVersionInfoKey,MessagingSendKey- Dot-namespaced action key constantsPluginAliases- Legacy wire-format key to canonical key mapIContext- Response type forAppLifecycle.getContextSendHttpRequest,SendHttpResponse- Types forHttp.send
HTTP
HttpClient- Fetch wrapper with interceptors, base URL, and default headersHttpClientOptions- Configuration for HttpClientHttpError- Error class for non-OK HTTP responsesHttpRequestConfig,HttpResponse- Request/response typesRequestInterceptor,ResponseInterceptor- Interceptor types
Telemetry
TelemetryLogger- Logger for telemetry eventsLogLevel- Enum for log severity levelsTelemetryEvent- Interface for telemetry event data
Utilities
parseQueryParams(url)- Parse query parameters from a URL stringbuildUrl(base, params)- Build a URL with query parameters
Scripts
| Script | Description |
| ------------- | ----------------------------- |
| build | Compile TypeScript to dist/ |
| dev | Watch mode compilation |
| check-types | Type-check without emitting |
| lint | Run ESLint on src/ |
| test | Run Bun tests (src/) |
| clean | Remove dist/ and .turbo/ |
Test Utilities
Shared mock factories live in src/__tests__/testUtils/:
createMockConnection(overrides?)— returns aConnectionInstancewith sensible defaults
Import from the barrel: import { createMockConnection } from '../../__tests__/testUtils';
