{"version":3,"sources":["jsdelivr-header.js","/npm/@al/policies@2.0.7/src/al-policies-client.ts","/npm/@al/policies@2.0.7/src/policies-utilities.ts","/npm/@al/policies@2.0.7/src/index.ts"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,uGCKa,yBAKX,WAAA,CAAmB,EAAqB,sBAArB,KAAA,SAJT,KAAA,eAAiB,KACnB,KAAA,YAAc,U,CAStB,eAAM,CAAU,EAAmB,GACjC,OAAO,KAAK,OAAO,IAAY,CAC7B,cAAe,gBAAW,WAC1B,aAAc,KAAK,YACnB,WAAY,EACZ,QAAS,KAAK,eACd,KAAM,aAAa,K,CAMvB,kBAAM,CAAa,GACjB,OAAO,KAAK,OAAO,IAAc,CAC/B,cAAe,gBAAW,WAC1B,aAAc,KAAK,YACnB,WAAY,EACZ,QAAS,KAAK,eACd,KAAM,a,WCjCI,gBAAgB,GAC5B,OAAO,EAAW,cAAc,QAAQ,MAAO,IACnD,C,SAEgB,gBAAgB,GAC5B,OAAO,EAAY,QAAQ,IAAK,IACpC,C,SAMgB,WAAW,EAAoB,EAAiB,GAC5D,IAAI,EACJ,GAAgB,SAAZ,EAAoB,CACpB,MAAM,EAAoB,gBAAgB,GAC1C,EAAa,IAAI,OAAO,EAAmB,I,MAE3C,EAAa,IAAI,OAAO,EAAO,KAEnC,OAAO,EAAS,MAAK,KAAY,EAAO,GAAS,MAAM,IAC3D,C,MCxBa,iBAAmB,kBAAa,YAAY,eAAe,IAAM,IAAI,2B","file":"/npm/@al/policies@2.0.7/dist/index.cjs.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@al/policies@2.0.7/dist/index.cjs.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/**\n * A client for interacting with the Alert Logic Policies Public API.\n */\nimport {\n  AlApiClient,\n  AlDefaultClient,\n  AlLocation,\n} from '@al/core';\n\nimport { Policy } from './types';\n\nexport class AlPoliciesClientInstance {\n  protected serviceVersion = 'v1';\n  private serviceName = 'policies';\n\n  /* istanbul ignore next */\n  constructor(public client:AlApiClient = AlDefaultClient) {\n  }\n\n  /**\n   * Returns the policy matching account_id and policy_id specified\n   */\n  async getPolicy(accountId: string, policyId: string): Promise<Policy> {\n    return this.client.get<Policy>({\n      service_stack: AlLocation.InsightAPI,\n      service_name: this.serviceName,\n      account_id: accountId,\n      version: this.serviceVersion,\n      path: `/policies/${policyId}`,\n    });\n  }\n  /**\n   * Lists policies belonging to a particular account\n   */\n  async listPolicies(accountId: string): Promise<Policy[]> {\n    return this.client.get<Policy[]>({\n      service_stack: AlLocation.InsightAPI,\n      service_name: this.serviceName,\n      account_id: accountId,\n      version: this.serviceVersion,\n      path: '/policies',\n    });\n  }\n\n}\n","import { Policy } from \"./types\";\n\n/**\n * These two functions perform opposite operations.\n * Policy name is transform to  node flavor once the whitespaces have bee replace with '-'.\n */\n\nexport function parsePolicyName(policyName: string): string {\n    return policyName.toLowerCase().replace(/\\s/g, '-');\n}\n\nexport function parseNodeFlavor(flavorValue: string): string {\n    return flavorValue.replace(\"-\", \" \");\n}\n\n/**\n * Returns the fist 'policy.byParam 'that matches 'value'.\n * The match criteria is not case sensitive.\n */\nexport function findPolicy(policies: Policy[], byParam: string, value: string): Policy | undefined {\n    let expression;\n    if (byParam === 'name') {\n        const parsedFlavorValue = parseNodeFlavor(value);\n        expression = new RegExp(parsedFlavorValue, \"i\");\n    } else {\n        expression = new RegExp(value, \"i\");\n    }\n    return policies.find(policy => !!policy[byParam].match(expression));\n}\n","import { AlGlobalizer } from '@al/core';\nimport { AlPoliciesClientInstance } from './al-policies-client';\n\n/* tslint:disable:variable-name */\nexport const AlPoliciesClient = AlGlobalizer.instantiate('al.policies', () => new AlPoliciesClientInstance());\n\nexport { AlPoliciesClientInstance } from './al-policies-client';\nexport * from './types';\nexport * from './policies-utilities';\n"]}