@kong-ui-public/entities-shared 3.43.3 → 3.44.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/dist/_plugin-vue_export-helper-BVLVXTg1.cjs +1 -0
- package/dist/_plugin-vue_export-helper-DD7nKH1E.js +747 -0
- package/dist/deck-editor.cjs.js +1 -0
- package/dist/deck-editor.es.js +86 -0
- package/dist/entities-shared.cjs.js +66 -0
- package/dist/entities-shared.es.js +4756 -53
- package/dist/style.css +1 -1
- package/dist/types/components/common/DeckCodeBlockInternal.vue.d.ts.map +1 -1
- package/dist/types/composables/useDeckOptions.d.ts.map +1 -1
- package/dist/types/constants.d.ts +21 -0
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/deck-editor.d.ts +18 -0
- package/dist/types/deck-editor.d.ts.map +1 -0
- package/dist/types/types/deck.d.ts +7 -0
- package/dist/types/types/deck.d.ts.map +1 -1
- package/package.json +11 -6
- package/dist/DeckCommandEditor-DeA1RUW0.js +0 -74
- package/dist/entities-shared.umd.js +0 -66
- package/dist/index-Bd4O1eIT.js +0 -5482
|
@@ -0,0 +1,747 @@
|
|
|
1
|
+
import N from "axios";
|
|
2
|
+
import { inject as R, ref as m, computed as _, unref as W, toValue as h, watch as se, toRef as ne, provide as J } from "vue";
|
|
3
|
+
import { createI18n as re, i18nTComponent as oe } from "@kong-ui-public/i18n";
|
|
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
|
+
const Qe = Object.values(Y), ie = [
|
|
6
|
+
"ca_certificate",
|
|
7
|
+
"certificate",
|
|
8
|
+
"consumer",
|
|
9
|
+
"consumer_group",
|
|
10
|
+
"service",
|
|
11
|
+
"key",
|
|
12
|
+
"set",
|
|
13
|
+
"plugin",
|
|
14
|
+
"route",
|
|
15
|
+
"upstream",
|
|
16
|
+
"target",
|
|
17
|
+
"vault",
|
|
18
|
+
"partial"
|
|
19
|
+
/* Partial */
|
|
20
|
+
];
|
|
21
|
+
function H(e) {
|
|
22
|
+
return ie.includes(e);
|
|
23
|
+
}
|
|
24
|
+
const qe = ["backend_cluster", "virtual_cluster", "listener", "produce_policy", "consume_policy", "cluster_policy", "listener_policy", "schema_registry", "static_key", "tls_trust_bundle"], Ze = ["auth_server", "auth_server_scopes", "auth_server_claims", "auth_server_clients"];
|
|
25
|
+
var le = /* @__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))(le || {}), ce = /* @__PURE__ */ ((e) => (e.Basic = "basic", e.Advanced = "advanced", e.Plugin = "plugin", e.Policy = "policy", e))(ce || {});
|
|
26
|
+
const Xe = ["structured", "yaml", "json", "terraform", "deck"];
|
|
27
|
+
function ue() {
|
|
28
|
+
return {
|
|
29
|
+
getAxiosInstance: (e = {}) => {
|
|
30
|
+
try {
|
|
31
|
+
const s = R("get-axios-instance", void 0);
|
|
32
|
+
return typeof s == "function" ? s(e) : N.create({
|
|
33
|
+
withCredentials: !0,
|
|
34
|
+
timeout: 3e4,
|
|
35
|
+
...e
|
|
36
|
+
});
|
|
37
|
+
} catch (s) {
|
|
38
|
+
return console.warn("getAxiosInstance:", s.message || s), N.create({
|
|
39
|
+
withCredentials: !0,
|
|
40
|
+
timeout: 3e4,
|
|
41
|
+
...e
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
getTraceIdFromError: (e) => {
|
|
46
|
+
var s;
|
|
47
|
+
return ((s = e == null ? void 0 : e.response) == null ? void 0 : s.headers["x-datadog-trace-id"]) || "";
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function de() {
|
|
52
|
+
return {
|
|
53
|
+
debounce: (e, s) => {
|
|
54
|
+
let r;
|
|
55
|
+
return (...t) => {
|
|
56
|
+
clearTimeout(r), r = window == null ? void 0 : window.setTimeout(() => {
|
|
57
|
+
e(...t);
|
|
58
|
+
}, s);
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const E = "khcp-user-table-preferences", fe = {
|
|
64
|
+
pageSize: 30,
|
|
65
|
+
sortColumnKey: void 0,
|
|
66
|
+
sortColumnOrder: void 0,
|
|
67
|
+
columnVisibility: {}
|
|
68
|
+
};
|
|
69
|
+
function et() {
|
|
70
|
+
const e = (r) => {
|
|
71
|
+
if (typeof r == "string")
|
|
72
|
+
try {
|
|
73
|
+
return JSON.parse(r);
|
|
74
|
+
} catch (t) {
|
|
75
|
+
console.error("useTablePreferences(tryParseJson)", t);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
}, s = () => {
|
|
79
|
+
const r = e(localStorage.getItem(E));
|
|
80
|
+
return !r || !Object.keys(r).length ? /* @__PURE__ */ new Map() : new Map(Object.entries(r));
|
|
81
|
+
};
|
|
82
|
+
return {
|
|
83
|
+
setTablePreferences: (r, t) => {
|
|
84
|
+
try {
|
|
85
|
+
const o = s();
|
|
86
|
+
o.set(r, t), localStorage.setItem(E, JSON.stringify(Object.fromEntries(o.entries())));
|
|
87
|
+
} catch (o) {
|
|
88
|
+
console.error("useTablePreferences(setTablePreferences)", o);
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
getTablePreferences: (r, t) => {
|
|
92
|
+
const o = s();
|
|
93
|
+
return (o == null ? void 0 : o.get(r)) || void 0 || t || fe;
|
|
94
|
+
},
|
|
95
|
+
deleteAllTablePreferences: () => {
|
|
96
|
+
localStorage.removeItem(E);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function L(e = {}) {
|
|
101
|
+
const { getAxiosInstance: s } = ue();
|
|
102
|
+
return {
|
|
103
|
+
axiosInstance: s(e)
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
const pe = {
|
|
107
|
+
actions: {
|
|
108
|
+
copyId: "Copy ID",
|
|
109
|
+
copied_id: 'Copied "{id}" to the clipboard',
|
|
110
|
+
copyToClipboard: "Copied successfully!",
|
|
111
|
+
copyToClipboardFailed: "Failed to copy to the clipboard"
|
|
112
|
+
}
|
|
113
|
+
}, ge = {
|
|
114
|
+
message: "Are you sure you want to delete this {entityType}?",
|
|
115
|
+
messageWithName: "Are you sure you want to delete this {entityType} {entityName}?"
|
|
116
|
+
}, me = {
|
|
117
|
+
actions: {
|
|
118
|
+
viewConfiguration: "View configuration",
|
|
119
|
+
hideConfiguration: "Hide configuration",
|
|
120
|
+
save: "Save",
|
|
121
|
+
cancel: "Cancel",
|
|
122
|
+
back: "Back"
|
|
123
|
+
},
|
|
124
|
+
configuration: {
|
|
125
|
+
title: "Configuration",
|
|
126
|
+
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.",
|
|
127
|
+
yaml: "YAML",
|
|
128
|
+
json: "JSON",
|
|
129
|
+
terraform: "Terraform",
|
|
130
|
+
deck: "decK"
|
|
131
|
+
},
|
|
132
|
+
errors: {
|
|
133
|
+
edit: "The entity could not be edited at this time."
|
|
134
|
+
}
|
|
135
|
+
}, he = {
|
|
136
|
+
emptyState: {
|
|
137
|
+
noSearchResultsTitle: "No results found",
|
|
138
|
+
noSearchResultsMessage: "Please adjust the criteria and try again.",
|
|
139
|
+
noSearchResultsCtaText: "Clear"
|
|
140
|
+
}
|
|
141
|
+
}, ve = {
|
|
142
|
+
title: "Configuration",
|
|
143
|
+
actions: {
|
|
144
|
+
copy: "Copy JSON",
|
|
145
|
+
deck_customize: "Customize before copying to CLI",
|
|
146
|
+
deck_customize_cancel: "Cancel"
|
|
147
|
+
},
|
|
148
|
+
sections: {
|
|
149
|
+
advanced: "Advanced",
|
|
150
|
+
plugin: "Plugin Specific Configuration",
|
|
151
|
+
policy: "Policy Specific Configuration"
|
|
152
|
+
},
|
|
153
|
+
commonFields: {
|
|
154
|
+
id_label: "ID",
|
|
155
|
+
name_label: "Name",
|
|
156
|
+
enabled_label: "Enabled",
|
|
157
|
+
enabled_tooltip: "Enabled is FTW",
|
|
158
|
+
updated_at_label: "Last Updated",
|
|
159
|
+
created_at_label: "Created",
|
|
160
|
+
tags_label: "Tags",
|
|
161
|
+
link: "Link",
|
|
162
|
+
partial_label: "Redis Configuration"
|
|
163
|
+
},
|
|
164
|
+
statusBadge: {
|
|
165
|
+
enabledLabel: "Enabled",
|
|
166
|
+
disabledLabel: "Disabled"
|
|
167
|
+
},
|
|
168
|
+
copy: {
|
|
169
|
+
tooltip: "Copy {label}",
|
|
170
|
+
success: "Copied!"
|
|
171
|
+
},
|
|
172
|
+
errors: {
|
|
173
|
+
load: "The entity configuration data could not be loaded at this time.",
|
|
174
|
+
copy: "Failed to copy to clipboard"
|
|
175
|
+
},
|
|
176
|
+
general: {
|
|
177
|
+
entryTitle: "Entry {index}",
|
|
178
|
+
structuredFormat: "Structured"
|
|
179
|
+
}
|
|
180
|
+
}, be = {
|
|
181
|
+
learnMore: "Learn more",
|
|
182
|
+
pricingTitle: "Pricing: "
|
|
183
|
+
}, ye = {
|
|
184
|
+
filterButtonText: "Filter",
|
|
185
|
+
fieldLabel: "Filter by:",
|
|
186
|
+
inputPlaceholder: "Enter a value",
|
|
187
|
+
selectPlaceholder: "Select an item",
|
|
188
|
+
applyButtonText: "Apply",
|
|
189
|
+
clearButtonText: "Clear",
|
|
190
|
+
clearAllButtonText: "Clear all filters"
|
|
191
|
+
}, _e = {
|
|
192
|
+
errors: {
|
|
193
|
+
fetch: "Could not fetch available items",
|
|
194
|
+
invalid: "Please select a valid value"
|
|
195
|
+
}
|
|
196
|
+
}, Ce = {
|
|
197
|
+
unexpected: "An unexpected error has occurred",
|
|
198
|
+
dataKeyUndefined: 'The data key "{dataKey}" does not exist in the response.'
|
|
199
|
+
}, ke = {
|
|
200
|
+
utf8Name: "The name can be any string containing characters, letters, numbers, or the following characters: ., -, _, or ~. Do not use spaces."
|
|
201
|
+
}, we = {
|
|
202
|
+
enable: {
|
|
203
|
+
title: "Enable {entityType}",
|
|
204
|
+
message: "Are you sure you want to enable the {entityType} {entityName}?",
|
|
205
|
+
confirmText: "Yes, enable"
|
|
206
|
+
},
|
|
207
|
+
disable: {
|
|
208
|
+
title: "Disable {entityType}",
|
|
209
|
+
message: "Are you sure you want to disable the {entityType} {entityName}?",
|
|
210
|
+
confirmText: "Yes, disable"
|
|
211
|
+
}
|
|
212
|
+
}, Ae = {
|
|
213
|
+
hint: {
|
|
214
|
+
konnect: "The {token} environment variable must be added first. See {link} for details.",
|
|
215
|
+
kongManager: "If your Admin API is secured, set up authentication following {link}."
|
|
216
|
+
},
|
|
217
|
+
documentation: "the documentation",
|
|
218
|
+
steps: {
|
|
219
|
+
step_1: "Step 1: Export token",
|
|
220
|
+
step_2: "Step 2: Apply configuration"
|
|
221
|
+
},
|
|
222
|
+
customization: {
|
|
223
|
+
title: "Customize before copying to CLI",
|
|
224
|
+
copy_pat: "Make sure to copy your personal access token now. You won't be able to see it again.",
|
|
225
|
+
reuse_pat: "Use an existing PAT if you've already generated one.",
|
|
226
|
+
generate_pat: "Generate PAT",
|
|
227
|
+
footer_reminder: "Changes made here won't affect your configuration."
|
|
228
|
+
},
|
|
229
|
+
copy_tooltip: "Copy"
|
|
230
|
+
}, xe = {
|
|
231
|
+
body: "Want a ready-to-use CLI command? {cta} to view this configuration as a decK sync snippet you can copy directly.",
|
|
232
|
+
cta: "Switch to decK format"
|
|
233
|
+
}, Ie = {
|
|
234
|
+
title: "Generate a Personal Access Token",
|
|
235
|
+
description: "Personal access tokens are used to authenticate decK commands and Konnect API requests.",
|
|
236
|
+
fields: {
|
|
237
|
+
name: {
|
|
238
|
+
label: "Name",
|
|
239
|
+
placeholder: "Enter token name"
|
|
240
|
+
},
|
|
241
|
+
expiresAt: {
|
|
242
|
+
label: "Expiration Date",
|
|
243
|
+
placeholder: "Select an expiration date",
|
|
244
|
+
n_days: "{n} days"
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
actions: {
|
|
248
|
+
cancel: "Cancel",
|
|
249
|
+
generate: "Generate",
|
|
250
|
+
generating: "Generating…"
|
|
251
|
+
}
|
|
252
|
+
}, De = {
|
|
253
|
+
global: pe,
|
|
254
|
+
deleteModal: ge,
|
|
255
|
+
baseForm: me,
|
|
256
|
+
baseTable: he,
|
|
257
|
+
baseConfigCard: ve,
|
|
258
|
+
emptyState: be,
|
|
259
|
+
filter: ye,
|
|
260
|
+
debouncedFilter: _e,
|
|
261
|
+
errors: Ce,
|
|
262
|
+
validationErrors: ke,
|
|
263
|
+
toggleModal: we,
|
|
264
|
+
deckCodeBlock: Ae,
|
|
265
|
+
deckCallout: xe,
|
|
266
|
+
generatePatModal: Ie
|
|
267
|
+
};
|
|
268
|
+
function K() {
|
|
269
|
+
const e = re("en-us", De);
|
|
270
|
+
return {
|
|
271
|
+
i18n: e,
|
|
272
|
+
i18nT: oe(e)
|
|
273
|
+
// Translation component <i18n-t>
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function Q() {
|
|
277
|
+
const e = (n, a) => (a == null ? void 0 : a[n]) ?? void 0, s = (n, a) => {
|
|
278
|
+
if (n.length !== a.length) return !1;
|
|
279
|
+
const c = /* @__PURE__ */ new Set([...n, ...a]);
|
|
280
|
+
for (const l of c) {
|
|
281
|
+
const i = n.filter((u) => u === l).length, f = a.filter((u) => u === l).length;
|
|
282
|
+
if (i !== f) return !1;
|
|
283
|
+
}
|
|
284
|
+
return !0;
|
|
285
|
+
};
|
|
286
|
+
return {
|
|
287
|
+
getPropValue: e,
|
|
288
|
+
objectsAreEqual: (n, a, c) => {
|
|
289
|
+
if (c) {
|
|
290
|
+
if (Object.keys(n).length === Object.keys(a).length)
|
|
291
|
+
for (const l in n)
|
|
292
|
+
if (Array.isArray(n[l]) && Array.isArray(a[l])) {
|
|
293
|
+
if (s(n[l], a[l]))
|
|
294
|
+
continue;
|
|
295
|
+
return !1;
|
|
296
|
+
} else {
|
|
297
|
+
if (n[l] === a[l])
|
|
298
|
+
continue;
|
|
299
|
+
return !1;
|
|
300
|
+
}
|
|
301
|
+
else
|
|
302
|
+
return !1;
|
|
303
|
+
return !0;
|
|
304
|
+
}
|
|
305
|
+
try {
|
|
306
|
+
return JSON.stringify(n) === JSON.stringify(a);
|
|
307
|
+
} catch {
|
|
308
|
+
return !1;
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
sortAlpha: (n) => (a, c) => {
|
|
312
|
+
let l = a[n] === void 0 || a[n] === null ? "" : a[n], i = c[n] === void 0 || c[n] === null ? "" : c[n];
|
|
313
|
+
return Array.isArray(a[n]) && (l = a[n][0]), Array.isArray(c[n]) && (i = c[n][0]), l.localeCompare(i);
|
|
314
|
+
},
|
|
315
|
+
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
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
function Oe(e, s, r, t = {
|
|
319
|
+
fetchedItemsKey: "data",
|
|
320
|
+
searchKeys: ["id"]
|
|
321
|
+
}) {
|
|
322
|
+
r || (r = "1000");
|
|
323
|
+
const { axiosInstance: o } = L(e.axiosRequestConfig), { i18n: { t: n } } = K(), { debounce: a } = de(), c = a(async (d) => {
|
|
324
|
+
await D(d);
|
|
325
|
+
}, 200), l = m(!1), i = m(""), f = m(""), u = m([]), w = m([]), k = m(void 0), p = _(() => {
|
|
326
|
+
let d = `${e.apiBaseUrl}${W(s)}`;
|
|
327
|
+
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}` : "");
|
|
328
|
+
}), { isValidUuid: C } = Q(), y = async () => {
|
|
329
|
+
try {
|
|
330
|
+
l.value = !0;
|
|
331
|
+
const { data: d } = await o.get(`${p.value}?size=${r}`);
|
|
332
|
+
d != null && d.next || (k.value = t.fetchedItemsKey in d ? d[t.fetchedItemsKey] : []), w.value = t.fetchedItemsKey in d ? d[t.fetchedItemsKey] : [], u.value = w.value;
|
|
333
|
+
} catch {
|
|
334
|
+
u.value = [], i.value = n("debouncedFilter.errors.fetch");
|
|
335
|
+
} finally {
|
|
336
|
+
l.value = !1;
|
|
337
|
+
}
|
|
338
|
+
}, I = m(""), D = async (d) => {
|
|
339
|
+
var M, T, U;
|
|
340
|
+
if (I.value !== d) {
|
|
341
|
+
if (I.value = d ?? "", !d) {
|
|
342
|
+
u.value = w.value;
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
if (k.value === void 0)
|
|
346
|
+
try {
|
|
347
|
+
if (l.value = !0, i.value = "", f.value = "", e.app === "konnect") {
|
|
348
|
+
const b = `${p.value}/${d}`, { data: v } = await o.get(`${b}?size=${r}`);
|
|
349
|
+
t.fetchedItemsKey in v ? u.value = v[t.fetchedItemsKey] : v != null && v[t.exactMatchKey ?? "id"] ? u.value = [v] : u.value = [];
|
|
350
|
+
} else {
|
|
351
|
+
const b = [];
|
|
352
|
+
C(d) && t.searchKeys.includes("id") ? b.push((async () => {
|
|
353
|
+
const { data: g } = await o.get(`${p.value}/${d}`);
|
|
354
|
+
return [g[t.fetchedItemsKey] ?? g];
|
|
355
|
+
})()) : b.push(
|
|
356
|
+
...t.searchKeys.filter((g) => g !== "id").map(async (g) => {
|
|
357
|
+
const { data: A } = await o.get(`${p.value}?${g}=${d}`);
|
|
358
|
+
return A[t.fetchedItemsKey];
|
|
359
|
+
})
|
|
360
|
+
);
|
|
361
|
+
const v = await Promise.all(b), O = /* @__PURE__ */ new Set();
|
|
362
|
+
u.value = [], (M = v == null ? void 0 : v.forEach) == null || M.call(v, (g) => {
|
|
363
|
+
var A;
|
|
364
|
+
(A = g == null ? void 0 : g.forEach) == null || A.call(g, ($) => {
|
|
365
|
+
O.has($.id) || (O.add($.id), u.value.push($));
|
|
366
|
+
});
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
} catch (b) {
|
|
370
|
+
((T = b == null ? void 0 : b.response) == null ? void 0 : T.status) === 404 ? f.value = n("debouncedFilter.errors.invalid") : (u.value = [], i.value = n("debouncedFilter.errors.fetch"));
|
|
371
|
+
} finally {
|
|
372
|
+
l.value = !1;
|
|
373
|
+
}
|
|
374
|
+
else
|
|
375
|
+
l.value = !0, f.value = "", u.value = (U = k.value) == null ? void 0 : U.filter((b) => {
|
|
376
|
+
var O;
|
|
377
|
+
let v = !1;
|
|
378
|
+
for (const g of t.searchKeys) {
|
|
379
|
+
const A = typeof b[g] == "string" ? (O = b[g]) == null ? void 0 : O.toLowerCase() : b[g];
|
|
380
|
+
A != null && A.includes(d.toLowerCase()) && (v = !0);
|
|
381
|
+
}
|
|
382
|
+
return v;
|
|
383
|
+
}), (!u.value || !u.value.length) && (f.value = n("debouncedFilter.errors.invalid")), l.value = !1;
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
return {
|
|
387
|
+
loading: l,
|
|
388
|
+
error: i,
|
|
389
|
+
validationError: f,
|
|
390
|
+
results: u,
|
|
391
|
+
allRecords: k,
|
|
392
|
+
loadItems: y,
|
|
393
|
+
debouncedQueryChange: c
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
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).";
|
|
397
|
+
function Re(e, s) {
|
|
398
|
+
const r = R(q, null), t = _(() => {
|
|
399
|
+
const a = h(e);
|
|
400
|
+
return (a.app === "kongManager" || !!(a.app === "konnect" && a.enableDeckConfig)) && H(h(s));
|
|
401
|
+
}), o = _(() => {
|
|
402
|
+
const a = h(e), c = a.app === "konnect" && a.enableDeckConfig && typeof a.enableDeckConfig != "boolean" ? a.enableDeckConfig.customization : void 0;
|
|
403
|
+
if (c && !r) {
|
|
404
|
+
console.warn(Z);
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
return c;
|
|
408
|
+
}), n = _(() => {
|
|
409
|
+
const a = h(e);
|
|
410
|
+
return a.app === "konnect" && a.enableDeckConfig && typeof a.enableDeckConfig != "boolean" ? a.enableDeckConfig.calloutPreferenceKey : a.app === "kongManager" ? a.deckCalloutPreferenceKey : void 0;
|
|
411
|
+
});
|
|
412
|
+
return {
|
|
413
|
+
isDeckEnabled: t,
|
|
414
|
+
deckCustomizationOptions: o,
|
|
415
|
+
deckCalloutPreferenceKey: n
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
function Ke(e, s) {
|
|
419
|
+
const r = R(q, null), t = _(() => {
|
|
420
|
+
const a = h(e);
|
|
421
|
+
return (a.app === "kongManager" || !!(a.app === "konnect" && a.enableDeckTab)) && H(h(s));
|
|
422
|
+
}), o = _(() => {
|
|
423
|
+
const a = h(e), c = a.app === "konnect" && a.enableDeckTab && typeof a.enableDeckTab != "boolean" ? a.enableDeckTab.customization : void 0;
|
|
424
|
+
if (c && !r) {
|
|
425
|
+
console.warn(Z);
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
return c;
|
|
429
|
+
}), n = _(() => {
|
|
430
|
+
const a = h(e);
|
|
431
|
+
return a.app === "konnect" && a.enableDeckTab && typeof a.enableDeckTab != "boolean" ? a.enableDeckTab.calloutPreferenceKey : a.app === "kongManager" ? a.deckCalloutPreferenceKey : void 0;
|
|
432
|
+
});
|
|
433
|
+
return {
|
|
434
|
+
isDeckEnabled: t,
|
|
435
|
+
deckCustomizationOptions: o,
|
|
436
|
+
deckCalloutPreferenceKey: n
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
function $e(e, s) {
|
|
440
|
+
const r = W(s), t = _(
|
|
441
|
+
() => e.apiBaseUrl.startsWith("/") ? new URL(`${window.location.origin}${r}`) : new URL(r)
|
|
442
|
+
);
|
|
443
|
+
return t.value.search = "", (o) => `${t.value.href}/${o}`;
|
|
444
|
+
}
|
|
445
|
+
function Ee() {
|
|
446
|
+
const { i18n: { t: e } } = K();
|
|
447
|
+
return {
|
|
448
|
+
getErrorFieldsFromError: (t) => {
|
|
449
|
+
var a, c, l;
|
|
450
|
+
if (!t)
|
|
451
|
+
return {
|
|
452
|
+
messages: [e("errors.unexpected")],
|
|
453
|
+
fields: []
|
|
454
|
+
};
|
|
455
|
+
if (((a = t == null ? void 0 : t.response) == null ? void 0 : a.status) === 401)
|
|
456
|
+
return {
|
|
457
|
+
messages: [],
|
|
458
|
+
fields: []
|
|
459
|
+
};
|
|
460
|
+
let o = [e("errors.unexpected")];
|
|
461
|
+
const n = [];
|
|
462
|
+
if ((c = t == null ? void 0 : t.response) != null && c.data) {
|
|
463
|
+
if ((l = t.response.data.details) != null && l.length)
|
|
464
|
+
return o = [], t.response.data.details.forEach((i) => {
|
|
465
|
+
let f = e("errors.unexpected");
|
|
466
|
+
i.messages && Array.isArray(i.messages) && i.messages.length && (f = i.messages.join(", ")), i.field && n.push({ field: i.field, message: f }), o.push(`${i.field ?? ""} ${f}`);
|
|
467
|
+
}), { messages: o, fields: n };
|
|
468
|
+
if (t.response.data.message && Array.isArray(t.response.data.message))
|
|
469
|
+
return o = [], t.response.data.message.forEach((i) => {
|
|
470
|
+
if (i != null && i.constraints) {
|
|
471
|
+
const f = Object.values(i.constraints).join(", ");
|
|
472
|
+
o.push(f), i.property && n.push({ field: i.property, message: f });
|
|
473
|
+
} else i != null && i.property && (i != null && i.message) ? (n.push({ field: i.property, message: i.message }), o.push(i.message)) : o.push(i);
|
|
474
|
+
}), { messages: o, fields: n };
|
|
475
|
+
if (typeof t.response.data.message == "string" || typeof t.response.data == "string")
|
|
476
|
+
return {
|
|
477
|
+
messages: [t.response.data.message],
|
|
478
|
+
fields: []
|
|
479
|
+
};
|
|
480
|
+
if (typeof t.response.data == "object")
|
|
481
|
+
return o = [], Object.keys(t.response.data).forEach((i) => {
|
|
482
|
+
n.push({ field: i, message: t.response.data[i] }), o.push(t.response.data[i]);
|
|
483
|
+
}), { messages: o, fields: n };
|
|
484
|
+
}
|
|
485
|
+
return {
|
|
486
|
+
messages: [t.message || e("errors.unexpected")],
|
|
487
|
+
fields: []
|
|
488
|
+
};
|
|
489
|
+
},
|
|
490
|
+
getMessageFromError: (t) => {
|
|
491
|
+
var o, n, a, c;
|
|
492
|
+
if (!t)
|
|
493
|
+
return e("errors.unexpected");
|
|
494
|
+
if (((o = t == null ? void 0 : t.response) == null ? void 0 : o.status) === 401)
|
|
495
|
+
return console.warn("getMessageFromError: User auth token is expired or missing, returning empty message."), "";
|
|
496
|
+
if ((n = t == null ? void 0 : t.response) != null && n.data) {
|
|
497
|
+
if (t.response.data.detail)
|
|
498
|
+
return t.response.data.detail;
|
|
499
|
+
if ((a = t.response.data.details) != null && a.length)
|
|
500
|
+
return t.response.data.details.map((l) => {
|
|
501
|
+
let i = e("errors.unexpected");
|
|
502
|
+
return l.messages && typeof l.messages == "object" && l.messages.length && (i = l.messages.join(", ")), l.field ? `${l.field} - ${i}` : i;
|
|
503
|
+
}).join("; ");
|
|
504
|
+
if (t.response.data.message) {
|
|
505
|
+
const { message: l } = t.response.data;
|
|
506
|
+
return Array.isArray(l) ? (c = l[0]) != null && c.constraints ? Object.values(l[0].constraints)[0] : l[0] : l;
|
|
507
|
+
}
|
|
508
|
+
if (typeof t.response.data == "string")
|
|
509
|
+
return t.response.data;
|
|
510
|
+
if (typeof t.response.data == "object")
|
|
511
|
+
return Object.keys(t.response.data).map((l) => `${l} ${t.response.data[l]}`).join(", ");
|
|
512
|
+
}
|
|
513
|
+
return t.message || e("errors.unexpected");
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
}
|
|
517
|
+
function Pe(e) {
|
|
518
|
+
const s = window.location.origin, r = s.endsWith("/") ? s : `${s}/`;
|
|
519
|
+
try {
|
|
520
|
+
const t = e.join("/"), o = `${r}${t}`, n = e.some((c) => c.trim() === "");
|
|
521
|
+
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))
|
|
522
|
+
return `${r}${t}`;
|
|
523
|
+
throw new Error("Invalid url");
|
|
524
|
+
} catch (t) {
|
|
525
|
+
return console.warn("Failed to build valid URL:", t), "";
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
function X(e, s) {
|
|
529
|
+
const r = _(() => {
|
|
530
|
+
const o = h(e);
|
|
531
|
+
return o.app === "konnect" || !!o.isExactMatch;
|
|
532
|
+
}), t = _(() => {
|
|
533
|
+
const o = h(s);
|
|
534
|
+
return o.startsWith("/") ? new URL(`${window.location.origin}${o}`) : new URL(o);
|
|
535
|
+
});
|
|
536
|
+
return (o) => {
|
|
537
|
+
const { page: n, pageSize: a, offset: c, sortColumnKey: l, sortColumnOrder: i, query: f } = o;
|
|
538
|
+
try {
|
|
539
|
+
let u = new URL(t.value.href);
|
|
540
|
+
return r.value && f ? (u.search = "", u = h(e).isExactMatch ? new URL(`${u.href}/${f}`) : new URL(`${u.href}?filter[name][contains]=${f}`)) : (r.value || new URLSearchParams(f).forEach((w, k) => {
|
|
541
|
+
u.searchParams.append(k, w);
|
|
542
|
+
}), l && u.searchParams.append("sort_by", l), i === "desc" && u.searchParams.append("sort_desc", "1"), u.searchParams.append("size", String(a))), c && n !== 1 && u.searchParams.append("offset", String(c)), u.href;
|
|
543
|
+
} catch (u) {
|
|
544
|
+
return console.error("RouteList(fetcher)", u), h(s);
|
|
545
|
+
}
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
const j = /* @__PURE__ */ new Map();
|
|
549
|
+
function Le(e, s, r) {
|
|
550
|
+
const t = m(!0), o = h(e), { axiosInstance: n } = L(o.axiosRequestConfig), a = X(e, s), c = m({
|
|
551
|
+
status: x.Idle
|
|
552
|
+
}), l = async (u) => {
|
|
553
|
+
var k;
|
|
554
|
+
const w = h(r) || "data";
|
|
555
|
+
try {
|
|
556
|
+
c.value = t.value ? { status: x.InitialLoad } : { status: x.Loading }, t.value = !1;
|
|
557
|
+
let p = a(u);
|
|
558
|
+
p.includes("filter[name]") && (p = `${p}&page[size]=${u.pageSize}&page[number]=${u.page}`);
|
|
559
|
+
const C = await n.get(p);
|
|
560
|
+
if (C.status >= 400)
|
|
561
|
+
throw C;
|
|
562
|
+
const y = C.data, I = w && w.replace(/[^\w-_]/gi, "");
|
|
563
|
+
let D;
|
|
564
|
+
y[I] ? D = Array.isArray(y[I]) ? y[I] : [y[I]] : Array.isArray(y) ? D = y : D = Object.keys(y).length ? [y] : [];
|
|
565
|
+
const d = {
|
|
566
|
+
data: D,
|
|
567
|
+
total: D.length,
|
|
568
|
+
...y.offset ? {
|
|
569
|
+
pagination: {
|
|
570
|
+
offset: y.offset
|
|
571
|
+
}
|
|
572
|
+
} : null
|
|
573
|
+
};
|
|
574
|
+
return d.data.length === 0 && !u.query ? c.value = {
|
|
575
|
+
status: x.NoRecords,
|
|
576
|
+
response: d
|
|
577
|
+
} : c.value = {
|
|
578
|
+
status: x.Idle,
|
|
579
|
+
response: d
|
|
580
|
+
}, d;
|
|
581
|
+
} catch (p) {
|
|
582
|
+
const C = {
|
|
583
|
+
data: [],
|
|
584
|
+
total: 0
|
|
585
|
+
};
|
|
586
|
+
return u.query && (((k = p.response) == null ? void 0 : k.status) === 404 || p.status === 404) ? (c.value = {
|
|
587
|
+
status: x.NoResults,
|
|
588
|
+
response: C,
|
|
589
|
+
error: p.response ? p : { response: p }
|
|
590
|
+
}, C) : (c.value = {
|
|
591
|
+
status: x.Error,
|
|
592
|
+
response: C,
|
|
593
|
+
error: p.response ? p : { response: p }
|
|
594
|
+
}, C);
|
|
595
|
+
}
|
|
596
|
+
}, i = o.cacheIdentifier, f = ee(i);
|
|
597
|
+
return { fetcher: l, fetcherState: c, fetcherCacheKey: f };
|
|
598
|
+
}
|
|
599
|
+
function ee(e) {
|
|
600
|
+
if (e) {
|
|
601
|
+
let s = j.get(e);
|
|
602
|
+
return s || (s = m(1), j.set(e, s)), s;
|
|
603
|
+
}
|
|
604
|
+
return m(1);
|
|
605
|
+
}
|
|
606
|
+
function Me() {
|
|
607
|
+
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;
|
|
608
|
+
return {
|
|
609
|
+
capitalize: (t) => t ? t.replace(s, (o) => o.toUpperCase()) : "",
|
|
610
|
+
convertKeyToTitle: e
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
const te = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i, F = (e) => {
|
|
614
|
+
if (typeof e != "string")
|
|
615
|
+
throw new TypeError("Invalid argument expected string");
|
|
616
|
+
const s = e.match(te);
|
|
617
|
+
if (!s)
|
|
618
|
+
throw new Error(`Invalid argument not valid semver ('${e}' received)`);
|
|
619
|
+
return s.shift(), s;
|
|
620
|
+
}, B = (e) => e === "*" || e === "x" || e === "X", z = (e) => {
|
|
621
|
+
const s = parseInt(e, 10);
|
|
622
|
+
return isNaN(s) ? e : s;
|
|
623
|
+
}, Te = (e, s) => typeof e != typeof s ? [String(e), String(s)] : [e, s], Ue = (e, s) => {
|
|
624
|
+
if (B(e) || B(s))
|
|
625
|
+
return 0;
|
|
626
|
+
const [r, t] = Te(z(e), z(s));
|
|
627
|
+
return r > t ? 1 : r < t ? -1 : 0;
|
|
628
|
+
}, V = (e, s) => {
|
|
629
|
+
for (let r = 0; r < Math.max(e.length, s.length); r++) {
|
|
630
|
+
const t = Ue(e[r] || "0", s[r] || "0");
|
|
631
|
+
if (t !== 0)
|
|
632
|
+
return t;
|
|
633
|
+
}
|
|
634
|
+
return 0;
|
|
635
|
+
}, Ne = (e, s) => {
|
|
636
|
+
const r = F(e), t = F(s), o = r.pop(), n = t.pop(), a = V(r, t);
|
|
637
|
+
return a !== 0 ? a : o && n ? V(o.split("."), n.split(".")) : o || n ? o ? -1 : 1 : 0;
|
|
638
|
+
}, G = (e, s, r) => {
|
|
639
|
+
je(r);
|
|
640
|
+
const t = Ne(e, s);
|
|
641
|
+
return ae[r].includes(t);
|
|
642
|
+
}, ae = {
|
|
643
|
+
">": [1],
|
|
644
|
+
">=": [0, 1],
|
|
645
|
+
"=": [0],
|
|
646
|
+
"<=": [-1, 0],
|
|
647
|
+
"<": [-1],
|
|
648
|
+
"!=": [-1, 1]
|
|
649
|
+
}, S = Object.keys(ae), je = (e) => {
|
|
650
|
+
if (typeof e != "string")
|
|
651
|
+
throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);
|
|
652
|
+
if (S.indexOf(e) === -1)
|
|
653
|
+
throw new Error(`Invalid operator, expected one of ${S.join("|")}`);
|
|
654
|
+
}, Fe = (e) => typeof e == "string" && /^[v\d]/.test(e) && te.test(e);
|
|
655
|
+
function Be(e) {
|
|
656
|
+
const { gatewayInfo: s, supportedRange: r } = e;
|
|
657
|
+
if (!s)
|
|
658
|
+
return !0;
|
|
659
|
+
const { edition: t, version: o } = s;
|
|
660
|
+
if (!Fe(o))
|
|
661
|
+
return console.error("Invalid version"), !1;
|
|
662
|
+
const n = r[t];
|
|
663
|
+
if (!n)
|
|
664
|
+
return !1;
|
|
665
|
+
const [a, c] = n;
|
|
666
|
+
return !(a && G(o, a, "<") || c && G(o, c, ">"));
|
|
667
|
+
}
|
|
668
|
+
function ze(e) {
|
|
669
|
+
const s = m(0), r = m(0), t = m(!1);
|
|
670
|
+
return se(e, (n) => {
|
|
671
|
+
n && !t.value && (s.value = n.offsetWidth, r.value = n.scrollWidth, t.value = !0);
|
|
672
|
+
}), {
|
|
673
|
+
isTruncated: _(() => s.value < r.value)
|
|
674
|
+
};
|
|
675
|
+
}
|
|
676
|
+
function Ve() {
|
|
677
|
+
const { i18n: { t: e } } = K();
|
|
678
|
+
return {
|
|
679
|
+
utf8Name: (r) => /^[\p{N}\p{L}.\-_~]*$/u.test(r) ? "" : e("validationErrors.utf8Name")
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
const P = Symbol("schema"), Ge = (e) => {
|
|
683
|
+
J(P, e);
|
|
684
|
+
}, Se = (e) => {
|
|
685
|
+
var o, n;
|
|
686
|
+
const s = R(P, 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 = ne(r == null ? void 0 : r[e]);
|
|
687
|
+
return J(P, t), t;
|
|
688
|
+
};
|
|
689
|
+
function We(e) {
|
|
690
|
+
let s = "";
|
|
691
|
+
const r = m(!1), t = m(null), o = _(() => {
|
|
692
|
+
let a;
|
|
693
|
+
return r.value ? a = !0 : t.value ? a = t.value.hasData || e && h(e) : a = !1, !a;
|
|
694
|
+
});
|
|
695
|
+
return {
|
|
696
|
+
tableState: t,
|
|
697
|
+
hasRecords: r,
|
|
698
|
+
hideTableToolbar: o,
|
|
699
|
+
handleStateChange: (a) => {
|
|
700
|
+
a.hasData ? r.value = !0 : a.state === "success" && !a.hasData && (!e || !s) && (r.value = !1), e && (s = h(e)), t.value = { ...a };
|
|
701
|
+
}
|
|
702
|
+
};
|
|
703
|
+
}
|
|
704
|
+
const at = {
|
|
705
|
+
useAxios: L,
|
|
706
|
+
useDebouncedFilter: Oe,
|
|
707
|
+
useDeleteUrlBuilder: $e,
|
|
708
|
+
useBaseEntityDeckOptions: Re,
|
|
709
|
+
useBaseFormDeckOptions: Ke,
|
|
710
|
+
useErrors: Ee,
|
|
711
|
+
useExternalLinkCreator: Pe,
|
|
712
|
+
useFetcher: Le,
|
|
713
|
+
useFetcherCacheKey: ee,
|
|
714
|
+
useFetchUrlBuilder: X,
|
|
715
|
+
useHelpers: Q,
|
|
716
|
+
useStringHelpers: Me,
|
|
717
|
+
useI18n: K,
|
|
718
|
+
useGatewayFeatureSupported: Be,
|
|
719
|
+
useTruncationDetector: ze,
|
|
720
|
+
useValidators: Ve,
|
|
721
|
+
useSchemaProvider: Ge,
|
|
722
|
+
useSubSchema: Se,
|
|
723
|
+
useTableState: We
|
|
724
|
+
}, st = (e, s) => {
|
|
725
|
+
const r = e.__vccOpts || e;
|
|
726
|
+
for (const [t, o] of s)
|
|
727
|
+
r[t] = o;
|
|
728
|
+
return r;
|
|
729
|
+
};
|
|
730
|
+
export {
|
|
731
|
+
le as C,
|
|
732
|
+
q as D,
|
|
733
|
+
qe as E,
|
|
734
|
+
x as F,
|
|
735
|
+
Ze as I,
|
|
736
|
+
tt as P,
|
|
737
|
+
Y as S,
|
|
738
|
+
st as _,
|
|
739
|
+
Qe as a,
|
|
740
|
+
Z as b,
|
|
741
|
+
at as c,
|
|
742
|
+
Xe as d,
|
|
743
|
+
ce as e,
|
|
744
|
+
et as f,
|
|
745
|
+
ie as g,
|
|
746
|
+
H as i
|
|
747
|
+
};
|