@burdenoff/fe-libs 2026.1119.8 → 2026.1120.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.
@@ -9,6 +9,32 @@ export interface ConnectionRecord {
9
9
  /** The signed-in account, once the provider has told the service who it is. */
10
10
  externalAccountEmail?: string | null;
11
11
  externalAccountName?: string | null;
12
+ /** When the service last wrote the record; tells a new outcome from an old one. */
13
+ updatedAt?: string | null;
14
+ }
15
+ /** The editable values of an existing connection, as Reconnect starts from them. */
16
+ export interface ConnectionSettings {
17
+ id: string;
18
+ name: string;
19
+ description: string | null;
20
+ /** The sign-in method it was made with; null means the provider's default. */
21
+ authMethodKey: string | null;
22
+ /** Non-secret settings, such as a bring-your-own app's client id. */
23
+ config: Record<string, unknown>;
24
+ /**
25
+ * The form values Reconnect opened with (or last saved). A field still
26
+ * holding its value is untouched and is not written, so a schema default
27
+ * the form showed for a setting the connection lacks is never saved just
28
+ * by reconnecting.
29
+ */
30
+ formValues?: Record<string, unknown>;
31
+ }
32
+ /** The fields `updateConnection` changes; anything left out is kept. */
33
+ export interface UpdateConnectionInput {
34
+ name?: string;
35
+ description?: string;
36
+ /** Replaces the stored config. */
37
+ config?: Record<string, unknown>;
12
38
  }
13
39
  export interface CreateConnectionInput {
14
40
  name: string;
@@ -47,6 +73,8 @@ export interface ConnectionsApi {
47
73
  scopes?: string[];
48
74
  }): Promise<ConnectionRecord | null>;
49
75
  getConnection(id: string): Promise<ConnectionRecord | null>;
76
+ getConnectionSettings(id: string): Promise<ConnectionSettings | null>;
77
+ updateConnection(id: string, input: UpdateConnectionInput): Promise<ConnectionRecord | null>;
50
78
  listVaults(): Promise<VaultSummary[]>;
51
79
  listVaultSecrets(vaultId: string): Promise<VaultSecretSummary[]>;
52
80
  createVault(name: string): Promise<VaultSummary>;
@@ -34,7 +34,7 @@ var n = "\n id\n key\n name\n description\n category\n authType\n icon\n
34
34
  ${n}
35
35
  }
36
36
  }
37
- `, s = "\n id\n name\n status\n errorMessage\n externalAccountEmail\n externalAccountName\n", c = t`
37
+ `, s = "\n id\n name\n status\n errorMessage\n externalAccountEmail\n externalAccountName\n updatedAt\n", c = t`
38
38
  mutation ConnectionDialogCreate($input: CreateConnectionInput!) {
39
39
  createConnection(input: $input) {
40
40
  ${s}
@@ -65,6 +65,22 @@ var n = "\n id\n key\n name\n description\n category\n authType\n icon\n
65
65
  }
66
66
  }
67
67
  `, p = t`
68
+ query ConnectionDialogConnectionSettings($id: ID!) {
69
+ getConnection(id: $id) {
70
+ id
71
+ name
72
+ description
73
+ authMethodKey
74
+ config
75
+ }
76
+ }
77
+ `, m = t`
78
+ mutation ConnectionDialogUpdate($id: ID!, $input: UpdateConnectionInput!) {
79
+ updateConnection(id: $id, input: $input) {
80
+ ${s}
81
+ }
82
+ }
83
+ `, h = t`
68
84
  query ConnectionDialogVaults($filter: VaultFilterInput, $pagination: SecurityPaginationInput) {
69
85
  getVaults(filter: $filter, pagination: $pagination) {
70
86
  items {
@@ -74,7 +90,7 @@ var n = "\n id\n key\n name\n description\n category\n authType\n icon\n
74
90
  }
75
91
  }
76
92
  }
77
- `, m = t`
93
+ `, g = t`
78
94
  query ConnectionDialogVaultSecrets(
79
95
  $vaultId: ID!
80
96
  $filter: SecretFilterInput
@@ -88,7 +104,7 @@ var n = "\n id\n key\n name\n description\n category\n authType\n icon\n
88
104
  }
89
105
  }
90
106
  }
91
- `, h = t`
107
+ `, _ = t`
92
108
  mutation ConnectionDialogCreateVault($input: CreateVaultInput!) {
93
109
  createVault(input: $input) {
94
110
  id
@@ -96,19 +112,19 @@ var n = "\n id\n key\n name\n description\n category\n authType\n icon\n
96
112
  }
97
113
  }
