@kong-ui-public/entities-shared 3.45.2 → 3.45.3-pr.3240.eaab26f65.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.
@@ -1,5 +1,5 @@
1
1
  import N from "axios";
2
- import { inject as P, ref as h, computed as _, unref as W, toValue as m, watch as se, toRef as ne, provide as J } from "vue";
2
+ import { inject as P, ref as m, computed as _, unref as W, toValue as h, watch as se, toRef as ne, provide as J } from "vue";
3
3
  import { createI18n as re, i18nTComponent as oe } from "@kong-ui-public/i18n";
4
4
  var x = /* @__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))(x || {}), Y = /* @__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))(Y || {});
5
5
  const Qe = Object.values(Y), ie = [
@@ -113,7 +113,7 @@ const pe = {
113
113
  }, ge = {
114
114
  message: "Are you sure you want to delete this {entityType}?",
115
115
  messageWithName: "Are you sure you want to delete this {entityType} {entityName}?"
116
- }, he = {
116
+ }, me = {
117
117
  actions: {
118
118
  viewConfiguration: "View configuration",
119
119
  hideConfiguration: "Hide configuration",
@@ -132,7 +132,7 @@ const pe = {
132
132
  errors: {
133
133
  edit: "The entity could not be edited at this time."
134
134
  }
135
- }, me = {
135
+ }, he = {
136
136
  emptyState: {
137
137
  noSearchResultsTitle: "No results found",
138
138
  noSearchResultsMessage: "Please adjust the criteria and try again.",
@@ -225,7 +225,8 @@ const pe = {
225
225
  copy_pat: "Make sure to copy your personal access token now. You won't be able to see it again.",
226
226
  reuse_pat: "Use an existing PAT if you've already generated one.",
227
227
  generate_pat: "Generate PAT",
228
- footer_reminder: "Changes made here won't affect your configuration."
228
+ footer_reminder: "Changes made here won't affect your configuration.",
229
+ secret_advise: "Command may contain sensitive values. Treat it as a secret."
229
230
  },
230
231
  copy_tooltip: "Copy"
231
232
  }, xe = {
@@ -253,8 +254,8 @@ const pe = {
253
254
  }, De = {
254
255
  global: pe,
255
256
  deleteModal: ge,
256
- baseForm: he,
257
- baseTable: me,
257
+ baseForm: me,
258
+ baseTable: he,
258
259
  baseConfigCard: ve,
259
260
  emptyState: be,
260
261
  filter: ye,
@@ -323,7 +324,7 @@ function Oe(e, s, r, t = {
323
324
  r || (r = "1000");
324
325
  const { axiosInstance: o } = L(e.axiosRequestConfig), { i18n: { t: n } } = R(), { debounce: a } = de(), c = a(async (d) => {
325
326
  await D(d);
326
- }, 200), l = h(!1), i = h(""), f = h(""), u = h([]), k = h([]), w = h(void 0), p = _(() => {
327
+ }, 200), l = m(!1), i = m(""), f = m(""), u = m([]), k = m([]), w = m(void 0), p = _(() => {
327
328
  let d = `${e.apiBaseUrl}${W(s)}`;
328
329
  return e.app === "konnect" && (d = d.replace(/{controlPlaneId}/gi, (e == null ? void 0 : e.controlPlaneId) || "")), d.replace(/\/{workspace}/gi, e != null && e.workspace ? `/${e.workspace}` : "");
329
330
  }), { isValidUuid: C } = Q(), y = async () => {
@@ -336,7 +337,7 @@ function Oe(e, s, r, t = {
336
337
  } finally {
337
338
  l.value = !1;
338
339
  }
339
- }, I = h(""), D = async (d) => {
340
+ }, I = m(""), D = async (d) => {
340
341
  var M, T, U;
341
342
  if (I.value !== d) {
342
343
  if (I.value = d ?? "", !d) {
@@ -397,17 +398,17 @@ function Oe(e, s, r, t = {
397
398
  const tt = Symbol("PLUGIN_FORM_LAYOUT_STATE"), q = Symbol("DECK_COMMAND_EDITOR"), Z = "[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).";
398
399
  function Pe(e, s) {
399
400
  const r = P(q, null), t = _(() => {
400
- const a = m(e);
401
- return (a.app === "kongManager" || !!(a.app === "konnect" && a.enableDeckConfig)) && H(m(s));
401
+ const a = h(e);
402
+ return (a.app === "kongManager" || !!(a.app === "konnect" && a.enableDeckConfig)) && H(h(s));
402
403
  }), o = _(() => {
403
- const a = m(e), c = a.app === "konnect" && a.enableDeckConfig && typeof a.enableDeckConfig != "boolean" ? a.enableDeckConfig.customization : void 0;
404
+ const a = h(e), c = a.app === "konnect" && a.enableDeckConfig && typeof a.enableDeckConfig != "boolean" ? a.enableDeckConfig.customization : void 0;
404
405
  if (c && !r) {
405
406
  console.warn(Z);
406
407
  return;
407
408
  }
408
409
  return c;
409
410
  }), n = _(() => {
410
- const a = m(e);
411
+ const a = h(e);
411
412
  return a.app === "konnect" && a.enableDeckConfig && typeof a.enableDeckConfig != "boolean" ? a.enableDeckConfig.calloutPreferenceKey : a.app === "kongManager" ? a.deckCalloutPreferenceKey : void 0;
412
413
  });
413
414
  return {
@@ -418,17 +419,17 @@ function Pe(e, s) {
418
419
  }
419
420
  function Re(e, s) {
420
421
  const r = P(q, null), t = _(() => {
421
- const a = m(e);
422
- return (a.app === "kongManager" || !!(a.app === "konnect" && a.enableDeckTab)) && H(m(s));
422
+ const a = h(e);
423
+ return (a.app === "kongManager" || !!(a.app === "konnect" && a.enableDeckTab)) && H(h(s));
423
424
  }), o = _(() => {
424
- const a = m(e), c = a.app === "konnect" && a.enableDeckTab && typeof a.enableDeckTab != "boolean" ? a.enableDeckTab.customization : void 0;
425
+ const a = h(e), c = a.app === "konnect" && a.enableDeckTab && typeof a.enableDeckTab != "boolean" ? a.enableDeckTab.customization : void 0;
425
426
  if (c && !r) {
426
427
  console.warn(Z);
427
428
  return;
428
429
  }
429
430
  return c;
430
431
  }), n = _(() => {
431
- const a = m(e);
432
+ const a = h(e);
432
433
  return a.app === "konnect" && a.enableDeckTab && typeof a.enableDeckTab != "boolean" ? a.enableDeckTab.calloutPreferenceKey : a.app === "kongManager" ? a.deckCalloutPreferenceKey : void 0;
433
434
  });
434
435
  return {
@@ -528,10 +529,10 @@ function $e(e) {
528
529
  }
529
530
  function X(e, s) {
530
531
  const r = _(() => {
531
- const o = m(e);
532
+ const o = h(e);
532
533
  return o.app === "konnect" || !!o.isExactMatch;
533
534
  }), t = _(() => {
534
- const o = m(s);
535
+ const o = h(s);
535
536
  return o.startsWith("/") ? new URL(`${window.location.origin}${o}`) : new URL(o);
536
537
  });
537
538
  return (o) => {
@@ -540,24 +541,24 @@ function X(e, s) {
540
541
  let u = new URL(t.value.href);
541
542
  if (r.value && f) {
542
543
  const k = new URLSearchParams(t.value.search);
543
- u.search = "", u = m(e).isExactMatch ? new URL(`${u.href}/${f}`) : new URL(`${u.href}?filter[name][contains]=${f}`), k.forEach((w, p) => u.searchParams.append(p, w));
544
+ u.search = "", u = h(e).isExactMatch ? new URL(`${u.href}/${f}`) : new URL(`${u.href}?filter[name][contains]=${f}`), k.forEach((w, p) => u.searchParams.append(p, w));
544
545
  } else
545
546
  r.value || new URLSearchParams(f).forEach((k, w) => {
546
547
  u.searchParams.append(w, k);
547
548
  }), l && u.searchParams.append("sort_by", l), i === "desc" && u.searchParams.append("sort_desc", "1"), u.searchParams.append("size", String(a));
548
549
  return c && n !== 1 && u.searchParams.append("offset", String(c)), u.href;
549
550
  } catch (u) {
550
- return console.error("RouteList(fetcher)", u), m(s);
551
+ return console.error("RouteList(fetcher)", u), h(s);
551
552
  }
552
553
  };
553
554
  }
554
555
  const j = /* @__PURE__ */ new Map();
