@ominity/api-typescript 0.0.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 (504) hide show
  1. package/FUNCTIONS.md +38 -0
  2. package/LICENSE.md +8 -0
  3. package/README.md +468 -0
  4. package/RUNTIMES.md +48 -0
  5. package/dist/commonjs/core.d.ts +10 -0
  6. package/dist/commonjs/core.d.ts.map +1 -0
  7. package/dist/commonjs/core.js +14 -0
  8. package/dist/commonjs/core.js.map +1 -0
  9. package/dist/commonjs/hooks/hooks.d.ts +25 -0
  10. package/dist/commonjs/hooks/hooks.d.ts.map +1 -0
  11. package/dist/commonjs/hooks/hooks.js +83 -0
  12. package/dist/commonjs/hooks/hooks.js.map +1 -0
  13. package/dist/commonjs/hooks/index.d.ts +3 -0
  14. package/dist/commonjs/hooks/index.d.ts.map +1 -0
  15. package/dist/commonjs/hooks/index.js +19 -0
  16. package/dist/commonjs/hooks/index.js.map +1 -0
  17. package/dist/commonjs/hooks/ominity-hooks.d.ts +12 -0
  18. package/dist/commonjs/hooks/ominity-hooks.d.ts.map +1 -0
  19. package/dist/commonjs/hooks/ominity-hooks.js +86 -0
  20. package/dist/commonjs/hooks/ominity-hooks.js.map +1 -0
  21. package/dist/commonjs/hooks/registration.d.ts +3 -0
  22. package/dist/commonjs/hooks/registration.d.ts.map +1 -0
  23. package/dist/commonjs/hooks/registration.js +16 -0
  24. package/dist/commonjs/hooks/registration.js.map +1 -0
  25. package/dist/commonjs/hooks/types.d.ts +76 -0
  26. package/dist/commonjs/hooks/types.d.ts.map +1 -0
  27. package/dist/commonjs/hooks/types.js +3 -0
  28. package/dist/commonjs/hooks/types.js.map +1 -0
  29. package/dist/commonjs/index.d.ts +6 -0
  30. package/dist/commonjs/index.d.ts.map +1 -0
  31. package/dist/commonjs/index.js +45 -0
  32. package/dist/commonjs/index.js.map +1 -0
  33. package/dist/commonjs/lib/base64.d.ts +10 -0
  34. package/dist/commonjs/lib/base64.d.ts.map +1 -0
  35. package/dist/commonjs/lib/base64.js +70 -0
  36. package/dist/commonjs/lib/base64.js.map +1 -0
  37. package/dist/commonjs/lib/config.d.ts +52 -0
  38. package/dist/commonjs/lib/config.d.ts.map +1 -0
  39. package/dist/commonjs/lib/config.js +33 -0
  40. package/dist/commonjs/lib/config.js.map +1 -0
  41. package/dist/commonjs/lib/dlv.d.ts +14 -0
  42. package/dist/commonjs/lib/dlv.d.ts.map +1 -0
  43. package/dist/commonjs/lib/dlv.js +46 -0
  44. package/dist/commonjs/lib/dlv.js.map +1 -0
  45. package/dist/commonjs/lib/encodings.d.ts +53 -0
  46. package/dist/commonjs/lib/encodings.d.ts.map +1 -0
  47. package/dist/commonjs/lib/encodings.js +381 -0
  48. package/dist/commonjs/lib/encodings.js.map +1 -0
  49. package/dist/commonjs/lib/env.d.ts +16 -0
  50. package/dist/commonjs/lib/env.d.ts.map +1 -0
  51. package/dist/commonjs/lib/env.js +80 -0
  52. package/dist/commonjs/lib/env.js.map +1 -0
  53. package/dist/commonjs/lib/files.d.ts +13 -0
  54. package/dist/commonjs/lib/files.d.ts.map +1 -0
  55. package/dist/commonjs/lib/files.js +74 -0
  56. package/dist/commonjs/lib/files.js.map +1 -0
  57. package/dist/commonjs/lib/http.d.ts +67 -0
  58. package/dist/commonjs/lib/http.d.ts.map +1 -0
  59. package/dist/commonjs/lib/http.js +214 -0
  60. package/dist/commonjs/lib/http.js.map +1 -0
  61. package/dist/commonjs/lib/is-plain-object.d.ts +2 -0
  62. package/dist/commonjs/lib/is-plain-object.d.ts.map +1 -0
  63. package/dist/commonjs/lib/is-plain-object.js +38 -0
  64. package/dist/commonjs/lib/is-plain-object.js.map +1 -0
  65. package/dist/commonjs/lib/logger.d.ts +6 -0
  66. package/dist/commonjs/lib/logger.d.ts.map +1 -0
  67. package/dist/commonjs/lib/logger.js +3 -0
  68. package/dist/commonjs/lib/logger.js.map +1 -0
  69. package/dist/commonjs/lib/matchers.d.ts +59 -0
  70. package/dist/commonjs/lib/matchers.d.ts.map +1 -0
  71. package/dist/commonjs/lib/matchers.js +219 -0
  72. package/dist/commonjs/lib/matchers.js.map +1 -0
  73. package/dist/commonjs/lib/primitives.d.ts +26 -0
  74. package/dist/commonjs/lib/primitives.d.ts.map +1 -0
  75. package/dist/commonjs/lib/primitives.js +108 -0
  76. package/dist/commonjs/lib/primitives.js.map +1 -0
  77. package/dist/commonjs/lib/retries.d.ts +38 -0
  78. package/dist/commonjs/lib/retries.d.ts.map +1 -0
  79. package/dist/commonjs/lib/retries.js +150 -0
  80. package/dist/commonjs/lib/retries.js.map +1 -0
  81. package/dist/commonjs/lib/schemas.d.ts +21 -0
  82. package/dist/commonjs/lib/schemas.d.ts.map +1 -0
  83. package/dist/commonjs/lib/schemas.js +92 -0
  84. package/dist/commonjs/lib/schemas.js.map +1 -0
  85. package/dist/commonjs/lib/sdks.d.ts +63 -0
  86. package/dist/commonjs/lib/sdks.d.ts.map +1 -0
  87. package/dist/commonjs/lib/sdks.js +270 -0
  88. package/dist/commonjs/lib/sdks.js.map +1 -0
  89. package/dist/commonjs/lib/security.d.ts +83 -0
  90. package/dist/commonjs/lib/security.d.ts.map +1 -0
  91. package/dist/commonjs/lib/security.js +155 -0
  92. package/dist/commonjs/lib/security.js.map +1 -0
  93. package/dist/commonjs/lib/url.d.ts +5 -0
  94. package/dist/commonjs/lib/url.d.ts.map +1 -0
  95. package/dist/commonjs/lib/url.js +22 -0
  96. package/dist/commonjs/lib/url.js.map +1 -0
  97. package/dist/commonjs/models/errors/documentation.d.ts +22 -0
  98. package/dist/commonjs/models/errors/documentation.d.ts.map +1 -0
  99. package/dist/commonjs/models/errors/documentation.js +61 -0
  100. package/dist/commonjs/models/errors/documentation.js.map +1 -0
  101. package/dist/commonjs/models/errors/error-response-links.d.ts +21 -0
  102. package/dist/commonjs/models/errors/error-response-links.d.ts.map +1 -0
  103. package/dist/commonjs/models/errors/error-response-links.js +59 -0
  104. package/dist/commonjs/models/errors/error-response-links.js.map +1 -0
  105. package/dist/commonjs/models/errors/error-response.d.ts +56 -0
  106. package/dist/commonjs/models/errors/error-response.d.ts.map +1 -0
  107. package/dist/commonjs/models/errors/error-response.js +98 -0
  108. package/dist/commonjs/models/errors/error-response.js.map +1 -0
  109. package/dist/commonjs/models/errors/http-client-errors.d.ts +44 -0
  110. package/dist/commonjs/models/errors/http-client-errors.d.ts.map +1 -0
  111. package/dist/commonjs/models/errors/http-client-errors.js +75 -0
  112. package/dist/commonjs/models/errors/http-client-errors.js.map +1 -0
  113. package/dist/commonjs/models/errors/index.d.ts +9 -0
  114. package/dist/commonjs/models/errors/index.d.ts.map +1 -0
  115. package/dist/commonjs/models/errors/index.js +25 -0
  116. package/dist/commonjs/models/errors/index.js.map +1 -0
  117. package/dist/commonjs/models/errors/ominity-default-error.d.ts +10 -0
  118. package/dist/commonjs/models/errors/ominity-default-error.d.ts.map +1 -0
  119. package/dist/commonjs/models/errors/ominity-default-error.js +31 -0
  120. package/dist/commonjs/models/errors/ominity-default-error.js.map +1 -0
  121. package/dist/commonjs/models/errors/ominity-error.d.ts +19 -0
  122. package/dist/commonjs/models/errors/ominity-error.d.ts.map +1 -0
  123. package/dist/commonjs/models/errors/ominity-error.js +17 -0
  124. package/dist/commonjs/models/errors/ominity-error.js.map +1 -0
  125. package/dist/commonjs/models/errors/response-validation-error.d.ts +26 -0
  126. package/dist/commonjs/models/errors/response-validation-error.d.ts.map +1 -0
  127. package/dist/commonjs/models/errors/response-validation-error.js +63 -0
  128. package/dist/commonjs/models/errors/response-validation-error.js.map +1 -0
  129. package/dist/commonjs/models/errors/sdk-validation-error.d.ts +21 -0
  130. package/dist/commonjs/models/errors/sdk-validation-error.d.ts.map +1 -0
  131. package/dist/commonjs/models/errors/sdk-validation-error.js +79 -0
  132. package/dist/commonjs/models/errors/sdk-validation-error.js.map +1 -0
  133. package/dist/commonjs/models/index.d.ts +2 -0
  134. package/dist/commonjs/models/index.d.ts.map +1 -0
  135. package/dist/commonjs/models/index.js +18 -0
  136. package/dist/commonjs/models/index.js.map +1 -0
  137. package/dist/commonjs/models/operations/index.d.ts +2 -0
  138. package/dist/commonjs/models/operations/index.d.ts.map +1 -0
  139. package/dist/commonjs/models/operations/index.js +3 -0
  140. package/dist/commonjs/models/operations/index.js.map +1 -0
  141. package/dist/commonjs/models/security.d.ts +19 -0
  142. package/dist/commonjs/models/security.d.ts.map +1 -0
  143. package/dist/commonjs/models/security.js +58 -0
  144. package/dist/commonjs/models/security.js.map +1 -0
  145. package/dist/commonjs/package.json +3 -0
  146. package/dist/commonjs/sdk/cms/index.d.ts +4 -0
  147. package/dist/commonjs/sdk/cms/index.d.ts.map +1 -0
  148. package/dist/commonjs/sdk/cms/index.js +11 -0
  149. package/dist/commonjs/sdk/cms/index.js.map +1 -0
  150. package/dist/commonjs/sdk/commerce/index.d.ts +7 -0
  151. package/dist/commonjs/sdk/commerce/index.d.ts.map +1 -0
  152. package/dist/commonjs/sdk/commerce/index.js +15 -0
  153. package/dist/commonjs/sdk/commerce/index.js.map +1 -0
  154. package/dist/commonjs/sdk/commerce/products.d.ts +4 -0
  155. package/dist/commonjs/sdk/commerce/products.d.ts.map +1 -0
  156. package/dist/commonjs/sdk/commerce/products.js +11 -0
  157. package/dist/commonjs/sdk/commerce/products.js.map +1 -0
  158. package/dist/commonjs/sdk/http.d.ts +19 -0
  159. package/dist/commonjs/sdk/http.d.ts.map +1 -0
  160. package/dist/commonjs/sdk/http.js +143 -0
  161. package/dist/commonjs/sdk/http.js.map +1 -0
  162. package/dist/commonjs/sdk/index.d.ts +2 -0
  163. package/dist/commonjs/sdk/index.d.ts.map +1 -0
  164. package/dist/commonjs/sdk/index.js +18 -0
  165. package/dist/commonjs/sdk/index.js.map +1 -0
  166. package/dist/commonjs/sdk/sdk.d.ts +16 -0
  167. package/dist/commonjs/sdk/sdk.d.ts.map +1 -0
  168. package/dist/commonjs/sdk/sdk.js +24 -0
  169. package/dist/commonjs/sdk/sdk.js.map +1 -0
  170. package/dist/commonjs/sdk/settings/index.d.ts +4 -0
  171. package/dist/commonjs/sdk/settings/index.d.ts.map +1 -0
  172. package/dist/commonjs/sdk/settings/index.js +11 -0
  173. package/dist/commonjs/sdk/settings/index.js.map +1 -0
  174. package/dist/commonjs/types/async.d.ts +23 -0
  175. package/dist/commonjs/types/async.d.ts.map +1 -0
  176. package/dist/commonjs/types/async.js +41 -0
  177. package/dist/commonjs/types/async.js.map +1 -0
  178. package/dist/commonjs/types/blobs.d.ts +4 -0
  179. package/dist/commonjs/types/blobs.d.ts.map +1 -0
  180. package/dist/commonjs/types/blobs.js +59 -0
  181. package/dist/commonjs/types/blobs.js.map +1 -0
  182. package/dist/commonjs/types/const-date-time.d.ts +3 -0
  183. package/dist/commonjs/types/const-date-time.d.ts.map +1 -0
  184. package/dist/commonjs/types/const-date-time.js +43 -0
  185. package/dist/commonjs/types/const-date-time.js.map +1 -0
  186. package/dist/commonjs/types/default-to-zero-value.d.ts +12 -0
  187. package/dist/commonjs/types/default-to-zero-value.d.ts.map +1 -0
  188. package/dist/commonjs/types/default-to-zero-value.js +32 -0
  189. package/dist/commonjs/types/default-to-zero-value.js.map +1 -0
  190. package/dist/commonjs/types/enums.d.ts +9 -0
  191. package/dist/commonjs/types/enums.d.ts.map +1 -0
  192. package/dist/commonjs/types/enums.js +63 -0
  193. package/dist/commonjs/types/enums.js.map +1 -0
  194. package/dist/commonjs/types/fp.d.ts +31 -0
  195. package/dist/commonjs/types/fp.d.ts.map +1 -0
  196. package/dist/commonjs/types/fp.js +34 -0
  197. package/dist/commonjs/types/fp.js.map +1 -0
  198. package/dist/commonjs/types/index.d.ts +10 -0
  199. package/dist/commonjs/types/index.d.ts.map +1 -0
  200. package/dist/commonjs/types/index.js +28 -0
  201. package/dist/commonjs/types/index.js.map +1 -0
  202. package/dist/commonjs/types/operations.d.ts +27 -0
  203. package/dist/commonjs/types/operations.d.ts.map +1 -0
  204. package/dist/commonjs/types/operations.js +80 -0
  205. package/dist/commonjs/types/operations.js.map +1 -0
  206. package/dist/commonjs/types/primitives.d.ts +11 -0
  207. package/dist/commonjs/types/primitives.d.ts.map +1 -0
  208. package/dist/commonjs/types/primitives.js +173 -0
  209. package/dist/commonjs/types/primitives.js.map +1 -0
  210. package/dist/commonjs/types/rfcdate.d.ts +21 -0
  211. package/dist/commonjs/types/rfcdate.d.ts.map +1 -0
  212. package/dist/commonjs/types/rfcdate.js +43 -0
  213. package/dist/commonjs/types/rfcdate.js.map +1 -0
  214. package/dist/commonjs/types/smart-union.d.ts +7 -0
  215. package/dist/commonjs/types/smart-union.d.ts.map +1 -0
  216. package/dist/commonjs/types/smart-union.js +143 -0
  217. package/dist/commonjs/types/smart-union.js.map +1 -0
  218. package/dist/commonjs/types/streams.d.ts +2 -0
  219. package/dist/commonjs/types/streams.d.ts.map +1 -0
  220. package/dist/commonjs/types/streams.js +15 -0
  221. package/dist/commonjs/types/streams.js.map +1 -0
  222. package/dist/commonjs/types/unrecognized.d.ts +16 -0
  223. package/dist/commonjs/types/unrecognized.d.ts.map +1 -0
  224. package/dist/commonjs/types/unrecognized.js +31 -0
  225. package/dist/commonjs/types/unrecognized.js.map +1 -0
  226. package/dist/esm/core.d.ts +10 -0
  227. package/dist/esm/core.d.ts.map +1 -0
  228. package/dist/esm/core.js +10 -0
  229. package/dist/esm/core.js.map +1 -0
  230. package/dist/esm/hooks/hooks.d.ts +25 -0
  231. package/dist/esm/hooks/hooks.d.ts.map +1 -0
  232. package/dist/esm/hooks/hooks.js +79 -0
  233. package/dist/esm/hooks/hooks.js.map +1 -0
  234. package/dist/esm/hooks/index.d.ts +3 -0
  235. package/dist/esm/hooks/index.d.ts.map +1 -0
  236. package/dist/esm/hooks/index.js +3 -0
  237. package/dist/esm/hooks/index.js.map +1 -0
  238. package/dist/esm/hooks/ominity-hooks.d.ts +12 -0
  239. package/dist/esm/hooks/ominity-hooks.d.ts.map +1 -0
  240. package/dist/esm/hooks/ominity-hooks.js +82 -0
  241. package/dist/esm/hooks/ominity-hooks.js.map +1 -0
  242. package/dist/esm/hooks/registration.d.ts +3 -0
  243. package/dist/esm/hooks/registration.d.ts.map +1 -0
  244. package/dist/esm/hooks/registration.js +13 -0
  245. package/dist/esm/hooks/registration.js.map +1 -0
  246. package/dist/esm/hooks/types.d.ts +76 -0
  247. package/dist/esm/hooks/types.d.ts.map +1 -0
  248. package/dist/esm/hooks/types.js +2 -0
  249. package/dist/esm/hooks/types.js.map +1 -0
  250. package/dist/esm/index.d.ts +6 -0
  251. package/dist/esm/index.d.ts.map +1 -0
  252. package/dist/esm/index.js +5 -0
  253. package/dist/esm/index.js.map +1 -0
  254. package/dist/esm/lib/base64.d.ts +10 -0
  255. package/dist/esm/lib/base64.d.ts.map +1 -0
  256. package/dist/esm/lib/base64.js +28 -0
  257. package/dist/esm/lib/base64.js.map +1 -0
  258. package/dist/esm/lib/config.d.ts +52 -0
  259. package/dist/esm/lib/config.d.ts.map +1 -0
  260. package/dist/esm/lib/config.js +29 -0
  261. package/dist/esm/lib/config.js.map +1 -0
  262. package/dist/esm/lib/dlv.d.ts +14 -0
  263. package/dist/esm/lib/dlv.d.ts.map +1 -0
  264. package/dist/esm/lib/dlv.js +43 -0
  265. package/dist/esm/lib/dlv.js.map +1 -0
  266. package/dist/esm/lib/encodings.d.ts +53 -0
  267. package/dist/esm/lib/encodings.d.ts.map +1 -0
  268. package/dist/esm/lib/encodings.js +367 -0
  269. package/dist/esm/lib/encodings.js.map +1 -0
  270. package/dist/esm/lib/env.d.ts +16 -0
  271. package/dist/esm/lib/env.d.ts.map +1 -0
  272. package/dist/esm/lib/env.js +42 -0
  273. package/dist/esm/lib/env.js.map +1 -0
  274. package/dist/esm/lib/files.d.ts +13 -0
  275. package/dist/esm/lib/files.d.ts.map +1 -0
  276. package/dist/esm/lib/files.js +70 -0
  277. package/dist/esm/lib/files.js.map +1 -0
  278. package/dist/esm/lib/http.d.ts +67 -0
  279. package/dist/esm/lib/http.d.ts.map +1 -0
  280. package/dist/esm/lib/http.js +204 -0
  281. package/dist/esm/lib/http.js.map +1 -0
  282. package/dist/esm/lib/is-plain-object.d.ts +2 -0
  283. package/dist/esm/lib/is-plain-object.d.ts.map +1 -0
  284. package/dist/esm/lib/is-plain-object.js +35 -0
  285. package/dist/esm/lib/is-plain-object.js.map +1 -0
  286. package/dist/esm/lib/logger.d.ts +6 -0
  287. package/dist/esm/lib/logger.d.ts.map +1 -0
  288. package/dist/esm/lib/logger.js +2 -0
  289. package/dist/esm/lib/logger.js.map +1 -0
  290. package/dist/esm/lib/matchers.d.ts +59 -0
  291. package/dist/esm/lib/matchers.d.ts.map +1 -0
  292. package/dist/esm/lib/matchers.js +200 -0
  293. package/dist/esm/lib/matchers.js.map +1 -0
  294. package/dist/esm/lib/primitives.d.ts +26 -0
  295. package/dist/esm/lib/primitives.d.ts.map +1 -0
  296. package/dist/esm/lib/primitives.js +100 -0
  297. package/dist/esm/lib/primitives.js.map +1 -0
  298. package/dist/esm/lib/retries.d.ts +38 -0
  299. package/dist/esm/lib/retries.d.ts.map +1 -0
  300. package/dist/esm/lib/retries.js +144 -0
  301. package/dist/esm/lib/retries.js.map +1 -0
  302. package/dist/esm/lib/schemas.d.ts +21 -0
  303. package/dist/esm/lib/schemas.d.ts.map +1 -0
  304. package/dist/esm/lib/schemas.js +54 -0
  305. package/dist/esm/lib/schemas.js.map +1 -0
  306. package/dist/esm/lib/sdks.d.ts +63 -0
  307. package/dist/esm/lib/sdks.d.ts.map +1 -0
  308. package/dist/esm/lib/sdks.js +266 -0
  309. package/dist/esm/lib/sdks.js.map +1 -0
  310. package/dist/esm/lib/security.d.ts +83 -0
  311. package/dist/esm/lib/security.d.ts.map +1 -0
  312. package/dist/esm/lib/security.js +148 -0
  313. package/dist/esm/lib/security.js.map +1 -0
  314. package/dist/esm/lib/url.d.ts +5 -0
  315. package/dist/esm/lib/url.d.ts.map +1 -0
  316. package/dist/esm/lib/url.js +19 -0
  317. package/dist/esm/lib/url.js.map +1 -0
  318. package/dist/esm/models/errors/documentation.d.ts +22 -0
  319. package/dist/esm/models/errors/documentation.d.ts.map +1 -0
  320. package/dist/esm/models/errors/documentation.js +23 -0
  321. package/dist/esm/models/errors/documentation.js.map +1 -0
  322. package/dist/esm/models/errors/error-response-links.d.ts +21 -0
  323. package/dist/esm/models/errors/error-response-links.d.ts.map +1 -0
  324. package/dist/esm/models/errors/error-response-links.js +21 -0
  325. package/dist/esm/models/errors/error-response-links.js.map +1 -0
  326. package/dist/esm/models/errors/error-response.d.ts +56 -0
  327. package/dist/esm/models/errors/error-response.d.ts.map +1 -0
  328. package/dist/esm/models/errors/error-response.js +61 -0
  329. package/dist/esm/models/errors/error-response.js.map +1 -0
  330. package/dist/esm/models/errors/http-client-errors.d.ts +44 -0
  331. package/dist/esm/models/errors/http-client-errors.d.ts.map +1 -0
  332. package/dist/esm/models/errors/http-client-errors.js +66 -0
  333. package/dist/esm/models/errors/http-client-errors.js.map +1 -0
  334. package/dist/esm/models/errors/index.d.ts +9 -0
  335. package/dist/esm/models/errors/index.d.ts.map +1 -0
  336. package/dist/esm/models/errors/index.js +9 -0
  337. package/dist/esm/models/errors/index.js.map +1 -0
  338. package/dist/esm/models/errors/ominity-default-error.d.ts +10 -0
  339. package/dist/esm/models/errors/ominity-default-error.d.ts.map +1 -0
  340. package/dist/esm/models/errors/ominity-default-error.js +27 -0
  341. package/dist/esm/models/errors/ominity-default-error.js.map +1 -0
  342. package/dist/esm/models/errors/ominity-error.d.ts +19 -0
  343. package/dist/esm/models/errors/ominity-error.d.ts.map +1 -0
  344. package/dist/esm/models/errors/ominity-error.js +13 -0
  345. package/dist/esm/models/errors/ominity-error.js.map +1 -0
  346. package/dist/esm/models/errors/response-validation-error.d.ts +26 -0
  347. package/dist/esm/models/errors/response-validation-error.d.ts.map +1 -0
  348. package/dist/esm/models/errors/response-validation-error.js +26 -0
  349. package/dist/esm/models/errors/response-validation-error.js.map +1 -0
  350. package/dist/esm/models/errors/sdk-validation-error.d.ts +21 -0
  351. package/dist/esm/models/errors/sdk-validation-error.d.ts.map +1 -0
  352. package/dist/esm/models/errors/sdk-validation-error.js +41 -0
  353. package/dist/esm/models/errors/sdk-validation-error.js.map +1 -0
  354. package/dist/esm/models/index.d.ts +2 -0
  355. package/dist/esm/models/index.d.ts.map +1 -0
  356. package/dist/esm/models/index.js +2 -0
  357. package/dist/esm/models/index.js.map +1 -0
  358. package/dist/esm/models/operations/index.d.ts +2 -0
  359. package/dist/esm/models/operations/index.d.ts.map +1 -0
  360. package/dist/esm/models/operations/index.js +2 -0
  361. package/dist/esm/models/operations/index.js.map +1 -0
  362. package/dist/esm/models/security.d.ts +19 -0
  363. package/dist/esm/models/security.d.ts.map +1 -0
  364. package/dist/esm/models/security.js +20 -0
  365. package/dist/esm/models/security.js.map +1 -0
  366. package/dist/esm/package.json +3 -0
  367. package/dist/esm/sdk/cms/index.d.ts +4 -0
  368. package/dist/esm/sdk/cms/index.d.ts.map +1 -0
  369. package/dist/esm/sdk/cms/index.js +7 -0
  370. package/dist/esm/sdk/cms/index.js.map +1 -0
  371. package/dist/esm/sdk/commerce/index.d.ts +7 -0
  372. package/dist/esm/sdk/commerce/index.d.ts.map +1 -0
  373. package/dist/esm/sdk/commerce/index.js +11 -0
  374. package/dist/esm/sdk/commerce/index.js.map +1 -0
  375. package/dist/esm/sdk/commerce/products.d.ts +4 -0
  376. package/dist/esm/sdk/commerce/products.d.ts.map +1 -0
  377. package/dist/esm/sdk/commerce/products.js +7 -0
  378. package/dist/esm/sdk/commerce/products.js.map +1 -0
  379. package/dist/esm/sdk/http.d.ts +19 -0
  380. package/dist/esm/sdk/http.d.ts.map +1 -0
  381. package/dist/esm/sdk/http.js +139 -0
  382. package/dist/esm/sdk/http.js.map +1 -0
  383. package/dist/esm/sdk/index.d.ts +2 -0
  384. package/dist/esm/sdk/index.d.ts.map +1 -0
  385. package/dist/esm/sdk/index.js +2 -0
  386. package/dist/esm/sdk/index.js.map +1 -0
  387. package/dist/esm/sdk/sdk.d.ts +16 -0
  388. package/dist/esm/sdk/sdk.d.ts.map +1 -0
  389. package/dist/esm/sdk/sdk.js +20 -0
  390. package/dist/esm/sdk/sdk.js.map +1 -0
  391. package/dist/esm/sdk/settings/index.d.ts +4 -0
  392. package/dist/esm/sdk/settings/index.d.ts.map +1 -0
  393. package/dist/esm/sdk/settings/index.js +7 -0
  394. package/dist/esm/sdk/settings/index.js.map +1 -0
  395. package/dist/esm/types/async.d.ts +23 -0
  396. package/dist/esm/types/async.d.ts.map +1 -0
  397. package/dist/esm/types/async.js +37 -0
  398. package/dist/esm/types/async.js.map +1 -0
  399. package/dist/esm/types/blobs.d.ts +4 -0
  400. package/dist/esm/types/blobs.d.ts.map +1 -0
  401. package/dist/esm/types/blobs.js +22 -0
  402. package/dist/esm/types/blobs.js.map +1 -0
  403. package/dist/esm/types/const-date-time.d.ts +3 -0
  404. package/dist/esm/types/const-date-time.d.ts.map +1 -0
  405. package/dist/esm/types/const-date-time.js +7 -0
  406. package/dist/esm/types/const-date-time.js.map +1 -0
  407. package/dist/esm/types/default-to-zero-value.d.ts +12 -0
  408. package/dist/esm/types/default-to-zero-value.d.ts.map +1 -0
  409. package/dist/esm/types/default-to-zero-value.js +28 -0
  410. package/dist/esm/types/default-to-zero-value.js.map +1 -0
  411. package/dist/esm/types/enums.d.ts +9 -0
  412. package/dist/esm/types/enums.d.ts.map +1 -0
  413. package/dist/esm/types/enums.js +24 -0
  414. package/dist/esm/types/enums.js.map +1 -0
  415. package/dist/esm/types/fp.d.ts +31 -0
  416. package/dist/esm/types/fp.d.ts.map +1 -0
  417. package/dist/esm/types/fp.js +28 -0
  418. package/dist/esm/types/fp.js.map +1 -0
  419. package/dist/esm/types/index.d.ts +10 -0
  420. package/dist/esm/types/index.d.ts.map +1 -0
  421. package/dist/esm/types/index.js +7 -0
  422. package/dist/esm/types/index.js.map +1 -0
  423. package/dist/esm/types/operations.d.ts +27 -0
  424. package/dist/esm/types/operations.d.ts.map +1 -0
  425. package/dist/esm/types/operations.js +74 -0
  426. package/dist/esm/types/operations.js.map +1 -0
  427. package/dist/esm/types/primitives.d.ts +11 -0
  428. package/dist/esm/types/primitives.d.ts.map +1 -0
  429. package/dist/esm/types/primitives.js +129 -0
  430. package/dist/esm/types/primitives.js.map +1 -0
  431. package/dist/esm/types/rfcdate.d.ts +21 -0
  432. package/dist/esm/types/rfcdate.d.ts.map +1 -0
  433. package/dist/esm/types/rfcdate.js +39 -0
  434. package/dist/esm/types/rfcdate.js.map +1 -0
  435. package/dist/esm/types/smart-union.d.ts +7 -0
  436. package/dist/esm/types/smart-union.d.ts.map +1 -0
  437. package/dist/esm/types/smart-union.js +107 -0
  438. package/dist/esm/types/smart-union.js.map +1 -0
  439. package/dist/esm/types/streams.d.ts +2 -0
  440. package/dist/esm/types/streams.d.ts.map +1 -0
  441. package/dist/esm/types/streams.js +12 -0
  442. package/dist/esm/types/streams.js.map +1 -0
  443. package/dist/esm/types/unrecognized.d.ts +16 -0
  444. package/dist/esm/types/unrecognized.d.ts.map +1 -0
  445. package/dist/esm/types/unrecognized.js +28 -0
  446. package/dist/esm/types/unrecognized.js.map +1 -0
  447. package/jsr.json +27 -0
  448. package/package.json +122 -0
  449. package/src/core.ts +10 -0
  450. package/src/hooks/hooks.ts +128 -0
  451. package/src/hooks/index.ts +2 -0
  452. package/src/hooks/ominity-hooks.ts +117 -0
  453. package/src/hooks/registration.ts +15 -0
  454. package/src/hooks/types.ts +103 -0
  455. package/src/index.ts +6 -0
  456. package/src/lib/base64.ts +36 -0
  457. package/src/lib/config.ts +84 -0
  458. package/src/lib/dlv.ts +49 -0
  459. package/src/lib/encodings.ts +497 -0
  460. package/src/lib/env.ts +56 -0
  461. package/src/lib/files.ts +79 -0
  462. package/src/lib/http.ts +320 -0
  463. package/src/lib/is-plain-object.ts +40 -0
  464. package/src/lib/logger.ts +6 -0
  465. package/src/lib/matchers.ts +349 -0
  466. package/src/lib/primitives.ts +147 -0
  467. package/src/lib/retries.ts +215 -0
  468. package/src/lib/schemas.ts +91 -0
  469. package/src/lib/sdks.ts +403 -0
  470. package/src/lib/security.ts +276 -0
  471. package/src/lib/url.ts +30 -0
  472. package/src/models/errors/documentation.ts +50 -0
  473. package/src/models/errors/error-response-links.ts +58 -0
  474. package/src/models/errors/error-response.ts +121 -0
  475. package/src/models/errors/http-client-errors.ts +58 -0
  476. package/src/models/errors/index.ts +8 -0
  477. package/src/models/errors/ominity-default-error.ts +36 -0
  478. package/src/models/errors/ominity-error.ts +31 -0
  479. package/src/models/errors/response-validation-error.ts +46 -0
  480. package/src/models/errors/sdk-validation-error.ts +50 -0
  481. package/src/models/index.ts +1 -0
  482. package/src/models/operations/index.ts +2 -0
  483. package/src/models/security.ts +46 -0
  484. package/src/sdk/cms/index.ts +7 -0
  485. package/src/sdk/commerce/index.ts +13 -0
  486. package/src/sdk/commerce/products.ts +7 -0
  487. package/src/sdk/http.ts +204 -0
  488. package/src/sdk/index.ts +2 -0
  489. package/src/sdk/sdk.ts +28 -0
  490. package/src/sdk/settings/index.ts +7 -0
  491. package/src/types/async.ts +65 -0
  492. package/src/types/blobs.ts +30 -0
  493. package/src/types/const-date-time.ts +12 -0
  494. package/src/types/default-to-zero-value.ts +30 -0
  495. package/src/types/enums.ts +42 -0
  496. package/src/types/fp.ts +47 -0
  497. package/src/types/index.ts +10 -0
  498. package/src/types/operations.ts +102 -0
  499. package/src/types/primitives.ts +165 -0
  500. package/src/types/rfcdate.ts +51 -0
  501. package/src/types/smart-union.ts +142 -0
  502. package/src/types/streams.ts +18 -0
  503. package/src/types/unrecognized.ts +32 -0
  504. package/tsconfig.json +40 -0
