@keboola/api-client 53.0.0 → 55.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (169) hide show
  1. package/API-SURFACE.md +2 -1
  2. package/CHANGELOG.md +68 -0
  3. package/README.md +1 -1
  4. package/dist/{admin-Di-MmGFP.cjs → admin-BZ7knTd0.cjs} +18 -2
  5. package/dist/admin-BZ7knTd0.cjs.map +1 -0
  6. package/dist/{admin-CbMOsfgs.js → admin-xFfHSZHQ.js} +13 -3
  7. package/dist/admin-xFfHSZHQ.js.map +1 -0
  8. package/dist/{componentId-DZP1rBix.js → componentId-Ba4gsJ9O.js} +3 -2
  9. package/dist/componentId-Ba4gsJ9O.js.map +1 -0
  10. package/dist/{componentId-olp0tltf.cjs → componentId-Ba_1Gv_A.cjs} +3 -2
  11. package/dist/componentId-Ba_1Gv_A.cjs.map +1 -0
  12. package/dist/{configurations-WI8H4zLk.cjs → configurations-BM63ep1s.cjs} +2 -2
  13. package/dist/{configurations-WI8H4zLk.cjs.map → configurations-BM63ep1s.cjs.map} +1 -1
  14. package/dist/{configurations-Cd6Nsox-.js → configurations-BqvtIQm4.js} +2 -2
  15. package/dist/{configurations-Cd6Nsox-.js.map → configurations-BqvtIQm4.js.map} +1 -1
  16. package/dist/constants/index.cjs +3 -2
  17. package/dist/constants/index.d.cts +2 -2
  18. package/dist/constants/index.d.ts +2 -2
  19. package/dist/constants/index.js +3 -3
  20. package/dist/{constants-DLPkpnGv.js → constants-HccvU5kx.js} +9 -2
  21. package/dist/constants-HccvU5kx.js.map +1 -0
  22. package/dist/{constants-Day8CU5i.cjs → constants-V9hAyPTo.cjs} +14 -1
  23. package/dist/constants-V9hAyPTo.cjs.map +1 -0
  24. package/dist/domain/permissions/index.cjs +4 -3
  25. package/dist/domain/permissions/index.d.cts +9 -1
  26. package/dist/domain/permissions/index.d.ts +9 -1
  27. package/dist/domain/permissions/index.js +4 -4
  28. package/dist/encryption/index.d.cts +1 -1
  29. package/dist/encryption/index.d.ts +1 -1
  30. package/dist/encryption/types.d.cts +1 -1
  31. package/dist/encryption/types.d.ts +1 -1
  32. package/dist/{index-B0prazAi.d.cts → index-BE6qM0vu.d.cts} +551 -30
  33. package/dist/{index-BoKrc8wy.d.ts → index-BGsP2QBc.d.ts} +2 -2
  34. package/dist/{index-BxgHNJ3Q.d.ts → index-CQPs3hrp.d.ts} +25 -40
  35. package/dist/{index-BL7uXOiY.d.cts → index-CWowDl63.d.cts} +2 -2
  36. package/dist/{index-BNwo-zaJ.d.cts → index-CYk7Aa8u.d.cts} +11 -3
  37. package/dist/{index-BUKMdbKh.d.cts → index-CmyFWQXn.d.cts} +25 -40
  38. package/dist/{index-CwUurckF.d.ts → index-D3hWR_e4.d.ts} +11 -3
  39. package/dist/{index-D0Gnp2QM.d.ts → index-DeWeUUfE.d.ts} +551 -30
  40. package/dist/index.cjs +12 -17
  41. package/dist/index.cjs.map +1 -1
  42. package/dist/index.d.cts +2 -2
  43. package/dist/index.d.ts +2 -2
  44. package/dist/index.js +11 -16
  45. package/dist/index.js.map +1 -1
  46. package/dist/management/index.cjs +1 -1
  47. package/dist/management/index.d.cts +1 -1
  48. package/dist/management/index.d.ts +1 -1
  49. package/dist/management/index.js +1 -1
  50. package/dist/management/types.d.cts +2 -2
  51. package/dist/management/types.d.ts +2 -2
  52. package/dist/{management-CmgsWmf0.js → management-BlMQnPNS.js} +40 -19
  53. package/dist/management-BlMQnPNS.js.map +1 -0
  54. package/dist/{management-Drs5G-hf.cjs → management-dIMrTTpI.cjs} +40 -19
  55. package/dist/management-dIMrTTpI.cjs.map +1 -0
  56. package/dist/metaObject-CSGF3d-o.js +53 -0
  57. package/dist/metaObject-CSGF3d-o.js.map +1 -0
  58. package/dist/metaObject-Ciyow2gr.cjs +64 -0
  59. package/dist/metaObject-Ciyow2gr.cjs.map +1 -0
  60. package/dist/metaObject-ClvW342q.d.ts +35 -0
  61. package/dist/metaObject-D7oudegV.d.cts +35 -0
  62. package/dist/oauth/index.cjs +2 -1
  63. package/dist/oauth/index.d.cts +41 -2
  64. package/dist/oauth/index.d.ts +41 -2
  65. package/dist/oauth/index.js +1 -1
  66. package/dist/oauth/types.d.cts +2 -2
  67. package/dist/oauth/types.d.ts +2 -2
  68. package/dist/{oauth-CSBChWuf.cjs → oauth-CEW2AvDV.cjs} +55 -1
  69. package/dist/oauth-CEW2AvDV.cjs.map +1 -0
  70. package/dist/{oauth-DOveZKUv.js → oauth-Fri6IthS.js} +51 -3
  71. package/dist/oauth-Fri6IthS.js.map +1 -0
  72. package/dist/{project-Onf-IcPW.cjs → project-BQ2oD6IW.cjs} +2 -2
  73. package/dist/{project-Onf-IcPW.cjs.map → project-BQ2oD6IW.cjs.map} +1 -1
  74. package/dist/{project-DmuC0bMK.js → project-aAVAOcmx.js} +2 -2
  75. package/dist/{project-DmuC0bMK.js.map → project-aAVAOcmx.js.map} +1 -1
  76. package/dist/queryService/index.d.cts +1 -1
  77. package/dist/queryService/index.d.ts +1 -1
  78. package/dist/queryService/types.d.cts +1 -1
  79. package/dist/queryService/types.d.ts +1 -1
  80. package/dist/queryService-B4h1Ez44.cjs +117 -0
  81. package/dist/queryService-B4h1Ez44.cjs.map +1 -0
  82. package/dist/queryService-DE_yE_S4.js +106 -0
  83. package/dist/queryService-DE_yE_S4.js.map +1 -0
  84. package/dist/queue/index.d.cts +1 -1
  85. package/dist/queue/index.d.ts +1 -1
  86. package/dist/sdk/configurations/index.cjs +48 -3
  87. package/dist/sdk/configurations/index.cjs.map +1 -1
  88. package/dist/sdk/configurations/index.d.cts +230 -2
  89. package/dist/sdk/configurations/index.d.ts +230 -2
  90. package/dist/sdk/configurations/index.js +48 -3
  91. package/dist/sdk/configurations/index.js.map +1 -1
  92. package/dist/sdk/dataAppServer/index.cjs +4 -40
  93. package/dist/sdk/dataAppServer/index.cjs.map +1 -1
  94. package/dist/sdk/dataAppServer/index.d.cts +1 -1
  95. package/dist/sdk/dataAppServer/index.d.ts +1 -1
  96. package/dist/sdk/dataAppServer/index.js +2 -38
  97. package/dist/sdk/dataAppServer/index.js.map +1 -1
  98. package/dist/sdk/queryService/index.cjs +3 -70
  99. package/dist/sdk/queryService/index.d.cts +2 -2
  100. package/dist/sdk/queryService/index.d.ts +2 -2
  101. package/dist/sdk/queryService/index.js +1 -70
  102. package/dist/sdk/securityPolicy/index.cjs +365 -0
  103. package/dist/sdk/securityPolicy/index.cjs.map +1 -0
  104. package/dist/sdk/securityPolicy/index.d.cts +110 -0
  105. package/dist/sdk/securityPolicy/index.d.ts +110 -0
  106. package/dist/sdk/securityPolicy/index.js +350 -0
  107. package/dist/sdk/securityPolicy/index.js.map +1 -0
  108. package/dist/sdk/securityPolicy/types.cjs +0 -0
  109. package/dist/sdk/securityPolicy/types.d.cts +2 -0
  110. package/dist/sdk/securityPolicy/types.d.ts +2 -0
  111. package/dist/sdk/securityPolicy/types.js +1 -0
  112. package/dist/sdk/semanticLayer/index.cjs +3 -2
  113. package/dist/sdk/semanticLayer/index.d.cts +3 -3
  114. package/dist/sdk/semanticLayer/index.d.ts +3 -3
  115. package/dist/sdk/semanticLayer/index.js +3 -1
  116. package/dist/sdk/semanticLayer/types.d.cts +1 -1
  117. package/dist/sdk/semanticLayer/types.d.ts +1 -1
  118. package/dist/sdk/vault/index.cjs +3 -12
  119. package/dist/sdk/vault/index.cjs.map +1 -1
  120. package/dist/sdk/vault/index.d.cts +1 -1
  121. package/dist/sdk/vault/index.d.ts +1 -1
  122. package/dist/sdk/vault/index.js +3 -12
  123. package/dist/sdk/vault/index.js.map +1 -1
  124. package/dist/{semanticLayer-D8D_3hk-.cjs → semanticLayer-BVpdWKJn.cjs} +4 -52
  125. package/dist/semanticLayer-BVpdWKJn.cjs.map +1 -0
  126. package/dist/{semanticLayer-CfjDnmsY.js → semanticLayer-Btj1Qy9O.js} +5 -47
  127. package/dist/semanticLayer-Btj1Qy9O.js.map +1 -0
  128. package/dist/storage/index.cjs +1 -1
  129. package/dist/storage/index.d.cts +2 -2
  130. package/dist/storage/index.d.ts +2 -2
  131. package/dist/storage/index.js +1 -1
  132. package/dist/storage/types.d.cts +2 -2
  133. package/dist/storage/types.d.ts +2 -2
  134. package/dist/{storage-BMrYlyLB.cjs → storage-BL-TfHp8.cjs} +2 -2
  135. package/dist/storage-BL-TfHp8.cjs.map +1 -0
  136. package/dist/{storage--2FvvLAw.js → storage-DEJN8sw-.js} +2 -2
  137. package/dist/storage-DEJN8sw-.js.map +1 -0
  138. package/dist/syncActions/index.cjs +1 -1
  139. package/dist/syncActions/index.js +1 -1
  140. package/dist/{syncActions-DToUhyP3.cjs → syncActions-B9JTiSao.cjs} +2 -2
  141. package/dist/{syncActions-DToUhyP3.cjs.map → syncActions-B9JTiSao.cjs.map} +1 -1
  142. package/dist/{syncActions-DV_aObTQ.js → syncActions-W98Jme2Z.js} +2 -2
  143. package/dist/{syncActions-DV_aObTQ.js.map → syncActions-W98Jme2Z.js.map} +1 -1
  144. package/dist/{types-iU1Sc1IM.d.ts → types-BDgOF2WN.d.ts} +6 -29
  145. package/dist/types-BXKL0wTI.d.cts +85 -0
  146. package/dist/{types-CsRfoHQw.d.cts → types-Bwvss_gW.d.cts} +1111 -412
  147. package/dist/{types-BljDxuWG.d.cts → types-DCARsJWs.d.cts} +6 -29
  148. package/dist/types-DK1bSUNr.d.ts +85 -0
  149. package/dist/{types-DjWubjvP.d.cts → types-DMhgKHCP.d.cts} +309 -74
  150. package/dist/{types-DNldEa7i.d.ts → types-J_dgwMjP.d.ts} +1111 -412
  151. package/dist/{types-CsVRsObb.d.ts → types-p_lWvuQJ.d.ts} +309 -74
  152. package/package.json +29 -3
  153. package/surface/management.md +29 -25
  154. package/dist/admin-CbMOsfgs.js.map +0 -1
  155. package/dist/admin-Di-MmGFP.cjs.map +0 -1
  156. package/dist/componentId-DZP1rBix.js.map +0 -1
  157. package/dist/componentId-olp0tltf.cjs.map +0 -1
  158. package/dist/constants-DLPkpnGv.js.map +0 -1
  159. package/dist/constants-Day8CU5i.cjs.map +0 -1
  160. package/dist/management-CmgsWmf0.js.map +0 -1
  161. package/dist/management-Drs5G-hf.cjs.map +0 -1
  162. package/dist/oauth-CSBChWuf.cjs.map +0 -1
  163. package/dist/oauth-DOveZKUv.js.map +0 -1
  164. package/dist/sdk/queryService/index.cjs.map +0 -1
  165. package/dist/sdk/queryService/index.js.map +0 -1
  166. package/dist/semanticLayer-CfjDnmsY.js.map +0 -1
  167. package/dist/semanticLayer-D8D_3hk-.cjs.map +0 -1
  168. package/dist/storage--2FvvLAw.js.map +0 -1
  169. package/dist/storage-BMrYlyLB.cjs.map +0 -1