98
114
  `;
99
- function g(e) {
115
+ function v(e) {
100
116
  return typeof e == "object" && e ? e : {};
101
117
  }
102
- function _(e) {
118
+ function y(e) {
103
119
  return typeof e == "string" ? e : "";
104
120
  }
105
- function v(e) {
121
+ function b(e) {
106
122
  return Array.isArray(e) ? e.filter((e) => typeof e == "string") : [];
107
123
  }
108
- function y(e) {
124
+ function x(e) {
109
125
  return typeof e == "object" && e && !Array.isArray(e) ? e : null;
110
126
  }
111
- var b = {
127
+ var S = {
112
128
  OAUTH2: "oauth2",
113
129
  OAUTH1: "oauth2",
114
130
  API_KEY: "api_key",
@@ -118,66 +134,77 @@ var b = {
118
134
  WORKSPACE_APP_TOKEN: "workspace_app_token",
119
135
  CUSTOM: "custom"
120
136
  };
121
- function x(e) {
137
+ function C(e) {
122
138
  let t = String(e ?? "").toUpperCase();
123
- return Object.prototype.hasOwnProperty.call(b, t) ? b[t] : "api_key";
139
+ return Object.prototype.hasOwnProperty.call(S, t) ? S[t] : "api_key";
124
140
  }
125
- function S(e) {
141
+ function w(e) {
126
142
  let t = String(e ?? "").toLowerCase();
127
143
  return t === "oauth2" || t === "minted" ? t : "fields";
128
144
  }
129
- function C(e) {
130
- let t = g(e), n = _(t.key);
145
+ function T(e) {
146
+ let t = v(e), n = y(t.key);
131
147
  return {
132
148
  key: n,
133
- displayName: _(t.displayName) || n,
134
- description: _(t.description) || null,
135
- authType: x(t.authType),
136
- flow: S(t.flow),
137
- defaultScopes: v(t.defaultScopes),
149
+ displayName: y(t.displayName) || n,
150
+ description: y(t.description) || null,
151
+ authType: C(t.authType),
152
+ flow: w(t.flow),
153
+ defaultScopes: b(t.defaultScopes),
138
154
  availableScopes: t.availableScopes ?? null,
139
- configSchema: y(t.configSchema),
155
+ configSchema: x(t.configSchema),
140
156
  isConfigured: t.isConfigured !== !1,
141
157
  isEnabled: t.isEnabled !== !1,
142
158
  displayOrder: Number(t.displayOrder ?? 0)
143
159
  };
144
160
  }
145
- function w(t) {
146
- let n = g(t);
161
+ function E(t) {
162
+ let n = v(t);
147
163
  return {
148
- id: _(n.id),
149
- key: _(n.key),
150
- name: _(n.name),
151
- description: _(n.description),
164
+ id: y(n.id),
165
+ key: y(n.key),
166
+ name: y(n.name),
167
+ description: y(n.description),
152
168
  category: e(n.category),
153
- authType: x(n.authType),
154
- icon: _(n.icon),
155
- website: _(n.website),
156
- docsUrl: _(n.docsUrl),
169
+ authType: C(n.authType),
170
+ icon: y(n.icon),
171
+ website: y(n.website),
172
+ docsUrl: y(n.docsUrl),
157
173
  isEnabled: n.isEnabled !== !1,
158
- pluginStatus: _(n.pluginStatus).toLowerCase(),
159
- defaultScopes: v(n.defaultScopes),
174
+ pluginStatus: y(n.pluginStatus).toLowerCase(),
175
+ defaultScopes: b(n.defaultScopes),
160
176
  availableScopes: n.availableScopes ?? null,
161
- configSchema: y(n.configSchema),
162
- authMethods: (Array.isArray(n.authMethods) ? n.authMethods : []).map(C).sort((e, t) => e.displayOrder - t.displayOrder)
177
+ configSchema: x(n.configSchema),
178
+ authMethods: (Array.isArray(n.authMethods) ? n.authMethods : []).map(T).sort((e, t) => e.displayOrder - t.displayOrder)
163
179
  };
164
180
  }
165
- function T(e) {
166
- let t = g(e), n = _(t.id);
181
+ function D(e) {
182
+ let t = v(e), n = y(t.id);
167
183
  return n ? {
168
184
  id: n,
169
- name: _(t.name),
170
- status: _(t.status),
171
- errorMessage: _(t.errorMessage) || null,
172
- externalAccountEmail: _(t.externalAccountEmail) || null,
173
- externalAccountName: _(t.externalAccountName) || null
185
+ name: y(t.name),
186
+ status: y(t.status),
187
+ errorMessage: y(t.errorMessage) || null,
188
+ externalAccountEmail: y(t.externalAccountEmail) || null,
189
+ externalAccountName: y(t.externalAccountName) || null,
190
+ updatedAt: y(t.updatedAt) || null
174
191
  } : null;
175
192
  }
176
- function E(e) {
177
- let t = g(e).id;
193
+ function O(e) {
194
+ let t = v(e), n = y(t.id);
195
+ return n ? {
196
+ id: n,
197
+ name: y(t.name),
198
+ description: y(t.description) || null,
199
+ authMethodKey: y(t.authMethodKey) || null,
200
+ config: x(t.config) ?? {}
201
+ } : null;
202
+ }
203
+ function k(e) {
204
+ let t = v(e).id;
178
205
  return typeof t == "string" && t ? t : void 0;
179
206
  }
180
- async function D(e) {
207
+ async function A(e) {
181
208
  let t = /* @__PURE__ */ new Set(), n = async (r, i) => {
182
209
  let a;
183
210
  try {
@@ -187,104 +214,113 @@ async function D(e) {
187
214
  return i;
188
215
  }
189
216
  let o = (a?.items ?? []).filter((e) => {
190
- let n = E(e);
217
+ let n = k(e);
191
218
  return !n || !t.has(n) && (t.add(n), !0);
192
219
  }), s = [...i, ...o];
193
220
  return a?.hasMore === !0 && o.length > 0 && r + 1 < 20 ? n(r + 1, s) : s;
194
221
  };
195
222
  return n(0, []);
196
223
  }
197
- function O(e) {
224
+ function j(e) {
198
225
  if (e.error) throw e.error instanceof Error ? e.error : /* @__PURE__ */ Error("The request failed");
199
226
  return e.data ?? null;
200
227
  }
201
- function k(e, t = {}) {
202
- let n = async (t, n, r = {}) => O(await e.query({
228
+ function M(e, t = {}) {
229
+ let n = async (t, n, r = {}) => j(await e.query({
203
230
  query: t,
204
231
  variables: n,
205
232
  fetchPolicy: "network-only",
206
233
  ...r.fresh ? { context: { queryDeduplication: !1 } } : {}
207
- })), s = async (t, n) => O(await e.mutate({
234
+ })), s = async (t, n) => j(await e.mutate({
208
235
  mutation: t,
209
236
  variables: n
210
237
  }));
211
238
  return {
212
239
  async listProviders(e) {
213
- return (await D(async (t) => {
240
+ return (await A(async (t) => {
214
241
  let a = {
215
242
  limit: 100,
216
243
  offset: t
217
244
  };
218
245
  return e === "catalog" ? (await n(i, { pagination: a }))?.getProviderCatalog : (await n(r, { pagination: a }))?.getProviders;
219
- })).map(w);
246
+ })).map(E);
220
247
  },
221
248
  async getProvider({ id: e, key: t }) {
222
249
  if (e) {
223
250
  let t = await n(a, { id: e });
224
- return t?.getProvider ? w(t.getProvider) : null;
251
+ return t?.getProvider ? E(t.getProvider) : null;
225
252
  }
226
253
  if (t) {
227
254
  let e = await n(o, { key: t });
228
- return e?.getProviderByKey ? w(e.getProviderByKey) : null;
255
+ return e?.getProviderByKey ? E(e.getProviderByKey) : null;
229
256
  }
230
257
  return null;
231
258
  },
232
259
  async createConnection(n) {
233
- let r = T((await s(c, { input: n }))?.createConnection);
260
+ let r = D((await s(c, { input: n }))?.createConnection);
234
261
  if (!r) throw Error("Failed to create connection");
235
262
  return t.refetchQueriesOnCreate?.length && e.refetchQueries({ include: t.refetchQueriesOnCreate }).catch(() => void 0), r;
236
263
  },
237
264
  async initiateOAuth(e) {
238
- return { redirectUrl: _((await s(l, { input: e }))?.initiateOAuth?.redirectUrl) || null };
265
+ return { redirectUrl: y((await s(l, { input: e }))?.initiateOAuth?.redirectUrl) || null };
239
266
  },
240
267
  async authenticateConnection(e) {
241
- return T((await s(u, { input: e }))?.authenticateConnection);
268
+ return D((await s(u, { input: e }))?.authenticateConnection);
242
269
  },
243
270
  async authenticateWithServiceAccount(e) {
244
- return T((await s(d, { input: e }))?.authenticateWithServiceAccount);
271
+ return D((await s(d, { input: e }))?.authenticateWithServiceAccount);
245
272
  },
246
273
  async getConnection(e) {
247
- return T((await n(f, { id: e }, { fresh: !0 }))?.getConnection);
274
+ return D((await n(f, { id: e }, { fresh: !0 }))?.getConnection);
275
+ },
276
+ async getConnectionSettings(e) {
277
+ return O((await n(p, { id: e }, { fresh: !0 }))?.getConnection);
278
+ },
279
+ async updateConnection(e, t) {
280
+ return D((await s(m, {
281
+ id: e,
282
+ input: t
283
+ }))?.updateConnection);
248
284
  },
249
285
  async listVaults() {
250
- return ((await n(p, {
286
+ return ((await n(h, {
251
287
  filter: { status: "ACTIVE" },
252
288
  pagination: { limit: 100 }
253
289
  }))?.getVaults?.items ?? []).map((e) => {
254
- let t = g(e);
290
+ let t = v(e);
255
291
  return {
256
- id: _(t.id),
257
- name: _(t.name),
292
+ id: y(t.id),
293
+ name: y(t.name),
258
294
  secretCount: Number(t.secretCount ?? 0)
259
295
  };
260
296
  });
261
297
  },
262
298
  async listVaultSecrets(e) {
263
- return ((await n(m, {
299
+ return ((await n(g, {
264
300
  vaultId: e,
265
301
  filter: { status: "ACTIVE" },
266
302
  pagination: { limit: 100 }
267
303
  }))?.getSecrets?.items ?? []).map((e) => {
268
- let t = g(e);
304
+ let t = v(e);
269
305
  return {
270
- id: _(t.id),
271
- name: _(t.name),
272
- type: _(t.type)
306
+ id: y(t.id),
307
+ name: y(t.name),
308
+ type: y(t.type)
273
309
  };
274
310
  });
275
311
  },
276
312
  async createVault(e) {
277
- let t = g((await s(h, { input: {
313
+ let t = v((await s(_, { input: {
278
314
  name: e.trim(),
279
315
  scope: "WORKSPACE"
280
316
  } }))?.createVault);
281
- if (!_(t.id)) throw Error("The vault could not be created");
317
+ if (!y(t.id)) throw Error("The vault could not be created");
282
318
  return {
283
- id: _(t.id),
284
- name: _(t.name),
319
+ id: y(t.id),
320
+ name: y(t.name),
285
321
  secretCount: 0
286
322
  };
287
323
  }
288
324
  };
289
325
  }
290
- export { k as createConnectionsApi, C as mapAuthMethod, w as mapProvider, x as normalizeAuthType, D as readAllProviderPages, O as unwrap };
326
+ export { M as createConnectionsApi, T as mapAuthMethod, E as mapProvider, C as normalizeAuthType, A as readAllProviderPages, j as unwrap };
@@ -1,6 +1,6 @@
1
1
  import { Translator } from '../credentials/translate';
2
2
  import { AuthMethodFlow, FormSchema } from '../credentials/types';
3
- import { ConnectionRecord, ConnectionsApi, CreateConnectionInput } from './api';
3
+ import { ConnectionRecord, ConnectionSettings, ConnectionsApi, CreateConnectionInput, UpdateConnectionInput } from './api';
4
4
  import { ConnectionAuthMethod, ConnectionProvider, CredentialStorageMode, CredentialStorageState, ProviderAuthType, ConnectionVisibility } from './types';
5
5
  /** Providers whose methods were never backfilled fall back to their type. */
6
6
  export declare function flowForAuthType(authType: ProviderAuthType): AuthMethodFlow;
@@ -28,6 +28,47 @@ export declare function normalizeStorageMode(storage: CredentialStorageState, mo
28
28
  export declare function collectsOwnClientId(schema: FormSchema | null): boolean;
29
29
  /** Minted methods store no credential, so they need no storage choice. */
30
30
  export declare function needsCredentialStorage(flow: AuthMethodFlow, provider: ConnectionProvider): boolean;
31
+ /**
32
+ * A field whose value the service keeps encrypted and never returns, so a
33
+ * form can only replace it. `clientSecret` always is (the service moves it to
34
+ * its own column whatever the schema says); any other field is when its
35
+ * schema marks it `secret`.
36
+ */
37
+ export declare function isSecretField(schema: FormSchema | null, field: string): boolean;
38
+ /**
39
+ * Whether Reconnect edits the values on the connection itself. An OAuth
40
+ * method's form (a bring-your-own app's client id and secret, a tenant or
41
+ * server address) is stored on the connection and saved before signing in
42
+ * again. Every other method's form is the credential, which Reconnect
43
+ * replaces as a whole.
44
+ */
45
+ export declare function reconnectEditsConfig(flow: AuthMethodFlow): boolean;
46
+ /**
47
+ * The form Reconnect shows for a method whose values live on the connection.
48
+ * A stored secret is never sent back to the browser, so its field starts
49
+ * blank: blank keeps the stored value, which makes the field optional, and the
50
+ * placeholder says so.
51
+ */
52
+ export declare function reconnectSchema(schema: FormSchema | null, flow: AuthMethodFlow, keepSecretPlaceholder: string): FormSchema | null;
53
+ /**
54
+ * The form values Reconnect opens with: the schema's defaults, overlaid with
55
+ * what the connection holds now for each non-secret field the form shows.
56
+ * Secret fields always start blank, even when the schema declares a default:
57
+ * a filled secret is sent as a new one and would replace the stored secret.
58
+ */
59
+ export declare function reconnectInitialValues(schema: FormSchema | null, flow: AuthMethodFlow, defaults: Record<string, unknown>, config: Record<string, unknown>): Record<string, unknown>;
60
+ /**
61
+ * What Reconnect must save before signing in again, or null when the person
62
+ * changed nothing. Compared with the connection's values when the dialog
63
+ * opened, so only an actual edit is written.
64
+ */
65
+ export declare function buildReconnectUpdate(draft: ConnectionDraft, current: ConnectionSettings): UpdateConnectionInput | null;
66
+ /**
67
+ * The connection's values once an update was saved, so trying again compares
68
+ * against what is now stored. Secrets are dropped: the service never returns
69
+ * them, and a blank field already means "keep".
70
+ */
71
+ export declare function applyReconnectUpdate(current: ConnectionSettings, update: UpdateConnectionInput, schema: FormSchema | null, formValues?: Record<string, unknown>): ConnectionSettings;
31
72
  export interface ConnectionDraft {
32
73
  provider: ConnectionProvider;
33
74
  method: ConnectionAuthMethod | null;
@@ -53,6 +94,12 @@ export interface ConnectionDraft {
53
94
  * chosen when it was made, so no storage choice is checked.
54
95
  */
55
96
  reconnect?: boolean;
97
+ /**
98
+ * Reconnect: the sign-in method the connection was made with (null for the
99
+ * provider's default). A reconnect cannot change it, so when it is no
100
+ * longer offered the draft is refused instead of using another method.
101
+ */
102
+ reconnectMethodKey?: string | null;
56
103
  }
57
104
  /** The first thing stopping the draft from being submitted, or null. */
58
105
  export declare function validateDraft(draft: ConnectionDraft, translate: Translator): string | null;
@@ -81,6 +128,12 @@ export type FlowStep = {
81
128
  kind: 'oauth';
82
129
  connection: ConnectionRecord;
83
130
  redirectUrl: string;
131
+ /**
132
+ * The connection as it is before the person signs in, read once the
133
+ * sign-in was started and before the popup opens. The wait reports only
134
+ * a state that differs from it.
135
+ */
136
+ baseline: Pick<ConnectionRecord, 'status' | 'updatedAt'>;
84
137
  };
85
138
  /**
86
139
  * Create the connection and complete as much of authentication as can be done
@@ -98,6 +151,15 @@ export declare function submitConnection(api: ConnectionsApi, draft: ConnectionD
98
151
  * rows behind and a reconnected connection keeps its id.
99
152
  */
100
153
  existing?: ConnectionRecord;
154
+ /**
155
+ * Reconnect: the existing connection's values when the dialog opened.
156
+ * Whatever the person changed (a new client id or secret, another
157
+ * setting, the name or description) is saved first, so the new sign-in
158
+ * uses it instead of the old stored values.
159
+ */
160
+ reconnectFrom?: ConnectionSettings;
161
+ /** Called once a Reconnect's changes are saved, with what is now stored. */
162
+ onReconnectSaved?: (settings: ConnectionSettings) => void;
101
163
  /**
102
164
  * Called as soon as a new record exists, before authentication runs, so a
103
165
  * caller can sign in on it again if a later step fails.