addigy 2.12.0 → 2.13.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
@@ -38,4 +38,5 @@ export { PaginationV2 } from './lib/v2/pagination-v2';
38
38
  export { PoliciesV2 } from './lib/v2/policies-v2';
39
39
  export { SmartSoftwareV2 } from './lib/v2/smart-software-v2';
40
40
  export { UsersV2 } from './lib/v2/users-v2';
41
+ export { VariablesV2 } from './lib/v2/variables-v2';
41
42
  export * from './lib/v2/v2.types';
package/index.js CHANGED
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.UsersV2 = exports.SmartSoftwareV2 = exports.PoliciesV2 = exports.PaginationV2 = exports.MdmConfigurationsV2 = exports.DevicesV2 = exports.CustomFactsV2 = exports.CertsV2 = exports.AddigyV2 = exports.Users = exports.Software = exports.ScreenConnect = exports.Profiles = exports.Policies = exports.MdmProfiles = exports.MdmPolicies = exports.MdmConfigurations = exports.Maintenance = exports.Integrations = exports.Files = exports.Facts = exports.Devices = exports.Certs = exports.Billing = exports.Applications = exports.Auth = exports.Alerts = exports.Addigy = void 0;
17
+ exports.VariablesV2 = exports.UsersV2 = exports.SmartSoftwareV2 = exports.PoliciesV2 = exports.PaginationV2 = exports.MdmConfigurationsV2 = exports.DevicesV2 = exports.CustomFactsV2 = exports.CertsV2 = exports.AddigyV2 = exports.Users = exports.Software = exports.ScreenConnect = exports.Profiles = exports.Policies = exports.MdmProfiles = exports.MdmPolicies = exports.MdmConfigurations = exports.Maintenance = exports.Integrations = exports.Files = exports.Facts = exports.Devices = exports.Certs = exports.Billing = exports.Applications = exports.Auth = exports.Alerts = exports.Addigy = void 0;
18
18
  __exportStar(require("./lib/types"), exports);
19
19
  var addigy_1 = require("./lib/addigy");
20
20
  Object.defineProperty(exports, "Addigy", { enumerable: true, get: function () { return addigy_1.Addigy; } });
@@ -83,4 +83,6 @@ var smart_software_v2_1 = require("./lib/v2/smart-software-v2");
83
83
  Object.defineProperty(exports, "SmartSoftwareV2", { enumerable: true, get: function () { return smart_software_v2_1.SmartSoftwareV2; } });
84
84
  var users_v2_1 = require("./lib/v2/users-v2");
85
85
  Object.defineProperty(exports, "UsersV2", { enumerable: true, get: function () { return users_v2_1.UsersV2; } });
86
+ var variables_v2_1 = require("./lib/v2/variables-v2");
87
+ Object.defineProperty(exports, "VariablesV2", { enumerable: true, get: function () { return variables_v2_1.VariablesV2; } });
86
88
  __exportStar(require("./lib/v2/v2.types"), exports);
@@ -3,9 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getAxiosHttpAgents = getAxiosHttpAgents;
4
4
  const http_1 = require("http-cookie-agent/http");
5
5
  const tough_cookie_1 = require("tough-cookie");
6
+ function getCookieOptions() {
7
+ return { jar: new tough_cookie_1.CookieJar() };
8
+ }
6
9
  function getAxiosHttpAgents() {
7
10
  return {
8
- httpAgent: new http_1.HttpCookieAgent({ cookies: { jar: new tough_cookie_1.CookieJar() } }),
9
- httpsAgent: new http_1.HttpsCookieAgent({ cookies: { jar: new tough_cookie_1.CookieJar() } }),
11
+ httpAgent: new http_1.HttpCookieAgent({ cookies: getCookieOptions() }),
12
+ httpsAgent: new http_1.HttpsCookieAgent({ cookies: getCookieOptions() }),
10
13
  };
11
14
  }
@@ -6,6 +6,7 @@ import { PoliciesV2 } from './policies-v2';
6
6
  import { SmartSoftwareV2 } from './smart-software-v2';
7
7
  import { IAddigyV2Config } from './v2.types';
8
8
  import { UsersV2 } from './users-v2';