555
556
  function Le(e, s, r) {
556
- const t = h(!0), o = m(e), { axiosInstance: n } = L(o.axiosRequestConfig), a = X(e, s), c = h({
557
+ const t = m(!0), o = h(e), { axiosInstance: n } = L(o.axiosRequestConfig), a = X(e, s), c = m({
557
558
  status: x.Idle
558
559
  }), l = async (u) => {
559
560
  var w;
560
- const k = m(r) || "data";
561
+ const k = h(r) || "data";
561
562
  try {
562
563
  c.value = t.value ? { status: x.InitialLoad } : { status: x.Loading }, t.value = !1;
563
564
  let p = a(u);
@@ -605,9 +606,9 @@ function Le(e, s, r) {
605
606
  function ee(e) {
606
607
  if (e) {
607
608
  let s = j.get(e);
608
- return s || (s = h(1), j.set(e, s)), s;
609
+ return s || (s = m(1), j.set(e, s)), s;
609
610
  }
610
- return h(1);
611
+ return m(1);
611
612
  }
612
613
  function Me() {
613
614
  const e = (t, o = "_") => t ? t.split(o).map((n) => n.toLowerCase() === "id" ? n.toUpperCase() : n.charAt(0).toUpperCase() + n.substring(1)).join(" ") : "", s = /(?:^|[\s-:'"])\w/g;
@@ -672,7 +673,7 @@ function Be(e) {
672
673
  return !(a && G(o, a, "<") || c && G(o, c, ">"));
673
674
  }
674
675
  function ze(e) {
675
- const s = h(0), r = h(0), t = h(!1);
676
+ const s = m(0), r = m(0), t = m(!1);
676
677
  return se(e, (n) => {
677
678
  n && !t.value && (s.value = n.offsetWidth, r.value = n.scrollWidth, t.value = !0);
678
679
  }), {
@@ -694,16 +695,16 @@ const $ = Symbol("schema"), Ge = (e) => {
694
695
  };
695
696
  function We(e) {
696
697
  let s = "";
697
- const r = h(!1), t = h(null), o = _(() => {
698
+ const r = m(!1), t = m(null), o = _(() => {
698
699
  let a;
699
- return r.value ? a = !0 : t.value ? a = t.value.hasData || e && m(e) : a = !1, !a;
700
+ return r.value ? a = !0 : t.value ? a = t.value.hasData || e && h(e) : a = !1, !a;
700
701
  });
701
702
  return {
702
703
  tableState: t,
703
704
  hasRecords: r,
704
705
  hideTableToolbar: o,
705
706
  handleStateChange: (a) => {
706
- a.hasData ? r.value = !0 : a.state === "success" && !a.hasData && (!e || !s) && (r.value = !1), e && (s = m(e)), t.value = { ...a };
707
+ a.hasData ? r.value = !0 : a.state === "success" && !a.hasData && (!e || !s) && (r.value = !1), e && (s = h(e)), t.value = { ...a };
707
708
  }
708
709
  };
709
710
  }
@@ -0,0 +1 @@
1
+ "use strict";const j=require("axios"),i=require("vue"),F=require("@kong-ui-public/i18n");var w=(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))(w||{}),R=(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))(R||{});const ae=Object.values(R),J=["ca_certificate","certificate","consumer","consumer_group","service","key","set","plugin","route","upstream","target","vault","partial"];function M(e){return J.includes(e)}const se=["backend_cluster","virtual_cluster","listener","produce_policy","consume_policy","cluster_policy","listener_policy","schema_registry","static_key","tls_trust_bundle"],ne=["auth_server","auth_server_scopes","auth_server_claims","auth_server_clients"];var q=(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))(q||{}),H=(e=>(e.Basic="basic",e.Advanced="advanced",e.Plugin="plugin",e.Policy="policy",e))(H||{});const re=["structured","yaml","json","terraform","deck"];function oe(){return{getAxiosInstance:(e={})=>{try{const s=i.inject("get-axios-instance",void 0);return typeof s=="function"?s(e):j.create({withCredentials:!0,timeout:3e4,...e})}catch(s){return console.warn("getAxiosInstance:",s.message||s),j.create({withCredentials:!0,timeout:3e4,...e})}},getTraceIdFromError:e=>{var s;return((s=e==null?void 0:e.response)==null?void 0:s.headers["x-datadog-trace-id"])||""}}}function ie(){return{debounce:(e,s)=>{let r;return(...t)=>{clearTimeout(r),r=window==null?void 0:window.setTimeout(()=>{e(...t)},s)}}}}const O="khcp-user-table-preferences",ce={pageSize:30,sortColumnKey:void 0,sortColumnOrder:void 0,columnVisibility:{}};function le(){const e=r=>{if(typeof r=="string")try{return JSON.parse(r)}catch(t){console.error("useTablePreferences(tryParseJson)",t);return}},s=()=>{const r=e(localStorage.getItem(O));return!r||!Object.keys(r).length?new Map:new Map(Object.entries(r))};return{setTablePreferences:(r,t)=>{try{const o=s();o.set(r,t),localStorage.setItem(O,JSON.stringify(Object.fromEntries(o.entries())))}catch(o){console.error("useTablePreferences(setTablePreferences)",o)}},getTablePreferences:(r,t)=>{const o=s();return(o==null?void 0:o.get(r))||void 0||t||ce},deleteAllTablePreferences:()=>{localStorage.removeItem(O)}}}function K(e={}){const{getAxiosInstance:s}=oe();return{axiosInstance:s(e)}}const ue={actions:{copyId:"Copy ID",copied_id:'Copied "{id}" to the clipboard',copyToClipboard:"Copied successfully!",copyToClipboardFailed:"Failed to copy to the clipboard"}},de={message:"Are you sure you want to delete this {entityType}?",messageWithName:"Are you sure you want to delete this {entityType} {entityName}?"},fe={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."}},pe={emptyState:{noSearchResultsTitle:"No results found",noSearchResultsMessage:"Please adjust the criteria and try again.",noSearchResultsCtaText:"Clear"}},ge={title:"Configuration",actions:{copy:"Copy JSON",deck_customize:"Customize before copying to CLI",deck_customize_cancel:"Cancel",sensitive_fields:"Show sensitive fields"},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"}},me={learnMore:"Learn more",pricingTitle:"Pricing: "},he={filterButtonText:"Filter",fieldLabel:"Filter by:",inputPlaceholder:"Enter a value",selectPlaceholder:"Select an item",applyButtonText:"Apply",clearButtonText:"Clear",clearAllButtonText:"Clear all filters"},ve={errors:{fetch:"Could not fetch available items",invalid:"Please select a valid value"}},be={unexpected:"An unexpected error has occurred",dataKeyUndefined:'The data key "{dataKey}" does not exist in the response.'},ye={utf8Name:"The name can be any string containing characters, letters, numbers, or the following characters: ., -, _, or ~. Do not use spaces."},_e={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"}},Ce={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 made here won't affect your configuration.",secret_advise:"Command may contain sensitive values. Treat it as a secret."},copy_tooltip:"Copy"},we={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"},ke={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…"}},Ae={global:ue,deleteModal:de,baseForm:fe,baseTable:pe,baseConfigCard:ge,emptyState:me,filter:he,debouncedFilter:ve,errors:be,validationErrors:ye,toggleModal:_e,deckCodeBlock:Ce,deckCallout:we,generatePatModal:ke};function D(){const e=F.createI18n("en-us",Ae);return{i18n:e,i18nT:F.i18nTComponent(e)}}function Q(){const e=(n,a)=>(a==null?void 0:a[n])??void 0,s=(n,a)=>{if(n.length!==a.length)return!1;const u=new Set([...n,...a]);for(const l of u){const c=n.filter(d=>d===l).length,p=a.filter(d=>d===l).length;if(c!==p)return!1}return!0};return{getPropValue:e,objectsAreEqual:(n,a,u)=>{if(u){if(Object.keys(n).length===Object.keys(a).length)for(const l in n)if(Array.isArray(n[l])&&Array.isArray(a[l])){if(s(n[l],a[l]))continue;return!1}else{if(n[l]===a[l])continue;return!1}else return!1;return!0}try{return JSON.stringify(n)===JSON.stringify(a)}catch{return!1}},sortAlpha:n=>(a,u)=>{let l=a[n]===void 0||a[n]===null?"":a[n],c=u[n]===void 0||u[n]===null?"":u[n];return Array.isArray(a[n])&&(l=a[n][0]),Array.isArray(u[n])&&(c=u[n][0]),l.localeCompare(c)},isValidUuid:n=>n?/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/.test(n):!1}}function Ie(e,s,r,t={fetchedItemsKey:"data",searchKeys:["id"]}){r||(r="1000");const{axiosInstance:o}=K(e.axiosRequestConfig),{i18n:{t:n}}=D(),{debounce:a}=ie(),u=a(async f=>{await I(f)},200),l=i.ref(!1),c=i.ref(""),p=i.ref(""),d=i.ref([]),_=i.ref([]),y=i.ref(void 0),g=i.computed(()=>{let f=`${e.apiBaseUrl}${i.unref(s)}`;return e.app==="konnect"&&(f=f.replace(/{controlPlaneId}/gi,(e==null?void 0:e.controlPlaneId)||"")),f.replace(/\/{workspace}/gi,e!=null&&e.workspace?`/${e.workspace}`:"")}),{isValidUuid:C}=Q(),b=async()=>{try{l.value=!0;const{data:f}=await o.get(`${g.value}?size=${r}`);f!=null&&f.next||(y.value=t.fetchedItemsKey in f?f[t.fetchedItemsKey]:[]),_.value=t.fetchedItemsKey in f?f[t.fetchedItemsKey]:[],d.value=_.value}catch{d.value=[],c.value=n("debouncedFilter.errors.fetch")}finally{l.value=!1}},A=i.ref(""),I=async f=>{var L,$,U;if(A.value!==f){if(A.value=f??"",!f){d.value=_.value;return}if(y.value===void 0)try{if(l.value=!0,c.value="",p.value="",e.app==="konnect"){const v=`${g.value}/${f}`,{data:h}=await o.get(`${v}?size=${r}`);t.fetchedItemsKey in h?d.value=h[t.fetchedItemsKey]:h!=null&&h[t.exactMatchKey??"id"]?d.value=[h]:d.value=[]}else{const v=[];C(f)&&t.searchKeys.includes("id")?v.push((async()=>{const{data:m}=await o.get(`${g.value}/${f}`);return[m[t.fetchedItemsKey]??m]})()):v.push(...t.searchKeys.filter(m=>m!=="id").map(async m=>{const{data:k}=await o.get(`${g.value}?${m}=${f}`);return k[t.fetchedItemsKey]}));const h=await Promise.all(v),x=new Set;d.value=[],(L=h==null?void 0:h.forEach)==null||L.call(h,m=>{var k;(k=m==null?void 0:m.forEach)==null||k.call(m,E=>{x.has(E.id)||(x.add(E.id),d.value.push(E))})})}}catch(v){(($=v==null?void 0:v.response)==null?void 0:$.status)===404?p.value=n("debouncedFilter.errors.invalid"):(d.value=[],c.value=n("debouncedFilter.errors.fetch"))}finally{l.value=!1}else l.value=!0,p.value="",d.value=(U=y.value)==null?void 0:U.filter(v=>{var x;let h=!1;for(const m of t.searchKeys){const k=typeof v[m]=="string"?(x=v[m])==null?void 0:x.toLowerCase():v[m];k!=null&&k.includes(f.toLowerCase())&&(h=!0)}return h}),(!d.value||!d.value.length)&&(p.value=n("debouncedFilter.errors.invalid")),l.value=!1}};return{loading:l,error:c,validationError:p,results:d,allRecords:y,loadItems:b,debouncedQueryChange:u}}const xe=Symbol("PLUGIN_FORM_LAYOUT_STATE"),N=Symbol("DECK_COMMAND_EDITOR"),P="[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).";function De(e,s){const r=i.inject(N,null),t=i.computed(()=>{const a=i.toValue(e);return(a.app==="kongManager"||!!(a.app==="konnect"&&a.enableDeckConfig))&&M(i.toValue(s))}),o=i.computed(()=>{const a=i.toValue(e),u=a.app==="konnect"&&a.enableDeckConfig&&typeof a.enableDeckConfig!="boolean"?a.enableDeckConfig.customization:void 0;if(u&&!r){console.warn(P);return}return u}),n=i.computed(()=>{const a=i.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:o,deckCalloutPreferenceKey:n}}function Ee(e,s){const r=i.inject(N,null),t=i.computed(()=>{const a=i.toValue(e);return(a.app==="kongManager"||!!(a.app==="konnect"&&a.enableDeckTab))&&M(i.toValue(s))}),o=i.computed(()=>{const a=i.toValue(e),u=a.app==="konnect"&&a.enableDeckTab&&typeof a.enableDeckTab!="boolean"?a.enableDeckTab.customization:void 0;if(u&&!r){console.warn(P);return}return u}),n=i.computed(()=>{const a=i.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:o,deckCalloutPreferenceKey:n}}function Oe(e,s){const r=i.unref(s),t=i.computed(()=>e.apiBaseUrl.startsWith("/")?new URL(`${window.location.origin}${r}`):new URL(r));return t.value.search="",o=>`${t.value.href}/${o}`}function Te(){const{i18n:{t:e}}=D();return{getErrorFieldsFromError:t=>{var a,u,l;if(!t)return{messages:[e("errors.unexpected")],fields:[]};if(((a=t==null?void 0:t.response)==null?void 0:a.status)===401)return{messages:[],fields:[]};let o=[e("errors.unexpected")];const n=[];if((u=t==null?void 0:t.response)!=null&&u.data){if((l=t.response.data.details)!=null&&l.length)return o=[],t.response.data.details.forEach(c=>{let p=e("errors.unexpected");c.messages&&Array.isArray(c.messages)&&c.messages.length&&(p=c.messages.join(", ")),c.field&&n.push({field:c.field,message:p}),o.push(`${c.field??""} ${p}`)}),{messages:o,fields:n};if(t.response.data.message&&Array.isArray(t.response.data.message))return o=[],t.response.data.message.forEach(c=>{if(c!=null&&c.constraints){const p=Object.values(c.constraints).join(", ");o.push(p),c.property&&n.push({field:c.property,message:p})}else c!=null&&c.property&&(c!=null&&c.message)?(n.push({field:c.property,message:c.message}),o.push(c.message)):o.push(c)}),{messages:o,fields:n};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 o=[],Object.keys(t.response.data).forEach(c=>{n.push({field:c,message:t.response.data[c]}),o.push(t.response.data[c])}),{messages:o,fields:n}}return{messages:[t.message||e("errors.unexpected")],fields:[]}},getMessageFromError:t=>{var o,n,a,u;if(!t)return e("errors.unexpected");if(((o=t==null?void 0:t.response)==null?void 0:o.status)===401)return console.warn("getMessageFromError: User auth token is expired or missing, returning empty message."),"";if((n=t==null?void 0:t.response)!=null&&n.data){if(t.response.data.detail)return t.response.data.detail;if((a=t.response.data.details)!=null&&a.length)return t.response.data.details.map(l=>{let c=e("errors.unexpected");return l.messages&&typeof l.messages=="object"&&l.messages.length&&(c=l.messages.join(", ")),l.field?`${l.field} - ${c}`:c}).join("; ");if(t.response.data.message){const{message:l}=t.response.data;return Array.isArray(l)?(u=l[0])!=null&&u.constraints?Object.values(l[0].constraints)[0]:l[0]:l}if(typeof t.response.data=="string")return t.response.data;if(typeof t.response.data=="object")return Object.keys(t.response.data).map(l=>`${l} ${t.response.data[l]}`).join(", ")}return t.message||e("errors.unexpected")}}}function Re(e){const s=window.location.origin,r=s.endsWith("/")?s:`${s}/`;try{const t=e.join("/"),o=`${r}${t}`,n=e.some(u=>u.trim()==="");if(/^(https:\/\/(www\.)?([a-zA-Z0-9-]+\.){1,}[a-zA-Z]{2,}(:[0-9]+)?(\/[^\/]+)*)$|^(https|http):\/\/localhost(:[0-9]+)?(\/[^\/]+)*$/.test(o)&&!n&&new URL(o))return`${r}${t}`;throw new Error("Invalid url")}catch(t){return console.warn("Failed to build valid URL:",t),""}}function Z(e,s){const r=i.computed(()=>{const o=i.toValue(e);return o.app==="konnect"||!!o.isExactMatch}),t=i.computed(()=>{const o=i.toValue(s);return o.startsWith("/")?new URL(`${window.location.origin}${o}`):new URL(o)});return o=>{const{page:n,pageSize:a,offset:u,sortColumnKey:l,sortColumnOrder:c,query:p}=o;try{let d=new URL(t.value.href);if(r.value&&p){const _=new URLSearchParams(t.value.search);d.search="",d=i.toValue(e).isExactMatch?new URL(`${d.href}/${p}`):new URL(`${d.href}?filter[name][contains]=${p}`),_.forEach((y,g)=>d.searchParams.append(g,y))}else r.value||new URLSearchParams(p).forEach((_,y)=>{d.searchParams.append(y,_)}),l&&d.searchParams.append("sort_by",l),c==="desc"&&d.searchParams.append("sort_desc","1"),d.searchParams.append("size",String(a));return u&&n!==1&&d.searchParams.append("offset",String(u)),d.href}catch(d){return console.error("RouteList(fetcher)",d),i.toValue(s)}}}const V=new Map;function Me(e,s,r){const t=i.ref(!0),o=i.toValue(e),{axiosInstance:n}=K(o.axiosRequestConfig),a=Z(e,s),u=i.ref({status:w.Idle}),l=async d=>{var y;const _=i.toValue(r)||"data";try{u.value=t.value?{status:w.InitialLoad}:{status:w.Loading},t.value=!1;let g=a(d);g.includes("filter[name]")&&(g=`${g}&page[size]=${d.pageSize}&page[number]=${d.page}`);const C=await n.get(g);if(C.status>=400)throw C;const b=C.data,A=_&&_.replace(/[^\w-_]/gi,"");let I;b[A]?I=Array.isArray(b[A])?b[A]:[b[A]]:Array.isArray(b)?I=b:I=Object.keys(b).length?[b]:[];const f={data:I,total:I.length,...b.offset?{pagination:{offset:b.offset}}:null};return f.data.length===0&&!d.query?u.value={status:w.NoRecords,response:f}:u.value={status:w.Idle,response:f},f}catch(g){const C={data:[],total:0};return d.query&&(((y=g.response)==null?void 0:y.status)===404||g.status===404)?(u.value={status:w.NoResults,response:C,error:g.response?g:{response:g}},C):(u.value={status:w.Error,response:C,error:g.response?g:{response:g}},C)}},c=o.cacheIdentifier,p=X(c);return{fetcher:l,fetcherState:u,fetcherCacheKey:p}}function X(e){if(e){let s=V.get(e);return s||(s=i.ref(1),V.set(e,s)),s}return i.ref(1)}function Ke(){const e=(t,o="_")=>t?t.split(o).map(n=>n.toLowerCase()==="id"?n.toUpperCase():n.charAt(0).toUpperCase()+n.substring(1)).join(" "):"",s=/(?:^|[\s-:'"])\w/g;return{capitalize:t=>t?t.replace(s,o=>o.toUpperCase()):"",convertKeyToTitle:e}}const ee=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,S=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const s=e.match(ee);if(!s)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return s.shift(),s},B=e=>e==="*"||e==="x"||e==="X",z=e=>{const s=parseInt(e,10);return isNaN(s)?e:s},Ne=(e,s)=>typeof e!=typeof s?[String(e),String(s)]:[e,s],Pe=(e,s)=>{if(B(e)||B(s))return 0;const[r,t]=Ne(z(e),z(s));return r>t?1:r<t?-1:0},G=(e,s)=>{for(let r=0;r<Math.max(e.length,s.length);r++){const t=Pe(e[r]||"0",s[r]||"0");if(t!==0)return t}return 0},Le=(e,s)=>{const r=S(e),t=S(s),o=r.pop(),n=t.pop(),a=G(r,t);return a!==0?a:o&&n?G(o.split("."),n.split(".")):o||n?o?-1:1:0},W=(e,s,r)=>{$e(r);const t=Le(e,s);return te[r].includes(t)},te={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},Y=Object.keys(te),$e=e=>{if(typeof e!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);if(Y.indexOf(e)===-1)throw new Error(`Invalid operator, expected one of ${Y.join("|")}`)},Ue=e=>typeof e=="string"&&/^[v\d]/.test(e)&&ee.test(e);function je(e){const{gatewayInfo:s,supportedRange:r}=e;if(!s)return!0;const{edition:t,version:o}=s;if(!Ue(o))return console.error("Invalid version"),!1;const n=r[t];if(!n)return!1;const[a,u]=n;return!(a&&W(o,a,"<")||u&&W(o,u,">"))}function Fe(e){const s=i.ref(0),r=i.ref(0),t=i.ref(!1);return i.watch(e,n=>{n&&!t.value&&(s.value=n.offsetWidth,r.value=n.scrollWidth,t.value=!0)}),{isTruncated:i.computed(()=>s.value<r.value)}}function Ve(){const{i18n:{t:e}}=D();return{utf8Name:r=>/^[\p{N}\p{L}.\-_~]*$/u.test(r)?"":e("validationErrors.utf8Name")}}const T=Symbol("schema"),Se=e=>{i.provide(T,e)},Be=e=>{var o,n;const s=i.inject(T,void 0),r=(n=(o=s==null?void 0:s.value)==null?void 0:o.fields)==null?void 0:n.find(a=>Object.keys(a)[0]===e),t=i.toRef(r==null?void 0:r[e]);return i.provide(T,t),t};function ze(e){let s="";const r=i.ref(!1),t=i.ref(null),o=i.computed(()=>{let a;return r.value?a=!0:t.value?a=t.value.hasData||e&&i.toValue(e):a=!1,!a});return{tableState:t,hasRecords:r,hideTableToolbar:o,handleStateChange:a=>{a.hasData?r.value=!0:a.state==="success"&&!a.hasData&&(!e||!s)&&(r.value=!1),e&&(s=i.toValue(e)),t.value={...a}}}}const Ge={useAxios:K,useDebouncedFilter:Ie,useDeleteUrlBuilder:Oe,useBaseEntityDeckOptions:De,useBaseFormDeckOptions:Ee,useErrors:Te,useExternalLinkCreator:Re,useFetcher:Me,useFetcherCacheKey:X,useFetchUrlBuilder:Z,useHelpers:Q,useStringHelpers:Ke,useI18n:D,useGatewayFeatureSupported:je,useTruncationDetector:Fe,useValidators:Ve,useSchemaProvider:Se,useSubSchema:Be,useTableState:ze},We=(e,s)=>{const r=e.__vccOpts||e;for(const[t,o]of s)r[t]=o;return r};exports.CONFIG_CARD_FORMATS=re;exports.ConfigurationSchemaSection=H;exports.ConfigurationSchemaType=q;exports.DECK_COMMAND_EDITOR_KEY=N;exports.DECK_COMMAND_EDITOR_MISSING_WARNING=P;exports.EventGatewayTypesArray=se;exports.FetcherStatus=w;exports.IdentityTypesArray=ne;exports.PLUGIN_FORM_LAYOUT_STATE=xe;exports.SupportedEntityDeckArray=J;exports.SupportedEntityType=R;exports.SupportedEntityTypesArray=ae;exports._export_sfc=We;exports.composables=Ge;exports.ft=le;exports.isSupportedDeckEntityType=M;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./_plugin-vue_export-helper-B2WhlBkH.cjs"),k=require("@kong-ui-public/monaco-editor"),y=require("@kong/icons"),_=require("@kong/kongponents");require("@kong-ui-public/monaco-editor/dist/runtime/style.css");const f={class:"deck-command-editor-wrapper"},C={class:"deck-command-copy-button"},g=e.defineComponent({__name:"DeckCommandEditor",props:e.mergeModels({language:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const n=e.useModel(r,"modelValue"),{i18n:{t:c}}=a.composables.useI18n(),d={scrollbar:{alwaysConsumeMouseWheel:!1},autoIndent:"keep",editContext:!1};async function m(){await p(n.value)}async function p(l){var i,s;if(navigator.clipboard)try{return await navigator.clipboard.writeText(l),!0}catch{}const o=document==null?void 0: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,(i=document==null?void 0:document.body)==null||i.appendChild(o),o.focus(),o.select());let t;try{t=document==null?void 0:document.execCommand("copy")}catch{t=!1}finally{(s=document==null?void 0:document.body)==null||s.removeChild(o)}return t}return(l,o)=>(e.openBlock(),e.createElementBlock("div",f,[e.createVNode(e.unref(k.MonacoEditor),{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=t=>n.value=t),appearance:"standalone",class:"deck-command-editor",language:r.language,options:d,theme:"light"},null,8,["modelValue","language"]),e.createElementVNode("div",C,[e.createVNode(e.unref(_.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=>m())},{default:e.withCtx(()=>[e.createVNode(e.unref(y.CopyIcon),{decorative:""})]),_:1},8,["aria-label","copy-tooltip"])])]))}}),u=a._export_sfc(g,[["__scopeId","data-v-c024a8eb"]]),v={},b={class:"editor-skeleton"};function E(r,n){const c=e.resolveComponent("KSkeleton");return e.openBlock(),e.createElementBlock("div",b,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(5,d=>e.createVNode(c,{key:d})),64))])}const h=a._export_sfc(v,[["render",E],["__scopeId","data-v-ec59bbd1"]]);function x(){e.provide(a.DECK_COMMAND_EDITOR_KEY,u)}exports.DeckCommandEditor=u;exports.DeckCommandEditorLoading=h;exports.provideDeckCommandEditor=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./_plugin-vue_export-helper-B5cQfgfE.cjs"),k=require("@kong-ui-public/monaco-editor"),y=require("@kong/icons"),_=require("@kong/kongponents");require("@kong-ui-public/monaco-editor/dist/runtime/style.css");const f={class:"deck-command-editor-wrapper"},C={class:"deck-command-copy-button"},g=e.defineComponent({__name:"DeckCommandEditor",props:e.mergeModels({language:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const n=e.useModel(r,"modelValue"),{i18n:{t:c}}=a.composables.useI18n(),d={scrollbar:{alwaysConsumeMouseWheel:!1},autoIndent:"keep",editContext:!1};async function m(){await p(n.value)}async function p(l){var i,s;if(navigator.clipboard)try{return await navigator.clipboard.writeText(l),!0}catch{}const o=document==null?void 0: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,(i=document==null?void 0:document.body)==null||i.appendChild(o),o.focus(),o.select());let t;try{t=document==null?void 0:document.execCommand("copy")}catch{t=!1}finally{(s=document==null?void 0:document.body)==null||s.removeChild(o)}return t}return(l,o)=>(e.openBlock(),e.createElementBlock("div",f,[e.createVNode(e.unref(k.MonacoEditor),{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=t=>n.value=t),appearance:"standalone",class:"deck-command-editor",language:r.language,options:d,theme:"light"},null,8,["modelValue","language"]),e.createElementVNode("div",C,[e.createVNode(e.unref(_.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=>m())},{default:e.withCtx(()=>[e.createVNode(e.unref(y.CopyIcon),{decorative:""})]),_:1},8,["aria-label","copy-tooltip"])])]))}}),u=a._export_sfc(g,[["__scopeId","data-v-c024a8eb"]]),v={},b={class:"editor-skeleton"};function E(r,n){const c=e.resolveComponent("KSkeleton");return e.openBlock(),e.createElementBlock("div",b,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(5,d=>e.createVNode(c,{key:d})),64))])}const h=a._export_sfc(v,[["render",E],["__scopeId","data-v-ec59bbd1"]]);function x(){e.provide(a.DECK_COMMAND_EDITOR_KEY,u)}exports.DeckCommandEditor=u;exports.DeckCommandEditorLoading=h;exports.provideDeckCommandEditor=x;
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as f, useModel as k, openBlock as s, createElementBlock as i, createVNode as c, unref as t, createElementVNode as C, withCtx as g, mergeModels as v, resolveComponent as b, Fragment as h, renderList as x, provide as E } from "vue";
2
- import { c as D, _ as u, D as w } from "./_plugin-vue_export-helper-BuUBqezl.js";
2
+ import { c as D, _ as u, D as w } from "./_plugin-vue_export-helper-81qp9EEZ.js";
3
3
  import { MonacoEditor as V } from "@kong-ui-public/monaco-editor";
4
4
  import { CopyIcon as I } from "@kong/icons";
5
5
  import { KCodeBlockIconButton as M } from "@kong/kongponents";