@@ -195,7 +195,17 @@ type paths = {
195
195
  path?: never;
196
196
  cookie?: never;
197
197
  };
198
- get?: never;
198
+ /**
199
+ * List platform consumers
200
+ * @description Every registration on the stack, oldest first. Requires the
201
+ * `oauth:platform-consumers-manage` scope. Neither the private key nor the client secret is
202
+ * returned.
203
+ *
204
+ * This is how to find the id of an existing registration: a second registration for the
205
+ * same host is refused with `409` without naming it. `connectionsCount` tells whether a
206
+ * `DELETE` of the registration would be refused.
207
+ */
208
+ get: operations['platformConsumerList'];
199
209
  put?: never;
200
210
  /**
201
211
  * Register a platform application
@@ -210,14 +220,15 @@ type paths = {
210
220
  * registration is usable):
211
221
  *
212
222
  * * Repository permissions: Contents → Read-only; Organization permissions: Members →
213
- * Read-only (the install callback needs it to confirm the installer owns the GitHub
223
+ * Read-only (the callback needs it to confirm the user connecting owns the GitHub
214
224
  * organization).
215
- * * "Where can this GitHub App be installed?" → Any account.
216
- * * **"Request user authorization (OAuth) during installation" must be enabled**, and the
217
- * App's Callback URL set to this service's
218
- * `/platform-consumers/github-app/callback`. Without it GitHub sends no `code` with the
219
- * install redirect, the callback cannot prove the installer owns the installation they
220
- * returned with, and every connection attempt fails there.
225
+ * * "Where can this GitHub App be installed?" → Any account, for an App that third parties
226
+ * install.
227
+ * * The App's Callback URL list must include this service's
228
+ * `/platform-consumers/github-app/callback`: connecting goes through the App's OAuth web
229
+ * flow with that URL as `redirect_uri`. "Request user authorization (OAuth) during
230
+ * installation" is not needed; when it is on, the redirect GitHub sends right after an
231
+ * install has no `state` and is answered with directions to connect from Keboola.
221
232
  * * `clientId` / `clientSecret` come from the same App's page ("Client ID", "Generate a new
222
233
  * client secret") — they are not the App ID and private key.
223
234
  *
@@ -265,10 +276,11 @@ type paths = {
265
276
  cookie?: never;
266
277
  };
267
278
  /**
268
- * GitHub App install callback
269
- * @description Invoked by GitHub, not by API consumers. This is the App's Callback URL, configured once on
270
- * the GitHub side and identical for every install, which is why it carries no organization
271
- * segment — the organization is recovered from the install session that `state` resolves to.
279
+ * GitHub App OAuth callback
280
+ * @description Invoked by GitHub, not by API consumers. This is one of the App's Callback URLs, configured
281
+ * once on the GitHub side and identical for every connection, which is why it carries no
282
+ * organization segment — the organization is recovered from the install session that `state`
283
+ * resolves to.
272
284
  *
273
285
  * It is the only endpoint that records an installation, and it requires no Keboola credential.
274
286
  * Three things authorise it, all of them necessary:
@@ -276,27 +288,44 @@ type paths = {
276
288
  * 1. `state` must match the `__Host-orgInstallSession` cookie set when the flow started (the
277
289
  * legacy `oauthSessionId` cookie is ignored here);
278
290
  * 2. `state` must resolve to an unexpired install session;
279
- * 3. the installing user must own the account the installation belongs to. GitHub, asked as
280
- * the App, says which account that is (`GET /app/installations/{id}`); asked with the
281
- * user-to-server token obtained from `code`, it says whether the installer is an active
282
- * owner of that organization (`GET /user/memberships/orgs/{login}` → `role: admin`,
283
- * `state: active`) or, for a personal account, that very user (`GET /user`). Being a
284
- * collaborator or an ordinary member is not enough.
291
+ * 3. the user who authorized (`code`, exchanged for a user-to-server token) must own the
292
+ * account the bound installation belongs to: an active owner of that organization
293
+ * (`GET /user/memberships/orgs/{login}` → `role: admin`, `state: active`) or, for a
294
+ * personal account, that very user (`GET /user`). Being a collaborator or an ordinary
295
+ * member is not enough. This is why the App needs "Organization members: read".
285
296
  *
286
- * Point 3 is why the App needs "Request user authorization (OAuth) during installation" and
287
- * the "Organization members: read" permission. Installation ids are small sequential
288
- * integers, so without that confirmation anyone able to start an install for an organization
289
- * they do administer could bind a stranger's installation and mint read tokens on that
290
- * stranger's private repositories.
297
+ * Which installation is bound:
291
298
  *
292
- * When the installer is not a GitHub organization owner, GitHub returns
293
- * `setup_action=request` with no installation id: the installation is pending an owner's
294
- * approval and nothing is recorded.
299
+ * * **OAuth web flow** (started by `POST /authorize/organizations/{organizationId}`; only
300
+ * `code` and `state` come back): the App's installations the user can reach
301
+ * (`GET /user/installations`, all pages), narrowed to the `account` given at the start if
302
+ * any, each run through check 3. Exactly one owned installation is connected. None
303
+ * installed is a `400` and none owned a `403`, both naming the App's install page
304
+ * (`/apps/{slug}/installations/new` on github.com, `/github-apps/…` on GitHub Enterprise
305
+ * Server); several owned without `account` is a `400`
306
+ * naming them — start again with `account`.
307
+ * * **No `state`** — GitHub's redirect after an install started on GitHub, for an App that
308
+ * requests user authorization during installation: a `400` saying the connection has to
309
+ * be started from Keboola. Nothing is asked of GitHub or recorded.
310
+ *
311
+ * Any `installation_id` GitHub adds to the query is ignored. Installation ids are small
312
+ * sequential integers: believing one would let anyone able to start a connection for an
313
+ * organization they do administer bind a stranger's installation and mint read tokens on
314
+ * that stranger's private repositories.
295
315
  *
296
316
  * An organization holds at most one connection per GitHub account and registration. When the
297
317
  * account is already connected under a *different* installation id — the App was
298
318
  * uninstalled and installed again — the stale connection is replaced by the new one.
299
319
  * Connecting the very same installation twice is a `409`.
320
+ *
321
+ * **Errors.** Once `state` resolves to a live session, every failure redirects (`302`) to the
322
+ * session's `returnUrl` with `error` (an `OrganizationConnectErrorCode`) and `message` added
323
+ * to its query — plus `accounts` for `severalOwned`, and `exceptionId` matching the log
324
+ * record — and ends the session (GitHub's `code`
325
+ * is single-use, so the flow has to start again). The statuses below name the same failures
326
+ * as they are answered elsewhere. Only the failures before that, which leave no `returnUrl`
327
+ * to go back to — no `state`, no matching cookie, an unknown or expired session — are
328
+ * answered with JSON.
300
329
  */