package/FUNCTIONS.md ADDED
@@ -0,0 +1,38 @@
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
+ Standalone functions are not yet available. This SDK currently focuses on the
8
+ class-based client and the generic `http` helper while the typed endpoints are
9
+ being implemented.
10
+
11
+ ## Example
12
+
13
+ ```typescript
14
+ // Standalone functions will be documented here once they are introduced.
15
+ ```
16
+
17
+ ## Result types
18
+
19
+ Standalone functions differ from SDK methods in that they return a
20
+ `Result<Value, Error>` type to capture _known errors_ and document them using
21
+ the type system. By avoiding throwing errors, application code maintains clear
22
+ control flow and error-handling become part of the regular flow of application
23
+ code.
24
+
25
+ > We use the term "known errors" because standalone functions, and JavaScript
26
+ > code in general, can still throw unexpected errors such as `TypeError`s,
27
+ > `RangeError`s and `DOMException`s. Exhaustively catching all errors may be
28
+ > something this SDK addresses in the future. Nevertheless, there is still a lot
29
+ > of benefit from capturing most errors and turning them into values.
30
+
31
+ The second reason for this style of programming is because these functions will
32
+ typically be used in front-end applications where exception throwing is
33
+ sometimes discouraged or considered unidiomatic. React and similar ecosystems
34
+ and libraries tend to promote this style of programming so that components
35
+ render useful content under all states (loading, success, error and so on).
36
+
37
+ Once standalone functions are added, this guide will show how to use the core
38
+ client with tree-shakable function imports.
package/LICENSE.md ADDED
@@ -0,0 +1,8 @@
1
+ Copyright (c) 2026, Ominity
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
+
6
+ Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
+ Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,468 @@
1
+ # @ominity/api-typescript
2
+
3
+ Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@ominity/api-typescript* API.
4
+
5
+ <br /><br />
6
+ > [!IMPORTANT]
7
+ > This SDK is under active development and not yet ready for production use.
8
+
9
+ <!-- Start Summary [summary] -->
10
+ ## Summary
11
+
12
+ Type-safe TypeScript SDK for the Ominity API. This SDK is manually maintained
13
+ and provides a stable core, module namespaces (`commerce`, `cms`, `settings`),
14
+ and a generic HTTP client for endpoints not yet implemented.
15
+
16
+ Documentation: https://docs.ominity.com
17
+ <!-- End Summary [summary] -->
18
+
19
+ <!-- Start Table of Contents [toc] -->
20
+ ## Table of Contents
21
+ <!-- $toc-max-depth=2 -->
22
+ * [@ominity/api-typescript](#ominityapi-typescript)
23
+ * [SDK Installation](#sdk-installation)
24
+ * [Requirements](#requirements)
25
+ * [SDK Example Usage](#sdk-example-usage)
26
+ * [Authentication](#authentication)
27
+ * [Available Resources and Operations](#available-resources-and-operations)
28
+ * [Standalone functions](#standalone-functions)
29
+ * [File uploads](#file-uploads)
30
+ * [Retries](#retries)
31
+ * [Error Handling](#error-handling)
32
+ * [Server URL Per-Client](#server-url-per-client)
33
+ * [Custom HTTP Client](#custom-http-client)
34
+ * [Debugging](#debugging)
35
+ * [Development](#development)
36
+ * [Maturity](#maturity)
37
+ * [Contributions](#contributions)
38
+
39
+ <!-- End Table of Contents [toc] -->
40
+
41
+ <!-- Start SDK Installation [installation] -->
42
+ ## SDK Installation
43
+
44
+ The SDK can be installed with either [npm](https://www.npmjs.com/), [pnpm](https://pnpm.io/), [bun](https://bun.sh/) or [yarn](https://classic.yarnpkg.com/en/) package managers.
45
+
46
+ ### NPM
47
+
48
+ ```bash
49
+ npm add @ominity/api-typescript
50
+ ```
51
+
52
+ ### PNPM
53
+
54
+ ```bash
55
+ pnpm add @ominity/api-typescript
56
+ ```
57
+
58
+ ### Bun
59
+
60
+ ```bash
61
+ bun add @ominity/api-typescript
62
+ ```
63
+
64
+ ### Yarn
65
+
66
+ ```bash
67
+ yarn add @ominity/api-typescript
68
+ ```
69
+
70
+ > [!NOTE]
71
+ > This package is published with CommonJS and ES Modules (ESM) support.
72
+ <!-- End SDK Installation [installation] -->
73
+
74
+ <!-- Start Requirements [requirements] -->
75
+ ## Requirements
76
+
77
+ For supported JavaScript runtimes, please consult [RUNTIMES.md](RUNTIMES.md).
78
+ <!-- End Requirements [requirements] -->
79
+
80
+ <!-- Start SDK Example Usage [usage] -->
81
+ ## SDK Example Usage
82
+
83
+ ### Example
84
+
85
+ ```typescript
86
+ import { Ominity } from "@ominity/api-typescript";
87
+
88
+ const ominity = new Ominity({
89
+ serverURL: "https://tenant-a.example.com/api",
90
+ security: {
91
+ apiKey: process.env["OMINITY_API_KEY"] ?? "",
92
+ },
93
+ language: "en",
94
+ channelId: "019c2dee-2ed6-7754-8698-6b8dd37bc61e",
95
+ });
96
+
97
+ async function run() {
98
+ const res = await ominity.http.get("/commerce/products", {
99
+ query: { include: "variants", sort: "-price" },
100
+ });
101
+
102
+ console.log(await res.json());
103
+ }
104
+
105
+ run();
106
+
107
+ ```
108
+ <!-- End SDK Example Usage [usage] -->
109
+
110
+ <!-- Start Authentication [security] -->
111
+ ## Authentication
112
+
113
+ ### Per-Client Security Schemes
114
+
115
+ This SDK supports the following security schemes globally:
116
+
117
+ | Name | Type | Scheme | Environment Variable |
118
+ | ------- | ------ | -------------- | ------------------------- |
119
+ | `apiKey` | http | Bearer (API key) | `OMINITY_API_KEY` |
120
+ | `oAuth` | http | Bearer (OAuth) | `OMINITY_OAUTH_TOKEN` |
121
+
122
+ To authenticate with the API, set the `security` object when initializing the SDK client instance. If `security.oAuth` is provided, it will be used; otherwise `security.apiKey` is used.
123
+ For example:
124
+ ```typescript
125
+ import { Ominity } from "@ominity/api-typescript";
126
+
127
+ const ominity = new Ominity({
128
+ serverURL: "https://tenant-a.example.com/api",
129
+ security: {
130
+ apiKey: process.env["OMINITY_API_KEY"] ?? "",
131
+ // oAuth: process.env["OMINITY_OAUTH_TOKEN"] ?? "",
132
+ },
133
+ });
134
+
135
+ async function run() {
136
+ const res = await ominity.http.get("/commerce/products");
137
+ console.log(await res.json());
138
+ }
139
+
140
+ run();
141
+
142
+ ```
143
+ <!-- End Authentication [security] -->
144
+
145
+ <!-- Start Available Resources and Operations [operations] -->
146
+ ## Available Resources and Operations
147
+
148
+ Typed operations are being added. Current namespaces:
149
+
150
+ - `commerce`
151
+ - `cms`
152
+ - `settings`
153
+ - `http` (generic client for unimplemented endpoints)
154
+
155
+ Use `ominity.http` for endpoints that are not yet implemented in the SDK.
156
+ <!-- End Available Resources and Operations [operations] -->
157
+
158
+ <!-- Start Standalone functions [standalone-funcs] -->
159
+ ## Standalone functions
160
+
161
+ Standalone functions are not yet available. This SDK currently focuses on the
162
+ class-based client and the generic `http` helper.
163
+
164
+ To read more about the intended standalone function approach, check
165
+ [FUNCTIONS.md](./FUNCTIONS.md).
166
+ <!-- End Standalone functions [standalone-funcs] -->
167
+
168
+ <!-- Start File uploads [file-upload] -->
169
+ ## File uploads
170
+
171
+ Certain SDK methods accept files as part of a multi-part request. It is possible and typically recommended to upload files as a stream rather than reading the entire contents into memory. This avoids excessive memory consumption and potentially crashing with out-of-memory errors when working with very large files. The following example demonstrates how to attach a file stream to a request.
172
+
173
+ > [!TIP]
174
+ >
175
+ > Depending on your JavaScript runtime, there are convenient utilities that return a handle to a file without reading the entire contents into memory:
176
+ >
177
+ > - **Node.js v20+:** Since v20, Node.js comes with a native `openAsBlob` function in [`node:fs`](https://nodejs.org/docs/latest-v20.x/api/fs.html#fsopenasblobpath-options).
178
+ > - **Bun:** The native [`Bun.file`](https://bun.sh/docs/api/file-io#reading-files-bun-file) function produces a file handle that can be used for streaming file uploads.
179
+ > - **Browsers:** All supported browsers return an instance to a [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) when reading the value from an `<input type="file">` element.
180
+ > - **Node.js v18:** A file stream can be created using the `fileFrom` helper from [`fetch-blob/from.js`](https://www.npmjs.com/package/fetch-blob).
181
+
182
+ ```typescript
183
+ import { Ominity } from "@ominity/api-typescript";
184
+ import { openAsBlob } from "node:fs";
185
+
186
+ const ominity = new Ominity({
187
+ serverURL: "https://tenant-a.example.com/api",
188
+ security: {
189
+ apiKey: process.env["OMINITY_API_KEY"] ?? "",
190
+ },
191
+ });
192
+
193
+ async function run() {
194
+ const form = new FormData();
195
+ form.append("file", await openAsBlob("./path/to/file.pdf"));
196
+
197
+ const res = await ominity.http.post("/files", {
198
+ body: form,
199
+ });
200
+
201
+ console.log(await res.json());
202
+ }
203
+
204
+ run();
205
+
206
+ ```
207
+ <!-- End File uploads [file-upload] -->
208
+
209
+ <!-- Start Retries [retries] -->
210
+ ## Retries
211
+
212
+ Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK.
213
+
214
+ To change the default retry strategy for a single API call, simply provide a retryConfig object to the call:
215
+ ```typescript
216
+ import { Ominity } from "@ominity/api-typescript";
217
+
218
+ const ominity = new Ominity({
219
+ serverURL: "https://tenant-a.example.com/api",
220
+ security: {
221
+ apiKey: process.env["OMINITY_API_KEY"] ?? "",
222
+ },
223
+ });
224
+
225
+ async function run() {
226
+ const res = await ominity.http.get("/commerce/products", {
227
+ retries: {
228
+ strategy: "backoff",
229
+ backoff: {
230
+ initialInterval: 1,
231
+ maxInterval: 50,
232
+ exponent: 1.1,
233
+ maxElapsedTime: 100,
234
+ },
235
+ retryConnectionErrors: false,
236
+ },
237
+ });
238
+
239
+ console.log(await res.json());
240
+ }
241
+
242
+ run();
243
+
244
+ ```
245
+
246
+ If you'd like to override the default retry strategy for all operations that support retries, you can provide a retryConfig at SDK initialization:
247
+ ```typescript
248
+ import { Ominity } from "@ominity/api-typescript";
249
+
250
+ const ominity = new Ominity({
251
+ serverURL: "https://tenant-a.example.com/api",
252
+ retryConfig: {
253
+ strategy: "backoff",
254
+ backoff: {
255
+ initialInterval: 1,
256
+ maxInterval: 50,
257
+ exponent: 1.1,
258
+ maxElapsedTime: 100,
259
+ },
260
+ retryConnectionErrors: false,
261
+ },
262
+ security: {
263
+ apiKey: process.env["OMINITY_API_KEY"] ?? "",
264
+ },
265
+ });
266
+
267
+ async function run() {
268
+ const res = await ominity.http.get("/commerce/products");
269
+
270
+ console.log(await res.json());
271
+ }
272
+
273
+ run();
274
+
275
+ ```
276
+ <!-- End Retries [retries] -->
277
+
278
+ <!-- Start Error Handling [errors] -->
279
+ ## Error Handling
280
+
281
+ [`OminityError`](./src/models/errors/ominity-error.ts) is the base class for all HTTP error responses. It has the following properties:
282
+
283
+ | Property | Type | Description |
284
+ | ------------------- | ---------- | --------------------------------------------------------------------------------------- |
285
+ | `error.message` | `string` | Error message |
286
+ | `error.statusCode` | `number` | HTTP response status code eg `404` |
287
+ | `error.headers` | `Headers` | HTTP response headers |
288
+ | `error.body` | `string` | HTTP body. Can be empty string if no body is returned. |
289
+ | `error.rawResponse` | `Response` | Raw HTTP response |
290
+ | `error.data$` | | Optional. Some errors may contain structured data. [See Error Classes](#error-classes). |
291
+
292
+ ### Example
293
+ ```typescript
294
+ import { Ominity } from "@ominity/api-typescript";
295
+ import * as errors from "@ominity/api-typescript/models/errors";
296
+
297
+ const ominity = new Ominity({
298
+ serverURL: "https://tenant-a.example.com/api",
299
+ security: {
300
+ apiKey: process.env["OMINITY_API_KEY"] ?? "",
301
+ oAuth: process.env["OMINITY_OAUTH_TOKEN"] ?? "",
302
+ },
303
+ });
304
+
305
+ async function run() {
306
+ try {
307
+ // Call a method that performs a request
308
+ console.log(ominity);
309
+ } catch (error) {
310
+ // The base class for HTTP error responses
311
+ if (error instanceof errors.OminityError) {
312
+ console.log(error.message);
313
+ console.log(error.statusCode);
314
+ console.log(error.body);
315
+ console.log(error.headers);
316
+
317
+ // Structured API error response
318
+ if (error instanceof errors.ErrorResponse) {
319
+ console.log(error.data$.status); // number
320
+ console.log(error.data$.title); // string
321
+ }
322
+ }
323
+ }
324
+ }
325
+
326
+ run();
327
+
328
+ ```
329
+
330
+ ### Error Classes
331
+ **Primary error:**
332
+ * [`OminityError`](./src/models/errors/ominity-error.ts): The base class for HTTP error responses.
333
+
334
+ <details><summary>Less common errors (9)</summary>
335
+
336
+ <br />
337
+
338
+ **Network errors:**
339
+ * [`ConnectionError`](./src/models/errors/http-client-errors.ts): HTTP client was unable to make a request to a server.
340
+ * [`RequestTimeoutError`](./src/models/errors/http-client-errors.ts): HTTP request timed out due to an AbortSignal signal.
341
+ * [`RequestAbortedError`](./src/models/errors/http-client-errors.ts): HTTP request was aborted by the client.
342
+ * [`InvalidRequestError`](./src/models/errors/http-client-errors.ts): Any input used to create a request is invalid.
343
+ * [`UnexpectedClientError`](./src/models/errors/http-client-errors.ts): Unrecognised or unexpected error.
344
+
345
+
346
+ **Inherit from [`OminityError`](./src/models/errors/ominity-error.ts)**:
347
+ * [`ErrorResponse`](./src/models/errors/error-response.ts): Standard API error response (including validation errors).
348
+ * [`ResponseValidationError`](./src/models/errors/response-validation-error.ts): Type mismatch between the data returned from the server and the structure expected by the SDK. See `error.rawValue` for the raw value and `error.pretty()` for a nicely formatted multi-line string.
349
+
350
+ </details>
351
+
352
+ \* Check [the method documentation](#available-resources-and-operations) to see if the error is applicable.
353
+ <!-- End Error Handling [errors] -->
354
+
355
+ <!-- Start Server Selection [server] -->
356
+ ## Server URL Per-Client
357
+
358
+ Each tenant runs on its own domain, so `serverURL` is required when initializing the SDK client instance. The SDK appends the API version (default `"v1"`) to this base URL. For example:
359
+ ```typescript
360
+ import { Ominity } from "@ominity/api-typescript";
361
+
362
+ const ominity = new Ominity({
363
+ serverURL: "https://tenant-a.example.com/api",
364
+ security: {
365
+ apiKey: process.env["OMINITY_API_KEY"] ?? "",
366
+ oAuth: process.env["OMINITY_OAUTH_TOKEN"] ?? "",
367
+ },
368
+ language: "en",
369
+ channelId: "web",
370
+ });
371
+
372
+ async function run() {
373
+ console.log(ominity);
374
+ }
375
+
376
+ run();
377
+
378
+ ```
379
+ <!-- End Server Selection [server] -->
380
+
381
+ <!-- Start Custom HTTP Client [http-client] -->
382
+ ## Custom HTTP Client
383
+
384
+ The TypeScript SDK makes API calls using an `HTTPClient` that wraps the native
385
+ [Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API). This
386
+ client is a thin wrapper around `fetch` and provides the ability to attach hooks
387
+ around the request lifecycle that can be used to modify the request or handle
388
+ errors and response.
389
+
390
+ The `HTTPClient` constructor takes an optional `fetcher` argument that can be
391
+ used to integrate a third-party HTTP client or when writing tests to mock out
392
+ the HTTP client and feed in fixtures.
393
+
394
+ The following example shows how to use the `"beforeRequest"` hook to to add a
395
+ custom header and a timeout to requests and how to use the `"requestError"` hook
396
+ to log errors:
397
+
398
+ ```typescript
399
+ import { Ominity } from "@ominity/api-typescript";
400
+ import { HTTPClient } from "@ominity/api-typescript/lib/http";
401
+
402
+ const httpClient = new HTTPClient({
403
+ // fetcher takes a function that has the same signature as native `fetch`.
404
+ fetcher: (request) => {
405
+ return fetch(request);
406
+ }
407
+ });
408
+
409
+ httpClient.addHook("beforeRequest", (request) => {
410
+ const nextRequest = new Request(request, {
411
+ signal: request.signal || AbortSignal.timeout(5000)
412
+ });
413
+
414
+ nextRequest.headers.set("x-custom-header", "custom value");
415
+
416
+ return nextRequest;
417
+ });
418
+
419
+ httpClient.addHook("requestError", (error, request) => {
420
+ console.group("Request Error");
421
+ console.log("Reason:", `${error}`);
422
+ console.log("Endpoint:", `${request.method} ${request.url}`);
423
+ console.groupEnd();
424
+ });
425
+
426
+ const sdk = new Ominity({
427
+ serverURL: "https://tenant-a.example.com/api",
428
+ security: { apiKey: process.env["OMINITY_API_KEY"] ?? "" },
429
+ httpClient: httpClient,
430
+ });
431
+ ```
432
+ <!-- End Custom HTTP Client [http-client] -->
433
+
434
+ <!-- Start Debugging [debug] -->
435
+ ## Debugging
436
+
437
+ You can setup your SDK to emit debug logs for SDK requests and responses.
438
+
439
+ You can pass a logger that matches `console`'s interface as an SDK option.
440
+
441
+ > [!WARNING]
442
+ > Beware that debug logging will reveal secrets, like API tokens in headers, in log messages printed to a console or files. It's recommended to use this feature only during local development and not in production.
443
+
444
+ ```typescript
445
+ import { Ominity } from "@ominity/api-typescript";
446
+
447
+ const sdk = new Ominity({
448
+ serverURL: "https://tenant-a.example.com/api",
449
+ security: { apiKey: process.env["OMINITY_API_KEY"] ?? "" },
450
+ debugLogger: console,
451
+ });
452
+ ```
453
+
454
+ You can also enable a default debug logger by setting an environment variable `OMINITY_DEBUG` to true.
455
+ <!-- End Debugging [debug] -->
456
+
457
+ # Development
458
+
459
+ ## Maturity
460
+
461
+ This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
462
+ to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
463
+ looking for the latest version.
464
+
465
+ ## Contributions
466
+
467
+ While we value open-source contributions to this SDK, it is still under active development.
468
+ We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
package/RUNTIMES.md ADDED
@@ -0,0 +1,48 @@
1
+ # Supported JavaScript runtimes
2
+
3
+ This SDK is intended to be used in JavaScript runtimes that support ECMAScript 2020 or newer. The SDK uses the following features:
4
+
5
+ - [Web Fetch API][web-fetch]
6
+ - [Web Streams API][web-streams] and in particular `ReadableStream`
7
+ - [Async iterables][async-iter] using `Symbol.asyncIterator`
8
+
9
+ [web-fetch]: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API
10
+ [web-streams]: https://developer.mozilla.org/en-US/docs/Web/API/Streams_API
11
+ [async-iter]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols
12
+
13
+ Runtime environments that are explicitly supported are:
14
+
15
+ - Evergreen browsers which include: Chrome, Safari, Edge, Firefox
16
+ - Node.js active and maintenance LTS releases
17
+ - Currently, this is v18, v20 and v22
18
+ - Bun v1 and above
19
+ - Deno v1.39
20
+ - Note that Deno does not currently have native support for streaming file uploads backed by the filesystem ([issue link][deno-file-streaming])
21
+
22
+ [deno-file-streaming]: https://github.com/denoland/deno/issues/11018
23
+
24
+ ## Recommended TypeScript compiler options
25
+
26
+ The following `tsconfig.json` options are recommended for projects using this
27
+ SDK in order to get static type support for features like async iterables,
28
+ streams and `fetch`-related APIs ([`for await...of`][for-await-of],
29
+ [`AbortSignal`][abort-signal], [`Request`][request], [`Response`][response] and
30
+ so on):
31
+
32
+ [for-await-of]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for-await...of
33
+ [abort-signal]: https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal
34
+ [request]: https://developer.mozilla.org/en-US/docs/Web/API/Request
35
+ [response]: https://developer.mozilla.org/en-US/docs/Web/API/Response
36
+
37
+ ```jsonc
38
+ {
39
+ "compilerOptions": {
40
+ "target": "es2020", // or higher
41
+ "lib": ["es2020", "dom", "dom.iterable"]
42
+ }
43
+ }
44
+ ```
45
+
46
+ While `target` can be set to older ECMAScript versions, it may result in extra,
47
+ unnecessary compatibility code being generated if you are not targeting old
48
+ runtimes.
@@ -0,0 +1,10 @@
1
+ import { ClientSDK } from "./lib/sdks.js";
2
+ /**
3
+ * A minimal client to use when calling standalone SDK functions. Typically, an
4
+ * instance of this class would be instantiated once at the start of an
5
+ * application and passed around through some dependency injection mechanism to
6
+ * parts of an application that need to make SDK calls.
7
+ */
8
+ export declare class OminityCore extends ClientSDK {
9
+ }
10
+ //# sourceMappingURL=core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C;;;;;GAKG;AACH,qBAAa,WAAY,SAAQ,SAAS;CAAG"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OminityCore = void 0;
4
+ const sdks_js_1 = require("./lib/sdks.js");
5
+ /**
6
+ * A minimal client to use when calling standalone SDK functions. Typically, an
7
+ * instance of this class would be instantiated once at the start of an
8
+ * application and passed around through some dependency injection mechanism to
9
+ * parts of an application that need to make SDK calls.
10
+ */
11
+ class OminityCore extends sdks_js_1.ClientSDK {
12
+ }
13
+ exports.OminityCore = OminityCore;
14
+ //# sourceMappingURL=core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"core.js","sourceRoot":"","sources":["../../src/core.ts"],"names":[],"mappings":";;;AACA,2CAA0C;AAE1C;;;;;GAKG;AACH,MAAa,WAAY,SAAQ,mBAAS;CAAG;AAA7C,kCAA6C"}
@@ -0,0 +1,25 @@
1
+ import { SDKOptions } from "../lib/config.js";
2
+ import { RequestInput } from "../lib/http.js";
3
+ import { AfterErrorContext, AfterErrorHook, AfterSuccessContext, AfterSuccessHook, BeforeCreateRequestContext, BeforeCreateRequestHook, BeforeRequestContext, BeforeRequestHook, Hooks, SDKInitHook } from "./types.js";
4
+ export declare class SDKHooks implements Hooks {
5
+ sdkInitHooks: SDKInitHook[];
6
+ beforeCreateRequestHooks: BeforeCreateRequestHook[];
7
+ beforeRequestHooks: BeforeRequestHook[];
8
+ afterSuccessHooks: AfterSuccessHook[];
9
+ afterErrorHooks: AfterErrorHook[];
10
+ constructor();
11
+ registerSDKInitHook(hook: SDKInitHook): void;
12
+ registerBeforeCreateRequestHook(hook: BeforeCreateRequestHook): void;
13
+ registerBeforeRequestHook(hook: BeforeRequestHook): void;
14
+ registerAfterSuccessHook(hook: AfterSuccessHook): void;
15
+ registerAfterErrorHook(hook: AfterErrorHook): void;
16
+ sdkInit(opts: SDKOptions): SDKOptions;
17
+ beforeCreateRequest(hookCtx: BeforeCreateRequestContext, input: RequestInput): RequestInput;
18
+ beforeRequest(hookCtx: BeforeRequestContext, request: Request): Promise<Request>;
19
+ afterSuccess(hookCtx: AfterSuccessContext, response: Response): Promise<Response>;
20
+ afterError(hookCtx: AfterErrorContext, response: Response | null, error: unknown): Promise<{
21
+ response: Response | null;
22
+ error: unknown;
23
+ }>;
24
+ }
25
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/hooks/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,0BAA0B,EAC1B,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,EAEjB,KAAK,EACL,WAAW,EACZ,MAAM,YAAY,CAAC;AAIpB,qBAAa,QAAS,YAAW,KAAK;IACpC,YAAY,EAAE,WAAW,EAAE,CAAM;IACjC,wBAAwB,EAAE,uBAAuB,EAAE,CAAM;IACzD,kBAAkB,EAAE,iBAAiB,EAAE,CAAM;IAC7C,iBAAiB,EAAE,gBAAgB,EAAE,CAAM;IAC3C,eAAe,EAAE,cAAc,EAAE,CAAM;;IAyBvC,mBAAmB,CAAC,IAAI,EAAE,WAAW;IAIrC,+BAA+B,CAAC,IAAI,EAAE,uBAAuB;IAI7D,yBAAyB,CAAC,IAAI,EAAE,iBAAiB;IAIjD,wBAAwB,CAAC,IAAI,EAAE,gBAAgB;IAI/C,sBAAsB,CAAC,IAAI,EAAE,cAAc;IAI3C,OAAO,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU;IAIrC,mBAAmB,CACjB,OAAO,EAAE,0BAA0B,EACnC,KAAK,EAAE,YAAY,GAClB,YAAY;IAUT,aAAa,CACjB,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,OAAO,CAAC;IAUb,YAAY,CAChB,OAAO,EAAE,mBAAmB,EAC5B,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,QAAQ,CAAC;IAUd,UAAU,CACd,OAAO,EAAE,iBAAiB,EAC1B,QAAQ,EAAE,QAAQ,GAAG,IAAI,EACzB,KAAK,EAAE,OAAO,GACb,OAAO,CAAC;QAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,CAAC;CAY1D"}