@kong-ui-public/entities-shared 3.66.1-pr.3759.917a5afa2.0 → 3.67.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/README.md +0 -2
- package/dist/_plugin-vue_export-helper-B_EUfOiY.cjs +1 -0
- package/dist/{_plugin-vue_export-helper-YEEGXgxj.js → _plugin-vue_export-helper-U0Lgy2iX.js} +79 -80
- package/dist/deck-editor.cjs.js +1 -1
- package/dist/deck-editor.es.js +1 -1
- package/dist/entities-shared.cjs.js +54 -54
- package/dist/entities-shared.es.js +1246 -1326
- package/dist/style.css +1 -1
- package/dist/types/components/common/SensitiveInput.vue.d.ts +1 -0
- package/dist/types/components/common/SensitiveInput.vue.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -2
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +11 -9
- package/dist/_plugin-vue_export-helper-D4bCd0pk.cjs +0 -1
- package/dist/types/components/common/SecretInput.vue.d.ts +0 -36
- package/dist/types/components/common/SecretInput.vue.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -42,7 +42,6 @@ Shared components for Kong entities.
|
|
|
42
42
|
- `EntityToggleModal`
|
|
43
43
|
- `EntityBaseConfigCard`
|
|
44
44
|
- `SensitiveInput`
|
|
45
|
-
- `SecretInput`
|
|
46
45
|
|
|
47
46
|
Reference the [individual component docs](#individual-component-documentation) for more info.
|
|
48
47
|
|
|
@@ -101,7 +100,6 @@ provide('app:konnectColorMode', colorMode)
|
|
|
101
100
|
- [`<EntityToggleModal.vue />`](docs/entity-toggle-modal.md)
|
|
102
101
|
- [`<EntityBaseConfigCard.vue />`](docs/entity-base-config-card.md)
|
|
103
102
|
- [`<SensitiveInput.vue />`](docs/sensitive-input.md)
|
|
104
|
-
- [`<SecretInput.vue />`](docs/secret-input.md)
|
|
105
103
|
|
|
106
104
|
## Individual composables documentation
|
|
107
105
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const N=require("axios"),l=require("vue"),$=require("@kong-ui-public/i18n"),Q=Symbol("PLUGIN_FORM_LAYOUT_STATE"),T=Symbol("DECK_COMMAND_EDITOR"),K="[entities-shared] DeckCommandEditor was not provided. Provide it via the `DECK_COMMAND_EDITOR_KEY` injection key or the `provideDeckCommandEditor` helper (see @kong-ui-public/entities-shared/deck-editor).",Z="50vh",ee=2e5;function te(){return{getAxiosInstance:(e={})=>{try{const r=l.inject("get-axios-instance",void 0);return typeof r=="function"?r(e):N.create({withCredentials:!0,timeout:3e4,...e})}catch(r){return console.warn("getAxiosInstance:",r.message||r),N.create({withCredentials:!0,timeout:3e4,...e})}},getTraceIdFromError:e=>e?.response?.headers["x-datadog-trace-id"]||""}}function se(){return{debounce:(e,r)=>{let i;return(...t)=>{clearTimeout(i),i=window?.setTimeout(()=>{e(...t)},r)}}}}const R="khcp-user-table-preferences",ae={pageSize:30,sortColumnKey:void 0,sortColumnOrder:void 0,columnVisibility:{}};function ne(){const e=i=>{if(typeof i=="string")try{return JSON.parse(i)}catch(t){console.error("useTablePreferences(tryParseJson)",t);return}},r=()=>{const i=e(localStorage.getItem(R));return!i||!Object.keys(i).length?new Map:new Map(Object.entries(i))};return{setTablePreferences:(i,t)=>{try{const s=r();s.set(i,t),localStorage.setItem(R,JSON.stringify(Object.fromEntries(s.entries())))}catch(s){console.error("useTablePreferences(setTablePreferences)",s)}},getTablePreferences:(i,t)=>r()?.get(i)||void 0||t||ae,deleteAllTablePreferences:()=>{localStorage.removeItem(R)}}}function L(e={}){const{getAxiosInstance:r}=te();return{axiosInstance:r(e)}}const re={actions:{copyId:"Copy ID",copied_id:'Copied "{id}" to the clipboard',copyToClipboard:"Copied successfully!",copyToClipboardFailed:"Failed to copy to the clipboard"}},oe={message:"Are you sure you want to delete this {entityType}?",messageWithName:"Are you sure you want to delete this {entityType} {entityName}?"},ie={actions:{viewConfiguration:"View configuration",hideConfiguration:"Hide 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",terraform:"Terraform",deck:"decK"},errors:{edit:"The entity could not be edited at this time."}},ce={emptyState:{noSearchResultsTitle:"No results found",noSearchResultsMessage:"Please adjust the criteria and try again.",noSearchResultsCtaText:"Clear"}},le={title:"Configuration",actions:{copy:"Copy JSON",deck_customize:"Customize before copying to CLI",deck_customize_cancel:"Cancel",sensitive_fields:"Show sensitive fields",sensitive_fields_tooltip:"View masked sensitive data in your configurations if any field values have been redacted."},sections:{advanced:"Advanced",plugin:"Plugin specific configuration",policy:"Policy 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",partial_label:"Redis configuration"},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"}},ue={learnMore:"Learn more",pricingTitle:"Pricing: "},de={filterButtonText:"Filter",fieldLabel:"Filter by:",inputPlaceholder:"Enter a value",selectPlaceholder:"Select an item",applyButtonText:"Apply",clearButtonText:"Clear",clearAllButtonText:"Clear all filters"},fe={errors:{fetch:"Could not fetch available items",invalid:"Please select a valid value"}},pe={unexpected:"An unexpected error has occurred",dataKeyUndefined:'The data key "{dataKey}" does not exist in the response.'},ge={utf8Name:"The name can be any string containing characters, letters, numbers, or the following characters: ., -, _, or ~. Do not use spaces."},me={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"}},ye={hint:{konnect:"The {token} environment variable must be added first. See {link} for details.",kongManager:"If your Admin API is secured, set up authentication following {link}."},documentation:"the documentation",steps:{step_1:"Step 1: Export token",step_2:"Step 2: Apply configuration"},customization:{title:"Customize before copying to CLI",copy_pat:"Make sure to copy your personal access token now. You won't be able to see it again.",reuse_pat:"Use an existing PAT if you've already generated one.",generate_pat:"Generate PAT",footer_reminder:"Changes you make here won't affect your configuration. After you apply changes with decK in the CLI, refresh the page to view them.",secret_advise:"Command may contain sensitive values. Treat it as a secret."},copy_tooltip:"Copy"},he={body:"Want a ready-to-use CLI command? {cta} to view this configuration as a decK sync snippet you can copy directly.",cta:"Switch to decK format"},ve={title:"Generate a Personal Access Token",description:"Personal access tokens are used to authenticate decK commands and Konnect API requests.",fields:{name:{label:"Name",placeholder:"Enter token name"},expiresAt:{label:"Expiration date",placeholder:"Select an expiration date",n_days:"{n} days"}},actions:{cancel:"Cancel",generate:"Generate",generating:"Generating…"}},be={dismissLabel:"Dismiss"},_e={rotateKey:"Rotate key",generateKey:"Generate key",placeholder:"Enter or generate a key",oneTimeHint:"The key is shown only once. Copy it now and store it securely.",copy:"Copy",showKey:"Show key",hideKey:"Hide key"},Ae={global:re,deleteModal:oe,baseForm:ie,baseTable:ce,baseConfigCard:le,emptyState:ue,filter:de,debouncedFilter:fe,errors:pe,validationErrors:ge,toggleModal:me,deckCodeBlock:ye,deckCallout:he,generatePatModal:ve,onboardingCard:be,sensitiveInput:_e};function E(){const e=$.createI18n("en-us",Ae);return{i18n:e,i18nT:$.i18nTComponent(e)}}var C=(e=>(e[e.InitialLoad=0]="InitialLoad",e[e.Loading=1]="Loading",e[e.Idle=2]="Idle",e[e.NoResults=3]="NoResults",e[e.NoRecords=4]="NoRecords",e[e.Error=5]="Error",e))(C||{}),M=(e=>(e.CaCertificate="ca_certificate",e.Certificate="certificate",e.Consumer="consumer",e.ConsumerGroup="consumer_group",e.GatewayService="service",e.Key="key",e.KeySet="set",e.Plugin="plugin",e.Route="route",e.SNI="sni",e.Upstream="upstream",e.Target="target",e.Vault="vault",e.Partial="partial",e.CloudGatewayAddon="cloud_gateway_addon",e.BackendCluster="backend_cluster",e.VirtualCluster="virtual_cluster",e.Listener="listener",e.ProducePolicy="produce_policy",e.ConsumePolicy="consume_policy",e.ClusterPolicy="cluster_policy",e.ListenerPolicy="listener_policy",e.SchemaRegistry="schema_registry",e.StaticKey="static_key",e.TlsTrustBundle="tls_trust_bundle",e.AuthServer="auth_server",e.AuthServerScopes="auth_server_scopes",e.AuthServerClaims="auth_server_claims",e.AuthServerClients="auth_server_clients",e.Other="other",e.PluginSchema="plugin_schema",e.CustomPlugin="custom_plugin",e.ClonedPlugin="cloned_plugin",e))(M||{});const Ce=Object.values(M),H=["ca_certificate","certificate","consumer","consumer_group","service","key","set","plugin","plugin_schema","custom_plugin","cloned_plugin","route","upstream","target","vault","partial"];function P(e){return H.includes(e)}const ke=["backend_cluster","virtual_cluster","listener","produce_policy","consume_policy","cluster_policy","listener_policy","schema_registry","static_key","tls_trust_bundle"],we=["auth_server","auth_server_scopes","auth_server_claims","auth_server_clients"];var D=(e=>(e.ID="id",e.IdArray="id-array",e.Text="plain-text",e.Date="date",e.Redacted="redacted",e.RedactedArray="redacted-array",e.Json="json",e.JsonArray="json-array",e.BadgeTag="badge-tag",e.CopyBadge="copy-badge",e.BadgeStatus="badge-status",e.BadgeMethod="badge-method",e.LinkInternal="link-internal",e.LinkExternal="link-external",e))(D||{}),S=(e=>(e.Basic="basic",e.Advanced="advanced",e.Plugin="plugin",e.Policy="policy",e))(S||{});const Ie=["structured","yaml","json","terraform","deck"];function W(){const e=(o,n)=>n?.[o]??void 0,r=(o,n)=>{if(o.length!==n.length)return!1;const f=new Set([...o,...n]);for(const c of f){const p=o.filter(b=>b===c).length,y=n.filter(b=>b===c).length;if(p!==y)return!1}return!0},i=(o,n,f)=>{if(f){if(Object.keys(o).length===Object.keys(n).length)for(const c in o)if(Array.isArray(o[c])&&Array.isArray(n[c])){if(r(o[c],n[c]))continue;return!1}else{if(o[c]===n[c])continue;return!1}else return!1;return!0}try{return JSON.stringify(o)===JSON.stringify(n)}catch{return!1}},t=o=>(n,f)=>{let c=n[o]===void 0||n[o]===null?"":n[o],p=f[o]===void 0||f[o]===null?"":f[o];return Array.isArray(n[o])&&(c=n[o][0]),Array.isArray(f[o])&&(p=f[o][0]),c.localeCompare(p)},s=o=>o?/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/.test(o):!1,u="********",a=o=>!!o&&typeof o=="object"&&!Array.isArray(o),d=(o,n)=>o?.find(c=>Object.keys(c)?.[0]===n)?.[n],m=(o,n)=>{if(!n||o===null||o===void 0)return o;if(n.type==="string")return n.encrypted?u:o;if(n.type==="record"||n.type==="map"){if(!a(o))return o;if(n.type==="map"&&!n.values)return{...o};const f={};for(const c in o)if(n.type==="record"){const p=d(n.fields,c);f[c]=p?m(o[c],p):o[c]}else if(n.type==="map"){const p=n.values;f[c]=m(o[c],{...p,encrypted:!!(n.encrypted||p.encrypted)})}return f}if((n.type==="array"||n.type==="set")&&Array.isArray(o)){const f=n.elements;return f?o.map(c=>m(c,{...f,encrypted:!!(n.encrypted||f.encrypted)})):o.slice()}return o},h=(o,n)=>{if(Array.isArray(o))return o.map(c=>h(c,n));if(!a(o))return o;const f={};for(const c in o){if(n[c]?.type===D.Redacted){f[c]=u;continue}if(n[c]?.type===D.RedactedArray&&Array.isArray(o[c])){f[c]=o[c].map(()=>u);continue}f[c]=h(o[c],n)}return f};return{getPropValue:e,objectsAreEqual:i,sortAlpha:t,isValidUuid:s,isObjectRecord:a,getApiSchemaField:d,redactByApiSchema:m,redactByConfigSchema:h}}function xe(e,r,i,t={fetchedItemsKey:"data",searchKeys:["id"]}){i||(i="1000");const{axiosInstance:s}=L(e.axiosRequestConfig),{i18n:{t:u}}=E(),{debounce:a}=se(),d=a(async g=>{await w(g)},200),m=l.ref(!1),h=l.ref(""),o=l.ref(""),n=l.ref([]),f=l.ref([]),c=l.ref(void 0),p=l.computed(()=>{let g=`${e.apiBaseUrl}${l.unref(r)}`;return e.app==="konnect"&&(g=g.replace(/{controlPlaneId}/gi,e?.controlPlaneId||"")),g.replace(/\/{workspace}/gi,e?.workspace?`/${e.workspace}`:"")}),{isValidUuid:y}=W(),b=async()=>{try{m.value=!0;const{data:g}=await s.get(`${p.value}?size=${i}`);g?.next||(c.value=t.fetchedItemsKey in g?g[t.fetchedItemsKey]:[]),f.value=t.fetchedItemsKey in g?g[t.fetchedItemsKey]:[],n.value=f.value}catch{n.value=[],h.value=u("debouncedFilter.errors.fetch")}finally{m.value=!1}},k=l.ref(""),w=async g=>{if(k.value!==g){if(k.value=g??"",!g){n.value=f.value;return}if(c.value===void 0)try{if(m.value=!0,h.value="",o.value="",e.app==="konnect"){const v=`${p.value}/${g}`,{data:_}=await s.get(`${v}?size=${i}`);t.fetchedItemsKey in _?n.value=_[t.fetchedItemsKey]:_?.[t.exactMatchKey??"id"]?n.value=[_]:n.value=[]}else{const v=[];y(g)&&t.searchKeys.includes("id")?v.push((async()=>{const{data:A}=await s.get(`${p.value}/${g}`);return[A[t.fetchedItemsKey]??A]})()):v.push(...t.searchKeys.filter(A=>A!=="id").map(async A=>{const{data:x}=await s.get(`${p.value}?${A}=${g}`);return x[t.fetchedItemsKey]}));const _=await Promise.all(v),I=new Set;n.value=[],_?.forEach?.(A=>{A?.forEach?.(x=>{I.has(x.id)||(I.add(x.id),n.value.push(x))})})}}catch(v){v?.response?.status===404?o.value=u("debouncedFilter.errors.invalid"):(n.value=[],h.value=u("debouncedFilter.errors.fetch"))}finally{m.value=!1}else m.value=!0,o.value="",n.value=c.value?.filter(v=>{let _=!1;for(const I of t.searchKeys)(typeof v[I]=="string"?v[I]?.toLowerCase():v[I])?.includes(g.toLowerCase())&&(_=!0);return _}),(!n.value||!n.value.length)&&(o.value=u("debouncedFilter.errors.invalid")),m.value=!1}};return{loading:m,error:h,validationError:o,results:n,allRecords:c,loadItems:b,debouncedQueryChange:d}}function De(e,r){const i=l.inject(T,null),t=l.computed(()=>{const a=l.toValue(e);return(a.app==="kongManager"||!!(a.app==="konnect"&&a.enableDeckConfig))&&P(l.toValue(r))}),s=l.computed(()=>{const a=l.toValue(e),d=a.app==="konnect"&&a.enableDeckConfig&&typeof a.enableDeckConfig!="boolean"?a.enableDeckConfig.customization:void 0;if(d&&!i){console.warn(K);return}return d}),u=l.computed(()=>{const a=l.toValue(e);return a.app==="konnect"&&a.enableDeckConfig&&typeof a.enableDeckConfig!="boolean"?a.enableDeckConfig.calloutPreferenceKey:a.app==="kongManager"?a.deckCalloutPreferenceKey:void 0});return{isDeckEnabled:t,deckCustomizationOptions:s,deckCalloutPreferenceKey:u}}function Oe(e,r){const i=l.inject(T,null),t=l.computed(()=>{const a=l.toValue(e);return(a.app==="kongManager"||!!(a.app==="konnect"&&a.enableDeckTab))&&P(l.toValue(r))}),s=l.computed(()=>{const a=l.toValue(e),d=a.app==="konnect"&&a.enableDeckTab&&typeof a.enableDeckTab!="boolean"?a.enableDeckTab.customization:void 0;if(d&&!i){console.warn(K);return}return d}),u=l.computed(()=>{const a=l.toValue(e);return a.app==="konnect"&&a.enableDeckTab&&typeof a.enableDeckTab!="boolean"?a.enableDeckTab.calloutPreferenceKey:a.app==="kongManager"?a.deckCalloutPreferenceKey:void 0});return{isDeckEnabled:t,deckCustomizationOptions:s,deckCalloutPreferenceKey:u}}function Ee(e,r){const i=l.unref(r),t=l.computed(()=>e.apiBaseUrl.startsWith("/")?new URL(`${window.location.origin}${i}`):new URL(i));return t.value.search="",s=>`${t.value.href}/${s}`}function Re(){const{i18n:{t:e}}=E();return{getErrorFieldsFromError:t=>{if(!t)return{messages:[e("errors.unexpected")],fields:[]};if(t?.response?.status===401)return{messages:[],fields:[]};let s=[e("errors.unexpected")];const u=[];if(t?.response?.data){if(t.response.data.details?.length)return s=[],t.response.data.details.forEach(a=>{let d=e("errors.unexpected");a.messages&&Array.isArray(a.messages)&&a.messages.length&&(d=a.messages.join(", ")),a.field&&u.push({field:a.field,message:d}),s.push(`${a.field??""} ${d}`)}),{messages:s,fields:u};if(t.response.data.message&&Array.isArray(t.response.data.message))return s=[],t.response.data.message.forEach(a=>{if(a?.constraints){const d=Object.values(a.constraints).join(", ");s.push(d),a.property&&u.push({field:a.property,message:d})}else a?.property&&a?.message?(u.push({field:a.property,message:a.message}),s.push(a.message)):s.push(a)}),{messages:s,fields:u};if(typeof t.response.data.message=="string"||typeof t.response.data=="string")return{messages:[t.response.data.message],fields:[]};if(typeof t.response.data=="object")return s=[],Object.keys(t.response.data).forEach(a=>{u.push({field:a,message:t.response.data[a]}),s.push(t.response.data[a])}),{messages:s,fields:u}}return{messages:[t.message||e("errors.unexpected")],fields:[]}},getMessageFromError:t=>{if(!t)return e("errors.unexpected");if(t?.response?.status===401)return console.warn("getMessageFromError: User auth token is expired or missing, returning empty message."),"";if(t?.response?.data){if(t.response.data.detail)return t.response.data.detail;if(t.response.data.details?.length)return t.response.data.details.map(s=>{let u=e("errors.unexpected");return s.messages&&typeof s.messages=="object"&&s.messages.length&&(u=s.messages.join(", ")),s.field?`${s.field} - ${u}`:u}).join("; ");if(t.response.data.message){const{message:s}=t.response.data;return Array.isArray(s)?s[0]?.constraints?Object.values(s[0].constraints)[0]:s[0]:s}if(typeof t.response.data=="string")return t.response.data;if(typeof t.response.data=="object")return Object.keys(t.response.data).map(s=>`${s} ${t.response.data[s]}`).join(", ")}return t.message||e("errors.unexpected")}}}function Te(e){const r=window.location.origin,i=r.endsWith("/")?r:`${r}/`;try{const t=e.join("/"),s=`${i}${t}`,u=e.some(d=>d.trim()==="");if(/^(https:\/\/(www\.)?([a-zA-Z0-9-]+\.){1,}[a-zA-Z]{2,}(:[0-9]+)?(\/[^\/]+)*)$|^(https|http):\/\/localhost(:[0-9]+)?(\/[^\/]+)*$/.test(s)&&!u&&new URL(s))return`${i}${t}`;throw new Error("Invalid url")}catch(t){return console.warn("Failed to build valid URL:",t),""}}function Y(e,r){const i=l.computed(()=>{const s=l.toValue(e);return typeof s.isExactMatch=="boolean"?s.isExactMatch:s.app==="konnect"}),t=l.computed(()=>{const s=l.toValue(r);return s.startsWith("/")?new URL(`${window.location.origin}${s}`):new URL(s)});return s=>{const{page:u,pageSize:a,offset:d,sortColumnKey:m,sortColumnOrder:h,query:o}=s;try{let n=new URL(t.value.href);if(i.value&&o){const f=new URLSearchParams(t.value.search);n.search="",n=l.toValue(e).isExactMatch?new URL(`${n.href}/${o}`):new URL(`${n.href}?filter[name][contains]=${o}`),f.forEach((c,p)=>n.searchParams.append(p,c))}else i.value||new URLSearchParams(o).forEach((f,c)=>{n.searchParams.append(c,f)}),m&&n.searchParams.append("sort_by",m),h==="desc"&&n.searchParams.append("sort_desc","1"),n.searchParams.append("size",String(a));return d&&u!==1&&n.searchParams.append("offset",String(d)),n.href}catch(n){return console.error("RouteList(fetcher)",n),l.toValue(r)}}}const U=new Map;function Ke(e,r,i){const t=l.ref(!0),s=l.toValue(e),{axiosInstance:u}=L(s.axiosRequestConfig),a=Y(e,r),d=l.ref({status:C.Idle}),m=async n=>{const f=l.toValue(i)||"data";try{d.value=t.value?{status:C.InitialLoad}:{status:C.Loading},t.value=!1;let c=a(n);c.includes("filter[name]")&&(c=`${c}&page[size]=${n.pageSize}&page[number]=${n.page}`);const p=await u.get(c);if(p.status>=400)throw p;const y=p.data,b=f&&f.replace(/[^\w-_]/gi,"");let k;y[b]?k=Array.isArray(y[b])?y[b]:[y[b]]:Array.isArray(y)?k=y:k=Object.keys(y).length?[y]:[];const w={data:k,total:k.length,...y.offset?{pagination:{offset:y.offset}}:null};return w.data.length===0&&!n.query?d.value={status:C.NoRecords,response:w}:d.value={status:C.Idle,response:w},w}catch(c){const p={data:[],total:0};return n.query&&(c.response?.status===404||c.status===404)?(d.value={status:C.NoResults,response:p,error:c.response?c:{response:c}},p):(d.value={status:C.Error,response:p,error:c.response?c:{response:c}},p)}},h=s.cacheIdentifier,o=J(h);return{fetcher:m,fetcherState:d,fetcherCacheKey:o}}function J(e){if(e){let r=U.get(e);return r||(r=l.ref(1),U.set(e,r)),r}return l.ref(1)}function Le(){const e=(t,s="_")=>t?t.split(s).map(u=>u.toLowerCase()==="id"?u.toUpperCase():u.charAt(0).toUpperCase()+u.substring(1)).join(" "):"",r=/(?:^|[\s-:'"])\w/g;return{capitalize:t=>t?t.replace(r,s=>s.toUpperCase()):"",convertKeyToTitle:e}}const X=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,j=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const r=e.match(X);if(!r)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return r.shift(),r},F=e=>e==="*"||e==="x"||e==="X",G=e=>{const r=parseInt(e,10);return isNaN(r)?e:r},Me=(e,r)=>typeof e!=typeof r?[String(e),String(r)]:[e,r],Pe=(e,r)=>{if(F(e)||F(r))return 0;const[i,t]=Me(G(e),G(r));return i>t?1:i<t?-1:0},V=(e,r)=>{for(let i=0;i<Math.max(e.length,r.length);i++){const t=Pe(e[i]||"0",r[i]||"0");if(t!==0)return t}return 0},Ne=(e,r)=>{const i=j(e),t=j(r),s=i.pop(),u=t.pop(),a=V(i,t);return a!==0?a:s&&u?V(s.split("."),u.split(".")):s||u?s?-1:1:0},B=(e,r,i)=>{$e(i);const t=Ne(e,r);return q[i].includes(t)},q={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},z=Object.keys(q),$e=e=>{if(typeof e!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);if(z.indexOf(e)===-1)throw new Error(`Invalid operator, expected one of ${z.join("|")}`)},Ue=e=>typeof e=="string"&&/^[v\d]/.test(e)&&X.test(e);function je(e){const{gatewayInfo:r,supportedRange:i}=e;if(!r)return!0;const{edition:t,version:s}=r;if(!Ue(s))return console.error("Invalid version"),!1;const u=i[t];if(!u)return!1;const[a,d]=u;return!(a&&B(s,a,"<")||d&&B(s,d,">"))}function Fe(e){const r=l.ref(0),i=l.ref(0),t=l.ref(!1);return l.watch(e,u=>{u&&!t.value&&(r.value=u.offsetWidth,i.value=u.scrollWidth,t.value=!0)}),{isTruncated:l.computed(()=>r.value<i.value)}}function Ge(){const{i18n:{t:e}}=E();return{utf8Name:i=>/^[\p{N}\p{L}.\-_~]*$/u.test(i)?"":e("validationErrors.utf8Name")}}const O=Symbol("schema"),Ve=e=>{l.provide(O,e)},Be=()=>l.inject(O,void 0),ze=e=>{const i=l.inject(O,void 0)?.value?.fields?.find(s=>Object.keys(s)[0]===e),t=l.toRef(i?.[e]);return l.provide(O,t),t};function He(e){let r="";const i=l.ref(!1),t=l.ref(null),s=l.computed(()=>{let a;return i.value?a=!0:t.value?a=t.value.hasData||e&&l.toValue(e):a=!1,!a});return{tableState:t,hasRecords:i,hideTableToolbar:s,handleStateChange:a=>{a.hasData?i.value=!0:a.state==="success"&&!a.hasData&&(!e||!r)&&(i.value=!1),e&&(r=l.toValue(e)),t.value={...a}}}}const Se={useAxios:L,useDebouncedFilter:xe,useDeleteUrlBuilder:Ee,useBaseEntityDeckOptions:De,useBaseFormDeckOptions:Oe,useErrors:Re,useExternalLinkCreator:Te,useFetcher:Ke,useFetcherCacheKey:J,useFetchUrlBuilder:Y,useHelpers:W,useStringHelpers:Le,useI18n:E,useGatewayFeatureSupported:je,useTruncationDetector:Fe,useValidators:Ge,useSchema:Be,useSchemaProvider:Ve,useSubSchema:ze,useTableState:He},We=(e,r)=>{const i=e.__vccOpts||e;for(const[t,s]of r)i[t]=s;return i};exports.CONFIG_CARD_CODE_BLOCK_MAX_HEIGHT=Z;exports.CONFIG_CARD_FORMATS=Ie;exports.ConfigurationSchemaSection=S;exports.ConfigurationSchemaType=D;exports.DECK_COMMAND_EDITOR_KEY=T;exports.DECK_COMMAND_EDITOR_MISSING_WARNING=K;exports.EventGatewayTypesArray=ke;exports.FetcherStatus=C;exports.IdentityTypesArray=we;exports.PLUGIN_FORM_LAYOUT_STATE=Q;exports.SHIKI_MAX_HIGHLIGHT_LENGTH=ee;exports.SupportedEntityDeckArray=H;exports.SupportedEntityType=M;exports.SupportedEntityTypesArray=Ce;exports._export_sfc=We;exports.composables=Se;exports.de=ne;exports.isSupportedDeckEntityType=P;
|
package/dist/{_plugin-vue_export-helper-YEEGXgxj.js → _plugin-vue_export-helper-U0Lgy2iX.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import $ from "axios";
|
|
2
2
|
import { inject as P, ref as m, computed as b, unref as G, toValue as h, watch as ee, toRef as te, provide as V } from "vue";
|
|
3
3
|
import { createI18n as se, i18nTComponent as ae } from "@kong-ui-public/i18n";
|
|
4
|
-
const Qe = /* @__PURE__ */ Symbol("PLUGIN_FORM_LAYOUT_STATE"), H = /* @__PURE__ */ Symbol("DECK_COMMAND_EDITOR"), W = "[entities-shared] DeckCommandEditor was not provided. Provide it via the `DECK_COMMAND_EDITOR_KEY` injection key or the `provideDeckCommandEditor` helper (see @kong-ui-public/entities-shared/deck-editor).",
|
|
4
|
+
const Qe = /* @__PURE__ */ Symbol("PLUGIN_FORM_LAYOUT_STATE"), H = /* @__PURE__ */ Symbol("DECK_COMMAND_EDITOR"), W = "[entities-shared] DeckCommandEditor was not provided. Provide it via the `DECK_COMMAND_EDITOR_KEY` injection key or the `provideDeckCommandEditor` helper (see @kong-ui-public/entities-shared/deck-editor).", Se = "50vh", Xe = 2e5;
|
|
5
5
|
function ne() {
|
|
6
6
|
return {
|
|
7
7
|
getAxiosInstance: (e = {}) => {
|
|
@@ -41,7 +41,7 @@ const L = "khcp-user-table-preferences", oe = {
|
|
|
41
41
|
sortColumnOrder: void 0,
|
|
42
42
|
columnVisibility: {}
|
|
43
43
|
};
|
|
44
|
-
function
|
|
44
|
+
function Ze() {
|
|
45
45
|
const e = (i) => {
|
|
46
46
|
if (typeof i == "string")
|
|
47
47
|
try {
|
|
@@ -75,7 +75,7 @@ function T(e = {}) {
|
|
|
75
75
|
axiosInstance: r(e)
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
const ie = { actions: { copyId: "Copy ID", copied_id: 'Copied "{id}" to the clipboard', copyToClipboard: "Copied successfully!", copyToClipboardFailed: "Failed to copy to the clipboard" } }, ce = { message: "Are you sure you want to delete this {entityType}?", messageWithName: "Are you sure you want to delete this {entityType} {entityName}?" }, le = { actions: { viewConfiguration: "View configuration", hideConfiguration: "Hide 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", terraform: "Terraform", deck: "decK" }, errors: { edit: "The entity could not be edited at this time." } }, ue = { emptyState: { noSearchResultsTitle: "No results found", noSearchResultsMessage: "Please adjust the criteria and try again.", noSearchResultsCtaText: "Clear" } }, de = { title: "Configuration", actions: { copy: "Copy JSON", deck_customize: "Customize before copying to CLI", deck_customize_cancel: "Cancel", sensitive_fields: "Show sensitive fields", sensitive_fields_tooltip: "View masked sensitive data in your configurations if any field values have been redacted." }, sections: { advanced: "Advanced", plugin: "Plugin specific configuration", policy: "Policy 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", partial_label: "Redis configuration" }, 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" } }, fe = { learnMore: "Learn more", pricingTitle: "Pricing: " }, pe = { filterButtonText: "Filter", fieldLabel: "Filter by:", inputPlaceholder: "Enter a value", selectPlaceholder: "Select an item", applyButtonText: "Apply", clearButtonText: "Clear", clearAllButtonText: "Clear all filters" }, ge = { errors: { fetch: "Could not fetch available items", invalid: "Please select a valid value" } }, me = { unexpected: "An unexpected error has occurred", dataKeyUndefined: 'The data key "{dataKey}" does not exist in the response.' }, he = { utf8Name: "The name can be any string containing characters, letters, numbers, or the following characters: ., -, _, or ~. Do not use spaces." }, ye = { 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" } }, ve = { hint: { konnect: "The {token} environment variable must be added first. See {link} for details.", kongManager: "If your Admin API is secured, set up authentication following {link}." }, documentation: "the documentation", steps: { step_1: "Step 1: Export token", step_2: "Step 2: Apply configuration" }, customization: { title: "Customize before copying to CLI", copy_pat: "Make sure to copy your personal access token now. You won't be able to see it again.", reuse_pat: "Use an existing PAT if you've already generated one.", generate_pat: "Generate PAT", footer_reminder: "Changes you make here won't affect your configuration. After you apply changes with decK in the CLI, refresh the page to view them.", secret_advise: "Command may contain sensitive values. Treat it as a secret." }, copy_tooltip: "Copy" }, be = { body: "Want a ready-to-use CLI command? {cta} to view this configuration as a decK sync snippet you can copy directly.", cta: "Switch to decK format" }, _e = { title: "Generate a Personal Access Token", description: "Personal access tokens are used to authenticate decK commands and Konnect API requests.", fields: { name: { label: "Name", placeholder: "Enter token name" }, expiresAt: { label: "Expiration date", placeholder: "Select an expiration date", n_days: "{n} days" } }, actions: { cancel: "Cancel", generate: "Generate", generating: "Generating…" } },
|
|
78
|
+
const ie = { actions: { copyId: "Copy ID", copied_id: 'Copied "{id}" to the clipboard', copyToClipboard: "Copied successfully!", copyToClipboardFailed: "Failed to copy to the clipboard" } }, ce = { message: "Are you sure you want to delete this {entityType}?", messageWithName: "Are you sure you want to delete this {entityType} {entityName}?" }, le = { actions: { viewConfiguration: "View configuration", hideConfiguration: "Hide 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", terraform: "Terraform", deck: "decK" }, errors: { edit: "The entity could not be edited at this time." } }, ue = { emptyState: { noSearchResultsTitle: "No results found", noSearchResultsMessage: "Please adjust the criteria and try again.", noSearchResultsCtaText: "Clear" } }, de = { title: "Configuration", actions: { copy: "Copy JSON", deck_customize: "Customize before copying to CLI", deck_customize_cancel: "Cancel", sensitive_fields: "Show sensitive fields", sensitive_fields_tooltip: "View masked sensitive data in your configurations if any field values have been redacted." }, sections: { advanced: "Advanced", plugin: "Plugin specific configuration", policy: "Policy 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", partial_label: "Redis configuration" }, 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" } }, fe = { learnMore: "Learn more", pricingTitle: "Pricing: " }, pe = { filterButtonText: "Filter", fieldLabel: "Filter by:", inputPlaceholder: "Enter a value", selectPlaceholder: "Select an item", applyButtonText: "Apply", clearButtonText: "Clear", clearAllButtonText: "Clear all filters" }, ge = { errors: { fetch: "Could not fetch available items", invalid: "Please select a valid value" } }, me = { unexpected: "An unexpected error has occurred", dataKeyUndefined: 'The data key "{dataKey}" does not exist in the response.' }, he = { utf8Name: "The name can be any string containing characters, letters, numbers, or the following characters: ., -, _, or ~. Do not use spaces." }, ye = { 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" } }, ve = { hint: { konnect: "The {token} environment variable must be added first. See {link} for details.", kongManager: "If your Admin API is secured, set up authentication following {link}." }, documentation: "the documentation", steps: { step_1: "Step 1: Export token", step_2: "Step 2: Apply configuration" }, customization: { title: "Customize before copying to CLI", copy_pat: "Make sure to copy your personal access token now. You won't be able to see it again.", reuse_pat: "Use an existing PAT if you've already generated one.", generate_pat: "Generate PAT", footer_reminder: "Changes you make here won't affect your configuration. After you apply changes with decK in the CLI, refresh the page to view them.", secret_advise: "Command may contain sensitive values. Treat it as a secret." }, copy_tooltip: "Copy" }, be = { body: "Want a ready-to-use CLI command? {cta} to view this configuration as a decK sync snippet you can copy directly.", cta: "Switch to decK format" }, _e = { title: "Generate a Personal Access Token", description: "Personal access tokens are used to authenticate decK commands and Konnect API requests.", fields: { name: { label: "Name", placeholder: "Enter token name" }, expiresAt: { label: "Expiration date", placeholder: "Select an expiration date", n_days: "{n} days" } }, actions: { cancel: "Cancel", generate: "Generate", generating: "Generating…" } }, ke = { dismissLabel: "Dismiss" }, we = { rotateKey: "Rotate key", generateKey: "Generate key", placeholder: "Enter or generate a key", oneTimeHint: "The key is shown only once. Copy it now and store it securely.", copy: "Copy", showKey: "Show key", hideKey: "Hide key" }, Ce = {
|
|
79
79
|
global: ie,
|
|
80
80
|
deleteModal: ce,
|
|
81
81
|
baseForm: le,
|
|
@@ -90,12 +90,11 @@ const ie = { actions: { copyId: "Copy ID", copied_id: 'Copied "{id}" to the clip
|
|
|
90
90
|
deckCodeBlock: ve,
|
|
91
91
|
deckCallout: be,
|
|
92
92
|
generatePatModal: _e,
|
|
93
|
-
onboardingCard:
|
|
94
|
-
sensitiveInput:
|
|
95
|
-
secretInput: Ce
|
|
93
|
+
onboardingCard: ke,
|
|
94
|
+
sensitiveInput: we
|
|
96
95
|
};
|
|
97
96
|
function O() {
|
|
98
|
-
const e = se("en-us",
|
|
97
|
+
const e = se("en-us", Ce);
|
|
99
98
|
return {
|
|
100
99
|
i18n: e,
|
|
101
100
|
i18nT: ae(e)
|
|
@@ -103,7 +102,7 @@ function O() {
|
|
|
103
102
|
};
|
|
104
103
|
}
|
|
105
104
|
var I = /* @__PURE__ */ ((e) => (e[e.InitialLoad = 0] = "InitialLoad", e[e.Loading = 1] = "Loading", e[e.Idle = 2] = "Idle", e[e.NoResults = 3] = "NoResults", e[e.NoRecords = 4] = "NoRecords", e[e.Error = 5] = "Error", e))(I || {}), J = /* @__PURE__ */ ((e) => (e.CaCertificate = "ca_certificate", e.Certificate = "certificate", e.Consumer = "consumer", e.ConsumerGroup = "consumer_group", e.GatewayService = "service", e.Key = "key", e.KeySet = "set", e.Plugin = "plugin", e.Route = "route", e.SNI = "sni", e.Upstream = "upstream", e.Target = "target", e.Vault = "vault", e.Partial = "partial", e.CloudGatewayAddon = "cloud_gateway_addon", e.BackendCluster = "backend_cluster", e.VirtualCluster = "virtual_cluster", e.Listener = "listener", e.ProducePolicy = "produce_policy", e.ConsumePolicy = "consume_policy", e.ClusterPolicy = "cluster_policy", e.ListenerPolicy = "listener_policy", e.SchemaRegistry = "schema_registry", e.StaticKey = "static_key", e.TlsTrustBundle = "tls_trust_bundle", e.AuthServer = "auth_server", e.AuthServerScopes = "auth_server_scopes", e.AuthServerClaims = "auth_server_claims", e.AuthServerClients = "auth_server_clients", e.Other = "other", e.PluginSchema = "plugin_schema", e.CustomPlugin = "custom_plugin", e.ClonedPlugin = "cloned_plugin", e))(J || {});
|
|
106
|
-
const
|
|
105
|
+
const qe = Object.values(J), Ae = [
|
|
107
106
|
"ca_certificate",
|
|
108
107
|
"certificate",
|
|
109
108
|
"consumer",
|
|
@@ -123,17 +122,17 @@ const et = Object.values(J), Ie = [
|
|
|
123
122
|
/* Partial */
|
|
124
123
|
];
|
|
125
124
|
function Y(e) {
|
|
126
|
-
return
|
|
125
|
+
return Ae.includes(e);
|
|
127
126
|
}
|
|
128
|
-
const
|
|
129
|
-
var E = /* @__PURE__ */ ((e) => (e.ID = "id", e.IdArray = "id-array", e.Text = "plain-text", e.Date = "date", e.Redacted = "redacted", e.RedactedArray = "redacted-array", e.Json = "json", e.JsonArray = "json-array", e.BadgeTag = "badge-tag", e.CopyBadge = "copy-badge", e.BadgeStatus = "badge-status", e.BadgeMethod = "badge-method", e.LinkInternal = "link-internal", e.LinkExternal = "link-external", e))(E || {}),
|
|
130
|
-
const
|
|
131
|
-
function
|
|
127
|
+
const et = ["backend_cluster", "virtual_cluster", "listener", "produce_policy", "consume_policy", "cluster_policy", "listener_policy", "schema_registry", "static_key", "tls_trust_bundle"], tt = ["auth_server", "auth_server_scopes", "auth_server_claims", "auth_server_clients"];
|
|
128
|
+
var E = /* @__PURE__ */ ((e) => (e.ID = "id", e.IdArray = "id-array", e.Text = "plain-text", e.Date = "date", e.Redacted = "redacted", e.RedactedArray = "redacted-array", e.Json = "json", e.JsonArray = "json-array", e.BadgeTag = "badge-tag", e.CopyBadge = "copy-badge", e.BadgeStatus = "badge-status", e.BadgeMethod = "badge-method", e.LinkInternal = "link-internal", e.LinkExternal = "link-external", e))(E || {}), Ie = /* @__PURE__ */ ((e) => (e.Basic = "basic", e.Advanced = "advanced", e.Plugin = "plugin", e.Policy = "policy", e))(Ie || {});
|
|
129
|
+
const st = ["structured", "yaml", "json", "terraform", "deck"];
|
|
130
|
+
function Q() {
|
|
132
131
|
const e = (o, n) => n?.[o] ?? void 0, r = (o, n) => {
|
|
133
132
|
if (o.length !== n.length) return !1;
|
|
134
133
|
const d = /* @__PURE__ */ new Set([...o, ...n]);
|
|
135
134
|
for (const c of d) {
|
|
136
|
-
const f = o.filter((
|
|
135
|
+
const f = o.filter((k) => k === c).length, y = n.filter((k) => k === c).length;
|
|
137
136
|
if (f !== y) return !1;
|
|
138
137
|
}
|
|
139
138
|
return !0;
|
|
@@ -225,7 +224,7 @@ function S() {
|
|
|
225
224
|
redactByConfigSchema: v
|
|
226
225
|
};
|
|
227
226
|
}
|
|
228
|
-
function
|
|
227
|
+
function xe(e, r, i, t = {
|
|
229
228
|
fetchedItemsKey: "data",
|
|
230
229
|
searchKeys: ["id"]
|
|
231
230
|
}) {
|
|
@@ -235,7 +234,7 @@ function De(e, r, i, t = {
|
|
|
235
234
|
}, 200), g = m(!1), v = m(""), o = m(""), n = m([]), d = m([]), c = m(void 0), f = b(() => {
|
|
236
235
|
let p = `${e.apiBaseUrl}${G(r)}`;
|
|
237
236
|
return e.app === "konnect" && (p = p.replace(/{controlPlaneId}/gi, e?.controlPlaneId || "")), p.replace(/\/{workspace}/gi, e?.workspace ? `/${e.workspace}` : "");
|
|
238
|
-
}), { isValidUuid: y } =
|
|
237
|
+
}), { isValidUuid: y } = Q(), k = async () => {
|
|
239
238
|
try {
|
|
240
239
|
g.value = !0;
|
|
241
240
|
const { data: p } = await s.get(`${f.value}?size=${i}`);
|
|
@@ -254,8 +253,8 @@ function De(e, r, i, t = {
|
|
|
254
253
|
if (c.value === void 0)
|
|
255
254
|
try {
|
|
256
255
|
if (g.value = !0, v.value = "", o.value = "", e.app === "konnect") {
|
|
257
|
-
const _ = `${f.value}/${p}`, { data:
|
|
258
|
-
t.fetchedItemsKey in
|
|
256
|
+
const _ = `${f.value}/${p}`, { data: w } = await s.get(`${_}?size=${i}`);
|
|
257
|
+
t.fetchedItemsKey in w ? n.value = w[t.fetchedItemsKey] : w?.[t.exactMatchKey ?? "id"] ? n.value = [w] : n.value = [];
|
|
259
258
|
} else {
|
|
260
259
|
const _ = [];
|
|
261
260
|
y(p) && t.searchKeys.includes("id") ? _.push((async () => {
|
|
@@ -267,8 +266,8 @@ function De(e, r, i, t = {
|
|
|
267
266
|
return K[t.fetchedItemsKey];
|
|
268
267
|
})
|
|
269
268
|
);
|
|
270
|
-
const
|
|
271
|
-
n.value = [],
|
|
269
|
+
const w = await Promise.all(_), D = /* @__PURE__ */ new Set();
|
|
270
|
+
n.value = [], w?.forEach?.((C) => {
|
|
272
271
|
C?.forEach?.((K) => {
|
|
273
272
|
D.has(K.id) || (D.add(K.id), n.value.push(K));
|
|
274
273
|
});
|
|
@@ -281,10 +280,10 @@ function De(e, r, i, t = {
|
|
|
281
280
|
}
|
|
282
281
|
else
|
|
283
282
|
g.value = !0, o.value = "", n.value = c.value?.filter((_) => {
|
|
284
|
-
let
|
|
283
|
+
let w = !1;
|
|
285
284
|
for (const D of t.searchKeys)
|
|
286
|
-
(typeof _[D] == "string" ? _[D]?.toLowerCase() : _[D])?.includes(p.toLowerCase()) && (
|
|
287
|
-
return
|
|
285
|
+
(typeof _[D] == "string" ? _[D]?.toLowerCase() : _[D])?.includes(p.toLowerCase()) && (w = !0);
|
|
286
|
+
return w;
|
|
288
287
|
}), (!n.value || !n.value.length) && (o.value = l("debouncedFilter.errors.invalid")), g.value = !1;
|
|
289
288
|
}
|
|
290
289
|
};
|
|
@@ -294,11 +293,11 @@ function De(e, r, i, t = {
|
|
|
294
293
|
validationError: o,
|
|
295
294
|
results: n,
|
|
296
295
|
allRecords: c,
|
|
297
|
-
loadItems:
|
|
296
|
+
loadItems: k,
|
|
298
297
|
debouncedQueryChange: u
|
|
299
298
|
};
|
|
300
299
|
}
|
|
301
|
-
function
|
|
300
|
+
function De(e, r) {
|
|
302
301
|
const i = P(H, null), t = b(() => {
|
|
303
302
|
const a = h(e);
|
|
304
303
|
return (a.app === "kongManager" || !!(a.app === "konnect" && a.enableDeckConfig)) && Y(h(r));
|
|
@@ -319,7 +318,7 @@ function Ke(e, r) {
|
|
|
319
318
|
deckCalloutPreferenceKey: l
|
|
320
319
|
};
|
|
321
320
|
}
|
|
322
|
-
function
|
|
321
|
+
function Ke(e, r) {
|
|
323
322
|
const i = P(H, null), t = b(() => {
|
|
324
323
|
const a = h(e);
|
|
325
324
|
return (a.app === "kongManager" || !!(a.app === "konnect" && a.enableDeckTab)) && Y(h(r));
|
|
@@ -340,13 +339,13 @@ function Pe(e, r) {
|
|
|
340
339
|
deckCalloutPreferenceKey: l
|
|
341
340
|
};
|
|
342
341
|
}
|
|
343
|
-
function
|
|
342
|
+
function Pe(e, r) {
|
|
344
343
|
const i = G(r), t = b(
|
|
345
344
|
() => e.apiBaseUrl.startsWith("/") ? new URL(`${window.location.origin}${i}`) : new URL(i)
|
|
346
345
|
);
|
|
347
346
|
return t.value.search = "", (s) => `${t.value.href}/${s}`;
|
|
348
347
|
}
|
|
349
|
-
function
|
|
348
|
+
function Re() {
|
|
350
349
|
const { i18n: { t: e } } = O();
|
|
351
350
|
return {
|
|
352
351
|
getErrorFieldsFromError: (t) => {
|
|
@@ -416,7 +415,7 @@ function Oe() {
|
|
|
416
415
|
}
|
|
417
416
|
};
|
|
418
417
|
}
|
|
419
|
-
function
|
|
418
|
+
function Oe(e) {
|
|
420
419
|
const r = window.location.origin, i = r.endsWith("/") ? r : `${r}/`;
|
|
421
420
|
try {
|
|
422
421
|
const t = e.join("/"), s = `${i}${t}`, l = e.some((u) => u.trim() === "");
|
|
@@ -427,7 +426,7 @@ function Le(e) {
|
|
|
427
426
|
return console.warn("Failed to build valid URL:", t), "";
|
|
428
427
|
}
|
|
429
428
|
}
|
|
430
|
-
function
|
|
429
|
+
function S(e, r) {
|
|
431
430
|
const i = b(() => {
|
|
432
431
|
const s = h(e);
|
|
433
432
|
return typeof s.isExactMatch == "boolean" ? s.isExactMatch : s.app === "konnect";
|
|
@@ -453,8 +452,8 @@ function Q(e, r) {
|
|
|
453
452
|
};
|
|
454
453
|
}
|
|
455
454
|
const M = /* @__PURE__ */ new Map();
|
|
456
|
-
function
|
|
457
|
-
const t = m(!0), s = h(e), { axiosInstance: l } = T(s.axiosRequestConfig), a =
|
|
455
|
+
function Le(e, r, i) {
|
|
456
|
+
const t = m(!0), s = h(e), { axiosInstance: l } = T(s.axiosRequestConfig), a = S(e, r), u = m({
|
|
458
457
|
status: I.Idle
|
|
459
458
|
}), g = async (n) => {
|
|
460
459
|
const d = h(i) || "data";
|
|
@@ -465,9 +464,9 @@ function Ee(e, r, i) {
|
|
|
465
464
|
const f = await l.get(c);
|
|
466
465
|
if (f.status >= 400)
|
|
467
466
|
throw f;
|
|
468
|
-
const y = f.data,
|
|
467
|
+
const y = f.data, k = d && d.replace(/[^\w-_]/gi, "");
|
|
469
468
|
let A;
|
|
470
|
-
y[
|
|
469
|
+
y[k] ? A = Array.isArray(y[k]) ? y[k] : [y[k]] : Array.isArray(y) ? A = y : A = Object.keys(y).length ? [y] : [];
|
|
471
470
|
const x = {
|
|
472
471
|
data: A,
|
|
473
472
|
total: A.length,
|
|
@@ -509,7 +508,7 @@ function X(e) {
|
|
|
509
508
|
}
|
|
510
509
|
return m(1);
|
|
511
510
|
}
|
|
512
|
-
function
|
|
511
|
+
function Ee() {
|
|
513
512
|
const e = (t, s = "_") => t ? t.split(s).map((l) => l.toLowerCase() === "id" ? l.toUpperCase() : l.charAt(0).toUpperCase() + l.substring(1)).join(" ") : "", r = /(?:^|[\s-:'"])\w/g;
|
|
514
513
|
return {
|
|
515
514
|
capitalize: (t) => t ? t.replace(r, (s) => s.toUpperCase()) : "",
|
|
@@ -526,24 +525,24 @@ const Z = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([
|
|
|
526
525
|
}, U = (e) => e === "*" || e === "x" || e === "X", j = (e) => {
|
|
527
526
|
const r = parseInt(e, 10);
|
|
528
527
|
return isNaN(r) ? e : r;
|
|
529
|
-
},
|
|
528
|
+
}, Te = (e, r) => typeof e != typeof r ? [String(e), String(r)] : [e, r], $e = (e, r) => {
|
|
530
529
|
if (U(e) || U(r))
|
|
531
530
|
return 0;
|
|
532
|
-
const [i, t] =
|
|
531
|
+
const [i, t] = Te(j(e), j(r));
|
|
533
532
|
return i > t ? 1 : i < t ? -1 : 0;
|
|
534
533
|
}, F = (e, r) => {
|
|
535
534
|
for (let i = 0; i < Math.max(e.length, r.length); i++) {
|
|
536
|
-
const t =
|
|
535
|
+
const t = $e(e[i] || "0", r[i] || "0");
|
|
537
536
|
if (t !== 0)
|
|
538
537
|
return t;
|
|
539
538
|
}
|
|
540
539
|
return 0;
|
|
541
|
-
},
|
|
540
|
+
}, Me = (e, r) => {
|
|
542
541
|
const i = N(e), t = N(r), s = i.pop(), l = t.pop(), a = F(i, t);
|
|
543
542
|
return a !== 0 ? a : s && l ? F(s.split("."), l.split(".")) : s || l ? s ? -1 : 1 : 0;
|
|
544
543
|
}, B = (e, r, i) => {
|
|
545
|
-
|
|
546
|
-
const t =
|
|
544
|
+
Ne(i);
|
|
545
|
+
const t = Me(e, r);
|
|
547
546
|
return q[i].includes(t);
|
|
548
547
|
}, q = {
|
|
549
548
|
">": [1],
|
|
@@ -552,18 +551,18 @@ const Z = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([
|
|
|
552
551
|
"<=": [-1, 0],
|
|
553
552
|
"<": [-1],
|
|
554
553
|
"!=": [-1, 1]
|
|
555
|
-
}, z = Object.keys(q),
|
|
554
|
+
}, z = Object.keys(q), Ne = (e) => {
|
|
556
555
|
if (typeof e != "string")
|
|
557
556
|
throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);
|
|
558
557
|
if (z.indexOf(e) === -1)
|
|
559
558
|
throw new Error(`Invalid operator, expected one of ${z.join("|")}`);
|
|
560
|
-
},
|
|
561
|
-
function
|
|
559
|
+
}, Ue = (e) => typeof e == "string" && /^[v\d]/.test(e) && Z.test(e);
|
|
560
|
+
function je(e) {
|
|
562
561
|
const { gatewayInfo: r, supportedRange: i } = e;
|
|
563
562
|
if (!r)
|
|
564
563
|
return !0;
|
|
565
564
|
const { edition: t, version: s } = r;
|
|
566
|
-
if (!
|
|
565
|
+
if (!Ue(s))
|
|
567
566
|
return console.error("Invalid version"), !1;
|
|
568
567
|
const l = i[t];
|
|
569
568
|
if (!l)
|
|
@@ -571,7 +570,7 @@ function Fe(e) {
|
|
|
571
570
|
const [a, u] = l;
|
|
572
571
|
return !(a && B(s, a, "<") || u && B(s, u, ">"));
|
|
573
572
|
}
|
|
574
|
-
function
|
|
573
|
+
function Fe(e) {
|
|
575
574
|
const r = m(0), i = m(0), t = m(!1);
|
|
576
575
|
return ee(e, (l) => {
|
|
577
576
|
l && !t.value && (r.value = l.offsetWidth, i.value = l.scrollWidth, t.value = !0);
|
|
@@ -579,19 +578,19 @@ function Be(e) {
|
|
|
579
578
|
isTruncated: b(() => r.value < i.value)
|
|
580
579
|
};
|
|
581
580
|
}
|
|
582
|
-
function
|
|
581
|
+
function Be() {
|
|
583
582
|
const { i18n: { t: e } } = O();
|
|
584
583
|
return {
|
|
585
584
|
utf8Name: (i) => /^[\p{N}\p{L}.\-_~]*$/u.test(i) ? "" : e("validationErrors.utf8Name")
|
|
586
585
|
};
|
|
587
586
|
}
|
|
588
|
-
const R = /* @__PURE__ */ Symbol("schema"),
|
|
587
|
+
const R = /* @__PURE__ */ Symbol("schema"), ze = (e) => {
|
|
589
588
|
V(R, e);
|
|
590
|
-
},
|
|
589
|
+
}, Ge = () => P(R, void 0), Ve = (e) => {
|
|
591
590
|
const i = P(R, void 0)?.value?.fields?.find((s) => Object.keys(s)[0] === e), t = te(i?.[e]);
|
|
592
591
|
return V(R, t), t;
|
|
593
592
|
};
|
|
594
|
-
function
|
|
593
|
+
function He(e) {
|
|
595
594
|
let r = "";
|
|
596
595
|
const i = m(!1), t = m(null), s = b(() => {
|
|
597
596
|
let a;
|
|
@@ -606,28 +605,28 @@ function We(e) {
|
|
|
606
605
|
}
|
|
607
606
|
};
|
|
608
607
|
}
|
|
609
|
-
const
|
|
608
|
+
const at = {
|
|
610
609
|
useAxios: T,
|
|
611
|
-
useDebouncedFilter:
|
|
612
|
-
useDeleteUrlBuilder:
|
|
613
|
-
useBaseEntityDeckOptions:
|
|
614
|
-
useBaseFormDeckOptions:
|
|
615
|
-
useErrors:
|
|
616
|
-
useExternalLinkCreator:
|
|
617
|
-
useFetcher:
|
|
610
|
+
useDebouncedFilter: xe,
|
|
611
|
+
useDeleteUrlBuilder: Pe,
|
|
612
|
+
useBaseEntityDeckOptions: De,
|
|
613
|
+
useBaseFormDeckOptions: Ke,
|
|
614
|
+
useErrors: Re,
|
|
615
|
+
useExternalLinkCreator: Oe,
|
|
616
|
+
useFetcher: Le,
|
|
618
617
|
useFetcherCacheKey: X,
|
|
619
|
-
useFetchUrlBuilder:
|
|
620
|
-
useHelpers:
|
|
621
|
-
useStringHelpers:
|
|
618
|
+
useFetchUrlBuilder: S,
|
|
619
|
+
useHelpers: Q,
|
|
620
|
+
useStringHelpers: Ee,
|
|
622
621
|
useI18n: O,
|
|
623
|
-
useGatewayFeatureSupported:
|
|
624
|
-
useTruncationDetector:
|
|
625
|
-
useValidators:
|
|
626
|
-
useSchema:
|
|
627
|
-
useSchemaProvider:
|
|
628
|
-
useSubSchema:
|
|
629
|
-
useTableState:
|
|
630
|
-
},
|
|
622
|
+
useGatewayFeatureSupported: je,
|
|
623
|
+
useTruncationDetector: Fe,
|
|
624
|
+
useValidators: Be,
|
|
625
|
+
useSchema: Ge,
|
|
626
|
+
useSchemaProvider: ze,
|
|
627
|
+
useSubSchema: Ve,
|
|
628
|
+
useTableState: He
|
|
629
|
+
}, nt = (e, r) => {
|
|
631
630
|
const i = e.__vccOpts || e;
|
|
632
631
|
for (const [t, s] of r)
|
|
633
632
|
i[t] = s;
|
|
@@ -636,20 +635,20 @@ const nt = {
|
|
|
636
635
|
export {
|
|
637
636
|
E as C,
|
|
638
637
|
H as D,
|
|
639
|
-
|
|
638
|
+
et as E,
|
|
640
639
|
I as F,
|
|
641
|
-
|
|
640
|
+
tt as I,
|
|
642
641
|
Qe as P,
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
642
|
+
Xe as S,
|
|
643
|
+
nt as _,
|
|
644
|
+
Se as a,
|
|
646
645
|
J as b,
|
|
647
|
-
|
|
648
|
-
|
|
646
|
+
at as c,
|
|
647
|
+
qe as d,
|
|
649
648
|
W as e,
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
649
|
+
st as f,
|
|
650
|
+
Ie as g,
|
|
651
|
+
Ze as h,
|
|
652
|
+
Ae as i,
|
|
654
653
|
Y as j
|
|
655
654
|
};
|
package/dist/deck-editor.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./_plugin-vue_export-helper-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./_plugin-vue_export-helper-B_EUfOiY.cjs"),p=require("@kong-ui-public/monaco-editor"),k=require("@kong/icons"),y=require("@kong/kongponents");require("@kong-ui-public/monaco-editor/dist/runtime/style.css");const _={class:"deck-command-editor-wrapper"},f={class:"deck-command-copy-button"},C=e.defineComponent({__name:"DeckCommandEditor",props:e.mergeModels({language:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const d=e.inject("app:konnectColorMode",e.computed(()=>"light")),n=e.useModel(r,"modelValue"),{i18n:{t:c}}=a.composables.useI18n(),s={scrollbar:{alwaysConsumeMouseWheel:!1},autoIndent:"keep",editContext:!1};async function u(){await m(n.value)}async function m(l){if(navigator.clipboard)try{return await navigator.clipboard.writeText(l),!0}catch{}const o=document?.createElement("textarea");o&&(o.style.position="fixed",o.style.top="0",o.style.left="0",o.style.width="32px",o.style.height="32px",o.style.padding="0",o.style.border="none",o.style.outline="none",o.style.boxShadow="none",o.style.background="transparent",o.value=l,document?.body?.appendChild(o),o.focus(),o.select());let t;try{t=document?.execCommand("copy")}catch{t=!1}finally{document?.body?.removeChild(o)}return t}return(l,o)=>(e.openBlock(),e.createElementBlock("div",_,[(e.openBlock(),e.createBlock(e.unref(p.MonacoEditor),{key:e.unref(d),modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=t=>n.value=t),appearance:"standalone",class:"deck-command-editor",language:r.language,options:s,theme:e.unref(d)},null,8,["modelValue","language","theme"])),e.createElementVNode("div",f,[e.createVNode(e.unref(y.KCodeBlockIconButton),{"aria-label":e.unref(c)("deckCodeBlock.copy_tooltip"),"copy-tooltip":e.unref(c)("deckCodeBlock.copy_tooltip"),theme:"light",onClick:o[1]||(o[1]=t=>u())},{default:e.withCtx(()=>[e.createVNode(e.unref(k.CopyIcon),{decorative:""})]),_:1},8,["aria-label","copy-tooltip"])])]))}}),i=a._export_sfc(C,[["__scopeId","data-v-2da602e1"]]),g={},v={class:"editor-skeleton"};function b(r,d){const n=e.resolveComponent("KSkeleton");return e.openBlock(),e.createElementBlock("div",v,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(5,c=>e.createVNode(n,{key:c})),64))])}const E=a._export_sfc(g,[["render",b],["__scopeId","data-v-ec59bbd1"]]);function h(){e.provide(a.DECK_COMMAND_EDITOR_KEY,i)}exports.DeckCommandEditor=i;exports.DeckCommandEditorLoading=E;exports.provideDeckCommandEditor=h;
|
package/dist/deck-editor.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as _, inject as f, computed as k, useModel as C, openBlock as c, createElementBlock as i, createBlock as g, unref as o, createElementVNode as v, createVNode as s, withCtx as h, mergeModels as b, resolveComponent as x, Fragment as E, renderList as D, provide as M } from "vue";
|
|
2
|
-
import { c as w, _ as m, D as V } from "./_plugin-vue_export-helper-
|
|
2
|
+
import { c as w, _ as m, D as V } from "./_plugin-vue_export-helper-U0Lgy2iX.js";
|
|
3
3
|
import { MonacoEditor as B } from "@kong-ui-public/monaco-editor";
|
|
4
4
|
import { CopyIcon as I } from "@kong/icons";
|
|
5
5
|
import { KCodeBlockIconButton as K } from "@kong/kongponents";
|