9
+ import { VariablesV2 } from './variables-v2';
9
10
  export declare class AddigyV2 {
10
11
  private readonly config;
11
12
  certs: CertsV2;
@@ -15,6 +16,8 @@ export declare class AddigyV2 {
15
16
  policies: PoliciesV2;
16
17
  smartSoftware: SmartSoftwareV2;
17
18
  users: UsersV2;
19
+ variables: VariablesV2;
18
20
  private readonly http;
21
+ private readonly internalHttp;
19
22
  constructor(config: IAddigyV2Config);
20
23
  }
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.AddigyV2 = void 0;
7
7
  const axios_1 = __importDefault(require("axios"));
8
+ const addigy_constants_1 = require("../addigy.constants");
8
9
  const addigy_utils_1 = require("../addigy.utils");
9
10
  const certs_v2_1 = require("./certs-v2");
10
11
  const custom_facts_v2_1 = require("./custom-facts-v2");
@@ -13,6 +14,7 @@ const mdm_configurations_v2_1 = require("./mdm-configurations-v2");
13
14
  const policies_v2_1 = require("./policies-v2");
14
15
  const smart_software_v2_1 = require("./smart-software-v2");
15
16
  const users_v2_1 = require("./users-v2");
17
+ const variables_v2_1 = require("./variables-v2");
16
18
  class AddigyV2 {
17
19
  constructor(config) {
18
20
  this.config = config;
@@ -25,13 +27,23 @@ class AddigyV2 {
25
27
  'x-api-key': this.config.apiKey,
26
28
  },
27
29
  });
30
+ this.internalHttp = axios_1.default.create({
31
+ baseURL: `${addigy_constants_1.Urls.api}/api/v2`,
32
+ ...(0, addigy_utils_1.getAxiosHttpAgents)(),
33
+ headers: {
34
+ 'content-type': 'application/json',
35
+ accept: 'application/json',
36
+ 'x-api-key': this.config.apiKey,
37
+ },
38
+ });
28
39
  this.certs = new certs_v2_1.CertsV2(this.http);
29
40
  this.customFacts = new custom_facts_v2_1.CustomFactsV2(this.http);
30
41
  this.devices = new devices_v2_1.DevicesV2(this.http);
31
42
  this.mdmConfigurations = new mdm_configurations_v2_1.MdmConfigurationsV2(this.http);
32
- this.policies = new policies_v2_1.PoliciesV2(this.http);
43
+ this.policies = new policies_v2_1.PoliciesV2(this.http, this.internalHttp);
33
44
  this.smartSoftware = new smart_software_v2_1.SmartSoftwareV2(this.http);
34
45
  this.users = new users_v2_1.UsersV2(this.http);
46
+ this.variables = new variables_v2_1.VariablesV2(this.http);
35
47
  }
36
48
  }
37
49
  exports.AddigyV2 = AddigyV2;
@@ -2,7 +2,9 @@ import { AxiosInstance } from 'axios';
2
2
  import { V2Policy } from './v2.types';
3
3
  export declare class PoliciesV2 {
4
4
  private readonly http;
5
- constructor(http: AxiosInstance);
5
+ private readonly internalHttp;
6
+ constructor(http: AxiosInstance, internalHttp: AxiosInstance);
6
7
  list(policies?: string[]): Promise<V2Policy[]>;
8
+ get(policyId: string): Promise<V2Policy>;
7
9
  create(name: string): Promise<V2Policy>;
8
10
  }