301
330
  get: operations['platformConsumerInstallCallback'];
302
331
  put?: never;
@@ -318,23 +347,30 @@ type paths = {
318
347
  put?: never;
319
348
  /**
320
349
  * Connect a GitHub organization
321
- * @description Starts the GitHub App install flow and redirects to GitHub.
350
+ * @description Starts connecting a GitHub organization and redirects to the GitHub App's OAuth web flow,
351
+ * `{webBaseUrl}/login/oauth/authorize?client_id=…&redirect_uri=…&state=…`, where
352
+ * `redirect_uri` is this service's `/platform-consumers/github-app/callback`. GitHub signs
353
+ * the user in, asks them to authorize the App the first time, and returns to the callback,
354
+ * which connects the installation the user owns (or the one on `account`). The App must
355
+ * already be installed on the GitHub organization — by anyone, from anywhere; the callback
356
+ * links the install page if it is not.
322
357
  *
323
- * Submitted by the browser as a form — a top-level navigation — exactly like
324
- * `POST /authorize/{componentId}`, with the caller's Storage API token in the `token` form
325
- * field, verified with Storage API by this service. The token may belong to any project the
326
- * caller can reach: it establishes only *who* the caller is. A token without an admin
327
- * (component or legacy token) is refused with `403`.
358
+ * Submitted by the browser as a form — a top-level navigation from the organization's page
359
+ * in the Control Panel — with the caller's Manage API token in the `manageToken` form field,
360
+ * verified by this service with `GET /manage/tokens/verify`. The token must have a user
361
+ * behind it: the Control Panel's session token or a personal Manage token. An application
362
+ * token is refused with `403`; a token Manage API does not know, or reports as expired or
363
+ * disabled, with `401`. Storage API tokens and programmatic `kbc_pat_*` tokens are not
364
+ * accepted. The token establishes only *who* the
365
+ * caller is, and it is never stored.
328
366
  *
329
367
  * The organization is taken from the URL and the caller must be an administrator of it — `GET /manage/organizations/{id}/users` is
330
368
  * Connection's organization administrators listing, so appearing in it is the admin check.
331
- * Deriving the organization from the token instead would be unsafe — users belong to projects
332
- * across several organizations and the project-to-organization link is invisible in the UI.
369
+ * Super admins who are not listed are refused.
333
370
  *
334
371
  * The credentials row is created incomplete and only becomes usable once the install
335
372
  * callback records the installation. Starting again under the name of an incomplete row (an
336
- * abandoned tab, or an install that became an owner-approval request) replaces that row and
337
- * its session; otherwise the `app:expire-auth-sessions` cron sweeps it after an hour. A name
373
+ * abandoned tab or a refused callback) replaces that row and its session; otherwise the `app:expire-auth-sessions` cron sweeps it after an hour. A name
338
374
  * already taken by a completed connection is a `409`.
339
375
  *
340
376
  * The response sets the session cookie `__Host-orgInstallSession` (Secure, HttpOnly,
@@ -347,7 +383,14 @@ type paths = {
347
383
  * Login-CSRF guard: the request must carry an `Origin` header exactly equal to an allowed
348
384
  * origin — `ORGANIZATION_INSTALL_ALLOWED_ORIGINS`, by default the stack's own UI
349
385
  * `https://connection.<HOSTNAME_SUFFIX>`. A missing, `null` or other origin is a `403`, with
350
- * nothing verified or written.
386
+ * nothing verified or written. `returnUrl` must be on an allowed origin too (a `400`
387
+ * otherwise), as errors are redirected there.
388
+ *
389
+ * **Errors.** Past those checks, every failure redirects (`302`) to `returnUrl` with `error`
390
+ * (an `OrganizationConnectErrorCode`) and `message` added to its query, instead of a JSON
391
+ * error page the user would be stranded on. The `401`/`403`/`409`/`412`/`503` below name the
392
+ * same failures as they are answered elsewhere. Only an invalid form (`422`), an untrusted
393
+ * `Origin` (`403`) and a `returnUrl` outside the UI (`400`) are answered with JSON.
351
394
  */
352
395
  post: operations['organizationCredentialsInit'];
353
396
  delete?: never;
@@ -366,7 +409,8 @@ type paths = {
366
409
  /**
367
410
  * List connected GitHub organizations
368
411
  * @description Lists the GitHub accounts this Keboola organization has connected. Connections whose
369
- * install never completed are omitted.
412
+ * install never completed are omitted. The caller must be an administrator of the
413
+ * organization; see `ManageApiUserToken` for the accepted tokens.
370
414
  */
371
415
  get: operations['organizationCredentialsList'];
372
416
  put?: never;
@@ -377,6 +421,45 @@ type paths = {
377
421
  patch?: never;
378
422
  trace?: never;
379
423
  };
424
+ '/organizations/{organizationId}/github-apps': {
425
+ parameters: {
426
+ query?: never;
427
+ header?: never;
428
+ path?: never;
429
+ cookie?: never;
430
+ };
431
+ /**
432
+ * List the GitHub Apps an organization can connect to
433
+ * @description GitHub Apps registered on this stack and where to install each. Connecting needs the App
434
+ * installed on the GitHub organization first, so the UI links `installUrl` next to
435
+ * "connect".
436
+ *
437
+ * Listed are the stack's default host and the hosts the organization already has a
438
+ * completed connection on — not every registration: those are not tied to an
439
+ * organization, and the stack's GitHub Enterprise hosts name other customers. A GitHub
440
+ * Enterprise host the organization has not connected yet is still connected to by naming
441
+ * it in the connect form's `host`.
442
+ *
443
+ * `installUrl` is `/apps/{slug}/installations/new` on github.com and
444
+ * `/github-apps/{slug}/installations/new` on GitHub Enterprise Server. It is null on GitHub
445
+ * Enterprise Cloud (`*.ghe.com`), which has no working public App page: an App is installed
446
+ * there from the GitHub organization's settings
447
+ * (`{webBaseUrl}/organizations/{organization}/settings/apps`) or, for an App owned by a
448
+ * GitHub enterprise, the enterprise's. `default` marks the host used when the connect form
449
+ * names none; it is listed first, the rest by host. Nothing secret is listed.
450
+ *
451
+ * The caller must be an administrator of the organization; see `ManageApiUserToken` for the
452
+ * accepted tokens.
453
+ */
454
+ get: operations['organizationGitHubAppsList'];
455
+ put?: never;
456
+ post?: never;
457
+ delete?: never;
458
+ options?: never;
459
+ head?: never;
460
+ patch?: never;
461
+ trace?: never;
462
+ };
380
463
  '/organization-credentials/connections': {
381
464
  parameters: {
382
465
  query?: never;
@@ -423,7 +506,8 @@ type paths = {
423
506
  /**
424
507
  * Disconnect a GitHub organization
425
508
  * @description Removes the connection on the Keboola side. The App stays installed on GitHub until an
426
- * owner removes it there.
509
+ * owner removes it there. The caller must be an administrator of the organization; see
510
+ * `ManageApiUserToken` for the accepted tokens.
427
511
  */
428
512
  delete: operations['organizationCredentialsDelete'];
429
513
  options?: never;
@@ -510,7 +594,7 @@ type components = {
510
594
  */
511
595
  appId: string;
512
596
  /**
513
- * @description GitHub App slug, used to build the install URL `{webBaseUrl}/apps/{slug}/installations/new`.
597
+ * @description GitHub App slug, used to build the install URL (`/apps/{slug}/installations/new` on github.com, `/github-apps/…` on GitHub Enterprise Server).
514
598
  * @example keboola-data-apps
515
599
  */
516
600
  slug: string;
@@ -554,9 +638,15 @@ type components = {
554
638
  */
555
639
  webHost?: string;
556
640
  };
641
+ PlatformConsumerListItem: components['schemas']['PlatformConsumer'] & {
642
+ /** Format: date-time */
643
+ created?: string;
644
+ /** @description Organization connections using this registration, including ones whose install never completed. A `DELETE` is refused while it is not 0. */
645
+ connectionsCount?: number;
646
+ };
557
647
  OrganizationCredentialsInitRequest: {
558
- /** @description Storage API token of the caller; identifies who they are */
559
- token: string;
648
+ /** @description Manage API token of the caller with a user behind it (the Control Panel's session token or a personal Manage token); identifies who they are */
649
+ manageToken: string;
560
650
  /**
561
651
  * @description Unique within the organization.
562
652
  * @example acme-github
@@ -564,7 +654,8 @@ type components = {
564
654
  name: string;
565
655
  /**
566
656
  * Format: url
567
- * @description Where GitHub returns the user after the install completes. Must be https.
657
+ * @description Where the browser returns after the connection completes, or with `error` and `message` added to its query when it fails (see `OrganizationConnectErrorCode`). Must be https and on an allowed origin (`ORGANIZATION_INSTALL_ALLOWED_ORIGINS`, by default the stack's own UI); its own query is kept.
658
+ * @example https://connection.keboola.com/control/organizations/433?tab=github
568
659
  */
569
660
  returnUrl: string;
570
661
  description?: string | null;
@@ -573,6 +664,11 @@ type components = {
573
664
  * @example acme.ghe.com
574
665
  */
575
666
  host?: string | null;
667
+ /**
668
+ * @description The GitHub account (organization or user login, case-insensitive) to connect. Needed only when the caller owns several accounts the GitHub App is installed on; omitted, the callback connects the only one.
669
+ * @example acme
670
+ */
671
+ account?: string | null;
576
672
  };
577
673
  OrganizationCredentials: {
578
674
  /** Format: uuid */
@@ -590,12 +686,56 @@ type components = {
590
686
  */
591
687
  host?: string;
592
688
  creator?: {
689
+ /** @description ID of the token the connection was started with. */
593
690
  id?: string;
691
+ /** @description Description of that token; for the Control Panel's session token, the user's email. */
594
692
  description?: string | null;
693
+ /**
694
+ * @description Which API the token belongs to. Connections are started with a Manage API token; `storage` marks connections started with a Storage API token before that.
695
+ * @enum {string}
696
+ */
697
+ type?: 'manage' | 'storage';
698
+ /** @description The user behind the Manage API token. A session token expires after about an hour, so this is what still says who connected the organization. Null for `storage`. */
699
+ user?: {
700
+ /** @example 76 */
701
+ id?: string;
702
+ /** @example admin@keboola.com */
703
+ email?: string | null;
704
+ } | null;
595
705
  };
596
706
  /** Format: date-time */
597
707
  created?: string;
598
708
  };
709
+ /**
710
+ * @description Why connecting an organization to a GitHub App failed, sent as `error` in the query of the `returnUrl` the browser is redirected to (together with `message`, an English explanation; `exceptionId`, matching the log record; and for `severalOwned`, `accounts`). Stable: a value is never renamed, so the UI can map it to its own copy; new values may be added, so treat an unknown one like `connectFailed`. Anyone can link the UI page with an `error` and `message` of their choosing: show the UI's own copy per `error`, never render `message` as HTML or links, and take the install link from `GET /organizations/{organizationId}/github-apps`.
711
+ * @enum {string}
712
+ */
713
+ OrganizationConnectErrorCode: 'invalidToken' | 'notUserToken' | 'notOrganizationAdmin' | 'noAppForHost' | 'nameTaken' | 'authorizationDenied' | 'authorizationFailed' | 'appNotInstalled' | 'notOwner' | 'samlSsoRequired' | 'missingMembersPermission' | 'severalOwned' | 'alreadyConnected' | 'superseded' | 'rateLimited' | 'githubUnavailable' | 'manageApiUnavailable' | 'connectFailed' | 'internalError';
714
+ OrganizationGitHubApp: {
715
+ /**
716
+ * @description The GitHub deployment, as the connect form's `host` takes it.
717
+ * @example github.com
718
+ */
719
+ host: string;
720
+ /**
721
+ * Format: url
722
+ * @example https://github.com
723
+ */
724
+ webBaseUrl: string;
725
+ /**
726
+ * @description The App's slug on GitHub.
727
+ * @example keboola-data-apps
728
+ */
729
+ slug: string;
730
+ /**
731
+ * Format: url
732
+ * @description The App's page for installing it on a GitHub account; null on GitHub Enterprise Cloud (`*.ghe.com`), where an App is installed from the organization's or enterprise's settings.
733
+ * @example https://github.com/apps/keboola-data-apps/installations/new
734
+ */
735
+ installUrl: string | null;
736
+ /** @description The host used when the connect form names none. */
737
+ default: boolean;
738
+ };
599
739
  OrganizationConnections: {
600
740
  connections: {
601
741
  /**
@@ -1153,6 +1293,36 @@ interface operations {
1153
1293
  422: components['responses']['422_UnprocessableEntity'];
1154
1294
  };
1155
1295
  };
1296
+ platformConsumerList: {
1297
+ parameters: {
1298
+ query?: never;
1299
+ header?: never;
1300
+ path?: never;
1301
+ cookie?: never;
1302
+ };
1303
+ requestBody?: never;
1304
+ responses: {
1305
+ /** @description Platform consumers */
1306
+ 200: {
1307
+ headers: {
1308
+ [name: string]: unknown;
1309
+ };
1310
+ content: {
1311
+ 'application/json': components['schemas']['PlatformConsumerListItem'][];
1312
+ };
1313
+ };
1314
+ 401: components['responses']['401_Unauthorized'];
1315
+ /** @description The token lacks the `oauth:platform-consumers-manage` scope */
1316
+ 403: {
1317
+ headers: {
1318
+ [name: string]: unknown;
1319
+ };
1320
+ content: {
1321
+ 'application/json': components['schemas']['Error'];
1322
+ };
1323
+ };
1324
+ };
1325
+ };
1156
1326
  platformConsumerCreate: {
1157
1327
  parameters: {
1158
1328
  query?: never;
@@ -1247,15 +1417,11 @@ interface operations {
1247
1417
  };
1248
1418
  platformConsumerInstallCallback: {
1249
1419
  parameters: {
1250
- query: {
1251
- /** @description GitHub installation ID. */
1252
- installation_id?: string;
1253
- /** @description Temporary user authorization code. Present only when the App has "Request user authorization (OAuth) during installation" enabled; the callback exchanges it for a user-to-server token and verifies installation ownership with it. */
1420
+ query?: {
1421
+ /** @description Temporary user authorization code; exchanged for a user-to-server token that identifies the user and verifies installation ownership. Missing when the user did not authorize the App (`error=access_denied`). */
1254
1422
  code?: string;
1255
- /** @description What GitHub did. `request` means an owner still has to approve. */
1256
- setup_action?: 'install' | 'request' | 'update';
1257
- /** @description Opaque install-session ID issued when the flow started. */
1258
- state: string;
1423
+ /** @description Opaque install-session ID issued when the flow started. Required; GitHub omits it on the redirect after an install started on GitHub, which is answered with a `400`. */
1424
+ state?: string;
1259
1425
  };
1260
1426
  header?: never;
1261
1427
  path?: never;
@@ -1263,25 +1429,45 @@ interface operations {
1263
1429
  };
1264
1430
  requestBody?: never;
1265
1431
  responses: {
1266
- /** @description Redirect back to the `returnUrl` supplied when the flow started */
1432
+ /**
1433
+ * @description Back to the `returnUrl` supplied when the flow started: as is when the connection is
1434
+ * recorded, or with `error`, `message` (and for `severalOwned`, `accounts`) added to its
1435
+ * query when it failed — see `OrganizationConnectErrorCode`:
1436
+ *
1437
+ * * `authorizationDenied` — no `code`, `error=access_denied`: the user did not authorize
1438
+ * the App;
1439
+ * * `authorizationFailed` — GitHub rejected the `code` (expired or already used), or
1440
+ * returned none for another reason, e.g. `redirect_uri_mismatch` (GitHub's `error`
1441
+ * and `error_description` are logged, not passed on);
1442
+ * * `appNotInstalled` — the App is not installed on any account the user can reach (or on
1443
+ * the requested `account`); the message links the install page;
1444
+ * * `notOwner` — the user owns none of those accounts (or not the requested `account`):
1445
+ * neither an active owner of the organization nor the personal account itself; the
1446
+ * message links the install page;
1447
+ * * `samlSsoRequired` — the organization enforces SAML SSO the user's GitHub session is
1448
+ * not authorized for;
1449
+ * * `missingMembersPermission` — the App lacks "Organization members: read";
1450
+ * * `severalOwned` — the user owns several accounts with the App installed and no
1451
+ * `account` was given; `accounts` lists their logins, comma-separated — start again
1452
+ * with `account` set to one of them;
1453
+ * * `alreadyConnected` — this installation (or GitHub account) is already connected to the
1454
+ * organization;
1455
+ * * `superseded` — a newer start under the same name replaced this attempt while the
1456
+ * callback ran (nothing is written; finish the newer attempt);
1457
+ * * `rateLimited`, `githubUnavailable` — GitHub is rate limiting, failing or returned a
1458
+ * malformed answer;
1459
+ * * `connectFailed`, `internalError` — anything else.
1460
+ */
1267
1461
  302: {
1268
1462
  headers: {
1463
+ /** @example https://connection.keboola.com/control/organizations/433?tab=github&error=notOwner&message=You%20are%20not%20an%20owner%20of%20%E2%80%A6 */
1464
+ Location?: string;
1269
1465
  [name: string]: unknown;
1270
1466
  };
1271
1467
  content?: never;
1272
1468
  };
1273
- 400: components['responses']['400_BadRequest'];
1274
- /** @description The installer is not an active owner of the GitHub organization (or not the personal account) the installation belongs to, or the App lacks "Organization members: read" */
1275
- 403: {
1276
- headers: {
1277
- [name: string]: unknown;
1278
- };
1279
- content: {
1280
- 'application/json': components['schemas']['Error'];
1281
- };
1282
- };
1283
- /** @description This installation is already connected to the organization (under the name the message states), the install session was already completed, or this attempt was superseded by a newer start under the same name while the callback ran (nothing is written; finish the newer attempt) */
1284
- 409: {
1469
+ /** @description No `state` (the connection has to be started from Keboola), no matching session cookie, or an unknown or expired session. With no session there is no `returnUrl` to go back to. */
1470
+ 400: {
1285
1471
  headers: {
1286
1472
  [name: string]: unknown;
1287
1473
  };
@@ -1307,17 +1493,30 @@ interface operations {
1307
1493
  };
1308
1494
  };
1309
1495
  responses: {
1310
- /** @description Redirect to GitHub to install the App */
1496
+ /**
1497
+ * @description To the GitHub App's OAuth web flow (`/login/oauth/authorize`); or, when the connection
1498
+ * cannot start, back to `returnUrl` with `error` and `message` added to its query — see
1499
+ * `OrganizationConnectErrorCode`:
1500
+ *
1501
+ * * `invalidToken` — Manage API does not know the token, or it is expired or disabled
1502
+ * (`401`);
1503
+ * * `notUserToken` — an application token, with no user behind it (`403`);
1504
+ * * `notOrganizationAdmin` — the caller does not administer the organization (`403`);
1505
+ * * `noAppForHost` — no GitHub App is registered for that host on this stack (`412`);
1506
+ * * `nameTaken` — a completed connection with this name already exists in the
1507
+ * organization (`409`);
1508
+ * * `manageApiUnavailable` — Manage API is unavailable (`503`);
1509
+ * * `connectFailed`, `internalError` — anything else.
1510
+ */
1311
1511
  302: {
1312
1512
  headers: {
1513
+ Location?: string;
1313
1514
  [name: string]: unknown;
1314
1515
  };
1315
1516
  content?: never;
1316
1517
  };
1317
- 400: components['responses']['400_BadRequest'];
1318
- 403: components['responses']['403_Forbidden'];
1319
- /** @description A completed connection with this name already exists in the organization */
1320
- 409: {
1518
+ /** @description `returnUrl` is not on an allowed origin */
1519
+ 400: {
1321
1520
  headers: {
1322
1521
  [name: string]: unknown;
1323
1522
  };
@@ -1325,8 +1524,8 @@ interface operations {
1325
1524
  'application/json': components['schemas']['Error'];
1326
1525
  };
1327
1526
  };
1328
- /** @description No GitHub App is registered for that host on this stack */
1329
- 412: {
1527
+ /** @description The request's `Origin` is missing or not allowed */
1528
+ 403: {
1330
1529
  headers: {
1331
1530
  [name: string]: unknown;
1332
1531
  };
@@ -1335,7 +1534,6 @@ interface operations {
1335
1534
  };
1336
1535
  };
1337
1536
  422: components['responses']['422_UnprocessableEntity'];
1338
- 503: components['responses']['503_ServiceUnavailable'];
1339
1537
  };
1340
1538
  };
1341
1539
  organizationCredentialsList: {
@@ -1364,6 +1562,32 @@ interface operations {
1364
1562
  503: components['responses']['503_ServiceUnavailable'];
1365
1563
  };
1366
1564
  };
1565
+ organizationGitHubAppsList: {
1566
+ parameters: {
1567
+ query?: never;
1568
+ header?: never;
1569
+ path: {
1570
+ /** @description Numeric Keboola organization ID. Always explicit — it is never derived from the token, because a user typically belongs to projects across several organizations. */
1571
+ organizationId: components['parameters']['OrganizationId'];
1572
+ };
1573
+ cookie?: never;
1574
+ };
1575
+ requestBody?: never;
1576
+ responses: {
1577
+ /** @description Registered GitHub Apps, one per host */
1578
+ 200: {
1579
+ headers: {
1580
+ [name: string]: unknown;
1581
+ };
1582
+ content: {
1583
+ 'application/json': components['schemas']['OrganizationGitHubApp'][];
1584
+ };
1585
+ };
1586
+ 401: components['responses']['401_Unauthorized'];
1587
+ 403: components['responses']['403_Forbidden'];
1588
+ 503: components['responses']['503_ServiceUnavailable'];
1589
+ };
1590
+ };
1367
1591
  organizationCredentialsConnections: {
1368
1592
  parameters: {
1369
1593
  query?: never;
@@ -1526,5 +1750,16 @@ type CredentialInput = ComponentPath & {
1526
1750
  type CreateCredentialInput = ComponentPath & Omit<CreateCredentialBody, '#data'> & {
1527
1751
  data: Record<string, unknown>;
1528
1752
  };
1529
- export { CredentialInput as a, GetCredentialsInput as c, Credential as i, CreateCredentialBody as n, CredentialPath as o, CreateCredentialInput as r, OrganizationConnection as s, ComponentPath as t };
1530
- //# sourceMappingURL=types-DjWubjvP.d.cts.map
1753
+ type OrganizationCredentials = OpenapiReturnType<paths['/organizations/{organizationId}/credentials']['get']>[number];
1754
+ type ManageTokenInput = {
1755
+ /** A Manage API token with a user behind it, e.g. the Control Panel's session token. */
1756
+ manageToken: string;
1757
+ };
1758
+ type GetOrganizationCredentialsInput = OpenapiPathType<paths['/organizations/{organizationId}/credentials']['get']> & ManageTokenInput;
1759
+ type GetOrganizationGitHubAppsInput = OpenapiPathType<paths['/organizations/{organizationId}/github-apps']['get']> & ManageTokenInput;
1760
+ type OrganizationGitHubApp = components['schemas']['OrganizationGitHubApp'];
1761
+ type OrganizationConnectErrorCode = components['schemas']['OrganizationConnectErrorCode'];
1762
+ type DeleteOrganizationCredentialsInput = OpenapiPathType<paths['/organizations/{organizationId}/credentials/{id}']['delete']> & ManageTokenInput;
1763
+ type GetOrganizationConnectFormInput = OpenapiPathType<paths['/authorize/organizations/{organizationId}']['post']> & OpenapiBodyType<paths['/authorize/organizations/{organizationId}']['post']>;
1764
+ export { CredentialInput as a, GetOrganizationConnectFormInput as c, OrganizationConnectErrorCode as d, OrganizationConnection as f, GetCredentialsInput as h, Credential as i, GetOrganizationCredentialsInput as l, OrganizationGitHubApp as m, CreateCredentialBody as n, CredentialPath as o, OrganizationCredentials as p, CreateCredentialInput as r, DeleteOrganizationCredentialsInput as s, ComponentPath as t, GetOrganizationGitHubAppsInput as u };
1765
+ //# sourceMappingURL=types-DMhgKHCP.d.cts.map