cribl-mgmt-plane 0.0.2

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 (430) hide show
  1. package/.devcontainer/README.md +30 -0
  2. package/.devcontainer/devcontainer.json +45 -0
  3. package/FUNCTIONS.md +88 -0
  4. package/README.md +342 -0
  5. package/RUNTIMES.md +48 -0
  6. package/dist/commonjs/__tests__/assertions.d.ts +2 -0
  7. package/dist/commonjs/__tests__/assertions.d.ts.map +1 -0
  8. package/dist/commonjs/__tests__/assertions.js +14 -0
  9. package/dist/commonjs/__tests__/assertions.js.map +1 -0
  10. package/dist/commonjs/__tests__/criblmgmtplane.test.d.ts +2 -0
  11. package/dist/commonjs/__tests__/criblmgmtplane.test.d.ts.map +1 -0
  12. package/dist/commonjs/__tests__/criblmgmtplane.test.js +18 -0
  13. package/dist/commonjs/__tests__/criblmgmtplane.test.js.map +1 -0
  14. package/dist/commonjs/__tests__/files.d.ts +6 -0
  15. package/dist/commonjs/__tests__/files.d.ts.map +1 -0
  16. package/dist/commonjs/__tests__/files.js +51 -0
  17. package/dist/commonjs/__tests__/files.js.map +1 -0
  18. package/dist/commonjs/__tests__/testclient.d.ts +3 -0
  19. package/dist/commonjs/__tests__/testclient.d.ts.map +1 -0
  20. package/dist/commonjs/__tests__/testclient.js +38 -0
  21. package/dist/commonjs/__tests__/testclient.js.map +1 -0
  22. package/dist/commonjs/core.d.ts +10 -0
  23. package/dist/commonjs/core.d.ts.map +1 -0
  24. package/dist/commonjs/core.js +17 -0
  25. package/dist/commonjs/core.js.map +1 -0
  26. package/dist/commonjs/funcs/dummyServiceStatus.d.ts +13 -0
  27. package/dist/commonjs/funcs/dummyServiceStatus.d.ts.map +1 -0
  28. package/dist/commonjs/funcs/dummyServiceStatus.js +101 -0
  29. package/dist/commonjs/funcs/dummyServiceStatus.js.map +1 -0
  30. package/dist/commonjs/hooks/hooks.d.ts +25 -0
  31. package/dist/commonjs/hooks/hooks.d.ts.map +1 -0
  32. package/dist/commonjs/hooks/hooks.js +86 -0
  33. package/dist/commonjs/hooks/hooks.js.map +1 -0
  34. package/dist/commonjs/hooks/index.d.ts +3 -0
  35. package/dist/commonjs/hooks/index.d.ts.map +1 -0
  36. package/dist/commonjs/hooks/index.js +22 -0
  37. package/dist/commonjs/hooks/index.js.map +1 -0
  38. package/dist/commonjs/hooks/registration.d.ts +3 -0
  39. package/dist/commonjs/hooks/registration.d.ts.map +1 -0
  40. package/dist/commonjs/hooks/registration.js +15 -0
  41. package/dist/commonjs/hooks/registration.js.map +1 -0
  42. package/dist/commonjs/hooks/types.d.ts +76 -0
  43. package/dist/commonjs/hooks/types.d.ts.map +1 -0
  44. package/dist/commonjs/hooks/types.js +6 -0
  45. package/dist/commonjs/hooks/types.js.map +1 -0
  46. package/dist/commonjs/index.d.ts +6 -0
  47. package/dist/commonjs/index.d.ts.map +1 -0
  48. package/dist/commonjs/index.js +48 -0
  49. package/dist/commonjs/index.js.map +1 -0
  50. package/dist/commonjs/lib/base64.d.ts +10 -0
  51. package/dist/commonjs/lib/base64.d.ts.map +1 -0
  52. package/dist/commonjs/lib/base64.js +71 -0
  53. package/dist/commonjs/lib/base64.js.map +1 -0
  54. package/dist/commonjs/lib/config.d.ts +38 -0
  55. package/dist/commonjs/lib/config.d.ts.map +1 -0
  56. package/dist/commonjs/lib/config.js +35 -0
  57. package/dist/commonjs/lib/config.js.map +1 -0
  58. package/dist/commonjs/lib/dlv.d.ts +14 -0
  59. package/dist/commonjs/lib/dlv.d.ts.map +1 -0
  60. package/dist/commonjs/lib/dlv.js +49 -0
  61. package/dist/commonjs/lib/dlv.js.map +1 -0
  62. package/dist/commonjs/lib/encodings.d.ts +52 -0
  63. package/dist/commonjs/lib/encodings.d.ts.map +1 -0
  64. package/dist/commonjs/lib/encodings.js +368 -0
  65. package/dist/commonjs/lib/encodings.js.map +1 -0
  66. package/dist/commonjs/lib/env.d.ts +15 -0
  67. package/dist/commonjs/lib/env.d.ts.map +1 -0
  68. package/dist/commonjs/lib/env.js +65 -0
  69. package/dist/commonjs/lib/env.js.map +1 -0
  70. package/dist/commonjs/lib/files.d.ts +13 -0
  71. package/dist/commonjs/lib/files.d.ts.map +1 -0
  72. package/dist/commonjs/lib/files.js +77 -0
  73. package/dist/commonjs/lib/files.js.map +1 -0
  74. package/dist/commonjs/lib/http.d.ts +67 -0
  75. package/dist/commonjs/lib/http.d.ts.map +1 -0
  76. package/dist/commonjs/lib/http.js +217 -0
  77. package/dist/commonjs/lib/http.js.map +1 -0
  78. package/dist/commonjs/lib/is-plain-object.d.ts +2 -0
  79. package/dist/commonjs/lib/is-plain-object.d.ts.map +1 -0
  80. package/dist/commonjs/lib/is-plain-object.js +41 -0
  81. package/dist/commonjs/lib/is-plain-object.js.map +1 -0
  82. package/dist/commonjs/lib/logger.d.ts +6 -0
  83. package/dist/commonjs/lib/logger.d.ts.map +1 -0
  84. package/dist/commonjs/lib/logger.js +6 -0
  85. package/dist/commonjs/lib/logger.js.map +1 -0
  86. package/dist/commonjs/lib/matchers.d.ts +59 -0
  87. package/dist/commonjs/lib/matchers.d.ts.map +1 -0
  88. package/dist/commonjs/lib/matchers.js +222 -0
  89. package/dist/commonjs/lib/matchers.js.map +1 -0
  90. package/dist/commonjs/lib/primitives.d.ts +26 -0
  91. package/dist/commonjs/lib/primitives.d.ts.map +1 -0
  92. package/dist/commonjs/lib/primitives.js +111 -0
  93. package/dist/commonjs/lib/primitives.js.map +1 -0
  94. package/dist/commonjs/lib/retries.d.ts +38 -0
  95. package/dist/commonjs/lib/retries.d.ts.map +1 -0
  96. package/dist/commonjs/lib/retries.js +153 -0
  97. package/dist/commonjs/lib/retries.js.map +1 -0
  98. package/dist/commonjs/lib/schemas.d.ts +19 -0
  99. package/dist/commonjs/lib/schemas.d.ts.map +1 -0
  100. package/dist/commonjs/lib/schemas.js +62 -0
  101. package/dist/commonjs/lib/schemas.js.map +1 -0
  102. package/dist/commonjs/lib/sdks.d.ts +63 -0
  103. package/dist/commonjs/lib/sdks.d.ts.map +1 -0
  104. package/dist/commonjs/lib/sdks.js +273 -0
  105. package/dist/commonjs/lib/sdks.js.map +1 -0
  106. package/dist/commonjs/lib/security.d.ts +83 -0
  107. package/dist/commonjs/lib/security.d.ts.map +1 -0
  108. package/dist/commonjs/lib/security.js +144 -0
  109. package/dist/commonjs/lib/security.js.map +1 -0
  110. package/dist/commonjs/lib/url.d.ts +5 -0
  111. package/dist/commonjs/lib/url.d.ts.map +1 -0
  112. package/dist/commonjs/lib/url.js +25 -0
  113. package/dist/commonjs/lib/url.js.map +1 -0
  114. package/dist/commonjs/models/errors/criblmgmtplanedefaulterror.d.ts +10 -0
  115. package/dist/commonjs/models/errors/criblmgmtplanedefaulterror.d.ts.map +1 -0
  116. package/dist/commonjs/models/errors/criblmgmtplanedefaulterror.js +34 -0
  117. package/dist/commonjs/models/errors/criblmgmtplanedefaulterror.js.map +1 -0
  118. package/dist/commonjs/models/errors/criblmgmtplaneerror.d.ts +19 -0
  119. package/dist/commonjs/models/errors/criblmgmtplaneerror.d.ts.map +1 -0
  120. package/dist/commonjs/models/errors/criblmgmtplaneerror.js +20 -0
  121. package/dist/commonjs/models/errors/criblmgmtplaneerror.js.map +1 -0
  122. package/dist/commonjs/models/errors/httpclienterrors.d.ts +44 -0
  123. package/dist/commonjs/models/errors/httpclienterrors.d.ts.map +1 -0
  124. package/dist/commonjs/models/errors/httpclienterrors.js +78 -0
  125. package/dist/commonjs/models/errors/httpclienterrors.js.map +1 -0
  126. package/dist/commonjs/models/errors/index.d.ts +5 -0
  127. package/dist/commonjs/models/errors/index.d.ts.map +1 -0
  128. package/dist/commonjs/models/errors/index.js +24 -0
  129. package/dist/commonjs/models/errors/index.js.map +1 -0
  130. package/dist/commonjs/models/errors/responsevalidationerror.d.ts +26 -0
  131. package/dist/commonjs/models/errors/responsevalidationerror.d.ts.map +1 -0
  132. package/dist/commonjs/models/errors/responsevalidationerror.js +66 -0
  133. package/dist/commonjs/models/errors/responsevalidationerror.js.map +1 -0
  134. package/dist/commonjs/models/errors/sdkvalidationerror.d.ts +21 -0
  135. package/dist/commonjs/models/errors/sdkvalidationerror.d.ts.map +1 -0
  136. package/dist/commonjs/models/errors/sdkvalidationerror.js +129 -0
  137. package/dist/commonjs/models/errors/sdkvalidationerror.js.map +1 -0
  138. package/dist/commonjs/models/index.d.ts +2 -0
  139. package/dist/commonjs/models/index.d.ts.map +1 -0
  140. package/dist/commonjs/models/index.js +21 -0
  141. package/dist/commonjs/models/index.js.map +1 -0
  142. package/dist/commonjs/models/security.d.ts +29 -0
  143. package/dist/commonjs/models/security.d.ts.map +1 -0
  144. package/dist/commonjs/models/security.js +69 -0
  145. package/dist/commonjs/models/security.js.map +1 -0
  146. package/dist/commonjs/package.json +3 -0
  147. package/dist/commonjs/sdk/index.d.ts +2 -0
  148. package/dist/commonjs/sdk/index.d.ts.map +1 -0
  149. package/dist/commonjs/sdk/index.js +21 -0
  150. package/dist/commonjs/sdk/index.js.map +1 -0
  151. package/dist/commonjs/sdk/sdk.d.ts +8 -0
  152. package/dist/commonjs/sdk/sdk.d.ts.map +1 -0
  153. package/dist/commonjs/sdk/sdk.js +19 -0
  154. package/dist/commonjs/sdk/sdk.js.map +1 -0
  155. package/dist/commonjs/types/async.d.ts +23 -0
  156. package/dist/commonjs/types/async.d.ts.map +1 -0
  157. package/dist/commonjs/types/async.js +44 -0
  158. package/dist/commonjs/types/async.js.map +1 -0
  159. package/dist/commonjs/types/blobs.d.ts +4 -0
  160. package/dist/commonjs/types/blobs.d.ts.map +1 -0
  161. package/dist/commonjs/types/blobs.js +62 -0
  162. package/dist/commonjs/types/blobs.js.map +1 -0
  163. package/dist/commonjs/types/constdatetime.d.ts +3 -0
  164. package/dist/commonjs/types/constdatetime.d.ts.map +1 -0
  165. package/dist/commonjs/types/constdatetime.js +46 -0
  166. package/dist/commonjs/types/constdatetime.js.map +1 -0
  167. package/dist/commonjs/types/enums.d.ts +12 -0
  168. package/dist/commonjs/types/enums.d.ts.map +1 -0
  169. package/dist/commonjs/types/enums.js +10 -0
  170. package/dist/commonjs/types/enums.js.map +1 -0
  171. package/dist/commonjs/types/fp.d.ts +31 -0
  172. package/dist/commonjs/types/fp.d.ts.map +1 -0
  173. package/dist/commonjs/types/fp.js +37 -0
  174. package/dist/commonjs/types/fp.js.map +1 -0
  175. package/dist/commonjs/types/index.d.ts +8 -0
  176. package/dist/commonjs/types/index.d.ts.map +1 -0
  177. package/dist/commonjs/types/index.js +16 -0
  178. package/dist/commonjs/types/index.js.map +1 -0
  179. package/dist/commonjs/types/operations.d.ts +27 -0
  180. package/dist/commonjs/types/operations.d.ts.map +1 -0
  181. package/dist/commonjs/types/operations.js +83 -0
  182. package/dist/commonjs/types/operations.js.map +1 -0
  183. package/dist/commonjs/types/rfcdate.d.ts +21 -0
  184. package/dist/commonjs/types/rfcdate.d.ts.map +1 -0
  185. package/dist/commonjs/types/rfcdate.js +46 -0
  186. package/dist/commonjs/types/rfcdate.js.map +1 -0
  187. package/dist/commonjs/types/streams.d.ts +2 -0
  188. package/dist/commonjs/types/streams.d.ts.map +1 -0
  189. package/dist/commonjs/types/streams.js +18 -0
  190. package/dist/commonjs/types/streams.js.map +1 -0
  191. package/dist/esm/__tests__/assertions.d.ts +2 -0
  192. package/dist/esm/__tests__/assertions.d.ts.map +1 -0
  193. package/dist/esm/__tests__/assertions.js +11 -0
  194. package/dist/esm/__tests__/assertions.js.map +1 -0
  195. package/dist/esm/__tests__/criblmgmtplane.test.d.ts +2 -0
  196. package/dist/esm/__tests__/criblmgmtplane.test.d.ts.map +1 -0
  197. package/dist/esm/__tests__/criblmgmtplane.test.js +16 -0
  198. package/dist/esm/__tests__/criblmgmtplane.test.js.map +1 -0
  199. package/dist/esm/__tests__/files.d.ts +6 -0
  200. package/dist/esm/__tests__/files.d.ts.map +1 -0
  201. package/dist/esm/__tests__/files.js +44 -0
  202. package/dist/esm/__tests__/files.js.map +1 -0
  203. package/dist/esm/__tests__/testclient.d.ts +3 -0
  204. package/dist/esm/__tests__/testclient.d.ts.map +1 -0
  205. package/dist/esm/__tests__/testclient.js +35 -0
  206. package/dist/esm/__tests__/testclient.js.map +1 -0
  207. package/dist/esm/core.d.ts +10 -0
  208. package/dist/esm/core.d.ts.map +1 -0
  209. package/dist/esm/core.js +13 -0
  210. package/dist/esm/core.js.map +1 -0
  211. package/dist/esm/funcs/dummyServiceStatus.d.ts +13 -0
  212. package/dist/esm/funcs/dummyServiceStatus.d.ts.map +1 -0
  213. package/dist/esm/funcs/dummyServiceStatus.js +65 -0
  214. package/dist/esm/funcs/dummyServiceStatus.js.map +1 -0
  215. package/dist/esm/hooks/hooks.d.ts +25 -0
  216. package/dist/esm/hooks/hooks.d.ts.map +1 -0
  217. package/dist/esm/hooks/hooks.js +82 -0
  218. package/dist/esm/hooks/hooks.js.map +1 -0
  219. package/dist/esm/hooks/index.d.ts +3 -0
  220. package/dist/esm/hooks/index.d.ts.map +1 -0
  221. package/dist/esm/hooks/index.js +6 -0
  222. package/dist/esm/hooks/index.js.map +1 -0
  223. package/dist/esm/hooks/registration.d.ts +3 -0
  224. package/dist/esm/hooks/registration.d.ts.map +1 -0
  225. package/dist/esm/hooks/registration.js +12 -0
  226. package/dist/esm/hooks/registration.js.map +1 -0
  227. package/dist/esm/hooks/types.d.ts +76 -0
  228. package/dist/esm/hooks/types.d.ts.map +1 -0
  229. package/dist/esm/hooks/types.js +5 -0
  230. package/dist/esm/hooks/types.js.map +1 -0
  231. package/dist/esm/index.d.ts +6 -0
  232. package/dist/esm/index.d.ts.map +1 -0
  233. package/dist/esm/index.js +8 -0
  234. package/dist/esm/index.js.map +1 -0
  235. package/dist/esm/lib/base64.d.ts +10 -0
  236. package/dist/esm/lib/base64.d.ts.map +1 -0
  237. package/dist/esm/lib/base64.js +29 -0
  238. package/dist/esm/lib/base64.js.map +1 -0
  239. package/dist/esm/lib/config.d.ts +38 -0
  240. package/dist/esm/lib/config.d.ts.map +1 -0
  241. package/dist/esm/lib/config.js +31 -0
  242. package/dist/esm/lib/config.js.map +1 -0
  243. package/dist/esm/lib/dlv.d.ts +14 -0
  244. package/dist/esm/lib/dlv.d.ts.map +1 -0
  245. package/dist/esm/lib/dlv.js +46 -0
  246. package/dist/esm/lib/dlv.js.map +1 -0
  247. package/dist/esm/lib/encodings.d.ts +52 -0
  248. package/dist/esm/lib/encodings.d.ts.map +1 -0
  249. package/dist/esm/lib/encodings.js +354 -0
  250. package/dist/esm/lib/encodings.js.map +1 -0
  251. package/dist/esm/lib/env.d.ts +15 -0
  252. package/dist/esm/lib/env.d.ts.map +1 -0
  253. package/dist/esm/lib/env.js +27 -0
  254. package/dist/esm/lib/env.js.map +1 -0
  255. package/dist/esm/lib/files.d.ts +13 -0
  256. package/dist/esm/lib/files.d.ts.map +1 -0
  257. package/dist/esm/lib/files.js +73 -0
  258. package/dist/esm/lib/files.js.map +1 -0
  259. package/dist/esm/lib/http.d.ts +67 -0
  260. package/dist/esm/lib/http.d.ts.map +1 -0
  261. package/dist/esm/lib/http.js +207 -0
  262. package/dist/esm/lib/http.js.map +1 -0
  263. package/dist/esm/lib/is-plain-object.d.ts +2 -0
  264. package/dist/esm/lib/is-plain-object.d.ts.map +1 -0
  265. package/dist/esm/lib/is-plain-object.js +38 -0
  266. package/dist/esm/lib/is-plain-object.js.map +1 -0
  267. package/dist/esm/lib/logger.d.ts +6 -0
  268. package/dist/esm/lib/logger.d.ts.map +1 -0
  269. package/dist/esm/lib/logger.js +5 -0
  270. package/dist/esm/lib/logger.js.map +1 -0
  271. package/dist/esm/lib/matchers.d.ts +59 -0
  272. package/dist/esm/lib/matchers.d.ts.map +1 -0
  273. package/dist/esm/lib/matchers.js +203 -0
  274. package/dist/esm/lib/matchers.js.map +1 -0
  275. package/dist/esm/lib/primitives.d.ts +26 -0
  276. package/dist/esm/lib/primitives.d.ts.map +1 -0
  277. package/dist/esm/lib/primitives.js +103 -0
  278. package/dist/esm/lib/primitives.js.map +1 -0
  279. package/dist/esm/lib/retries.d.ts +38 -0
  280. package/dist/esm/lib/retries.d.ts.map +1 -0
  281. package/dist/esm/lib/retries.js +147 -0
  282. package/dist/esm/lib/retries.js.map +1 -0
  283. package/dist/esm/lib/schemas.d.ts +19 -0
  284. package/dist/esm/lib/schemas.d.ts.map +1 -0
  285. package/dist/esm/lib/schemas.js +57 -0
  286. package/dist/esm/lib/schemas.js.map +1 -0
  287. package/dist/esm/lib/sdks.d.ts +63 -0
  288. package/dist/esm/lib/sdks.d.ts.map +1 -0
  289. package/dist/esm/lib/sdks.js +269 -0
  290. package/dist/esm/lib/sdks.js.map +1 -0
  291. package/dist/esm/lib/security.d.ts +83 -0
  292. package/dist/esm/lib/security.d.ts.map +1 -0
  293. package/dist/esm/lib/security.js +137 -0
  294. package/dist/esm/lib/security.js.map +1 -0
  295. package/dist/esm/lib/url.d.ts +5 -0
  296. package/dist/esm/lib/url.d.ts.map +1 -0
  297. package/dist/esm/lib/url.js +22 -0
  298. package/dist/esm/lib/url.js.map +1 -0
  299. package/dist/esm/models/errors/criblmgmtplanedefaulterror.d.ts +10 -0
  300. package/dist/esm/models/errors/criblmgmtplanedefaulterror.d.ts.map +1 -0
  301. package/dist/esm/models/errors/criblmgmtplanedefaulterror.js +30 -0
  302. package/dist/esm/models/errors/criblmgmtplanedefaulterror.js.map +1 -0
  303. package/dist/esm/models/errors/criblmgmtplaneerror.d.ts +19 -0
  304. package/dist/esm/models/errors/criblmgmtplaneerror.d.ts.map +1 -0
  305. package/dist/esm/models/errors/criblmgmtplaneerror.js +16 -0
  306. package/dist/esm/models/errors/criblmgmtplaneerror.js.map +1 -0
  307. package/dist/esm/models/errors/httpclienterrors.d.ts +44 -0
  308. package/dist/esm/models/errors/httpclienterrors.d.ts.map +1 -0
  309. package/dist/esm/models/errors/httpclienterrors.js +69 -0
  310. package/dist/esm/models/errors/httpclienterrors.js.map +1 -0
  311. package/dist/esm/models/errors/index.d.ts +5 -0
  312. package/dist/esm/models/errors/index.d.ts.map +1 -0
  313. package/dist/esm/models/errors/index.js +8 -0
  314. package/dist/esm/models/errors/index.js.map +1 -0
  315. package/dist/esm/models/errors/responsevalidationerror.d.ts +26 -0
  316. package/dist/esm/models/errors/responsevalidationerror.d.ts.map +1 -0
  317. package/dist/esm/models/errors/responsevalidationerror.js +29 -0
  318. package/dist/esm/models/errors/responsevalidationerror.js.map +1 -0
  319. package/dist/esm/models/errors/sdkvalidationerror.d.ts +21 -0
  320. package/dist/esm/models/errors/sdkvalidationerror.d.ts.map +1 -0
  321. package/dist/esm/models/errors/sdkvalidationerror.js +91 -0
  322. package/dist/esm/models/errors/sdkvalidationerror.js.map +1 -0
  323. package/dist/esm/models/index.d.ts +2 -0
  324. package/dist/esm/models/index.d.ts.map +1 -0
  325. package/dist/esm/models/index.js +5 -0
  326. package/dist/esm/models/index.js.map +1 -0
  327. package/dist/esm/models/security.d.ts +29 -0
  328. package/dist/esm/models/security.d.ts.map +1 -0
  329. package/dist/esm/models/security.js +31 -0
  330. package/dist/esm/models/security.js.map +1 -0
  331. package/dist/esm/package.json +3 -0
  332. package/dist/esm/sdk/index.d.ts +2 -0
  333. package/dist/esm/sdk/index.d.ts.map +1 -0
  334. package/dist/esm/sdk/index.js +5 -0
  335. package/dist/esm/sdk/index.js.map +1 -0
  336. package/dist/esm/sdk/sdk.d.ts +8 -0
  337. package/dist/esm/sdk/sdk.d.ts.map +1 -0
  338. package/dist/esm/sdk/sdk.js +15 -0
  339. package/dist/esm/sdk/sdk.js.map +1 -0
  340. package/dist/esm/types/async.d.ts +23 -0
  341. package/dist/esm/types/async.d.ts.map +1 -0
  342. package/dist/esm/types/async.js +40 -0
  343. package/dist/esm/types/async.js.map +1 -0
  344. package/dist/esm/types/blobs.d.ts +4 -0
  345. package/dist/esm/types/blobs.d.ts.map +1 -0
  346. package/dist/esm/types/blobs.js +25 -0
  347. package/dist/esm/types/blobs.js.map +1 -0
  348. package/dist/esm/types/constdatetime.d.ts +3 -0
  349. package/dist/esm/types/constdatetime.d.ts.map +1 -0
  350. package/dist/esm/types/constdatetime.js +10 -0
  351. package/dist/esm/types/constdatetime.js.map +1 -0
  352. package/dist/esm/types/enums.d.ts +12 -0
  353. package/dist/esm/types/enums.d.ts.map +1 -0
  354. package/dist/esm/types/enums.js +7 -0
  355. package/dist/esm/types/enums.js.map +1 -0
  356. package/dist/esm/types/fp.d.ts +31 -0
  357. package/dist/esm/types/fp.d.ts.map +1 -0
  358. package/dist/esm/types/fp.js +31 -0
  359. package/dist/esm/types/fp.js.map +1 -0
  360. package/dist/esm/types/index.d.ts +8 -0
  361. package/dist/esm/types/index.d.ts.map +1 -0
  362. package/dist/esm/types/index.js +8 -0
  363. package/dist/esm/types/index.js.map +1 -0
  364. package/dist/esm/types/operations.d.ts +27 -0
  365. package/dist/esm/types/operations.d.ts.map +1 -0
  366. package/dist/esm/types/operations.js +77 -0
  367. package/dist/esm/types/operations.js.map +1 -0
  368. package/dist/esm/types/rfcdate.d.ts +21 -0
  369. package/dist/esm/types/rfcdate.d.ts.map +1 -0
  370. package/dist/esm/types/rfcdate.js +42 -0
  371. package/dist/esm/types/rfcdate.js.map +1 -0
  372. package/dist/esm/types/streams.d.ts +2 -0
  373. package/dist/esm/types/streams.d.ts.map +1 -0
  374. package/dist/esm/types/streams.js +15 -0
  375. package/dist/esm/types/streams.js.map +1 -0
  376. package/docs/sdks/criblmgmtplane/README.md +78 -0
  377. package/examples/README.md +26 -0
  378. package/examples/dummyServiceStatus.example.ts +23 -0
  379. package/examples/package-lock.json +614 -0
  380. package/examples/package.json +18 -0
  381. package/jsr.json +27 -0
  382. package/package.json +115 -0
  383. package/src/__tests__/assertions.ts +13 -0
  384. package/src/__tests__/criblmgmtplane.test.ts +19 -0
  385. package/src/__tests__/files.ts +56 -0
  386. package/src/__tests__/mockserver/README.md +52 -0
  387. package/src/__tests__/testclient.ts +48 -0
  388. package/src/core.ts +13 -0
  389. package/src/funcs/dummyServiceStatus.ts +139 -0
  390. package/src/hooks/hooks.ts +132 -0
  391. package/src/hooks/index.ts +6 -0
  392. package/src/hooks/registration.ts +14 -0
  393. package/src/hooks/types.ts +107 -0
  394. package/src/index.ts +9 -0
  395. package/src/lib/base64.ts +37 -0
  396. package/src/lib/config.ts +64 -0
  397. package/src/lib/dlv.ts +53 -0
  398. package/src/lib/encodings.ts +483 -0
  399. package/src/lib/env.ts +41 -0
  400. package/src/lib/files.ts +82 -0
  401. package/src/lib/http.ts +323 -0
  402. package/src/lib/is-plain-object.ts +43 -0
  403. package/src/lib/logger.ts +9 -0
  404. package/src/lib/matchers.ts +358 -0
  405. package/src/lib/primitives.ts +150 -0
  406. package/src/lib/retries.ts +218 -0
  407. package/src/lib/schemas.ts +91 -0
  408. package/src/lib/sdks.ts +406 -0
  409. package/src/lib/security.ts +261 -0
  410. package/src/lib/url.ts +33 -0
  411. package/src/models/errors/criblmgmtplanedefaulterror.ts +40 -0
  412. package/src/models/errors/criblmgmtplaneerror.ts +35 -0
  413. package/src/models/errors/httpclienterrors.ts +62 -0
  414. package/src/models/errors/index.ts +8 -0
  415. package/src/models/errors/responsevalidationerror.ts +50 -0
  416. package/src/models/errors/sdkvalidationerror.ts +109 -0
  417. package/src/models/index.ts +5 -0
  418. package/src/models/security.ts +62 -0
  419. package/src/sdk/index.ts +5 -0
  420. package/src/sdk/sdk.ts +21 -0
  421. package/src/types/async.ts +68 -0
  422. package/src/types/blobs.ts +31 -0
  423. package/src/types/constdatetime.ts +15 -0
  424. package/src/types/enums.ts +16 -0
  425. package/src/types/fp.ts +50 -0
  426. package/src/types/index.ts +11 -0
  427. package/src/types/operations.ts +105 -0
  428. package/src/types/rfcdate.ts +54 -0
  429. package/src/types/streams.ts +21 -0
  430. package/tsconfig.json +41 -0
