addigy 2.8.1 → 2.9.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 (4) hide show
  1. package/index.d.ts +2 -1
  2. package/index.js +39 -24
  3. package/package.json +19 -19
  4. package/types.d.ts +101 -0
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CreateWebContentFilterPayload, CustomFact, Extension, FilevaultRequest, IAddigyConfig, IAddigyInternalAuthObject, MdmConfigurationPayload, NotificationSettings, PPPCInput, ServiceManagementPayloadRule, SupportedOsVersions } from './types';
1
+ import { CreateSoftware, CreateWebContentFilterPayload, CustomFact, Extension, FilevaultRequest, IAddigyConfig, IAddigyInternalAuthObject, MdmConfigurationPayload, NotificationSettings, PPPCInput, ServiceManagementPayloadRule, Software, SupportedOsVersions } from './types';
2
2
  export * from './types';
3
3
  declare enum AlertStatus {
4
4
  Acknowledged = "Acknowledged",
@@ -41,6 +41,7 @@ export declare class Addigy {
41
41
  getFileUploadUrl(fileName: string, contentType?: string): Promise<string>;
42
42
  uploadFile(uploadUrl: string, file: object, contentType?: string): Promise<object[]>;
43
43
  createCustomSoftware(baseIdentifier: string, version: string, downloads: string[], installationScript: string, condition: string, removeScript: string, priority?: number): Promise<object[]>;
44
+ createSoftwareInternal(authObject: IAddigyInternalAuthObject, software: CreateSoftware): Promise<Software>;
44
45
  getUsers(authObject: IAddigyInternalAuthObject): Promise<object[]>;
45
46
  createUser(authObject: IAddigyInternalAuthObject, email: string, name: string, policies: string[] | undefined, role: UserRoles | string, phone?: string): Promise<object[]>;
46
47
  updateUser(authObject: IAddigyInternalAuthObject, email: string, name: string, policies: string[] | undefined, role: string, phone?: string): Promise<object[]>;
package/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -394,6 +398,17 @@ class Addigy {
394
398
  throw err;
395
399
  }
396
400
  }
401
+ async createSoftwareInternal(authObject, software) {
402
+ const res = await this._addigyRequest('https://app.addigy.com/api/software', {
403
+ headers: {
404
+ Cookie: `auth_token=${authObject.authToken};`,
405
+ origin: 'https://app-prod.addigy.com',
406
+ },
407
+ method: 'POST',
408
+ json: software,
409
+ });
410
+ return JSON.parse(res.body);
411
+ }
397
412
  async getUsers(authObject) {
398
413
  try {
399
414
  let res = await this._addigyRequest('https://app-prod.addigy.com/api/account', {
@@ -581,8 +596,8 @@ class Addigy {
581
596
  }
582
597
  async createKernelExtensionPolicy(authObject, name, allowOverrides, kernalExtensions) {
583
598
  var _a, _b;
584
- let payloadUUID = uuid_1.v4();
585
- let groupUUID = uuid_1.v4();
599
+ let payloadUUID = (0, uuid_1.v4)();
600
+ let groupUUID = (0, uuid_1.v4)();
586
601
  const payload = {
587
602
  addigy_payload_type: 'com.addigy.syspolicy.kernel-extension-policy.com.apple.syspolicy.kernel-extension-policy',
588
603
  payload_type: 'com.apple.syspolicy.kernel-extension-policy',
@@ -623,13 +638,13 @@ class Addigy {
623
638
  }
624
639
  async createSystemExtensionPolicy(authObject, name, allowOverrides, systemExtensions) {
625
640
  var _a, _b, _c;
626
- const groupUUID = uuid_1.v4();
641
+ const groupUUID = (0, uuid_1.v4)();
627
642
  const payload = {
628
643
  addigy_payload_type: 'com.addigy.syspolicy.system-extension-policy.com.apple.system-extension-policy',
629
644
  payload_type: 'com.apple.system-extension-policy',
630
645
  payload_version: 1,
631
646
  payload_identifier: `com.addigy.syspolicy.system-extension-policy.com.apple.system-extension-policy.${groupUUID}`,
632
- payload_uuid: uuid_1.v4(),
647
+ payload_uuid: (0, uuid_1.v4)(),
633
648
  payload_group_id: groupUUID,
634
649
  payload_enabled: true,
635
650
  payload_display_name: name,
@@ -669,13 +684,13 @@ class Addigy {
669
684
  }
670
685
  }
671
686
  async createNotificationSettingsPolicy(authObject, name, notificationSettings) {
672
- const groupUUID = uuid_1.v4();
687
+ const groupUUID = (0, uuid_1.v4)();
673
688
  const payload = {
674
689
  addigy_payload_type: 'com.addigy.notifications.com.apple.notificationsettings',
675
690
  payload_type: 'com.apple.notificationsettings',
676
691
  payload_version: 1,
677
692
  payload_identifier: `com.addigy.notifications.com.apple.notificationsettings.${groupUUID}`,
678
- payload_uuid: uuid_1.v4(),
693
+ payload_uuid: (0, uuid_1.v4)(),
679
694
  payload_group_id: groupUUID,
680
695
  payload_display_name: name,
681
696
  notification_settings: notificationSettings,
@@ -691,7 +706,7 @@ class Addigy {
691
706
  return JSON.parse(res.body);
692
707
  }
693
708
  async createCustomProfile(authObject, name, customProfileText, supportedOsVersions, payloadScope = 'System', is_profile_signed = false) {
694
- const groupUUID = uuid_1.v4();
709
+ const groupUUID = (0, uuid_1.v4)();
695
710
  const customProfileJson = plist_1.default.parse(customProfileText);
696
711
  const updateCustomProfileJson = Object.entries(customProfileJson).reduce((acc, [key, value]) => {
697
712
  acc[this.toSnakeCase(key)] = value;
@@ -703,7 +718,7 @@ class Addigy {
703
718
  payload_type: 'custom',
704
719
  payload_version: 1,
705
720
  payload_identifier: `com.addigy.custom.mdm.payload.${groupUUID}`,
706
- payload_uuid: `custom-profile-${uuid_1.v4()}`,
721
+ payload_uuid: `custom-profile-${(0, uuid_1.v4)()}`,
707
722
  payload_group_id: groupUUID,
708
723
  payload_display_name: name,
709
724
  is_profile_signed,
@@ -745,7 +760,7 @@ class Addigy {
745
760
  }
746
761
  }
747
762
  async createServiceManagementPolicy(authObject, name, rules, priority = 9) {
748
- const groupUUID = uuid_1.v4();
763
+ const groupUUID = (0, uuid_1.v4)();
749
764
  const payload = {
750
765
  addigy_payload_type: 'com.addigy.servicemanagement.com.apple.servicemanagement',
751
766
  addigy_payload_version: 0,
@@ -756,7 +771,7 @@ class Addigy {
756
771
  payload_identifier: `com.addigy.servicemanagement.com.apple.servicemanagement.${groupUUID}`,
757
772
  payload_priority: priority,
758
773
  payload_type: 'com.apple.servicemanagement',
759
- payload_uuid: uuid_1.v4(),
774
+ payload_uuid: (0, uuid_1.v4)(),
760
775
  payload_version: 1,
761
776
  policy_restricted: false,
762
777
  requires_device_supervision: false,
@@ -780,7 +795,7 @@ class Addigy {
780
795
  }
781
796
  }
782
797
  async createWebContentFilterPolicy(authObject, payloadName, webContentPayload, priority = 9) {
783
- const groupUUID = uuid_1.v4();
798
+ const groupUUID = (0, uuid_1.v4)();
784
799
  const payload = {
785
800
  addigy_payload_type: 'com.addigy.webcontent-filter.com.apple.webcontent-filter',
786
801
  addigy_payload_version: 2,
@@ -804,7 +819,7 @@ class Addigy {
804
819
  payload_identifier: `com.addigy.webcontent-filter.com.apple.webcontent-filter.${groupUUID}`,
805
820
  payload_priority: priority,
806
821
  payload_type: 'com.apple.webcontent-filter',
807
- payload_uuid: uuid_1.v4(),
822
+ payload_uuid: (0, uuid_1.v4)(),
808
823
  payload_version: 1,
809
824
  permitted_urls: null,
810
825
  policy_restricted: false,
@@ -828,8 +843,8 @@ class Addigy {
828
843
  return JSON.parse(res.body);
829
844
  }
830
845
  async createFilevaultPolicy(authObject, name, filevault, payloadPriority = 1) {
831
- const groupUUID = uuid_1.v4();
832
- const encryptCertPayloadUUID = uuid_1.v4();
846
+ const groupUUID = (0, uuid_1.v4)();
847
+ const encryptCertPayloadUUID = (0, uuid_1.v4)();
833
848
  const basePayload = {
834
849
  payload_display_name: name,
835
850
  payload_version: 1,
@@ -843,7 +858,7 @@ class Addigy {
843
858
  payload_type: 'com.apple.MCX.FileVault2',
844
859
  addigy_payload_type: 'com.addigy.securityAndPrivacy.com.apple.MCX.FileVault2',
845
860
  payload_identifier: `com.addigy.securityAndPrivacy.com.apple.MCX.FileVault2.${groupUUID}`,
846
- payload_uuid: uuid_1.v4(),
861
+ payload_uuid: (0, uuid_1.v4)(),
847
862
  enable: filevault.enable ? 'On' : 'Off',
848
863
  defer: filevault.defer,
849
864
  use_recovery_key: true,
@@ -860,7 +875,7 @@ class Addigy {
860
875
  payload_type: 'com.apple.MCX',
861
876
  addigy_payload_type: 'com.addigy.securityAndPrivacy.com.apple.MCX',
862
877
  payload_identifier: `com.addigy.securityAndPrivacy.com.apple.MCX.${groupUUID} `,
863
- payload_uuid: uuid_1.v4(),
878
+ payload_uuid: (0, uuid_1.v4)(),
864
879
  destroy_fv_key_on_standby: filevault.destroyFvKeyOnStandby === undefined
865
880
  ? null
866
881
  : filevault.destroyFvKeyOnStandby,
@@ -873,14 +888,14 @@ class Addigy {
873
888
  addigy_payload_type: 'com.addigy.securityAndPrivacy.com.apple.security.pkcs1',
874
889
  payload_type: 'com.apple.security.pkcs1',
875
890
  payload_identifier: `com.addigy.securityAndPrivacy.com.apple.security.pkcs1.${groupUUID}`,
876
- payload_uuid: uuid_1.v4(),
891
+ payload_uuid: (0, uuid_1.v4)(),
877
892
  is_from_security_profile: true,
878
893
  }, {
879
894
  ...basePayload,
880
895
  addigy_payload_type: 'com.addigy.securityAndPrivacy.com.apple.security.FDERecoveryKeyEscrow',
881
896
  payload_type: 'com.apple.security.FDERecoveryKeyEscrow',
882
897
  payload_identifier: `com.addigy.securityAndPrivacy.com.apple.security.FDERecoveryKeyEscrow.${groupUUID}`,
883
- payload_uuid: uuid_1.v4(),
898
+ payload_uuid: (0, uuid_1.v4)(),
884
899
  encrypt_cert_payload_uuid: encryptCertPayloadUUID,
885
900
  location: 'Key will be escrowed to an Addigy secure database.',
886
901
  }, {
@@ -888,7 +903,7 @@ class Addigy {
888
903
  addigy_payload_type: 'com.addigy.securityAndPrivacy.com.apple.security.FDERecoveryRedirect',
889
904
  payload_type: 'com.apple.security.FDERecoveryRedirect',
890
905
  payload_identifier: `com.addigy.securityAndPrivacy.com.apple.security.FDERecoveryRedirect.${groupUUID}`,
891
- payload_uuid: uuid_1.v4(),
906
+ payload_uuid: (0, uuid_1.v4)(),
892
907
  encrypt_cert_payload_uuid: encryptCertPayloadUUID,
893
908
  redirect_url: '',
894
909
  });
@@ -908,7 +923,7 @@ class Addigy {
908
923
  }
909
924
  }
910
925
  async createPPPCPolicy(authObject, name, pppcPolicy) {
911
- const groupUUID = uuid_1.v4();
926
+ const groupUUID = (0, uuid_1.v4)();
912
927
  const payload = {
913
928
  addigy_payload_type: 'com.addigy.TCC.configuration-profile-policy.com.apple.TCC.configuration-profile-policy',
914
929
  payload_type: 'com.apple.TCC.configuration-profile-policy',
@@ -916,7 +931,7 @@ class Addigy {
916
931
  payload_group_id: groupUUID,
917
932
  payload_version: 1,
918
933
  payload_identifier: `com.addigy.TCC.configuration-profile-policy.com.apple.TCC.configuration-profile-policy.${groupUUID}`,
919
- payload_uuid: uuid_1.v4(),
934
+ payload_uuid: (0, uuid_1.v4)(),
920
935
  services: {
921
936
  accessibility: [],
922
937
  address_book: [],
@@ -954,7 +969,7 @@ class Addigy {
954
969
  static_code: (_a = e.staticCode) !== null && _a !== void 0 ? _a : false,
955
970
  predefined_app: null,
956
971
  manual_selection: true,
957
- rowId: uuid_1.v4(),
972
+ rowId: (0, uuid_1.v4)(),
958
973
  };
959
974
  if (e.service === 'screen_capture' && e.authorization) {
960
975
  service.authorization = e.authorization;
@@ -1154,7 +1169,7 @@ class Addigy {
1154
1169
  }
1155
1170
  async _addigyRequest(url, options) {
1156
1171
  try {
1157
- let res = await got_1.default(url, options);
1172
+ let res = await (0, got_1.default)(url, options);
1158
1173
  return res;
1159
1174
  }
1160
1175
  catch (err) {
package/package.json CHANGED
@@ -6,32 +6,32 @@
6
6
  }
7
7
  },
8
8
  "dependencies": {
9
- "@expo/plist": "0.0.18",
9
+ "@expo/plist": "0.0.20",
10
10
  "form-data": "4.0.0",
11
- "got": "11.8.5",
11
+ "got": "11.8.6",
12
12
  "uuid": "8.3.2"
13
13
  },
14
14
  "description": "",
15
15
  "devDependencies": {
16
- "@pliancy/eslint-config-ts": "0.0.5",
17
- "@pliancy/semantic-release-config-npm": "2.1.0",
16
+ "@pliancy/eslint-config-ts": "1.0.0",
17
+ "@pliancy/semantic-release-config-npm": "2.2.0",
18
18
  "@types/got": "9.6.12",
19
- "@types/jest": "26.0.23",
20
- "@types/node": "15.12.5",
21
- "@types/uuid": "8.3.0",
22
- "commitizen": "4.2.4",
23
- "cpy-cli": "3.1.1",
19
+ "@types/jest": "29.5.5",
20
+ "@types/node": "15.14.9",
21
+ "@types/uuid": "8.3.4",
22
+ "commitizen": "4.3.0",
23
+ "cpy-cli": "5.0.0",
24
24
  "cz-conventional-changelog": "3.3.0",
25
25
  "gh-pages": "3.2.3",
26
- "husky": "7.0.1",
27
- "jest": "27.0.6",
26
+ "husky": "8.0.3",
27
+ "jest": "29.7.0",
28
28
  "npm-run-all": "4.1.5",
29
- "open": "8.2.1",
30
- "pinst": "2.1.6",
29
+ "open": "9.1.0",
30
+ "pinst": "^3.0.0",
31
31
  "rimraf": "3.0.2",
32
- "ts-jest": "27.0.3",
33
- "typedoc": "0.21.2",
34
- "typescript": "4.3.4"
32
+ "ts-jest": "29.1.1",
33
+ "typedoc": "0.25.1",
34
+ "typescript": "4.9.5"
35
35
  },
36
36
  "keywords": [
37
37
  "addigy",
@@ -59,9 +59,9 @@
59
59
  "tsc": "tsc -p tsconfig.build.json"
60
60
  },
61
61
  "types": "index.d.ts",
62
- "version": "2.8.1",
62
+ "version": "2.9.0",
63
63
  "volta": {
64
- "node": "14.17.1",
65
- "yarn": "1.22.10"
64
+ "node": "20.8.0",
65
+ "yarn": "1.22.19"
66
66
  }
67
67
  }
package/types.d.ts CHANGED
@@ -290,3 +290,104 @@ export interface CreateWebContentFilterPayload {
290
290
  requires_device_supervision?: boolean;
291
291
  requires_mdm_profile_approved?: boolean;
292
292
  }
293
+ export interface Software {
294
+ name: string;
295
+ provider: string;
296
+ identifier: string;
297
+ version: string;
298
+ instruction_id: string;
299
+ base_identifier: string;
300
+ public_software_instruction_id: string;
301
+ fact_identifier: string;
302
+ run_on_success: boolean;
303
+ predefined_conditions: PredefinedConditions;
304
+ condition: string;
305
+ remove_script: string;
306
+ policy_restricted: boolean;
307
+ status_on_skipped: string;
308
+ user_email: string;
309
+ label: string;
310
+ public: boolean;
311
+ organization_id: string;
312
+ downloads: any[];
313
+ profiles: any[];
314
+ installation_script: string;
315
+ price_per_device: number;
316
+ priority: number;
317
+ tcc_version: number;
318
+ type: string;
319
+ category: string;
320
+ software_icon: SoftwareIcon;
321
+ description: string;
322
+ archived: boolean;
323
+ }
324
+ export interface CreateSoftware {
325
+ base_identifier: string;
326
+ version: string;
327
+ downloads: SoftwareDownload[];
328
+ profiles: any[];
329
+ installation_script: string;
330
+ remove_script: string;
331
+ condition: string;
332
+ predefined_conditions: PredefinedConditions;
333
+ public: boolean | null;
334
+ software_icon: SoftwareIcon;
335
+ run_on_success: boolean;
336
+ status_on_skipped: string;
337
+ priority: number;
338
+ category: string;
339
+ }
340
+ export interface PredefinedConditions {
341
+ os_version: OSVersion;
342
+ app_exists: AppExists;
343
+ file_exists: FileExists;
344
+ file_not_exists: FileExists;
345
+ profile_exists: ProfileExists;
346
+ process_not_running: ProcessNotRunning;
347
+ required_architecture: RequiredArchitecture;
348
+ }
349
+ export interface AppExists {
350
+ enabled: boolean;
351
+ operator: string;
352
+ version: string;
353
+ path: string;
354
+ install_if_not_present: boolean;
355
+ }
356
+ export interface FileExists {
357
+ enabled: boolean;
358
+ path: string;
359
+ }
360
+ export interface OSVersion {
361
+ enabled: boolean;
362
+ operator: string;
363
+ version: string;
364
+ }
365
+ export interface ProcessNotRunning {
366
+ enabled: boolean;
367
+ process_name: string;
368
+ }
369
+ export interface ProfileExists {
370
+ enabled: boolean;
371
+ profile_id: string;
372
+ }
373
+ export interface RequiredArchitecture {
374
+ enabled: boolean;
375
+ apple_silicon: boolean;
376
+ }
377
+ export interface SoftwareIcon {
378
+ orgid: string;
379
+ filename: string;
380
+ id: string;
381
+ provider: string;
382
+ }
383
+ export interface SoftwareDownload {
384
+ orgid: string;
385
+ created: Date;
386
+ content_type: string;
387
+ filename: string;
388
+ id: string;
389
+ md5_hash: string;
390
+ provider: string;
391
+ user_email: string;
392
+ size: number;
393
+ }