@mcesystems/mdm-client-g4 1.0.64

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.
package/README.md ADDED
@@ -0,0 +1,83 @@
1
+ # @mcesystems/mdm-client
2
+
3
+ MDM client for device management.
4
+
5
+ ## Install
6
+
7
+ This package is published as part of the monorepo. Use it through your workspace
8
+ package manager.
9
+
10
+ ## Usage
11
+
12
+ ### Create client from environment
13
+
14
+ `createMDMClient()` reads `MDM_ENDPOINT` and `CREDENTIALS_PATH` from the
15
+ environment, uses `@mcesystems/auth` to obtain a token, then returns a client.
16
+ Make sure `AUTH_API_URL` is set for the auth flow.
17
+
18
+ ```ts
19
+ import { createMDMClient } from "@mcesystems/mdm-client";
20
+
21
+ async function main() {
22
+ const mdmClient = await createMDMClient();
23
+ if (!mdmClient) {
24
+ throw new Error("Missing MDM_ENDPOINT or CREDENTIALS_PATH");
25
+ }
26
+
27
+ const enrollmentProfile = await mdmClient.generateEnrollmentProfile("device-id");
28
+ if (enrollmentProfile.status === "OK") {
29
+ console.log(enrollmentProfile.profile);
30
+ }
31
+ }
32
+
33
+ main().catch((error) => {
34
+ console.error(error);
35
+ process.exit(1);
36
+ });
37
+ ```
38
+
39
+ ### Create client directly
40
+
41
+ ```ts
42
+ import { MdmClient } from "@mcesystems/mdm-client";
43
+
44
+ const mdmClient = new MdmClient({
45
+ endpoint: "https://mdm.example.com/graphql",
46
+ authToken: "<access-token>",
47
+ timeout: 60000,
48
+ });
49
+ ```
50
+
51
+ ## API
52
+
53
+ ### `MdmClient`
54
+
55
+ - `generateEnrollmentProfile(deviceId: string)`
56
+ - `waitForDeviceToEnroll(deviceId: string, previousOpRef?: string)`
57
+ - `installApp(deviceId: string, options: { appId?: string; url?: string; waitForInstalled?: boolean })`
58
+
59
+ ### Types
60
+
61
+ Exported types from `src/types/mdm.ts`:
62
+
63
+ - `GenerateEnrollmentProfileResponse`
64
+ - `WaitForDeviceToEnrollResponse`
65
+ - `InstallAppResponse`
66
+ - `MdmClientConfig`
67
+ - `InstallAppOptions`
68
+ - `InstallAppMdmOptions`
69
+ - `DeviceType`
70
+ - `MdmApiCallStatus`
71
+
72
+ ## Environment variables
73
+
74
+ When using `createMDMClient()`:
75
+
76
+ - `MDM_ENDPOINT`: MDM GraphQL endpoint URL
77
+ - `CREDENTIALS_PATH`: path to credentials file used by `@mcesystems/auth`
78
+ - `AUTH_API_URL`: auth API base URL for token retrieval
79
+
80
+ ## Logging
81
+
82
+ This package uses `@mcesystems/tool-debug` for logging. Configure logging in your
83
+ app as needed.