@greensecurity/javascript-sdk 0.9.1

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 (432) hide show
  1. package/.devcontainer/README.md +35 -0
  2. package/.devcontainer/devcontainer.json +45 -0
  3. package/FUNCTIONS.md +109 -0
  4. package/REACT_QUERY.md +318 -0
  5. package/README.md +561 -0
  6. package/RUNTIMES.md +48 -0
  7. package/core.d.ts +10 -0
  8. package/core.d.ts.map +1 -0
  9. package/core.js +17 -0
  10. package/core.js.map +1 -0
  11. package/docs/sdks/greensecurity/README.md +14 -0
  12. package/docs/sdks/organizations/README.md +252 -0
  13. package/docs/sdks/user/README.md +348 -0
  14. package/docs/sdks/vendors/README.md +219 -0
  15. package/funcs/organizationsGetFacility.d.ts +17 -0
  16. package/funcs/organizationsGetFacility.d.ts.map +1 -0
  17. package/funcs/organizationsGetFacility.js +117 -0
  18. package/funcs/organizationsGetFacility.js.map +1 -0
  19. package/funcs/organizationsListOrSearchFacilities.d.ts +28 -0
  20. package/funcs/organizationsListOrSearchFacilities.d.ts.map +1 -0
  21. package/funcs/organizationsListOrSearchFacilities.js +131 -0
  22. package/funcs/organizationsListOrSearchFacilities.js.map +1 -0
  23. package/funcs/userGetCurrentUser.d.ts +16 -0
  24. package/funcs/userGetCurrentUser.d.ts.map +1 -0
  25. package/funcs/userGetCurrentUser.js +101 -0
  26. package/funcs/userGetCurrentUser.js.map +1 -0
  27. package/funcs/userGetUserById.d.ts +17 -0
  28. package/funcs/userGetUserById.d.ts.map +1 -0
  29. package/funcs/userGetUserById.js +117 -0
  30. package/funcs/userGetUserById.js.map +1 -0
  31. package/funcs/userLogsUserIntoTheSystem.d.ts +46 -0
  32. package/funcs/userLogsUserIntoTheSystem.d.ts.map +1 -0
  33. package/funcs/userLogsUserIntoTheSystem.js +137 -0
  34. package/funcs/userLogsUserIntoTheSystem.js.map +1 -0
  35. package/funcs/vendorsCreateVendorRegistration.d.ts +16 -0
  36. package/funcs/vendorsCreateVendorRegistration.d.ts.map +1 -0
  37. package/funcs/vendorsCreateVendorRegistration.js +107 -0
  38. package/funcs/vendorsCreateVendorRegistration.js.map +1 -0
  39. package/funcs/vendorsListVendorJobTitles.d.ts +16 -0
  40. package/funcs/vendorsListVendorJobTitles.d.ts.map +1 -0
  41. package/funcs/vendorsListVendorJobTitles.js +114 -0
  42. package/funcs/vendorsListVendorJobTitles.js.map +1 -0
  43. package/hooks/hooks.d.ts +24 -0
  44. package/hooks/hooks.d.ts.map +1 -0
  45. package/hooks/hooks.js +86 -0
  46. package/hooks/hooks.js.map +1 -0
  47. package/hooks/index.d.ts +3 -0
  48. package/hooks/index.d.ts.map +1 -0
  49. package/hooks/index.js +22 -0
  50. package/hooks/index.js.map +1 -0
  51. package/hooks/registration.d.ts +3 -0
  52. package/hooks/registration.d.ts.map +1 -0
  53. package/hooks/registration.js +15 -0
  54. package/hooks/registration.js.map +1 -0
  55. package/hooks/types.d.ts +78 -0
  56. package/hooks/types.d.ts.map +1 -0
  57. package/hooks/types.js +6 -0
  58. package/hooks/types.js.map +1 -0
  59. package/index.d.ts +4 -0
  60. package/index.d.ts.map +1 -0
  61. package/index.js +46 -0
  62. package/index.js.map +1 -0
  63. package/jsr.json +27 -0
  64. package/lib/base64.d.ts +10 -0
  65. package/lib/base64.d.ts.map +1 -0
  66. package/lib/base64.js +71 -0
  67. package/lib/base64.js.map +1 -0
  68. package/lib/config.d.ts +38 -0
  69. package/lib/config.d.ts.map +1 -0
  70. package/lib/config.js +46 -0
  71. package/lib/config.js.map +1 -0
  72. package/lib/dlv.d.ts +14 -0
  73. package/lib/dlv.d.ts.map +1 -0
  74. package/lib/dlv.js +49 -0
  75. package/lib/dlv.js.map +1 -0
  76. package/lib/encodings.d.ts +52 -0
  77. package/lib/encodings.d.ts.map +1 -0
  78. package/lib/encodings.js +368 -0
  79. package/lib/encodings.js.map +1 -0
  80. package/lib/env.d.ts +16 -0
  81. package/lib/env.d.ts.map +1 -0
  82. package/lib/env.js +66 -0
  83. package/lib/env.js.map +1 -0
  84. package/lib/files.d.ts +8 -0
  85. package/lib/files.d.ts.map +1 -0
  86. package/lib/files.js +36 -0
  87. package/lib/files.js.map +1 -0
  88. package/lib/http.d.ts +67 -0
  89. package/lib/http.d.ts.map +1 -0
  90. package/lib/http.js +217 -0
  91. package/lib/http.js.map +1 -0
  92. package/lib/is-plain-object.d.ts +2 -0
  93. package/lib/is-plain-object.d.ts.map +1 -0
  94. package/lib/is-plain-object.js +41 -0
  95. package/lib/is-plain-object.js.map +1 -0
  96. package/lib/logger.d.ts +6 -0
  97. package/lib/logger.d.ts.map +1 -0
  98. package/lib/logger.js +6 -0
  99. package/lib/logger.js.map +1 -0
  100. package/lib/matchers.d.ts +64 -0
  101. package/lib/matchers.d.ts.map +1 -0
  102. package/lib/matchers.js +204 -0
  103. package/lib/matchers.js.map +1 -0
  104. package/lib/primitives.d.ts +23 -0
  105. package/lib/primitives.d.ts.map +1 -0
  106. package/lib/primitives.js +104 -0
  107. package/lib/primitives.js.map +1 -0
  108. package/lib/retries.d.ts +38 -0
  109. package/lib/retries.d.ts.map +1 -0
  110. package/lib/retries.js +153 -0
  111. package/lib/retries.js.map +1 -0
  112. package/lib/schemas.d.ts +19 -0
  113. package/lib/schemas.d.ts.map +1 -0
  114. package/lib/schemas.js +62 -0
  115. package/lib/schemas.js.map +1 -0
  116. package/lib/sdks.d.ts +60 -0
  117. package/lib/sdks.d.ts.map +1 -0
  118. package/lib/sdks.js +280 -0
  119. package/lib/sdks.js.map +1 -0
  120. package/lib/security.d.ts +82 -0
  121. package/lib/security.d.ts.map +1 -0
  122. package/lib/security.js +145 -0
  123. package/lib/security.js.map +1 -0
  124. package/lib/url.d.ts +5 -0
  125. package/lib/url.d.ts.map +1 -0
  126. package/lib/url.js +25 -0
  127. package/lib/url.js.map +1 -0
  128. package/models/components/contact.d.ts +135 -0
  129. package/models/components/contact.d.ts.map +1 -0
  130. package/models/components/contact.js +172 -0
  131. package/models/components/contact.js.map +1 -0
  132. package/models/components/departmentsummary.d.ts +34 -0
  133. package/models/components/departmentsummary.d.ts.map +1 -0
  134. package/models/components/departmentsummary.js +71 -0
  135. package/models/components/departmentsummary.js.map +1 -0
  136. package/models/components/desc.d.ts +25 -0
  137. package/models/components/desc.d.ts.map +1 -0
  138. package/models/components/desc.js +66 -0
  139. package/models/components/desc.js.map +1 -0
  140. package/models/components/expand.d.ts +79 -0
  141. package/models/components/expand.d.ts.map +1 -0
  142. package/models/components/expand.js +79 -0
  143. package/models/components/expand.js.map +1 -0
  144. package/models/components/facility.d.ts +544 -0
  145. package/models/components/facility.d.ts.map +1 -0
  146. package/models/components/facility.js +797 -0
  147. package/models/components/facility.js.map +1 -0
  148. package/models/components/facilitysummary.d.ts +34 -0
  149. package/models/components/facilitysummary.d.ts.map +1 -0
  150. package/models/components/facilitysummary.js +71 -0
  151. package/models/components/facilitysummary.js.map +1 -0
  152. package/models/components/imageset.d.ts +38 -0
  153. package/models/components/imageset.d.ts.map +1 -0
  154. package/models/components/imageset.js +75 -0
  155. package/models/components/imageset.js.map +1 -0
  156. package/models/components/index.d.ts +20 -0
  157. package/models/components/index.d.ts.map +1 -0
  158. package/models/components/index.js +39 -0
  159. package/models/components/index.js.map +1 -0
  160. package/models/components/loginemailandpassword.d.ts +45 -0
  161. package/models/components/loginemailandpassword.d.ts.map +1 -0
  162. package/models/components/loginemailandpassword.js +82 -0
  163. package/models/components/loginemailandpassword.js.map +1 -0
  164. package/models/components/loginrequirementsfromemail.d.ts +40 -0
  165. package/models/components/loginrequirementsfromemail.d.ts.map +1 -0
  166. package/models/components/loginrequirementsfromemail.js +80 -0
  167. package/models/components/loginrequirementsfromemail.js.map +1 -0
  168. package/models/components/mfarequiredresponse.d.ts +98 -0
  169. package/models/components/mfarequiredresponse.d.ts.map +1 -0
  170. package/models/components/mfarequiredresponse.js +126 -0
  171. package/models/components/mfarequiredresponse.js.map +1 -0
  172. package/models/components/pager.d.ts +69 -0
  173. package/models/components/pager.d.ts.map +1 -0
  174. package/models/components/pager.js +97 -0
  175. package/models/components/pager.js.map +1 -0
  176. package/models/components/passwordrequiredresponse.d.ts +62 -0
  177. package/models/components/passwordrequiredresponse.d.ts.map +1 -0
  178. package/models/components/passwordrequiredresponse.js +92 -0
  179. package/models/components/passwordrequiredresponse.js.map +1 -0
  180. package/models/components/samlloginrequiredresponse.d.ts +73 -0
  181. package/models/components/samlloginrequiredresponse.d.ts.map +1 -0
  182. package/models/components/samlloginrequiredresponse.js +106 -0
  183. package/models/components/samlloginrequiredresponse.js.map +1 -0
  184. package/models/components/security.d.ts +31 -0
  185. package/models/components/security.d.ts.map +1 -0
  186. package/models/components/security.js +80 -0
  187. package/models/components/security.js.map +1 -0
  188. package/models/components/status.d.ts +37 -0
  189. package/models/components/status.d.ts.map +1 -0
  190. package/models/components/status.js +65 -0
  191. package/models/components/status.js.map +1 -0
  192. package/models/components/systemsummary.d.ts +34 -0
  193. package/models/components/systemsummary.d.ts.map +1 -0
  194. package/models/components/systemsummary.js +71 -0
  195. package/models/components/systemsummary.js.map +1 -0
  196. package/models/components/user.d.ts +265 -0
  197. package/models/components/user.d.ts.map +1 -0
  198. package/models/components/user.js +284 -0
  199. package/models/components/user.js.map +1 -0
  200. package/models/components/vendorjobtitle.d.ts +41 -0
  201. package/models/components/vendorjobtitle.d.ts.map +1 -0
  202. package/models/components/vendorjobtitle.js +71 -0
  203. package/models/components/vendorjobtitle.js.map +1 -0
  204. package/models/components/vendortype.d.ts +69 -0
  205. package/models/components/vendortype.d.ts.map +1 -0
  206. package/models/components/vendortype.js +135 -0
  207. package/models/components/vendortype.js.map +1 -0
  208. package/models/errors/apierror.d.ts +8 -0
  209. package/models/errors/apierror.d.ts.map +1 -0
  210. package/models/errors/apierror.js +21 -0
  211. package/models/errors/apierror.js.map +1 -0
  212. package/models/errors/apierrorresponse.d.ts +51 -0
  213. package/models/errors/apierrorresponse.d.ts.map +1 -0
  214. package/models/errors/apierrorresponse.js +91 -0
  215. package/models/errors/apierrorresponse.js.map +1 -0
  216. package/models/errors/httpclienterrors.d.ts +44 -0
  217. package/models/errors/httpclienterrors.d.ts.map +1 -0
  218. package/models/errors/httpclienterrors.js +78 -0
  219. package/models/errors/httpclienterrors.js.map +1 -0
  220. package/models/errors/index.d.ts +5 -0
  221. package/models/errors/index.d.ts.map +1 -0
  222. package/models/errors/index.js +24 -0
  223. package/models/errors/index.js.map +1 -0
  224. package/models/errors/sdkvalidationerror.d.ts +20 -0
  225. package/models/errors/sdkvalidationerror.d.ts.map +1 -0
  226. package/models/errors/sdkvalidationerror.js +115 -0
  227. package/models/errors/sdkvalidationerror.js.map +1 -0
  228. package/models/operations/createvendorregistration.d.ts +115 -0
  229. package/models/operations/createvendorregistration.d.ts.map +1 -0
  230. package/models/operations/createvendorregistration.js +143 -0
  231. package/models/operations/createvendorregistration.js.map +1 -0
  232. package/models/operations/getfacility.d.ts +32 -0
  233. package/models/operations/getfacility.d.ts.map +1 -0
  234. package/models/operations/getfacility.js +69 -0
  235. package/models/operations/getfacility.js.map +1 -0
  236. package/models/operations/getuserbyid.d.ts +32 -0
  237. package/models/operations/getuserbyid.d.ts.map +1 -0
  238. package/models/operations/getuserbyid.js +69 -0
  239. package/models/operations/getuserbyid.js.map +1 -0
  240. package/models/operations/index.d.ts +7 -0
  241. package/models/operations/index.d.ts.map +1 -0
  242. package/models/operations/index.js +26 -0
  243. package/models/operations/index.js.map +1 -0
  244. package/models/operations/listorsearchfacilities.d.ts +110 -0
  245. package/models/operations/listorsearchfacilities.d.ts.map +1 -0
  246. package/models/operations/listorsearchfacilities.js +130 -0
  247. package/models/operations/listorsearchfacilities.js.map +1 -0
  248. package/models/operations/listvendorjobtitles.d.ts +86 -0
  249. package/models/operations/listvendorjobtitles.d.ts.map +1 -0
  250. package/models/operations/listvendorjobtitles.js +118 -0
  251. package/models/operations/listvendorjobtitles.js.map +1 -0
  252. package/models/operations/logsuserintothesystem.d.ts +98 -0
  253. package/models/operations/logsuserintothesystem.d.ts.map +1 -0
  254. package/models/operations/logsuserintothesystem.js +164 -0
  255. package/models/operations/logsuserintothesystem.js.map +1 -0
  256. package/package.json +41 -0
  257. package/react-query/_context.d.ts +8 -0
  258. package/react-query/_context.d.ts.map +1 -0
  259. package/react-query/_context.js +21 -0
  260. package/react-query/_context.js.map +1 -0
  261. package/react-query/_types.d.ts +14 -0
  262. package/react-query/_types.d.ts.map +1 -0
  263. package/react-query/_types.js +6 -0
  264. package/react-query/_types.js.map +1 -0
  265. package/react-query/index.d.ts +10 -0
  266. package/react-query/index.d.ts.map +1 -0
  267. package/react-query/index.js +32 -0
  268. package/react-query/index.js.map +1 -0
  269. package/react-query/organizationsGetFacility.d.ts +31 -0
  270. package/react-query/organizationsGetFacility.d.ts.map +1 -0
  271. package/react-query/organizationsGetFacility.js +87 -0
  272. package/react-query/organizationsGetFacility.js.map +1 -0
  273. package/react-query/organizationsListOrSearchFacilities.d.ts +91 -0
  274. package/react-query/organizationsListOrSearchFacilities.d.ts.map +1 -0
  275. package/react-query/organizationsListOrSearchFacilities.js +132 -0
  276. package/react-query/organizationsListOrSearchFacilities.js.map +1 -0
  277. package/react-query/userGetCurrentUser.d.ts +29 -0
  278. package/react-query/userGetCurrentUser.d.ts.map +1 -0
  279. package/react-query/userGetCurrentUser.js +75 -0
  280. package/react-query/userGetCurrentUser.js.map +1 -0
  281. package/react-query/userGetUserById.d.ts +31 -0
  282. package/react-query/userGetUserById.d.ts.map +1 -0
  283. package/react-query/userGetUserById.js +87 -0
  284. package/react-query/userGetUserById.js.map +1 -0
  285. package/react-query/userLogsUserIntoTheSystem.d.ts +53 -0
  286. package/react-query/userLogsUserIntoTheSystem.d.ts.map +1 -0
  287. package/react-query/userLogsUserIntoTheSystem.js +77 -0
  288. package/react-query/userLogsUserIntoTheSystem.js.map +1 -0
  289. package/react-query/vendorsCreateVendorRegistration.d.ts +23 -0
  290. package/react-query/vendorsCreateVendorRegistration.d.ts.map +1 -0
  291. package/react-query/vendorsCreateVendorRegistration.js +51 -0
  292. package/react-query/vendorsCreateVendorRegistration.js.map +1 -0
  293. package/react-query/vendorsListVendorJobTitles.d.ts +53 -0
  294. package/react-query/vendorsListVendorJobTitles.d.ts.map +1 -0
  295. package/react-query/vendorsListVendorJobTitles.js +102 -0
  296. package/react-query/vendorsListVendorJobTitles.js.map +1 -0
  297. package/sdk/index.d.ts +2 -0
  298. package/sdk/index.d.ts.map +1 -0
  299. package/sdk/index.js +21 -0
  300. package/sdk/index.js.map +1 -0
  301. package/sdk/organizations.d.ts +33 -0
  302. package/sdk/organizations.d.ts.map +1 -0
  303. package/sdk/organizations.js +45 -0
  304. package/sdk/organizations.js.map +1 -0
  305. package/sdk/sdk.d.ts +13 -0
  306. package/sdk/sdk.d.ts.map +1 -0
  307. package/sdk/sdk.js +23 -0
  308. package/sdk/sdk.js.map +1 -0
  309. package/sdk/user.d.ts +57 -0
  310. package/sdk/user.d.ts.map +1 -0
  311. package/sdk/user.js +72 -0
  312. package/sdk/user.js.map +1 -0
  313. package/sdk/vendors.d.ts +19 -0
  314. package/sdk/vendors.d.ts.map +1 -0
  315. package/sdk/vendors.js +32 -0
  316. package/sdk/vendors.js.map +1 -0
  317. package/src/core.ts +13 -0
  318. package/src/funcs/organizationsGetFacility.ts +144 -0
  319. package/src/funcs/organizationsListOrSearchFacilities.ts +152 -0
  320. package/src/funcs/userGetCurrentUser.ts +118 -0
  321. package/src/funcs/userGetUserById.ts +141 -0
  322. package/src/funcs/userLogsUserIntoTheSystem.ts +161 -0
  323. package/src/funcs/vendorsCreateVendorRegistration.ts +132 -0
  324. package/src/funcs/vendorsListVendorJobTitles.ts +141 -0
  325. package/src/hooks/hooks.ts +132 -0
  326. package/src/hooks/index.ts +6 -0
  327. package/src/hooks/registration.ts +14 -0
  328. package/src/hooks/types.ts +110 -0
  329. package/src/index.ts +7 -0
  330. package/src/lib/base64.ts +37 -0
  331. package/src/lib/config.ts +76 -0
  332. package/src/lib/dlv.ts +53 -0
  333. package/src/lib/encodings.ts +483 -0
  334. package/src/lib/env.ts +43 -0
  335. package/src/lib/files.ts +40 -0
  336. package/src/lib/http.ts +323 -0
  337. package/src/lib/is-plain-object.ts +43 -0
  338. package/src/lib/logger.ts +9 -0
  339. package/src/lib/matchers.ts +322 -0
  340. package/src/lib/primitives.ts +136 -0
  341. package/src/lib/retries.ts +218 -0
  342. package/src/lib/schemas.ts +91 -0
  343. package/src/lib/sdks.ts +400 -0
  344. package/src/lib/security.ts +260 -0
  345. package/src/lib/url.ts +33 -0
  346. package/src/models/components/contact.ts +268 -0
  347. package/src/models/components/departmentsummary.ts +73 -0
  348. package/src/models/components/desc.ts +48 -0
  349. package/src/models/components/expand.ts +52 -0
  350. package/src/models/components/facility.ts +1334 -0
  351. package/src/models/components/facilitysummary.ts +71 -0
  352. package/src/models/components/imageset.ts +77 -0
  353. package/src/models/components/index.ts +23 -0
  354. package/src/models/components/loginemailandpassword.ts +95 -0
  355. package/src/models/components/loginrequirementsfromemail.ts +88 -0
  356. package/src/models/components/mfarequiredresponse.ts +160 -0
  357. package/src/models/components/pager.ts +126 -0
  358. package/src/models/components/passwordrequiredresponse.ts +105 -0
  359. package/src/models/components/samlloginrequiredresponse.ts +136 -0
  360. package/src/models/components/security.ts +75 -0
  361. package/src/models/components/status.ts +38 -0
  362. package/src/models/components/systemsummary.ts +69 -0
  363. package/src/models/components/user.ts +451 -0
  364. package/src/models/components/vendorjobtitle.ts +76 -0
  365. package/src/models/components/vendortype.ts +170 -0
  366. package/src/models/errors/apierror.ts +27 -0
  367. package/src/models/errors/apierrorresponse.ts +95 -0
  368. package/src/models/errors/httpclienterrors.ts +62 -0
  369. package/src/models/errors/index.ts +8 -0
  370. package/src/models/errors/sdkvalidationerror.ts +97 -0
  371. package/src/models/operations/createvendorregistration.ts +237 -0
  372. package/src/models/operations/getfacility.ts +69 -0
  373. package/src/models/operations/getuserbyid.ts +69 -0
  374. package/src/models/operations/index.ts +10 -0
  375. package/src/models/operations/listorsearchfacilities.ts +219 -0
  376. package/src/models/operations/listvendorjobtitles.ts +179 -0
  377. package/src/models/operations/logsuserintothesystem.ts +270 -0
  378. package/src/react-query/_types.ts +91 -0
  379. package/src/react-query/index.ts +14 -0
  380. package/src/react-query/organizationsGetFacility.ts +154 -0
  381. package/src/react-query/organizationsListOrSearchFacilities.ts +241 -0
  382. package/src/react-query/userGetCurrentUser.ts +124 -0
  383. package/src/react-query/userGetUserById.ts +152 -0
  384. package/src/react-query/userLogsUserIntoTheSystem.ts +119 -0
  385. package/src/react-query/vendorsCreateVendorRegistration.ts +93 -0
  386. package/src/react-query/vendorsListVendorJobTitles.ts +194 -0
  387. package/src/sdk/index.ts +5 -0
  388. package/src/sdk/organizations.ts +59 -0
  389. package/src/sdk/sdk.ts +25 -0
  390. package/src/sdk/user.ts +92 -0
  391. package/src/sdk/vendors.ts +45 -0
  392. package/src/types/blobs.ts +31 -0
  393. package/src/types/constdatetime.ts +15 -0
  394. package/src/types/enums.ts +16 -0
  395. package/src/types/fp.ts +50 -0
  396. package/src/types/index.ts +11 -0
  397. package/src/types/operations.ts +105 -0
  398. package/src/types/rfcdate.ts +54 -0
  399. package/src/types/streams.ts +21 -0
  400. package/tsconfig.json +41 -0
  401. package/types/blobs.d.ts +4 -0
  402. package/types/blobs.d.ts.map +1 -0
  403. package/types/blobs.js +62 -0
  404. package/types/blobs.js.map +1 -0
  405. package/types/constdatetime.d.ts +3 -0
  406. package/types/constdatetime.d.ts.map +1 -0
  407. package/types/constdatetime.js +46 -0
  408. package/types/constdatetime.js.map +1 -0
  409. package/types/enums.d.ts +12 -0
  410. package/types/enums.d.ts.map +1 -0
  411. package/types/enums.js +10 -0
  412. package/types/enums.js.map +1 -0
  413. package/types/fp.d.ts +31 -0
  414. package/types/fp.d.ts.map +1 -0
  415. package/types/fp.js +37 -0
  416. package/types/fp.js.map +1 -0
  417. package/types/index.d.ts +8 -0
  418. package/types/index.d.ts.map +1 -0
  419. package/types/index.js +16 -0
  420. package/types/index.js.map +1 -0
  421. package/types/operations.d.ts +27 -0
  422. package/types/operations.d.ts.map +1 -0
  423. package/types/operations.js +83 -0
  424. package/types/operations.js.map +1 -0
  425. package/types/rfcdate.d.ts +21 -0
  426. package/types/rfcdate.d.ts.map +1 -0
  427. package/types/rfcdate.js +46 -0
  428. package/types/rfcdate.js.map +1 -0
  429. package/types/streams.d.ts +2 -0
  430. package/types/streams.d.ts.map +1 -0
  431. package/types/streams.js +18 -0
  432. package/types/streams.js.map +1 -0
