@burdenoff/fe-libs 2026.930.4 → 2026.1001.1

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.
Files changed (126) hide show
  1. package/dist/connections/ConnectionDetailsTab.d.ts +11 -0
  2. package/dist/connections/ConnectionDetailsTab.d.ts.map +1 -0
  3. package/dist/connections/ConnectionDetailsTab.js +71 -0
  4. package/dist/connections/ConnectionDialog.d.ts +57 -0
  5. package/dist/connections/ConnectionDialog.d.ts.map +1 -0
  6. package/dist/connections/ConnectionDialog.js +88 -0
  7. package/dist/connections/ConnectionDialogPanel.d.ts +26 -0
  8. package/dist/connections/ConnectionDialogPanel.d.ts.map +1 -0
  9. package/dist/connections/ConnectionDialogPanel.js +272 -0
  10. package/dist/connections/ConnectionFormTab.d.ts +37 -0
  11. package/dist/connections/ConnectionFormTab.d.ts.map +1 -0
  12. package/dist/connections/ConnectionFormTab.js +185 -0
  13. package/dist/connections/CredentialStorageSelector.d.ts +19 -0
  14. package/dist/connections/CredentialStorageSelector.d.ts.map +1 -0
  15. package/dist/connections/CredentialStorageSelector.js +294 -0
  16. package/dist/connections/DialogHeading.d.ts +7 -0
  17. package/dist/connections/DialogHeading.d.ts.map +1 -0
  18. package/dist/connections/DialogHeading.js +16 -0
  19. package/dist/connections/ProviderIcon.d.ts +10 -0
  20. package/dist/connections/ProviderIcon.d.ts.map +1 -0
  21. package/dist/connections/ProviderIcon.js +57 -0
  22. package/dist/connections/ProviderPickerPanel.d.ts +15 -0
  23. package/dist/connections/ProviderPickerPanel.d.ts.map +1 -0
  24. package/dist/connections/ProviderPickerPanel.js +84 -0
  25. package/dist/connections/ScopePicker.d.ts +15 -0
  26. package/dist/connections/ScopePicker.d.ts.map +1 -0
  27. package/dist/connections/ScopePicker.js +38 -0
  28. package/dist/connections/api.d.ts +60 -0
  29. package/dist/connections/api.d.ts.map +1 -0
  30. package/dist/connections/api.js +259 -0
  31. package/dist/connections/assets/bigconsole.png.js +4 -0
  32. package/dist/connections/assets/burdenoff.png.js +4 -0
  33. package/dist/connections/connectionFlow.d.ts +81 -0
  34. package/dist/connections/connectionFlow.d.ts.map +1 -0
  35. package/dist/connections/connectionFlow.js +101 -0
  36. package/dist/connections/frame.d.ts +32 -0
  37. package/dist/connections/frame.d.ts.map +1 -0
  38. package/dist/connections/frame.js +13 -0
  39. package/dist/connections/index.d.ts +24 -0
  40. package/dist/connections/index.d.ts.map +1 -0
  41. package/dist/connections/labels.d.ts +5 -0
  42. package/dist/connections/labels.d.ts.map +1 -0
  43. package/dist/connections/labels.js +35 -0
  44. package/dist/connections/oauthPopup.d.ts +48 -0
  45. package/dist/connections/oauthPopup.d.ts.map +1 -0
  46. package/dist/connections/oauthPopup.js +70 -0
  47. package/dist/connections/picker.d.ts +7 -0
  48. package/dist/connections/picker.d.ts.map +1 -0
  49. package/dist/connections/picker.js +16 -0
  50. package/dist/connections/providerIdentity.d.ts +23 -0
  51. package/dist/connections/providerIdentity.d.ts.map +1 -0
  52. package/dist/connections/providerIdentity.js +175 -0
  53. package/dist/connections/scopes.d.ts +42 -0
  54. package/dist/connections/scopes.d.ts.map +1 -0
  55. package/dist/connections/scopes.js +30 -0
  56. package/dist/connections/storage.d.ts +8 -0
  57. package/dist/connections/storage.d.ts.map +1 -0
  58. package/dist/connections/storage.js +21 -0
  59. package/dist/connections/types.d.ts +82 -0
  60. package/dist/connections/types.d.ts.map +1 -0
  61. package/dist/connections/useConnectionSubmit.d.ts +22 -0
  62. package/dist/connections/useConnectionSubmit.d.ts.map +1 -0
  63. package/dist/connections/useConnectionSubmit.js +99 -0
  64. package/dist/connections.d.ts +2 -0
  65. package/dist/connections.js +14 -0
  66. package/dist/credentials/AuthMethodSelector.d.ts +4 -0
  67. package/dist/credentials/AuthMethodSelector.d.ts.map +1 -1
  68. package/dist/credentials/AuthMethodSelector.js +42 -33
  69. package/dist/credentials/SchemaForm.d.ts +3 -28
  70. package/dist/credentials/SchemaForm.d.ts.map +1 -1
  71. package/dist/credentials/SchemaForm.js +116 -162
  72. package/dist/credentials/index.d.ts +5 -2
  73. package/dist/credentials/index.d.ts.map +1 -1
  74. package/dist/credentials/methods.d.ts +11 -0
  75. package/dist/credentials/methods.d.ts.map +1 -0
  76. package/dist/credentials/methods.js +6 -0
  77. package/dist/credentials/schema.d.ts +43 -0
  78. package/dist/credentials/schema.d.ts.map +1 -0
  79. package/dist/credentials/schema.js +56 -0
  80. package/dist/credentials/translate.d.ts +18 -0
  81. package/dist/credentials/translate.d.ts.map +1 -0
  82. package/dist/credentials/translate.js +7 -0
  83. package/dist/credentials/types.d.ts +1 -1
  84. package/dist/credentials.js +6 -3
  85. package/dist/shared/assistant/conversation.d.ts +5 -1
  86. package/dist/shared/assistant/conversation.d.ts.map +1 -1
  87. package/dist/shared/assistant/history/historyApi.d.ts +25 -9
  88. package/dist/shared/assistant/history/historyApi.d.ts.map +1 -1
  89. package/dist/shared/assistant/history/historyApi.js +220 -75
  90. package/dist/shared/assistant/history/historyControls.d.ts +86 -0
  91. package/dist/shared/assistant/history/historyControls.d.ts.map +1 -0
  92. package/dist/shared/assistant/history/historyControls.js +80 -0
  93. package/dist/shared/assistant/history/historyEngine.d.ts +23 -3
  94. package/dist/shared/assistant/history/historyEngine.d.ts.map +1 -1
  95. package/dist/shared/assistant/history/historyEngine.js +578 -369
  96. package/dist/shared/assistant/history/historyErrors.d.ts +25 -5
  97. package/dist/shared/assistant/history/historyErrors.d.ts.map +1 -1
  98. package/dist/shared/assistant/history/historyErrors.js +39 -30
  99. package/dist/shared/assistant/history/historyList.d.ts +33 -7
  100. package/dist/shared/assistant/history/historyList.d.ts.map +1 -1
  101. package/dist/shared/assistant/history/historyList.js +72 -51
  102. package/dist/shared/assistant/history/historyOperations.d.ts +36 -7
  103. package/dist/shared/assistant/history/historyOperations.d.ts.map +1 -1
  104. package/dist/shared/assistant/history/historyOperations.js +100 -25
  105. package/dist/shared/assistant/history/historyStatus.d.ts +27 -1
  106. package/dist/shared/assistant/history/historyStatus.d.ts.map +1 -1
  107. package/dist/shared/assistant/history/historyStatus.js +6 -2
  108. package/dist/shared/assistant/history/historyStore.d.ts +29 -7
  109. package/dist/shared/assistant/history/historyStore.d.ts.map +1 -1
  110. package/dist/shared/assistant/history/historyStore.js +172 -103
  111. package/dist/shared/assistant/history/historyTransportErrors.d.ts +28 -0
  112. package/dist/shared/assistant/history/historyTransportErrors.d.ts.map +1 -0
  113. package/dist/shared/assistant/history/historyTransportErrors.js +16 -0
  114. package/dist/shared/assistant/history/historyTypes.d.ts +80 -1
  115. package/dist/shared/assistant/history/historyTypes.d.ts.map +1 -1
  116. package/dist/shared/assistant/history/stampRegistry.d.ts +19 -1
  117. package/dist/shared/assistant/history/stampRegistry.d.ts.map +1 -1
  118. package/dist/shared/assistant/history/stampRegistry.js +13 -1
  119. package/dist/shared/assistant/index.d.ts +2 -0
  120. package/dist/shared/assistant/index.d.ts.map +1 -1
  121. package/dist/shared/assistant/store.d.ts +8 -0
  122. package/dist/shared/assistant/store.d.ts.map +1 -1
  123. package/dist/shared/assistant/store.js +50 -46
  124. package/dist/shared/assistant/writeReplyBinder.d.ts +1 -1
  125. package/dist/shared-assistant.js +164 -162
  126. package/package.json +11 -2
