# @microsoft/managed-apps

The client SDK for Microsoft managed apps. Code running inside a managed app imports this package to talk to the host — app context, the typed data client (Dataverse and connector operations), and developer telemetry. The SDK runs in the app iframe and communicates with the host over the channel protocol.

The package has no root entry; import from one of the subpaths below. Usage and full API details are covered in the [Microsoft managed apps documentation](https://go.microsoft.com/fwlink/?LinkId=2369054).

### `@microsoft/managed-apps/app`

`getContext`, `setConfig`, `IContext`, `IConfig`.

### `@microsoft/managed-apps/auth`

`getUser`, `IUser`.

`getUser()` returns the signed-in user's `fullName`, `objectId`, and `tenantId` supplied
by the host:

```typescript
import { getUser } from '@microsoft/managed-apps/auth';

const user = await getUser();
// Example host-supplied identity:
// {
//   fullName: 'Alex Example',
//   objectId: '11111111-1111-4111-8111-111111111111',
//   tenantId: '22222222-2222-4222-8222-222222222222'
// }
```

Results are cached for the app-frame session only when both IDs contain
non-whitespace characters. The SDK relies on the host's typed response contract;
these checks determine cache eligibility, not response validation. An empty
`fullName` is valid when both IDs are present. Subsequent calls return the same
cached object without another host request; field values are never trimmed or normalized.

For compatibility, blank or partial identities still resolve successfully but are
not cached. A later explicit `getUser()` call requests identity from the host again;
there are no automatic retries. Genuine host/channel failures still reject.

An SDK-only update cannot supply IDs omitted by an older host or missing from the
signed-in account. Upgrade the host to receive its identity-wiring fix and open a
fresh host/app frame. Identity belongs to that lifetime; account changes also require
a fresh host/frame.

### `@microsoft/managed-apps/data`

`getClient`, `DataClient`, `IOperationOptions`, `IOperationResult`, `serializeMultiSelectPicklistFields`, `deserializeMultiSelectPicklistFields`.

### `@microsoft/managed-apps/telemetry`

`initializeLogger`, `ILogger`, and the `Metric` types.
