botshield-sdk 2.1.0 → 2.2.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 (218) hide show
  1. package/README.md +14 -9
  2. package/bin/mcp-server.js +433 -68
  3. package/bin/mcp-server.js.map +22 -18
  4. package/dist/commonjs/funcs/actions-propose-action.d.ts +1 -1
  5. package/dist/commonjs/funcs/actions-propose-action.js +1 -1
  6. package/dist/commonjs/funcs/census-get-partner-config.d.ts +18 -0
  7. package/dist/commonjs/funcs/census-get-partner-config.d.ts.map +1 -0
  8. package/dist/commonjs/funcs/census-get-partner-config.js +134 -0
  9. package/dist/commonjs/funcs/census-get-partner-config.js.map +1 -0
  10. package/dist/commonjs/funcs/census-verify-token.js +0 -12
  11. package/dist/commonjs/funcs/census-verify-token.js.map +1 -1
  12. package/dist/commonjs/funcs/secured-accounts-get-status.d.ts +18 -0
  13. package/dist/commonjs/funcs/secured-accounts-get-status.d.ts.map +1 -0
  14. package/dist/commonjs/funcs/secured-accounts-get-status.js +126 -0
  15. package/dist/commonjs/funcs/secured-accounts-get-status.js.map +1 -0
  16. package/dist/commonjs/funcs/secured-accounts-list.d.ts +18 -0
  17. package/dist/commonjs/funcs/secured-accounts-list.d.ts.map +1 -0
  18. package/dist/commonjs/funcs/secured-accounts-list.js +129 -0
  19. package/dist/commonjs/funcs/secured-accounts-list.js.map +1 -0
  20. package/dist/commonjs/funcs/secured-accounts-revoke.d.ts +18 -0
  21. package/dist/commonjs/funcs/secured-accounts-revoke.d.ts.map +1 -0
  22. package/dist/commonjs/funcs/secured-accounts-revoke.js +123 -0
  23. package/dist/commonjs/funcs/secured-accounts-revoke.js.map +1 -0
  24. package/dist/commonjs/funcs/verification-get-status.js +0 -12
  25. package/dist/commonjs/funcs/verification-get-status.js.map +1 -1
  26. package/dist/commonjs/lib/config.d.ts +2 -2
  27. package/dist/commonjs/lib/config.js +2 -2
  28. package/dist/commonjs/lib/security.d.ts.map +1 -1
  29. package/dist/commonjs/lib/security.js +0 -14
  30. package/dist/commonjs/lib/security.js.map +1 -1
  31. package/dist/commonjs/mcp-server/cli/start/command.d.ts.map +1 -1
  32. package/dist/commonjs/mcp-server/cli/start/command.js +0 -16
  33. package/dist/commonjs/mcp-server/cli/start/command.js.map +1 -1
  34. package/dist/commonjs/mcp-server/cli/start/impl.d.ts +0 -2
  35. package/dist/commonjs/mcp-server/cli/start/impl.d.ts.map +1 -1
  36. package/dist/commonjs/mcp-server/cli/start/impl.js +0 -4
  37. package/dist/commonjs/mcp-server/cli/start/impl.js.map +1 -1
  38. package/dist/commonjs/mcp-server/mcp-server.js +1 -1
  39. package/dist/commonjs/mcp-server/server.js +1 -1
  40. package/dist/commonjs/mcp-server/tools/actions-cancel-action.js +1 -1
  41. package/dist/commonjs/mcp-server/tools/actions-cancel-action.js.map +1 -1
  42. package/dist/commonjs/mcp-server/tools/actions-check-action-status.js +1 -1
  43. package/dist/commonjs/mcp-server/tools/actions-check-action-status.js.map +1 -1
  44. package/dist/commonjs/mcp-server/tools/actions-propose-action.js +1 -1
  45. package/dist/commonjs/mcp-server/tools/actions-propose-action.js.map +1 -1
  46. package/dist/commonjs/models/operations/index.d.ts +4 -0
  47. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  48. package/dist/commonjs/models/operations/index.js +4 -0
  49. package/dist/commonjs/models/operations/index.js.map +1 -1
  50. package/dist/commonjs/models/operations/sdk-create-session.d.ts +5 -5
  51. package/dist/commonjs/models/operations/sdk-create-session.d.ts.map +1 -1
  52. package/dist/commonjs/models/operations/sdk-create-session.js +6 -6
  53. package/dist/commonjs/models/operations/sdk-create-session.js.map +1 -1
  54. package/dist/commonjs/models/operations/sdk-get-partner-config.d.ts +148 -0
  55. package/dist/commonjs/models/operations/sdk-get-partner-config.d.ts.map +1 -0
  56. package/dist/commonjs/models/operations/sdk-get-partner-config.js +197 -0
  57. package/dist/commonjs/models/operations/sdk-get-partner-config.js.map +1 -0
  58. package/dist/commonjs/models/operations/sdk-verify-token.d.ts +0 -4
  59. package/dist/commonjs/models/operations/sdk-verify-token.d.ts.map +1 -1
  60. package/dist/commonjs/models/operations/sdk-verify-token.js +0 -4
  61. package/dist/commonjs/models/operations/sdk-verify-token.js.map +1 -1
  62. package/dist/commonjs/models/operations/secured-accounts-list.d.ts +212 -0
  63. package/dist/commonjs/models/operations/secured-accounts-list.d.ts.map +1 -0
  64. package/dist/commonjs/models/operations/secured-accounts-list.js +254 -0
  65. package/dist/commonjs/models/operations/secured-accounts-list.js.map +1 -0
  66. package/dist/commonjs/models/operations/secured-accounts-revoke.d.ts +130 -0
  67. package/dist/commonjs/models/operations/secured-accounts-revoke.d.ts.map +1 -0
  68. package/dist/commonjs/models/operations/secured-accounts-revoke.js +185 -0
  69. package/dist/commonjs/models/operations/secured-accounts-revoke.js.map +1 -0
  70. package/dist/commonjs/models/operations/secured-accounts-status.d.ts +97 -0
  71. package/dist/commonjs/models/operations/secured-accounts-status.d.ts.map +1 -0
  72. package/dist/commonjs/models/operations/secured-accounts-status.js +163 -0
  73. package/dist/commonjs/models/operations/secured-accounts-status.js.map +1 -0
  74. package/dist/commonjs/models/operations/verification-get-status.d.ts +0 -4
  75. package/dist/commonjs/models/operations/verification-get-status.d.ts.map +1 -1
  76. package/dist/commonjs/models/operations/verification-get-status.js +0 -4
  77. package/dist/commonjs/models/operations/verification-get-status.js.map +1 -1
  78. package/dist/commonjs/models/security.d.ts +0 -4
  79. package/dist/commonjs/models/security.d.ts.map +1 -1
  80. package/dist/commonjs/models/security.js +0 -4
  81. package/dist/commonjs/models/security.js.map +1 -1
  82. package/dist/commonjs/sdk/actions.d.ts +1 -1
  83. package/dist/commonjs/sdk/actions.js +1 -1
  84. package/dist/commonjs/sdk/census.d.ts +7 -0
  85. package/dist/commonjs/sdk/census.d.ts.map +1 -1
  86. package/dist/commonjs/sdk/census.js +10 -0
  87. package/dist/commonjs/sdk/census.js.map +1 -1
  88. package/dist/commonjs/sdk/sdk.d.ts +3 -0
  89. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  90. package/dist/commonjs/sdk/sdk.js +5 -0
  91. package/dist/commonjs/sdk/sdk.js.map +1 -1
  92. package/dist/commonjs/sdk/secured-accounts.d.ts +26 -0
  93. package/dist/commonjs/sdk/secured-accounts.d.ts.map +1 -0
  94. package/dist/commonjs/sdk/secured-accounts.js +42 -0
  95. package/dist/commonjs/sdk/secured-accounts.js.map +1 -0
  96. package/dist/esm/funcs/actions-propose-action.d.ts +1 -1
  97. package/dist/esm/funcs/actions-propose-action.js +1 -1
  98. package/dist/esm/funcs/census-get-partner-config.d.ts +18 -0
  99. package/dist/esm/funcs/census-get-partner-config.d.ts.map +1 -0
  100. package/dist/esm/funcs/census-get-partner-config.js +98 -0
  101. package/dist/esm/funcs/census-get-partner-config.js.map +1 -0
  102. package/dist/esm/funcs/census-verify-token.js +0 -12
  103. package/dist/esm/funcs/census-verify-token.js.map +1 -1
  104. package/dist/esm/funcs/secured-accounts-get-status.d.ts +18 -0
  105. package/dist/esm/funcs/secured-accounts-get-status.d.ts.map +1 -0
  106. package/dist/esm/funcs/secured-accounts-get-status.js +90 -0
  107. package/dist/esm/funcs/secured-accounts-get-status.js.map +1 -0
  108. package/dist/esm/funcs/secured-accounts-list.d.ts +18 -0
  109. package/dist/esm/funcs/secured-accounts-list.d.ts.map +1 -0
  110. package/dist/esm/funcs/secured-accounts-list.js +93 -0
  111. package/dist/esm/funcs/secured-accounts-list.js.map +1 -0
  112. package/dist/esm/funcs/secured-accounts-revoke.d.ts +18 -0
  113. package/dist/esm/funcs/secured-accounts-revoke.d.ts.map +1 -0
  114. package/dist/esm/funcs/secured-accounts-revoke.js +87 -0
  115. package/dist/esm/funcs/secured-accounts-revoke.js.map +1 -0
  116. package/dist/esm/funcs/verification-get-status.js +0 -12
  117. package/dist/esm/funcs/verification-get-status.js.map +1 -1
  118. package/dist/esm/lib/config.d.ts +2 -2
  119. package/dist/esm/lib/config.js +2 -2
  120. package/dist/esm/lib/security.d.ts.map +1 -1
  121. package/dist/esm/lib/security.js +0 -14
  122. package/dist/esm/lib/security.js.map +1 -1
  123. package/dist/esm/mcp-server/cli/start/command.d.ts.map +1 -1
  124. package/dist/esm/mcp-server/cli/start/command.js +0 -16
  125. package/dist/esm/mcp-server/cli/start/command.js.map +1 -1
  126. package/dist/esm/mcp-server/cli/start/impl.d.ts +0 -2
  127. package/dist/esm/mcp-server/cli/start/impl.d.ts.map +1 -1
  128. package/dist/esm/mcp-server/cli/start/impl.js +0 -4
  129. package/dist/esm/mcp-server/cli/start/impl.js.map +1 -1
  130. package/dist/esm/mcp-server/mcp-server.js +1 -1
  131. package/dist/esm/mcp-server/server.js +1 -1
  132. package/dist/esm/mcp-server/tools/actions-cancel-action.js +1 -1
  133. package/dist/esm/mcp-server/tools/actions-cancel-action.js.map +1 -1
  134. package/dist/esm/mcp-server/tools/actions-check-action-status.js +1 -1
  135. package/dist/esm/mcp-server/tools/actions-check-action-status.js.map +1 -1
  136. package/dist/esm/mcp-server/tools/actions-propose-action.js +1 -1
  137. package/dist/esm/mcp-server/tools/actions-propose-action.js.map +1 -1
  138. package/dist/esm/models/operations/index.d.ts +4 -0
  139. package/dist/esm/models/operations/index.d.ts.map +1 -1
  140. package/dist/esm/models/operations/index.js +4 -0
  141. package/dist/esm/models/operations/index.js.map +1 -1
  142. package/dist/esm/models/operations/sdk-create-session.d.ts +5 -5
  143. package/dist/esm/models/operations/sdk-create-session.d.ts.map +1 -1
  144. package/dist/esm/models/operations/sdk-create-session.js +5 -5
  145. package/dist/esm/models/operations/sdk-create-session.js.map +1 -1
  146. package/dist/esm/models/operations/sdk-get-partner-config.d.ts +148 -0
  147. package/dist/esm/models/operations/sdk-get-partner-config.d.ts.map +1 -0
  148. package/dist/esm/models/operations/sdk-get-partner-config.js +149 -0
  149. package/dist/esm/models/operations/sdk-get-partner-config.js.map +1 -0
  150. package/dist/esm/models/operations/sdk-verify-token.d.ts +0 -4
  151. package/dist/esm/models/operations/sdk-verify-token.d.ts.map +1 -1
  152. package/dist/esm/models/operations/sdk-verify-token.js +0 -4
  153. package/dist/esm/models/operations/sdk-verify-token.js.map +1 -1
  154. package/dist/esm/models/operations/secured-accounts-list.d.ts +212 -0
  155. package/dist/esm/models/operations/secured-accounts-list.d.ts.map +1 -0
  156. package/dist/esm/models/operations/secured-accounts-list.js +206 -0
  157. package/dist/esm/models/operations/secured-accounts-list.js.map +1 -0
  158. package/dist/esm/models/operations/secured-accounts-revoke.d.ts +130 -0
  159. package/dist/esm/models/operations/secured-accounts-revoke.d.ts.map +1 -0
  160. package/dist/esm/models/operations/secured-accounts-revoke.js +139 -0
  161. package/dist/esm/models/operations/secured-accounts-revoke.js.map +1 -0
  162. package/dist/esm/models/operations/secured-accounts-status.d.ts +97 -0
  163. package/dist/esm/models/operations/secured-accounts-status.d.ts.map +1 -0
  164. package/dist/esm/models/operations/secured-accounts-status.js +117 -0
  165. package/dist/esm/models/operations/secured-accounts-status.js.map +1 -0
  166. package/dist/esm/models/operations/verification-get-status.d.ts +0 -4
  167. package/dist/esm/models/operations/verification-get-status.d.ts.map +1 -1
  168. package/dist/esm/models/operations/verification-get-status.js +0 -4
  169. package/dist/esm/models/operations/verification-get-status.js.map +1 -1
  170. package/dist/esm/models/security.d.ts +0 -4
  171. package/dist/esm/models/security.d.ts.map +1 -1
  172. package/dist/esm/models/security.js +0 -4
  173. package/dist/esm/models/security.js.map +1 -1
  174. package/dist/esm/sdk/actions.d.ts +1 -1
  175. package/dist/esm/sdk/actions.js +1 -1
  176. package/dist/esm/sdk/census.d.ts +7 -0
  177. package/dist/esm/sdk/census.d.ts.map +1 -1
  178. package/dist/esm/sdk/census.js +10 -0
  179. package/dist/esm/sdk/census.js.map +1 -1
  180. package/dist/esm/sdk/sdk.d.ts +3 -0
  181. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  182. package/dist/esm/sdk/sdk.js +5 -0
  183. package/dist/esm/sdk/sdk.js.map +1 -1
  184. package/dist/esm/sdk/secured-accounts.d.ts +26 -0
  185. package/dist/esm/sdk/secured-accounts.d.ts.map +1 -0
  186. package/dist/esm/sdk/secured-accounts.js +38 -0
  187. package/dist/esm/sdk/secured-accounts.js.map +1 -0
  188. package/jsr.json +1 -1
  189. package/package.json +1 -1
  190. package/src/funcs/actions-propose-action.ts +1 -1
  191. package/src/funcs/census-get-partner-config.ts +198 -0
  192. package/src/funcs/census-verify-token.ts +0 -14
  193. package/src/funcs/secured-accounts-get-status.ts +189 -0
  194. package/src/funcs/secured-accounts-list.ts +194 -0
  195. package/src/funcs/secured-accounts-revoke.ts +185 -0
  196. package/src/funcs/verification-get-status.ts +0 -14
  197. package/src/lib/config.ts +2 -2
  198. package/src/lib/security.ts +0 -14
  199. package/src/mcp-server/cli/start/command.ts +0 -16
  200. package/src/mcp-server/cli/start/impl.ts +0 -6
  201. package/src/mcp-server/mcp-server.ts +1 -1
  202. package/src/mcp-server/server.ts +1 -1
  203. package/src/mcp-server/tools/actions-cancel-action.ts +1 -1
  204. package/src/mcp-server/tools/actions-check-action-status.ts +1 -1
  205. package/src/mcp-server/tools/actions-propose-action.ts +1 -1
  206. package/src/models/operations/index.ts +4 -0
  207. package/src/models/operations/sdk-create-session.ts +13 -11
  208. package/src/models/operations/sdk-get-partner-config.ts +385 -0
  209. package/src/models/operations/sdk-verify-token.ts +0 -8
  210. package/src/models/operations/secured-accounts-list.ts +507 -0
  211. package/src/models/operations/secured-accounts-revoke.ts +359 -0
  212. package/src/models/operations/secured-accounts-status.ts +296 -0
  213. package/src/models/operations/verification-get-status.ts +0 -8
  214. package/src/models/security.ts +0 -8
  215. package/src/sdk/actions.ts +1 -1
  216. package/src/sdk/census.ts +20 -0
  217. package/src/sdk/sdk.ts +6 -0
  218. package/src/sdk/secured-accounts.ts +69 -0
