fluidapi 0.0.3

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 (321) hide show
  1. package/FUNCTIONS.md +85 -0
  2. package/README.md +429 -0
  3. package/RUNTIMES.md +48 -0
  4. package/esm/core.d.ts +10 -0
  5. package/esm/core.d.ts.map +1 -0
  6. package/esm/core.js +13 -0
  7. package/esm/core.js.map +1 -0
  8. package/esm/funcs/metadata-get-jwks.d.ts +18 -0
  9. package/esm/funcs/metadata-get-jwks.d.ts.map +1 -0
  10. package/esm/funcs/metadata-get-jwks.js +67 -0
  11. package/esm/funcs/metadata-get-jwks.js.map +1 -0
  12. package/esm/funcs/metadata-health-check.d.ts +15 -0
  13. package/esm/funcs/metadata-health-check.d.ts.map +1 -0
  14. package/esm/funcs/metadata-health-check.js +64 -0
  15. package/esm/funcs/metadata-health-check.js.map +1 -0
  16. package/esm/funcs/tokens-issue-fluid-token.d.ts +25 -0
  17. package/esm/funcs/tokens-issue-fluid-token.d.ts.map +1 -0
  18. package/esm/funcs/tokens-issue-fluid-token.js +87 -0
  19. package/esm/funcs/tokens-issue-fluid-token.js.map +1 -0
  20. package/esm/funcs/tokens-issue-token.d.ts +31 -0
  21. package/esm/funcs/tokens-issue-token.d.ts.map +1 -0
  22. package/esm/funcs/tokens-issue-token.js +93 -0
  23. package/esm/funcs/tokens-issue-token.js.map +1 -0
  24. package/esm/funcs/tokens-issue-user-token.d.ts +37 -0
  25. package/esm/funcs/tokens-issue-user-token.d.ts.map +1 -0
  26. package/esm/funcs/tokens-issue-user-token.js +97 -0
  27. package/esm/funcs/tokens-issue-user-token.js.map +1 -0
  28. package/esm/hooks/hooks.d.ts +25 -0
  29. package/esm/hooks/hooks.d.ts.map +1 -0
  30. package/esm/hooks/hooks.js +82 -0
  31. package/esm/hooks/hooks.js.map +1 -0
  32. package/esm/hooks/index.d.ts +3 -0
  33. package/esm/hooks/index.d.ts.map +1 -0
  34. package/esm/hooks/index.js +6 -0
  35. package/esm/hooks/index.js.map +1 -0
  36. package/esm/hooks/registration.d.ts +3 -0
  37. package/esm/hooks/registration.d.ts.map +1 -0
  38. package/esm/hooks/registration.js +12 -0
  39. package/esm/hooks/registration.js.map +1 -0
  40. package/esm/hooks/types.d.ts +76 -0
  41. package/esm/hooks/types.d.ts.map +1 -0
  42. package/esm/hooks/types.js +5 -0
  43. package/esm/hooks/types.js.map +1 -0
  44. package/esm/index.d.ts +6 -0
  45. package/esm/index.d.ts.map +1 -0
  46. package/esm/index.js +8 -0
  47. package/esm/index.js.map +1 -0
  48. package/esm/lib/base64.d.ts +10 -0
  49. package/esm/lib/base64.d.ts.map +1 -0
  50. package/esm/lib/base64.js +31 -0
  51. package/esm/lib/base64.js.map +1 -0
  52. package/esm/lib/config.d.ts +57 -0
  53. package/esm/lib/config.d.ts.map +1 -0
  54. package/esm/lib/config.js +50 -0
  55. package/esm/lib/config.js.map +1 -0
  56. package/esm/lib/dlv.d.ts +14 -0
  57. package/esm/lib/dlv.d.ts.map +1 -0
  58. package/esm/lib/dlv.js +46 -0
  59. package/esm/lib/dlv.js.map +1 -0
  60. package/esm/lib/encodings.d.ts +53 -0
  61. package/esm/lib/encodings.d.ts.map +1 -0
  62. package/esm/lib/encodings.js +370 -0
  63. package/esm/lib/encodings.js.map +1 -0
  64. package/esm/lib/env.d.ts +14 -0
  65. package/esm/lib/env.d.ts.map +1 -0
  66. package/esm/lib/env.js +43 -0
  67. package/esm/lib/env.js.map +1 -0
  68. package/esm/lib/files.d.ts +13 -0
  69. package/esm/lib/files.d.ts.map +1 -0
  70. package/esm/lib/files.js +73 -0
  71. package/esm/lib/files.js.map +1 -0
  72. package/esm/lib/http.d.ts +67 -0
  73. package/esm/lib/http.d.ts.map +1 -0
  74. package/esm/lib/http.js +209 -0
  75. package/esm/lib/http.js.map +1 -0
  76. package/esm/lib/is-plain-object.d.ts +2 -0
  77. package/esm/lib/is-plain-object.d.ts.map +1 -0
  78. package/esm/lib/is-plain-object.js +38 -0
  79. package/esm/lib/is-plain-object.js.map +1 -0
  80. package/esm/lib/logger.d.ts +6 -0
  81. package/esm/lib/logger.d.ts.map +1 -0
  82. package/esm/lib/logger.js +5 -0
  83. package/esm/lib/logger.js.map +1 -0
  84. package/esm/lib/matchers.d.ts +59 -0
  85. package/esm/lib/matchers.d.ts.map +1 -0
  86. package/esm/lib/matchers.js +202 -0
  87. package/esm/lib/matchers.js.map +1 -0
  88. package/esm/lib/primitives.d.ts +26 -0
  89. package/esm/lib/primitives.d.ts.map +1 -0
  90. package/esm/lib/primitives.js +103 -0
  91. package/esm/lib/primitives.js.map +1 -0
  92. package/esm/lib/retries.d.ts +38 -0
  93. package/esm/lib/retries.d.ts.map +1 -0
  94. package/esm/lib/retries.js +150 -0
  95. package/esm/lib/retries.js.map +1 -0
  96. package/esm/lib/schemas.d.ts +21 -0
  97. package/esm/lib/schemas.d.ts.map +1 -0
  98. package/esm/lib/schemas.js +57 -0
  99. package/esm/lib/schemas.js.map +1 -0
  100. package/esm/lib/sdks.d.ts +63 -0
  101. package/esm/lib/sdks.d.ts.map +1 -0
  102. package/esm/lib/sdks.js +258 -0
  103. package/esm/lib/sdks.js.map +1 -0
  104. package/esm/lib/security.d.ts +80 -0
  105. package/esm/lib/security.d.ts.map +1 -0
  106. package/esm/lib/security.js +122 -0
  107. package/esm/lib/security.js.map +1 -0
  108. package/esm/lib/url.d.ts +5 -0
  109. package/esm/lib/url.d.ts.map +1 -0
  110. package/esm/lib/url.js +22 -0
  111. package/esm/lib/url.js.map +1 -0
  112. package/esm/models/error-response.d.ts +17 -0
  113. package/esm/models/error-response.d.ts.map +1 -0
  114. package/esm/models/error-response.js +15 -0
  115. package/esm/models/error-response.js.map +1 -0
  116. package/esm/models/errors/error-response.d.ts +21 -0
  117. package/esm/models/errors/error-response.d.ts.map +1 -0
  118. package/esm/models/errors/error-response.js +37 -0
  119. package/esm/models/errors/error-response.js.map +1 -0
  120. package/esm/models/errors/fluidapi-default-error.d.ts +10 -0
  121. package/esm/models/errors/fluidapi-default-error.d.ts.map +1 -0
  122. package/esm/models/errors/fluidapi-default-error.js +30 -0
  123. package/esm/models/errors/fluidapi-default-error.js.map +1 -0
  124. package/esm/models/errors/fluidapi-error.d.ts +19 -0
  125. package/esm/models/errors/fluidapi-error.d.ts.map +1 -0
  126. package/esm/models/errors/fluidapi-error.js +26 -0
  127. package/esm/models/errors/fluidapi-error.js.map +1 -0
  128. package/esm/models/errors/http-client-errors.d.ts +44 -0
  129. package/esm/models/errors/http-client-errors.d.ts.map +1 -0
  130. package/esm/models/errors/http-client-errors.js +56 -0
  131. package/esm/models/errors/http-client-errors.js.map +1 -0
  132. package/esm/models/errors/index.d.ts +7 -0
  133. package/esm/models/errors/index.d.ts.map +1 -0
  134. package/esm/models/errors/index.js +10 -0
  135. package/esm/models/errors/index.js.map +1 -0
  136. package/esm/models/errors/response-validation-error.d.ts +26 -0
  137. package/esm/models/errors/response-validation-error.d.ts.map +1 -0
  138. package/esm/models/errors/response-validation-error.js +37 -0
  139. package/esm/models/errors/response-validation-error.js.map +1 -0
  140. package/esm/models/errors/sdk-validation-error.d.ts +21 -0
  141. package/esm/models/errors/sdk-validation-error.d.ts.map +1 -0
  142. package/esm/models/errors/sdk-validation-error.js +52 -0
  143. package/esm/models/errors/sdk-validation-error.js.map +1 -0
  144. package/esm/models/health-response.d.ts +10 -0
  145. package/esm/models/health-response.d.ts.map +1 -0
  146. package/esm/models/health-response.js +14 -0
  147. package/esm/models/health-response.js.map +1 -0
  148. package/esm/models/index.d.ts +8 -0
  149. package/esm/models/index.d.ts.map +1 -0
  150. package/esm/models/index.js +11 -0
  151. package/esm/models/index.js.map +1 -0
  152. package/esm/models/issue-token-request.d.ts +31 -0
  153. package/esm/models/issue-token-request.d.ts.map +1 -0
  154. package/esm/models/issue-token-request.js +27 -0
  155. package/esm/models/issue-token-request.js.map +1 -0
  156. package/esm/models/jwk-set.d.ts +21 -0
  157. package/esm/models/jwk-set.d.ts.map +1 -0
  158. package/esm/models/jwk-set.js +26 -0
  159. package/esm/models/jwk-set.js.map +1 -0
  160. package/esm/models/operations/index.d.ts +4 -0
  161. package/esm/models/operations/index.d.ts.map +1 -0
  162. package/esm/models/operations/index.js +7 -0
  163. package/esm/models/operations/index.js.map +1 -0
  164. package/esm/models/operations/issue-fluid-token.d.ts +15 -0
  165. package/esm/models/operations/issue-fluid-token.d.ts.map +1 -0
  166. package/esm/models/operations/issue-fluid-token.js +16 -0
  167. package/esm/models/operations/issue-fluid-token.js.map +1 -0
  168. package/esm/models/operations/issue-token.d.ts +15 -0
  169. package/esm/models/operations/issue-token.d.ts.map +1 -0
  170. package/esm/models/operations/issue-token.js +16 -0
  171. package/esm/models/operations/issue-token.js.map +1 -0
  172. package/esm/models/operations/issue-user-token.d.ts +15 -0
  173. package/esm/models/operations/issue-user-token.d.ts.map +1 -0
  174. package/esm/models/operations/issue-user-token.js +16 -0
  175. package/esm/models/operations/issue-user-token.js.map +1 -0
  176. package/esm/models/token-data.d.ts +29 -0
  177. package/esm/models/token-data.d.ts.map +1 -0
  178. package/esm/models/token-data.js +30 -0
  179. package/esm/models/token-data.js.map +1 -0
  180. package/esm/models/user-token-data.d.ts +12 -0
  181. package/esm/models/user-token-data.d.ts.map +1 -0
  182. package/esm/models/user-token-data.js +23 -0
  183. package/esm/models/user-token-data.js.map +1 -0
  184. package/esm/models/user-token-request.d.ts +25 -0
  185. package/esm/models/user-token-request.d.ts.map +1 -0
  186. package/esm/models/user-token-request.js +26 -0
  187. package/esm/models/user-token-request.js.map +1 -0
  188. package/esm/sdk/index.d.ts +2 -0
  189. package/esm/sdk/index.d.ts.map +1 -0
  190. package/esm/sdk/index.js +5 -0
  191. package/esm/sdk/index.js.map +1 -0
  192. package/esm/sdk/metadata.d.ts +16 -0
  193. package/esm/sdk/metadata.d.ts.map +1 -0
  194. package/esm/sdk/metadata.js +25 -0
  195. package/esm/sdk/metadata.js.map +1 -0
  196. package/esm/sdk/sdk.d.ts +10 -0
  197. package/esm/sdk/sdk.d.ts.map +1 -0
  198. package/esm/sdk/sdk.js +17 -0
  199. package/esm/sdk/sdk.js.map +1 -0
  200. package/esm/sdk/tokens.d.ts +63 -0
  201. package/esm/sdk/tokens.d.ts.map +1 -0
  202. package/esm/sdk/tokens.js +74 -0
  203. package/esm/sdk/tokens.js.map +1 -0
  204. package/esm/types/async.d.ts +23 -0
  205. package/esm/types/async.d.ts.map +1 -0
  206. package/esm/types/async.js +28 -0
  207. package/esm/types/async.js.map +1 -0
  208. package/esm/types/blobs.d.ts +4 -0
  209. package/esm/types/blobs.d.ts.map +1 -0
  210. package/esm/types/blobs.js +25 -0
  211. package/esm/types/blobs.js.map +1 -0
  212. package/esm/types/const-date-time.d.ts +3 -0
  213. package/esm/types/const-date-time.d.ts.map +1 -0
  214. package/esm/types/const-date-time.js +10 -0
  215. package/esm/types/const-date-time.js.map +1 -0
  216. package/esm/types/default-to-zero-value.d.ts +12 -0
  217. package/esm/types/default-to-zero-value.d.ts.map +1 -0
  218. package/esm/types/default-to-zero-value.js +31 -0
  219. package/esm/types/default-to-zero-value.js.map +1 -0
  220. package/esm/types/enums.d.ts +9 -0
  221. package/esm/types/enums.d.ts.map +1 -0
  222. package/esm/types/enums.js +27 -0
  223. package/esm/types/enums.js.map +1 -0
  224. package/esm/types/fp.d.ts +31 -0
  225. package/esm/types/fp.d.ts.map +1 -0
  226. package/esm/types/fp.js +31 -0
  227. package/esm/types/fp.js.map +1 -0
  228. package/esm/types/index.d.ts +10 -0
  229. package/esm/types/index.d.ts.map +1 -0
  230. package/esm/types/index.js +10 -0
  231. package/esm/types/index.js.map +1 -0
  232. package/esm/types/operations.d.ts +27 -0
  233. package/esm/types/operations.d.ts.map +1 -0
  234. package/esm/types/operations.js +77 -0
  235. package/esm/types/operations.js.map +1 -0
  236. package/esm/types/primitives.d.ts +11 -0
  237. package/esm/types/primitives.d.ts.map +1 -0
  238. package/esm/types/primitives.js +132 -0
  239. package/esm/types/primitives.js.map +1 -0
  240. package/esm/types/rfcdate.d.ts +21 -0
  241. package/esm/types/rfcdate.d.ts.map +1 -0
  242. package/esm/types/rfcdate.js +43 -0
  243. package/esm/types/rfcdate.js.map +1 -0
  244. package/esm/types/smart-union.d.ts +7 -0
  245. package/esm/types/smart-union.d.ts.map +1 -0
  246. package/esm/types/smart-union.js +117 -0
  247. package/esm/types/smart-union.js.map +1 -0
  248. package/esm/types/streams.d.ts +2 -0
  249. package/esm/types/streams.d.ts.map +1 -0
  250. package/esm/types/streams.js +15 -0
  251. package/esm/types/streams.js.map +1 -0
  252. package/esm/types/unrecognized.d.ts +16 -0
  253. package/esm/types/unrecognized.d.ts.map +1 -0
  254. package/esm/types/unrecognized.js +31 -0
  255. package/esm/types/unrecognized.js.map +1 -0
  256. package/examples/metadataHealthCheck.example.ts +24 -0
  257. package/jsr.json +27 -0
  258. package/package.json +62 -0
  259. package/src/core.ts +13 -0
  260. package/src/funcs/metadata-get-jwks.ts +145 -0
  261. package/src/funcs/metadata-health-check.ts +142 -0
  262. package/src/funcs/tokens-issue-fluid-token.ts +175 -0
  263. package/src/funcs/tokens-issue-token.ts +181 -0
  264. package/src/funcs/tokens-issue-user-token.ts +184 -0
  265. package/src/hooks/hooks.ts +132 -0
  266. package/src/hooks/index.ts +6 -0
  267. package/src/hooks/registration.ts +14 -0
  268. package/src/hooks/types.ts +107 -0
  269. package/src/index.ts +9 -0
  270. package/src/lib/base64.ts +39 -0
  271. package/src/lib/config.ts +94 -0
  272. package/src/lib/dlv.ts +53 -0
  273. package/src/lib/encodings.ts +501 -0
  274. package/src/lib/env.ts +53 -0
  275. package/src/lib/files.ts +82 -0
  276. package/src/lib/http.ts +323 -0
  277. package/src/lib/is-plain-object.ts +43 -0
  278. package/src/lib/logger.ts +9 -0
  279. package/src/lib/matchers.ts +353 -0
  280. package/src/lib/primitives.ts +150 -0
  281. package/src/lib/retries.ts +218 -0
  282. package/src/lib/schemas.ts +94 -0
  283. package/src/lib/sdks.ts +406 -0
  284. package/src/lib/security.ts +236 -0
  285. package/src/lib/url.ts +33 -0
  286. package/src/models/error-response.ts +36 -0
  287. package/src/models/errors/error-response.ts +56 -0
  288. package/src/models/errors/fluidapi-default-error.ts +40 -0
  289. package/src/models/errors/fluidapi-error.ts +35 -0
  290. package/src/models/errors/http-client-errors.ts +62 -0
  291. package/src/models/errors/index.ts +10 -0
  292. package/src/models/errors/response-validation-error.ts +50 -0
  293. package/src/models/errors/sdk-validation-error.ts +54 -0
  294. package/src/models/health-response.ts +31 -0
  295. package/src/models/index.ts +11 -0
  296. package/src/models/issue-token-request.ts +66 -0
  297. package/src/models/jwk-set.ts +57 -0
  298. package/src/models/operations/index.ts +7 -0
  299. package/src/models/operations/issue-fluid-token.ts +37 -0
  300. package/src/models/operations/issue-token.ts +37 -0
  301. package/src/models/operations/issue-user-token.ts +37 -0
  302. package/src/models/token-data.ts +65 -0
  303. package/src/models/user-token-data.ts +45 -0
  304. package/src/models/user-token-request.ts +60 -0
  305. package/src/sdk/index.ts +5 -0
  306. package/src/sdk/metadata.ts +38 -0
  307. package/src/sdk/sdk.ts +19 -0
  308. package/src/sdk/tokens.ts +100 -0
  309. package/src/types/async.ts +68 -0
  310. package/src/types/blobs.ts +33 -0
  311. package/src/types/const-date-time.ts +15 -0
  312. package/src/types/default-to-zero-value.ts +33 -0
  313. package/src/types/enums.ts +45 -0
  314. package/src/types/fp.ts +50 -0
  315. package/src/types/index.ts +13 -0
  316. package/src/types/operations.ts +105 -0
  317. package/src/types/primitives.ts +168 -0
  318. package/src/types/rfcdate.ts +54 -0
  319. package/src/types/smart-union.ts +153 -0
  320. package/src/types/streams.ts +21 -0
  321. package/src/types/unrecognized.ts +35 -0