@@ -2,8 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PoliciesV2 = void 0;
4
4
  class PoliciesV2 {
5
- constructor(http) {
5
+ constructor(http, internalHttp) {
6
6
  this.http = http;
7
+ this.internalHttp = internalHttp;
7
8
  }
8
9
  async list(policies) {
9
10
  var _a;
@@ -15,6 +16,10 @@ class PoliciesV2 {
15
16
  }
16
17
  return (_a = responseData.items) !== null && _a !== void 0 ? _a : [];
17
18
  }
19
+ async get(policyId) {
20
+ const response = await this.internalHttp.get(`/policies/${encodeURIComponent(policyId)}`);
21
+ return response.data;
22
+ }
18
23
  async create(name) {
19
24
  const requestBody = { name };
20
25
  const response = await this.http.post('/policies', requestBody);
@@ -240,6 +240,7 @@ export interface V2Policy {
240
240
  color?: string;
241
241
  icon?: string;
242
242
  parent?: string;
243
+ instructions?: string[];
243
244
  [key: string]: unknown;
244
245
  }
245
246
  export type PoliciesListResponse = V2PaginatedResponse<V2Policy>;
@@ -521,4 +522,52 @@ export interface AssignCustomFactToPoliciesResponse {
521
522
  succeeded?: string[];
522
523
  failed?: string[];
523
524
  }
525
+ export type VariableType = 'string' | 'secret';
526
+ export interface VariableFilter {
527
+ key_contains?: string;
528
+ keys?: string[];
529
+ }
530
+ export interface VariablesListOptions extends V2ListOptions {
531
+ filter?: VariableFilter;
532
+ }
533
+ export interface NewVariableRequest {
534
+ key: string;
535
+ type: VariableType;
536
+ default_value?: unknown;
537
+ }
538
+ export interface VariableUpdateRequest {
539
+ key: string;
540
+ default_value?: unknown;
541
+ }
542
+ export interface PolicyValue {
543
+ policy_id: string;
544
+ value: unknown;
545
+ }
546
+ export interface Variable {
547
+ created_date?: string;
548
+ default_value?: unknown;
549
+ key?: string;
550
+ type?: string;
551
+ updated_date?: string;
552
+ }
553
+ export interface VariablePolicies {
554
+ policy_values: PolicyValue[];
555
+ updated_date?: string;
556
+ variable_key: string;
557
+ }
558
+ export interface VariablePolicy {
559
+ policy_id: string;
560
+ value: unknown;
561
+ variable_key: string;
562
+ }
563
+ export interface VariableValueResponse {
564
+ value?: unknown;
565
+ }
566
+ export interface AssetVariableUsage {
567
+ asset_ids?: string[];
568
+ asset_type?: string;
569
+ organization_id?: string;
570
+ variable_key?: string;
571
+ }
572
+ export type VariablesListResponse = V2PaginatedResponse<Variable>;
524
573
  export {};
@@ -0,0 +1,20 @@
1
+ import { AxiosInstance } from 'axios';
2
+ import { AssetVariableUsage, NewVariableRequest, Variable, VariablePolicies, VariablePolicy, VariablesListOptions, VariableUpdateRequest, VariableValueResponse } from './v2.types';
3
+ export interface VariablePoliciesOptions {
4
+ policyId?: string;
5
+ variableKey?: string;
6
+ }
7
+ export declare class VariablesV2 {
8
+ private readonly http;
9
+ constructor(http: AxiosInstance);
10
+ list(options?: VariablesListOptions): Promise<Variable[]>;
11
+ create(organizationId: string, request: NewVariableRequest): Promise<Variable>;
12
+ update(organizationId: string, request: VariableUpdateRequest): Promise<Variable>;
13
+ delete(organizationId: string, key: string): Promise<void>;
14
+ getPolicies(organizationId: string, options?: VariablePoliciesOptions): Promise<VariablePolicies[]>;
15
+ assignPolicyValue(organizationId: string, request: VariablePolicy): Promise<void>;
16
+ removePolicyValue(organizationId: string, policyId: string, variableKey: string): Promise<void>;
17
+ getPolicyValue(organizationId: string, policyId: string, variableKey: string): Promise<VariableValueResponse>;
18
+ getUsage(organizationId: string, variableKey: string): Promise<AssetVariableUsage[]>;
19
+ getValue(organizationId: string, variableKey: string): Promise<VariableValueResponse>;
20
+ }
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.VariablesV2 = void 0;
4
+ const pagination_v2_1 = require("./pagination-v2");
5
+ class VariablesV2 {
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ async list(options) {
10
+ const baseRequest = {};
11
+ return pagination_v2_1.PaginationV2.fetchItems(async ({ page, per_page }) => {
12
+ const requestBody = pagination_v2_1.PaginationV2.buildRequestBody(baseRequest, {
13
+ ...options,
14
+ page,
15
+ perPage: per_page,
16
+ });
17
+ if (options === null || options === void 0 ? void 0 : options.filter) {
18
+ requestBody.query = options.filter;
19
+ }
20
+ const response = await this.http.post('/oa/variables/query', requestBody);
21
+ return response.data;
22
+ }, options);
23
+ }
24
+ async create(organizationId, request) {
25
+ const response = await this.http.post(`/o/${encodeURIComponent(organizationId)}/variables`, request);
26
+ return response.data;
27
+ }
28
+ async update(organizationId, request) {
29
+ const response = await this.http.put(`/o/${encodeURIComponent(organizationId)}/variables`, request);
30
+ return response.data;
31
+ }
32
+ async delete(organizationId, key) {
33
+ await this.http.delete(`/o/${encodeURIComponent(organizationId)}/variables`, {
34
+ params: { key },
35
+ });
36
+ }
37
+ async getPolicies(organizationId, options) {
38
+ const params = {};
39
+ if (typeof (options === null || options === void 0 ? void 0 : options.policyId) === 'string') {
40
+ params.policy_id = options.policyId;
41
+ }
42
+ if (typeof (options === null || options === void 0 ? void 0 : options.variableKey) === 'string') {
43
+ params.variable_key = options.variableKey;
44
+ }
45
+ const path = `/o/${encodeURIComponent(organizationId)}/variables/policies`;
46
+ const response = Object.keys(params).length > 0
47
+ ? await this.http.get(path, { params })
48
+ : await this.http.get(path);
49
+ return response.data;
50
+ }
51
+ async assignPolicyValue(organizationId, request) {
52
+ await this.http.post(`/o/${encodeURIComponent(organizationId)}/variables/policies`, request);
53
+ }
54
+ async removePolicyValue(organizationId, policyId, variableKey) {
55
+ await this.http.delete(`/o/${encodeURIComponent(organizationId)}/variables/policies`, {
56
+ params: { policy_id: policyId, variable_key: variableKey },
57
+ });
58
+ }
59
+ async getPolicyValue(organizationId, policyId, variableKey) {
60
+ const response = await this.http.get(`/o/${encodeURIComponent(organizationId)}/variables/policies/value`, {
61
+ params: { policy_id: policyId, variable_key: variableKey },
62
+ });
63
+ return response.data;
64
+ }
65
+ async getUsage(organizationId, variableKey) {
66
+ const response = await this.http.get(`/o/${encodeURIComponent(organizationId)}/variables/usage`, {
67
+ params: { variable_key: variableKey },
68
+ });
69
+ return response.data;
70
+ }
71
+ async getValue(organizationId, variableKey) {
72
+ const response = await this.http.get(`/o/${encodeURIComponent(organizationId)}/variables/value`, {
73
+ params: { variable_key: variableKey },
74
+ });
75
+ return response.data;
76
+ }
77
+ }
78
+ exports.VariablesV2 = VariablesV2;
package/package.json CHANGED
@@ -14,20 +14,21 @@
14
14
  "description": "",
15
15
  "devDependencies": {
16
16
  "@pliancy/eslint-config-ts": "1.1.1",
17
- "@pliancy/semantic-release-config-npm": "2.2.0",
17
+ "@pliancy/semantic-release-config-npm": "2.5.0",
18
+ "@semantic-release/git": "10.0.1",
18
19
  "@types/jest": "30.0.0",
19
20
  "@types/node": "22.13.9",
20
- "@types/tough-cookie": "4.0.5",
21
- "commitizen": "4.3.1",
22
- "concurrently": "9.2.1",
21
+ "commitizen": "4.3.2",
22
+ "concurrently": "10.0.3",
23
23
  "cpy-cli": "7.0.0",
24
24
  "cz-conventional-changelog": "3.3.0",
25
25
  "husky": "9.1.7",
26
- "jest": "30.2.0",
26
+ "jest": "30.4.2",
27
27
  "open": "11.0.0",
28
28
  "pinst": "3.0.0",
29
29
  "rimraf": "6.1.3",
30
- "ts-jest": "29.4.6",
30
+ "semantic-release": "25.0.5",
31
+ "ts-jest": "29.4.11",
31
32
  "typescript": "5.9.3"
32
33
  },
33
34
  "keywords": [
@@ -56,7 +57,7 @@
56
57
  "tsc": "tsc -p tsconfig.build.json"
57
58
  },
58
59
  "types": "index.d.ts",
59
- "version": "2.12.0",
60
+ "version": "2.13.0",
60
61
  "volta": {
61
62
  "node": "22.14.0",
62
63
  "yarn": "1.22.22"