@@ -0,0 +1,194 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { BotShieldCore } from "../core.js";
6
+ import { encodeFormQuery } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { resolveSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import { BotShieldError } from "../models/errors/bot-shield-error.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/http-client-errors.js";
22
+ import * as errors from "../models/errors/index.js";
23
+ import { ResponseValidationError } from "../models/errors/response-validation-error.js";
24
+ import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * List Secured Accounts
31
+ *
32
+ * @remarks
33
+ * Your Secured Accounts, newest first. Filter to one account with `platform_user_ref` (exact match) or by `status`. Rows carry the handle and binding facts — never your ref or anything that identifies the person. The environment is your API key's: a `bs_dev_…` key sees and changes development Secured Accounts only, a `bs_prod_…` key production only. Server API keys only — site keys (`pk_…`) are refused.
34
+ */
35
+ export function securedAccountsList(
36
+ client: BotShieldCore,
37
+ security: operations.SecuredAccountsListSecurity,
38
+ request?: operations.SecuredAccountsListRequest | undefined,
39
+ options?: RequestOptions,
40
+ ): APIPromise<
41
+ Result<
42
+ operations.SecuredAccountsListResponse,
43
+ | errors.InvalidInputError
44
+ | errors.ErrorResponse
45
+ | BotShieldError
46
+ | ResponseValidationError
47
+ | ConnectionError
48
+ | RequestAbortedError
49
+ | RequestTimeoutError
50
+ | InvalidRequestError
51
+ | UnexpectedClientError
52
+ | SDKValidationError
53
+ >
54
+ > {
55
+ return new APIPromise($do(
56
+ client,
57
+ security,
58
+ request,
59
+ options,
60
+ ));
61
+ }
62
+
63
+ async function $do(
64
+ client: BotShieldCore,
65
+ security: operations.SecuredAccountsListSecurity,
66
+ request?: operations.SecuredAccountsListRequest | undefined,
67
+ options?: RequestOptions,
68
+ ): Promise<
69
+ [
70
+ Result<
71
+ operations.SecuredAccountsListResponse,
72
+ | errors.InvalidInputError
73
+ | errors.ErrorResponse
74
+ | BotShieldError
75
+ | ResponseValidationError
76
+ | ConnectionError
77
+ | RequestAbortedError
78
+ | RequestTimeoutError
79
+ | InvalidRequestError
80
+ | UnexpectedClientError
81
+ | SDKValidationError
82
+ >,
83
+ APICall,
84
+ ]
85
+ > {
86
+ const parsed = safeParse(
87
+ request,
88
+ (value) =>
89
+ operations.SecuredAccountsListRequest$outboundSchema.optional().parse(
90
+ value,
91
+ ),
92
+ "Input validation failed",
93
+ );
94
+ if (!parsed.ok) {
95
+ return [parsed, { status: "invalid" }];
96
+ }
97
+ const payload = parsed.value;
98
+ const body = null;
99
+
100
+ const path = pathToFunc("/secured-accounts/list")();
101
+
102
+ const query = encodeFormQuery({
103
+ "limit": payload?.limit,
104
+ "offset": payload?.offset,
105
+ "platform_user_ref": payload?.platform_user_ref,
106
+ "status": payload?.status,
107
+ });
108
+
109
+ const headers = new Headers(compactMap({
110
+ Accept: "application/json",
111
+ }));
112
+
113
+ const requestSecurity = resolveSecurity(
114
+ [
115
+ {
116
+ fieldName: "Authorization",
117
+ type: "apiKey:header",
118
+ value: security?.apiKeyAuth,
119
+ },
120
+ ],
121
+ );
122
+
123
+ const context = {
124
+ options: client._options,
125
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
126
+ operationID: "SecuredAccountsList",
127
+ oAuth2Scopes: null,
128
+
129
+ resolvedSecurity: requestSecurity,
130
+
131
+ securitySource: security,
132
+ retryConfig: options?.retries
133
+ || client._options.retryConfig
134
+ || { strategy: "none" },
135
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
136
+ };
137
+
138
+ const requestRes = client._createRequest(context, {
139
+ security: requestSecurity,
140
+ method: "GET",
141
+ baseURL: options?.serverURL,
142
+ path: path,
143
+ headers: headers,
144
+ query: query,
145
+ body: body,
146
+ userAgent: client._options.userAgent,
147
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
148
+ }, options);
149
+ if (!requestRes.ok) {
150
+ return [requestRes, { status: "invalid" }];
151
+ }
152
+ const req = requestRes.value;
153
+
154
+ const doResult = await client._do(req, {
155
+ context,
156
+ isErrorStatusCode: (statusCode: number) =>
157
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
158
+ retryConfig: context.retryConfig,
159
+ retryCodes: context.retryCodes,
160
+ });
161
+ if (!doResult.ok) {
162
+ return [doResult, { status: "request-error", request: req }];
163
+ }
164
+ const response = doResult.value;
165
+
166
+ const responseFields = {
167
+ HttpMeta: { Response: response, Request: req },
168
+ };
169
+
170
+ const [result] = await M.match<
171
+ operations.SecuredAccountsListResponse,
172
+ | errors.InvalidInputError
173
+ | errors.ErrorResponse
174
+ | BotShieldError
175
+ | ResponseValidationError
176
+ | ConnectionError
177
+ | RequestAbortedError
178
+ | RequestTimeoutError
179
+ | InvalidRequestError
180
+ | UnexpectedClientError
181
+ | SDKValidationError
182
+ >(
183
+ M.json(200, operations.SecuredAccountsListResponse$inboundSchema),
184
+ M.jsonErr(400, errors.InvalidInputError$inboundSchema),
185
+ M.jsonErr(500, errors.ErrorResponse$inboundSchema),
186
+ M.fail("4XX"),
187
+ M.fail("5XX"),
188
+ )(response, req, { extraFields: responseFields });
189
+ if (!result.ok) {
190
+ return [result, { status: "complete", request: req, response }];
191
+ }
192
+
193
+ return [result, { status: "complete", request: req, response }];
194
+ }
@@ -0,0 +1,185 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { BotShieldCore } from "../core.js";
6
+ import { encodeJSON } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { resolveSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import { BotShieldError } from "../models/errors/bot-shield-error.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/http-client-errors.js";
22
+ import * as errors from "../models/errors/index.js";
23
+ import { ResponseValidationError } from "../models/errors/response-validation-error.js";
24
+ import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Revoke a Secured Account
31
+ *
32
+ * @remarks
33
+ * End a Secured Account from your server. Send `reason: 'credential_changed'` when a primary sign-in detail changed on your side (password reset, email change, …) — the Secured Accounts spec requires it; the person's app then shows the account as Unlinked with a Re-link action. Your company's agents for that person are revoked with it, `account.unlinked { handle, by: 'platform', unlinked_at, reason, surface_id }` is sent to your webhook endpoints, live widgets for the account update at once, and the person is told. The next passkey ceremony on that account secures it again from scratch. Idempotent: an account that is not secured (or already unlinked) returns `revoked: false`. Select it by `platform_user_ref` or by `handle` — exactly one. The environment is your API key's: a `bs_dev_…` key sees and changes development Secured Accounts only, a `bs_prod_…` key production only. Server API keys only — site keys (`pk_…`) are refused.
34
+ */
35
+ export function securedAccountsRevoke(
36
+ client: BotShieldCore,
37
+ security: operations.SecuredAccountsRevokeSecurity,
38
+ request: operations.SecuredAccountsRevokeRequest,
39
+ options?: RequestOptions,
40
+ ): APIPromise<
41
+ Result<
42
+ operations.SecuredAccountsRevokeResponse,
43
+ | errors.InvalidInputError
44
+ | errors.ErrorResponse
45
+ | BotShieldError
46
+ | ResponseValidationError
47
+ | ConnectionError
48
+ | RequestAbortedError
49
+ | RequestTimeoutError
50
+ | InvalidRequestError
51
+ | UnexpectedClientError
52
+ | SDKValidationError
53
+ >
54
+ > {
55
+ return new APIPromise($do(
56
+ client,
57
+ security,
58
+ request,
59
+ options,
60
+ ));
61
+ }
62
+
63
+ async function $do(
64
+ client: BotShieldCore,
65
+ security: operations.SecuredAccountsRevokeSecurity,
66
+ request: operations.SecuredAccountsRevokeRequest,
67
+ options?: RequestOptions,
68
+ ): Promise<
69
+ [
70
+ Result<
71
+ operations.SecuredAccountsRevokeResponse,
72
+ | errors.InvalidInputError
73
+ | errors.ErrorResponse
74
+ | BotShieldError
75
+ | ResponseValidationError
76
+ | ConnectionError
77
+ | RequestAbortedError
78
+ | RequestTimeoutError
79
+ | InvalidRequestError
80
+ | UnexpectedClientError
81
+ | SDKValidationError
82
+ >,
83
+ APICall,
84
+ ]
85
+ > {
86
+ const parsed = safeParse(
87
+ request,
88
+ (value) =>
89
+ operations.SecuredAccountsRevokeRequest$outboundSchema.parse(value),
90
+ "Input validation failed",
91
+ );
92
+ if (!parsed.ok) {
93
+ return [parsed, { status: "invalid" }];
94
+ }
95
+ const payload = parsed.value;
96
+ const body = encodeJSON("body", payload, { explode: true });
97
+
98
+ const path = pathToFunc("/secured-accounts/revoke")();
99
+
100
+ const headers = new Headers(compactMap({
101
+ "Content-Type": "application/json",
102
+ Accept: "application/json",
103
+ }));
104
+
105
+ const requestSecurity = resolveSecurity(
106
+ [
107
+ {
108
+ fieldName: "Authorization",
109
+ type: "apiKey:header",
110
+ value: security?.apiKeyAuth,
111
+ },
112
+ ],
113
+ );
114
+
115
+ const context = {
116
+ options: client._options,
117
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
118
+ operationID: "SecuredAccountsRevoke",
119
+ oAuth2Scopes: null,
120
+
121
+ resolvedSecurity: requestSecurity,
122
+
123
+ securitySource: security,
124
+ retryConfig: options?.retries
125
+ || client._options.retryConfig
126
+ || { strategy: "none" },
127
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
128
+ };
129
+
130
+ const requestRes = client._createRequest(context, {
131
+ security: requestSecurity,
132
+ method: "POST",
133
+ baseURL: options?.serverURL,
134
+ path: path,
135
+ headers: headers,
136
+ body: body,
137
+ userAgent: client._options.userAgent,
138
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
139
+ }, options);
140
+ if (!requestRes.ok) {
141
+ return [requestRes, { status: "invalid" }];
142
+ }
143
+ const req = requestRes.value;
144
+
145
+ const doResult = await client._do(req, {
146
+ context,
147
+ isErrorStatusCode: (statusCode: number) =>
148
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
149
+ retryConfig: context.retryConfig,
150
+ retryCodes: context.retryCodes,
151
+ });
152
+ if (!doResult.ok) {
153
+ return [doResult, { status: "request-error", request: req }];
154
+ }
155
+ const response = doResult.value;
156
+
157
+ const responseFields = {
158
+ HttpMeta: { Response: response, Request: req },
159
+ };
160
+
161
+ const [result] = await M.match<
162
+ operations.SecuredAccountsRevokeResponse,
163
+ | errors.InvalidInputError
164
+ | errors.ErrorResponse
165
+ | BotShieldError
166
+ | ResponseValidationError
167
+ | ConnectionError
168
+ | RequestAbortedError
169
+ | RequestTimeoutError
170
+ | InvalidRequestError
171
+ | UnexpectedClientError
172
+ | SDKValidationError
173
+ >(
174
+ M.json(200, operations.SecuredAccountsRevokeResponse$inboundSchema),
175
+ M.jsonErr(400, errors.InvalidInputError$inboundSchema),
176
+ M.jsonErr(500, errors.ErrorResponse$inboundSchema),
177
+ M.fail("4XX"),
178
+ M.fail("5XX"),
179
+ )(response, req, { extraFields: responseFields });
180
+ if (!result.ok) {
181
+ return [result, { status: "complete", request: req, response }];
182
+ }
183
+
184
+ return [result, { status: "complete", request: req, response }];
185
+ }
@@ -120,20 +120,6 @@ async function $do(
120
120
  value: security?.apiKeyAuth1,
121
121
  },
122
122
  ],
123
- [
124
- {
125
- fieldName: "Authorization",
126
- type: "apiKey:header",
127
- value: security?.apiKeyAuth2,
128
- },
129
- ],
130
- [
131
- {
132
- fieldName: "Authorization",
133
- type: "apiKey:header",
134
- value: security?.apiKeyAuth3,
135
- },
136
- ],
137
123
  );