@@ -0,0 +1,84 @@
1
+ import { cn as e } from "../lib/utils.js";
2
+ import { IllustratedEmptyState as t } from "../ui/illustration.js";
3
+ import { authTypeLabel as n, categoryLabel as r } from "./labels.js";
4
+ import { ProviderIcon as i } from "./ProviderIcon.js";
5
+ import { INPUT_CLASS as a } from "./frame.js";
6
+ import { groupByCategory as o, pickableProviders as s } from "./picker.js";
7
+ import { useEffect as c, useMemo as l, useState as u } from "react";
8
+ import { Loader2 as d, Search as f } from "lucide-react";
9
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
10
+ //#region src/connections/ProviderPickerPanel.tsx
11
+ var h = ({ api: h, source: g, translate: _, searchInputRef: v, onSelect: y }) => {
12
+ let [b, x] = u([]), [S, C] = u(!0), [w, T] = u(""), E = g === "installed";
13
+ c(() => {
14
+ let e = !1;
15
+ return h.listProviders(g).then((t) => {
16
+ e || x(t);
17
+ }).catch(() => {
18
+ e || x([]);
19
+ }).finally(() => {
20
+ e || C(!1);
21
+ }), () => {
22
+ e = !0;
23
+ };
24
+ }, [h, g]);
25
+ let D = l(() => s(b, g, w, _), [
26
+ b,
27
+ g,
28
+ w,
29
+ _
30
+ ]), O = l(() => o(D), [D]);
31
+ return /* @__PURE__ */ m("div", {
32
+ className: "min-h-0 flex-1 overflow-y-auto p-5",
33
+ children: [/* @__PURE__ */ m("div", {
34
+ className: "relative mb-4",
35
+ children: [/* @__PURE__ */ p(f, {
36
+ size: 16,
37
+ className: "absolute left-3 top-1/2 -translate-y-1/2 text-text-secondary"
38
+ }), /* @__PURE__ */ p("input", {
39
+ ref: v,
40
+ type: "text",
41
+ value: w,
42
+ onChange: (e) => T(e.target.value),
43
+ placeholder: E ? _("integrations.addConnection.search.placeholder", "Search installed providers...") : _("integrations.addConnection.search.catalogPlaceholder", "Search providers..."),
44
+ "aria-label": E ? _("integrations.addConnection.search.ariaLabel", "Search installed providers") : _("integrations.addConnection.search.catalogAriaLabel", "Search providers"),
45
+ className: e(a, "py-2.5 pl-9")
46
+ })]
47
+ }), S ? /* @__PURE__ */ p("div", {
48
+ className: "flex items-center justify-center py-8",
49
+ children: /* @__PURE__ */ p(d, {
50
+ size: 24,
51
+ className: "animate-spin text-text-secondary"
52
+ })
53
+ }) : D.length === 0 ? /* @__PURE__ */ p(t, {
54
+ illustration: w ? "empty-search" : "empty-data",
55
+ title: w ? _("integrations.addConnection.empty.noMatchingProviders", "No matching providers") : _("integrations.addConnection.empty.noInstalledProviders", "No installed providers yet"),
56
+ description: w ? _("integrations.addConnection.empty.matchingDescription", "No installed provider matches your search. Try a different term or install one from the catalog.", { query: w }) : _("integrations.addConnection.empty.installedDescription", "You need at least one installed, enabled provider before you can create a connection. Install one from the catalog to get started.")
57
+ }) : /* @__PURE__ */ p("div", {
58
+ className: "space-y-1",
59
+ children: O.map(([e, t]) => /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ p("div", {
60
+ className: "px-2 py-1.5 text-xs font-semibold uppercase tracking-wider text-text-secondary",
61
+ children: r(e, _)
62
+ }), t.map((e) => /* @__PURE__ */ m("button", {
63
+ type: "button",
64
+ onClick: () => y(e),
65
+ className: "flex w-full items-center gap-3 rounded-md px-3 py-2.5 text-left transition-colors hover:bg-accent/50",
66
+ children: [/* @__PURE__ */ p(i, {
67
+ provider: e,
68
+ size: 32
69
+ }), /* @__PURE__ */ m("span", {
70
+ className: "min-w-0 flex-1",
71
+ children: [/* @__PURE__ */ p("span", {
72
+ className: "block text-sm font-medium text-text-primary",
73
+ children: e.name
74
+ }), /* @__PURE__ */ p("span", {
75
+ className: "block text-xs text-text-secondary",
76
+ children: n(e.authType, _)
77
+ })]
78
+ })]
79
+ }, e.id))] }, e))
80
+ })]
81
+ });
82
+ };
83
+ //#endregion
84
+ export { h as ProviderPickerPanel };
@@ -0,0 +1,15 @@
1
+ import { FC } from 'react';
2
+ import { Translator } from '../credentials/translate';
3
+ import { ScopeOption, ScopeSelection } from './scopes';
4
+ interface ScopePickerProps {
5
+ options: ScopeOption[];
6
+ /** Scopes the method requests when the user picks nothing. */
7
+ defaultScopes: string[];
8
+ selection: ScopeSelection;
9
+ onChange: (selection: string[]) => void;
10
+ translate: Translator;
11
+ disabled?: boolean;
12
+ }
13
+ export declare const ScopePicker: FC<ScopePickerProps>;
14
+ export {};
15
+ //# sourceMappingURL=ScopePicker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ScopePicker.d.ts","sourceRoot":"","sources":["../../src/connections/ScopePicker.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAA+B,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,UAAU,CAAC;AAE9F,UAAU,gBAAgB;IACxB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,8DAA8D;IAC9D,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,SAAS,EAAE,cAAc,CAAC;IAC1B,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACxC,SAAS,EAAE,UAAU,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAkD5C,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { isScopeChecked as e, toggleScope as t } from "./scopes.js";
2
+ import { Lock as n } from "lucide-react";
3
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
4
+ //#region src/connections/ScopePicker.tsx
5
+ var a = ({ options: a, defaultScopes: o, selection: s, onChange: c, translate: l, disabled: u }) => {
6
+ let d = a.filter((e) => !e.required), f = a.filter((e) => e.required);
7
+ return d.length === 0 ? null : /* @__PURE__ */ i("div", {
8
+ className: "space-y-2",
9
+ children: [
10
+ /* @__PURE__ */ r("span", {
11
+ className: "block text-sm font-medium text-text-primary",
12
+ children: l("integrations.addConnection.scopes.title", "Permissions")
13
+ }),
14
+ /* @__PURE__ */ r("div", {
15
+ className: "space-y-1.5 rounded-md border border-border-subtle p-3",
16
+ children: d.map((n) => /* @__PURE__ */ i("label", {
17
+ className: "flex cursor-pointer items-start gap-2 text-sm text-text-primary",
18
+ children: [/* @__PURE__ */ r("input", {
19
+ type: "checkbox",
20
+ checked: e(n.scope, s, o),
21
+ onChange: () => c(t(n.scope, s, o, a)),
22
+ disabled: u,
23
+ className: "mt-0.5"
24
+ }), /* @__PURE__ */ r("span", { children: n.description ?? n.scope })]
25
+ }, n.scope))
26
+ }),
27
+ f.length > 0 && /* @__PURE__ */ i("p", {
28
+ className: "flex items-center gap-1.5 text-xs text-text-secondary",
29
+ children: [/* @__PURE__ */ r(n, {
30
+ size: 12,
31
+ className: "flex-shrink-0"
32
+ }), l("integrations.addConnection.scopes.alwaysIncluded", "Always included: {{scopes}}", { scopes: f.map((e) => e.scope).join(", ") })]
33
+ })
34
+ ]
35
+ });
36
+ };
37
+ //#endregion
38
+ export { a as ScopePicker };
@@ -0,0 +1,60 @@
1
+ import { ApolloClient } from '@apollo/client';
2
+ import { ConnectionAuthMethod, ConnectionProvider, ProviderAuthType, VaultSecretSummary, VaultSummary } from './types';
3
+ /** A connection as the dialog tracks it. */
4
+ export interface ConnectionRecord {
5
+ id: string;
6
+ name: string;
7
+ status: string;
8
+ errorMessage: string | null;
9
+ }
10
+ export interface CreateConnectionInput {
11
+ name: string;
12
+ description?: string;
13
+ providerId: string;
14
+ authMethodKey?: string;
15
+ config?: Record<string, unknown>;
16
+ vaultId?: string;
17
+ credentialSecretId?: string;
18
+ managedSecretName?: string;
19
+ }
20
+ /** Everything the dialog asks of the service. Faked in tests. */
21
+ export interface ConnectionsApi {
22
+ listProviders(source: 'installed' | 'catalog'): Promise<ConnectionProvider[]>;
23
+ getProvider(ref: {
24
+ id?: string;
25
+ key?: string;
26
+ }): Promise<ConnectionProvider | null>;
27
+ createConnection(input: CreateConnectionInput): Promise<ConnectionRecord>;
28
+ initiateOAuth(input: {
29
+ connectionId: string;
30
+ redirectUri: string;
31
+ scopes?: string[];
32
+ }): Promise<{
33
+ redirectUrl: string | null;
34
+ }>;
35
+ authenticateConnection(input: {
36
+ connectionId: string;
37
+ authMethodKey?: string;
38
+ values: Record<string, unknown>;
39
+ }): Promise<ConnectionRecord | null>;
40
+ authenticateWithServiceAccount(input: {
41
+ connectionId: string;
42
+ scopes?: string[];
43
+ }): Promise<ConnectionRecord | null>;
44
+ getConnection(id: string): Promise<ConnectionRecord | null>;
45
+ listVaults(): Promise<VaultSummary[]>;
46
+ listVaultSecrets(vaultId: string): Promise<VaultSecretSummary[]>;
47
+ createVault(name: string): Promise<VaultSummary>;
48
+ }
49
+ export interface ConnectionsApiOptions {
50
+ /**
51
+ * Named queries to refetch once a connection is created, so the host's own
52
+ * lists (e.g. `GetConnections`) show it without a reload.
53
+ */
54
+ refetchQueriesOnCreate?: string[];
55
+ }
56
+ export declare function normalizeAuthType(value: unknown): ProviderAuthType;
57
+ export declare function mapAuthMethod(raw: unknown): ConnectionAuthMethod;
58
+ export declare function mapProvider(raw: unknown): ConnectionProvider;
59
+ export declare function createConnectionsApi(client: ApolloClient, options?: ConnectionsApiOptions): ConnectionsApi;
60
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/connections/api.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,259 @@
1
+ import { normalizeProviderCategory as e } from "./providerIdentity.js";
2
+ import { gql as t } from "@apollo/client";
3
+ //#region src/connections/api.ts
4
+ var n = "\n id\n key\n name\n description\n category\n authType\n icon\n website\n docsUrl\n isEnabled\n pluginStatus\n defaultScopes\n availableScopes\n configSchema\n authMethods {\n \n key\n displayName\n description\n authType\n flow\n defaultScopes\n availableScopes\n configSchema\n isConfigured\n isEnabled\n displayOrder\n\n }\n", r = t`
5
+ query ConnectionDialogProviders(
6
+ $filter: ProviderFilterInput
7
+ $pagination: IntegrationsPaginationInput
8
+ ) {
9
+ getProviders(filter: $filter, pagination: $pagination) {
10
+ items {
11
+ ${n}
12
+ }
13
+ }
14
+ }
15
+ `, i = t`
16
+ query ConnectionDialogProviderCatalog($pagination: IntegrationsPaginationInput) {
17
+ getProviderCatalog(pagination: $pagination) {
18
+ items {
19
+ ${n}
20
+ }
21
+ }
22
+ }
23
+ `, a = t`
24
+ query ConnectionDialogProvider($id: ID!) {
25
+ getProvider(id: $id) {
26
+ ${n}
27
+ }
28
+ }
29
+ `, o = t`
30
+ query ConnectionDialogProviderByKey($key: String!) {
31
+ getProviderByKey(key: $key) {
32
+ ${n}
33
+ }
34
+ }
35
+ `, s = "\n id\n name\n status\n errorMessage\n", c = t`
36
+ mutation ConnectionDialogCreate($input: CreateConnectionInput!) {
37
+ createConnection(input: $input) {
38
+ ${s}
39
+ }
40
+ }
41
+ `, l = t`
42
+ mutation ConnectionDialogInitiateOAuth($input: InitiateOAuthInput!) {
43
+ initiateOAuth(input: $input) {
44
+ redirectUrl
45
+ }
46
+ }
47
+ `, u = t`
48
+ mutation ConnectionDialogAuthenticate($input: AuthenticateConnectionInput!) {
49
+ authenticateConnection(input: $input) {
50
+ ${s}
51
+ }
52
+ }
53
+ `, d = t`
54
+ mutation ConnectionDialogServiceAccount($input: ServiceAccountAuthInput!) {
55
+ authenticateWithServiceAccount(input: $input) {
56
+ ${s}
57
+ }
58
+ }
59
+ `, f = t`
60
+ query ConnectionDialogConnection($id: ID!) {
61
+ getConnection(id: $id) {
62
+ ${s}
63
+ }
64
+ }
65
+ `, p = t`
66
+ query ConnectionDialogVaults($filter: VaultFilterInput, $pagination: SecurityPaginationInput) {
67
+ getVaults(filter: $filter, pagination: $pagination) {
68
+ items {
69
+ id
70
+ name
71
+ secretCount
72
+ }
73
+ }
74
+ }
75
+ `, m = t`
76
+ query ConnectionDialogVaultSecrets(
77
+ $vaultId: ID!
78
+ $filter: SecretFilterInput
79
+ $pagination: SecurityPaginationInput
80
+ ) {
81
+ getSecrets(vaultId: $vaultId, filter: $filter, pagination: $pagination) {
82
+ items {
83
+ id
84
+ name
85
+ type
86
+ }
87
+ }
88
+ }
89
+ `, h = t`
90
+ mutation ConnectionDialogCreateVault($input: CreateVaultInput!) {
91
+ createVault(input: $input) {
92
+ id
93
+ name
94
+ }
95
+ }
96
+ `;
97
+ function g(e) {
98
+ return typeof e == "object" && e ? e : {};
99
+ }
100
+ function _(e) {
101
+ return typeof e == "string" ? e : "";
102
+ }
103
+ function v(e) {
104
+ return Array.isArray(e) ? e.filter((e) => typeof e == "string") : [];
105
+ }
106
+ function y(e) {
107
+ return typeof e == "object" && e && !Array.isArray(e) ? e : null;
108
+ }
109
+ var b = {
110
+ OAUTH2: "oauth2",
111
+ OAUTH1: "oauth2",
112
+ API_KEY: "api_key",
113
+ BASIC_AUTH: "basic_auth",
114
+ BEARER_TOKEN: "bearer_token",
115
+ SERVICE_ACCOUNT: "service_account",
116
+ WORKSPACE_APP_TOKEN: "workspace_app_token",
117
+ CUSTOM: "custom"
118
+ };
119
+ function x(e) {
120
+ let t = String(e ?? "").toUpperCase();
121
+ return Object.prototype.hasOwnProperty.call(b, t) ? b[t] : "api_key";
122
+ }
123
+ function S(e) {
124
+ let t = String(e ?? "").toLowerCase();
125
+ return t === "oauth2" || t === "minted" ? t : "fields";
126
+ }
127
+ function C(e) {
128
+ let t = g(e), n = _(t.key);
129
+ return {
130
+ key: n,
131
+ displayName: _(t.displayName) || n,
132
+ description: _(t.description) || null,
133
+ authType: x(t.authType),
134
+ flow: S(t.flow),
135
+ defaultScopes: v(t.defaultScopes),
136
+ availableScopes: t.availableScopes ?? null,
137
+ configSchema: y(t.configSchema),
138
+ isConfigured: t.isConfigured !== !1,
139
+ isEnabled: t.isEnabled !== !1,
140
+ displayOrder: Number(t.displayOrder ?? 0)
141
+ };
142
+ }
143
+ function w(t) {
144
+ let n = g(t);
145
+ return {
146
+ id: _(n.id),
147
+ key: _(n.key),
148
+ name: _(n.name),
149
+ description: _(n.description),
150
+ category: e(n.category),
151
+ authType: x(n.authType),
152
+ icon: _(n.icon),
153
+ website: _(n.website),
154
+ docsUrl: _(n.docsUrl),
155
+ isEnabled: n.isEnabled !== !1,
156
+ pluginStatus: _(n.pluginStatus).toLowerCase(),
157
+ defaultScopes: v(n.defaultScopes),
158
+ availableScopes: n.availableScopes ?? null,
159
+ configSchema: y(n.configSchema),
160
+ authMethods: (Array.isArray(n.authMethods) ? n.authMethods : []).map(C).sort((e, t) => e.displayOrder - t.displayOrder)
161
+ };
162
+ }
163
+ function T(e) {
164
+ let t = g(e), n = _(t.id);
165
+ return n ? {
166
+ id: n,
167
+ name: _(t.name),
168
+ status: _(t.status),
169
+ errorMessage: _(t.errorMessage) || null
170
+ } : null;
171
+ }
172
+ function E(e) {
173
+ if (e.error) throw e.error instanceof Error ? e.error : /* @__PURE__ */ Error("The request failed");
174
+ return e.data ?? null;
175
+ }
176
+ function D(e, t = {}) {
177
+ let n = async (t, n) => E(await e.query({
178
+ query: t,
179
+ variables: n,
180
+ fetchPolicy: "network-only"
181
+ })), s = async (t, n) => E(await e.mutate({
182
+ mutation: t,
183
+ variables: n
184
+ }));
185
+ return {
186
+ async listProviders(e) {
187
+ return e === "catalog" ? ((await n(i, { pagination: { limit: 100 } }))?.getProviderCatalog?.items ?? []).map(w) : ((await n(r, { pagination: { limit: 100 } }))?.getProviders?.items ?? []).map(w);
188
+ },
189
+ async getProvider({ id: e, key: t }) {
190
+ if (e) {
191
+ let t = await n(a, { id: e });
192
+ return t?.getProvider ? w(t.getProvider) : null;
193
+ }
194
+ if (t) {
195
+ let e = await n(o, { key: t });
196
+ return e?.getProviderByKey ? w(e.getProviderByKey) : null;
197
+ }
198
+ return null;
199
+ },
200
+ async createConnection(n) {
201
+ let r = T((await s(c, { input: n }))?.createConnection);
202
+ if (!r) throw Error("Failed to create connection");
203
+ return t.refetchQueriesOnCreate?.length && e.refetchQueries({ include: t.refetchQueriesOnCreate }).catch(() => void 0), r;
204
+ },
205
+ async initiateOAuth(e) {
206
+ return { redirectUrl: _((await s(l, { input: e }))?.initiateOAuth?.redirectUrl) || null };
207
+ },
208
+ async authenticateConnection(e) {
209
+ return T((await s(u, { input: e }))?.authenticateConnection);
210
+ },
211
+ async authenticateWithServiceAccount(e) {
212
+ return T((await s(d, { input: e }))?.authenticateWithServiceAccount);
213
+ },
214
+ async getConnection(e) {
215
+ return T((await n(f, { id: e }))?.getConnection);
216
+ },
217
+ async listVaults() {
218
+ return ((await n(p, {
219
+ filter: { status: "ACTIVE" },
220
+ pagination: { limit: 100 }
221
+ }))?.getVaults?.items ?? []).map((e) => {
222
+ let t = g(e);
223
+ return {
224
+ id: _(t.id),
225
+ name: _(t.name),
226
+ secretCount: Number(t.secretCount ?? 0)
227
+ };
228
+ });
229
+ },
230
+ async listVaultSecrets(e) {
231
+ return ((await n(m, {
232
+ vaultId: e,
233
+ filter: { status: "ACTIVE" },
234
+ pagination: { limit: 100 }
235
+ }))?.getSecrets?.items ?? []).map((e) => {
236
+ let t = g(e);
237
+ return {
238
+ id: _(t.id),
239
+ name: _(t.name),
240
+ type: _(t.type)
241
+ };
242
+ });
243
+ },
244
+ async createVault(e) {
245
+ let t = g((await s(h, { input: {
246
+ name: e.trim(),
247
+ scope: "WORKSPACE"
248
+ } }))?.createVault);
249
+ if (!_(t.id)) throw Error("The vault could not be created");
250
+ return {
251
+ id: _(t.id),
252
+ name: _(t.name),
253
+ secretCount: 0
254
+ };
255
+ }
256
+ };
257
+ }
258
+ //#endregion
259
+ export { D as createConnectionsApi, w as mapProvider, x as normalizeAuthType };