@tai42/api-client 19.3.0 → 21.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.
- package/README.md +29 -0
- package/dist/agents.d.ts.map +1 -1
- package/dist/agents.js +6 -4
- package/dist/agents.js.map +1 -1
- package/dist/client/agents-client.d.ts.map +1 -1
- package/dist/client/agents-client.js +3 -2
- package/dist/client/agents-client.js.map +1 -1
- package/dist/client/auth-client.d.ts +143 -90
- package/dist/client/auth-client.d.ts.map +1 -1
- package/dist/client/auth-client.js +81 -25
- package/dist/client/auth-client.js.map +1 -1
- package/dist/client/backend-client.d.ts +14 -13
- package/dist/client/backend-client.d.ts.map +1 -1
- package/dist/client/backend-client.js +7 -3
- package/dist/client/backend-client.js.map +1 -1
- package/dist/client/backup-client.d.ts +45 -19
- package/dist/client/backup-client.d.ts.map +1 -1
- package/dist/client/backup-client.js +8 -3
- package/dist/client/backup-client.js.map +1 -1
- package/dist/client/capabilities-client.d.ts +20 -16
- package/dist/client/capabilities-client.d.ts.map +1 -1
- package/dist/client/capabilities-client.js +3 -2
- package/dist/client/capabilities-client.js.map +1 -1
- package/dist/client/channels-client.d.ts.map +1 -1
- package/dist/client/channels-client.js +2 -1
- package/dist/client/channels-client.js.map +1 -1
- package/dist/client/config-client.d.ts +44 -17
- package/dist/client/config-client.d.ts.map +1 -1
- package/dist/client/config-client.js +10 -4
- package/dist/client/config-client.js.map +1 -1
- package/dist/client/connectors-client.d.ts +270 -81
- package/dist/client/connectors-client.d.ts.map +1 -1
- package/dist/client/connectors-client.js +38 -10
- package/dist/client/connectors-client.js.map +1 -1
- package/dist/client/conversations-client.d.ts +440 -86
- package/dist/client/conversations-client.d.ts.map +1 -1
- package/dist/client/conversations-client.js +46 -17
- package/dist/client/conversations-client.js.map +1 -1
- package/dist/client/hooks-client.d.ts +3 -3
- package/dist/client/hooks-client.d.ts.map +1 -1
- package/dist/client/hooks-client.js +12 -7
- package/dist/client/hooks-client.js.map +1 -1
- package/dist/client/index.d.ts +2252 -864
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +10 -2
- package/dist/client/index.js.map +1 -1
- package/dist/client/interactions-client.d.ts +19 -14
- package/dist/client/interactions-client.d.ts.map +1 -1
- package/dist/client/interactions-client.js +21 -9
- package/dist/client/interactions-client.js.map +1 -1
- package/dist/client/login-client.d.ts +18 -17
- package/dist/client/login-client.d.ts.map +1 -1
- package/dist/client/login-client.js +8 -4
- package/dist/client/login-client.js.map +1 -1
- package/dist/client/manifest-client.d.ts +276 -105
- package/dist/client/manifest-client.d.ts.map +1 -1
- package/dist/client/manifest-client.js +22 -16
- package/dist/client/manifest-client.js.map +1 -1
- package/dist/client/marketplace-client.d.ts +181 -51
- package/dist/client/marketplace-client.d.ts.map +1 -1
- package/dist/client/marketplace-client.js +23 -12
- package/dist/client/marketplace-client.js.map +1 -1
- package/dist/client/mcp-config-schema-client.d.ts.map +1 -1
- package/dist/client/mcp-config-schema-client.js +2 -1
- package/dist/client/mcp-config-schema-client.js.map +1 -1
- package/dist/client/notifications-client.d.ts +44 -14
- package/dist/client/notifications-client.d.ts.map +1 -1
- package/dist/client/notifications-client.js +2 -1
- package/dist/client/notifications-client.js.map +1 -1
- package/dist/client/observability-client.d.ts +78 -38
- package/dist/client/observability-client.d.ts.map +1 -1
- package/dist/client/observability-client.js +29 -6
- package/dist/client/observability-client.js.map +1 -1
- package/dist/client/plugins-client.d.ts +8 -6
- package/dist/client/plugins-client.d.ts.map +1 -1
- package/dist/client/plugins-client.js +2 -1
- package/dist/client/plugins-client.js.map +1 -1
- package/dist/client/policy-client.d.ts +4 -4
- package/dist/client/policy-client.d.ts.map +1 -1
- package/dist/client/policy-client.js +11 -4
- package/dist/client/policy-client.js.map +1 -1
- package/dist/client/presets-client.d.ts +84 -39
- package/dist/client/presets-client.d.ts.map +1 -1
- package/dist/client/presets-client.js +25 -13
- package/dist/client/presets-client.js.map +1 -1
- package/dist/client/profiles-client.d.ts +40 -33
- package/dist/client/profiles-client.d.ts.map +1 -1
- package/dist/client/profiles-client.js +15 -10
- package/dist/client/profiles-client.js.map +1 -1
- package/dist/client/schedules-client.d.ts +21 -17
- package/dist/client/schedules-client.d.ts.map +1 -1
- package/dist/client/schedules-client.js +8 -5
- package/dist/client/schedules-client.js.map +1 -1
- package/dist/client/settings-schema-client.d.ts +1 -1
- package/dist/client/settings-schema-client.d.ts.map +1 -1
- package/dist/client/settings-schema-client.js +2 -1
- package/dist/client/settings-schema-client.js.map +1 -1
- package/dist/client/states-client.d.ts +215 -87
- package/dist/client/states-client.d.ts.map +1 -1
- package/dist/client/states-client.js +98 -37
- package/dist/client/states-client.js.map +1 -1
- package/dist/client/storage-client.d.ts +5 -5
- package/dist/client/storage-client.d.ts.map +1 -1
- package/dist/client/storage-client.js +24 -12
- package/dist/client/storage-client.js.map +1 -1
- package/dist/client/sub-mcp-client.d.ts +3 -1
- package/dist/client/sub-mcp-client.d.ts.map +1 -1
- package/dist/client/sub-mcp-client.js +9 -4
- package/dist/client/sub-mcp-client.js.map +1 -1
- package/dist/client/system-client.d.ts +2 -2
- package/dist/client/system-client.d.ts.map +1 -1
- package/dist/client/system-client.js +2 -1
- package/dist/client/system-client.js.map +1 -1
- package/dist/client/templates-client.d.ts +65 -6
- package/dist/client/templates-client.d.ts.map +1 -1
- package/dist/client/templates-client.js +25 -7
- package/dist/client/templates-client.js.map +1 -1
- package/dist/client/tool-extensions-client.d.ts +41 -16
- package/dist/client/tool-extensions-client.d.ts.map +1 -1
- package/dist/client/tool-extensions-client.js +6 -4
- package/dist/client/tool-extensions-client.js.map +1 -1
- package/dist/client/tool-meta-client.d.ts +8 -8
- package/dist/client/tool-meta-client.d.ts.map +1 -1
- package/dist/client/tool-meta-client.js +12 -8
- package/dist/client/tool-meta-client.js.map +1 -1
- package/dist/client/tools-client.d.ts +150 -23
- package/dist/client/tools-client.d.ts.map +1 -1
- package/dist/client/tools-client.js +8 -8
- package/dist/client/tools-client.js.map +1 -1
- package/dist/client/trigger-links-client.d.ts +11 -9
- package/dist/client/trigger-links-client.d.ts.map +1 -1
- package/dist/client/trigger-links-client.js +4 -4
- package/dist/client/trigger-links-client.js.map +1 -1
- package/dist/fleet-report.d.ts +21 -5
- package/dist/fleet-report.d.ts.map +1 -1
- package/dist/fleet-report.js +31 -6
- package/dist/fleet-report.js.map +1 -1
- package/dist/generated/api-routes.d.ts +1014 -0
- package/dist/generated/api-routes.d.ts.map +1 -0
- package/dist/generated/api-routes.js +322 -0
- package/dist/generated/api-routes.js.map +1 -0
- package/dist/generated/openapi-schemas.d.ts +12425 -0
- package/dist/generated/openapi-schemas.d.ts.map +1 -0
- package/dist/generated/openapi-schemas.js +671 -0
- package/dist/generated/openapi-schemas.js.map +1 -0
- package/dist/generated/served-schemas.d.ts +6697 -392
- package/dist/generated/served-schemas.d.ts.map +1 -1
- package/dist/generated/served-schemas.js +7061 -46
- package/dist/generated/served-schemas.js.map +1 -1
- package/dist/headers.d.ts +4 -0
- package/dist/headers.d.ts.map +1 -0
- package/dist/headers.js +4 -0
- package/dist/headers.js.map +1 -0
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +4 -3
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/schemas/api-keys.d.ts +14 -12
- package/dist/schemas/api-keys.d.ts.map +1 -1
- package/dist/schemas/api-keys.js +9 -23
- package/dist/schemas/api-keys.js.map +1 -1
- package/dist/schemas/auth-routes.d.ts +34 -29
- package/dist/schemas/auth-routes.d.ts.map +1 -1
- package/dist/schemas/auth-routes.js +22 -27
- package/dist/schemas/auth-routes.js.map +1 -1
- package/dist/schemas/backup.d.ts +157 -36
- package/dist/schemas/backup.d.ts.map +1 -1
- package/dist/schemas/backup.js +27 -26
- package/dist/schemas/backup.js.map +1 -1
- package/dist/schemas/capabilities.d.ts +32 -22
- package/dist/schemas/capabilities.d.ts.map +1 -1
- package/dist/schemas/capabilities.js +15 -40
- package/dist/schemas/capabilities.js.map +1 -1
- package/dist/schemas/channels.d.ts +1 -1
- package/dist/schemas/channels.d.ts.map +1 -1
- package/dist/schemas/channels.js +2 -5
- package/dist/schemas/channels.js.map +1 -1
- package/dist/schemas/config.d.ts.map +1 -1
- package/dist/schemas/config.js +4 -6
- package/dist/schemas/config.js.map +1 -1
- package/dist/schemas/connectors.d.ts +381 -185
- package/dist/schemas/connectors.d.ts.map +1 -1
- package/dist/schemas/connectors.js +54 -101
- package/dist/schemas/connectors.js.map +1 -1
- package/dist/schemas/conversations.d.ts +970 -241
- package/dist/schemas/conversations.d.ts.map +1 -1
- package/dist/schemas/conversations.js +40 -134
- package/dist/schemas/conversations.js.map +1 -1
- package/dist/schemas/extensions.d.ts +9 -6
- package/dist/schemas/extensions.d.ts.map +1 -1
- package/dist/schemas/extensions.js +6 -4
- package/dist/schemas/extensions.js.map +1 -1
- package/dist/schemas/fleet.d.ts +153 -99
- package/dist/schemas/fleet.d.ts.map +1 -1
- package/dist/schemas/fleet.js +41 -51
- package/dist/schemas/fleet.js.map +1 -1
- package/dist/schemas/hooks.d.ts +34 -34
- package/dist/schemas/hooks.d.ts.map +1 -1
- package/dist/schemas/hooks.js +15 -34
- package/dist/schemas/hooks.js.map +1 -1
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +1 -1
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/interactions.d.ts +146 -123
- package/dist/schemas/interactions.d.ts.map +1 -1
- package/dist/schemas/interactions.js +44 -129
- package/dist/schemas/interactions.js.map +1 -1
- package/dist/schemas/login.d.ts +36 -37
- package/dist/schemas/login.d.ts.map +1 -1
- package/dist/schemas/login.js +8 -42
- package/dist/schemas/login.js.map +1 -1
- package/dist/schemas/manifest-mcp.d.ts +61 -35
- package/dist/schemas/manifest-mcp.d.ts.map +1 -1
- package/dist/schemas/manifest-mcp.js +13 -19
- package/dist/schemas/manifest-mcp.js.map +1 -1
- package/dist/schemas/marketplace.d.ts +219 -133
- package/dist/schemas/marketplace.d.ts.map +1 -1
- package/dist/schemas/marketplace.js +35 -120
- package/dist/schemas/marketplace.js.map +1 -1
- package/dist/schemas/members.d.ts +161 -0
- package/dist/schemas/members.d.ts.map +1 -0
- package/dist/schemas/members.js +73 -0
- package/dist/schemas/members.js.map +1 -0
- package/dist/schemas/notifications.d.ts +113 -41
- package/dist/schemas/notifications.d.ts.map +1 -1
- package/dist/schemas/notifications.js +9 -35
- package/dist/schemas/notifications.js.map +1 -1
- package/dist/schemas/observability.d.ts +174 -72
- package/dist/schemas/observability.d.ts.map +1 -1
- package/dist/schemas/observability.js +23 -76
- package/dist/schemas/observability.js.map +1 -1
- package/dist/schemas/policy.d.ts +11 -11
- package/dist/schemas/policy.d.ts.map +1 -1
- package/dist/schemas/policy.js +5 -12
- package/dist/schemas/policy.js.map +1 -1
- package/dist/schemas/presets.d.ts +109 -64
- package/dist/schemas/presets.d.ts.map +1 -1
- package/dist/schemas/presets.js +12 -48
- package/dist/schemas/presets.js.map +1 -1
- package/dist/schemas/principals.d.ts +28 -21
- package/dist/schemas/principals.d.ts.map +1 -1
- package/dist/schemas/principals.js +13 -25
- package/dist/schemas/principals.js.map +1 -1
- package/dist/schemas/profiles.d.ts +75 -63
- package/dist/schemas/profiles.d.ts.map +1 -1
- package/dist/schemas/profiles.js +24 -54
- package/dist/schemas/profiles.js.map +1 -1
- package/dist/schemas/roles.d.ts +22 -22
- package/dist/schemas/roles.d.ts.map +1 -1
- package/dist/schemas/roles.js +10 -17
- package/dist/schemas/roles.js.map +1 -1
- package/dist/schemas/schedules.d.ts +21 -15
- package/dist/schemas/schedules.d.ts.map +1 -1
- package/dist/schemas/schedules.js +4 -13
- package/dist/schemas/schedules.js.map +1 -1
- package/dist/schemas/served.d.ts +6373 -194
- package/dist/schemas/served.d.ts.map +1 -1
- package/dist/schemas/served.js +21 -0
- package/dist/schemas/served.js.map +1 -1
- package/dist/schemas/settings-schema.d.ts +1 -1
- package/dist/schemas/settings-schema.d.ts.map +1 -1
- package/dist/schemas/settings-schema.js +17 -19
- package/dist/schemas/settings-schema.js.map +1 -1
- package/dist/schemas/setup.d.ts +6 -6
- package/dist/schemas/setup.d.ts.map +1 -1
- package/dist/schemas/setup.js +2 -11
- package/dist/schemas/setup.js.map +1 -1
- package/dist/schemas/states.d.ts +450 -135
- package/dist/schemas/states.d.ts.map +1 -1
- package/dist/schemas/states.js +76 -140
- package/dist/schemas/states.js.map +1 -1
- package/dist/schemas/storage.d.ts +7 -8
- package/dist/schemas/storage.d.ts.map +1 -1
- package/dist/schemas/storage.js +8 -17
- package/dist/schemas/storage.js.map +1 -1
- package/dist/schemas/studio-plugins.d.ts +24 -18
- package/dist/schemas/studio-plugins.d.ts.map +1 -1
- package/dist/schemas/studio-plugins.js +5 -19
- package/dist/schemas/studio-plugins.js.map +1 -1
- package/dist/schemas/sub-mcp.d.ts +11 -8
- package/dist/schemas/sub-mcp.d.ts.map +1 -1
- package/dist/schemas/sub-mcp.js +10 -19
- package/dist/schemas/sub-mcp.js.map +1 -1
- package/dist/schemas/system-kinds.d.ts +76 -46
- package/dist/schemas/system-kinds.d.ts.map +1 -1
- package/dist/schemas/system-kinds.js +11 -28
- package/dist/schemas/system-kinds.js.map +1 -1
- package/dist/schemas/templates.d.ts +83 -25
- package/dist/schemas/templates.d.ts.map +1 -1
- package/dist/schemas/templates.js +8 -9
- package/dist/schemas/templates.js.map +1 -1
- package/dist/schemas/tool-meta.d.ts +15 -15
- package/dist/schemas/tool-meta.d.ts.map +1 -1
- package/dist/schemas/tool-meta.js +6 -21
- package/dist/schemas/tool-meta.js.map +1 -1
- package/dist/schemas/tools.d.ts +177 -56
- package/dist/schemas/tools.d.ts.map +1 -1
- package/dist/schemas/tools.js +20 -41
- package/dist/schemas/tools.js.map +1 -1
- package/dist/schemas/trigger-links.d.ts +22 -17
- package/dist/schemas/trigger-links.d.ts.map +1 -1
- package/dist/schemas/trigger-links.js +7 -27
- package/dist/schemas/trigger-links.js.map +1 -1
- package/dist/tool-runs.d.ts +175 -54
- package/dist/tool-runs.d.ts.map +1 -1
- package/dist/tool-runs.js +33 -34
- package/dist/tool-runs.js.map +1 -1
- package/package.json +4 -3
- package/src/agents.ts +16 -4
- package/src/client/agents-client.ts +3 -2
- package/src/client/auth-client.ts +134 -34
- package/src/client/backend-client.ts +8 -3
- package/src/client/backup-client.ts +8 -3
- package/src/client/capabilities-client.ts +4 -2
- package/src/client/channels-client.ts +3 -1
- package/src/client/config-client.ts +13 -5
- package/src/client/connectors-client.ts +91 -16
- package/src/client/conversations-client.ts +79 -30
- package/src/client/hooks-client.ts +25 -12
- package/src/client/index.ts +16 -4
- package/src/client/interactions-client.ts +40 -16
- package/src/client/login-client.ts +8 -4
- package/src/client/manifest-client.ts +48 -24
- package/src/client/marketplace-client.ts +23 -12
- package/src/client/mcp-config-schema-client.ts +2 -1
- package/src/client/notifications-client.ts +2 -1
- package/src/client/observability-client.ts +60 -8
- package/src/client/plugins-client.ts +2 -1
- package/src/client/policy-client.ts +24 -9
- package/src/client/presets-client.ts +26 -13
- package/src/client/profiles-client.ts +53 -24
- package/src/client/schedules-client.ts +14 -20
- package/src/client/settings-schema-client.ts +2 -1
- package/src/client/states-client.ts +151 -49
- package/src/client/storage-client.ts +43 -14
- package/src/client/sub-mcp-client.ts +10 -4
- package/src/client/system-client.ts +2 -1
- package/src/client/templates-client.ts +26 -7
- package/src/client/tool-extensions-client.ts +14 -7
- package/src/client/tool-meta-client.ts +46 -21
- package/src/client/tools-client.ts +13 -8
- package/src/client/trigger-links-client.ts +10 -6
- package/src/fleet-report.ts +48 -7
- package/src/generated/api-routes.ts +327 -0
- package/src/generated/openapi-schemas.ts +1508 -0
- package/src/generated/served-schemas.ts +7118 -82
- package/src/headers.ts +4 -0
- package/src/http.ts +4 -3
- package/src/index.ts +52 -10
- package/src/schemas/api-keys.ts +9 -25
- package/src/schemas/auth-routes.ts +27 -28
- package/src/schemas/backup.ts +33 -31
- package/src/schemas/capabilities.ts +16 -39
- package/src/schemas/channels.ts +4 -4
- package/src/schemas/config.ts +6 -6
- package/src/schemas/connectors.ts +61 -102
- package/src/schemas/conversations.ts +43 -133
- package/src/schemas/extensions.ts +7 -4
- package/src/schemas/fleet.ts +51 -51
- package/src/schemas/hooks.ts +18 -37
- package/src/schemas/index.ts +1 -1
- package/src/schemas/interactions.ts +48 -131
- package/src/schemas/login.ts +10 -41
- package/src/schemas/manifest-mcp.ts +13 -19
- package/src/schemas/marketplace.ts +37 -120
- package/src/schemas/members.ts +91 -0
- package/src/schemas/notifications.ts +10 -34
- package/src/schemas/observability.ts +34 -79
- package/src/schemas/policy.ts +5 -12
- package/src/schemas/presets.ts +13 -48
- package/src/schemas/principals.ts +17 -24
- package/src/schemas/profiles.ts +25 -55
- package/src/schemas/roles.ts +11 -17
- package/src/schemas/schedules.ts +4 -15
- package/src/schemas/served.ts +33 -0
- package/src/schemas/settings-schema.ts +18 -23
- package/src/schemas/setup.ts +4 -10
- package/src/schemas/states.ts +88 -139
- package/src/schemas/storage.ts +10 -16
- package/src/schemas/studio-plugins.ts +8 -19
- package/src/schemas/sub-mcp.ts +12 -18
- package/src/schemas/system-kinds.ts +12 -29
- package/src/schemas/templates.ts +8 -10
- package/src/schemas/tool-meta.ts +8 -20
- package/src/schemas/tools.ts +22 -45
- package/src/schemas/trigger-links.ts +8 -26
- package/src/tool-runs.ts +47 -38
- package/dist/client/web-entry-gate-client.d.ts +0 -34
- package/dist/client/web-entry-gate-client.d.ts.map +0 -1
- package/dist/client/web-entry-gate-client.js +0 -25
- package/dist/client/web-entry-gate-client.js.map +0 -1
- package/dist/schemas/web-entry.d.ts +0 -45
- package/dist/schemas/web-entry.d.ts.map +0 -1
- package/dist/schemas/web-entry.js +0 -36
- package/dist/schemas/web-entry.js.map +0 -1
- package/src/client/web-entry-gate-client.ts +0 -45
- package/src/schemas/web-entry.ts +0 -46
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Auth scopes, routes, roles and API-key sub-client. */
|
|
2
|
-
import {
|
|
2
|
+
import { apiRoutes, buildPath } from '../generated/api-routes';
|
|
3
3
|
import * as s from '../schemas';
|
|
4
4
|
import type { Transport } from './transport';
|
|
5
5
|
|
|
@@ -72,99 +72,199 @@ export interface PinRoutePublicBody {
|
|
|
72
72
|
readonly pattern?: string;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
/**
|
|
76
|
+
* Body for invoking a declared member action (POST
|
|
77
|
+
* `/api/auth/member-actions/invoke`). `action_key` is the opaque catalog key;
|
|
78
|
+
* `target_handle` is the row handle the action acts on, `null` for a page-scoped
|
|
79
|
+
* action; `input` is the per-action input the backend validates against the action's
|
|
80
|
+
* declared input model. All three are opaque to Studio — the keys are joined and
|
|
81
|
+
* echoed, the input is built from the action's `input_schema`, and no provider field
|
|
82
|
+
* is named here.
|
|
83
|
+
*/
|
|
84
|
+
export interface InvokeMemberActionBody {
|
|
85
|
+
readonly action_key: string;
|
|
86
|
+
readonly target_handle: string | null;
|
|
87
|
+
readonly input: Record<string, unknown>;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** Scope mapping, the route catalog and the public-route pins. */
|
|
91
|
+
function scopeRouteMethods(t: Transport) {
|
|
76
92
|
const { req } = t;
|
|
77
93
|
return {
|
|
78
|
-
listScopes: (signal?: AbortSignal) =>
|
|
94
|
+
listScopes: (signal?: AbortSignal) =>
|
|
95
|
+
req(apiRoutes.get_api_auth_scopes.path, s.authScopes, { signal }),
|
|
79
96
|
addUrlToScope: (body: AddUrlToScopeBody) =>
|
|
80
|
-
req(
|
|
97
|
+
req(apiRoutes.post_api_auth_scopes.path, s.addUrlToScopeResult, { method: 'POST', body }),
|
|
81
98
|
removeUrlFromScope: (body: { url: string }) =>
|
|
82
|
-
req(
|
|
83
|
-
removeScope: (scopeId: string) =>
|
|
84
|
-
req(`/api/auth/scopes/${encodeSegment(scopeId)}`, s.removeScopeResult, {
|
|
99
|
+
req(apiRoutes.delete_api_auth_scopes_urls.path, s.removeUrlFromScopeResult, {
|
|
85
100
|
method: 'DELETE',
|
|
101
|
+
body,
|
|
86
102
|
}),
|
|
103
|
+
removeScope: (scopeId: string) =>
|
|
104
|
+
req(
|
|
105
|
+
buildPath(apiRoutes.delete_api_auth_scopes_scope_id.path, { scope_id: scopeId }),
|
|
106
|
+
s.removeScopeResult,
|
|
107
|
+
{
|
|
108
|
+
method: 'DELETE',
|
|
109
|
+
},
|
|
110
|
+
),
|
|
87
111
|
// The app's HTTP route catalog with each route's current mapping — the only
|
|
88
112
|
// source of the mapper's unassigned-routes bucket (`mapped: null` entries).
|
|
89
|
-
listAuthRoutes: (signal?: AbortSignal) =>
|
|
113
|
+
listAuthRoutes: (signal?: AbortSignal) =>
|
|
114
|
+
req(apiRoutes.get_api_auth_routes.path, s.authRoutes, { signal }),
|
|
90
115
|
// The urls pinned to the public marker; pinning/unpinning is the dedicated
|
|
91
116
|
// public-routes writer, never the scope machinery.
|
|
92
117
|
listPublicRoutes: (signal?: AbortSignal) =>
|
|
93
|
-
req(
|
|
118
|
+
req(apiRoutes.get_api_auth_public_routes.path, s.publicRoutes, { signal }),
|
|
94
119
|
pinRoutePublic: (body: PinRoutePublicBody) =>
|
|
95
|
-
req(
|
|
120
|
+
req(apiRoutes.post_api_auth_public_routes.path, s.pinPublicResult, { method: 'POST', body }),
|
|
96
121
|
// Unpin a public url. A url that is absent or scope-mapped is a loud 404.
|
|
97
122
|
unpinPublicRoute: (url: string) =>
|
|
98
|
-
req(
|
|
123
|
+
req(apiRoutes.delete_api_auth_public_routes.path, s.unpinPublicResult, {
|
|
124
|
+
method: 'DELETE',
|
|
125
|
+
body: { url },
|
|
126
|
+
}),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
99
129
|
|
|
130
|
+
/** Role bodies, their version history and rollback. */
|
|
131
|
+
function roleMethods(t: Transport) {
|
|
132
|
+
const { req } = t;
|
|
133
|
+
return {
|
|
100
134
|
// The seeded + operator-authored roles as full bodies (base-tier ceiling +
|
|
101
135
|
// editable per-tag grant map). ADMIN-ONLY — the route is `secret` (a listing
|
|
102
136
|
// exposes each role's raw base-tier jq); a non-admin projection never reaches it.
|
|
103
|
-
listRoles: (signal?: AbortSignal) =>
|
|
137
|
+
listRoles: (signal?: AbortSignal) =>
|
|
138
|
+
req(apiRoutes.get_api_auth_roles.path, s.roleList, { signal }),
|
|
104
139
|
// Create an operator-authored role. The server validates the grant map + base
|
|
105
140
|
// tier and 409s on a name collision; the reserved `admin` role cannot be created.
|
|
106
141
|
createRole: (body: RoleCreateBody) =>
|
|
107
|
-
req(
|
|
142
|
+
req(apiRoutes.post_api_auth_roles.path, s.roleBody, { method: 'POST', body }),
|
|
108
143
|
// Edit a role's per-tag grant map + description (omit-means-keep). The reserved
|
|
109
144
|
// `admin` role and any `allow_all` role are block-downgrade guarded server-side.
|
|
110
145
|
updateRole: (name: string, body: RoleUpdateBody) =>
|
|
111
|
-
req(
|
|
146
|
+
req(buildPath(apiRoutes.put_api_auth_roles_name.path, { name }), s.roleBody, {
|
|
147
|
+
method: 'PUT',
|
|
148
|
+
body,
|
|
149
|
+
}),
|
|
112
150
|
// Delete a role. The reserved `admin` role is undeletable; a role still assigned
|
|
113
151
|
// to any principal is a loud 409.
|
|
114
152
|
deleteRole: (name: string) =>
|
|
115
|
-
req(
|
|
153
|
+
req(buildPath(apiRoutes.delete_api_auth_roles_name.path, { name }), s.roleDeleted, {
|
|
154
|
+
method: 'DELETE',
|
|
155
|
+
}),
|
|
116
156
|
// A role's append-only version history + who/action/before→after audit trail.
|
|
117
157
|
// ADMIN-ONLY (`secret`).
|
|
118
158
|
listRoleVersions: (name: string, signal?: AbortSignal) =>
|
|
119
|
-
req(
|
|
159
|
+
req(buildPath(apiRoutes.get_api_auth_roles_name_versions.path, { name }), s.roleVersions, {
|
|
160
|
+
signal,
|
|
161
|
+
}),
|
|
120
162
|
// Re-point a role's active version to a prior one (LIVE — holders follow on
|
|
121
163
|
// their next request); returns the re-pointed role body.
|
|
122
164
|
rollbackRole: (name: string, version: number) =>
|
|
123
|
-
req(
|
|
165
|
+
req(buildPath(apiRoutes.post_api_auth_roles_name_rollback.path, { name }), s.roleBody, {
|
|
124
166
|
method: 'POST',
|
|
125
167
|
body: { version },
|
|
126
168
|
}),
|
|
169
|
+
};
|
|
170
|
+
}
|
|
127
171
|
|
|
172
|
+
/** API keys, claim links and the member directory with its actions. */
|
|
173
|
+
function keyMemberMethods(t: Transport) {
|
|
174
|
+
const { req } = t;
|
|
175
|
+
return {
|
|
128
176
|
listTokensPayload: (signal?: AbortSignal) =>
|
|
129
|
-
req(
|
|
177
|
+
req(apiRoutes.get_api_auth_tokens_payload.path, s.tokensPayload, { signal }),
|
|
130
178
|
createApiKey: (body: ApiKeyBody) =>
|
|
131
|
-
req(
|
|
179
|
+
req(apiRoutes.post_api_auth_api_keys.path, s.createdApiKey, { method: 'POST', body }),
|
|
132
180
|
editApiKey: (userId: string, body: Omit<ApiKeyBody, 'user_id'>) =>
|
|
133
|
-
req(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
181
|
+
req(
|
|
182
|
+
buildPath(apiRoutes.put_api_auth_api_keys_user_id.path, { user_id: userId }),
|
|
183
|
+
s.editApiKeyResult,
|
|
184
|
+
{
|
|
185
|
+
method: 'PUT',
|
|
186
|
+
body,
|
|
187
|
+
},
|
|
188
|
+
),
|
|
137
189
|
revokeApiKey: (userId: string) =>
|
|
138
|
-
req(
|
|
139
|
-
|
|
140
|
-
|
|
190
|
+
req(
|
|
191
|
+
buildPath(apiRoutes.delete_api_auth_api_keys_user_id.path, { user_id: userId }),
|
|
192
|
+
s.revokeApiKeyResult,
|
|
193
|
+
{
|
|
194
|
+
method: 'DELETE',
|
|
195
|
+
},
|
|
196
|
+
),
|
|
141
197
|
// Mint a one-time claim link carrying a raw key to another device (the QR
|
|
142
198
|
// onboarding leg). The token rides the URL fragment; the server returns a
|
|
143
199
|
// relative `claim_path` and the raw token ONCE.
|
|
144
200
|
createClaimLink: (body: ClaimLinkBody) =>
|
|
145
|
-
req(
|
|
201
|
+
req(apiRoutes.post_api_auth_claim_links.path, s.claimLinkCreated, { method: 'POST', body }),
|
|
202
|
+
|
|
203
|
+
// The deployment-wide membership: every accounts provider's people and
|
|
204
|
+
// outstanding invitations, aggregated and platform-joined server-side into one
|
|
205
|
+
// directory (each row carrying its principal state + opaque routing tokens).
|
|
206
|
+
// ADMIN-ONLY (`secret`) — a non-admin projection never reaches the route.
|
|
207
|
+
listMembers: (signal?: AbortSignal) =>
|
|
208
|
+
req(apiRoutes.get_api_auth_members.path, s.memberDirectory, { signal }),
|
|
209
|
+
|
|
210
|
+
// The catalog of member-admin actions every accounts provider declares, each
|
|
211
|
+
// with its opaque key, rendered label, placement, and input/result JSON Schema.
|
|
212
|
+
// ADMIN-ONLY (`secret`) — the same fence the members listing carries.
|
|
213
|
+
listMemberActions: (signal?: AbortSignal) =>
|
|
214
|
+
req(apiRoutes.get_api_auth_member_actions.path, s.memberActionCatalog, { signal }),
|
|
215
|
+
// Invoke one declared action by its opaque key, echoing the target row's handle
|
|
216
|
+
// and the per-action input. The result is carried opaquely for a read-only,
|
|
217
|
+
// schema-driven render. ADMIN-ONLY (`fenced`).
|
|
218
|
+
invokeMemberAction: (body: InvokeMemberActionBody) =>
|
|
219
|
+
req(apiRoutes.post_api_auth_member_actions_invoke.path, s.invokeMemberActionResult, {
|
|
220
|
+
method: 'POST',
|
|
221
|
+
body,
|
|
222
|
+
}),
|
|
223
|
+
};
|
|
224
|
+
}
|
|
146
225
|
|
|
226
|
+
/** The deployment's principals. */
|
|
227
|
+
function principalMethods(t: Transport) {
|
|
228
|
+
const { req } = t;
|
|
229
|
+
return {
|
|
147
230
|
// The deployment's principals (identities). ADMIN-ONLY (`secret`) — a
|
|
148
231
|
// non-admin projection never reaches the route.
|
|
149
232
|
listPrincipals: (signal?: AbortSignal) =>
|
|
150
|
-
req(
|
|
233
|
+
req(apiRoutes.get_api_auth_principals.path, s.principalList, { signal }),
|
|
151
234
|
// Create a `human` or `service` principal and apply its role (admin only).
|
|
152
235
|
// A duplicate id is a loud 409; an unknown role a loud 400.
|
|
153
236
|
createPrincipal: (body: {
|
|
154
237
|
user_id?: string;
|
|
155
|
-
kind:
|
|
238
|
+
kind: s.PrincipalKind;
|
|
156
239
|
display_name: string;
|
|
157
240
|
role: string;
|
|
158
|
-
}) => req(
|
|
241
|
+
}) => req(apiRoutes.post_api_auth_principals.path, s.principal, { method: 'POST', body }),
|
|
159
242
|
// Update a principal's display name and/or `disabled` flag (omit-means-keep;
|
|
160
243
|
// an all-absent body is a loud 400). Disabling turns off every credential the
|
|
161
244
|
// principal owns.
|
|
162
245
|
updatePrincipal: (userId: string, body: { display_name?: string; disabled?: boolean }) =>
|
|
163
|
-
req(
|
|
246
|
+
req(
|
|
247
|
+
buildPath(apiRoutes.put_api_auth_principals_user_id.path, { user_id: userId }),
|
|
248
|
+
s.principal,
|
|
249
|
+
{ method: 'PUT', body },
|
|
250
|
+
),
|
|
164
251
|
// Delete a principal — revokes every key it owns and its policy row.
|
|
165
252
|
deletePrincipal: (userId: string) =>
|
|
166
|
-
req(
|
|
167
|
-
|
|
168
|
-
|
|
253
|
+
req(
|
|
254
|
+
buildPath(apiRoutes.delete_api_auth_principals_user_id.path, { user_id: userId }),
|
|
255
|
+
s.principalDeleted,
|
|
256
|
+
{
|
|
257
|
+
method: 'DELETE',
|
|
258
|
+
},
|
|
259
|
+
),
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export function authClient(t: Transport) {
|
|
264
|
+
return {
|
|
265
|
+
...scopeRouteMethods(t),
|
|
266
|
+
...roleMethods(t),
|
|
267
|
+
...keyMemberMethods(t),
|
|
268
|
+
...principalMethods(t),
|
|
169
269
|
};
|
|
170
270
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Backend identity and worker-bus fleet sub-client. */
|
|
2
|
+
import { apiRoutes } from '../generated/api-routes';
|
|
2
3
|
import * as s from '../schemas';
|
|
3
4
|
import type { Transport } from './transport';
|
|
4
5
|
|
|
@@ -11,15 +12,19 @@ export function backendClient(t: Transport) {
|
|
|
11
12
|
// plugin is registered. `listFleetWorkers` reads the live bus presence census
|
|
12
13
|
// (every subscribed worker, ASGI + backend-runtime) and never fabricates an empty
|
|
13
14
|
// fleet — a census read that fails surfaces as a loud 500.
|
|
14
|
-
getBackendInfo: (signal?: AbortSignal) =>
|
|
15
|
+
getBackendInfo: (signal?: AbortSignal) =>
|
|
16
|
+
req(apiRoutes.get_api_backend.path, s.backendInfo, { signal }),
|
|
15
17
|
listFleetWorkers: (signal?: AbortSignal) =>
|
|
16
|
-
req(
|
|
18
|
+
req(apiRoutes.get_api_fleet_workers.path, s.fleetWorkers, { signal }),
|
|
17
19
|
// Soft-restart the fleet: `targets` names the workers to reload, or `null` for
|
|
18
20
|
// the whole fleet. The serving worker applies locally then broadcasts; a 200
|
|
19
21
|
// response carries the per-worker fleet report, so workers that did not converge
|
|
20
22
|
// are named, not hidden. A failed local apply instead re-raises as a loud error
|
|
21
23
|
// (the transport throws with the failure message), not a returned report.
|
|
22
24
|
reloadFleetConfig: (targets: string[] | null) =>
|
|
23
|
-
req(
|
|
25
|
+
req(apiRoutes.post_api_fleet_reload_config.path, s.fleetReloadResult, {
|
|
26
|
+
method: 'POST',
|
|
27
|
+
body: { targets },
|
|
28
|
+
}),
|
|
24
29
|
};
|
|
25
30
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Backup section listing, export and import sub-client. */
|
|
2
|
+
import { apiRoutes } from '../generated/api-routes';
|
|
2
3
|
import { apiDownload } from '../http';
|
|
3
4
|
import * as s from '../schemas';
|
|
4
5
|
import type { Transport } from './transport';
|
|
@@ -7,10 +8,14 @@ export function backupClient(t: Transport) {
|
|
|
7
8
|
const { config, req } = t;
|
|
8
9
|
return {
|
|
9
10
|
listBackupSections: (signal?: AbortSignal) =>
|
|
10
|
-
req(
|
|
11
|
+
req(apiRoutes.get_api_backup_sections.path, s.backupSections, { signal }),
|
|
11
12
|
exportBackup: (sections: string[], signal?: AbortSignal): Promise<Blob> =>
|
|
12
|
-
apiDownload(config,
|
|
13
|
+
apiDownload(config, apiRoutes.post_api_backup_export.path, {
|
|
14
|
+
method: 'POST',
|
|
15
|
+
body: { sections },
|
|
16
|
+
signal,
|
|
17
|
+
}),
|
|
13
18
|
importBackup: (body: { document: unknown; sections: string[] }) =>
|
|
14
|
-
req(
|
|
19
|
+
req(apiRoutes.post_api_backup_import.path, s.backupImportReport, { method: 'POST', body }),
|
|
15
20
|
};
|
|
16
21
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Caller capability projection and auth-capabilities sub-clients. */
|
|
2
|
+
import { apiRoutes } from '../generated/api-routes';
|
|
2
3
|
import * as s from '../schemas';
|
|
3
4
|
import type { Transport } from './transport';
|
|
4
5
|
|
|
@@ -7,7 +8,8 @@ export function capabilitiesGetMe(t: Transport) {
|
|
|
7
8
|
return {
|
|
8
9
|
// The derived (path, method) surface + tools/agents the caller can reach
|
|
9
10
|
// right now — the projection the Studio filters its nav and pages on.
|
|
10
|
-
getMe: (signal?: AbortSignal) =>
|
|
11
|
+
getMe: (signal?: AbortSignal) =>
|
|
12
|
+
req(apiRoutes.get_api_auth_me.path, s.meProjection, { signal }),
|
|
11
13
|
};
|
|
12
14
|
}
|
|
13
15
|
|
|
@@ -17,6 +19,6 @@ export function capabilitiesGetCaps(t: Transport) {
|
|
|
17
19
|
// Whether this deployment can mint API keys locally (the settings key-create
|
|
18
20
|
// UI gates on `mintable`). AUTHED.
|
|
19
21
|
getAuthCapabilities: (signal?: AbortSignal) =>
|
|
20
|
-
req(
|
|
22
|
+
req(apiRoutes.get_api_auth_capabilities.path, s.authCapabilities, { signal }),
|
|
21
23
|
};
|
|
22
24
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Installed channel-plugin catalog sub-client. */
|
|
2
|
+
import { apiRoutes } from '../generated/api-routes';
|
|
2
3
|
import * as s from '../schemas';
|
|
3
4
|
import type { Transport } from './transport';
|
|
4
5
|
|
|
@@ -6,6 +7,7 @@ export function channelsClient(t: Transport) {
|
|
|
6
7
|
const { req } = t;
|
|
7
8
|
return {
|
|
8
9
|
// The installed channel-plugin names (delivery media for ask questions).
|
|
9
|
-
listChannels: (signal?: AbortSignal) =>
|
|
10
|
+
listChannels: (signal?: AbortSignal) =>
|
|
11
|
+
req(apiRoutes.get_api_channels.path, s.channels, { signal }),
|
|
10
12
|
};
|
|
11
13
|
}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
/** Environment-config and reload sub-client. */
|
|
2
|
+
import { apiRoutes } from '../generated/api-routes';
|
|
2
3
|
import * as s from '../schemas';
|
|
3
4
|
import type { Transport } from './transport';
|
|
4
5
|
|
|
5
6
|
export function configClient(t: Transport) {
|
|
6
7
|
const { req } = t;
|
|
7
8
|
return {
|
|
8
|
-
getEnvConfig: (signal?: AbortSignal) =>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
getEnvConfig: (signal?: AbortSignal) =>
|
|
10
|
+
req(apiRoutes.get_api_config_env.path, s.envConfig, { signal }),
|
|
11
|
+
// `env` MERGES into the stored env ('' deletes a key); `secret_keys`, when a list,
|
|
12
|
+
// REPLACES the operator's secret marks (absent or `null` leaves them untouched).
|
|
13
|
+
setEnvConfig: (body: { env: Record<string, string>; secret_keys?: string[] | null }) =>
|
|
14
|
+
req(apiRoutes.post_api_config_env.path, s.reloadConfigResult, { method: 'POST', body }),
|
|
15
|
+
getConfigMode: (signal?: AbortSignal) =>
|
|
16
|
+
req(apiRoutes.get_api_config_mode.path, s.configMode, { signal }),
|
|
12
17
|
// The LOCAL soft-restart door (distinct from the System page's fleet door
|
|
13
18
|
// `/api/fleet/reload-config`): refresh env from the config manager, reset the
|
|
14
19
|
// settings caches, and re-initialize from the manifest — applied on the serving
|
|
@@ -16,6 +21,9 @@ export function configClient(t: Transport) {
|
|
|
16
21
|
// Admin-`fenced`; the 200 body is the bare per-worker fleet report so an
|
|
17
22
|
// unconverged sibling is visible, never hidden.
|
|
18
23
|
reloadConfig: (targets: string[] | null = null) =>
|
|
19
|
-
req(
|
|
24
|
+
req(apiRoutes.post_api_config_reload.path, s.fleetReloadResult, {
|
|
25
|
+
method: 'POST',
|
|
26
|
+
body: { targets },
|
|
27
|
+
}),
|
|
20
28
|
};
|
|
21
29
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Connector provider and connection lifecycle sub-client. */
|
|
2
|
-
import {
|
|
2
|
+
import { apiRoutes, buildPath } from '../generated/api-routes';
|
|
3
3
|
import * as s from '../schemas';
|
|
4
4
|
import type { Transport } from './transport';
|
|
5
5
|
|
|
@@ -11,42 +11,117 @@ export interface StartConnectArgs {
|
|
|
11
11
|
readonly return_url?: string;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
/** Look a server up by its address, or the server of an existing provider. */
|
|
15
|
+
export type DiscoverServerTarget = { readonly url: string } | { readonly providerId: string };
|
|
16
|
+
|
|
17
|
+
/** The body of `POST /api/connectors/providers`: add the MCP server at `url`. */
|
|
18
|
+
export interface AddServerArgs {
|
|
19
|
+
readonly url: string;
|
|
20
|
+
readonly id?: string;
|
|
21
|
+
readonly display_name?: string;
|
|
22
|
+
readonly description?: string;
|
|
23
|
+
readonly icon_url?: string;
|
|
24
|
+
readonly category?: string;
|
|
25
|
+
readonly scopes?: string[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** The body of `PUT /api/connectors/providers/{id}/client`: an app registered by hand. */
|
|
29
|
+
export interface SetProviderClientArgs {
|
|
30
|
+
readonly client_id: string;
|
|
31
|
+
readonly client_secret?: string | null;
|
|
32
|
+
readonly token_endpoint_auth_method?: 'client_secret_post' | 'client_secret_basic' | 'none';
|
|
33
|
+
readonly issuer?: string;
|
|
34
|
+
}
|
|
35
|
+
|
|
14
36
|
export function connectorsClient(t: Transport) {
|
|
15
37
|
const { req } = t;
|
|
16
38
|
return {
|
|
17
39
|
listProviders: (signal?: AbortSignal) =>
|
|
18
|
-
req(
|
|
40
|
+
req(apiRoutes.get_api_connectors_providers.path, s.providers, { signal }),
|
|
19
41
|
listConnections: (signal?: AbortSignal) =>
|
|
20
|
-
req(
|
|
42
|
+
req(apiRoutes.get_api_connectors_connections.path, s.connectionsList, { signal }),
|
|
21
43
|
getConnection: (id: string, signal?: AbortSignal) =>
|
|
22
|
-
req(
|
|
44
|
+
req(
|
|
45
|
+
buildPath(apiRoutes.get_api_connectors_connections_connection_id.path, {
|
|
46
|
+
connection_id: id,
|
|
47
|
+
}),
|
|
48
|
+
s.connectionView,
|
|
49
|
+
{ signal },
|
|
50
|
+
),
|
|
23
51
|
startConnect: (args: StartConnectArgs) =>
|
|
24
|
-
req(
|
|
52
|
+
req(apiRoutes.post_api_connectors_connections_start.path, s.startConnectResult, {
|
|
25
53
|
method: 'POST',
|
|
26
54
|
body: args,
|
|
27
55
|
}),
|
|
28
56
|
disconnect: (id: string) =>
|
|
29
|
-
req(
|
|
30
|
-
|
|
31
|
-
|
|
57
|
+
req(
|
|
58
|
+
buildPath(apiRoutes.delete_api_connectors_connections_connection_id.path, {
|
|
59
|
+
connection_id: id,
|
|
60
|
+
}),
|
|
61
|
+
s.disconnectResult,
|
|
62
|
+
{
|
|
63
|
+
method: 'DELETE',
|
|
64
|
+
},
|
|
65
|
+
),
|
|
32
66
|
reconnect: (id: string, enabled_sub_services: string[], return_url?: string) =>
|
|
33
|
-
req(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
67
|
+
req(
|
|
68
|
+
buildPath(apiRoutes.post_api_connectors_connections_connection_id_reconnect.path, {
|
|
69
|
+
connection_id: id,
|
|
70
|
+
}),
|
|
71
|
+
s.reconnectResult,
|
|
72
|
+
{
|
|
73
|
+
method: 'POST',
|
|
74
|
+
body: { enabled_sub_services, return_url },
|
|
75
|
+
},
|
|
76
|
+
),
|
|
37
77
|
patchSubServices: (id: string, enabled_sub_services: string[], return_url?: string) =>
|
|
38
78
|
req(
|
|
39
|
-
|
|
79
|
+
buildPath(apiRoutes.patch_api_connectors_connections_connection_id_sub_services.path, {
|
|
80
|
+
connection_id: id,
|
|
81
|
+
}),
|
|
40
82
|
s.patchSubServicesResult,
|
|
41
83
|
{
|
|
42
84
|
method: 'PATCH',
|
|
43
85
|
body: { enabled_sub_services, return_url },
|
|
44
86
|
},
|
|
45
87
|
),
|
|
46
|
-
|
|
47
|
-
|
|
88
|
+
// `iss` is the redirect's issuer parameter, sent when the redirect carried one.
|
|
89
|
+
completeOAuth: (state: string, code: string, error?: string, iss?: string) =>
|
|
90
|
+
req(apiRoutes.post_api_connectors_oauth_complete.path, s.oauthCompleteResult, {
|
|
91
|
+
method: 'POST',
|
|
92
|
+
body: { state, code, error, iss },
|
|
93
|
+
}),
|
|
94
|
+
...providerSetupClient(t),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** The provider-setup calls: look a server up, add it, set its sign-in client, remove it. */
|
|
99
|
+
function providerSetupClient(t: Transport) {
|
|
100
|
+
const { req } = t;
|
|
101
|
+
return {
|
|
102
|
+
discoverServer: (target: DiscoverServerTarget) =>
|
|
103
|
+
req(apiRoutes.post_api_connectors_providers_discover.path, s.discoveredServer, {
|
|
104
|
+
method: 'POST',
|
|
105
|
+
body: 'url' in target ? { url: target.url } : { provider_id: target.providerId },
|
|
106
|
+
}),
|
|
107
|
+
addServer: (args: AddServerArgs) =>
|
|
108
|
+
req(apiRoutes.post_api_connectors_providers.path, s.providerMutationResult, {
|
|
48
109
|
method: 'POST',
|
|
49
|
-
body:
|
|
110
|
+
body: args,
|
|
50
111
|
}),
|
|
112
|
+
removeProvider: (id: string) =>
|
|
113
|
+
req(
|
|
114
|
+
buildPath(apiRoutes.delete_api_connectors_providers_provider_id.path, { provider_id: id }),
|
|
115
|
+
s.removeProviderResult,
|
|
116
|
+
{ method: 'DELETE' },
|
|
117
|
+
),
|
|
118
|
+
setProviderClient: (id: string, args: SetProviderClientArgs) =>
|
|
119
|
+
req(
|
|
120
|
+
buildPath(apiRoutes.put_api_connectors_providers_provider_id_client.path, {
|
|
121
|
+
provider_id: id,
|
|
122
|
+
}),
|
|
123
|
+
s.providerMutationResult,
|
|
124
|
+
{ method: 'PUT', body: args },
|
|
125
|
+
),
|
|
51
126
|
};
|
|
52
127
|
}
|