138
124
 
139
125
  const context = {
package/src/lib/config.ts CHANGED
@@ -69,7 +69,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
69
69
  export const SDK_METADATA = {
70
70
  language: "typescript",
71
71
  openapiDocVersion: "2.0.0",
72
- sdkVersion: "2.1.0",
72
+ sdkVersion: "2.2.0",
73
73
  genVersion: "2.934.1",
74
- userAgent: "speakeasy-sdk/typescript 2.1.0 2.934.1 2.0.0 botshield-sdk",
74
+ userAgent: "speakeasy-sdk/typescript 2.2.0 2.934.1 2.0.0 botshield-sdk",
75
75
  } as const;
@@ -261,20 +261,6 @@ export function resolveGlobalSecurity(
261
261
  value: security?.agentKeyAuth1,
262
262
  },
263
263
  ],
264
- [
265
- {
266
- fieldName: "Authorization",
267
- type: "apiKey:header",
268
- value: security?.agentKeyAuth2,
269
- },
270
- ],
271
- [
272
- {
273
- fieldName: "Authorization",
274
- type: "apiKey:header",
275
- value: security?.agentKeyAuth3,
276
- },
277
- ],
278
264
  ];
279
265
 
280
266
  if (allowedFields) {
@@ -59,22 +59,6 @@ export const startCommand = buildCommand({
59
59
  return z.string().parse(value);
60
60
  },
61
61
  },
62
- "agent-key-auth2": {
63
- kind: "parsed",
64
- brief: "Sets the agentKeyAuth2 auth field for the API",
65
- optional: true,
66
- parse: (value) => {
67
- return z.string().parse(value);
68
- },
69
- },
70
- "agent-key-auth3": {
71
- kind: "parsed",
72
- brief: "Sets the agentKeyAuth3 auth field for the API",
73
- optional: true,
74
- parse: (value) => {
75
- return z.string().parse(value);
76
- },
77
- },
78
62
  "server-url": {
79
63
  kind: "parsed",
80
64
  brief: "Overrides the default server URL used by the SDK",
@@ -21,8 +21,6 @@ interface StartCommandFlags {
21
21
  readonly scope?: MCPScope[];
22
22
  readonly "agent-key-auth"?: string | undefined;
23
23
  readonly "agent-key-auth1"?: string | undefined;
24
- readonly "agent-key-auth2"?: string | undefined;
25
- readonly "agent-key-auth3"?: string | undefined;
26
24
  readonly "server-url"?: string;
27
25
  readonly "server-index"?: SDKOptions["serverIdx"];
28
26
  readonly "log-level": ConsoleLoggerLevel;
@@ -56,8 +54,6 @@ async function startStdio(flags: StartCommandFlags) {
56
54
  security: {
57
55
  agentKeyAuth: flags["agent-key-auth"] ?? "",
58
56
  agentKeyAuth1: flags["agent-key-auth1"] ?? "",
59
- agentKeyAuth2: flags["agent-key-auth2"] ?? "",
60
- agentKeyAuth3: flags["agent-key-auth3"] ?? "",
61
57
  },
62
58
  serverURL: flags["server-url"],
63
59
  serverIdx: flags["server-index"],
@@ -82,8 +78,6 @@ async function startSSE(flags: StartCommandFlags) {
82
78
  security: {
83
79
  agentKeyAuth: flags["agent-key-auth"] ?? "",
84
80
  agentKeyAuth1: flags["agent-key-auth1"] ?? "",
85
- agentKeyAuth2: flags["agent-key-auth2"] ?? "",
86
- agentKeyAuth3: flags["agent-key-auth3"] ?? "",
87
81
  },
88
82
  serverURL: flags["server-url"],
89
83
  serverIdx: flags["server-index"],
@@ -19,7 +19,7 @@ const routes = buildRouteMap({
19
19
  export const app = buildApplication(routes, {
20
20
  name: "mcp",
21
21
  versionInfo: {
22
- currentVersion: "2.1.0",
22
+ currentVersion: "2.2.0",
23
23
  },
24
24
  });
25
25
 
@@ -27,7 +27,7 @@ export function createMCPServer(deps: {
27
27
  }) {
28
28
  const server = new McpServer({
29
29
  name: "BotShield",
30
- version: "2.1.0",
30
+ version: "2.2.0",
31
31
  });
32
32
 
33
33
  const client = new BotShieldCore({
@@ -14,7 +14,7 @@ export const tool$actionsCancelAction: ToolDefinition<typeof args> = {
14
14
  name: "cancel_resolution",
15
15
  description:
16
16
  `Stand down a queued resolution before the user responds. No-op once terminal; TTL expiry produces no Resolution.`,
17
- scopes: ["queue", "queue", "queue", "queue"],
17
+ scopes: ["queue", "queue"],
18
18
  args,
19
19
  tool: async (client, args, ctx) => {
20
20
  const [result, apiCall] = await actionsCancelAction(
@@ -14,7 +14,7 @@ export const tool$actionsCheckActionStatus: ToolDefinition<typeof args> = {
14
14
  name: "check_resolution_status",
15
15
  description:
16
16
  `Poll a proposed resolution (pass wait_seconds up to 25 to long-poll). Terminal states (approved/denied) carry the signed Proof of Resolution JWT — verify against BotShield's JWKS; the request_id is the JWT jti.`,
17
- scopes: ["queue", "queue", "queue", "queue"],
17
+ scopes: ["queue", "queue"],
18
18
  args,
19
19
  tool: async (client, args, ctx) => {
20
20
  const [result, apiCall] = await actionsCheckActionStatus(
@@ -14,7 +14,7 @@ export const tool$actionsProposeAction: ToolDefinition<typeof args> = {
14
14
  name: "propose_resolution",
15
15
  description:
16
16
  `Propose a human-presence-gated action to a BotShield user (Agents Ask). Returns a card_id immediately; the signed Proof of Resolution arrives async via the agent's registered callback, or poll check_resolution_status.`,
17
- scopes: ["queue", "queue", "queue", "queue"],
17
+ scopes: ["queue", "queue"],
18
18
  args,
19
19
  tool: async (client, args, ctx) => {
20
20
  const [result, apiCall] = await actionsProposeAction(
@@ -7,9 +7,13 @@ export * from "./actions-check-status.js";
7
7
  export * from "./actions-propose.js";
8
8
  export * from "./sdk-create-session.js";
9
9
  export * from "./sdk-create-verification-link.js";
10
+ export * from "./sdk-get-partner-config.js";
10
11
  export * from "./sdk-logout.js";
11
12
  export * from "./sdk-revoke-verification.js";
12
13
  export * from "./sdk-store-signal.js";
13
14
  export * from "./sdk-validate-signal.js";
14
15
  export * from "./sdk-verify-token.js";
16
+ export * from "./secured-accounts-list.js";
17
+ export * from "./secured-accounts-revoke.js";
18
+ export * from "./secured-accounts-status.js";
15
19
  export * from "./verification-get-status.js";
@@ -31,21 +31,23 @@ export type SDKCreateSessionRequest = {
31
31
  /**
32
32
  * Resolved from the credential: API token environment, or site key pk_test_ → development / pk_live_ → production.
33
33
  */
34
- export const Environment = {
34
+ export const SDKCreateSessionEnvironment = {
35
35
  Development: "development",
36
36
  Production: "production",
37
37
  } as const;
38
38
  /**
39
39
  * Resolved from the credential: API token environment, or site key pk_test_ → development / pk_live_ → production.
40
40
  */
41
- export type Environment = OpenEnum<typeof Environment>;
41
+ export type SDKCreateSessionEnvironment = OpenEnum<
42
+ typeof SDKCreateSessionEnvironment
43
+ >;
42
44
 
43
45
  export type SDKCreateSessionOrganization = {
44
46
  id: string;
45
47
  /**
46
48
  * Resolved from the credential: API token environment, or site key pk_test_ → development / pk_live_ → production.
47
49
  */
48
- environment: Environment;
50
+ environment: SDKCreateSessionEnvironment;
49
51
  };
50
52
 
51
53
  /**
@@ -205,17 +207,17 @@ export function sdkCreateSessionRequestFromJSON(
205
207
  }
206
208
 
207
209
  /** @internal */
208
- export const Environment$inboundSchema: z.ZodType<
209
- Environment,
210
+ export const SDKCreateSessionEnvironment$inboundSchema: z.ZodType<
211
+ SDKCreateSessionEnvironment,
210
212
  z.ZodTypeDef,
211
213
  unknown
212
- > = openEnums.inboundSchema(Environment);
214
+ > = openEnums.inboundSchema(SDKCreateSessionEnvironment);
213
215
  /** @internal */
214
- export const Environment$outboundSchema: z.ZodType<
216
+ export const SDKCreateSessionEnvironment$outboundSchema: z.ZodType<
215
217
  string,
216
218
  z.ZodTypeDef,
217
- Environment
218
- > = openEnums.outboundSchema(Environment);
219
+ SDKCreateSessionEnvironment
220
+ > = openEnums.outboundSchema(SDKCreateSessionEnvironment);
219
221
 
220
222
  /** @internal */
221
223
  export const SDKCreateSessionOrganization$inboundSchema: z.ZodType<
@@ -224,7 +226,7 @@ export const SDKCreateSessionOrganization$inboundSchema: z.ZodType<
224
226
  unknown
225
227
  > = z.object({
226
228
  id: types.string(),
227
- environment: Environment$inboundSchema,
229
+ environment: SDKCreateSessionEnvironment$inboundSchema,
228
230
  });
229
231
  /** @internal */
230
232
  export type SDKCreateSessionOrganization$Outbound = {
@@ -239,7 +241,7 @@ export const SDKCreateSessionOrganization$outboundSchema: z.ZodType<
239
241
  SDKCreateSessionOrganization
240
242
  > = z.object({
241
243
  id: z.string(),
242
- environment: Environment$outboundSchema,
244
+ environment: SDKCreateSessionEnvironment$outboundSchema,
243
245
  });
244
246
 
245
247
  export function sdkCreateSessionOrganizationToJSON(