addigy 2.8.2 → 2.10.0

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 (66) hide show
  1. package/README.md +5 -5
  2. package/index.d.ts +29 -80
  3. package/index.js +50 -1153
  4. package/lib/addigy.constants.d.ts +6 -0
  5. package/lib/addigy.constants.js +10 -0
  6. package/lib/addigy.d.ts +44 -0
  7. package/lib/addigy.js +63 -0
  8. package/lib/addigy.utils.d.ts +6 -0
  9. package/lib/addigy.utils.js +12 -0
  10. package/lib/alerts/alert.types.d.ts +5 -0
  11. package/lib/alerts/alert.types.js +9 -0
  12. package/lib/alerts/alerts.d.ts +7 -0
  13. package/lib/alerts/alerts.js +22 -0
  14. package/lib/applications/applications.d.ts +6 -0
  15. package/lib/applications/applications.js +18 -0
  16. package/lib/auth/auth.d.ts +9 -0
  17. package/lib/auth/auth.js +75 -0
  18. package/lib/auth/auth.types.d.ts +5 -0
  19. package/lib/billing/billing.d.ts +5 -0
  20. package/lib/billing/billing.js +36 -0
  21. package/lib/certs/certs.d.ts +5 -0
  22. package/lib/certs/certs.js +43 -0
  23. package/lib/commands/commands.d.ts +7 -0
  24. package/lib/commands/commands.js +31 -0
  25. package/lib/devices/devices.d.ts +11 -0
  26. package/lib/devices/devices.js +55 -0
  27. package/lib/facts/facts.d.ts +8 -0
  28. package/lib/facts/facts.js +66 -0
  29. package/lib/facts/facts.types.d.ts +22 -0
  30. package/lib/facts/facts.types.js +2 -0
  31. package/lib/files/files.d.ts +10 -0
  32. package/lib/files/files.js +63 -0
  33. package/lib/files/files.types.d.ts +26 -0
  34. package/lib/files/files.types.js +2 -0
  35. package/lib/integrations/integrations.d.ts +8 -0
  36. package/lib/integrations/integrations.js +63 -0
  37. package/lib/maintenance/maintenance.d.ts +6 -0
  38. package/lib/maintenance/maintenance.js +18 -0
  39. package/lib/mdm/mdm-configurations.d.ts +7 -0
  40. package/lib/mdm/mdm-configurations.js +41 -0
  41. package/lib/mdm/mdm-policies.d.ts +20 -0
  42. package/lib/mdm/mdm-policies.js +347 -0
  43. package/lib/mdm/mdm-profiles.d.ts +8 -0
  44. package/lib/mdm/mdm-profiles.js +74 -0
  45. package/{types.d.ts → lib/mdm/mdm.types.d.ts} +90 -180
  46. package/lib/mdm/mdm.types.js +2 -0
  47. package/lib/policies/policies.d.ts +11 -0
  48. package/lib/policies/policies.js +78 -0
  49. package/lib/profiles/profiles.d.ts +9 -0
  50. package/lib/profiles/profiles.js +59 -0
  51. package/lib/profiles/profiles.types.d.ts +20 -0
  52. package/lib/profiles/profiles.types.js +2 -0
  53. package/lib/screenconnect/screenconnect.d.ts +5 -0
  54. package/lib/screenconnect/screenconnect.js +39 -0
  55. package/lib/software/software.d.ts +13 -0
  56. package/lib/software/software.js +73 -0
  57. package/lib/software/software.types.d.ts +101 -0
  58. package/lib/software/software.types.js +2 -0
  59. package/lib/types.d.ts +20 -0
  60. package/lib/types.js +2 -0
  61. package/lib/users/user.types.d.ts +5 -0
  62. package/lib/users/user.types.js +9 -0
  63. package/lib/users/users.d.ts +9 -0
  64. package/lib/users/users.js +104 -0
  65. package/package.json +13 -14
  66. /package/{types.js → lib/auth/auth.types.js} +0 -0
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Files = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const addigy_constants_1 = require("../addigy.constants");
9
+ const addigy_utils_1 = require("../addigy.utils");
10
+ class Files {
11
+ constructor(config) {
12
+ this.config = config;
13
+ this.http = axios_1.default.create({
14
+ ...(0, addigy_utils_1.getAxiosHttpAgents)(),
15
+ });
16
+ }
17
+ async getFileUploadUrl(fileName, contentType) {
18
+ const headers = {
19
+ 'client-Id': this.config.clientId,
20
+ 'client-Secret': this.config.clientSecret,
21
+ 'file-name': fileName,
22
+ 'content-type': contentType !== null && contentType !== void 0 ? contentType : 'application/octet-stream',
23
+ };
24
+ try {
25
+ let res = await this.http.get(`${addigy_constants_1.Urls.fileManager}/api/upload/url`, {
26
+ headers,
27
+ });
28
+ return res.data;
29
+ }
30
+ catch (err) {
31
+ throw err;
32
+ }
33
+ }
34
+ async uploadFile(uploadUrl, file, contentType) {
35
+ const headers = {
36
+ 'content-type': contentType !== null && contentType !== void 0 ? contentType : 'application/octet-stream',
37
+ };
38
+ try {
39
+ let res = await this.http.put(uploadUrl, file, {
40
+ headers,
41
+ });
42
+ return res.data;
43
+ }
44
+ catch (err) {
45
+ throw err;
46
+ }
47
+ }
48
+ async getFileVaultKeys(authObject) {
49
+ try {
50
+ let res = await this.http.get(`${addigy_constants_1.Urls.api}/get_org_filevault_keys`, {
51
+ headers: {
52
+ Cookie: `auth_token=${authObject.authToken};`,
53
+ origin: addigy_constants_1.Urls.appProd,
54
+ },
55
+ });
56
+ return res.data;
57
+ }
58
+ catch (err) {
59
+ throw err;
60
+ }
61
+ }
62
+ }
63
+ exports.Files = Files;
@@ -0,0 +1,26 @@
1
+ import { Payload } from '../types';
2
+ export interface FilevaultPayload extends Payload {
3
+ enable?: 'On' | 'Off';
4
+ defer?: boolean;
5
+ use_recovery_key?: boolean;
6
+ show_recovery_key?: boolean | null;
7
+ defer_dont_ask_at_user_logout?: boolean | null;
8
+ defer_force_at_user_login_max_bypass_attempts?: number | null;
9
+ addigy_payload_version?: number;
10
+ destroy_fv_key_on_standby?: boolean | null;
11
+ dont_allow_fde_disable?: boolean;
12
+ is_from_security_profile?: boolean;
13
+ encrypt_cert_payload_uuid?: string;
14
+ location?: string;
15
+ payload_priority?: number;
16
+ redirect_url?: string;
17
+ }
18
+ export interface FilevaultRequest {
19
+ enable?: boolean;
20
+ defer?: boolean;
21
+ showRecoveryKey?: boolean;
22
+ destroyFvKeyOnStandby?: boolean;
23
+ escrowRecoveryKey?: boolean;
24
+ deferDontAskAtUserLogout?: boolean;
25
+ deferForceAtUserLoginMaxBypassAttempts?: -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
26
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { IAddigyInternalAuthObject } from '../auth/auth.types';
2
+ export declare class Integrations {
3
+ private readonly headers;
4
+ private readonly http;
5
+ getApiIntegrations(authObject: IAddigyInternalAuthObject): Promise<object[]>;
6
+ createApiIntegration(authObject: IAddigyInternalAuthObject, name: string): Promise<object>;
7
+ deleteApiIntegration(authObject: IAddigyInternalAuthObject, objectId: string): Promise<object>;
8
+ }
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Integrations = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const addigy_constants_1 = require("../addigy.constants");
9
+ const addigy_utils_1 = require("../addigy.utils");
10
+ class Integrations {
11
+ constructor() {
12
+ this.headers = { origin: addigy_constants_1.Urls.appProd };
13
+ this.http = axios_1.default.create({
14
+ ...(0, addigy_utils_1.getAxiosHttpAgents)(),
15
+ headers: this.headers,
16
+ });
17
+ }
18
+ async getApiIntegrations(authObject) {
19
+ try {
20
+ let res = await this.http.get(`${addigy_constants_1.Urls.api}/accounts/api/keys/get`, {
21
+ headers: {
22
+ Cookie: `auth_token=${authObject.authToken};`,
23
+ email: authObject.emailAddress,
24
+ orgid: authObject.orgId,
25
+ },
26
+ });
27
+ return res.data;
28
+ }
29
+ catch (err) {
30
+ throw err;
31
+ }
32
+ }
33
+ async createApiIntegration(authObject, name) {
34
+ let postBody = {
35
+ name,
36
+ };
37
+ try {
38
+ let res = await this.http.post(`${addigy_constants_1.Urls.appProd}/api/integrations/keys`, postBody, {
39
+ headers: {
40
+ Cookie: `auth_token=${authObject.authToken};`,
41
+ },
42
+ });
43
+ return res.data;
44
+ }
45
+ catch (err) {
46
+ throw err;
47
+ }
48
+ }
49
+ async deleteApiIntegration(authObject, objectId) {
50
+ try {
51
+ let res = await this.http.delete(`${addigy_constants_1.Urls.appProd}/api/integrations/keys?id=${objectId}`, {
52
+ headers: {
53
+ Cookie: `auth_token=${authObject.authToken};`,
54
+ },
55
+ });
56
+ return res.data;
57
+ }
58
+ catch (err) {
59
+ throw err;
60
+ }
61
+ }
62
+ }
63
+ exports.Integrations = Integrations;
@@ -0,0 +1,6 @@
1
+ import { AxiosInstance } from 'axios';
2
+ export declare class Maintenance {
3
+ private readonly http;
4
+ constructor(http: AxiosInstance);
5
+ getMaintenance(page?: number, pageLength?: number): Promise<object[]>;
6
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Maintenance = void 0;
4
+ class Maintenance {
5
+ constructor(http) {
6
+ this.http = http;
7
+ }
8
+ async getMaintenance(page = 1, pageLength = 10) {
9
+ try {
10
+ let res = await this.http.get(`maintenance?page=${page}&per_page=${pageLength}`);
11
+ return res.data;
12
+ }
13
+ catch (err) {
14
+ throw err;
15
+ }
16
+ }
17
+ }
18
+ exports.Maintenance = Maintenance;
@@ -0,0 +1,7 @@
1
+ import { IAddigyInternalAuthObject } from '../auth/auth.types';
2
+ import { MdmConfigurationPayload } from './mdm.types';
3
+ export declare class MdmConfigurations {
4
+ private readonly http;
5
+ getMdmConfigurations(authObject: IAddigyInternalAuthObject): Promise<MdmConfigurationPayload[]>;
6
+ getMdmConfigurationByName(authObject: IAddigyInternalAuthObject, name: string): Promise<MdmConfigurationPayload | undefined>;
7
+ }
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MdmConfigurations = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const addigy_constants_1 = require("../addigy.constants");
9
+ const addigy_utils_1 = require("../addigy.utils");
10
+ class MdmConfigurations {
11
+ constructor() {
12
+ this.http = axios_1.default.create({
13
+ baseURL: `${addigy_constants_1.Urls.app}/api/v2/mdm`,
14
+ ...(0, addigy_utils_1.getAxiosHttpAgents)(),
15
+ });
16
+ }
17
+ async getMdmConfigurations(authObject) {
18
+ var _a;
19
+ try {
20
+ let res = await this.http.get('configurations/profiles', {
21
+ headers: {
22
+ Cookie: `auth_token=${authObject.authToken};`,
23
+ },
24
+ });
25
+ return (_a = res.data) === null || _a === void 0 ? void 0 : _a.payloads;
26
+ }
27
+ catch (err) {
28
+ throw err;
29
+ }
30
+ }
31
+ async getMdmConfigurationByName(authObject, name) {
32
+ try {
33
+ const mdmConfigurations = await this.getMdmConfigurations(authObject);
34
+ return mdmConfigurations.find((e) => e.payload_display_name === name);
35
+ }
36
+ catch (err) {
37
+ throw err;
38
+ }
39
+ }
40
+ }
41
+ exports.MdmConfigurations = MdmConfigurations;
@@ -0,0 +1,20 @@
1
+ import { IAddigyInternalAuthObject } from '../auth/auth.types';
2
+ import { CreateWebContentFilterPayload, Extension, NotificationSettings, PPPCInput, ServiceManagementPayloadRule } from './mdm.types';
3
+ import { FilevaultRequest } from '../files/files.types';
4
+ export declare class MdmPolicies {
5
+ private readonly http;
6
+ createKernelExtensionPolicy(authObject: IAddigyInternalAuthObject, name: string, allowOverrides: boolean, kernelExtensions: {
7
+ allowedTeamIdentifiers?: string[];
8
+ allowedKernelExtensions?: Extension[];
9
+ }): Promise<any>;
10
+ createSystemExtensionPolicy(authObject: IAddigyInternalAuthObject, name: string, allowOverrides: boolean, systemExtensions: {
11
+ allowedSystemExtensions?: Extension[];
12
+ allowedSystemExtensionTypes?: Extension[];
13
+ allowedTeamIdentifiers?: string[];
14
+ }): Promise<any>;
15
+ createNotificationSettingsPolicy(authObject: IAddigyInternalAuthObject, name: string, notificationSettings: NotificationSettings[]): Promise<any>;
16
+ createServiceManagementPolicy(authObject: IAddigyInternalAuthObject, name: string, rules: ServiceManagementPayloadRule[], priority?: number): Promise<any>;
17
+ createWebContentFilterPolicy(authObject: IAddigyInternalAuthObject, payloadName: string, webContentPayload: CreateWebContentFilterPayload, priority?: number): Promise<any>;
18
+ createFilevaultPolicy(authObject: IAddigyInternalAuthObject, name: string, filevault: FilevaultRequest, payloadPriority?: number): Promise<any>;
19
+ createPPPCPolicy(authObject: IAddigyInternalAuthObject, name: string, pppcPolicy: PPPCInput[]): Promise<any>;
20
+ }
@@ -0,0 +1,347 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MdmPolicies = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ const addigy_constants_1 = require("../addigy.constants");
9
+ const uuid_1 = require("uuid");
10
+ const addigy_utils_1 = require("../addigy.utils");
11
+ class MdmPolicies {
12
+ constructor() {
13
+ this.http = axios_1.default.create({
14
+ baseURL: `${addigy_constants_1.Urls.appProd}/api/mdm/user/profiles/configurations`,
15
+ ...(0, addigy_utils_1.getAxiosHttpAgents)(),
16
+ headers: { origin: addigy_constants_1.Urls.appProd },
17
+ });
18
+ }
19
+ async createKernelExtensionPolicy(authObject, name, allowOverrides, kernelExtensions) {
20
+ var _a, _b;
21
+ let payloadUUID = (0, uuid_1.v4)();
22
+ let groupUUID = (0, uuid_1.v4)();
23
+ const payload = {
24
+ addigy_payload_type: 'com.addigy.syspolicy.kernel-extension-policy.com.apple.syspolicy.kernel-extension-policy',
25
+ payload_type: 'com.apple.syspolicy.kernel-extension-policy',
26
+ payload_version: 1,
27
+ payload_identifier: `com.addigy.syspolicy.kernel-extension-policy.com.apple.syspolicy.kernel-extension-policy.${groupUUID}`,
28
+ payload_uuid: payloadUUID,
29
+ payload_group_id: groupUUID,
30
+ payload_enabled: true,
31
+ payload_display_name: name,
32
+ allow_user_overrides: allowOverrides,
33
+ allowed_kernel_extensions: {},
34
+ allowed_team_identifiers: [],
35
+ };
36
+ if ((_a = kernelExtensions.allowedKernelExtensions) === null || _a === void 0 ? void 0 : _a.length) {
37
+ kernelExtensions.allowedKernelExtensions.forEach((e) => {
38
+ payload.allowed_kernel_extensions[e.teamIdentifier] = e.bundleIdentifiers;
39
+ });
40
+ }
41
+ if ((_b = kernelExtensions.allowedTeamIdentifiers) === null || _b === void 0 ? void 0 : _b.length) {
42
+ kernelExtensions.allowedTeamIdentifiers.forEach((e) => {
43
+ payload.allowed_team_identifiers.push(e);
44
+ });
45
+ }
46
+ try {
47
+ let res = await this.http.post('/', { payloads: [payload] }, {
48
+ headers: {
49
+ Cookie: `auth_token=${authObject.authToken};`,
50
+ },
51
+ });
52
+ return res.data;
53
+ }
54
+ catch (err) {
55
+ throw err;
56
+ }
57
+ }
58
+ async createSystemExtensionPolicy(authObject, name, allowOverrides, systemExtensions) {
59
+ var _a, _b, _c;
60
+ const groupUUID = (0, uuid_1.v4)();
61
+ const payload = {
62
+ addigy_payload_type: 'com.addigy.syspolicy.system-extension-policy.com.apple.system-extension-policy',
63
+ payload_type: 'com.apple.system-extension-policy',
64
+ payload_version: 1,
65
+ payload_identifier: `com.addigy.syspolicy.system-extension-policy.com.apple.system-extension-policy.${groupUUID}`,
66
+ payload_uuid: (0, uuid_1.v4)(),
67
+ payload_group_id: groupUUID,
68
+ payload_enabled: true,
69
+ payload_display_name: name,
70
+ allowed_system_extensions: {},
71
+ allowed_system_extensions_types: {},
72
+ allowed_team_identifiers: [],
73
+ allow_user_overrides: allowOverrides,
74
+ };
75
+ if ((_a = systemExtensions.allowedSystemExtensions) === null || _a === void 0 ? void 0 : _a.length) {
76
+ systemExtensions.allowedSystemExtensions.forEach((e) => {
77
+ payload.allowed_system_extensions[e.teamIdentifier] = e.bundleIdentifiers;
78
+ });
79
+ }
80
+ if ((_b = systemExtensions.allowedSystemExtensionTypes) === null || _b === void 0 ? void 0 : _b.length) {
81
+ systemExtensions.allowedSystemExtensionTypes.forEach((e) => {
82
+ payload.allowed_system_extensions_types[e.teamIdentifier] = e.bundleIdentifiers;
83
+ });
84
+ }
85
+ if ((_c = systemExtensions.allowedTeamIdentifiers) === null || _c === void 0 ? void 0 : _c.length) {
86
+ systemExtensions.allowedTeamIdentifiers.forEach((e) => {
87
+ payload.allowed_team_identifiers.push(e);
88
+ });
89
+ }
90
+ try {
91
+ let res = await this.http.post('/', { payloads: [payload] }, {
92
+ headers: {
93
+ Cookie: `auth_token=${authObject.authToken};`,
94
+ },
95
+ });
96
+ return res.data;
97
+ }
98
+ catch (err) {
99
+ throw err;
100
+ }
101
+ }
102
+ async createNotificationSettingsPolicy(authObject, name, notificationSettings) {
103
+ const groupUUID = (0, uuid_1.v4)();
104
+ const payload = {
105
+ addigy_payload_type: 'com.addigy.notifications.com.apple.notificationsettings',
106
+ payload_type: 'com.apple.notificationsettings',
107
+ payload_version: 1,
108
+ payload_identifier: `com.addigy.notifications.com.apple.notificationsettings.${groupUUID}`,
109
+ payload_uuid: (0, uuid_1.v4)(),
110
+ payload_group_id: groupUUID,
111
+ payload_display_name: name,
112
+ notification_settings: notificationSettings,
113
+ };
114
+ let res = await this.http.post('/', { payloads: [payload] }, {
115
+ headers: {
116
+ Cookie: `auth_token=${authObject.authToken};`,
117
+ },
118
+ });
119
+ return res.data;
120
+ }
121
+ async createServiceManagementPolicy(authObject, name, rules, priority = 9) {
122
+ const groupUUID = (0, uuid_1.v4)();
123
+ const payload = {
124
+ addigy_payload_type: 'com.addigy.servicemanagement.com.apple.servicemanagement',
125
+ addigy_payload_version: 0,
126
+ has_manifest: false,
127
+ payload_display_name: name,
128
+ payload_enabled: false,
129
+ payload_group_id: groupUUID,
130
+ payload_identifier: `com.addigy.servicemanagement.com.apple.servicemanagement.${groupUUID}`,
131
+ payload_priority: priority,
132
+ payload_type: 'com.apple.servicemanagement',
133
+ payload_uuid: (0, uuid_1.v4)(),
134
+ payload_version: 1,
135
+ policy_restricted: false,
136
+ requires_device_supervision: false,
137
+ requires_mdm_profile_approved: false,
138
+ supported_os_versions: null,
139
+ rules,
140
+ };
141
+ try {
142
+ let res = await this.http.post('/', { payloads: [payload] }, {
143
+ headers: {
144
+ Cookie: `auth_token=${authObject.authToken};`,
145
+ },
146
+ });
147
+ return res.data;
148
+ }
149
+ catch (err) {
150
+ throw err;
151
+ }
152
+ }
153
+ async createWebContentFilterPolicy(authObject, payloadName, webContentPayload, priority = 9) {
154
+ const groupUUID = (0, uuid_1.v4)();
155
+ const payload = {
156
+ addigy_payload_type: 'com.addigy.webcontent-filter.com.apple.webcontent-filter',
157
+ addigy_payload_version: 2,
158
+ auto_filter_enabled: null,
159
+ blacklisted_urls: null,
160
+ content_filter_uuid: null,
161
+ filter_browsers: null,
162
+ filter_data_provider_bundle_identifier: null,
163
+ filter_data_provider_designated_requirement: null,
164
+ filter_packet_provider_bundle_identifier: null,
165
+ filter_packet_provider_designated_requirement: null,
166
+ filter_packets: null,
167
+ filter_sockets: true,
168
+ filter_type: 'Plugin',
169
+ has_manifest: false,
170
+ organization: null,
171
+ password: null,
172
+ payload_display_name: payloadName,
173
+ payload_enabled: true,
174
+ payload_group_id: groupUUID,
175
+ payload_identifier: `com.addigy.webcontent-filter.com.apple.webcontent-filter.${groupUUID}`,
176
+ payload_priority: priority,
177
+ payload_type: 'com.apple.webcontent-filter',
178
+ payload_uuid: (0, uuid_1.v4)(),
179
+ payload_version: 1,
180
+ permitted_urls: null,
181
+ policy_restricted: false,
182
+ requires_device_supervision: false,
183
+ requires_mdm_profile_approved: false,
184
+ server_address: null,
185
+ supported_os_versions: null,
186
+ user_name: null,
187
+ vendor_config: null,
188
+ white_listed_bookmarks: null,
189
+ ...webContentPayload,
190
+ };
191
+ let res = await this.http.post('/', { payloads: [payload] }, {
192
+ headers: {
193
+ Cookie: `auth_token=${authObject.authToken};`,
194
+ },
195
+ });
196
+ return res.data;
197
+ }
198
+ async createFilevaultPolicy(authObject, name, filevault, payloadPriority = 1) {
199
+ const groupUUID = (0, uuid_1.v4)();
200
+ const encryptCertPayloadUUID = (0, uuid_1.v4)();
201
+ const basePayload = {
202
+ payload_display_name: name,
203
+ payload_version: 1,
204
+ payload_group_id: groupUUID,
205
+ addigy_payload_version: 0,
206
+ payload_priority: payloadPriority,
207
+ };
208
+ const payloads = [
209
+ {
210
+ ...basePayload,
211
+ payload_type: 'com.apple.MCX.FileVault2',
212
+ addigy_payload_type: 'com.addigy.securityAndPrivacy.com.apple.MCX.FileVault2',
213
+ payload_identifier: `com.addigy.securityAndPrivacy.com.apple.MCX.FileVault2.${groupUUID}`,
214
+ payload_uuid: (0, uuid_1.v4)(),
215
+ enable: filevault.enable ? 'On' : 'Off',
216
+ defer: filevault.defer,
217
+ use_recovery_key: true,
218
+ show_recovery_key: filevault.showRecoveryKey === undefined ? null : filevault.showRecoveryKey,
219
+ defer_dont_ask_at_user_logout: filevault.deferDontAskAtUserLogout === undefined
220
+ ? null
221
+ : filevault.deferDontAskAtUserLogout,
222
+ defer_force_at_user_login_max_bypass_attempts: filevault.deferForceAtUserLoginMaxBypassAttempts === undefined
223
+ ? null
224
+ : filevault.deferForceAtUserLoginMaxBypassAttempts,
225
+ },
226
+ {
227
+ ...basePayload,
228
+ payload_type: 'com.apple.MCX',
229
+ addigy_payload_type: 'com.addigy.securityAndPrivacy.com.apple.MCX',
230
+ payload_identifier: `com.addigy.securityAndPrivacy.com.apple.MCX.${groupUUID} `,
231
+ payload_uuid: (0, uuid_1.v4)(),
232
+ destroy_fv_key_on_standby: filevault.destroyFvKeyOnStandby === undefined
233
+ ? null
234
+ : filevault.destroyFvKeyOnStandby,
235
+ dont_allow_fde_disable: true,
236
+ },
237
+ ];
238
+ if (filevault.escrowRecoveryKey)
239
+ payloads.push({
240
+ ...basePayload,
241
+ addigy_payload_type: 'com.addigy.securityAndPrivacy.com.apple.security.pkcs1',
242
+ payload_type: 'com.apple.security.pkcs1',
243
+ payload_identifier: `com.addigy.securityAndPrivacy.com.apple.security.pkcs1.${groupUUID}`,
244
+ payload_uuid: (0, uuid_1.v4)(),
245
+ is_from_security_profile: true,
246
+ }, {
247
+ ...basePayload,
248
+ addigy_payload_type: 'com.addigy.securityAndPrivacy.com.apple.security.FDERecoveryKeyEscrow',
249
+ payload_type: 'com.apple.security.FDERecoveryKeyEscrow',
250
+ payload_identifier: `com.addigy.securityAndPrivacy.com.apple.security.FDERecoveryKeyEscrow.${groupUUID}`,
251
+ payload_uuid: (0, uuid_1.v4)(),
252
+ encrypt_cert_payload_uuid: encryptCertPayloadUUID,
253
+ location: 'Key will be escrowed to an Addigy secure database.',
254
+ }, {
255
+ ...basePayload,
256
+ addigy_payload_type: 'com.addigy.securityAndPrivacy.com.apple.security.FDERecoveryRedirect',
257
+ payload_type: 'com.apple.security.FDERecoveryRedirect',
258
+ payload_identifier: `com.addigy.securityAndPrivacy.com.apple.security.FDERecoveryRedirect.${groupUUID}`,
259
+ payload_uuid: (0, uuid_1.v4)(),
260
+ encrypt_cert_payload_uuid: encryptCertPayloadUUID,
261
+ redirect_url: '',
262
+ });
263
+ try {
264
+ let res = await this.http.post('/', { payloads }, {
265
+ headers: {
266
+ Cookie: `auth_token=${authObject.authToken};`,
267
+ },
268
+ });
269
+ return res.data;
270
+ }
271
+ catch (err) {
272
+ throw err;
273
+ }
274
+ }
275
+ async createPPPCPolicy(authObject, name, pppcPolicy) {
276
+ const groupUUID = (0, uuid_1.v4)();
277
+ const payload = {
278
+ addigy_payload_type: 'com.addigy.TCC.configuration-profile-policy.com.apple.TCC.configuration-profile-policy',
279
+ payload_type: 'com.apple.TCC.configuration-profile-policy',
280
+ payload_display_name: name,
281
+ payload_group_id: groupUUID,
282
+ payload_version: 1,
283
+ payload_identifier: `com.addigy.TCC.configuration-profile-policy.com.apple.TCC.configuration-profile-policy.${groupUUID}`,
284
+ payload_uuid: (0, uuid_1.v4)(),
285
+ services: {
286
+ accessibility: [],
287
+ address_book: [],
288
+ apple_events: [],
289
+ calendar: [],
290
+ camera: [],
291
+ microphone: [],
292
+ photos: [],
293
+ post_event: [],
294
+ reminders: [],
295
+ system_policy_all_files: [],
296
+ system_policy_sys_admin_files: [],
297
+ file_provider_presence: [],
298
+ listen_event: [],
299
+ media_library: [],
300
+ screen_capture: [],
301
+ speech_recognition: [],
302
+ system_policy_desktop_folder: [],
303
+ system_policy_documents_folder: [],
304
+ system_policy_downloads_folder: [],
305
+ system_policy_network_volumes: [],
306
+ system_policy_removable_volumes: [],
307
+ },
308
+ };
309
+ pppcPolicy.forEach((pppc) => {
310
+ pppc.services.forEach((e) => {
311
+ var _a;
312
+ const service = {
313
+ allowed: false,
314
+ authorization: '',
315
+ code_requirement: pppc.codeRequirement,
316
+ comment: '',
317
+ identifier_type: e.identifierType,
318
+ identifier: pppc.identifier,
319
+ static_code: (_a = e.staticCode) !== null && _a !== void 0 ? _a : false,
320
+ predefined_app: null,
321
+ manual_selection: true,
322
+ rowId: (0, uuid_1.v4)(),
323
+ };
324
+ if (e.service === 'screen_capture' && e.authorization) {
325
+ service.authorization = e.authorization;
326
+ }
327
+ if (e.service !== 'screen_capture')
328
+ service.allowed = e.allowed;
329
+ if (e.service === 'apple_events') {
330
+ service.ae_receiver_identifier = e.aeReceiverIdentifier;
331
+ service.ae_receiver_identifier_type = e.aeReceiverIdentifierType;
332
+ service.ae_receiver_code_requirement = e.aeReceiverCodeRequirement;
333
+ service.ae_receiver_predefined_app = null;
334
+ service.ae_receiver_manual_selection = true;
335
+ }
336
+ payload.services[e.service].push(service);
337
+ });
338
+ });
339
+ const res = await this.http.post('/', { payloads: [payload] }, {
340
+ headers: {
341
+ Cookie: `auth_token=${authObject.authToken};`,
342
+ },
343
+ });
344
+ return res.data;
345
+ }
346
+ }
347
+ exports.MdmPolicies = MdmPolicies;
@@ -0,0 +1,8 @@
1
+ import { IAddigyInternalAuthObject } from '../auth/auth.types';
2
+ import { SupportedOsVersions } from '../types';
3
+ export declare class MdmProfiles {
4
+ private readonly http;
5
+ createCustomProfile(authObject: IAddigyInternalAuthObject, name: string, customProfileText: string, supportedOsVersions: SupportedOsVersions, payloadScope?: 'System' | 'User', is_profile_signed?: boolean): Promise<any>;
6
+ createMdmProfile(authObject: IAddigyInternalAuthObject, mdmProfile: any): Promise<any>;
7
+ private toSnakeCase;
8
+ }