addigy 2.4.0 → 2.5.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.
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Extension, FilevaultRequest, IAddigyConfig, IAddigyInternalAuthObject, NotificationSettings, PPPCInput, SupportedOsVersions } from './types';
1
+ import { CustomFact, Extension, FilevaultRequest, IAddigyConfig, IAddigyInternalAuthObject, NotificationSettings, PPPCInput, SupportedOsVersions } from './types';
2
2
  export * from './types';
3
3
  declare enum AlertStatus {
4
4
  Acknowledged = "Acknowledged",
@@ -64,6 +64,9 @@ export declare class Addigy {
64
64
  createMdmProfile(authObject: IAddigyInternalAuthObject, mdmProfile: any): Promise<any>;
65
65
  createFilevaultPolicy(authObject: IAddigyInternalAuthObject, name: string, filevault: FilevaultRequest, payloadPriority?: number): Promise<any>;
66
66
  createPPPCPolicy(authObject: IAddigyInternalAuthObject, name: string, pppcPolicy: PPPCInput[]): Promise<any>;
67
+ createCustomFact(authObject: IAddigyInternalAuthObject, name: string, script: string, scriptType: 'bash' | 'python' | 'zsh'): Promise<CustomFact>;
68
+ getCustomFacts(authObject: IAddigyInternalAuthObject): Promise<CustomFact[]>;
69
+ getCustomFactByName(authObject: IAddigyInternalAuthObject, name: string): Promise<CustomFact | undefined>;
67
70
  getMdmConfigurations(authObject: IAddigyInternalAuthObject): Promise<any[]>;
68
71
  getMdmConfigurationByName(authObject: IAddigyInternalAuthObject, name: string): Promise<any>;
69
72
  getFileVaultKeys(authObject: IAddigyInternalAuthObject): Promise<object[]>;
package/index.js CHANGED
@@ -897,6 +897,54 @@ class Addigy {
897
897
  });
898
898
  return JSON.parse(res.body);
899
899
  }
900
+ async createCustomFact(authObject, name, script, scriptType) {
901
+ const shebang = {
902
+ bash: '#!/bin/bash',
903
+ python: '#!/usr/bin/python',
904
+ zsh: '#!/bin/zsh',
905
+ };
906
+ const body = {
907
+ name,
908
+ os_architectures: {
909
+ linux_arm: {
910
+ is_supported: false,
911
+ language: '',
912
+ shebang: '',
913
+ script: '',
914
+ },
915
+ darwin_amd64: {
916
+ is_supported: true,
917
+ language: scriptType,
918
+ shebang: shebang[scriptType],
919
+ script,
920
+ },
921
+ },
922
+ return_type: 'string',
923
+ };
924
+ const res = await this._addigyRequest('https://app-prod.addigy.com/api/services/facts/custom', {
925
+ headers: {
926
+ Cookie: `auth_token=${authObject.authToken};`,
927
+ origin: 'https://app-prod.addigy.com',
928
+ },
929
+ method: 'POST',
930
+ json: body,
931
+ });
932
+ return JSON.parse(res.body);
933
+ }
934
+ async getCustomFacts(authObject) {
935
+ const res = await this._addigyRequest('https://app-prod.addigy.com/api/services/facts/custom', {
936
+ headers: {
937
+ Cookie: `auth_token=${authObject.authToken};`,
938
+ origin: 'https://app-prod.addigy.com',
939
+ },
940
+ method: 'GET',
941
+ });
942
+ return JSON.parse(res.body);
943
+ }
944
+ async getCustomFactByName(authObject, name) {
945
+ const facts = await this.getCustomFacts(authObject);
946
+ return facts.find((e) => e.name === name);
947
+ }
900
948
  async getMdmConfigurations(authObject) {
901
949
  var _a;
902
950
  try {
package/package.json CHANGED
@@ -8,14 +8,14 @@
8
8
  "dependencies": {
9
9
  "@expo/plist": "0.0.18",
10
10
  "form-data": "4.0.0",
11
- "got": "11.8.2",
11
+ "got": "11.8.5",
12
12
  "uuid": "8.3.2"
13
13
  },
14
14
  "description": "",
15
15
  "devDependencies": {
16
16
  "@pliancy/eslint-config-ts": "0.0.5",
17
17
  "@pliancy/semantic-release-config-npm": "2.1.0",
18
- "@types/got": "9.6.11",
18
+ "@types/got": "9.6.12",
19
19
  "@types/jest": "26.0.23",
20
20
  "@types/node": "15.12.5",
21
21
  "@types/uuid": "8.3.0",
@@ -59,7 +59,7 @@
59
59
  "tsc": "tsc -p tsconfig.build.json"
60
60
  },
61
61
  "types": "index.d.ts",
62
- "version": "2.4.0",
62
+ "version": "2.5.0",
63
63
  "volta": {
64
64
  "node": "14.17.1",
65
65
  "yarn": "1.22.10"
package/types.d.ts CHANGED
@@ -172,3 +172,25 @@ export interface FilevaultRequest {
172
172
  deferDontAskAtUserLogout?: boolean;
173
173
  deferForceAtUserLoginMaxBypassAttempts?: -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
174
174
  }
175
+ export interface CustomFact {
176
+ organization_id: string;
177
+ name: string;
178
+ return_type: string;
179
+ identifier: string;
180
+ version: number;
181
+ os_architectures: CustomFactOSArchitectures;
182
+ notes: string;
183
+ provider: string;
184
+ source: string;
185
+ }
186
+ export interface CustomFactOSArchitectures {
187
+ linux_arm: CustomFactOSArchitecturesData;
188
+ darwin_amd64: CustomFactOSArchitecturesData;
189
+ }
190
+ export interface CustomFactOSArchitecturesData {
191
+ language: string;
192
+ is_supported: boolean;
193
+ shebang: string;
194
+ script: string;
195
+ md5_hash: string;
196
+ }