{"version":3,"file":"scopes.cjs","sources":["../../../src/types/scopes.ts"],"sourcesContent":["export interface ScopeDashboardBindingSpec {\n  dashboard: string;\n  scope: string;\n}\n\nexport interface ScopeDashboardBindingStatus {\n  dashboardTitle: string;\n  groups?: string[];\n}\n\n// TODO: Use Resource from apiserver when we export the types\nexport interface ScopeDashboardBinding {\n  metadata: {\n    name: string;\n  };\n  spec: ScopeDashboardBindingSpec;\n  status: ScopeDashboardBindingStatus;\n}\n\nexport type ScopeFilterOperator = 'equals' | 'not-equals' | 'regex-match' | 'regex-not-match' | 'one-of' | 'not-one-of';\nexport type EqualityOrMultiOperator = Extract<ScopeFilterOperator, 'equals' | 'not-equals' | 'one-of' | 'not-one-of'>;\n\nexport function isEqualityOrMultiOperator(value: string): value is EqualityOrMultiOperator {\n  const operators = new Set(['equals', 'not-equals', 'one-of', 'not-one-of']);\n  return operators.has(value);\n}\n\nexport const scopeFilterOperatorMap: Record<string, ScopeFilterOperator> = {\n  '=': 'equals',\n  '!=': 'not-equals',\n  '=~': 'regex-match',\n  '!~': 'regex-not-match',\n  '=|': 'one-of',\n  '!=|': 'not-one-of',\n};\n\nexport const reverseScopeFilterOperatorMap: Record<ScopeFilterOperator, string> = Object.fromEntries(\n  Object.entries(scopeFilterOperatorMap).map(([symbol, operator]) => [operator, symbol])\n  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n) as Record<ScopeFilterOperator, string>;\n\nexport interface ScopeSpecFilter {\n  key: string;\n  value: string;\n  // values is used for operators that support multiple values (e.g. one-of, not-one-of)\n  values?: string[];\n  operator: ScopeFilterOperator;\n}\n\nexport interface ScopeSpec {\n  title: string;\n  // Used to display the title next to the selected scope and expand the selector to the proper path.\n  // This will override whichever is selected from in the selector.\n  defaultPath?: string[];\n  filters?: ScopeSpecFilter[];\n}\n\n// TODO: Use Resource from apiserver when we export the types\nexport interface Scope {\n  metadata: {\n    // Name is actually the ID of the resource, use spec.title for user readable string\n    name: string;\n  };\n  spec: ScopeSpec;\n}\n\nexport type ScopeNodeNodeType = 'container' | 'leaf';\nexport type ScopeNodeLinkType = 'scope';\n\nexport interface ScopeNodeSpec {\n  nodeType: ScopeNodeNodeType;\n  title: string;\n  subTitle?: string;\n  description?: string;\n\n  // If true for a scope category/type, it means only single child can be selected at a time.\n  disableMultiSelect?: boolean;\n\n  // Id of a scope this node links to. Can be blank for nodes only representing category/type.\n  linkId?: string;\n  // Right now only scope can be linked but in the future this may be other types.\n  linkType?: ScopeNodeLinkType;\n\n  // Id of the parent node.\n  parentName?: string;\n\n  // Redirect to a specific path when this node is selected.\n  redirectPath?: string;\n}\n\n// TODO: Use Resource from apiserver when we export the types\n// Scope node represents a node in a tree that is shown to users. Each node can be a category/type with more children\n// nodes and/or (meaning some can be both) a node representing a selectable scope. Each node can link to a scope but\n// multiple nodes can link to the same scope, meaning a scope is part of multiple categories/types.\nexport interface ScopeNode {\n  metadata: {\n    // Name is actually the ID of the resource, use spec.title for user readable string\n    name: string;\n  };\n  spec: ScopeNodeSpec;\n}\n"],"names":[],"mappings":";;;;;AAsBO,SAAS,0BAA0B,KAAA,EAAiD;AACzF,EAAA,MAAM,SAAA,uBAAgB,GAAA,CAAI,CAAC,UAAU,YAAA,EAAc,QAAA,EAAU,YAAY,CAAC,CAAA;AAC1E,EAAA,OAAO,SAAA,CAAU,IAAI,KAAK,CAAA;AAC5B;AAEO,MAAM,sBAAA,GAA8D;AAAA,EACzE,GAAA,EAAK,QAAA;AAAA,EACL,IAAA,EAAM,YAAA;AAAA,EACN,IAAA,EAAM,aAAA;AAAA,EACN,IAAA,EAAM,iBAAA;AAAA,EACN,IAAA,EAAM,QAAA;AAAA,EACN,KAAA,EAAO;AACT;AAEO,MAAM,gCAAqE,MAAA,CAAO,WAAA;AAAA,EACvF,MAAA,CAAO,OAAA,CAAQ,sBAAsB,CAAA,CAAE,GAAA,CAAI,CAAC,CAAC,MAAA,EAAQ,QAAQ,CAAA,KAAM,CAAC,QAAA,EAAU,MAAM,CAAC;AAAA;AAEvF;;;;;;"}