@mcesystems/mdm-client
v1.0.63
Published
MDM client for device management
Readme
@mcesystems/mdm-client
MDM client for device management.
Install
This package is published as part of the monorepo. Use it through your workspace package manager.
Usage
Create client from environment
createMDMClient() reads MDM_ENDPOINT and CREDENTIALS_PATH from the
environment, uses @mcesystems/auth to obtain a token, then returns a client.
Make sure AUTH_API_URL is set for the auth flow.
import { createMDMClient } from "@mcesystems/mdm-client";
async function main() {
const mdmClient = await createMDMClient();
if (!mdmClient) {
throw new Error("Missing MDM_ENDPOINT or CREDENTIALS_PATH");
}
const enrollmentProfile = await mdmClient.generateEnrollmentProfile("device-id");
if (enrollmentProfile.status === "OK") {
console.log(enrollmentProfile.profile);
}
}
main().catch((error) => {
console.error(error);
process.exit(1);
});Create client directly
import { MdmClient } from "@mcesystems/mdm-client";
const mdmClient = new MdmClient({
endpoint: "https://mdm.example.com/graphql",
authToken: "<access-token>",
timeout: 60000,
});API
MdmClient
generateEnrollmentProfile(deviceId: string)waitForDeviceToEnroll(deviceId: string, previousOpRef?: string)installApp(deviceId: string, options: { appId?: string; url?: string; waitForInstalled?: boolean })
Types
Exported types from src/types/mdm.ts:
GenerateEnrollmentProfileResponseWaitForDeviceToEnrollResponseInstallAppResponseMdmClientConfigInstallAppOptionsInstallAppMdmOptionsDeviceTypeMdmApiCallStatus
Environment variables
When using createMDMClient():
MDM_ENDPOINT: MDM GraphQL endpoint URLCREDENTIALS_PATH: path to credentials file used by@mcesystems/authAUTH_API_URL: auth API base URL for token retrieval
Logging
This package uses @mcesystems/tool-debug for logging. Configure logging in your
app as needed.
