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,117 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+ // Not needed if lax mode
5
+ import * as z from "zod/v4-mini";
6
+ import { startCountingDefaultToZeroValue } from "./default-to-zero-value.js";
7
+ import { RFCDate } from "./rfcdate.js";
8
+ import { startCountingUnrecognized } from "./unrecognized.js";
9
+ /**
10
+ * Smart union parser that tries all schemas and returns the best match
11
+ * based on the number of populated fields.
12
+ */
13
+ export function smartUnion(options) {
14
+ return z.pipe(z.unknown(), z.transform((input, ctx) => {
15
+ const candidates = [];
16
+ const errors = options.map(() => []);
17
+ const parentUnrecognizedCtr = startCountingUnrecognized();
18
+ const parentZeroDefaultCtr = startCountingDefaultToZeroValue();
19
+ // Filter out invalid options
20
+ for (const [i, option] of options.entries()) {
21
+ const unrecognizedCtr = startCountingUnrecognized();
22
+ const zeroDefaultCtr = startCountingDefaultToZeroValue();
23
+ const result = option.safeParse(input);
24
+ const inexactCount = unrecognizedCtr.end();
25
+ const zeroDefaultCount = zeroDefaultCtr.end();
26
+ if (result.success) {
27
+ candidates.push({
28
+ data: result.data,
29
+ inexactCount,
30
+ zeroDefaultCount,
31
+ fieldCount: -1, // We'll count this later if needed
32
+ });
33
+ continue;
34
+ }
35
+ errors[i].push(...result.error.issues);
36
+ }
37
+ // No valid options
38
+ if (candidates.length === 0) {
39
+ parentUnrecognizedCtr.end(0);
40
+ parentZeroDefaultCtr.end(0);
41
+ ctx.issues.push({
42
+ input: input,
43
+ code: "invalid_union",
44
+ errors: errors,
45
+ });
46
+ return z.NEVER;
47
+ }
48
+ let best = candidates[0];
49
+ // Find the best option
50
+ for (const candidate of candidates) {
51
+ // Minor optimization to avoid counting fields if there's only one candidate
52
+ if (candidates.length > 1) {
53
+ candidate.fieldCount = countFieldsRecursive(candidate.data);
54
+ }
55
+ best = better(candidate, best);
56
+ }
57
+ // The cost of this union should be the cost of the best candidate not all the candidates
58
+ parentUnrecognizedCtr.end(best.inexactCount);
59
+ parentZeroDefaultCtr.end(best.zeroDefaultCount);
60
+ return best.data;
61
+ }));
62
+ }
63
+ function better(a, b) {
64
+ // First prefer exact matches over inexact ones
65
+ const aIsExact = a.inexactCount === 0;
66
+ const bIsExact = b.inexactCount === 0;
67
+ if (aIsExact !== bIsExact) {
68
+ return aIsExact ? a : b;
69
+ }
70
+ // Then compare field counts
71
+ const actualFieldCountA = a.fieldCount - a.zeroDefaultCount;
72
+ const actualFieldCountB = b.fieldCount - b.zeroDefaultCount;
73
+ if (actualFieldCountA !== actualFieldCountB) {
74
+ return actualFieldCountA > actualFieldCountB ? a : b;
75
+ }
76
+ return a.inexactCount < b.inexactCount ? a : b;
77
+ }
78
+ /**
79
+ * Counts the number of fields in a parsed value recursively.
80
+ * @param `parsed` assumed to *not* contain cycles
81
+ * fieldCount: total number of fields found
82
+ * inexactCount: number of primitive values that are not unrecognized enum values
83
+ */
84
+ function countFieldsRecursive(parsed) {
85
+ let fieldCount = 0;
86
+ const queue = [parsed];
87
+ let index = 0;
88
+ while (index < queue.length) {
89
+ const value = queue[index++];
90
+ if (value === undefined) {
91
+ continue;
92
+ }
93
+ // Check if it's a primitive value
94
+ const type = typeof value;
95
+ if (value === null
96
+ || type === "number"
97
+ || type === "string"
98
+ || type === "boolean"
99
+ || type === "bigint"
100
+ || value instanceof Date
101
+ || value instanceof RFCDate) {
102
+ fieldCount++;
103
+ continue;
104
+ }
105
+ // Handle arrays
106
+ if (Array.isArray(value)) {
107
+ queue.push(...value);
108
+ continue;
109
+ }
110
+ // Handle objects
111
+ if (type === "object") {
112
+ queue.push(...Object.values(value));
113
+ }
114
+ }
115
+ return fieldCount;
116
+ }
117
+ //# sourceMappingURL=smart-union.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smart-union.js","sourceRoot":"","sources":["../../src/types/smart-union.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,yBAAyB;AACzB,OAAO,KAAK,CAAC,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAY9D;;;GAGG;AACH,MAAM,UAAU,UAAU,CAGxB,OAAgB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H,CAAC;IAED,OAAO,UAAU,CAAC;AAAA,CACnB"}
@@ -0,0 +1,2 @@
1
+ export declare function isReadableStream<T = Uint8Array>(val: unknown): val is ReadableStream<T>;
2
+ //# sourceMappingURL=streams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streams.d.ts","sourceRoot":"","sources":["../../src/types/streams.ts"],"names":[],"mappings":"AAIA,wBAAgB,gBAAgB,CAAC,CAAC,GAAG,UAAU,EAC7C,GAAG,EAAE,OAAO,GACX,GAAG,IAAI,cAAc,CAAC,CAAC,CAAC,CAc1B"}
@@ -0,0 +1,15 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+ export function isReadableStream(val) {
5
+ if (typeof val !== "object" || val === null) {
6
+ return false;
7
+ }
8
+ // Check for the presence of methods specific to ReadableStream
9
+ const stream = val;
10
+ // ReadableStream has methods like getReader, cancel, and tee
11
+ return (typeof stream.getReader === "function" &&
12
+ typeof stream.cancel === "function" &&
13
+ typeof stream.tee === "function");
14
+ }
15
+ //# sourceMappingURL=streams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streams.js","sourceRoot":"","sources":["../../src/types/streams.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,UAAU,gBAAgB,CAC9B,GAAY,EACc;IAC1B,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QAC5C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,+DAA+D;IAC/D,MAAM,MAAM,GAAG,GAAiC,CAAC;IAEjD,6DAA6D;IAC7D,OAAO,CACL,OAAO,MAAM,CAAC,SAAS,KAAK,UAAU;QACtC,OAAO,MAAM,CAAC,MAAM,KAAK,UAAU;QACnC,OAAO,MAAM,CAAC,GAAG,KAAK,UAAU,CACjC,CAAC;AAAA,CACH"}
@@ -0,0 +1,16 @@
1
+ declare const __brand: unique symbol;
2
+ export type Unrecognized<T> = T & {
3
+ [__brand]: "unrecognized";
4
+ };
5
+ declare function unrecognized<T>(value: T): Unrecognized<T>;
6
+ export declare function startCountingUnrecognized(): {
7
+ /**
8
+ * Ends counting and returns the delta.
9
+ * @param delta - If provided, only this amount is added to the parent counter
10
+ * (used for nested unions where we only want to record the winning option's count).
11
+ * If not provided, records all counts since start().
12
+ */
13
+ end: (delta?: number | undefined) => number;
14
+ };
15
+ export { unrecognized };
16
+ //# sourceMappingURL=unrecognized.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unrecognized.d.ts","sourceRoot":"","sources":["../../src/types/unrecognized.ts"],"names":[],"mappings":"AAIA,OAAO,CAAC,MAAM,OAAO,EAAE,OAAO,MAAM,CAAC;AACrC,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,CAAC,OAAO,CAAC,EAAE,cAAc,CAAA;CAAE,CAAC;AAEhE,iBAAS,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAGlD;AAID,wBAAgB,yBAAyB;IAIrC;;;;;OAKG;;EASN;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,31 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+ function unrecognized(value) {
5
+ globalCount++;
6
+ return value;
7
+ }
8
+ let globalCount = 0;
9
+ let refCount = 0;
10
+ export function startCountingUnrecognized() {
11
+ refCount++;
12
+ const start = globalCount;
13
+ return {
14
+ /**
15
+ * Ends counting and returns the delta.
16
+ * @param delta - If provided, only this amount is added to the parent counter
17
+ * (used for nested unions where we only want to record the winning option's count).
18
+ * If not provided, records all counts since start().
19
+ */
20
+ end: (delta) => {
21
+ const count = globalCount - start;
22
+ // Reset globalCount back to start, then add only the specified delta
23
+ globalCount = start + (delta ?? count);
24
+ if (--refCount === 0)
25
+ globalCount = 0;
26
+ return count;
27
+ },
28
+ };
29
+ }
30
+ export { unrecognized };
31
+ //# sourceMappingURL=unrecognized.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unrecognized.js","sourceRoot":"","sources":["../../src/types/unrecognized.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,SAAS,YAAY,CAAI,KAAQ,EAAmB;IAClD,WAAW,EAAE,CAAC;IACd,OAAO,KAAwB,CAAC;AAAA,CACjC;AAED,IAAI,WAAW,GAAG,CAAC,CAAC;AACpB,IAAI,QAAQ,GAAG,CAAC,CAAC;AACjB,MAAM,UAAU,yBAAyB,GAAG;IAC1C,QAAQ,EAAE,CAAC;IACX,MAAM,KAAK,GAAG,WAAW,CAAC;IAC1B,OAAO;QACL;;;;;WAKG;QACH,GAAG,EAAE,CAAC,KAAc,EAAE,EAAE,CAAC;YACvB,MAAM,KAAK,GAAG,WAAW,GAAG,KAAK,CAAC;YAClC,qEAAqE;YACrE,WAAW,GAAG,KAAK,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC;YACvC,IAAI,EAAE,QAAQ,KAAK,CAAC;gBAAE,WAAW,GAAG,CAAC,CAAC;YACtC,OAAO,KAAK,CAAC;QAAA,CACd;KACF,CAAC;AAAA,CACH;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import dotenv from "dotenv";
6
+ dotenv.config();
7
+ /**
8
+ * Example usage of the fluidapi SDK
9
+ *
10
+ * To run this example from the examples directory:
11
+ * npm run build && npx tsx metadataHealthCheck.example.ts
12
+ */
13
+
14
+ import { Fluidapi } from "fluidapi";
15
+
16
+ const fluidapi = new Fluidapi();
17
+
18
+ async function main() {
19
+ const result = await fluidapi.metadata.healthCheck();
20
+
21
+ console.log(result);
22
+ }
23
+
24
+ main().catch(console.error);
package/jsr.json ADDED
@@ -0,0 +1,27 @@
1
+
2
+
3
+ {
4
+ "name": "fluidapi",
5
+ "version": "0.0.3",
6
+ "exports": {
7
+ ".": "./src/index.ts",
8
+ "./models/errors": "./src/models/errors/index.ts",
9
+ "./models": "./src/models/index.ts",
10
+ "./models/operations": "./src/models/operations/index.ts",
11
+ "./lib/config": "./src/lib/config.ts",
12
+ "./lib/http": "./src/lib/http.ts",
13
+ "./lib/retries": "./src/lib/retries.ts",
14
+ "./lib/sdks": "./src/lib/sdks.ts",
15
+ "./types": "./src/types/index.ts"
16
+ },
17
+ "publish": {
18
+ "include": [
19
+ "LICENSE",
20
+ "README.md",
21
+ "RUNTIMES.md",
22
+ "USAGE.md",
23
+ "jsr.json",
24
+ "src/**/*.ts"
25
+ ]
26
+ }
27
+ }
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "fluidapi",
3
+ "version": "0.0.3",
4
+ "author": "Denis",
5
+ "type": "module",
6
+ "main": "./esm/index.js",
7
+ "exports": {
8
+ ".": {
9
+ "source": "./src/index.ts",
10
+ "types": "./esm/index.d.ts",
11
+ "default": "./esm/index.js"
12
+ },
13
+ "./package.json": "./package.json",
14
+ "./types": {
15
+ "source": "./src/types/index.ts",
16
+ "types": "./esm/types/index.d.ts",
17
+ "default": "./esm/types/index.js"
18
+ },
19
+ "./models/errors": {
20
+ "source": "./src/models/errors/index.ts",
21
+ "types": "./esm/models/errors/index.d.ts",
22
+ "default": "./esm/models/errors/index.js"
23
+ },
24
+ "./models": {
25
+ "source": "./src/models/index.ts",
26
+ "types": "./esm/models/index.d.ts",
27
+ "default": "./esm/models/index.js"
28
+ },
29
+ "./models/operations": {
30
+ "source": "./src/models/operations/index.ts",
31
+ "types": "./esm/models/operations/index.d.ts",
32
+ "default": "./esm/models/operations/index.js"
33
+ },
34
+ "./*.js": {
35
+ "source": "./src/*.ts",
36
+ "types": "./esm/*.d.ts",
37
+ "default": "./esm/*.js"
38
+ },
39
+ "./*": {
40
+ "source": "./src/*.ts",
41
+ "types": "./esm/*.d.ts",
42
+ "default": "./esm/*.js"
43
+ }
44
+ },
45
+ "sideEffects": false,
46
+ "scripts": {
47
+ "lint": "oxlint --max-warnings=0 --deny-warnings 'src/**/*.{ts,tsx}'",
48
+ "build": "tsgo",
49
+ "prepublishOnly": "npm run build"
50
+ },
51
+ "peerDependencies": {
52
+
53
+ },
54
+ "devDependencies": {
55
+ "@typescript/native-preview": "7.0.0-dev.20260302.1",
56
+ "oxlint": "^1.50.0",
57
+ "typescript": "~5.8.3"
58
+ },
59
+ "dependencies": {
60
+ "zod": "^3.25.65 || ^4.0.0"
61
+ }
62
+ }
package/src/core.ts ADDED
@@ -0,0 +1,13 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { ClientSDK } from "./lib/sdks.js";
6
+
7
+ /**
8
+ * A minimal client to use when calling standalone SDK functions. Typically, an
9
+ * instance of this class would be instantiated once at the start of an
10
+ * application and passed around through some dependency injection mechanism to
11
+ * parts of an application that need to make SDK calls.
12
+ */
13
+ export class FluidapiCore extends ClientSDK {}
@@ -0,0 +1,145 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { FluidapiCore } from "../core.js";
6
+ import * as M from "../lib/matchers.js";
7
+ import { compactMap } from "../lib/primitives.js";
8
+ import { RequestOptions } from "../lib/sdks.js";
9
+ import { pathToFunc } from "../lib/url.js";
10
+ import { FluidapiError } from "../models/errors/fluidapi-error.js";
11
+ import {
12
+ ConnectionError,
13
+ InvalidRequestError,
14
+ RequestAbortedError,
15
+ RequestTimeoutError,
16
+ UnexpectedClientError,
17
+ } from "../models/errors/http-client-errors.js";
18
+ import * as errors from "../models/errors/index.js";
19
+ import { ResponseValidationError } from "../models/errors/response-validation-error.js";
20
+ import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
21
+ import * as models from "../models/index.js";
22
+ import { APICall, APIPromise } from "../types/async.js";
23
+ import { Result } from "../types/fp.js";
24
+
25
+ /**
26
+ * Get public signing keys
27
+ *
28
+ * @remarks
29
+ * Returns the JWKS used to validate Fluid-signed JWTs.
30
+ */
31
+ export function metadataGetJWKS(
32
+ client: FluidapiCore,
33
+ options?: RequestOptions,
34
+ ): APIPromise<
35
+ Result<
36
+ models.JWKSet,
37
+ | errors.ErrorResponse
38
+ | FluidapiError
39
+ | ResponseValidationError
40
+ | ConnectionError
41
+ | RequestAbortedError
42
+ | RequestTimeoutError
43
+ | InvalidRequestError
44
+ | UnexpectedClientError
45
+ | SDKValidationError
46
+ >
47
+ > {
48
+ return new APIPromise($do(
49
+ client,
50
+ options,
51
+ ));
52
+ }
53
+
54
+ async function $do(
55
+ client: FluidapiCore,
56
+ options?: RequestOptions,
57
+ ): Promise<
58
+ [
59
+ Result<
60
+ models.JWKSet,
61
+ | errors.ErrorResponse
62
+ | FluidapiError
63
+ | ResponseValidationError
64
+ | ConnectionError
65
+ | RequestAbortedError
66
+ | RequestTimeoutError
67
+ | InvalidRequestError
68
+ | UnexpectedClientError
69
+ | SDKValidationError
70
+ >,
71
+ APICall,
72
+ ]
73
+ > {
74
+ const path = pathToFunc("/.well-known/jwks.json")();
75
+
76
+ const headers = new Headers(compactMap({
77
+ Accept: "application/json",
78
+ }));
79
+
80
+ const context = {
81
+ options: client._options,
82
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
83
+ operationID: "getJWKS",
84
+ oAuth2Scopes: null,
85
+
86
+ resolvedSecurity: null,
87
+
88
+ securitySource: null,
89
+ retryConfig: options?.retries
90
+ || client._options.retryConfig
91
+ || { strategy: "none" },
92
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
93
+ };
94
+
95
+ const requestRes = client._createRequest(context, {
96
+ method: "GET",
97
+ baseURL: options?.serverURL,
98
+ path: path,
99
+ headers: headers,
100
+ userAgent: client._options.userAgent,
101
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
102
+ }, options);
103
+ if (!requestRes.ok) {
104
+ return [requestRes, { status: "invalid" }];
105
+ }
106
+ const req = requestRes.value;
107
+
108
+ const doResult = await client._do(req, {
109
+ context,
110
+ errorCodes: ["4XX", "503", "5XX"],
111
+ retryConfig: context.retryConfig,
112
+ retryCodes: context.retryCodes,
113
+ });
114
+ if (!doResult.ok) {
115
+ return [doResult, { status: "request-error", request: req }];
116
+ }
117
+ const response = doResult.value;
118
+
119
+ const responseFields = {
120
+ HttpMeta: { Response: response, Request: req },
121
+ };
122
+
123
+ const [result] = await M.match<
124
+ models.JWKSet,
125
+ | errors.ErrorResponse
126
+ | FluidapiError
127
+ | ResponseValidationError
128
+ | ConnectionError
129
+ | RequestAbortedError
130
+ | RequestTimeoutError
131
+ | InvalidRequestError
132
+ | UnexpectedClientError
133
+ | SDKValidationError
134
+ >(
135
+ M.json(200, models.JWKSet$inboundSchema),
136
+ M.jsonErr(503, errors.ErrorResponse$inboundSchema),
137
+ M.fail("4XX"),
138
+ M.fail("5XX"),
139
+ )(response, req, { extraFields: responseFields });
140
+ if (!result.ok) {
141
+ return [result, { status: "complete", request: req, response }];
142
+ }
143
+
144
+ return [result, { status: "complete", request: req, response }];
145
+ }
@@ -0,0 +1,142 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { FluidapiCore } from "../core.js";
6
+ import * as M from "../lib/matchers.js";
7
+ import { compactMap } from "../lib/primitives.js";
8
+ import { RequestOptions } from "../lib/sdks.js";
9
+ import { pathToFunc } from "../lib/url.js";
10
+ import { FluidapiError } from "../models/errors/fluidapi-error.js";
11
+ import {
12
+ ConnectionError,
13
+ InvalidRequestError,
14
+ RequestAbortedError,
15
+ RequestTimeoutError,
16
+ UnexpectedClientError,
17
+ } from "../models/errors/http-client-errors.js";
18
+ import * as errors from "../models/errors/index.js";
19
+ import { ResponseValidationError } from "../models/errors/response-validation-error.js";
20
+ import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
21
+ import * as models from "../models/index.js";
22
+ import { APICall, APIPromise } from "../types/async.js";
23
+ import { Result } from "../types/fp.js";
24
+
25
+ /**
26
+ * Health check
27
+ */
28
+ export function metadataHealthCheck(
29
+ client: FluidapiCore,
30
+ options?: RequestOptions,
31
+ ): APIPromise<
32
+ Result<
33
+ models.HealthResponse,
34
+ | errors.ErrorResponse
35
+ | FluidapiError
36
+ | ResponseValidationError
37
+ | ConnectionError
38
+ | RequestAbortedError
39
+ | RequestTimeoutError
40
+ | InvalidRequestError
41
+ | UnexpectedClientError
42
+ | SDKValidationError
43
+ >
44
+ > {
45
+ return new APIPromise($do(
46
+ client,
47
+ options,
48
+ ));
49
+ }
50
+
51
+ async function $do(
52
+ client: FluidapiCore,
53
+ options?: RequestOptions,
54
+ ): Promise<
55
+ [
56
+ Result<
57
+ models.HealthResponse,
58
+ | errors.ErrorResponse
59
+ | FluidapiError
60
+ | ResponseValidationError
61
+ | ConnectionError
62
+ | RequestAbortedError
63
+ | RequestTimeoutError
64
+ | InvalidRequestError
65
+ | UnexpectedClientError
66
+ | SDKValidationError
67
+ >,
68
+ APICall,
69
+ ]
70
+ > {
71
+ const path = pathToFunc("/health")();
72
+
73
+ const headers = new Headers(compactMap({
74
+ Accept: "application/json",
75
+ }));
76
+
77
+ const context = {
78
+ options: client._options,
79
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
80
+ operationID: "healthCheck",
81
+ oAuth2Scopes: null,
82
+
83
+ resolvedSecurity: null,
84
+
85
+ securitySource: null,
86
+ retryConfig: options?.retries
87
+ || client._options.retryConfig
88
+ || { strategy: "none" },
89
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
90
+ };
91
+
92
+ const requestRes = client._createRequest(context, {
93
+ method: "GET",
94
+ baseURL: options?.serverURL,
95
+ path: path,
96
+ headers: headers,
97
+ userAgent: client._options.userAgent,
98
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
99
+ }, options);
100
+ if (!requestRes.ok) {
101
+ return [requestRes, { status: "invalid" }];
102
+ }
103
+ const req = requestRes.value;
104
+
105
+ const doResult = await client._do(req, {
106
+ context,
107
+ errorCodes: ["4XX", "503", "5XX"],
108
+ retryConfig: context.retryConfig,
109
+ retryCodes: context.retryCodes,
110
+ });
111
+ if (!doResult.ok) {
112
+ return [doResult, { status: "request-error", request: req }];
113
+ }
114
+ const response = doResult.value;
115
+
116
+ const responseFields = {
117
+ HttpMeta: { Response: response, Request: req },
118
+ };
119
+
120
+ const [result] = await M.match<
121
+ models.HealthResponse,
122
+ | errors.ErrorResponse
123
+ | FluidapiError
124
+ | ResponseValidationError
125
+ | ConnectionError
126
+ | RequestAbortedError
127
+ | RequestTimeoutError
128
+ | InvalidRequestError
129
+ | UnexpectedClientError
130
+ | SDKValidationError
131
+ >(
132
+ M.json(200, models.HealthResponse$inboundSchema),
133
+ M.jsonErr(503, errors.ErrorResponse$inboundSchema),
134
+ M.fail("4XX"),
135
+ M.fail("5XX"),
136
+ )(response, req, { extraFields: responseFields });
137
+ if (!result.ok) {
138
+ return [result, { status: "complete", request: req, response }];
139
+ }
140
+
141
+ return [result, { status: "complete", request: req, response }];
142
+ }