@@ -0,0 +1,35 @@
1
+
2
+ <div align="center">
3
+ <a href="https://codespaces.new/repconnex/repconnex.git/tree/main"><img src="https://github.com/codespaces/badge.svg" /></a>
4
+ </div>
5
+ <br>
6
+
7
+ > **Remember to shutdown a GitHub Codespace when it is not in use!**
8
+
9
+ # Dev Containers Quick Start
10
+
11
+ The default location for usage snippets is the `samples` directory.
12
+
13
+ ## Running a Usage Sample
14
+
15
+ A sample usage example has been provided in a `root.ts` file. As you work with the SDK, it's expected that you will modify these samples to fit your needs. To execute this particular snippet, use the command below.
16
+
17
+ ```
18
+ ts-node root.ts
19
+ ```
20
+
21
+ ## Generating Additional Usage Samples
22
+
23
+ The speakeasy CLI allows you to generate more usage snippets. Here's how:
24
+
25
+ - To generate a sample for a specific operation by providing an operation ID, use:
26
+
27
+ ```
28
+ speakeasy generate usage -s https://example.com/OVERWRITE_WHEN_SAMPLE_SPEC_IS_WRITTEN -l typescript -i {INPUT_OPERATION_ID} -o ./samples
29
+ ```
30
+
31
+ - To generate samples for an entire namespace (like a tag or group name), use:
32
+
33
+ ```
34
+ speakeasy generate usage -s https://example.com/OVERWRITE_WHEN_SAMPLE_SPEC_IS_WRITTEN -l typescript -n {INPUT_TAG_NAME} -o ./samples
35
+ ```
@@ -0,0 +1,45 @@
1
+ // For format details, see https://aka.ms/devcontainer.json. For config options, see the
2
+ // README at: https://github.com/devcontainers/images/tree/main/src/typescript-node
3
+ {
4
+ "name": "TypeScript",
5
+ "image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye",
6
+ // Features to add to the dev container. More info: https://containers.dev/features.
7
+ // "features": {},
8
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
9
+ // "forwardPorts": [],
10
+ // Use 'postCreateCommand' to run commands after the container is created.
11
+ "postCreateCommand": "sudo chmod +x ./.devcontainer/setup.sh && ./.devcontainer/setup.sh",
12
+ "customizations": {
13
+ "vscode": {
14
+ "extensions": [
15
+ "ms-vscode.vscode-typescript-tslint-plugin",
16
+ "esbenp.prettier-vscode",
17
+ "github.vscode-pull-request-github"
18
+ ],
19
+ "settings": {
20
+ "files.eol": "\n",
21
+ "editor.formatOnSave": true,
22
+ "typescript.tsc.autoDetect": "on",
23
+ "typescript.updateImportsOnFileMove.enabled": "always",
24
+ "typescript.preferences.importModuleSpecifier": "relative",
25
+ "[typescript]": {
26
+ "editor.codeActionsOnSave": {
27
+ "source.organizeImports": true
28
+ }
29
+ },
30
+ "[typescriptreact]": {
31
+ "editor.codeActionsOnSave": {
32
+ "source.organizeImports": true
33
+ }
34
+ }
35
+ }
36
+ },
37
+ "codespaces": {
38
+ "openFiles": [
39
+ ".devcontainer/README.md"
40
+ ]
41
+ }
42
+ }
43
+ // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
44
+ // "remoteUser": "root"
45
+ }
package/FUNCTIONS.md ADDED
@@ -0,0 +1,109 @@
1
+ # Standalone Functions
2
+
3
+ > [!NOTE]
4
+ > This section is useful if you are using a bundler and targetting browsers and
5
+ > runtimes where the size of an application affects performance and load times.
6
+
7
+ Every method in this SDK is also available as a standalone function. This
8
+ alternative API is suitable when targetting the browser or serverless runtimes
9
+ and using a bundler to build your application since all unused functionality
10
+ will be tree-shaken away. This includes code for unused methods, Zod schemas,
11
+ encoding helpers and response handlers. The result is dramatically smaller
12
+ impact on the application's final bundle size which grows very slowly as you use
13
+ more and more functionality from this SDK.
14
+
15
+ Calling methods through the main SDK class remains a valid and generally more
16
+ more ergonomic option. Standalone functions represent an optimisation for a
17
+ specific category of applications.
18
+
19
+ ## Example
20
+
21
+ ```typescript
22
+ import { GreenSecurityCore } from "@greensecurity/javascript-sdk/core.js";
23
+ import { vendorsCreateVendorRegistration } from "@greensecurity/javascript-sdk/funcs/vendorsCreateVendorRegistration.js";
24
+ import { SDKValidationError } from "@greensecurity/javascript-sdk/models/errors/sdkvalidationerror.js";
25
+
26
+ // Use `GreenSecurityCore` for best tree-shaking performance.
27
+ // You can create one instance of it to use across an application.
28
+ const greenSecurity = new GreenSecurityCore();
29
+
30
+ async function run() {
31
+ const res = await vendorsCreateVendorRegistration(greenSecurity, {
32
+ email: "user@example.com",
33
+ password: "Abcdef123!",
34
+ timezone: "America/Chicago",
35
+ affiliateId: 123,
36
+ vendorGroupId: 123,
37
+ managingCompanyId: 123,
38
+ });
39
+
40
+ switch (true) {
41
+ case res.ok:
42
+ // The success case will be handled outside of the switch block
43
+ break;
44
+ case res.error instanceof SDKValidationError:
45
+ // Pretty-print validation errors.
46
+ return console.log(res.error.pretty());
47
+ case res.error instanceof Error:
48
+ return console.log(res.error);
49
+ default:
50
+ // TypeScript's type checking will fail on the following line if the above
51
+ // cases were not exhaustive.
52
+ res.error satisfies never;
53
+ throw new Error("Assertion failed: expected error checks to be exhaustive: " + res.error);
54
+ }
55
+
56
+
57
+ const { value: result } = res;
58
+
59
+ // Handle the result
60
+ console.log(result);
61
+ }
62
+
63
+ run();
64
+ ```
65
+
66
+ ## Result types
67
+
68
+ Standalone functions differ from SDK methods in that they return a
69
+ `Result<Value, Error>` type to capture _known errors_ and document them using
70
+ the type system. By avoiding throwing errors, application code maintains clear
71
+ control flow and error-handling become part of the regular flow of application
72
+ code.
73
+
74
+ > We use the term "known errors" because standalone functions, and JavaScript
75
+ > code in general, can still throw unexpected errors such as `TypeError`s,
76
+ > `RangeError`s and `DOMException`s. Exhaustively catching all errors may be
77
+ > something this SDK addresses in the future. Nevertheless, there is still a lot
78
+ > of benefit from capturing most errors and turning them into values.
79
+
80
+ The second reason for this style of programming is because these functions will
81
+ typically be used in front-end applications where exception throwing is
82
+ sometimes discouraged or considered unidiomatic. React and similar ecosystems
83
+ and libraries tend to promote this style of programming so that components
84
+ render useful content under all states (loading, success, error and so on).
85
+
86
+ The general pattern when calling standalone functions looks like this:
87
+
88
+ ```typescript
89
+ import { Core } from "<sdk-package-name>";
90
+ import { fetchSomething } from "<sdk-package-name>/funcs/fetchSomething.js";
91
+
92
+ const client = new Core();
93
+
94
+ async function run() {
95
+ const result = await fetchSomething(client, { id: "123" });
96
+ if (!result.ok) {
97
+ // You can throw the error or handle it. It's your choice now.
98
+ throw result.error;
99
+ }
100
+
101
+ console.log(result.value);
102
+ }
103
+
104
+ run();
105
+ ```
106
+
107
+ Notably, `result.error` above will have an explicit type compared to a try-catch
108
+ variation where the error in the catch block can only be of type `unknown` (or
109
+ `any` depending on your TypeScript settings).
package/REACT_QUERY.md ADDED
@@ -0,0 +1,318 @@
1
+ # React hooks
2
+
3
+ This SDK provides React hooks and utilies for making queries and mutations that
4
+ can take the pain out of building front-end applications for the web or React
5
+ Native.
6
+
7
+ They are built as a thin wrapper around [TanStack Query for React v5][rq], a
8
+ powerful, asynchronous state management library. A good understanding of that
9
+ library will be very helpful while using them. In addition to hooks, there are
10
+ several helper functions that can be used for cache management and data fetching
11
+ during server-rendering and in React Server Components.
12
+
13
+ ## Getting started
14
+
15
+ To get started using React hooks, you will need to inject TanStack query and an
16
+ SDK instance into your application. Typically, this will be done high up in
17
+ your React app at the root or layout component. For example:
18
+
19
+ ```tsx
20
+ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
21
+ import { GreenSecurityCore } from "@greensecurity/javascript-sdk";
22
+ import { GreenSecurityProvider } from "@greensecurity/javascript-sdk/react-query";
23
+
24
+ const queryClient = new QueryClient();
25
+ const greenSecurity = new GreenSecurityCore();
26
+
27
+ // Retries are handled by the underlying SDK.
28
+ queryClient.setQueryDefaults(["@greensecurity/javascript-sdk"], { retry: false });
29
+ queryClient.setMutationDefaults(["@greensecurity/javascript-sdk"], { retry: false });
30
+
31
+ export function App() {
32
+ return (
33
+ <QueryClientProvider client={queryClient}>
34
+ <GreenSecurityProvider client={greenSecurity}>
35
+ {/* Your app logic starts here */}
36
+ </GreenSecurityProvider>
37
+ </QueryClientProvider>
38
+ );
39
+ }
40
+ ```
41
+
42
+ ## Queries
43
+
44
+ Query hooks are the basic building block for fetching data. In addition to
45
+ request data, they take the same options as the [`useQuery` hook][use-query]
46
+ from TanStack Query.
47
+
48
+ [use-query]: https://tanstack.com/query/v5/docs/framework/react/reference/useQuery
49
+
50
+ ```tsx
51
+ import { useVendorsListVendorJobTitles } from "@greensecurity/javascript-sdk/react-query/vendorsListVendorJobTitles.js";
52
+
53
+ export function Example() {
54
+ const { data, error, status } = useVendorsListVendorJobTitles({
55
+ sort: "job",
56
+ desc: true,
57
+ itemsPerPage: 25,
58
+ jobLike: "job",
59
+ });
60
+
61
+ // Render the UI here...
62
+ }
63
+ ```
64
+
65
+ ### Query timeouts and retries
66
+
67
+ Since the underlying SDK handles request timeouts and retries, there are a few
68
+ more options provided by the query hooks to control these behaviors.
69
+
70
+ ```tsx
71
+ import { useState } from "react";
72
+ import { useVendorsListVendorJobTitles } from "@greensecurity/javascript-sdk/react-query/vendorsListVendorJobTitles.js";
73
+
74
+ export function ExampleWithOptions() {
75
+ const [enabled, setEnabled] = useState(true);
76
+ const { data, error, status } = useVendorsListVendorJobTitles(
77
+ {
78
+ sort: "job",
79
+ desc: true,
80
+ itemsPerPage: 25,
81
+ jobLike: "job",
82
+ },
83
+ {
84
+ // TanStack Query options:
85
+ enabled,
86
+ staleTime: 60 * 1000, // 1 minute
87
+ gcTime: 5 * 60 * 1000, // 5 minutes
88
+
89
+ // Request options for the underlying API call:
90
+ timeoutMs: 1000,
91
+ retryCodes: ["5XX"],
92
+ retries: {
93
+ strategy: "backoff",
94
+ backoff: {
95
+ initialInterval: 500,
96
+ maxInterval: 10 * 1000, // 10 seconds
97
+ exponent: 1.5,
98
+ maxElapsedTime: 60 * 1000, // 1 minute
99
+ },
100
+ },
101
+ }
102
+ );
103
+
104
+ // Render the UI here...
105
+ }
106
+ ```
107
+
108
+
109
+ ## Mutations
110
+
111
+ Operations that can have side-effects in this SDK are exposed as mutation hooks.
112
+ These can be integrated into HTML forms to submit data to the API. They also
113
+ take the same options as the [`useMutation` hook][use-mutation] from TanStack
114
+ Query.
115
+
116
+ [use-mutation]: https://tanstack.com/query/v5/docs/framework/react/reference/useMutation
117
+
118
+ ```tsx
119
+ import { useVendorsCreateVendorRegistrationMutation } from "@greensecurity/javascript-sdk/react-query/vendorsCreateVendorRegistration.js";
120
+
121
+ export function Example() {
122
+ const { mutate, status } = useVendorsCreateVendorRegistrationMutation();
123
+
124
+ return (
125
+ <form
126
+ onSubmit={(e) => {
127
+ e.preventDefault();
128
+
129
+ // Read form data here...
130
+
131
+ mutate({
132
+ email: "user@example.com",
133
+ password: "Abcdef123!",
134
+ timezone: "America/Chicago",
135
+ affiliateId: 123,
136
+ vendorGroupId: 123,
137
+ managingCompanyId: 123,
138
+ });
139
+ }}
140
+ >
141
+ {/* Form fields go here... */}
142
+ <button type="submit" disabled={status === "pending"}>Submit</button>
143
+ </form>
144
+ );
145
+ }
146
+ ```
147
+
148
+ ### Mutation timeouts and retries
149
+
150
+ Since the underlying SDK handles request timeouts and retries, there are a few
151
+ more options provided by the mutation hooks to control these behaviors.
152
+
153
+ ```tsx
154
+ import { useVendorsCreateVendorRegistrationMutation } from "@greensecurity/javascript-sdk/react-query/vendorsCreateVendorRegistration.js";
155
+
156
+ export function ExampleWithOptions() {
157
+ const { mutate, status } = useVendorsCreateVendorRegistrationMutation({
158
+ // TanStack Query options:
159
+ networkMode: "online",
160
+ gcTime: 5 * 60 * 1000, // 5 minutes
161
+
162
+ // Request options for the underlying API call:
163
+ timeoutMs: 1000,
164
+ retryCodes: ["5XX"],
165
+ retries: {
166
+ strategy: "backoff",
167
+ backoff: {
168
+ initialInterval: 500,
169
+ maxInterval: 10 * 1000, // 10 seconds
170
+ exponent: 1.5,
171
+ maxElapsedTime: 60 * 1000, // 1 minute
172
+ },
173
+ },
174
+ });
175
+
176
+ // Render the UI here...
177
+ }
178
+ ```
179
+
180
+
181
+ ## Cache invalidation
182
+
183
+ In many instances, triggering a mutation hook requires invalidating specific
184
+ query data currently residing in the TanStack Query's cache. Alongside every
185
+ query hook there are two functions that help invalidate cached data:
186
+
187
+ ```tsx
188
+ import { useQueryClient } from "@tanstack/react-query";
189
+ import { invalidateVendorsListVendorJobTitles, invalidateAllVendorsListVendorJobTitles } from "@greensecurity/javascript-sdk/react-query/vendorsListVendorJobTitles.js";
190
+ // Replace this with a real mutation
191
+ import { useExampleMutation } from "@greensecurity/javascript-sdk/react-query/example.js";
192
+
193
+ export function Example() {
194
+ const { queryClient } = useQueryClient();
195
+ const { mutate, status } = useExampleMutation();
196
+
197
+ return (
198
+ <form
199
+ onSubmit={(e) => {
200
+ e.preventDefault();
201
+
202
+ const formData = new FormData(e.target);
203
+
204
+ mutate(formData, {
205
+ onSuccess: () => {
206
+ // Invalidate a single cache entry:
207
+ invalidateVendorsListVendorJobTitles(queryClient, /* ... arguments ... */);
208
+ // OR, invalidate all cache entries for the query targets:
209
+ invalidateAllVendorsListVendorJobTitles(queryClient);
210
+ },
211
+ });
212
+ }}
213
+ >
214
+ {/* Form fields go here... */}
215
+
216
+ <button type="submit" disabled={status === "pending"}>Submit</button>
217
+ </form>
218
+ );
219
+ }
220
+ ```
221
+
222
+
223
+ ## Integration with React Suspense
224
+
225
+ TanStack Query predates React Suspense and out of the box it does a great job at
226
+ exposing the lifecycle of asynchronous tasks. However, if you are already using
227
+ Suspense in your app, the default hooks will not trigger suspense boundaries.
228
+ This is why the library and, by extension, this SDK also provide equivalent
229
+ hooks that integrate neatly with React Suspense.
230
+
231
+ ```tsx
232
+ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
233
+ import { ErrorBoundary } from "react-error-boundary";
234
+
235
+ import { GreenSecurityCore } from "@greensecurity/javascript-sdk";
236
+ import { GreenSecurityProvider } from "@greensecurity/javascript-sdk/react-query";
237
+ import { useVendorsListVendorJobTitlesSuspense } from "@greensecurity/javascript-sdk/react-query/vendorsListVendorJobTitles.js";
238
+
239
+ const queryClient = new QueryClient();
240
+ const greenSecurity = new GreenSecurityCore();
241
+
242
+ export function App() {
243
+ return (
244
+ <QueryClientProvider client={queryClient}>
245
+ <GreenSecurityProvider client={greenSecurity}>
246
+ <QueryErrorResetBoundary>
247
+ {({ reset }) => (
248
+ <ErrorBoundary
249
+ fallbackRender={({ error, resetErrorBoundary }) => (
250
+ <div>
251
+ There was an error!{' '}
252
+ <Button onClick={() => resetErrorBoundary()}>Try again</Button>
253
+ <pre>{error.message}</pre>
254
+ </div>
255
+ )}
256
+ onReset={reset}
257
+ >
258
+ <React.Suspense fallback={<h1>Loading...</h1>}>
259
+ <Example />
260
+ </React.Suspense>
261
+ </ErrorBoundary>
262
+ )}
263
+ </QueryErrorResetBoundary>
264
+ </GreenSecurityProvider>
265
+ </QueryClientProvider>
266
+ );
267
+ }
268
+
269
+ function Example() {
270
+ const { data } = useVendorsListVendorJobTitlesSuspense({
271
+ sort: "job",
272
+ desc: true,
273
+ itemsPerPage: 25,
274
+ jobLike: "job",
275
+ });
276
+
277
+ // Render the UI here...
278
+ }
279
+ ```
280
+
281
+
282
+ ## Server-rendering and React Server Components
283
+
284
+ Query hooks are also side-loaded with prefetch helper functions. These functions
285
+ can be used to fetch data from the API during server-rendering and in React
286
+ Server Components so that it can be available immediately on page load to any
287
+ components that use the corresponding hooks:
288
+ ```tsx
289
+ import {
290
+ dehydrate,
291
+ HydrationBoundary,
292
+ QueryClient,
293
+ } from "@tanstack/react-query";
294
+ import { GreenSecurityCore } from "@greensecurity/javascript-sdk";
295
+ import { prefetchVendorsListVendorJobTitles } from "@greensecurity/javascript-sdk/react-query/vendorsListVendorJobTitles.js";
296
+
297
+ export default async function Page() {
298
+ const queryClient = new QueryClient();
299
+ const greenSecurity = new GreenSecurityCore();
300
+
301
+ await prefetchVendorsListVendorJobTitles(queryClient, greenSecurity, {
302
+ sort: "job",
303
+ desc: true,
304
+ itemsPerPage: 25,
305
+ jobLike: "job",
306
+ });
307
+
308
+ return (
309
+ // HydrationBoundary is a Client Component, so hydration will happen there.
310
+ <HydrationBoundary state={dehydrate(queryClient)}>
311
+ {/* Client components under this point will also have data on page load. */}
312
+ </HydrationBoundary>
313
+ );
314
+ }
315
+ ```
316
+
317
+
318
+ [rq]: https://tanstack.com/query/v5/docs/framework/react/overview