package/package.json ADDED
@@ -0,0 +1,115 @@
1
+ {
2
+ "name": "cribl-mgmt-plane",
3
+ "version": "0.0.2",
4
+ "author": "Speakeasy",
5
+ "type": "module",
6
+ "tshy": {
7
+ "sourceDialects": [
8
+ "cribl-mgmt-plane/source"
9
+ ],
10
+ "exports": {
11
+ ".": "./src/index.ts",
12
+ "./package.json": "./package.json",
13
+ "./types": "./src/types/index.ts",
14
+ "./models/errors": "./src/models/errors/index.ts",
15
+ "./models": "./src/models/index.ts",
16
+ "./*.js": "./src/*.ts",
17
+ "./*": "./src/*.ts"
18
+ }
19
+ },
20
+ "sideEffects": false,
21
+ "scripts": {
22
+ "test": "vitest run src --reporter=junit --outputFile=.speakeasy/reports/tests.xml --reporter=default",
23
+ "check": "npm run test && npm run lint",
24
+ "lint": "eslint --cache --max-warnings=0 src",
25
+ "build": "tshy",
26
+ "prepublishOnly": "npm run build"
27
+ },
28
+ "peerDependencies": {
29
+ "zod": "^3"
30
+ },
31
+ "devDependencies": {
32
+ "@eslint/js": "^9.19.0",
33
+ "@types/node": "^18.19.3",
34
+ "eslint": "^9.19.0",
35
+ "globals": "^15.14.0",
36
+ "tshy": "^2.0.0",
37
+ "typescript": "^5.4.5",
38
+ "typescript-eslint": "^8.22.0",
39
+ "vitest": "^3.0.2",
40
+ "zod": "^3.25.17"
41
+ },
42
+ "dependencies": {},
43
+ "exports": {
44
+ ".": {
45
+ "import": {
46
+ "cribl-mgmt-plane/source": "./src/index.ts",
47
+ "types": "./dist/esm/index.d.ts",
48
+ "default": "./dist/esm/index.js"
49
+ },
50
+ "require": {
51
+ "types": "./dist/commonjs/index.d.ts",
52
+ "default": "./dist/commonjs/index.js"
53
+ }
54
+ },
55
+ "./package.json": "./package.json",
56
+ "./types": {
57
+ "import": {
58
+ "cribl-mgmt-plane/source": "./src/types/index.ts",
59
+ "types": "./dist/esm/types/index.d.ts",
60
+ "default": "./dist/esm/types/index.js"
61
+ },
62
+ "require": {
63
+ "types": "./dist/commonjs/types/index.d.ts",
64
+ "default": "./dist/commonjs/types/index.js"
65
+ }
66
+ },
67
+ "./models/errors": {
68
+ "import": {
69
+ "cribl-mgmt-plane/source": "./src/models/errors/index.ts",
70
+ "types": "./dist/esm/models/errors/index.d.ts",
71
+ "default": "./dist/esm/models/errors/index.js"
72
+ },
73
+ "require": {
74
+ "types": "./dist/commonjs/models/errors/index.d.ts",
75
+ "default": "./dist/commonjs/models/errors/index.js"
76
+ }
77
+ },
78
+ "./models": {
79
+ "import": {
80
+ "cribl-mgmt-plane/source": "./src/models/index.ts",
81
+ "types": "./dist/esm/models/index.d.ts",
82
+ "default": "./dist/esm/models/index.js"
83
+ },
84
+ "require": {
85
+ "types": "./dist/commonjs/models/index.d.ts",
86
+ "default": "./dist/commonjs/models/index.js"
87
+ }
88
+ },
89
+ "./*.js": {
90
+ "import": {
91
+ "cribl-mgmt-plane/source": "./src/*.ts",
92
+ "types": "./dist/esm/*.d.ts",
93
+ "default": "./dist/esm/*.js"
94
+ },
95
+ "require": {
96
+ "types": "./dist/commonjs/*.d.ts",
97
+ "default": "./dist/commonjs/*.js"
98
+ }
99
+ },
100
+ "./*": {
101
+ "import": {
102
+ "cribl-mgmt-plane/source": "./src/*.ts",
103
+ "types": "./dist/esm/*.d.ts",
104
+ "default": "./dist/esm/*.js"
105
+ },
106
+ "require": {
107
+ "types": "./dist/commonjs/*.d.ts",
108
+ "default": "./dist/commonjs/*.js"
109
+ }
110
+ }
111
+ },
112
+ "main": "./dist/commonjs/index.js",
113
+ "types": "./dist/commonjs/index.d.ts",
114
+ "module": "./dist/esm/index.js"
115
+ }
@@ -0,0 +1,13 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { fail } from "assert";
6
+
7
+ export function assertDefined(value: any): any {
8
+ if (value === undefined) {
9
+ fail("value is undefined");
10
+ }
11
+
12
+ return value;
13
+ }
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { test } from "vitest";
6
+ import { CriblMgmtPlane } from "../index.js";
7
+ import { createTestHTTPClient } from "./testclient.js";
8
+
9
+ test("Criblmgmtplane Dummy Service Status", async () => {
10
+ const testHttpClient = createTestHTTPClient("dummyServiceStatus");
11
+
12
+ const criblMgmtPlane = new CriblMgmtPlane({
13
+ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080",
14
+ httpClient: testHttpClient,
15
+ bearerAuth: process.env["CRIBLMGMTPLANE_BEARER_AUTH"] ?? "value",
16
+ });
17
+
18
+ await criblMgmtPlane.dummyServiceStatus();
19
+ });
@@ -0,0 +1,56 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { createReadStream } from "node:fs";
6
+ import { readFile } from "node:fs/promises";
7
+ import { Readable } from "node:stream";
8
+
9
+ export function filesToStream(filePath: string): ReadableStream<Uint8Array> {
10
+ return Readable.toWeb(
11
+ createReadStream(filePath),
12
+ ) as unknown as ReadableStream<Uint8Array>;
13
+ }
14
+
15
+ export async function filesToByteArray(filePath: string): Promise<Uint8Array> {
16
+ return new Uint8Array(await readFile(filePath));
17
+ }
18
+
19
+ export async function filesToString(filePath: string): Promise<string> {
20
+ return readFile(filePath, "utf8");
21
+ }
22
+
23
+ export async function streamToByteArray(
24
+ stream?: ReadableStream<Uint8Array>,
25
+ ): Promise<Buffer> {
26
+ if (!stream) {
27
+ return Buffer.from("");
28
+ }
29
+
30
+ const chunks = [];
31
+ const reader = stream.getReader();
32
+
33
+ let done = false;
34
+ while (!done) {
35
+ const res = await reader.read();
36
+ done = res.done;
37
+ if (res.value) {
38
+ chunks.push(res.value);
39
+ }
40
+ }
41
+
42
+ return Buffer.concat(chunks);
43
+ }
44
+
45
+ export function bytesToStream(bytes: Uint8Array): ReadableStream<Uint8Array> {
46
+ return new ReadableStream({
47
+ start(controller) {
48
+ controller.enqueue(bytes);
49
+ },
50
+ pull(controller) {
51
+ controller.close();
52
+ },
53
+ cancel() {
54
+ },
55
+ });
56
+ }
@@ -0,0 +1,52 @@
1
+ # Mock Server
2
+
3
+ A generated HTTP mock server based on your OpenAPI Specification (OAS). Use this mock server for integration and contract testing.
4
+
5
+ ## Usage
6
+
7
+ The server can be built and started via the [Go programming language toolchain](https://go.dev/) or [Docker](https://www.docker.com/).
8
+
9
+ If you have Go installed, start the server directly via:
10
+
11
+ ```shell
12
+ go run .
13
+ ```
14
+
15
+ Otherwise, if you have Docker installed, build and run the server via:
16
+
17
+ ```shell
18
+ docker build -t mockserver .
19
+ docker run -i -p 18080:18080 -t --rm mockserver
20
+ ```
21
+
22
+ By default, the server runs on port `18080`.
23
+
24
+ ### Server Paths
25
+
26
+ The server contains generated paths from the OAS and the following additional built-in paths.
27
+
28
+ | Path | Description |
29
+ |---|---|
30
+ | [`/_mockserver/health`](https://localhost:18080/_mockserver/health) | verify server is running |
31
+ | [`/_mockserver/log`](https://localhost:18080/_mockserver/log) | view per-OAS-operation logs |
32
+
33
+ Any request outside the generated and built-in paths will return a `404 Not Found` response.
34
+
35
+ ### Server Customization
36
+
37
+ The server supports the following flags for customization.
38
+
39
+ | Flag | Default | Description |
40
+ |---|---|---|
41
+ | `-address` | `:18080` | server listen address |
42
+ | `-log-format` | `text` | logging format (supported: `JSON`, `text`) |
43
+ | `-log-level` | `INFO` | logging level (supported: `DEBUG`, `INFO`, `WARN`, `ERROR`) |
44
+
45
+ For example, enabling server debug logging:
46
+
47
+ ```shell
48
+ # via `go run`
49
+ go run . -log-level=DEBUG
50
+ # via `docker run`
51
+ docker run -i -p 18080:18080 -t --rm mockserver -log-level=DEBUG
52
+ ```
@@ -0,0 +1,48 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { getRandomValues } from "crypto";
6
+ import { HTTPClient } from "../lib/http.js";
7
+
8
+ export function createTestHTTPClient(testName: string): HTTPClient {
9
+ const httpClient = new HTTPClient({
10
+ fetcher: (request: URL | RequestInfo) => {
11
+ return fetch(request);
12
+ },
13
+ });
14
+
15
+ const testInstanceId = genTestId();
16
+
17
+ httpClient.addHook("beforeRequest", (request: Request) => {
18
+ const nextRequest = new Request(request, {
19
+ signal: request.signal || AbortSignal.timeout(5000),
20
+ });
21
+
22
+ nextRequest.headers.set("x-speakeasy-test-name", testName);
23
+ nextRequest.headers.set("x-speakeasy-test-instance-id", testInstanceId);
24
+
25
+ return nextRequest;
26
+ });
27
+
28
+ return httpClient;
29
+ }
30
+
31
+ function genTestId(): string {
32
+ const b = new Uint8Array(16);
33
+ getRandomValues(b);
34
+
35
+ return `${buf2hex(b.slice(0, 4))}-${buf2hex(b.slice(4, 6))}-${
36
+ buf2hex(
37
+ b.slice(6, 8),
38
+ )
39
+ }-${buf2hex(b.slice(8, 10))}-${buf2hex(b.slice(10))}`;
40
+ }
41
+
42
+ // Helper function to convert buffer to hex string
43
+ function buf2hex(buffer: Uint8Array): string {
44
+ return [...buffer]
45
+ .map((x) => x.toString(16).padStart(2, "0"))
46
+ .join("")
47
+ .toUpperCase();
48
+ }
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 CriblMgmtPlaneCore extends ClientSDK {}
@@ -0,0 +1,139 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { CriblMgmtPlaneCore } from "../core.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { RequestOptions } from "../lib/sdks.js";
10
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
11
+ import { pathToFunc } from "../lib/url.js";
12
+ import { CriblMgmtPlaneError } from "../models/errors/criblmgmtplaneerror.js";
13
+ import {
14
+ ConnectionError,
15
+ InvalidRequestError,
16
+ RequestAbortedError,
17
+ RequestTimeoutError,
18
+ UnexpectedClientError,
19
+ } from "../models/errors/httpclienterrors.js";
20
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
21
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
22
+ import { APICall, APIPromise } from "../types/async.js";
23
+ import { Result } from "../types/fp.js";
24
+
25
+ /**
26
+ * Service status
27
+ */
28
+ export function dummyServiceStatus(
29
+ client: CriblMgmtPlaneCore,
30
+ options?: RequestOptions,
31
+ ): APIPromise<
32
+ Result<
33
+ void,
34
+ | CriblMgmtPlaneError
35
+ | ResponseValidationError
36
+ | ConnectionError
37
+ | RequestAbortedError
38
+ | RequestTimeoutError
39
+ | InvalidRequestError
40
+ | UnexpectedClientError
41
+ | SDKValidationError
42
+ >
43
+ > {
44
+ return new APIPromise($do(
45
+ client,
46
+ options,
47
+ ));
48
+ }
49
+
50
+ async function $do(
51
+ client: CriblMgmtPlaneCore,
52
+ options?: RequestOptions,
53
+ ): Promise<
54
+ [
55
+ Result<
56
+ void,
57
+ | CriblMgmtPlaneError
58
+ | ResponseValidationError
59
+ | ConnectionError
60
+ | RequestAbortedError
61
+ | RequestTimeoutError
62
+ | InvalidRequestError
63
+ | UnexpectedClientError
64
+ | SDKValidationError
65
+ >,
66
+ APICall,
67
+ ]
68
+ > {
69
+ const path = pathToFunc("/status")();
70
+
71
+ const headers = new Headers(compactMap({
72
+ Accept: "*/*",
73
+ }));
74
+
75
+ const secConfig = await extractSecurity(client._options.bearerAuth);
76
+ const securityInput = secConfig == null ? {} : { bearerAuth: secConfig };
77
+ const requestSecurity = resolveGlobalSecurity(securityInput);
78
+
79
+ const context = {
80
+ options: client._options,
81
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
82
+ operationID: "dummyServiceStatus",
83
+ oAuth2Scopes: [],
84
+
85
+ resolvedSecurity: requestSecurity,
86
+
87
+ securitySource: client._options.bearerAuth,
88
+ retryConfig: options?.retries
89
+ || client._options.retryConfig
90
+ || { strategy: "none" },
91
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
92
+ };
93
+
94
+ const requestRes = client._createRequest(context, {
95
+ security: requestSecurity,
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", "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 [result] = await M.match<
120
+ void,
121
+ | CriblMgmtPlaneError
122
+ | ResponseValidationError
123
+ | ConnectionError
124
+ | RequestAbortedError
125
+ | RequestTimeoutError
126
+ | InvalidRequestError
127
+ | UnexpectedClientError
128
+ | SDKValidationError
129
+ >(
130
+ M.nil(200, z.void()),
131
+ M.fail("4XX"),
132
+ M.fail("5XX"),
133
+ )(response, req);
134
+ if (!result.ok) {
135
+ return [result, { status: "complete", request: req, response }];
136
+ }
137
+
138
+ return [result, { status: "complete", request: req, response }];
139
+ }
@@ -0,0 +1,132 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { SDKOptions } from "../lib/config.js";
6
+ import { RequestInput } from "../lib/http.js";
7
+ import {
8
+ AfterErrorContext,
9
+ AfterErrorHook,
10
+ AfterSuccessContext,
11
+ AfterSuccessHook,
12
+ BeforeCreateRequestContext,
13
+ BeforeCreateRequestHook,
14
+ BeforeRequestContext,
15
+ BeforeRequestHook,
16
+ Hook,
17
+ Hooks,
18
+ SDKInitHook,
19
+ } from "./types.js";
20
+
21
+ import { initHooks } from "./registration.js";
22
+
23
+ export class SDKHooks implements Hooks {
24
+ sdkInitHooks: SDKInitHook[] = [];
25
+ beforeCreateRequestHooks: BeforeCreateRequestHook[] = [];
26
+ beforeRequestHooks: BeforeRequestHook[] = [];
27
+ afterSuccessHooks: AfterSuccessHook[] = [];
28
+ afterErrorHooks: AfterErrorHook[] = [];
29
+
30
+ constructor() {
31
+ const presetHooks: Array<Hook> = [];
32
+
33
+ for (const hook of presetHooks) {
34
+ if ("sdkInit" in hook) {
35
+ this.registerSDKInitHook(hook);
36
+ }
37
+ if ("beforeCreateRequest" in hook) {
38
+ this.registerBeforeCreateRequestHook(hook);
39
+ }
40
+ if ("beforeRequest" in hook) {
41
+ this.registerBeforeRequestHook(hook);
42
+ }
43
+ if ("afterSuccess" in hook) {
44
+ this.registerAfterSuccessHook(hook);
45
+ }
46
+ if ("afterError" in hook) {
47
+ this.registerAfterErrorHook(hook);
48
+ }
49
+ }
50
+ initHooks(this);
51
+ }
52
+
53
+ registerSDKInitHook(hook: SDKInitHook) {
54
+ this.sdkInitHooks.push(hook);
55
+ }
56
+
57
+ registerBeforeCreateRequestHook(hook: BeforeCreateRequestHook) {
58
+ this.beforeCreateRequestHooks.push(hook);
59
+ }
60
+
61
+ registerBeforeRequestHook(hook: BeforeRequestHook) {
62
+ this.beforeRequestHooks.push(hook);
63
+ }
64
+
65
+ registerAfterSuccessHook(hook: AfterSuccessHook) {
66
+ this.afterSuccessHooks.push(hook);
67
+ }
68
+
69
+ registerAfterErrorHook(hook: AfterErrorHook) {
70
+ this.afterErrorHooks.push(hook);
71
+ }
72
+
73
+ sdkInit(opts: SDKOptions): SDKOptions {
74
+ return this.sdkInitHooks.reduce((opts, hook) => hook.sdkInit(opts), opts);
75
+ }
76
+
77
+ beforeCreateRequest(
78
+ hookCtx: BeforeCreateRequestContext,
79
+ input: RequestInput,
80
+ ): RequestInput {
81
+ let inp = input;
82
+
83
+ for (const hook of this.beforeCreateRequestHooks) {
84
+ inp = hook.beforeCreateRequest(hookCtx, inp);
85
+ }
86
+
87
+ return inp;
88
+ }
89
+
90
+ async beforeRequest(
91
+ hookCtx: BeforeRequestContext,
92
+ request: Request,
93
+ ): Promise<Request> {
94
+ let req = request;
95
+
96
+ for (const hook of this.beforeRequestHooks) {
97
+ req = await hook.beforeRequest(hookCtx, req);
98
+ }
99
+
100
+ return req;
101
+ }
102
+
103
+ async afterSuccess(
104
+ hookCtx: AfterSuccessContext,
105
+ response: Response,
106
+ ): Promise<Response> {
107
+ let res = response;
108
+
109
+ for (const hook of this.afterSuccessHooks) {
110
+ res = await hook.afterSuccess(hookCtx, res);
111
+ }
112
+
113
+ return res;
114
+ }
115
+
116
+ async afterError(
117
+ hookCtx: AfterErrorContext,
118
+ response: Response | null,
119
+ error: unknown,
120
+ ): Promise<{ response: Response | null; error: unknown }> {
121
+ let res = response;
122
+ let err = error;
123
+
124
+ for (const hook of this.afterErrorHooks) {
125
+ const result = await hook.afterError(hookCtx, res, err);
126
+ res = result.response;
127
+ err = result.error;
128
+ }
129
+
130
+ return { response: res, error: err };
131
+ }
132
+ }
@@ -0,0 +1,6 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ export * from "./hooks.js";
6
+ export * from "./types.js";
@@ -0,0 +1,14 @@
1
+ import { Hooks } from "./types.js";
2
+
3
+ /*
4
+ * This file is only ever generated once on the first generation and then is free to be modified.
5
+ * Any hooks you wish to add should be registered in the initHooks function. Feel free to define them
6
+ * in this file or in separate files in the hooks folder.
7
+ */
8
+
9
+ // @ts-expect-error remove this line when you add your first hook and hooks is used
10
+ export function initHooks(hooks: Hooks) {
11
+ // Add hooks by calling hooks.register{ClientInit/BeforeCreateRequest/BeforeRequest/AfterSuccess/AfterError}Hook
12
+ // with an instance of a hook that implements that specific Hook interface
13
+ // Hooks are registered per SDK instance, and are valid for the lifetime of the SDK instance
14
+ }