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,236 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ type OAuth2PasswordFlow = {
6
+ username: string;
7
+ password: string;
8
+ clientID?: string | undefined;
9
+ clientSecret?: string | undefined;
10
+ tokenURL: string;
11
+ };
12
+
13
+ export enum SecurityErrorCode {
14
+ Incomplete = "incomplete",
15
+ UnrecognisedSecurityType = "unrecognized_security_type",
16
+ }
17
+
18
+ export class SecurityError extends Error {
19
+ constructor(
20
+ public code: SecurityErrorCode,
21
+ message: string,
22
+ ) {
23
+ super(message);
24
+ this.name = "SecurityError";
25
+ }
26
+
27
+ static incomplete(): SecurityError {
28
+ return new SecurityError(
29
+ SecurityErrorCode.Incomplete,
30
+ "Security requirements not met in order to perform the operation",
31
+ );
32
+ }
33
+ static unrecognizedType(type: string): SecurityError {
34
+ return new SecurityError(
35
+ SecurityErrorCode.UnrecognisedSecurityType,
36
+ `Unrecognised security type: ${type}`,
37
+ );
38
+ }
39
+ }
40
+
41
+ export type SecurityState = {
42
+ basic: { username?: string | undefined; password?: string | undefined };
43
+ headers: Record<string, string>;
44
+ queryParams: Record<string, string>;
45
+ cookies: Record<string, string>;
46
+ oauth2: ({ type: "password" } & OAuth2PasswordFlow) | { type: "none" };
47
+ };
48
+
49
+ type SecurityInputBasic = {
50
+ type: "http:basic";
51
+ value:
52
+ | { username?: string | undefined; password?: string | undefined }
53
+ | null
54
+ | undefined;
55
+ };
56
+
57
+ type SecurityInputBearer = {
58
+ type: "http:bearer";
59
+ value: string | null | undefined;
60
+ fieldName: string;
61
+ };
62
+
63
+ type SecurityInputAPIKey = {
64
+ type: "apiKey:header" | "apiKey:query" | "apiKey:cookie";
65
+ value: string | null | undefined;
66
+ fieldName: string;
67
+ };
68
+
69
+ type SecurityInputOIDC = {
70
+ type: "openIdConnect";
71
+ value: string | null | undefined;
72
+ fieldName: string;
73
+ };
74
+
75
+ type SecurityInputOAuth2 = {
76
+ type: "oauth2";
77
+ value: string | null | undefined;
78
+ fieldName: string;
79
+ };
80
+
81
+ type SecurityInputOAuth2ClientCredentials = {
82
+ type: "oauth2:client_credentials";
83
+ value:
84
+ | {
85
+ clientID?: string | undefined;
86
+ clientSecret?: string | undefined;
87
+ }
88
+ | null
89
+ | string
90
+ | undefined;
91
+ fieldName?: string;
92
+ };
93
+
94
+ type SecurityInputOAuth2PasswordCredentials = {
95
+ type: "oauth2:password";
96
+ value:
97
+ | string
98
+ | null
99
+ | undefined;
100
+ fieldName?: string;
101
+ };
102
+
103
+ type SecurityInputCustom = {
104
+ type: "http:custom";
105
+ value: any | null | undefined;
106
+ fieldName?: string;
107
+ };
108
+
109
+ export type SecurityInput =
110
+ | SecurityInputBasic
111
+ | SecurityInputBearer
112
+ | SecurityInputAPIKey
113
+ | SecurityInputOAuth2
114
+ | SecurityInputOAuth2ClientCredentials
115
+ | SecurityInputOAuth2PasswordCredentials
116
+ | SecurityInputOIDC
117
+ | SecurityInputCustom;
118
+
119
+ export function resolveSecurity(
120
+ ...options: SecurityInput[][]
121
+ ): SecurityState | null {
122
+ const state: SecurityState = {
123
+ basic: {},
124
+ headers: {},
125
+ queryParams: {},
126
+ cookies: {},
127
+ oauth2: { type: "none" },
128
+ };
129
+
130
+ const option = options.find((opts) => {
131
+ return opts.every((o) => {
132
+ if (o.value == null) {
133
+ return false;
134
+ } else if (o.type === "http:basic") {
135
+ return o.value.username != null || o.value.password != null;
136
+ } else if (o.type === "http:custom") {
137
+ return null;
138
+ } else if (o.type === "oauth2:password") {
139
+ return (
140
+ typeof o.value === "string" && !!o.value
141
+ );
142
+ } else if (o.type === "oauth2:client_credentials") {
143
+ if (typeof o.value == "string") {
144
+ return !!o.value;
145
+ }
146
+ return o.value.clientID != null || o.value.clientSecret != null;
147
+ } else if (typeof o.value === "string") {
148
+ return !!o.value;
149
+ } else {
150
+ throw new Error(
151
+ `Unrecognized security type: ${o.type} (value type: ${typeof o
152
+ .value})`,
153
+ );
154
+ }
155
+ });
156
+ });
157
+ if (option == null) {
158
+ return null;
159
+ }
160
+
161
+ option.forEach((spec) => {
162
+ if (spec.value == null) {
163
+ return;
164
+ }
165
+
166
+ const { type } = spec;
167
+
168
+ switch (type) {
169
+ case "apiKey:header":
170
+ state.headers[spec.fieldName] = spec.value;
171
+ break;
172
+ case "apiKey:query":
173
+ state.queryParams[spec.fieldName] = spec.value;
174
+ break;
175
+ case "apiKey:cookie":
176
+ state.cookies[spec.fieldName] = spec.value;
177
+ break;
178
+ case "http:basic":
179
+ applyBasic(state, spec);
180
+ break;
181
+ case "http:custom":
182
+ break;
183
+ case "http:bearer":
184
+ applyBearer(state, spec);
185
+ break;
186
+ case "oauth2":
187
+ applyBearer(state, spec);
188
+ break;
189
+ case "oauth2:password":
190
+ applyBearer(state, spec);
191
+ break;
192
+ case "oauth2:client_credentials":
193
+ break;
194
+ case "openIdConnect":
195
+ applyBearer(state, spec);
196
+ break;
197
+ default:
198
+ throw SecurityError.unrecognizedType((spec satisfies never, type));
199
+ }
200
+ });
201
+
202
+ return state;
203
+ }
204
+
205
+ function applyBasic(
206
+ state: SecurityState,
207
+ spec: SecurityInputBasic,
208
+ ) {
209
+ if (spec.value == null) {
210
+ return;
211
+ }
212
+
213
+ state.basic = spec.value;
214
+ }
215
+
216
+ function applyBearer(
217
+ state: SecurityState,
218
+ spec:
219
+ | SecurityInputBearer
220
+ | SecurityInputOAuth2
221
+ | SecurityInputOIDC
222
+ | SecurityInputOAuth2PasswordCredentials,
223
+ ) {
224
+ if (typeof spec.value !== "string" || !spec.value) {
225
+ return;
226
+ }
227
+
228
+ let value = spec.value;
229
+ if (value.slice(0, 7).toLowerCase() !== "bearer ") {
230
+ value = `Bearer ${value}`;
231
+ }
232
+
233
+ if (spec.fieldName !== undefined) {
234
+ state.headers[spec.fieldName] = value;
235
+ }
236
+ }
package/src/lib/url.ts ADDED
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ const hasOwn = Object.prototype.hasOwnProperty;
6
+
7
+ export type Params = Partial<Record<string, string | number>>;
8
+
9
+ export function pathToFunc(
10
+ pathPattern: string,
11
+ options?: { charEncoding?: "percent" | "none" },
12
+ ): (params?: Params) => string {
13
+ const paramRE = /\{([a-zA-Z0-9_][a-zA-Z0-9_-]*?)\}/g;
14
+
15
+ return function buildURLPath(params: Record<string, unknown> = {}): string {
16
+ return pathPattern.replace(paramRE, function (_, placeholder) {
17
+ if (!hasOwn.call(params, placeholder)) {
18
+ throw new Error(`Parameter '${placeholder}' is required`);
19
+ }
20
+
21
+ const value = params[placeholder];
22
+ if (typeof value !== "string" && typeof value !== "number") {
23
+ throw new Error(
24
+ `Parameter '${placeholder}' must be a string or number`,
25
+ );
26
+ }
27
+
28
+ return options?.charEncoding === "percent"
29
+ ? encodeURIComponent(`${value}`)
30
+ : `${value}`;
31
+ });
32
+ };
33
+ }
@@ -0,0 +1,36 @@
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 ErrorT = {
12
+ /**
13
+ * Machine-readable error code
14
+ */
15
+ code: string;
16
+ /**
17
+ * Human-readable description
18
+ */
19
+ message: string;
20
+ };
21
+
22
+ /** @internal */
23
+ export const ErrorT$inboundSchema: z.ZodMiniType<ErrorT, unknown> = z.object({
24
+ code: types.string(),
25
+ message: types.string(),
26
+ });
27
+
28
+ export function errorFromJSON(
29
+ jsonString: string,
30
+ ): SafeParseResult<ErrorT, SDKValidationError> {
31
+ return safeParse(
32
+ jsonString,
33
+ (x) => ErrorT$inboundSchema.parse(JSON.parse(x)),
34
+ `Failed to parse 'ErrorT' from JSON`,
35
+ );
36
+ }
@@ -0,0 +1,56 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import * as types from "../../types/primitives.js";
7
+ import * as models from "../index.js";
8
+ import { FluidapiError } from "./fluidapi-error.js";
9
+
10
+ export type ErrorResponseData = {
11
+ ok: boolean;
12
+ error: models.ErrorT;
13
+ };
14
+
15
+ export class ErrorResponse extends FluidapiError {
16
+ ok: boolean;
17
+ error: models.ErrorT;
18
+
19
+ /** The original data that was passed to this error instance. */
20
+ data$: ErrorResponseData;
21
+
22
+ constructor(
23
+ err: ErrorResponseData,
24
+ httpMeta: { response: Response; request: Request; body: string },
25
+ ) {
26
+ const message = err.error?.message
27
+ || `API error occurred: ${JSON.stringify(err)}`;
28
+ super(message, httpMeta);
29
+ this.data$ = err;
30
+ this.ok = err.ok;
31
+ this.error = err.error;
32
+
33
+ this.name = "ErrorResponse";
34
+ }
35
+ }
36
+
37
+ /** @internal */
38
+ export const ErrorResponse$inboundSchema: z.ZodMiniType<
39
+ ErrorResponse,
40
+ unknown
41
+ > = z.pipe(
42
+ z.object({
43
+ ok: types.boolean(),
44
+ error: z.lazy(() => models.ErrorT$inboundSchema),
45
+ request$: z.custom<Request>(x => x instanceof Request),
46
+ response$: z.custom<Response>(x => x instanceof Response),
47
+ body$: z.string(),
48
+ }),
49
+ z.transform((v) => {
50
+ return new ErrorResponse(v, {
51
+ request: v.request$,
52
+ response: v.response$,
53
+ body: v.body$,
54
+ });
55
+ }),
56
+ );
@@ -0,0 +1,40 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { FluidapiError } from "./fluidapi-error.js";
6
+
7
+ /** The fallback error class if no more specific error class is matched */
8
+ export class FluidapiDefaultError extends FluidapiError {
9
+ constructor(
10
+ message: string,
11
+ httpMeta: {
12
+ response: Response;
13
+ request: Request;
14
+ body: string;
15
+ },
16
+ ) {
17
+ if (message) {
18
+ message += `: `;
19
+ }
20
+ message += `Status ${httpMeta.response.status}`;
21
+ const contentType = httpMeta.response.headers.get("content-type") || `""`;
22
+ if (contentType !== "application/json") {
23
+ message += ` Content-Type ${
24
+ contentType.includes(" ") ? `"${contentType}"` : contentType
25
+ }`;
26
+ }
27
+ const body = httpMeta.body || `""`;
28
+ message += body.length > 100 ? "\n" : ". ";
29
+ let bodyDisplay = body;
30
+ if (body.length > 10000) {
31
+ const truncated = body.substring(0, 10000);
32
+ const remaining = body.length - 10000;
33
+ bodyDisplay = `${truncated}...and ${remaining} more chars`;
34
+ }
35
+ message += `Body: ${bodyDisplay}`;
36
+ message = message.trim();
37
+ super(message, httpMeta);
38
+ this.name = "FluidapiDefaultError";
39
+ }
40
+ }
@@ -0,0 +1,35 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ /** The base class for all HTTP error responses */
6
+ export class FluidapiError extends Error {
7
+ /** HTTP status code */
8
+ public readonly statusCode: number;
9
+ /** HTTP body */
10
+ public readonly body: string;
11
+ /** HTTP headers */
12
+ public readonly headers: Headers;
13
+ /** HTTP content type */
14
+ public readonly contentType: string;
15
+ /** Raw response */
16
+ public readonly rawResponse: Response;
17
+
18
+ constructor(
19
+ message: string,
20
+ httpMeta: {
21
+ response: Response;
22
+ request: Request;
23
+ body: string;
24
+ },
25
+ ) {
26
+ super(message);
27
+ this.statusCode = httpMeta.response.status;
28
+ this.body = httpMeta.body;
29
+ this.headers = httpMeta.response.headers;
30
+ this.contentType = httpMeta.response.headers.get("content-type") || "";
31
+ this.rawResponse = httpMeta.response;
32
+
33
+ this.name = "FluidapiError";
34
+ }
35
+ }
@@ -0,0 +1,62 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ /**
6
+ * Base class for all HTTP errors.
7
+ */
8
+ export class HTTPClientError extends Error {
9
+ /** The underlying cause of the error. */
10
+ override readonly cause: unknown;
11
+ override name = "HTTPClientError";
12
+ constructor(message: string, opts?: { cause?: unknown }) {
13
+ let msg = message;
14
+ if (opts?.cause) {
15
+ msg += `: ${opts.cause}`;
16
+ }
17
+
18
+ super(msg, opts);
19
+ // In older runtimes, the cause field would not have been assigned through
20
+ // the super() call.
21
+ if (typeof this.cause === "undefined") {
22
+ this.cause = opts?.cause;
23
+ }
24
+ }
25
+ }
26
+
27
+ /**
28
+ * An error to capture unrecognised or unexpected errors when making HTTP calls.
29
+ */
30
+ export class UnexpectedClientError extends HTTPClientError {
31
+ override name = "UnexpectedClientError";
32
+ }
33
+
34
+ /**
35
+ * An error that is raised when any inputs used to create a request are invalid.
36
+ */
37
+ export class InvalidRequestError extends HTTPClientError {
38
+ override name = "InvalidRequestError";
39
+ }
40
+
41
+ /**
42
+ * An error that is raised when a HTTP request was aborted by the client error.
43
+ */
44
+ export class RequestAbortedError extends HTTPClientError {
45
+ override readonly name = "RequestAbortedError";
46
+ }
47
+
48
+ /**
49
+ * An error that is raised when a HTTP request timed out due to an AbortSignal
50
+ * signal timeout.
51
+ */
52
+ export class RequestTimeoutError extends HTTPClientError {
53
+ override readonly name = "RequestTimeoutError";
54
+ }
55
+
56
+ /**
57
+ * An error that is raised when a HTTP client is unable to make a request to
58
+ * a server.
59
+ */
60
+ export class ConnectionError extends HTTPClientError {
61
+ override readonly name = "ConnectionError";
62
+ }
@@ -0,0 +1,10 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ export * from "./error-response.js";
6
+ export * from "./fluidapi-default-error.js";
7
+ export * from "./fluidapi-error.js";
8
+ export * from "./http-client-errors.js";
9
+ export * from "./response-validation-error.js";
10
+ export * from "./sdk-validation-error.js";
@@ -0,0 +1,50 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4/core";
6
+ import { FluidapiError } from "./fluidapi-error.js";
7
+ import { formatZodError } from "./sdk-validation-error.js";
8
+
9
+ export class ResponseValidationError extends FluidapiError {
10
+ /**
11
+ * The raw value that failed validation.
12
+ */
13
+ public readonly rawValue: unknown;
14
+
15
+ /**
16
+ * The raw message that failed validation.
17
+ */
18
+ public readonly rawMessage: unknown;
19
+
20
+ constructor(
21
+ message: string,
22
+ extra: {
23
+ response: Response;
24
+ request: Request;
25
+ body: string;
26
+ cause: unknown;
27
+ rawValue: unknown;
28
+ rawMessage: unknown;
29
+ },
30
+ ) {
31
+ super(message, extra);
32
+ this.name = "ResponseValidationError";
33
+ this.cause = extra.cause;
34
+ this.rawValue = extra.rawValue;
35
+ this.rawMessage = extra.rawMessage;
36
+ }
37
+
38
+ /**
39
+ * Return a pretty-formatted error message if the underlying validation error
40
+ * is a ZodError or some other recognized error type, otherwise return the
41
+ * default error message.
42
+ */
43
+ public pretty(): string {
44
+ if (this.cause instanceof z.$ZodError) {
45
+ return `${this.rawMessage}\n${formatZodError(this.cause)}`;
46
+ } else {
47
+ return this.toString();
48
+ }
49
+ }
50
+ }
@@ -0,0 +1,54 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4/core";
6
+
7
+ export class SDKValidationError extends Error {
8
+ /**
9
+ * The raw value that failed validation.
10
+ */
11
+ public readonly rawValue: unknown;
12
+
13
+ /**
14
+ * The raw message that failed validation.
15
+ */
16
+ public readonly rawMessage: unknown;
17
+
18
+ // Allows for backwards compatibility for `instanceof` checks of `ResponseValidationError`
19
+ static override [Symbol.hasInstance](
20
+ instance: unknown,
21
+ ): instance is SDKValidationError {
22
+ if (!(instance instanceof Error)) return false;
23
+ if (!("rawValue" in instance)) return false;
24
+ if (!("rawMessage" in instance)) return false;
25
+ if (!("pretty" in instance)) return false;
26
+ if (typeof instance.pretty !== "function") return false;
27
+ return true;
28
+ }
29
+
30
+ constructor(message: string, cause: unknown, rawValue: unknown) {
31
+ super(`${message}: ${cause}`);
32
+ this.name = "SDKValidationError";
33
+ this.cause = cause;
34
+ this.rawValue = rawValue;
35
+ this.rawMessage = message;
36
+ }
37
+
38
+ /**
39
+ * Return a pretty-formatted error message if the underlying validation error
40
+ * is a ZodError or some other recognized error type, otherwise return the
41
+ * default error message.
42
+ */
43
+ public pretty(): string {
44
+ if (this.cause instanceof z.$ZodError) {
45
+ return `${this.rawMessage}\n${formatZodError(this.cause)}`;
46
+ } else {
47
+ return this.toString();
48
+ }
49
+ }
50
+ }
51
+
52
+ export function formatZodError(err: z.$ZodError): string {
53
+ return z.prettifyError(err);
54
+ }
@@ -0,0 +1,31 @@
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 HealthResponse = {
12
+ status: string;
13
+ };
14
+
15
+ /** @internal */
16
+ export const HealthResponse$inboundSchema: z.ZodMiniType<
17
+ HealthResponse,
18
+ unknown
19
+ > = z.object({
20
+ status: types.string(),
21
+ });
22
+
23
+ export function healthResponseFromJSON(
24
+ jsonString: string,
25
+ ): SafeParseResult<HealthResponse, SDKValidationError> {
26
+ return safeParse(
27
+ jsonString,
28
+ (x) => HealthResponse$inboundSchema.parse(JSON.parse(x)),
29
+ `Failed to parse 'HealthResponse' from JSON`,
30
+ );
31
+ }
@@ -0,0 +1,11 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ export * from "./error-response.js";
6
+ export * from "./health-response.js";
7
+ export * from "./issue-token-request.js";
8
+ export * from "./jwk-set.js";
9
+ export * from "./token-data.js";
10
+ export * from "./user-token-data.js";
11
+ export * from "./user-token-request.js";