@kong-ui-public/entities-snis 2.3.25 → 2.3.26

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.
@@ -121,7 +121,7 @@ function ti() {
121
121
  return {
122
122
  getAxiosInstance: (e = {}) => {
123
123
  try {
124
- const t = Ut("get-axios-instance");
124
+ const t = Ut("get-axios-instance", void 0);
125
125
  return typeof t == "function" ? t(e) : pt.create({
126
126
  withCredentials: !0,
127
127
  timeout: 3e4,
@@ -1,4 +1,4 @@
1
- (function(H,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@kong-ui-public/i18n"),require("axios"),require("@kong/kongponents"),require("vue-router")):typeof define=="function"&&define.amd?define(["exports","vue","@kong-ui-public/i18n","axios","@kong/kongponents","vue-router"],t):(H=typeof globalThis<"u"?globalThis:H||self,t(H["kong-ui-public-entities-snis"]={},H.Vue,H["kong-ui-public-i18n"],H.axios,H.Kongponents,H.VueRouter))})(this,function(H,t,ce,Pe,Ea,Ue){"use strict";const pn={actions:{create:"New SNI",copy_id:"Copy ID",copy_json:"Copy JSON",edit:"Edit",delete:"Delete",clear:"Clear",loading:"Loading..."},search:{placeholder:"Filter by exact name or ID",no_results:"No results found"},snis:{title:"SNIs",list:{toolbar_actions:{new:"New SNI"},table_headers:{name:"Name",id:"ID",certificate_id:"SSL Certificate ID",tags:"Tags"},empty_state:{title:"Configure a New SNI",description:"SNIs are used to map hostnames to a certificate."}}},form:{sections:{general:{title:"General Information",description:"General information will help identify and manage this SNI."},certificate:{title:"Certificate",description:"Map an existing Certificate object to hostnames"}},fields:{name:{label:"Name",placeholder:"Enter a unique name for this SNI"},tags:{label:"Tags",placeholder:"Enter a list of tags separated by comma",help:"e.g. tag1, tag2, tag3",tooltip:"An optional set of strings for grouping and filtering, separated by commas."},certificate_id:{label:"SSL Certificate ID",placeholder:"Enter or select a Certificate ID",footer:"Search by exact ID to find certificates not included in the list"}}},delete:{title:"Delete an SNI",description:"This action cannot be reversed so make sure to check the SNI usage before deleting."},errors:{delete:"The SNI could not be deleted at this time.",general:"SNIs could not be retrieved",certificates:{fetch:"Could not fetch available certificates",invalid:"Please select a valid certificate ID"},copy:"Failed to copy to clipboard"},copy:{success:"Copied {val} to clipboard",success_brief:"Successfully copied to clipboard"}};function fn(){const e=ce.createI18n("en-us",pn);return{i18n:e,i18nT:ce.i18nTComponent(e)}}const ze={useI18n:fn},de={list:{konnect:{all:"/api/runtime_groups/{controlPlaneId}/snis"},kongManager:{all:"/{workspace}/snis"}},form:{konnect:{create:"/api/runtime_groups/{controlPlaneId}/snis",edit:"/api/runtime_groups/{controlPlaneId}/snis/{id}",validate:"/api/runtime_groups/{controlPlaneId}/v1/schemas/json/sni/validate",certificates:"/api/runtime_groups/{controlPlaneId}/certificates"},kongManager:{create:"/{workspace}/snis",edit:"/{workspace}/snis/{id}",validate:"/{workspace}/schemas/snis/validate",certificates:"/{workspace}/certificates"}}};var He=(e=>(e.GatewayService="service",e.Route="route",e.Consumer="consumer",e.ConsumerGroup="consumer group",e.Plugin="plugin",e.Upstream="upstream",e.Certificate="certificate",e.CACertificate="ca certificate",e.SNI="SNI",e.Key="key",e.KeySet="key set",e.Vault="vault",e.Application="application",e.Developer="developer",e.acls="ACL Credential",e["basic-auth"]="Basic Auth Credential",e["key-auth"]="Key Auth Credential",e["key-auth-enc"]="Key Auth Encrypted Credential",e.oauth2="OAuth 2.0 Credential",e["hmac-auth"]="HMAC Credential",e.jwt="JWT Credential",e.Target="target",e.Policy="policy",e))(He||{}),be=(e=>(e.Edit="edit",e.Create="create",e))(be||{}),ee=(e=>(e[e.Loading=0]="Loading",e[e.Idle=1]="Idle",e[e.NoResults=2]="NoResults",e[e.Error=3]="Error",e))(ee||{});function mn(){return{getAxiosInstance:(e={})=>{try{const n=t.inject("get-axios-instance");return typeof n=="function"?n(e):Pe.create({withCredentials:!0,timeout:3e4,...e})}catch(n){return console.warn("getAxiosInstance:",n.message||n),Pe.create({withCredentials:!0,timeout:3e4,...e})}},getTraceIdFromError:e=>{var n;return((n=e==null?void 0:e.response)==null?void 0:n.headers["x-datadog-trace-id"])||""}}}function hn(){return{debounce:(e,n)=>{let r;return(...o)=>{clearTimeout(r),r=window==null?void 0:window.setTimeout(()=>{e(...o)},n)}}}}const Ie="khcp-user-table-preferences",gn={pageSize:30,sortColumnKey:void 0,sortColumnOrder:void 0};function yn(){const e=r=>{if(typeof r=="string")try{return JSON.parse(r)}catch(o){console.error("useTablePreferences(tryParseJson)",o);return}},n=()=>{const r=e(localStorage.getItem(Ie));return!r||!Object.keys(r).length?new Map:new Map(Object.entries(r))};return{setTablePreferences:(r,o)=>{try{const i=n();i.set(r,o),localStorage.setItem(Ie,JSON.stringify(Object.fromEntries(i.entries())))}catch(i){console.error("useTablePreferences(setTablePreferences)",i)}},getTablePreferences:r=>{const o=n();return(o==null?void 0:o.get(r))||void 0||gn},deleteAllTablePreferences:()=>{localStorage.removeItem(Ie)}}}function Ne(e={}){const{getAxiosInstance:n}=mn();return{axiosInstance:n(e)}}const bn={actions:{copyId:"Copy ID",copied_id:'Copied "{id}" to the clipboard',copyToClipboard:"Copied successfully!",copyToClipboardFailed:"Failed to copy to the clipboard"}},kn={message:"Are you sure you want to delete this {entityType}?",messageWithName:"Are you sure you want to delete this {entityType} {entityName}?"},Cn={actions:{viewConfiguration:"View Configuration",save:"Save",cancel:"Cancel",back:"Back"},configuration:{title:"Configuration",message:"Export configurations for core Kong Gateway objects, like services, routes, and plugins, to either YAML or JSON. This allows for straightforward importing into APIOps tools like decK with YAML, or Insomnia and cURL with JSON.",yaml:"YAML",json:"JSON"},errors:{edit:"The entity could not be edited at this time."}},wn={emptyState:{noSearchResultsTitle:"No results found",noSearchResultsMessage:"Please adjust the criteria and try again.",noSearchResultsCtaText:"Clear"}},Sn={title:"Configuration",actions:{copy:"Copy JSON"},sections:{advanced:"Advanced",plugin:"Plugin Specific Configuration"},commonFields:{id_label:"ID",name_label:"Name",enabled_label:"Enabled",enabled_tooltip:"Enabled is FTW",updated_at_label:"Last Updated",created_at_label:"Created",tags_label:"Tags",link:"Link"},statusBadge:{enabledLabel:"Enabled",disabledLabel:"Disabled"},copy:{tooltip:"Copy {label}",success:"Copied!"},errors:{load:"The entity configuration data could not be loaded at this time.",copy:"Failed to copy to clipboard"},general:{entryTitle:"Entry {index}",structuredFormat:"Structured"}},xn={filterButtonText:"Filter",fieldLabel:"Filter by:",inputPlaceholder:"Enter a value",selectPlaceholder:"Select an item",applyButtonText:"Apply",clearButtonText:"Clear",clearAllButtonText:"Clear all filters"},An={errors:{fetch:"Could not fetch available items",invalid:"Please select a valid value"}},In={unexpected:"An unexpected error has occurred",dataKeyUndefined:'The data key "{dataKey}" does not exist in the response.'},Nn={enable:{title:"Enable {entityType}",message:"Are you sure you want to enable the {entityType} {entityName}?",confirmText:"Yes, enable"},disable:{title:"Disable {entityType}",message:"Are you sure you want to disable the {entityType} {entityName}?",confirmText:"Yes, disable"}},_n={global:bn,deleteModal:kn,baseForm:Cn,baseTable:wn,baseConfigCard:Sn,filter:xn,debouncedFilter:An,errors:In,toggleModal:Nn};function _e(){const e=ce.createI18n("en-us",_n);return{i18n:e,i18nT:ce.i18nTComponent(e)}}function Ye(){const e=(r,o)=>(o==null?void 0:o[r])??void 0,n=(r,o)=>{if(r.length!==o.length)return!1;const i=new Set([...r,...o]);for(const l of i){const a=r.filter(c=>c===l).length,s=o.filter(c=>c===l).length;if(a!==s)return!1}return!0};return{getPropValue:e,objectsAreEqual:(r,o,i)=>{if(i){if(Object.keys(r).length===Object.keys(o).length)for(const l in r)if(Array.isArray(r[l])&&Array.isArray(o[l])){if(n(r[l],o[l]))continue;return!1}else{if(r[l]===o[l])continue;return!1}else return!1;return!0}try{return JSON.stringify(r)===JSON.stringify(o)}catch{return!1}},sortAlpha:r=>(o,i)=>{let l=o[r]===void 0||o[r]===null?"":o[r],a=i[r]===void 0||i[r]===null?"":i[r];return Array.isArray(o[r])&&(l=o[r][0]),Array.isArray(i[r])&&(a=i[r][0]),l.localeCompare(a)},isValidUuid:r=>r?/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/.test(r):!1}}function En(e,n,r,o={fetchedItemsKey:"data",searchKeys:["id"]}){r||(r="100");const{axiosInstance:i}=Ne({headers:e.requestHeaders}),{i18n:{t:l}}=_e(),{debounce:a}=hn(),s=a(async S=>{await E(S)},200),c=t.ref(!1),u=t.ref(""),p=t.ref(""),d=t.ref([]),m=t.ref([]),f=t.ref(void 0),C=t.unref(n);let h=`${e.apiBaseUrl}${C}`;e.app==="konnect"?h=h.replace(/{controlPlaneId}/gi,(e==null?void 0:e.controlPlaneId)||""):e.app==="kongManager"&&(h=h.replace(/\/{workspace}/gi,e!=null&&e.workspace?`/${e.workspace}`:""));const{isValidUuid:w}=Ye(),b=async()=>{try{c.value=!0;const{data:S}=await i.get(`${h}?size=${r}`);S!=null&&S.next||(f.value=o.fetchedItemsKey in S?S[o.fetchedItemsKey]:[]),m.value=o.fetchedItemsKey in S?S[o.fetchedItemsKey]:[],d.value=m.value}catch{d.value=[],u.value=l("debouncedFilter.errors.fetch")}finally{c.value=!1}},g=t.ref(""),E=async S=>{var x,_,P;if(g.value!==S)if(g.value=S||"",f.value===void 0)try{if(c.value=!0,u.value="",p.value="",e.app==="konnect"){let A=h+"";S&&(A+=`/${S}`);const{data:v}=await i.get(`${A}?size=${r}`);o.fetchedItemsKey in v?d.value=v[o.fetchedItemsKey]:v!=null&&v.id?d.value=[v]:d.value=[]}else if(S){const A=[];w(S)&&o.searchKeys.includes("id")?A.push((async()=>{const{data:V}=await i.get(`${h}/${S}`);return[V[o.fetchedItemsKey]??V]})()):A.push(...o.searchKeys.filter(V=>V!=="id").map(async V=>{const{data:T}=await i.get(`${h}?${V}=${S}`);return T[o.fetchedItemsKey]}));const v=await Promise.all(A),$=new Set;d.value=[],(x=v==null?void 0:v.forEach)==null||x.call(v,V=>{var T;(T=V==null?void 0:V.forEach)==null||T.call(V,K=>{$.has(K.id)||($.add(K.id),d.value.push(K))})})}else d.value=m.value}catch(A){((_=A==null?void 0:A.response)==null?void 0:_.status)===404?p.value=l("debouncedFilter.errors.invalid"):(d.value=[],u.value=l("debouncedFilter.errors.fetch"))}finally{c.value=!1}else c.value=!0,p.value="",S?(d.value=(P=f.value)==null?void 0:P.filter(A=>{var v;let $=!1;for(const V of o.searchKeys){const T=typeof A[V]=="string"?(v=A[V])==null?void 0:v.toLowerCase():A[V];T!=null&&T.includes(S.toLowerCase())&&($=!0)}return $}),(!d.value||!d.value.length)&&(p.value=l("debouncedFilter.errors.invalid"))):d.value=f.value,c.value=!1};return{loading:c,error:u,validationError:p,results:d,allRecords:f,loadItems:b,debouncedQueryChange:s}}function Tn(e,n){const r=t.unref(n),o=t.computed(()=>e.apiBaseUrl.startsWith("/")?new URL(`${window.location.origin}${r}`):new URL(r));return o.value.search="",i=>`${o.value.href}/${i}`}function Bn(){const{i18n:{t:e}}=_e();return{getMessageFromError:n=>{var r,o,i,l;if(!n)return e("errors.unexpected");if(((r=n==null?void 0:n.response)==null?void 0:r.status)===401)return console.warn("getMessageFromError: User auth token is expired or missing, returning empty message."),"";if((o=n==null?void 0:n.response)!=null&&o.data){if(n.response.data.detail)return n.response.data.detail;if((i=n.response.data.details)!=null&&i.length)return n.response.data.details.map(a=>{let s=e("errors.unexpected");return a.messages&&typeof a.messages=="object"&&a.messages.length&&(s=a.messages.join(", ")),a.field?`${a.field} - ${s}`:s}).join("; ");if(n.response.data.message){const{message:a}=n.response.data;return Array.isArray(a)?(l=a[0])!=null&&l.constraints?Object.values(a[0].constraints)[0]:a[0]:a}if(typeof n.response.data=="string")return n.response.data;if(typeof n.response.data=="object")return Object.keys(n.response.data).map(a=>`${a} ${n.response.data[a]}`).join(", ")}return n.message||e("errors.unexpected")}}}function vn(e){const n=window.location.origin,r=n.endsWith("/")?n:`${n}/`;try{const o=e.join("/"),i=`${r}${o}`,l=e.some(a=>a.trim()==="");if(/^(https:\/\/(www\.)?([a-zA-Z0-9-]+\.){1,}[a-zA-Z]{2,}(:[0-9]+)?(\/[^\/]+)*)$|^(https|http):\/\/localhost(:[0-9]+)?(\/[^\/]+)*$/.test(i)&&!l&&new URL(i))return`${r}${o}`;throw new Error("Invalid url")}catch(o){return console.warn("Failed to build valid URL:",o),""}}function We(e,n){const r=t.ref(t.unref(e)),o=t.ref(t.unref(n)),i=t.computed(()=>!!(r.value.app==="konnect"||r.value.isExactMatch)),l=t.computed(()=>o.value.startsWith("/")?new URL(`${window.location.origin}${o.value}`):new URL(o.value));return a=>{const{page:s,pageSize:c,offset:u,sortColumnKey:p,sortColumnOrder:d,query:m}=a;try{let f=new URL(l.value.href);return i.value&&m?(f.search="",f=r.value.app==="konnect"?new URL(`${f.href}?filter[name][contains]=${m}`):new URL(`${f.href}/${m}/`)):(i.value||new URLSearchParams(m).forEach((C,h)=>{f.searchParams.append(h,C)}),p&&f.searchParams.append("sort_by",p),d==="desc"&&f.searchParams.append("sort_desc","1"),f.searchParams.append("size",String(c))),u&&s!==1&&f.searchParams.append("offset",String(u)),f.href}catch(f){return console.error("RouteList(fetcher)",f),o.value}}}function Vn(e,n,r="data"){const o=t.unref(n),{axiosInstance:i}=Ne({headers:e.requestHeaders}),l=We(e,o),a=t.ref({status:ee.Idle});return{fetcher:async s=>{try{a.value={status:ee.Loading};let c=l(s);c.includes("filter[name]")&&(c=`${c}&page[size]=${s.pageSize}&page[number]=${s.page}`);const{data:u}=await i.get(c),p=r&&r.replace(/[^\w-_]/gi,"");let d;u[p]&&Array.isArray(u[p])?d=u[p]:Array.isArray(u)?d=u:d=Object.keys(u).length?[u]:[];const m={data:d,total:d.length,...u.offset?{pagination:{offset:u.offset}}:null};return a.value={status:ee.Idle,response:m},m}catch(c){const u={data:[],total:0};return s.query&&c.response.status===404?(a.value={status:ee.NoResults,response:u,error:c},u):(a.value={status:ee.Error,response:u,error:c},u)}},fetcherState:a}}function jn(){const e=(r,o="_")=>r?r.split(o).map(i=>i.toLowerCase()==="id"?i.toUpperCase():i.charAt(0).toUpperCase()+i.substring(1)).join(" "):"",n=/(?:^|[\s-:'"])\w/g;return{capitalize:r=>r?r.replace(n,o=>o.toUpperCase()):"",convertKeyToTitle:e}}const Je=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Ge=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const n=e.match(Je);if(!n)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return n.shift(),n},Ze=e=>e==="*"||e==="x"||e==="X",Qe=e=>{const n=parseInt(e,10);return isNaN(n)?e:n},Mn=(e,n)=>typeof e!=typeof n?[String(e),String(n)]:[e,n],On=(e,n)=>{if(Ze(e)||Ze(n))return 0;const[r,o]=Mn(Qe(e),Qe(n));return r>o?1:r<o?-1:0},Xe=(e,n)=>{for(let r=0;r<Math.max(e.length,n.length);r++){const o=On(e[r]||"0",n[r]||"0");if(o!==0)return o}return 0},Fn=(e,n)=>{const r=Ge(e),o=Ge(n),i=r.pop(),l=o.pop(),a=Xe(r,o);return a!==0?a:i&&l?Xe(i.split("."),l.split(".")):i||l?i?-1:1:0},et=(e,n,r)=>{Dn(r);const o=Fn(e,n);return tt[r].includes(o)},tt={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},nt=Object.keys(tt),Dn=e=>{if(typeof e!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);if(nt.indexOf(e)===-1)throw new Error(`Invalid operator, expected one of ${nt.join("|")}`)},$n=e=>typeof e=="string"&&/^[v\d]/.test(e)&&Je.test(e);function Ln(e){const{gatewayInfo:n,supportedRange:r}=e;if(!n)return!0;const{edition:o,version:i}=n;if(!$n(i))return console.error("Invalid version"),!1;const l=r[o];if(!l)return!1;const[a,s]=l;return!(a&&et(i,a,"<")||s&&et(i,s,">"))}function qn(e){const n=t.ref(0),r=t.ref(0),o=t.ref(!1);return t.watch(e,i=>{i&&!o.value&&(n.value=i.offsetWidth,r.value=i.scrollWidth,o.value=!0)}),{isTruncated:t.computed(()=>n.value<r.value)}}const te={useAxios:Ne,useDebouncedFilter:En,useDeleteUrlBuilder:Tn,useErrors:Bn,useExternalLinkCreator:vn,useFetcher:Vn,useFetchUrlBuilder:We,useHelpers:Ye,useStringHelpers:jn,useI18n:_e,useGatewayFeatureSupported:Ln,useTruncationDetector:qn},re=(e,n)=>{const r=e.__vccOpts||e;for(const[o,i]of n)r[o]=i;return r},Kn="#0044f4",Rn="#3a3f51",Pn={class:"json-config"},Un={key:0,class:"json-endpoint"},zn=t.defineComponent({__name:"JsonCodeBlock",props:{config:{type:Object,required:!1,default:()=>({})},fetcherUrl:{type:String,required:!1,default:""},jsonRecord:{type:Object,required:!0},requestMethod:{type:String,required:!1,default:""}},setup(e){t.useCssVars(i=>({"2d178975":`${o.value}ch`}));const n=e,r=t.computed(()=>n.jsonRecord),o=t.computed(()=>{var i;if(!n.fetcherUrl)return 0;const l=(i=n.fetcherUrl)==null?void 0:i.split("/");return l.length<2?0:41+(n.requestMethod==="post"?l[l.length-1]:l[l.length-2]).length});return(i,l)=>{var a;const s=t.resolveComponent("KBadge"),c=t.resolveComponent("KCodeBlock");return t.openBlock(),t.createElementBlock("div",Pn,[n.fetcherUrl&&(a=n.config)!=null&&a.jsonYamlFormsEnabled?(t.openBlock(),t.createElementBlock("div",Un,[t.createVNode(s,{appearance:n.requestMethod},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.requestMethod),1)]),_:1},8,["appearance"]),t.createVNode(c,{id:"json-endpoint-codeblock",code:n.fetcherUrl,"is-single-line":"",language:"json",theme:"dark"},null,8,["code"])])):t.createCommentVNode("",!0),n.jsonRecord?(t.openBlock(),t.createBlock(c,{key:1,id:"json-codeblock",class:t.normalizeClass({"json-content":n.fetcherUrl}),code:JSON.stringify(r.value,null,2),language:"json",theme:"dark"},null,8,["class","code"])):t.createCommentVNode("",!0)])}}});/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */function rt(e){return typeof e>"u"||e===null}function Hn(e){return typeof e=="object"&&e!==null}function Yn(e){return Array.isArray(e)?e:rt(e)?[]:[e]}function Wn(e,n){var r,o,i,l;if(n)for(l=Object.keys(n),r=0,o=l.length;r<o;r+=1)i=l[r],e[i]=n[i];return e}function Jn(e,n){var r="",o;for(o=0;o<n;o+=1)r+=e;return r}function Gn(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var Zn=rt,Qn=Hn,Xn=Yn,er=Jn,tr=Gn,nr=Wn,D={isNothing:Zn,isObject:Qn,toArray:Xn,repeat:er,isNegativeZero:tr,extend:nr};function ot(e,n){var r="",o=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!n&&e.mark.snippet&&(r+=`
1
+ (function(H,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@kong-ui-public/i18n"),require("axios"),require("@kong/kongponents"),require("vue-router")):typeof define=="function"&&define.amd?define(["exports","vue","@kong-ui-public/i18n","axios","@kong/kongponents","vue-router"],t):(H=typeof globalThis<"u"?globalThis:H||self,t(H["kong-ui-public-entities-snis"]={},H.Vue,H["kong-ui-public-i18n"],H.axios,H.Kongponents,H.VueRouter))})(this,function(H,t,ce,Pe,Ea,Ue){"use strict";const pn={actions:{create:"New SNI",copy_id:"Copy ID",copy_json:"Copy JSON",edit:"Edit",delete:"Delete",clear:"Clear",loading:"Loading..."},search:{placeholder:"Filter by exact name or ID",no_results:"No results found"},snis:{title:"SNIs",list:{toolbar_actions:{new:"New SNI"},table_headers:{name:"Name",id:"ID",certificate_id:"SSL Certificate ID",tags:"Tags"},empty_state:{title:"Configure a New SNI",description:"SNIs are used to map hostnames to a certificate."}}},form:{sections:{general:{title:"General Information",description:"General information will help identify and manage this SNI."},certificate:{title:"Certificate",description:"Map an existing Certificate object to hostnames"}},fields:{name:{label:"Name",placeholder:"Enter a unique name for this SNI"},tags:{label:"Tags",placeholder:"Enter a list of tags separated by comma",help:"e.g. tag1, tag2, tag3",tooltip:"An optional set of strings for grouping and filtering, separated by commas."},certificate_id:{label:"SSL Certificate ID",placeholder:"Enter or select a Certificate ID",footer:"Search by exact ID to find certificates not included in the list"}}},delete:{title:"Delete an SNI",description:"This action cannot be reversed so make sure to check the SNI usage before deleting."},errors:{delete:"The SNI could not be deleted at this time.",general:"SNIs could not be retrieved",certificates:{fetch:"Could not fetch available certificates",invalid:"Please select a valid certificate ID"},copy:"Failed to copy to clipboard"},copy:{success:"Copied {val} to clipboard",success_brief:"Successfully copied to clipboard"}};function fn(){const e=ce.createI18n("en-us",pn);return{i18n:e,i18nT:ce.i18nTComponent(e)}}const ze={useI18n:fn},de={list:{konnect:{all:"/api/runtime_groups/{controlPlaneId}/snis"},kongManager:{all:"/{workspace}/snis"}},form:{konnect:{create:"/api/runtime_groups/{controlPlaneId}/snis",edit:"/api/runtime_groups/{controlPlaneId}/snis/{id}",validate:"/api/runtime_groups/{controlPlaneId}/v1/schemas/json/sni/validate",certificates:"/api/runtime_groups/{controlPlaneId}/certificates"},kongManager:{create:"/{workspace}/snis",edit:"/{workspace}/snis/{id}",validate:"/{workspace}/schemas/snis/validate",certificates:"/{workspace}/certificates"}}};var He=(e=>(e.GatewayService="service",e.Route="route",e.Consumer="consumer",e.ConsumerGroup="consumer group",e.Plugin="plugin",e.Upstream="upstream",e.Certificate="certificate",e.CACertificate="ca certificate",e.SNI="SNI",e.Key="key",e.KeySet="key set",e.Vault="vault",e.Application="application",e.Developer="developer",e.acls="ACL Credential",e["basic-auth"]="Basic Auth Credential",e["key-auth"]="Key Auth Credential",e["key-auth-enc"]="Key Auth Encrypted Credential",e.oauth2="OAuth 2.0 Credential",e["hmac-auth"]="HMAC Credential",e.jwt="JWT Credential",e.Target="target",e.Policy="policy",e))(He||{}),be=(e=>(e.Edit="edit",e.Create="create",e))(be||{}),ee=(e=>(e[e.Loading=0]="Loading",e[e.Idle=1]="Idle",e[e.NoResults=2]="NoResults",e[e.Error=3]="Error",e))(ee||{});function mn(){return{getAxiosInstance:(e={})=>{try{const n=t.inject("get-axios-instance",void 0);return typeof n=="function"?n(e):Pe.create({withCredentials:!0,timeout:3e4,...e})}catch(n){return console.warn("getAxiosInstance:",n.message||n),Pe.create({withCredentials:!0,timeout:3e4,...e})}},getTraceIdFromError:e=>{var n;return((n=e==null?void 0:e.response)==null?void 0:n.headers["x-datadog-trace-id"])||""}}}function hn(){return{debounce:(e,n)=>{let r;return(...o)=>{clearTimeout(r),r=window==null?void 0:window.setTimeout(()=>{e(...o)},n)}}}}const Ie="khcp-user-table-preferences",gn={pageSize:30,sortColumnKey:void 0,sortColumnOrder:void 0};function yn(){const e=r=>{if(typeof r=="string")try{return JSON.parse(r)}catch(o){console.error("useTablePreferences(tryParseJson)",o);return}},n=()=>{const r=e(localStorage.getItem(Ie));return!r||!Object.keys(r).length?new Map:new Map(Object.entries(r))};return{setTablePreferences:(r,o)=>{try{const i=n();i.set(r,o),localStorage.setItem(Ie,JSON.stringify(Object.fromEntries(i.entries())))}catch(i){console.error("useTablePreferences(setTablePreferences)",i)}},getTablePreferences:r=>{const o=n();return(o==null?void 0:o.get(r))||void 0||gn},deleteAllTablePreferences:()=>{localStorage.removeItem(Ie)}}}function Ne(e={}){const{getAxiosInstance:n}=mn();return{axiosInstance:n(e)}}const bn={actions:{copyId:"Copy ID",copied_id:'Copied "{id}" to the clipboard',copyToClipboard:"Copied successfully!",copyToClipboardFailed:"Failed to copy to the clipboard"}},kn={message:"Are you sure you want to delete this {entityType}?",messageWithName:"Are you sure you want to delete this {entityType} {entityName}?"},Cn={actions:{viewConfiguration:"View Configuration",save:"Save",cancel:"Cancel",back:"Back"},configuration:{title:"Configuration",message:"Export configurations for core Kong Gateway objects, like services, routes, and plugins, to either YAML or JSON. This allows for straightforward importing into APIOps tools like decK with YAML, or Insomnia and cURL with JSON.",yaml:"YAML",json:"JSON"},errors:{edit:"The entity could not be edited at this time."}},wn={emptyState:{noSearchResultsTitle:"No results found",noSearchResultsMessage:"Please adjust the criteria and try again.",noSearchResultsCtaText:"Clear"}},Sn={title:"Configuration",actions:{copy:"Copy JSON"},sections:{advanced:"Advanced",plugin:"Plugin Specific Configuration"},commonFields:{id_label:"ID",name_label:"Name",enabled_label:"Enabled",enabled_tooltip:"Enabled is FTW",updated_at_label:"Last Updated",created_at_label:"Created",tags_label:"Tags",link:"Link"},statusBadge:{enabledLabel:"Enabled",disabledLabel:"Disabled"},copy:{tooltip:"Copy {label}",success:"Copied!"},errors:{load:"The entity configuration data could not be loaded at this time.",copy:"Failed to copy to clipboard"},general:{entryTitle:"Entry {index}",structuredFormat:"Structured"}},xn={filterButtonText:"Filter",fieldLabel:"Filter by:",inputPlaceholder:"Enter a value",selectPlaceholder:"Select an item",applyButtonText:"Apply",clearButtonText:"Clear",clearAllButtonText:"Clear all filters"},An={errors:{fetch:"Could not fetch available items",invalid:"Please select a valid value"}},In={unexpected:"An unexpected error has occurred",dataKeyUndefined:'The data key "{dataKey}" does not exist in the response.'},Nn={enable:{title:"Enable {entityType}",message:"Are you sure you want to enable the {entityType} {entityName}?",confirmText:"Yes, enable"},disable:{title:"Disable {entityType}",message:"Are you sure you want to disable the {entityType} {entityName}?",confirmText:"Yes, disable"}},_n={global:bn,deleteModal:kn,baseForm:Cn,baseTable:wn,baseConfigCard:Sn,filter:xn,debouncedFilter:An,errors:In,toggleModal:Nn};function _e(){const e=ce.createI18n("en-us",_n);return{i18n:e,i18nT:ce.i18nTComponent(e)}}function Ye(){const e=(r,o)=>(o==null?void 0:o[r])??void 0,n=(r,o)=>{if(r.length!==o.length)return!1;const i=new Set([...r,...o]);for(const l of i){const a=r.filter(c=>c===l).length,s=o.filter(c=>c===l).length;if(a!==s)return!1}return!0};return{getPropValue:e,objectsAreEqual:(r,o,i)=>{if(i){if(Object.keys(r).length===Object.keys(o).length)for(const l in r)if(Array.isArray(r[l])&&Array.isArray(o[l])){if(n(r[l],o[l]))continue;return!1}else{if(r[l]===o[l])continue;return!1}else return!1;return!0}try{return JSON.stringify(r)===JSON.stringify(o)}catch{return!1}},sortAlpha:r=>(o,i)=>{let l=o[r]===void 0||o[r]===null?"":o[r],a=i[r]===void 0||i[r]===null?"":i[r];return Array.isArray(o[r])&&(l=o[r][0]),Array.isArray(i[r])&&(a=i[r][0]),l.localeCompare(a)},isValidUuid:r=>r?/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/.test(r):!1}}function En(e,n,r,o={fetchedItemsKey:"data",searchKeys:["id"]}){r||(r="100");const{axiosInstance:i}=Ne({headers:e.requestHeaders}),{i18n:{t:l}}=_e(),{debounce:a}=hn(),s=a(async S=>{await E(S)},200),c=t.ref(!1),u=t.ref(""),p=t.ref(""),d=t.ref([]),m=t.ref([]),f=t.ref(void 0),C=t.unref(n);let h=`${e.apiBaseUrl}${C}`;e.app==="konnect"?h=h.replace(/{controlPlaneId}/gi,(e==null?void 0:e.controlPlaneId)||""):e.app==="kongManager"&&(h=h.replace(/\/{workspace}/gi,e!=null&&e.workspace?`/${e.workspace}`:""));const{isValidUuid:w}=Ye(),b=async()=>{try{c.value=!0;const{data:S}=await i.get(`${h}?size=${r}`);S!=null&&S.next||(f.value=o.fetchedItemsKey in S?S[o.fetchedItemsKey]:[]),m.value=o.fetchedItemsKey in S?S[o.fetchedItemsKey]:[],d.value=m.value}catch{d.value=[],u.value=l("debouncedFilter.errors.fetch")}finally{c.value=!1}},g=t.ref(""),E=async S=>{var x,_,P;if(g.value!==S)if(g.value=S||"",f.value===void 0)try{if(c.value=!0,u.value="",p.value="",e.app==="konnect"){let A=h+"";S&&(A+=`/${S}`);const{data:v}=await i.get(`${A}?size=${r}`);o.fetchedItemsKey in v?d.value=v[o.fetchedItemsKey]:v!=null&&v.id?d.value=[v]:d.value=[]}else if(S){const A=[];w(S)&&o.searchKeys.includes("id")?A.push((async()=>{const{data:V}=await i.get(`${h}/${S}`);return[V[o.fetchedItemsKey]??V]})()):A.push(...o.searchKeys.filter(V=>V!=="id").map(async V=>{const{data:T}=await i.get(`${h}?${V}=${S}`);return T[o.fetchedItemsKey]}));const v=await Promise.all(A),$=new Set;d.value=[],(x=v==null?void 0:v.forEach)==null||x.call(v,V=>{var T;(T=V==null?void 0:V.forEach)==null||T.call(V,K=>{$.has(K.id)||($.add(K.id),d.value.push(K))})})}else d.value=m.value}catch(A){((_=A==null?void 0:A.response)==null?void 0:_.status)===404?p.value=l("debouncedFilter.errors.invalid"):(d.value=[],u.value=l("debouncedFilter.errors.fetch"))}finally{c.value=!1}else c.value=!0,p.value="",S?(d.value=(P=f.value)==null?void 0:P.filter(A=>{var v;let $=!1;for(const V of o.searchKeys){const T=typeof A[V]=="string"?(v=A[V])==null?void 0:v.toLowerCase():A[V];T!=null&&T.includes(S.toLowerCase())&&($=!0)}return $}),(!d.value||!d.value.length)&&(p.value=l("debouncedFilter.errors.invalid"))):d.value=f.value,c.value=!1};return{loading:c,error:u,validationError:p,results:d,allRecords:f,loadItems:b,debouncedQueryChange:s}}function Tn(e,n){const r=t.unref(n),o=t.computed(()=>e.apiBaseUrl.startsWith("/")?new URL(`${window.location.origin}${r}`):new URL(r));return o.value.search="",i=>`${o.value.href}/${i}`}function Bn(){const{i18n:{t:e}}=_e();return{getMessageFromError:n=>{var r,o,i,l;if(!n)return e("errors.unexpected");if(((r=n==null?void 0:n.response)==null?void 0:r.status)===401)return console.warn("getMessageFromError: User auth token is expired or missing, returning empty message."),"";if((o=n==null?void 0:n.response)!=null&&o.data){if(n.response.data.detail)return n.response.data.detail;if((i=n.response.data.details)!=null&&i.length)return n.response.data.details.map(a=>{let s=e("errors.unexpected");return a.messages&&typeof a.messages=="object"&&a.messages.length&&(s=a.messages.join(", ")),a.field?`${a.field} - ${s}`:s}).join("; ");if(n.response.data.message){const{message:a}=n.response.data;return Array.isArray(a)?(l=a[0])!=null&&l.constraints?Object.values(a[0].constraints)[0]:a[0]:a}if(typeof n.response.data=="string")return n.response.data;if(typeof n.response.data=="object")return Object.keys(n.response.data).map(a=>`${a} ${n.response.data[a]}`).join(", ")}return n.message||e("errors.unexpected")}}}function vn(e){const n=window.location.origin,r=n.endsWith("/")?n:`${n}/`;try{const o=e.join("/"),i=`${r}${o}`,l=e.some(a=>a.trim()==="");if(/^(https:\/\/(www\.)?([a-zA-Z0-9-]+\.){1,}[a-zA-Z]{2,}(:[0-9]+)?(\/[^\/]+)*)$|^(https|http):\/\/localhost(:[0-9]+)?(\/[^\/]+)*$/.test(i)&&!l&&new URL(i))return`${r}${o}`;throw new Error("Invalid url")}catch(o){return console.warn("Failed to build valid URL:",o),""}}function We(e,n){const r=t.ref(t.unref(e)),o=t.ref(t.unref(n)),i=t.computed(()=>!!(r.value.app==="konnect"||r.value.isExactMatch)),l=t.computed(()=>o.value.startsWith("/")?new URL(`${window.location.origin}${o.value}`):new URL(o.value));return a=>{const{page:s,pageSize:c,offset:u,sortColumnKey:p,sortColumnOrder:d,query:m}=a;try{let f=new URL(l.value.href);return i.value&&m?(f.search="",f=r.value.app==="konnect"?new URL(`${f.href}?filter[name][contains]=${m}`):new URL(`${f.href}/${m}/`)):(i.value||new URLSearchParams(m).forEach((C,h)=>{f.searchParams.append(h,C)}),p&&f.searchParams.append("sort_by",p),d==="desc"&&f.searchParams.append("sort_desc","1"),f.searchParams.append("size",String(c))),u&&s!==1&&f.searchParams.append("offset",String(u)),f.href}catch(f){return console.error("RouteList(fetcher)",f),o.value}}}function Vn(e,n,r="data"){const o=t.unref(n),{axiosInstance:i}=Ne({headers:e.requestHeaders}),l=We(e,o),a=t.ref({status:ee.Idle});return{fetcher:async s=>{try{a.value={status:ee.Loading};let c=l(s);c.includes("filter[name]")&&(c=`${c}&page[size]=${s.pageSize}&page[number]=${s.page}`);const{data:u}=await i.get(c),p=r&&r.replace(/[^\w-_]/gi,"");let d;u[p]&&Array.isArray(u[p])?d=u[p]:Array.isArray(u)?d=u:d=Object.keys(u).length?[u]:[];const m={data:d,total:d.length,...u.offset?{pagination:{offset:u.offset}}:null};return a.value={status:ee.Idle,response:m},m}catch(c){const u={data:[],total:0};return s.query&&c.response.status===404?(a.value={status:ee.NoResults,response:u,error:c},u):(a.value={status:ee.Error,response:u,error:c},u)}},fetcherState:a}}function jn(){const e=(r,o="_")=>r?r.split(o).map(i=>i.toLowerCase()==="id"?i.toUpperCase():i.charAt(0).toUpperCase()+i.substring(1)).join(" "):"",n=/(?:^|[\s-:'"])\w/g;return{capitalize:r=>r?r.replace(n,o=>o.toUpperCase()):"",convertKeyToTitle:e}}const Je=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Ge=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const n=e.match(Je);if(!n)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return n.shift(),n},Ze=e=>e==="*"||e==="x"||e==="X",Qe=e=>{const n=parseInt(e,10);return isNaN(n)?e:n},Mn=(e,n)=>typeof e!=typeof n?[String(e),String(n)]:[e,n],On=(e,n)=>{if(Ze(e)||Ze(n))return 0;const[r,o]=Mn(Qe(e),Qe(n));return r>o?1:r<o?-1:0},Xe=(e,n)=>{for(let r=0;r<Math.max(e.length,n.length);r++){const o=On(e[r]||"0",n[r]||"0");if(o!==0)return o}return 0},Fn=(e,n)=>{const r=Ge(e),o=Ge(n),i=r.pop(),l=o.pop(),a=Xe(r,o);return a!==0?a:i&&l?Xe(i.split("."),l.split(".")):i||l?i?-1:1:0},et=(e,n,r)=>{Dn(r);const o=Fn(e,n);return tt[r].includes(o)},tt={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},nt=Object.keys(tt),Dn=e=>{if(typeof e!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);if(nt.indexOf(e)===-1)throw new Error(`Invalid operator, expected one of ${nt.join("|")}`)},$n=e=>typeof e=="string"&&/^[v\d]/.test(e)&&Je.test(e);function Ln(e){const{gatewayInfo:n,supportedRange:r}=e;if(!n)return!0;const{edition:o,version:i}=n;if(!$n(i))return console.error("Invalid version"),!1;const l=r[o];if(!l)return!1;const[a,s]=l;return!(a&&et(i,a,"<")||s&&et(i,s,">"))}function qn(e){const n=t.ref(0),r=t.ref(0),o=t.ref(!1);return t.watch(e,i=>{i&&!o.value&&(n.value=i.offsetWidth,r.value=i.scrollWidth,o.value=!0)}),{isTruncated:t.computed(()=>n.value<r.value)}}const te={useAxios:Ne,useDebouncedFilter:En,useDeleteUrlBuilder:Tn,useErrors:Bn,useExternalLinkCreator:vn,useFetcher:Vn,useFetchUrlBuilder:We,useHelpers:Ye,useStringHelpers:jn,useI18n:_e,useGatewayFeatureSupported:Ln,useTruncationDetector:qn},re=(e,n)=>{const r=e.__vccOpts||e;for(const[o,i]of n)r[o]=i;return r},Kn="#0044f4",Rn="#3a3f51",Pn={class:"json-config"},Un={key:0,class:"json-endpoint"},zn=t.defineComponent({__name:"JsonCodeBlock",props:{config:{type:Object,required:!1,default:()=>({})},fetcherUrl:{type:String,required:!1,default:""},jsonRecord:{type:Object,required:!0},requestMethod:{type:String,required:!1,default:""}},setup(e){t.useCssVars(i=>({"2d178975":`${o.value}ch`}));const n=e,r=t.computed(()=>n.jsonRecord),o=t.computed(()=>{var i;if(!n.fetcherUrl)return 0;const l=(i=n.fetcherUrl)==null?void 0:i.split("/");return l.length<2?0:41+(n.requestMethod==="post"?l[l.length-1]:l[l.length-2]).length});return(i,l)=>{var a;const s=t.resolveComponent("KBadge"),c=t.resolveComponent("KCodeBlock");return t.openBlock(),t.createElementBlock("div",Pn,[n.fetcherUrl&&(a=n.config)!=null&&a.jsonYamlFormsEnabled?(t.openBlock(),t.createElementBlock("div",Un,[t.createVNode(s,{appearance:n.requestMethod},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(n.requestMethod),1)]),_:1},8,["appearance"]),t.createVNode(c,{id:"json-endpoint-codeblock",code:n.fetcherUrl,"is-single-line":"",language:"json",theme:"dark"},null,8,["code"])])):t.createCommentVNode("",!0),n.jsonRecord?(t.openBlock(),t.createBlock(c,{key:1,id:"json-codeblock",class:t.normalizeClass({"json-content":n.fetcherUrl}),code:JSON.stringify(r.value,null,2),language:"json",theme:"dark"},null,8,["class","code"])):t.createCommentVNode("",!0)])}}});/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */function rt(e){return typeof e>"u"||e===null}function Hn(e){return typeof e=="object"&&e!==null}function Yn(e){return Array.isArray(e)?e:rt(e)?[]:[e]}function Wn(e,n){var r,o,i,l;if(n)for(l=Object.keys(n),r=0,o=l.length;r<o;r+=1)i=l[r],e[i]=n[i];return e}function Jn(e,n){var r="",o;for(o=0;o<n;o+=1)r+=e;return r}function Gn(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var Zn=rt,Qn=Hn,Xn=Yn,er=Jn,tr=Gn,nr=Wn,D={isNothing:Zn,isObject:Qn,toArray:Xn,repeat:er,isNegativeZero:tr,extend:nr};function ot(e,n){var r="",o=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(r+='in "'+e.mark.name+'" '),r+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!n&&e.mark.snippet&&(r+=`
2
2
 
3
3
  `+e.mark.snippet),o+" "+r):o}function ue(e,n){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=n,this.message=ot(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}ue.prototype=Object.create(Error.prototype),ue.prototype.constructor=ue,ue.prototype.toString=function(e){return this.name+": "+ot(this,e)};var R=ue;function Ee(e,n,r,o,i){var l="",a="",s=Math.floor(i/2)-1;return o-n>s&&(l=" ... ",n=o-s+l.length),r-o>s&&(a=" ...",r=o+s-a.length),{str:l+e.slice(n,r).replace(/\t/g,"→")+a,pos:o-n+l.length}}function Te(e,n){return D.repeat(" ",n-e.length)+e}function rr(e,n){if(n=Object.create(n||null),!e.buffer)return null;n.maxLength||(n.maxLength=79),typeof n.indent!="number"&&(n.indent=1),typeof n.linesBefore!="number"&&(n.linesBefore=3),typeof n.linesAfter!="number"&&(n.linesAfter=2);for(var r=/\r?\n|\r|\0/g,o=[0],i=[],l,a=-1;l=r.exec(e.buffer);)i.push(l.index),o.push(l.index+l[0].length),e.position<=l.index&&a<0&&(a=o.length-2);a<0&&(a=o.length-1);var s="",c,u,p=Math.min(e.line+n.linesAfter,i.length).toString().length,d=n.maxLength-(n.indent+p+3);for(c=1;c<=n.linesBefore&&!(a-c<0);c++)u=Ee(e.buffer,o[a-c],i[a-c],e.position-(o[a]-o[a-c]),d),s=D.repeat(" ",n.indent)+Te((e.line-c+1).toString(),p)+" | "+u.str+`
4
4
  `+s;for(u=Ee(e.buffer,o[a],i[a],e.position,d),s+=D.repeat(" ",n.indent)+Te((e.line+1).toString(),p)+" | "+u.str+`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kong-ui-public/entities-snis",
3
- "version": "2.3.25",
3
+ "version": "2.3.26",
4
4
  "type": "module",
5
5
  "main": "./dist/entities-snis.umd.js",
6
6
  "module": "./dist/entities-snis.es.js",
@@ -51,7 +51,7 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "@kong-ui-public/copy-uuid": "^2.0.40",
54
- "@kong-ui-public/entities-shared": "^2.7.4"
54
+ "@kong-ui-public/entities-shared": "^2.7.5"
55
55
  },
56
56
  "scripts": {
57
57
  "dev": "cross-env USE_SANDBOX=true vite",