@@ -0,0 +1,66 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../lib/primitives.js";
7
+ import { ClosedEnum } from "../types/enums.js";
8
+
9
+ export const GrantType = {
10
+ ClientCredentials: "client_credentials",
11
+ } as const;
12
+ export type GrantType = ClosedEnum<typeof GrantType>;
13
+
14
+ export type IssueTokenRequest = {
15
+ grantType: GrantType;
16
+ clientId: string;
17
+ clientSecret: string;
18
+ /**
19
+ * Space-separated list of scopes to request. Must be a subset of the
20
+ *
21
+ * @remarks
22
+ * scopes configured for the tenant. Omit to request all available scopes.
23
+ */
24
+ scope?: string | undefined;
25
+ };
26
+
27
+ /** @internal */
28
+ export const GrantType$outboundSchema: z.ZodMiniEnum<typeof GrantType> = z.enum(
29
+ GrantType,
30
+ );
31
+
32
+ /** @internal */
33
+ export type IssueTokenRequest$Outbound = {
34
+ grant_type: string;
35
+ client_id: string;
36
+ client_secret: string;
37
+ scope?: string | undefined;
38
+ };
39
+
40
+ /** @internal */
41
+ export const IssueTokenRequest$outboundSchema: z.ZodMiniType<
42
+ IssueTokenRequest$Outbound,
43
+ IssueTokenRequest
44
+ > = z.pipe(
45
+ z.object({
46
+ grantType: GrantType$outboundSchema,
47
+ clientId: z.string(),
48
+ clientSecret: z.string(),
49
+ scope: z.optional(z.string()),
50
+ }),
51
+ z.transform((v) => {
52
+ return remap$(v, {
53
+ grantType: "grant_type",
54
+ clientId: "client_id",
55
+ clientSecret: "client_secret",
56
+ });
57
+ }),
58
+ );
59
+
60
+ export function issueTokenRequestToJSON(
61
+ issueTokenRequest: IssueTokenRequest,
62
+ ): string {
63
+ return JSON.stringify(
64
+ IssueTokenRequest$outboundSchema.parse(issueTokenRequest),
65
+ );
66
+ }
@@ -0,0 +1,57 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../types/fp.js";
8
+ import * as types from "../types/primitives.js";
9
+ import { SDKValidationError } from "./errors/sdk-validation-error.js";
10
+
11
+ export type Key = {
12
+ kty: string;
13
+ kid: string;
14
+ use: string;
15
+ alg: string;
16
+ n: string;
17
+ e: string;
18
+ };
19
+
20
+ export type JWKSet = {
21
+ keys: Array<Key>;
22
+ };
23
+
24
+ /** @internal */
25
+ export const Key$inboundSchema: z.ZodMiniType<Key, unknown> = z.object({
26
+ kty: types.string(),
27
+ kid: types.string(),
28
+ use: types.string(),
29
+ alg: types.string(),
30
+ n: types.string(),
31
+ e: types.string(),
32
+ });
33
+
34
+ export function keyFromJSON(
35
+ jsonString: string,
36
+ ): SafeParseResult<Key, SDKValidationError> {
37
+ return safeParse(
38
+ jsonString,
39
+ (x) => Key$inboundSchema.parse(JSON.parse(x)),
40
+ `Failed to parse 'Key' from JSON`,
41
+ );
42
+ }
43
+
44
+ /** @internal */
45
+ export const JWKSet$inboundSchema: z.ZodMiniType<JWKSet, unknown> = z.object({
46
+ keys: z.array(z.lazy(() => Key$inboundSchema)),
47
+ });
48
+
49
+ export function jwkSetFromJSON(
50
+ jsonString: string,
51
+ ): SafeParseResult<JWKSet, SDKValidationError> {
52
+ return safeParse(
53
+ jsonString,
54
+ (x) => JWKSet$inboundSchema.parse(JSON.parse(x)),
55
+ `Failed to parse 'JWKSet' from JSON`,
56
+ );
57
+ }
@@ -0,0 +1,7 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ export * from "./issue-fluid-token.js";
6
+ export * from "./issue-token.js";
7
+ export * from "./issue-user-token.js";
@@ -0,0 +1,37 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../../types/fp.js";
8
+ import * as types from "../../types/primitives.js";
9
+ import { SDKValidationError } from "../errors/sdk-validation-error.js";
10
+ import * as models from "../index.js";
11
+
12
+ /**
13
+ * Fluid-signed M2M token issued
14
+ */
15
+ export type IssueFluidTokenResponse = {
16
+ ok: boolean;
17
+ data?: models.TokenData | undefined;
18
+ };
19
+
20
+ /** @internal */
21
+ export const IssueFluidTokenResponse$inboundSchema: z.ZodMiniType<
22
+ IssueFluidTokenResponse,
23
+ unknown
24
+ > = z.object({
25
+ ok: types.boolean(),
26
+ data: types.optional(models.TokenData$inboundSchema),
27
+ });
28
+
29
+ export function issueFluidTokenResponseFromJSON(
30
+ jsonString: string,
31
+ ): SafeParseResult<IssueFluidTokenResponse, SDKValidationError> {
32
+ return safeParse(
33
+ jsonString,
34
+ (x) => IssueFluidTokenResponse$inboundSchema.parse(JSON.parse(x)),
35
+ `Failed to parse 'IssueFluidTokenResponse' from JSON`,
36
+ );
37
+ }
@@ -0,0 +1,37 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../../types/fp.js";
8
+ import * as types from "../../types/primitives.js";
9
+ import { SDKValidationError } from "../errors/sdk-validation-error.js";
10
+ import * as models from "../index.js";
11
+
12
+ /**
13
+ * Access token issued
14
+ */
15
+ export type IssueTokenResponse = {
16
+ ok: boolean;
17
+ data?: models.TokenData | undefined;
18
+ };
19
+
20
+ /** @internal */
21
+ export const IssueTokenResponse$inboundSchema: z.ZodMiniType<
22
+ IssueTokenResponse,
23
+ unknown
24
+ > = z.object({
25
+ ok: types.boolean(),
26
+ data: types.optional(models.TokenData$inboundSchema),
27
+ });
28
+
29
+ export function issueTokenResponseFromJSON(
30
+ jsonString: string,
31
+ ): SafeParseResult<IssueTokenResponse, SDKValidationError> {
32
+ return safeParse(
33
+ jsonString,
34
+ (x) => IssueTokenResponse$inboundSchema.parse(JSON.parse(x)),
35
+ `Failed to parse 'IssueTokenResponse' from JSON`,
36
+ );
37
+ }
@@ -0,0 +1,37 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../../types/fp.js";
8
+ import * as types from "../../types/primitives.js";
9
+ import { SDKValidationError } from "../errors/sdk-validation-error.js";
10
+ import * as models from "../index.js";
11
+
12
+ /**
13
+ * User token issued
14
+ */
15
+ export type IssueUserTokenResponse = {
16
+ ok: boolean;
17
+ data?: models.UserTokenData | undefined;
18
+ };
19
+
20
+ /** @internal */
21
+ export const IssueUserTokenResponse$inboundSchema: z.ZodMiniType<
22
+ IssueUserTokenResponse,
23
+ unknown
24
+ > = z.object({
25
+ ok: types.boolean(),
26
+ data: types.optional(models.UserTokenData$inboundSchema),
27
+ });
28
+
29
+ export function issueUserTokenResponseFromJSON(
30
+ jsonString: string,
31
+ ): SafeParseResult<IssueUserTokenResponse, SDKValidationError> {
32
+ return safeParse(
33
+ jsonString,
34
+ (x) => IssueUserTokenResponse$inboundSchema.parse(JSON.parse(x)),
35
+ `Failed to parse 'IssueUserTokenResponse' from JSON`,
36
+ );
37
+ }
@@ -0,0 +1,65 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../lib/primitives.js";
7
+ import { safeParse } from "../lib/schemas.js";
8
+ import { ClosedEnum } from "../types/enums.js";
9
+ import { Result as SafeParseResult } from "../types/fp.js";
10
+ import * as types from "../types/primitives.js";
11
+ import { SDKValidationError } from "./errors/sdk-validation-error.js";
12
+
13
+ export const TokenType = {
14
+ Bearer: "bearer",
15
+ } as const;
16
+ export type TokenType = ClosedEnum<typeof TokenType>;
17
+
18
+ export type TokenData = {
19
+ /**
20
+ * JWT access token
21
+ */
22
+ accessToken: string;
23
+ tokenType: TokenType;
24
+ /**
25
+ * Token lifetime in seconds
26
+ */
27
+ expiresIn: number;
28
+ /**
29
+ * Space-separated list of granted scopes
30
+ */
31
+ scope: string;
32
+ };
33
+
34
+ /** @internal */
35
+ export const TokenType$inboundSchema: z.ZodMiniEnum<typeof TokenType> = z.enum(
36
+ TokenType,
37
+ );
38
+
39
+ /** @internal */
40
+ export const TokenData$inboundSchema: z.ZodMiniType<TokenData, unknown> = z
41
+ .pipe(
42
+ z.object({
43
+ access_token: types.string(),
44
+ token_type: TokenType$inboundSchema,
45
+ expires_in: types.number(),
46
+ scope: types.string(),
47
+ }),
48
+ z.transform((v) => {
49
+ return remap$(v, {
50
+ "access_token": "accessToken",
51
+ "token_type": "tokenType",
52
+ "expires_in": "expiresIn",
53
+ });
54
+ }),
55
+ );
56
+
57
+ export function tokenDataFromJSON(
58
+ jsonString: string,
59
+ ): SafeParseResult<TokenData, SDKValidationError> {
60
+ return safeParse(
61
+ jsonString,
62
+ (x) => TokenData$inboundSchema.parse(JSON.parse(x)),
63
+ `Failed to parse 'TokenData' from JSON`,
64
+ );
65
+ }
@@ -0,0 +1,45 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../lib/primitives.js";
7
+ import { safeParse } from "../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../types/fp.js";
9
+ import * as types from "../types/primitives.js";
10
+ import { SDKValidationError } from "./errors/sdk-validation-error.js";
11
+
12
+ export type UserTokenData = {
13
+ accessToken: string;
14
+ tokenType: string;
15
+ expiresIn?: number | undefined;
16
+ };
17
+
18
+ /** @internal */
19
+ export const UserTokenData$inboundSchema: z.ZodMiniType<
20
+ UserTokenData,
21
+ unknown
22
+ > = z.pipe(
23
+ z.object({
24
+ access_token: types.string(),
25
+ token_type: types.string(),
26
+ expires_in: types.optional(types.number()),
27
+ }),
28
+ z.transform((v) => {
29
+ return remap$(v, {
30
+ "access_token": "accessToken",
31
+ "token_type": "tokenType",
32
+ "expires_in": "expiresIn",
33
+ });
34
+ }),
35
+ );
36
+
37
+ export function userTokenDataFromJSON(
38
+ jsonString: string,
39
+ ): SafeParseResult<UserTokenData, SDKValidationError> {
40
+ return safeParse(
41
+ jsonString,
42
+ (x) => UserTokenData$inboundSchema.parse(JSON.parse(x)),
43
+ `Failed to parse 'UserTokenData' from JSON`,
44
+ );
45
+ }
@@ -0,0 +1,60 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { remap as remap$ } from "../lib/primitives.js";
7
+
8
+ export type UserTokenRequest = {
9
+ externalId: string;
10
+ customerExternalId?: string | undefined;
11
+ email?: string | undefined;
12
+ givenName?: string | undefined;
13
+ familyName?: string | undefined;
14
+ /**
15
+ * Optional token lifetime in seconds.
16
+ */
17
+ expiresIn?: number | undefined;
18
+ };
19
+
20
+ /** @internal */
21
+ export type UserTokenRequest$Outbound = {
22
+ external_id: string;
23
+ customer_external_id?: string | undefined;
24
+ email?: string | undefined;
25
+ given_name?: string | undefined;
26
+ family_name?: string | undefined;
27
+ expires_in?: number | undefined;
28
+ };
29
+
30
+ /** @internal */
31
+ export const UserTokenRequest$outboundSchema: z.ZodMiniType<
32
+ UserTokenRequest$Outbound,
33
+ UserTokenRequest
34
+ > = z.pipe(
35
+ z.object({
36
+ externalId: z.string(),
37
+ customerExternalId: z.optional(z.string()),
38
+ email: z.optional(z.string()),
39
+ givenName: z.optional(z.string()),
40
+ familyName: z.optional(z.string()),
41
+ expiresIn: z.optional(z.int()),
42
+ }),
43
+ z.transform((v) => {
44
+ return remap$(v, {
45
+ externalId: "external_id",
46
+ customerExternalId: "customer_external_id",
47
+ givenName: "given_name",
48
+ familyName: "family_name",
49
+ expiresIn: "expires_in",
50
+ });
51
+ }),
52
+ );
53
+
54
+ export function userTokenRequestToJSON(
55
+ userTokenRequest: UserTokenRequest,
56
+ ): string {
57
+ return JSON.stringify(
58
+ UserTokenRequest$outboundSchema.parse(userTokenRequest),
59
+ );
60
+ }
@@ -0,0 +1,5 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ export * from "./sdk.js";
@@ -0,0 +1,38 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { metadataGetJWKS } from "../funcs/metadata-get-jwks.js";
6
+ import { metadataHealthCheck } from "../funcs/metadata-health-check.js";
7
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
8
+ import * as models from "../models/index.js";
9
+ import { unwrapAsync } from "../types/fp.js";
10
+
11
+ export class Metadata extends ClientSDK {
12
+ /**
13
+ * Health check
14
+ */
15
+ async healthCheck(
16
+ options?: RequestOptions,
17
+ ): Promise<models.HealthResponse> {
18
+ return unwrapAsync(metadataHealthCheck(
19
+ this,
20
+ options,
21
+ ));
22
+ }
23
+
24
+ /**
25
+ * Get public signing keys
26
+ *
27
+ * @remarks
28
+ * Returns the JWKS used to validate Fluid-signed JWTs.
29
+ */
30
+ async getJWKS(
31
+ options?: RequestOptions,
32
+ ): Promise<models.JWKSet> {
33
+ return unwrapAsync(metadataGetJWKS(
34
+ this,
35
+ options,
36
+ ));
37
+ }
38
+ }
package/src/sdk/sdk.ts ADDED
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { ClientSDK } from "../lib/sdks.js";
6
+ import { Metadata } from "./metadata.js";
7
+ import { Tokens } from "./tokens.js";
8
+
9
+ export class Fluidapi extends ClientSDK {
10
+ private _metadata?: Metadata;
11
+ get metadata(): Metadata {
12
+ return (this._metadata ??= new Metadata(this._options));
13
+ }
14
+
15
+ private _tokens?: Tokens;
16
+ get tokens(): Tokens {
17
+ return (this._tokens ??= new Tokens(this._options));
18
+ }
19
+ }
@@ -0,0 +1,100 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { tokensIssueFluidToken } from "../funcs/tokens-issue-fluid-token.js";
6
+ import { tokensIssueToken } from "../funcs/tokens-issue-token.js";
7
+ import { tokensIssueUserToken } from "../funcs/tokens-issue-user-token.js";
8
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
9
+ import * as models from "../models/index.js";
10
+ import * as operations from "../models/operations/index.js";
11
+ import { unwrapAsync } from "../types/fp.js";
12
+
13
+ export class Tokens extends ClientSDK {
14
+ /**
15
+ * Issue access token (client_credentials)
16
+ *
17
+ * @remarks
18
+ * Standard OAuth2 token endpoint. Performs a `client_credentials` grant
19
+ * against the Authorization Server and returns the access token (JWT).
20
+ *
21
+ * The OAuth2 client must be registered first via
22
+ * `POST /v1/tenants/{tenant_id}/credentials`.
23
+ *
24
+ * ### Scope reduction
25
+ *
26
+ * By default the token is issued with all scopes configured for the tenant.
27
+ * You can request a subset by passing `scope` in the form body.
28
+ * Requesting a scope not in the tenant's allowlist returns `400 invalid_scope`.
29
+ *
30
+ * **Available scopes:** `fluid:api`
31
+ */
32
+ async issueToken(
33
+ request: models.IssueTokenRequest,
34
+ options?: RequestOptions,
35
+ ): Promise<operations.IssueTokenResponse> {
36
+ return unwrapAsync(tokensIssueToken(
37
+ this,
38
+ request,
39
+ options,
40
+ ));
41
+ }
42
+
43
+ /**
44
+ * Issue Fluid-signed M2M token
45
+ *
46
+ * @remarks
47
+ * Validates client credentials against the Authorization Server and then
48
+ * generates a JWT signed by Fluid.
49
+ *
50
+ * This endpoint coexists with `/oauth2/token`.
51
+ * Use `/oauth2/token` when you want the standard Hydra-backed token flow.
52
+ * Use `/oauth2/token-fluid` when you need a Fluid-signed JWT carrying
53
+ * `workspace_id`, `tenant_id`, `client_id`, and `credential_type` claims for M2M calls.
54
+ */
55
+ async issueFluidToken(
56
+ request: models.IssueTokenRequest,
57
+ options?: RequestOptions,
58
+ ): Promise<operations.IssueFluidTokenResponse> {
59
+ return unwrapAsync(tokensIssueFluidToken(
60
+ this,
61
+ request,
62
+ options,
63
+ ));
64
+ }
65
+
66
+ /**
67
+ * Issue end-user token
68
+ *
69
+ * @remarks
70
+ * Issues a JWT for an end user (workspace user or customer user).
71
+ *
72
+ * Supported authentication modes:
73
+ * - `Authorization: Bearer <m2m_token>` — preferred. The token must be a
74
+ * Fluid-signed M2M JWT with `scope` including `fluid:api`.
75
+ * Canonical first-access provisioning via external lookup/create is only
76
+ * available in this mode.
77
+ * - HTTP Basic Auth with `client_id` + `client_secret`.
78
+ * In this mode the service does not perform canonical lookup/create.
79
+ *
80
+ * If `customer_external_id` is present, the JWT is issued with `scope: customer`.
81
+ * Otherwise it is issued with `scope: workspace`.
82
+ *
83
+ * When canonical first-access provisioning is enabled, `email` is required
84
+ * so the service can lookup or create the canonical user before issuing the token.
85
+ *
86
+ * When canonical provisioning is disabled by server configuration, the
87
+ * service may materialize local IAM context by assuming `external_id` is
88
+ * already the canonical `user_id`.
89
+ */
90
+ async issueUserToken(
91
+ request: models.UserTokenRequest,
92
+ options?: RequestOptions,
93
+ ): Promise<operations.IssueUserTokenResponse> {
94
+ return unwrapAsync(tokensIssueUserToken(
95
+ this,
96
+ request,
97
+ options,
98
+ ));
99
+ }
100
+ }
@@ -0,0 +1,68 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ export type APICall =
6
+ | {
7
+ status: "complete";
8
+ request: Request;
9
+ response: Response;
10
+ }
11
+ | {
12
+ status: "request-error";
13
+ request: Request;
14
+ response?: undefined;
15
+ }
16
+ | {
17
+ status: "invalid";
18
+ request?: undefined;
19
+ response?: undefined;
20
+ };
21
+
22
+ export class APIPromise<T> implements Promise<T> {
23
+ readonly #promise: Promise<[T, APICall]>;
24
+ readonly #unwrapped: Promise<T>;
25
+
26
+ readonly [Symbol.toStringTag] = "APIPromise";
27
+
28
+ constructor(p: [T, APICall] | Promise<[T, APICall]>) {
29
+ this.#promise = p instanceof Promise ? p : Promise.resolve(p);
30
+ this.#unwrapped =
31
+ p instanceof Promise
32
+ ? this.#promise.then(([value]) => value)
33
+ : Promise.resolve(p[0]);
34
+ }
35
+
36
+ then<TResult1 = T, TResult2 = never>(
37
+ onfulfilled?:
38
+ | ((value: T) => TResult1 | PromiseLike<TResult1>)
39
+ | null
40
+ | undefined,
41
+ onrejected?:
42
+ | ((reason: any) => TResult2 | PromiseLike<TResult2>)
43
+ | null
44
+ | undefined,
45
+ ): Promise<TResult1 | TResult2> {
46
+ return this.#promise.then(
47
+ onfulfilled ? ([value]) => onfulfilled(value) : void 0,
48
+ onrejected,
49
+ );
50
+ }
51
+
52
+ catch<TResult = never>(
53
+ onrejected?:
54
+ | ((reason: any) => TResult | PromiseLike<TResult>)
55
+ | null
56
+ | undefined,
57
+ ): Promise<T | TResult> {
58
+ return this.#unwrapped.catch(onrejected);
59
+ }
60
+
61
+ finally(onfinally?: (() => void) | null | undefined): Promise<T> {
62
+ return this.#unwrapped.finally(onfinally);
63
+ }
64
+
65
+ $inspect(): Promise<[T, APICall]> {
66
+ return this.#promise;
67
+ }
68
+ }
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+
7
+ export const blobLikeSchema: z.ZodMiniType<Blob, Blob> = z.custom<Blob>(
8
+ isBlobLike,
9
+ {
10
+ message: "expected a Blob, File or Blob-like object",
11
+ abort: true,
12
+ },
13
+ );
14
+
15
+ export function isBlobLike(val: unknown): val is Blob {
16
+ if (val instanceof Blob) {
17
+ return true;
18
+ }
19
+
20
+ if (typeof val !== "object" || val == null || !(Symbol.toStringTag in val)) {
21
+ return false;
22
+ }
23
+
24
+ const name = val[Symbol.toStringTag];
25
+ if (typeof name !== "string") {
26
+ return false;
27
+ }
28
+ if (name !== "Blob" && name !== "File") {
29
+ return false;
30
+ }
31
+
32
+ return "stream" in val && typeof val.stream === "function";
33
+ }