@prorobotech/openapi-k8s-toolkit 1.2.0-alpha.13 → 1.2.0-alpha.15
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/mockServiceWorker.js +349 -0
- package/dist/openapi-k8s-toolkit.es.js +49 -28
- package/dist/openapi-k8s-toolkit.es.js.map +1 -1
- package/dist/openapi-k8s-toolkit.umd.js +49 -27
- package/dist/openapi-k8s-toolkit.umd.js.map +1 -1
- package/dist/types/api/bff/search/getKinds.d.ts +1 -1
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/hooks/index.d.ts +2 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/hooks/queryRangeMatrix/index.d.ts +2 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/hooks/queryRangeMatrix/multi/index.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/hooks/queryRangeMatrix/multi/usePromMatrixToLineMulti.d.ts +7 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/hooks/queryRangeMatrix/single/index.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/hooks/queryRangeMatrix/single/usePromMatrixToLineSingle.d.ts +7 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/hooks/queryVector/index.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/hooks/queryVector/usePromVector.d.ts +6 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/hooks/queryVector/usePromVector.test.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/organisms/matrix/toArea/MatrixToAreaMulti.d.ts +6 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/organisms/matrix/toArea/MatrixToAreaSingle.d.ts +6 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/organisms/matrix/toAreaStacked/MatrixToAreaStacked.d.ts +6 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/organisms/matrix/toLine/MatrixToLineMulti.d.ts +6 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/organisms/matrix/toLine/MatrixToLineSingle.d.ts +6 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/organisms/matrix/toReducedBar/MatrixToReducedBar.d.ts +7 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/organisms/matrix/toTableRows/MatrixToTableRows.d.ts +7 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/organisms/vector/toBar/VectorToBarHorizontal.d.ts +7 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/organisms/vector/toBar/VectorToBarVertical.d.ts +7 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/organisms/vector/toBarGauge/VectorToBarGauge.d.ts +8 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/organisms/vector/toGaugeRadial/VectorToGaugeRadial.d.ts +9 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/organisms/vector/toPie/VectorToPie.d.ts +7 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/organisms/vector/toTableRows/VectorToTableRows.d.ts +7 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/{prometheus.d.ts → buildPrometheusRangeParams/buildPrometheusRangeParams.d.ts} +2 -2
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/buildPrometheusRangeParams/index.d.ts +2 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/formatters/formatBytes.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/formatters/formatTimestamp.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/formatters/index.d.ts +2 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/matrixAdapater/index.d.ts +9 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/matrixAdapater/toAreaStacked/index.d.ts +2 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/matrixAdapater/toAreaStacked/matrixToAreaStackedAdapter.d.ts +14 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/matrixAdapater/toLine/index.d.ts +2 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/matrixAdapater/toLine/matrixToLineAdapter.d.ts +12 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/matrixAdapater/toLine/matrixToLineAdapter.test.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/matrixAdapater/toReducedVector/index.d.ts +2 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/matrixAdapater/toReducedVector/matrixToReducedVectorAdapter.d.ts +8 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/matrixAdapater/toReducedVector/matrixToReducedVectorAdapter.test.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/matrixAdapater/toTableRows/index.d.ts +2 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/matrixAdapater/toTableRows/matrixToTableRowsAdapter.d.ts +12 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/matrixAdapater/toTableRows/matrixToTableRowsAdapter.test.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/matrixAdapater/types.d.ts +10 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/vectorAdapter/helpers.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/vectorAdapter/index.d.ts +11 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/vectorAdapter/pickSeriesId.test.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/vectorAdapter/prometheusVectorUtils.test.d.ts +1 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/vectorAdapter/toBar/index.d.ts +2 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/vectorAdapter/toBar/vectorToBarAdapter.d.ts +18 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/vectorAdapter/toBarGauge/index.d.ts +2 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/vectorAdapter/toBarGauge/vectorToBarGaugeAdapter.d.ts +7 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/vectorAdapter/toGaugeRadial/index.d.ts +2 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/vectorAdapter/toGaugeRadial/vectorToGaugeRadialAdapter.d.ts +7 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/vectorAdapter/toPie/index.d.ts +2 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/vectorAdapter/toPie/vectorToPieAdapter.d.ts +7 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/vectorAdapter/toTableRows/index.d.ts +2 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/vectorAdapter/toTableRows/vectorToTableRowsAdapter.d.ts +8 -0
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/vectorAdapter/types.d.ts +10 -0
- package/dist/types/components/organisms/DynamicComponents/types.d.ts +2 -0
- package/dist/types/hooks/useKinds.d.ts +8 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +9 -2
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/MemoryChart.d.ts +0 -6
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/MemoryChartMulti.d.ts +0 -6
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/hooks/usePrometheusQueryRange.d.ts +0 -7
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/hooks/usePrometheusQueryRangeMulti.d.ts +0 -7
- package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/prometheusAdapter.d.ts +0 -21
- /package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/hooks/{usePrometheusQueryRange.test.d.ts → queryRangeMatrix/multi/usePromMatrixToLineMulti.test.d.ts} +0 -0
- /package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/hooks/{usePrometheusQueryRangeMulti.test.d.ts → queryRangeMatrix/single/usePromMatrixToLineSingle.test.d.ts} +0 -0
- /package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/{prometheus.test.d.ts → buildPrometheusRangeParams/buildPrometheusRangeParams.test.d.ts} +0 -0
- /package/dist/types/components/organisms/DynamicComponents/molecules/PrometheusGraph/utils/{prometheusAdapter.test.d.ts → matrixAdapater/toAreaStacked/matrixToAreaStackedAdapter.test.d.ts} +0 -0
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Mock Service Worker.
|
|
6
|
+
* @see https://github.com/mswjs/msw
|
|
7
|
+
* - Please do NOT modify this file.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const PACKAGE_VERSION = '2.12.4'
|
|
11
|
+
const INTEGRITY_CHECKSUM = '4db4a41e972cec1b64cc569c66952d82'
|
|
12
|
+
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
|
|
13
|
+
const activeClientIds = new Set()
|
|
14
|
+
|
|
15
|
+
addEventListener('install', function () {
|
|
16
|
+
self.skipWaiting()
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
addEventListener('activate', function (event) {
|
|
20
|
+
event.waitUntil(self.clients.claim())
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
addEventListener('message', async function (event) {
|
|
24
|
+
const clientId = Reflect.get(event.source || {}, 'id')
|
|
25
|
+
|
|
26
|
+
if (!clientId || !self.clients) {
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const client = await self.clients.get(clientId)
|
|
31
|
+
|
|
32
|
+
if (!client) {
|
|
33
|
+
return
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const allClients = await self.clients.matchAll({
|
|
37
|
+
type: 'window',
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
switch (event.data) {
|
|
41
|
+
case 'KEEPALIVE_REQUEST': {
|
|
42
|
+
sendToClient(client, {
|
|
43
|
+
type: 'KEEPALIVE_RESPONSE',
|
|
44
|
+
})
|
|
45
|
+
break
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
case 'INTEGRITY_CHECK_REQUEST': {
|
|
49
|
+
sendToClient(client, {
|
|
50
|
+
type: 'INTEGRITY_CHECK_RESPONSE',
|
|
51
|
+
payload: {
|
|
52
|
+
packageVersion: PACKAGE_VERSION,
|
|
53
|
+
checksum: INTEGRITY_CHECKSUM,
|
|
54
|
+
},
|
|
55
|
+
})
|
|
56
|
+
break
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
case 'MOCK_ACTIVATE': {
|
|
60
|
+
activeClientIds.add(clientId)
|
|
61
|
+
|
|
62
|
+
sendToClient(client, {
|
|
63
|
+
type: 'MOCKING_ENABLED',
|
|
64
|
+
payload: {
|
|
65
|
+
client: {
|
|
66
|
+
id: client.id,
|
|
67
|
+
frameType: client.frameType,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
})
|
|
71
|
+
break
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
case 'CLIENT_CLOSED': {
|
|
75
|
+
activeClientIds.delete(clientId)
|
|
76
|
+
|
|
77
|
+
const remainingClients = allClients.filter((client) => {
|
|
78
|
+
return client.id !== clientId
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
// Unregister itself when there are no more clients
|
|
82
|
+
if (remainingClients.length === 0) {
|
|
83
|
+
self.registration.unregister()
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
break
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
addEventListener('fetch', function (event) {
|
|
92
|
+
const requestInterceptedAt = Date.now()
|
|
93
|
+
|
|
94
|
+
// Bypass navigation requests.
|
|
95
|
+
if (event.request.mode === 'navigate') {
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Opening the DevTools triggers the "only-if-cached" request
|
|
100
|
+
// that cannot be handled by the worker. Bypass such requests.
|
|
101
|
+
if (
|
|
102
|
+
event.request.cache === 'only-if-cached' &&
|
|
103
|
+
event.request.mode !== 'same-origin'
|
|
104
|
+
) {
|
|
105
|
+
return
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Bypass all requests when there are no active clients.
|
|
109
|
+
// Prevents the self-unregistered worked from handling requests
|
|
110
|
+
// after it's been terminated (still remains active until the next reload).
|
|
111
|
+
if (activeClientIds.size === 0) {
|
|
112
|
+
return
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const requestId = crypto.randomUUID()
|
|
116
|
+
event.respondWith(handleRequest(event, requestId, requestInterceptedAt))
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @param {FetchEvent} event
|
|
121
|
+
* @param {string} requestId
|
|
122
|
+
* @param {number} requestInterceptedAt
|
|
123
|
+
*/
|
|
124
|
+
async function handleRequest(event, requestId, requestInterceptedAt) {
|
|
125
|
+
const client = await resolveMainClient(event)
|
|
126
|
+
const requestCloneForEvents = event.request.clone()
|
|
127
|
+
const response = await getResponse(
|
|
128
|
+
event,
|
|
129
|
+
client,
|
|
130
|
+
requestId,
|
|
131
|
+
requestInterceptedAt,
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
// Send back the response clone for the "response:*" life-cycle events.
|
|
135
|
+
// Ensure MSW is active and ready to handle the message, otherwise
|
|
136
|
+
// this message will pend indefinitely.
|
|
137
|
+
if (client && activeClientIds.has(client.id)) {
|
|
138
|
+
const serializedRequest = await serializeRequest(requestCloneForEvents)
|
|
139
|
+
|
|
140
|
+
// Clone the response so both the client and the library could consume it.
|
|
141
|
+
const responseClone = response.clone()
|
|
142
|
+
|
|
143
|
+
sendToClient(
|
|
144
|
+
client,
|
|
145
|
+
{
|
|
146
|
+
type: 'RESPONSE',
|
|
147
|
+
payload: {
|
|
148
|
+
isMockedResponse: IS_MOCKED_RESPONSE in response,
|
|
149
|
+
request: {
|
|
150
|
+
id: requestId,
|
|
151
|
+
...serializedRequest,
|
|
152
|
+
},
|
|
153
|
+
response: {
|
|
154
|
+
type: responseClone.type,
|
|
155
|
+
status: responseClone.status,
|
|
156
|
+
statusText: responseClone.statusText,
|
|
157
|
+
headers: Object.fromEntries(responseClone.headers.entries()),
|
|
158
|
+
body: responseClone.body,
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
responseClone.body ? [serializedRequest.body, responseClone.body] : [],
|
|
163
|
+
)
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return response
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Resolve the main client for the given event.
|
|
171
|
+
* Client that issues a request doesn't necessarily equal the client
|
|
172
|
+
* that registered the worker. It's with the latter the worker should
|
|
173
|
+
* communicate with during the response resolving phase.
|
|
174
|
+
* @param {FetchEvent} event
|
|
175
|
+
* @returns {Promise<Client | undefined>}
|
|
176
|
+
*/
|
|
177
|
+
async function resolveMainClient(event) {
|
|
178
|
+
const client = await self.clients.get(event.clientId)
|
|
179
|
+
|
|
180
|
+
if (activeClientIds.has(event.clientId)) {
|
|
181
|
+
return client
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (client?.frameType === 'top-level') {
|
|
185
|
+
return client
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const allClients = await self.clients.matchAll({
|
|
189
|
+
type: 'window',
|
|
190
|
+
})
|
|
191
|
+
|
|
192
|
+
return allClients
|
|
193
|
+
.filter((client) => {
|
|
194
|
+
// Get only those clients that are currently visible.
|
|
195
|
+
return client.visibilityState === 'visible'
|
|
196
|
+
})
|
|
197
|
+
.find((client) => {
|
|
198
|
+
// Find the client ID that's recorded in the
|
|
199
|
+
// set of clients that have registered the worker.
|
|
200
|
+
return activeClientIds.has(client.id)
|
|
201
|
+
})
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* @param {FetchEvent} event
|
|
206
|
+
* @param {Client | undefined} client
|
|
207
|
+
* @param {string} requestId
|
|
208
|
+
* @param {number} requestInterceptedAt
|
|
209
|
+
* @returns {Promise<Response>}
|
|
210
|
+
*/
|
|
211
|
+
async function getResponse(event, client, requestId, requestInterceptedAt) {
|
|
212
|
+
// Clone the request because it might've been already used
|
|
213
|
+
// (i.e. its body has been read and sent to the client).
|
|
214
|
+
const requestClone = event.request.clone()
|
|
215
|
+
|
|
216
|
+
function passthrough() {
|
|
217
|
+
// Cast the request headers to a new Headers instance
|
|
218
|
+
// so the headers can be manipulated with.
|
|
219
|
+
const headers = new Headers(requestClone.headers)
|
|
220
|
+
|
|
221
|
+
// Remove the "accept" header value that marked this request as passthrough.
|
|
222
|
+
// This prevents request alteration and also keeps it compliant with the
|
|
223
|
+
// user-defined CORS policies.
|
|
224
|
+
const acceptHeader = headers.get('accept')
|
|
225
|
+
if (acceptHeader) {
|
|
226
|
+
const values = acceptHeader.split(',').map((value) => value.trim())
|
|
227
|
+
const filteredValues = values.filter(
|
|
228
|
+
(value) => value !== 'msw/passthrough',
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
if (filteredValues.length > 0) {
|
|
232
|
+
headers.set('accept', filteredValues.join(', '))
|
|
233
|
+
} else {
|
|
234
|
+
headers.delete('accept')
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
return fetch(requestClone, { headers })
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Bypass mocking when the client is not active.
|
|
242
|
+
if (!client) {
|
|
243
|
+
return passthrough()
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Bypass initial page load requests (i.e. static assets).
|
|
247
|
+
// The absence of the immediate/parent client in the map of the active clients
|
|
248
|
+
// means that MSW hasn't dispatched the "MOCK_ACTIVATE" event yet
|
|
249
|
+
// and is not ready to handle requests.
|
|
250
|
+
if (!activeClientIds.has(client.id)) {
|
|
251
|
+
return passthrough()
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// Notify the client that a request has been intercepted.
|
|
255
|
+
const serializedRequest = await serializeRequest(event.request)
|
|
256
|
+
const clientMessage = await sendToClient(
|
|
257
|
+
client,
|
|
258
|
+
{
|
|
259
|
+
type: 'REQUEST',
|
|
260
|
+
payload: {
|
|
261
|
+
id: requestId,
|
|
262
|
+
interceptedAt: requestInterceptedAt,
|
|
263
|
+
...serializedRequest,
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
[serializedRequest.body],
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
switch (clientMessage.type) {
|
|
270
|
+
case 'MOCK_RESPONSE': {
|
|
271
|
+
return respondWithMock(clientMessage.data)
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
case 'PASSTHROUGH': {
|
|
275
|
+
return passthrough()
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
return passthrough()
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* @param {Client} client
|
|
284
|
+
* @param {any} message
|
|
285
|
+
* @param {Array<Transferable>} transferrables
|
|
286
|
+
* @returns {Promise<any>}
|
|
287
|
+
*/
|
|
288
|
+
function sendToClient(client, message, transferrables = []) {
|
|
289
|
+
return new Promise((resolve, reject) => {
|
|
290
|
+
const channel = new MessageChannel()
|
|
291
|
+
|
|
292
|
+
channel.port1.onmessage = (event) => {
|
|
293
|
+
if (event.data && event.data.error) {
|
|
294
|
+
return reject(event.data.error)
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
resolve(event.data)
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
client.postMessage(message, [
|
|
301
|
+
channel.port2,
|
|
302
|
+
...transferrables.filter(Boolean),
|
|
303
|
+
])
|
|
304
|
+
})
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* @param {Response} response
|
|
309
|
+
* @returns {Response}
|
|
310
|
+
*/
|
|
311
|
+
function respondWithMock(response) {
|
|
312
|
+
// Setting response status code to 0 is a no-op.
|
|
313
|
+
// However, when responding with a "Response.error()", the produced Response
|
|
314
|
+
// instance will have status code set to 0. Since it's not possible to create
|
|
315
|
+
// a Response instance with status code 0, handle that use-case separately.
|
|
316
|
+
if (response.status === 0) {
|
|
317
|
+
return Response.error()
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
const mockedResponse = new Response(response.body, response)
|
|
321
|
+
|
|
322
|
+
Reflect.defineProperty(mockedResponse, IS_MOCKED_RESPONSE, {
|
|
323
|
+
value: true,
|
|
324
|
+
enumerable: true,
|
|
325
|
+
})
|
|
326
|
+
|
|
327
|
+
return mockedResponse
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* @param {Request} request
|
|
332
|
+
*/
|
|
333
|
+
async function serializeRequest(request) {
|
|
334
|
+
return {
|
|
335
|
+
url: request.url,
|
|
336
|
+
mode: request.mode,
|
|
337
|
+
method: request.method,
|
|
338
|
+
headers: Object.fromEntries(request.headers.entries()),
|
|
339
|
+
cache: request.cache,
|
|
340
|
+
credentials: request.credentials,
|
|
341
|
+
destination: request.destination,
|
|
342
|
+
integrity: request.integrity,
|
|
343
|
+
redirect: request.redirect,
|
|
344
|
+
referrer: request.referrer,
|
|
345
|
+
referrerPolicy: request.referrerPolicy,
|
|
346
|
+
body: await request.arrayBuffer(),
|
|
347
|
+
keepalive: request.keepalive,
|
|
348
|
+
}
|
|
349
|
+
}
|
|
@@ -8614,8 +8614,7 @@ const ManageableBreadcrumbs = ({ data }) => {
|
|
|
8614
8614
|
};
|
|
8615
8615
|
|
|
8616
8616
|
const getKinds = async ({ cluster }) => {
|
|
8617
|
-
|
|
8618
|
-
return result.data;
|
|
8617
|
+
return axios.get(`/api/clusters/${cluster}/openapi-bff/search/kinds/getKinds`);
|
|
8619
8618
|
};
|
|
8620
8619
|
|
|
8621
8620
|
const kindByGvr = (entries) => (gvr) => {
|
|
@@ -9387,7 +9386,7 @@ const useK8sSmartResource = (params) => {
|
|
|
9387
9386
|
if (cancelled) {
|
|
9388
9387
|
return;
|
|
9389
9388
|
}
|
|
9390
|
-
setKindsWithVersion(getSortedKindsAll(data));
|
|
9389
|
+
setKindsWithVersion(getSortedKindsAll(data.data));
|
|
9391
9390
|
}).catch(() => {
|
|
9392
9391
|
if (!cancelled) {
|
|
9393
9392
|
setKindsWithVersion(void 0);
|
|
@@ -43325,20 +43324,43 @@ const VisibilityContainer$1 = ({
|
|
|
43325
43324
|
children
|
|
43326
43325
|
}) => {
|
|
43327
43326
|
const { data: multiQueryData, isLoading: isMultiqueryLoading } = useMultiQuery();
|
|
43327
|
+
const partsOfUrl = usePartsOfUrl();
|
|
43328
43328
|
const {
|
|
43329
43329
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
43330
43330
|
id,
|
|
43331
|
-
value
|
|
43331
|
+
value,
|
|
43332
|
+
criteria,
|
|
43333
|
+
valueToCompare
|
|
43332
43334
|
} = data;
|
|
43335
|
+
const replaceValues = partsOfUrl.partsOfUrl.reduce((acc, value2, index) => {
|
|
43336
|
+
acc[index.toString()] = value2;
|
|
43337
|
+
return acc;
|
|
43338
|
+
}, {});
|
|
43333
43339
|
const valuePrepared = parseWithoutPartsOfUrl({
|
|
43334
43340
|
text: value,
|
|
43335
43341
|
multiQueryData,
|
|
43336
43342
|
customFallback: "~undefined-value~"
|
|
43337
43343
|
});
|
|
43344
|
+
const shouldHideByCriteria = (() => {
|
|
43345
|
+
if (!criteria) return false;
|
|
43346
|
+
if (criteria === "exists") {
|
|
43347
|
+
return !valuePrepared || valuePrepared === "~undefined-value~";
|
|
43348
|
+
}
|
|
43349
|
+
if (criteria === "notExists") {
|
|
43350
|
+
return !!valuePrepared && valuePrepared !== "~undefined-value~";
|
|
43351
|
+
}
|
|
43352
|
+
if (!valueToCompare) return false;
|
|
43353
|
+
const targets = Array.isArray(valueToCompare) ? valueToCompare.map((target) => parseAll({ text: target, replaceValues, multiQueryData })) : [parseAll({ text: String(valueToCompare), replaceValues, multiQueryData })];
|
|
43354
|
+
const matches = targets.includes(String(valuePrepared));
|
|
43355
|
+
if (criteria === "equals") return !matches;
|
|
43356
|
+
if (criteria === "notEquals") return matches;
|
|
43357
|
+
return false;
|
|
43358
|
+
})();
|
|
43338
43359
|
if (isMultiqueryLoading) {
|
|
43339
43360
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: "Loading multiquery" });
|
|
43340
43361
|
}
|
|
43341
|
-
|
|
43362
|
+
const shouldAutoHide = !criteria && (!valuePrepared || valuePrepared === "~undefined-value~");
|
|
43363
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Styled$t.VisibilityContainer, { $hidden: shouldAutoHide || shouldHideByCriteria, children });
|
|
43342
43364
|
};
|
|
43343
43365
|
|
|
43344
43366
|
const unknownToString = (value) => {
|
|
@@ -46470,6 +46492,23 @@ const pluralByKind = (entries) => (kind, apiVersion) => {
|
|
|
46470
46492
|
return uniq.length === 1 ? uniq[0] : void 0;
|
|
46471
46493
|
};
|
|
46472
46494
|
|
|
46495
|
+
const useKinds = ({
|
|
46496
|
+
cluster,
|
|
46497
|
+
refetchInterval,
|
|
46498
|
+
isEnabled
|
|
46499
|
+
}) => {
|
|
46500
|
+
return useQuery({
|
|
46501
|
+
queryKey: ["useKinds", cluster],
|
|
46502
|
+
queryFn: () => getKinds({ cluster }),
|
|
46503
|
+
select: (data) => ({
|
|
46504
|
+
kindIndex: data.data,
|
|
46505
|
+
kindsWithVersion: getSortedKindsAll(data.data)
|
|
46506
|
+
}),
|
|
46507
|
+
refetchInterval: refetchInterval !== void 0 ? refetchInterval : 6e4,
|
|
46508
|
+
enabled: isEnabled
|
|
46509
|
+
});
|
|
46510
|
+
};
|
|
46511
|
+
|
|
46473
46512
|
const findOwnerReferencePath = (rawObject, jsonPathToArrayOfRefs, reference) => {
|
|
46474
46513
|
if (!rawObject || !jsonPathToArrayOfRefs) return void 0;
|
|
46475
46514
|
let arrayJsonPath = jsonPathToArrayOfRefs.trim();
|
|
@@ -46601,16 +46640,7 @@ const RefsList = ({
|
|
|
46601
46640
|
baseNavigationName,
|
|
46602
46641
|
listFlexProps
|
|
46603
46642
|
}) => {
|
|
46604
|
-
const
|
|
46605
|
-
const [kindsWithVersion, setKindWithVersion] = useState();
|
|
46606
|
-
useEffect(() => {
|
|
46607
|
-
getKinds({ cluster }).then((data) => {
|
|
46608
|
-
setKindIndex(data);
|
|
46609
|
-
setKindWithVersion(getSortedKindsAll(data));
|
|
46610
|
-
}).catch((error) => {
|
|
46611
|
-
console.error(error);
|
|
46612
|
-
});
|
|
46613
|
-
}, [cluster]);
|
|
46643
|
+
const { data: kindsData } = useKinds({ cluster });
|
|
46614
46644
|
const { data: navigationDataArr } = useK8sSmartResource({
|
|
46615
46645
|
cluster,
|
|
46616
46646
|
apiGroup: "front.in-cloud.io",
|
|
@@ -46618,7 +46648,7 @@ const RefsList = ({
|
|
|
46618
46648
|
plural: baseNavigationPlural,
|
|
46619
46649
|
fieldSelector: `metadata.name=${baseNavigationName}`
|
|
46620
46650
|
});
|
|
46621
|
-
const getPlural = kindsWithVersion ? pluralByKind(kindsWithVersion) : void 0;
|
|
46651
|
+
const getPlural = kindsData?.kindsWithVersion ? pluralByKind(kindsData?.kindsWithVersion) : void 0;
|
|
46622
46652
|
const baseFactoriesMapping = navigationDataArr && navigationDataArr.items && navigationDataArr.items.length > 0 ? navigationDataArr.items[0].spec?.baseFactoriesMapping : void 0;
|
|
46623
46653
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Flex, { vertical: true, gap: 8, ...listFlexProps, children: refsArr.map((ref) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
46624
46654
|
RefElement,
|
|
@@ -54898,16 +54928,7 @@ const Events = ({
|
|
|
54898
54928
|
baseNavigationName
|
|
54899
54929
|
}) => {
|
|
54900
54930
|
const { token } = theme.useToken();
|
|
54901
|
-
const
|
|
54902
|
-
const [kindsWithVersion, setKindWithVersion] = useState();
|
|
54903
|
-
useEffect(() => {
|
|
54904
|
-
getKinds({ cluster }).then((data) => {
|
|
54905
|
-
setKindIndex(data);
|
|
54906
|
-
setKindWithVersion(getSortedKindsAll(data));
|
|
54907
|
-
}).catch((error) => {
|
|
54908
|
-
console.error(error);
|
|
54909
|
-
});
|
|
54910
|
-
}, [cluster]);
|
|
54931
|
+
const { data: kindsData } = useKinds({ cluster });
|
|
54911
54932
|
const { data: navigationDataArr } = useK8sSmartResource({
|
|
54912
54933
|
cluster,
|
|
54913
54934
|
apiGroup: "front.in-cloud.io",
|
|
@@ -55126,7 +55147,7 @@ const Events = ({
|
|
|
55126
55147
|
if (nearBottom && hasMore) sendScroll();
|
|
55127
55148
|
}, [hasMore, sendScroll]);
|
|
55128
55149
|
const total = state.order.length;
|
|
55129
|
-
const getPlural = kindsWithVersion ? pluralByKind(kindsWithVersion) : void 0;
|
|
55150
|
+
const getPlural = kindsData?.kindsWithVersion ? pluralByKind(kindsData?.kindsWithVersion) : void 0;
|
|
55130
55151
|
const baseFactoriesMapping = navigationDataArr && navigationDataArr.items && navigationDataArr.items.length > 0 ? navigationDataArr.items[0].spec?.baseFactoriesMapping : void 0;
|
|
55131
55152
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(Styled.Root, { $substractHeight: substractHeight || 340, children: [
|
|
55132
55153
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Styled.Header, { children: [
|
|
@@ -55823,5 +55844,5 @@ const useResourceScope = ({ plural, cluster, apiGroup, apiVersion }) => {
|
|
|
55823
55844
|
});
|
|
55824
55845
|
};
|
|
55825
55846
|
|
|
55826
|
-
export { BackToDefaultIcon, BlackholeForm, BlackholeFormProvider, ContentCard$1 as ContentCard, CursorDefaultDiv, CursorPointerTag, CursorPointerTagMinContent, CustomSelect$4 as CustomSelect, DeleteIcon, DeleteModal, DeleteModalMany, DownIcon, DynamicComponents, DynamicRenderer, DynamicRendererWithProviders, EarthIcon, EditIcon, EnrichedTable, EnrichedTableProvider, Events, FlexGrow, LockedIcon, LookingGlassIcon, ManageableBreadcrumbs, ManageableBreadcrumbsProvider, ManageableSidebar, ManageableSidebarProvider, MarketPlace, MarketplaceCard, MinusIcon, NodeTerminal, PaddingContainer, PauseCircleIcon, PlusIcon, PodLogs, PodLogsMonaco, PodTerminal, ProjectInfoCard, ResourceLink, ResumeCircleIcon, Search, Spacer$1 as Spacer, SuccessIcon, TreeWithSearch, UncontrolledSelect, UnlockedIcon, UpIcon, VMVNC, YamlEditorSingleton$1 as YamlEditorSingleton, checkIfApiInstanceNamespaceScoped, checkIfBuiltInInstanceNamespaceScoped, checkPermission, convertBytes, convertCompute, convertCores, convertStorage, createContextFactory, createNewEntry, deepMerge, deleteEntry, feedbackIcons, filterIfApiInstanceNamespaceScoped, filterIfBuiltInInstanceNamespaceScoped, filterSelectOptions, floorToDecimal, formatBytesAuto, formatCoresAuto, getAllPathsFromObj, getApiResourceSingle, getApiResourceTypes, getApiResourceTypesByApiGroup, getApiResources, getBuiltinResourceSingle, getBuiltinResourceTypes, getBuiltinResources, getBuiltinTreeData, getClusterList, getCrdData, getCrdResourceSingle, getCrdResources, getDirectUnknownResource, getEnrichedColumns, getEnrichedColumnsWithControls, getGroupsByCategory, getKinds, getLinkToApiForm, getLinkToBuiltinForm, getLinkToForm, getNamespaceLink, getObjectFormItemsDraft, getPrefixSubarrays, getResourceLink, getSortedKinds, getSortedKindsAll, getStringByName, getSwagger, getUppercase, groupsToTreeData, hslFromString, includesArray, isFlatObject, isMultilineFromYaml, isMultilineString, kindByGvr, namespacedByGvr, normalizeValuesForQuotasToNumber, parseCoresWithUnit, parseQuotaValue, parseQuotaValueCpu, parseQuotaValueMemoryAndStorage, parseValueWithUnit, pluralByKind, prepareDataForManageableBreadcrumbs, prepareDataForManageableSidebar, prepareTemplate, prepareUrlsToFetchForDynamicRenderer, toBytes, toCores, updateEntry, useApiResourceSingle, useApiResourceTypesByGroup, useApiResources, useApisResourceTypes, useBuiltinResourceSingle, useBuiltinResourceTypes, useBuiltinResources, useClusterList, useCrdData, useCrdResourceSingle, useCrdResources, useDirectUnknownResource, useInfiniteSentinel, useK8sSmartResource, useK8sVerbs, useListWatch, useManyK8sSmartResource, usePermissions, useResourceScope, useSmartResourceParams };
|
|
55847
|
+
export { BackToDefaultIcon, BlackholeForm, BlackholeFormProvider, ContentCard$1 as ContentCard, CursorDefaultDiv, CursorPointerTag, CursorPointerTagMinContent, CustomSelect$4 as CustomSelect, DeleteIcon, DeleteModal, DeleteModalMany, DownIcon, DynamicComponents, DynamicRenderer, DynamicRendererWithProviders, EarthIcon, EditIcon, EnrichedTable, EnrichedTableProvider, Events, FlexGrow, LockedIcon, LookingGlassIcon, ManageableBreadcrumbs, ManageableBreadcrumbsProvider, ManageableSidebar, ManageableSidebarProvider, MarketPlace, MarketplaceCard, MinusIcon, NodeTerminal, PaddingContainer, PauseCircleIcon, PlusIcon, PodLogs, PodLogsMonaco, PodTerminal, ProjectInfoCard, ResourceLink, ResumeCircleIcon, Search, Spacer$1 as Spacer, SuccessIcon, TreeWithSearch, UncontrolledSelect, UnlockedIcon, UpIcon, VMVNC, YamlEditorSingleton$1 as YamlEditorSingleton, checkIfApiInstanceNamespaceScoped, checkIfBuiltInInstanceNamespaceScoped, checkPermission, convertBytes, convertCompute, convertCores, convertStorage, createContextFactory, createNewEntry, deepMerge, deleteEntry, feedbackIcons, filterIfApiInstanceNamespaceScoped, filterIfBuiltInInstanceNamespaceScoped, filterSelectOptions, floorToDecimal, formatBytesAuto, formatCoresAuto, getAllPathsFromObj, getApiResourceSingle, getApiResourceTypes, getApiResourceTypesByApiGroup, getApiResources, getBuiltinResourceSingle, getBuiltinResourceTypes, getBuiltinResources, getBuiltinTreeData, getClusterList, getCrdData, getCrdResourceSingle, getCrdResources, getDirectUnknownResource, getEnrichedColumns, getEnrichedColumnsWithControls, getGroupsByCategory, getKinds, getLinkToApiForm, getLinkToBuiltinForm, getLinkToForm, getNamespaceLink, getObjectFormItemsDraft, getPrefixSubarrays, getResourceLink, getSortedKinds, getSortedKindsAll, getStringByName, getSwagger, getUppercase, groupsToTreeData, hslFromString, includesArray, isFlatObject, isMultilineFromYaml, isMultilineString, kindByGvr, namespacedByGvr, normalizeValuesForQuotasToNumber, parseCoresWithUnit, parseQuotaValue, parseQuotaValueCpu, parseQuotaValueMemoryAndStorage, parseValueWithUnit, pluralByKind, prepareDataForManageableBreadcrumbs, prepareDataForManageableSidebar, prepareTemplate, prepareUrlsToFetchForDynamicRenderer, toBytes, toCores, updateEntry, useApiResourceSingle, useApiResourceTypesByGroup, useApiResources, useApisResourceTypes, useBuiltinResourceSingle, useBuiltinResourceTypes, useBuiltinResources, useClusterList, useCrdData, useCrdResourceSingle, useCrdResources, useDirectUnknownResource, useInfiniteSentinel, useK8sSmartResource, useK8sVerbs, useKinds, useListWatch, useManyK8sSmartResource, usePermissions, useResourceScope, useSmartResourceParams };
|
|
55827
55848
|
//# sourceMappingURL=openapi-k8s-toolkit.es.js.map
|