@executor-js/plugin-openapi 1.4.29 → 1.4.30
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/{AddOpenApiSource-FLMNI742.js → AddOpenApiSource-KSOMPQ2R.js} +4 -4
- package/dist/{EditOpenApiSource-I4NIGIIJ.js → EditOpenApiSource-AOA7APR2.js} +301 -192
- package/dist/EditOpenApiSource-AOA7APR2.js.map +1 -0
- package/dist/{OpenApiSourceSummary-CM46DB4L.js → OpenApiSourceSummary-Y3S6ZBOZ.js} +4 -4
- package/dist/OpenApiSourceSummary-Y3S6ZBOZ.js.map +1 -0
- package/dist/api/group.d.ts +124 -118
- package/dist/api/index.d.ts +148 -369
- package/dist/chunk-BB5IAKRG.js +136 -0
- package/dist/chunk-BB5IAKRG.js.map +1 -0
- package/dist/{chunk-E7PZ2QGD.js → chunk-EOXXE5DG.js} +17 -455
- package/dist/chunk-EOXXE5DG.js.map +1 -0
- package/dist/{chunk-OZ67JNID.js → chunk-NIKLYJ3X.js} +830 -319
- package/dist/chunk-NIKLYJ3X.js.map +1 -0
- package/dist/{chunk-TGDT6QCH.js → chunk-YJMXYKYX.js} +178 -117
- package/dist/chunk-YJMXYKYX.js.map +1 -0
- package/dist/{chunk-GFQUEZUW.js → chunk-ZZBTLFTA.js} +78 -93
- package/dist/chunk-ZZBTLFTA.js.map +1 -0
- package/dist/client.js +7 -137
- package/dist/client.js.map +1 -1
- package/dist/core.js +5 -10
- package/dist/index.js +3 -2
- package/dist/react/atoms.d.ts +83 -223
- package/dist/react/client.d.ts +123 -117
- package/dist/sdk/credential-status.d.ts +3 -3
- package/dist/sdk/extract.d.ts +19 -19
- package/dist/sdk/index.d.ts +2 -2
- package/dist/sdk/invoke.d.ts +7 -7
- package/dist/sdk/parse.d.ts +2 -3
- package/dist/sdk/plugin.d.ts +181 -275
- package/dist/sdk/preview.d.ts +12 -12
- package/dist/sdk/source-contracts.d.ts +55 -0
- package/dist/sdk/store.d.ts +6 -269
- package/dist/sdk/types.d.ts +16 -65
- package/dist/testing/index.d.ts +149 -11
- package/dist/testing.js +419 -33
- package/dist/testing.js.map +1 -1
- package/dist/testing.test.d.ts +1 -0
- package/package.json +3 -4
- package/dist/EditOpenApiSource-I4NIGIIJ.js.map +0 -1
- package/dist/OpenApiSourceSummary-CM46DB4L.js.map +0 -1
- package/dist/chunk-E7PZ2QGD.js.map +0 -1
- package/dist/chunk-GFQUEZUW.js.map +0 -1
- package/dist/chunk-OZ67JNID.js.map +0 -1
- package/dist/chunk-TGDT6QCH.js.map +0 -1
- /package/dist/{AddOpenApiSource-FLMNI742.js.map → AddOpenApiSource-KSOMPQ2R.js.map} +0 -0
|
@@ -1,29 +1,34 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addOpenApiSpecOptimistic,
|
|
3
|
-
previewOpenApiSpec
|
|
4
|
-
|
|
5
|
-
} from "./chunk-GFQUEZUW.js";
|
|
3
|
+
previewOpenApiSpec
|
|
4
|
+
} from "./chunk-ZZBTLFTA.js";
|
|
6
5
|
import {
|
|
7
|
-
ConfiguredHeaderBinding,
|
|
8
6
|
OAuth2SourceConfig,
|
|
9
|
-
OpenApiSourceBindingInput,
|
|
10
7
|
expandServerUrlOptions,
|
|
11
8
|
headerBindingSlot,
|
|
12
9
|
oauth2ClientIdSlot,
|
|
13
10
|
oauth2ClientSecretSlot,
|
|
14
11
|
oauth2ConnectionSlot,
|
|
15
|
-
queryParamBindingSlot
|
|
16
|
-
|
|
12
|
+
queryParamBindingSlot,
|
|
13
|
+
specFetchHeaderBindingSlot,
|
|
14
|
+
specFetchQueryParamBindingSlot
|
|
15
|
+
} from "./chunk-EOXXE5DG.js";
|
|
17
16
|
|
|
18
17
|
// src/react/AddOpenApiSource.tsx
|
|
19
18
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
20
19
|
import { useAtomSet } from "@effect/atom-react";
|
|
20
|
+
import * as Effect from "effect/Effect";
|
|
21
21
|
import * as Exit from "effect/Exit";
|
|
22
22
|
import * as Match from "effect/Match";
|
|
23
23
|
import * as Option from "effect/Option";
|
|
24
24
|
import * as Schema from "effect/Schema";
|
|
25
|
-
import {
|
|
26
|
-
|
|
25
|
+
import {
|
|
26
|
+
ConnectionId,
|
|
27
|
+
ScopeId,
|
|
28
|
+
SecretId,
|
|
29
|
+
SetSourceCredentialBindingInput
|
|
30
|
+
} from "@executor-js/sdk/shared";
|
|
31
|
+
import { setSourceCredentialBinding, startOAuth } from "@executor-js/react/api/atoms";
|
|
27
32
|
import { useScope, useScopeStack } from "@executor-js/react/api/scope-context";
|
|
28
33
|
import { connectionWriteKeys, sourceWriteKeys } from "@executor-js/react/api/reactivity-keys";
|
|
29
34
|
import { HeadersList } from "@executor-js/react/plugins/headers-list";
|
|
@@ -173,6 +178,16 @@ function inferOAuthIssuerUrl(authorizationUrl) {
|
|
|
173
178
|
return null;
|
|
174
179
|
}
|
|
175
180
|
}
|
|
181
|
+
var specInputForAdd = (input) => {
|
|
182
|
+
const value2 = input.trim();
|
|
183
|
+
const parsed = Effect.runSyncExit(
|
|
184
|
+
Effect.try({
|
|
185
|
+
try: () => new URL(value2),
|
|
186
|
+
catch: () => null
|
|
187
|
+
})
|
|
188
|
+
);
|
|
189
|
+
return Exit.isSuccess(parsed) ? { kind: "url", url: value2 } : { kind: "blob", value: value2 };
|
|
190
|
+
};
|
|
176
191
|
var serializeStrategy = (s) => Match.value(s).pipe(
|
|
177
192
|
Match.when({ kind: "none" }, () => "none"),
|
|
178
193
|
Match.when({ kind: "custom" }, () => "custom"),
|
|
@@ -259,43 +274,36 @@ function AddOpenApiSource(props) {
|
|
|
259
274
|
})),
|
|
260
275
|
[scopeStack]
|
|
261
276
|
);
|
|
262
|
-
const defaultCredentialTargetScope = credentialScopeOptions[credentialScopeOptions.length - 1]?.scopeId ?? scopeId;
|
|
263
277
|
const defaultOAuthTokenTargetScope = credentialScopeOptions[0]?.scopeId ?? scopeId;
|
|
264
|
-
const [credentialTargetScope, setCredentialTargetScope] = useState(
|
|
265
|
-
defaultCredentialTargetScope
|
|
266
|
-
);
|
|
267
278
|
const [oauthTokenTargetScope, setOAuthTokenTargetScope] = useState(
|
|
268
279
|
defaultOAuthTokenTargetScope
|
|
269
280
|
);
|
|
270
|
-
const bindingScopeOptions = useMemo(
|
|
271
|
-
() => credentialScopeOptions.map((option) => ({ ...option })),
|
|
272
|
-
[credentialScopeOptions]
|
|
273
|
-
);
|
|
274
|
-
useEffect(() => {
|
|
275
|
-
if (!credentialScopeOptions.some((option) => option.scopeId === credentialTargetScope)) {
|
|
276
|
-
setCredentialTargetScope(defaultCredentialTargetScope);
|
|
277
|
-
}
|
|
278
|
-
}, [credentialScopeOptions, credentialTargetScope, defaultCredentialTargetScope]);
|
|
279
281
|
useEffect(() => {
|
|
280
282
|
if (!credentialScopeOptions.some((option) => option.scopeId === oauthTokenTargetScope)) {
|
|
281
283
|
setOAuthTokenTargetScope(defaultOAuthTokenTargetScope);
|
|
282
284
|
}
|
|
283
285
|
}, [credentialScopeOptions, defaultOAuthTokenTargetScope, oauthTokenTargetScope]);
|
|
284
|
-
|
|
285
|
-
|
|
286
|
+
useEffect(() => {
|
|
287
|
+
if (oauth2ClientIdScope && !credentialScopeOptions.some((option) => option.scopeId === oauth2ClientIdScope)) {
|
|
288
|
+
setOauth2ClientIdScope(null);
|
|
289
|
+
setOauth2ClientIdSecretId(null);
|
|
290
|
+
setOauth2AuthState(null);
|
|
291
|
+
}
|
|
292
|
+
if (oauth2ClientSecretScope && !credentialScopeOptions.some((option) => option.scopeId === oauth2ClientSecretScope)) {
|
|
293
|
+
setOauth2ClientSecretScope(null);
|
|
294
|
+
setOauth2ClientSecretSecretId(null);
|
|
295
|
+
setOauth2AuthState(null);
|
|
296
|
+
}
|
|
297
|
+
}, [credentialScopeOptions, oauth2ClientIdScope, oauth2ClientSecretScope]);
|
|
286
298
|
const doPreview = useAtomSet(previewOpenApiSpec, { mode: "promiseExit" });
|
|
287
299
|
const doAdd = useAtomSet(addOpenApiSpecOptimistic(scopeId), {
|
|
288
300
|
mode: "promiseExit"
|
|
289
301
|
});
|
|
290
302
|
const doStartOAuth = useAtomSet(startOAuth, { mode: "promiseExit" });
|
|
291
|
-
const doSetBinding = useAtomSet(
|
|
303
|
+
const doSetBinding = useAtomSet(setSourceCredentialBinding, {
|
|
292
304
|
mode: "promiseExit"
|
|
293
305
|
});
|
|
294
306
|
const secretList = useSecretPickerSecrets();
|
|
295
|
-
const initialCredentialSecrets = useMemo(
|
|
296
|
-
() => secretList.filter((secret) => secret.scopeId === String(credentialTargetScope)),
|
|
297
|
-
[credentialTargetScope, secretList]
|
|
298
|
-
);
|
|
299
307
|
const oauth = useOAuthPopupFlow({
|
|
300
308
|
popupName: OPENAPI_OAUTH_POPUP_NAME,
|
|
301
309
|
popupBlockedMessage: "OAuth popup was blocked by the browser",
|
|
@@ -324,6 +332,7 @@ function AddOpenApiSource(props) {
|
|
|
324
332
|
new Map(servers.flatMap(expandServerOptions).map((option) => [option.value, option])).values()
|
|
325
333
|
);
|
|
326
334
|
const resolvedBaseUrl = baseUrl.trim();
|
|
335
|
+
const sourceScope = ScopeId.make(scopeId);
|
|
327
336
|
const configuredHeaders = {};
|
|
328
337
|
const headerBindings = [];
|
|
329
338
|
const configuredQueryParams = {};
|
|
@@ -331,17 +340,14 @@ function AddOpenApiSource(props) {
|
|
|
331
340
|
for (const ch of customHeaders) {
|
|
332
341
|
if (!ch.name.trim()) continue;
|
|
333
342
|
const slot = headerBindingSlot(ch.name.trim());
|
|
334
|
-
configuredHeaders[ch.name.trim()] =
|
|
335
|
-
kind: "binding",
|
|
336
|
-
slot,
|
|
337
|
-
prefix: ch.prefix
|
|
338
|
-
});
|
|
343
|
+
configuredHeaders[ch.name.trim()] = { kind: "secret", prefix: ch.prefix };
|
|
339
344
|
if (ch.secretId) {
|
|
345
|
+
const targetScope = ch.targetScope ?? sourceScope;
|
|
340
346
|
headerBindings.push({
|
|
341
347
|
slot,
|
|
342
348
|
secretId: ch.secretId,
|
|
343
|
-
scope:
|
|
344
|
-
secretScope: ch.secretScope ??
|
|
349
|
+
scope: targetScope,
|
|
350
|
+
secretScope: ch.secretScope ?? targetScope
|
|
345
351
|
});
|
|
346
352
|
}
|
|
347
353
|
}
|
|
@@ -350,16 +356,13 @@ function AddOpenApiSource(props) {
|
|
|
350
356
|
if (!name) continue;
|
|
351
357
|
if (param.secretId) {
|
|
352
358
|
const slot = queryParamBindingSlot(name);
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
slot,
|
|
356
|
-
prefix: param.prefix
|
|
357
|
-
});
|
|
359
|
+
const targetScope = param.targetScope ?? sourceScope;
|
|
360
|
+
configuredQueryParams[name] = { kind: "secret", prefix: param.prefix };
|
|
358
361
|
queryParamBindings.push({
|
|
359
362
|
slot,
|
|
360
363
|
secretId: param.secretId,
|
|
361
|
-
scope:
|
|
362
|
-
secretScope: param.secretScope ??
|
|
364
|
+
scope: targetScope,
|
|
365
|
+
secretScope: param.secretScope ?? targetScope
|
|
363
366
|
});
|
|
364
367
|
continue;
|
|
365
368
|
}
|
|
@@ -367,6 +370,43 @@ function AddOpenApiSource(props) {
|
|
|
367
370
|
configuredQueryParams[name] = param.literalValue.trim();
|
|
368
371
|
}
|
|
369
372
|
}
|
|
373
|
+
const configuredSpecFetchHeaders = {};
|
|
374
|
+
const configuredSpecFetchQueryParams = {};
|
|
375
|
+
const specFetchBindings = [];
|
|
376
|
+
for (const header of specFetchCredentials.headers) {
|
|
377
|
+
const name = header.name.trim();
|
|
378
|
+
if (!name || !header.secretId) continue;
|
|
379
|
+
const targetScope = header.targetScope ?? sourceScope;
|
|
380
|
+
configuredSpecFetchHeaders[name] = { kind: "secret", prefix: header.prefix };
|
|
381
|
+
specFetchBindings.push({
|
|
382
|
+
slot: specFetchHeaderBindingSlot(name),
|
|
383
|
+
secretId: header.secretId,
|
|
384
|
+
scope: targetScope,
|
|
385
|
+
secretScope: header.secretScope ?? targetScope
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
for (const param of specFetchCredentials.queryParams) {
|
|
389
|
+
const name = param.name.trim();
|
|
390
|
+
if (!name) continue;
|
|
391
|
+
if (param.secretId) {
|
|
392
|
+
const targetScope = param.targetScope ?? sourceScope;
|
|
393
|
+
configuredSpecFetchQueryParams[name] = { kind: "secret", prefix: param.prefix };
|
|
394
|
+
specFetchBindings.push({
|
|
395
|
+
slot: specFetchQueryParamBindingSlot(name),
|
|
396
|
+
secretId: param.secretId,
|
|
397
|
+
scope: targetScope,
|
|
398
|
+
secretScope: param.secretScope ?? targetScope
|
|
399
|
+
});
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
402
|
+
if (param.literalValue?.trim()) {
|
|
403
|
+
configuredSpecFetchQueryParams[name] = param.literalValue.trim();
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
const configuredSpecFetchCredentials = Object.keys(configuredSpecFetchHeaders).length > 0 || Object.keys(configuredSpecFetchQueryParams).length > 0 ? {
|
|
407
|
+
...Object.keys(configuredSpecFetchHeaders).length > 0 ? { headers: configuredSpecFetchHeaders } : {},
|
|
408
|
+
...Object.keys(configuredSpecFetchQueryParams).length > 0 ? { queryParams: configuredSpecFetchQueryParams } : {}
|
|
409
|
+
} : null;
|
|
370
410
|
const oauth2Presets = preview?.oauth2Presets ?? [];
|
|
371
411
|
const oauth2RedirectUrl = oauthCallbackUrl(OPENAPI_OAUTH_CALLBACK_PATH);
|
|
372
412
|
const resolvedSourceId = slugifyNamespace(identity.namespace) || (preview ? Option.getOrElse(preview.title, () => "openapi") : "openapi");
|
|
@@ -404,7 +444,10 @@ function AddOpenApiSource(props) {
|
|
|
404
444
|
const hasIncompleteQueryCredentials = runtimeCredentials.queryParams.some(
|
|
405
445
|
(param) => param.name.trim() && !param.secretId && !param.literalValue?.trim()
|
|
406
446
|
);
|
|
407
|
-
const
|
|
447
|
+
const hasIncompleteSpecFetchCredentials = specFetchCredentials.headers.some((header) => header.name.trim() && !header.secretId) || specFetchCredentials.queryParams.some(
|
|
448
|
+
(param) => param.name.trim() && !param.secretId && !param.literalValue?.trim()
|
|
449
|
+
);
|
|
450
|
+
const willAddWithoutInitialCredentials = Boolean(selectedOAuth2Preset && !oauth2Auth) || hasIncompleteSpecFetchCredentials || hasIncompleteHeaderCredentials || hasIncompleteQueryCredentials;
|
|
408
451
|
const canAdd = preview !== null && resolvedBaseUrl.length > 0;
|
|
409
452
|
const handleAnalyze = async () => {
|
|
410
453
|
setAnalyzing(true);
|
|
@@ -478,21 +521,6 @@ function AddOpenApiSource(props) {
|
|
|
478
521
|
setStrategy(next.length === 0 ? { kind: "none" } : { kind: "custom" });
|
|
479
522
|
}
|
|
480
523
|
};
|
|
481
|
-
const setInitialCredentialScope = (targetScope) => {
|
|
482
|
-
setCredentialTargetScope(targetScope);
|
|
483
|
-
setCustomHeaders(
|
|
484
|
-
(headers) => headers.map((header) => ({
|
|
485
|
-
...header,
|
|
486
|
-
targetScope,
|
|
487
|
-
...header.secretScope && header.secretScope !== targetScope ? { secretId: null, secretScope: void 0 } : {}
|
|
488
|
-
}))
|
|
489
|
-
);
|
|
490
|
-
setOauth2ClientIdSecretId(null);
|
|
491
|
-
setOauth2ClientSecretSecretId(null);
|
|
492
|
-
setOauth2ClientIdScope(null);
|
|
493
|
-
setOauth2ClientSecretScope(null);
|
|
494
|
-
setOauth2AuthState(null);
|
|
495
|
-
};
|
|
496
524
|
const toggleOAuth2Scope = (scope) => {
|
|
497
525
|
setOauth2SelectedScopes((prev) => {
|
|
498
526
|
const copy = new Set(prev);
|
|
@@ -508,6 +536,8 @@ function AddOpenApiSource(props) {
|
|
|
508
536
|
setOauth2Error(null);
|
|
509
537
|
const displayName = identity.name.trim() || selectedOAuth2Preset.securitySchemeName;
|
|
510
538
|
const tokenUrl = resolveOAuthUrl(selectedOAuth2Preset.tokenUrl, resolvedBaseUrl);
|
|
539
|
+
const clientIdSecretScope = oauth2ClientIdScope ?? sourceScope;
|
|
540
|
+
const clientSecretSecretScope = oauth2ClientSecretScope ?? sourceScope;
|
|
511
541
|
if (selectedOAuth2Preset.flow === "clientCredentials") {
|
|
512
542
|
if (!oauth2ClientSecretSecretId) {
|
|
513
543
|
setOauth2Error("client_credentials requires a client secret");
|
|
@@ -526,7 +556,9 @@ function AddOpenApiSource(props) {
|
|
|
526
556
|
kind: "client-credentials",
|
|
527
557
|
tokenEndpoint: tokenUrl,
|
|
528
558
|
clientIdSecretId: oauth2ClientIdSecretId,
|
|
559
|
+
clientIdSecretScopeId: String(clientIdSecretScope),
|
|
529
560
|
clientSecretSecretId: oauth2ClientSecretSecretId,
|
|
561
|
+
clientSecretSecretScopeId: String(clientSecretSecretScope),
|
|
530
562
|
scopes: [...oauth2SelectedScopes]
|
|
531
563
|
},
|
|
532
564
|
pluginId: "openapi",
|
|
@@ -571,7 +603,9 @@ function AddOpenApiSource(props) {
|
|
|
571
603
|
tokenEndpoint: tokenUrl,
|
|
572
604
|
issuerUrl,
|
|
573
605
|
clientIdSecretId: oauth2ClientIdSecretId,
|
|
606
|
+
clientIdSecretScopeId: String(clientIdSecretScope),
|
|
574
607
|
clientSecretSecretId: oauth2ClientSecretSecretId ?? null,
|
|
608
|
+
clientSecretSecretScopeId: oauth2ClientSecretSecretId ? String(clientSecretSecretScope) : null,
|
|
575
609
|
scopes: [...oauth2SelectedScopes]
|
|
576
610
|
},
|
|
577
611
|
pluginId: "openapi",
|
|
@@ -615,7 +649,10 @@ function AddOpenApiSource(props) {
|
|
|
615
649
|
resolvedSourceId,
|
|
616
650
|
selectedOAuth2Fingerprint,
|
|
617
651
|
oauth,
|
|
618
|
-
oauthTokenTargetScope
|
|
652
|
+
oauthTokenTargetScope,
|
|
653
|
+
oauth2ClientIdScope,
|
|
654
|
+
oauth2ClientSecretScope,
|
|
655
|
+
sourceScope
|
|
619
656
|
]);
|
|
620
657
|
const handleCancelOAuth2 = useCallback(() => {
|
|
621
658
|
oauth.cancel();
|
|
@@ -630,13 +667,11 @@ function AddOpenApiSource(props) {
|
|
|
630
667
|
const exit = await doAdd({
|
|
631
668
|
params: { scopeId },
|
|
632
669
|
payload: {
|
|
633
|
-
|
|
634
|
-
credentialTargetScope,
|
|
635
|
-
spec: specUrl,
|
|
636
|
-
specFetchCredentials: serializeHttpCredentials(specFetchCredentials),
|
|
670
|
+
spec: specInputForAdd(specUrl),
|
|
637
671
|
name: displayName,
|
|
638
672
|
namespace,
|
|
639
|
-
baseUrl: resolvedBaseUrl
|
|
673
|
+
baseUrl: resolvedBaseUrl,
|
|
674
|
+
...configuredSpecFetchCredentials ? { specFetchCredentials: configuredSpecFetchCredentials } : {},
|
|
640
675
|
...hasHeaders ? { headers: configuredHeaders } : {},
|
|
641
676
|
...Object.keys(configuredQueryParams).length > 0 ? { queryParams: configuredQueryParams } : {},
|
|
642
677
|
...configuredOAuth2 ? { oauth2: configuredOAuth2 } : {}
|
|
@@ -649,19 +684,16 @@ function AddOpenApiSource(props) {
|
|
|
649
684
|
return;
|
|
650
685
|
}
|
|
651
686
|
const sourceId = exit.value.namespace;
|
|
652
|
-
const sourceScope = ScopeId.make(scopeId);
|
|
653
|
-
const bindingScope = ScopeId.make(credentialTargetScope);
|
|
654
687
|
const oauthTokenBindingScope = ScopeId.make(oauthTokenTargetScope);
|
|
655
|
-
const
|
|
656
|
-
const
|
|
688
|
+
const clientIdBindingScope = oauth2ClientIdScope ?? sourceScope;
|
|
689
|
+
const clientSecretBindingScope = oauth2ClientSecretScope ?? sourceScope;
|
|
657
690
|
for (const binding of headerBindings) {
|
|
658
691
|
const bindingExit = await doSetBinding({
|
|
659
692
|
params: { scopeId },
|
|
660
|
-
payload:
|
|
661
|
-
sourceId,
|
|
662
|
-
sourceScope,
|
|
693
|
+
payload: SetSourceCredentialBindingInput.make({
|
|
694
|
+
source: { id: sourceId, scope: sourceScope },
|
|
663
695
|
scope: binding.scope,
|
|
664
|
-
|
|
696
|
+
slotKey: binding.slot,
|
|
665
697
|
value: {
|
|
666
698
|
kind: "secret",
|
|
667
699
|
secretId: SecretId.make(binding.secretId),
|
|
@@ -679,11 +711,31 @@ function AddOpenApiSource(props) {
|
|
|
679
711
|
for (const binding of queryParamBindings) {
|
|
680
712
|
const bindingExit = await doSetBinding({
|
|
681
713
|
params: { scopeId },
|
|
682
|
-
payload:
|
|
683
|
-
sourceId,
|
|
684
|
-
sourceScope,
|
|
714
|
+
payload: SetSourceCredentialBindingInput.make({
|
|
715
|
+
source: { id: sourceId, scope: sourceScope },
|
|
685
716
|
scope: binding.scope,
|
|
686
|
-
|
|
717
|
+
slotKey: binding.slot,
|
|
718
|
+
value: {
|
|
719
|
+
kind: "secret",
|
|
720
|
+
secretId: SecretId.make(binding.secretId),
|
|
721
|
+
secretScopeId: binding.secretScope
|
|
722
|
+
}
|
|
723
|
+
}),
|
|
724
|
+
reactivityKeys: bindingWriteKeys
|
|
725
|
+
});
|
|
726
|
+
if (Exit.isFailure(bindingExit)) {
|
|
727
|
+
setAddError(errorMessageFromExit(bindingExit, "Failed to add source"));
|
|
728
|
+
setAdding(false);
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
for (const binding of specFetchBindings) {
|
|
733
|
+
const bindingExit = await doSetBinding({
|
|
734
|
+
params: { scopeId },
|
|
735
|
+
payload: SetSourceCredentialBindingInput.make({
|
|
736
|
+
source: { id: sourceId, scope: sourceScope },
|
|
737
|
+
scope: binding.scope,
|
|
738
|
+
slotKey: binding.slot,
|
|
687
739
|
value: {
|
|
688
740
|
kind: "secret",
|
|
689
741
|
secretId: SecretId.make(binding.secretId),
|
|
@@ -701,15 +753,14 @@ function AddOpenApiSource(props) {
|
|
|
701
753
|
if (configuredOAuth2 && oauth2ClientIdSecretId) {
|
|
702
754
|
const bindingExit = await doSetBinding({
|
|
703
755
|
params: { scopeId },
|
|
704
|
-
payload:
|
|
705
|
-
sourceId,
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
slot: configuredOAuth2.clientIdSlot,
|
|
756
|
+
payload: SetSourceCredentialBindingInput.make({
|
|
757
|
+
source: { id: sourceId, scope: sourceScope },
|
|
758
|
+
scope: clientIdBindingScope,
|
|
759
|
+
slotKey: configuredOAuth2.clientIdSlot,
|
|
709
760
|
value: {
|
|
710
761
|
kind: "secret",
|
|
711
762
|
secretId: SecretId.make(oauth2ClientIdSecretId),
|
|
712
|
-
secretScopeId:
|
|
763
|
+
secretScopeId: clientIdBindingScope
|
|
713
764
|
}
|
|
714
765
|
}),
|
|
715
766
|
reactivityKeys: bindingWriteKeys
|
|
@@ -723,15 +774,14 @@ function AddOpenApiSource(props) {
|
|
|
723
774
|
if (configuredOAuth2?.clientSecretSlot && oauth2ClientSecretSecretId) {
|
|
724
775
|
const bindingExit = await doSetBinding({
|
|
725
776
|
params: { scopeId },
|
|
726
|
-
payload:
|
|
727
|
-
sourceId,
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
slot: configuredOAuth2.clientSecretSlot,
|
|
777
|
+
payload: SetSourceCredentialBindingInput.make({
|
|
778
|
+
source: { id: sourceId, scope: sourceScope },
|
|
779
|
+
scope: clientSecretBindingScope,
|
|
780
|
+
slotKey: configuredOAuth2.clientSecretSlot,
|
|
731
781
|
value: {
|
|
732
782
|
kind: "secret",
|
|
733
783
|
secretId: SecretId.make(oauth2ClientSecretSecretId),
|
|
734
|
-
secretScopeId:
|
|
784
|
+
secretScopeId: clientSecretBindingScope
|
|
735
785
|
}
|
|
736
786
|
}),
|
|
737
787
|
reactivityKeys: bindingWriteKeys
|
|
@@ -745,11 +795,10 @@ function AddOpenApiSource(props) {
|
|
|
745
795
|
if (configuredOAuth2 && oauth2Auth) {
|
|
746
796
|
const bindingExit = await doSetBinding({
|
|
747
797
|
params: { scopeId },
|
|
748
|
-
payload:
|
|
749
|
-
sourceId,
|
|
750
|
-
sourceScope,
|
|
798
|
+
payload: SetSourceCredentialBindingInput.make({
|
|
799
|
+
source: { id: sourceId, scope: sourceScope },
|
|
751
800
|
scope: oauthTokenBindingScope,
|
|
752
|
-
|
|
801
|
+
slotKey: configuredOAuth2.connectionSlot,
|
|
753
802
|
value: {
|
|
754
803
|
kind: "connection",
|
|
755
804
|
connectionId: ConnectionId.make(oauth2Auth.connectionId)
|
|
@@ -806,7 +855,9 @@ function AddOpenApiSource(props) {
|
|
|
806
855
|
onChange: setSpecFetchCredentials,
|
|
807
856
|
existingSecrets: secretList,
|
|
808
857
|
sourceName: identity.name,
|
|
809
|
-
targetScope:
|
|
858
|
+
targetScope: sourceScope,
|
|
859
|
+
credentialScopeOptions,
|
|
860
|
+
bindingScopeOptions: credentialScopeOptions,
|
|
810
861
|
labels: {
|
|
811
862
|
headers: "Spec fetch headers",
|
|
812
863
|
queryParams: "Spec fetch query parameters"
|
|
@@ -920,10 +971,9 @@ function AddOpenApiSource(props) {
|
|
|
920
971
|
onHeadersChange: handleHeadersChange,
|
|
921
972
|
existingSecrets: secretList,
|
|
922
973
|
sourceName: identity.name,
|
|
923
|
-
targetScope:
|
|
924
|
-
credentialScopeOptions
|
|
925
|
-
bindingScopeOptions,
|
|
926
|
-
restrictSecretsToTargetScope: true,
|
|
974
|
+
targetScope: sourceScope,
|
|
975
|
+
credentialScopeOptions,
|
|
976
|
+
bindingScopeOptions: credentialScopeOptions,
|
|
927
977
|
emptyLabel: "No credentials yet. Add the header value this method should use."
|
|
928
978
|
}
|
|
929
979
|
) }),
|
|
@@ -934,10 +984,9 @@ function AddOpenApiSource(props) {
|
|
|
934
984
|
onChange: setRuntimeCredentials,
|
|
935
985
|
existingSecrets: secretList,
|
|
936
986
|
sourceName: identity.name,
|
|
937
|
-
targetScope:
|
|
938
|
-
credentialScopeOptions
|
|
939
|
-
bindingScopeOptions,
|
|
940
|
-
restrictSecretsToTargetScope: true,
|
|
987
|
+
targetScope: sourceScope,
|
|
988
|
+
credentialScopeOptions,
|
|
989
|
+
bindingScopeOptions: credentialScopeOptions,
|
|
941
990
|
sections: { headers: false, queryParams: true },
|
|
942
991
|
labels: { queryParams: "Runtime query parameters" }
|
|
943
992
|
}
|
|
@@ -968,14 +1017,14 @@ function AddOpenApiSource(props) {
|
|
|
968
1017
|
value: oauth2ClientIdSecretId,
|
|
969
1018
|
onSelect: (id, secretScopeId) => {
|
|
970
1019
|
setOauth2ClientIdSecretId(id);
|
|
971
|
-
setOauth2ClientIdScope(secretScopeId ??
|
|
1020
|
+
setOauth2ClientIdScope(secretScopeId ?? sourceScope);
|
|
972
1021
|
setOauth2AuthState(null);
|
|
973
1022
|
},
|
|
974
|
-
secrets:
|
|
1023
|
+
secrets: secretList,
|
|
975
1024
|
sourceName: identity.name,
|
|
976
1025
|
secretLabel: "Client ID",
|
|
977
|
-
targetScope: oauth2ClientIdScope ??
|
|
978
|
-
credentialScopeOptions
|
|
1026
|
+
targetScope: oauth2ClientIdScope ?? sourceScope,
|
|
1027
|
+
credentialScopeOptions,
|
|
979
1028
|
onCreatedScope: setOauth2ClientIdScope
|
|
980
1029
|
}
|
|
981
1030
|
)
|
|
@@ -983,9 +1032,15 @@ function AddOpenApiSource(props) {
|
|
|
983
1032
|
/* @__PURE__ */ jsx2(
|
|
984
1033
|
CredentialScopeDropdown,
|
|
985
1034
|
{
|
|
986
|
-
value:
|
|
987
|
-
options:
|
|
988
|
-
onChange:
|
|
1035
|
+
value: oauth2ClientIdScope ?? sourceScope,
|
|
1036
|
+
options: credentialScopeOptions,
|
|
1037
|
+
onChange: (targetScope) => {
|
|
1038
|
+
setOauth2ClientIdScope(targetScope);
|
|
1039
|
+
setOauth2ClientIdSecretId(null);
|
|
1040
|
+
setOauth2AuthState(null);
|
|
1041
|
+
},
|
|
1042
|
+
label: "Used by",
|
|
1043
|
+
help: "Choose where this OAuth client ID credential lives."
|
|
989
1044
|
}
|
|
990
1045
|
)
|
|
991
1046
|
] })
|
|
@@ -1008,14 +1063,14 @@ function AddOpenApiSource(props) {
|
|
|
1008
1063
|
value: oauth2ClientSecretSecretId,
|
|
1009
1064
|
onSelect: (id, secretScopeId) => {
|
|
1010
1065
|
setOauth2ClientSecretSecretId(id);
|
|
1011
|
-
setOauth2ClientSecretScope(secretScopeId ??
|
|
1066
|
+
setOauth2ClientSecretScope(secretScopeId ?? sourceScope);
|
|
1012
1067
|
setOauth2AuthState(null);
|
|
1013
1068
|
},
|
|
1014
|
-
secrets:
|
|
1069
|
+
secrets: secretList,
|
|
1015
1070
|
sourceName: identity.name,
|
|
1016
1071
|
secretLabel: "Client Secret",
|
|
1017
|
-
targetScope: oauth2ClientSecretScope ??
|
|
1018
|
-
credentialScopeOptions
|
|
1072
|
+
targetScope: oauth2ClientSecretScope ?? sourceScope,
|
|
1073
|
+
credentialScopeOptions,
|
|
1019
1074
|
onCreatedScope: setOauth2ClientSecretScope
|
|
1020
1075
|
}
|
|
1021
1076
|
)
|
|
@@ -1023,9 +1078,15 @@ function AddOpenApiSource(props) {
|
|
|
1023
1078
|
/* @__PURE__ */ jsx2(
|
|
1024
1079
|
CredentialScopeDropdown,
|
|
1025
1080
|
{
|
|
1026
|
-
value:
|
|
1027
|
-
options:
|
|
1028
|
-
onChange:
|
|
1081
|
+
value: oauth2ClientSecretScope ?? sourceScope,
|
|
1082
|
+
options: credentialScopeOptions,
|
|
1083
|
+
onChange: (targetScope) => {
|
|
1084
|
+
setOauth2ClientSecretScope(targetScope);
|
|
1085
|
+
setOauth2ClientSecretSecretId(null);
|
|
1086
|
+
setOauth2AuthState(null);
|
|
1087
|
+
},
|
|
1088
|
+
label: "Used by",
|
|
1089
|
+
help: "Choose where this OAuth client secret credential lives."
|
|
1029
1090
|
}
|
|
1030
1091
|
)
|
|
1031
1092
|
] })
|
|
@@ -1117,4 +1178,4 @@ export {
|
|
|
1117
1178
|
inferOAuthIssuerUrl,
|
|
1118
1179
|
AddOpenApiSource
|
|
1119
1180
|
};
|
|
1120
|
-
//# sourceMappingURL=chunk-
|
|
1181
|
+
//# sourceMappingURL=chunk-YJMXYKYX.js.map
|