@omnibase/core-js 0.7.6 → 0.9.0

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 (744) hide show
  1. package/.openapi-generator/FILES +228 -0
  2. package/.openapi-generator/VERSION +1 -0
  3. package/.openapi-generator-ignore +23 -0
  4. package/README.md +240 -169
  5. package/dist/apis/DatabaseApi.d.ts +31 -0
  6. package/dist/apis/DatabaseApi.js +86 -0
  7. package/dist/apis/PaymentsApi.d.ts +57 -0
  8. package/dist/apis/PaymentsApi.js +141 -0
  9. package/dist/apis/PermissionsApi.d.ts +57 -0
  10. package/dist/apis/PermissionsApi.js +158 -0
  11. package/dist/apis/StorageApi.d.ts +57 -0
  12. package/dist/apis/StorageApi.js +141 -0
  13. package/dist/apis/StripeApi.d.ts +112 -0
  14. package/dist/apis/StripeApi.js +291 -0
  15. package/dist/apis/TenantsApi.d.ts +220 -0
  16. package/dist/apis/TenantsApi.js +617 -0
  17. package/dist/apis/index.d.ts +6 -0
  18. package/dist/apis/index.js +24 -0
  19. package/dist/esm/apis/DatabaseApi.d.ts +31 -0
  20. package/dist/esm/apis/DatabaseApi.js +82 -0
  21. package/dist/esm/apis/PaymentsApi.d.ts +57 -0
  22. package/dist/esm/apis/PaymentsApi.js +137 -0
  23. package/dist/esm/apis/PermissionsApi.d.ts +57 -0
  24. package/dist/esm/apis/PermissionsApi.js +154 -0
  25. package/dist/esm/apis/StorageApi.d.ts +57 -0
  26. package/dist/esm/apis/StorageApi.js +137 -0
  27. package/dist/esm/apis/StripeApi.d.ts +112 -0
  28. package/dist/esm/apis/StripeApi.js +287 -0
  29. package/dist/esm/apis/TenantsApi.d.ts +220 -0
  30. package/dist/esm/apis/TenantsApi.js +613 -0
  31. package/dist/esm/apis/index.d.ts +6 -0
  32. package/dist/esm/apis/index.js +8 -0
  33. package/dist/esm/index.d.ts +3 -0
  34. package/dist/esm/index.js +5 -0
  35. package/dist/esm/models/AcceptInvite200Response.d.ts +39 -0
  36. package/dist/esm/models/AcceptInvite200Response.js +44 -0
  37. package/dist/esm/models/AssignRole200Response.d.ts +39 -0
  38. package/dist/esm/models/AssignRole200Response.js +44 -0
  39. package/dist/esm/models/CheckPermission200Response.d.ts +39 -0
  40. package/dist/esm/models/CheckPermission200Response.js +44 -0
  41. package/dist/esm/models/ClientRelationship.d.ts +57 -0
  42. package/dist/esm/models/ClientRelationship.js +50 -0
  43. package/dist/esm/models/ClientSubjectSet.d.ts +44 -0
  44. package/dist/esm/models/ClientSubjectSet.js +45 -0
  45. package/dist/esm/models/CreateCheckout200Response.d.ts +39 -0
  46. package/dist/esm/models/CreateCheckout200Response.js +44 -0
  47. package/dist/esm/models/CreateCustomerPortal200Response.d.ts +39 -0
  48. package/dist/esm/models/CreateCustomerPortal200Response.js +44 -0
  49. package/dist/esm/models/CreateInvite200Response.d.ts +39 -0
  50. package/dist/esm/models/CreateInvite200Response.js +44 -0
  51. package/dist/esm/models/CreateRelationship200Response.d.ts +39 -0
  52. package/dist/esm/models/CreateRelationship200Response.js +44 -0
  53. package/dist/esm/models/CreateRole200Response.d.ts +39 -0
  54. package/dist/esm/models/CreateRole200Response.js +44 -0
  55. package/dist/esm/models/CreateTenant200Response.d.ts +39 -0
  56. package/dist/esm/models/CreateTenant200Response.js +44 -0
  57. package/dist/esm/models/DeleteRole200Response.d.ts +39 -0
  58. package/dist/esm/models/DeleteRole200Response.js +44 -0
  59. package/dist/esm/models/DeleteTenant200Response.d.ts +39 -0
  60. package/dist/esm/models/DeleteTenant200Response.js +44 -0
  61. package/dist/esm/models/DeployPermissionNamespaces200Response.d.ts +39 -0
  62. package/dist/esm/models/DeployPermissionNamespaces200Response.js +44 -0
  63. package/dist/esm/models/GetRoleDefinitions200Response.d.ts +39 -0
  64. package/dist/esm/models/GetRoleDefinitions200Response.js +44 -0
  65. package/dist/esm/models/GetTenantBillingStatus200Response.d.ts +39 -0
  66. package/dist/esm/models/GetTenantBillingStatus200Response.js +44 -0
  67. package/dist/esm/models/GetTenantJWT200Response.d.ts +39 -0
  68. package/dist/esm/models/GetTenantJWT200Response.js +44 -0
  69. package/dist/esm/models/HandlersBadRequestResponse.d.ts +38 -0
  70. package/dist/esm/models/HandlersBadRequestResponse.js +43 -0
  71. package/dist/esm/models/HandlersForbiddenResponse.d.ts +38 -0
  72. package/dist/esm/models/HandlersForbiddenResponse.js +43 -0
  73. package/dist/esm/models/HandlersInternalServerErrorResponse.d.ts +38 -0
  74. package/dist/esm/models/HandlersInternalServerErrorResponse.js +43 -0
  75. package/dist/esm/models/HandlersNotFoundErrorResponse.d.ts +38 -0
  76. package/dist/esm/models/HandlersNotFoundErrorResponse.js +43 -0
  77. package/dist/esm/models/HandlersSuccessResponse.d.ts +38 -0
  78. package/dist/esm/models/HandlersSuccessResponse.js +43 -0
  79. package/dist/esm/models/HandlersUnauthorizedResponse.d.ts +38 -0
  80. package/dist/esm/models/HandlersUnauthorizedResponse.js +43 -0
  81. package/dist/esm/models/ListRoles200Response.d.ts +39 -0
  82. package/dist/esm/models/ListRoles200Response.js +44 -0
  83. package/dist/esm/models/ListTenantSubscriptions200Response.d.ts +39 -0
  84. package/dist/esm/models/ListTenantSubscriptions200Response.js +44 -0
  85. package/dist/esm/models/ListTenantUsers200Response.d.ts +39 -0
  86. package/dist/esm/models/ListTenantUsers200Response.js +44 -0
  87. package/dist/esm/models/ModelsBillingStatusResponse.d.ts +38 -0
  88. package/dist/esm/models/ModelsBillingStatusResponse.js +43 -0
  89. package/dist/esm/models/ModelsDeleteObjectRequest.d.ts +32 -0
  90. package/dist/esm/models/ModelsDeleteObjectRequest.js +43 -0
  91. package/dist/esm/models/ModelsDownloadRequest.d.ts +32 -0
  92. package/dist/esm/models/ModelsDownloadRequest.js +43 -0
  93. package/dist/esm/models/ModelsDownloadResponse.d.ts +32 -0
  94. package/dist/esm/models/ModelsDownloadResponse.js +41 -0
  95. package/dist/esm/models/ModelsMessageResponse.d.ts +32 -0
  96. package/dist/esm/models/ModelsMessageResponse.js +41 -0
  97. package/dist/esm/models/ModelsMeter.d.ts +65 -0
  98. package/dist/esm/models/ModelsMeter.js +62 -0
  99. package/dist/esm/models/ModelsMeterCustomerMapping.d.ts +45 -0
  100. package/dist/esm/models/ModelsMeterCustomerMapping.js +53 -0
  101. package/dist/esm/models/ModelsMeterDefaultAggregation.d.ts +41 -0
  102. package/dist/esm/models/ModelsMeterDefaultAggregation.js +51 -0
  103. package/dist/esm/models/ModelsMeterValueSettings.d.ts +32 -0
  104. package/dist/esm/models/ModelsMeterValueSettings.js +43 -0
  105. package/dist/esm/models/ModelsMeterWithStripeID.d.ts +71 -0
  106. package/dist/esm/models/ModelsMeterWithStripeID.js +64 -0
  107. package/dist/esm/models/ModelsNamespaceDefinition.d.ts +50 -0
  108. package/dist/esm/models/ModelsNamespaceDefinition.js +47 -0
  109. package/dist/esm/models/ModelsPrice.d.ts +112 -0
  110. package/dist/esm/models/ModelsPrice.js +73 -0
  111. package/dist/esm/models/ModelsPriceDisplay.d.ts +44 -0
  112. package/dist/esm/models/ModelsPriceDisplay.js +45 -0
  113. package/dist/esm/models/ModelsPriceLimit.d.ts +44 -0
  114. package/dist/esm/models/ModelsPriceLimit.js +45 -0
  115. package/dist/esm/models/ModelsPriceUI.d.ts +58 -0
  116. package/dist/esm/models/ModelsPriceUI.js +51 -0
  117. package/dist/esm/models/ModelsPriceWithStripeID.d.ts +118 -0
  118. package/dist/esm/models/ModelsPriceWithStripeID.js +75 -0
  119. package/dist/esm/models/ModelsProduct.d.ts +64 -0
  120. package/dist/esm/models/ModelsProduct.js +59 -0
  121. package/dist/esm/models/ModelsProductUI.d.ts +68 -0
  122. package/dist/esm/models/ModelsProductUI.js +53 -0
  123. package/dist/esm/models/ModelsProductWithStripeIDs.d.ts +70 -0
  124. package/dist/esm/models/ModelsProductWithStripeIDs.js +61 -0
  125. package/dist/esm/models/ModelsRole.d.ts +68 -0
  126. package/dist/esm/models/ModelsRole.js +53 -0
  127. package/dist/esm/models/ModelsStripeConfiguration.d.ts +46 -0
  128. package/dist/esm/models/ModelsStripeConfiguration.js +51 -0
  129. package/dist/esm/models/ModelsStripeConfigurationWithIDs.d.ts +46 -0
  130. package/dist/esm/models/ModelsStripeConfigurationWithIDs.js +51 -0
  131. package/dist/esm/models/ModelsSubscriptionResponse.d.ts +56 -0
  132. package/dist/esm/models/ModelsSubscriptionResponse.js +49 -0
  133. package/dist/esm/models/ModelsTenant.d.ts +69 -0
  134. package/dist/esm/models/ModelsTenant.js +54 -0
  135. package/dist/esm/models/ModelsTenantInvite.d.ts +87 -0
  136. package/dist/esm/models/ModelsTenantInvite.js +60 -0
  137. package/dist/esm/models/ModelsTenantSettings.d.ts +44 -0
  138. package/dist/esm/models/ModelsTenantSettings.js +45 -0
  139. package/dist/esm/models/ModelsTier.d.ts +44 -0
  140. package/dist/esm/models/ModelsTier.js +45 -0
  141. package/dist/esm/models/ModelsUploadRequest.d.ts +40 -0
  142. package/dist/esm/models/ModelsUploadRequest.js +45 -0
  143. package/dist/esm/models/ModelsUploadResponse.d.ts +38 -0
  144. package/dist/esm/models/ModelsUploadResponse.js +43 -0
  145. package/dist/esm/models/StorageDownloadPost200Response.d.ts +39 -0
  146. package/dist/esm/models/StorageDownloadPost200Response.js +44 -0
  147. package/dist/esm/models/StorageObjectDelete200Response.d.ts +39 -0
  148. package/dist/esm/models/StorageObjectDelete200Response.js +44 -0
  149. package/dist/esm/models/StorageUploadPost200Response.d.ts +39 -0
  150. package/dist/esm/models/StorageUploadPost200Response.js +44 -0
  151. package/dist/esm/models/StripeConfigArchiveAllPost200Response.d.ts +39 -0
  152. package/dist/esm/models/StripeConfigArchiveAllPost200Response.js +44 -0
  153. package/dist/esm/models/StripeConfigGet200Response.d.ts +39 -0
  154. package/dist/esm/models/StripeConfigGet200Response.js +44 -0
  155. package/dist/esm/models/StripeConfigHistoryGet200Response.d.ts +39 -0
  156. package/dist/esm/models/StripeConfigHistoryGet200Response.js +44 -0
  157. package/dist/esm/models/StripeConfigPullGet200Response.d.ts +39 -0
  158. package/dist/esm/models/StripeConfigPullGet200Response.js +44 -0
  159. package/dist/esm/models/SwitchActiveTenant200Response.d.ts +39 -0
  160. package/dist/esm/models/SwitchActiveTenant200Response.js +44 -0
  161. package/dist/esm/models/TenantsAcceptInviteRequest.d.ts +32 -0
  162. package/dist/esm/models/TenantsAcceptInviteRequest.js +43 -0
  163. package/dist/esm/models/TenantsAcceptInviteResponse.d.ts +44 -0
  164. package/dist/esm/models/TenantsAcceptInviteResponse.js +45 -0
  165. package/dist/esm/models/TenantsAssignRoleRequest.d.ts +38 -0
  166. package/dist/esm/models/TenantsAssignRoleRequest.js +43 -0
  167. package/dist/esm/models/TenantsAssignRoleResponse.d.ts +32 -0
  168. package/dist/esm/models/TenantsAssignRoleResponse.js +41 -0
  169. package/dist/esm/models/TenantsCreateRoleRequest.d.ts +38 -0
  170. package/dist/esm/models/TenantsCreateRoleRequest.js +47 -0
  171. package/dist/esm/models/TenantsCreateTenantRequest.d.ts +44 -0
  172. package/dist/esm/models/TenantsCreateTenantRequest.js +49 -0
  173. package/dist/esm/models/TenantsCreateTenantResponse.d.ts +45 -0
  174. package/dist/esm/models/TenantsCreateTenantResponse.js +46 -0
  175. package/dist/esm/models/TenantsCreateTenantUserInviteRequest.d.ts +44 -0
  176. package/dist/esm/models/TenantsCreateTenantUserInviteRequest.js +51 -0
  177. package/dist/esm/models/TenantsCreateTenantUserInviteResponse.d.ts +39 -0
  178. package/dist/esm/models/TenantsCreateTenantUserInviteResponse.js +44 -0
  179. package/dist/esm/models/TenantsDeleteRoleResponse.d.ts +32 -0
  180. package/dist/esm/models/TenantsDeleteRoleResponse.js +41 -0
  181. package/dist/esm/models/TenantsDeleteTenantResponse.d.ts +32 -0
  182. package/dist/esm/models/TenantsDeleteTenantResponse.js +41 -0
  183. package/dist/esm/models/TenantsDeleteTenantUserRequest.d.ts +32 -0
  184. package/dist/esm/models/TenantsDeleteTenantUserRequest.js +43 -0
  185. package/dist/esm/models/TenantsJWTTokenResponse.d.ts +32 -0
  186. package/dist/esm/models/TenantsJWTTokenResponse.js +41 -0
  187. package/dist/esm/models/TenantsNamespaceDefinitionsResponse.d.ts +33 -0
  188. package/dist/esm/models/TenantsNamespaceDefinitionsResponse.js +42 -0
  189. package/dist/esm/models/TenantsRolesListResponse.d.ts +33 -0
  190. package/dist/esm/models/TenantsRolesListResponse.js +42 -0
  191. package/dist/esm/models/TenantsSwitchTenantRequest.d.ts +32 -0
  192. package/dist/esm/models/TenantsSwitchTenantRequest.js +43 -0
  193. package/dist/esm/models/TenantsSwitchTenantResponse.d.ts +38 -0
  194. package/dist/esm/models/TenantsSwitchTenantResponse.js +43 -0
  195. package/dist/esm/models/TenantsTenantUserResponse.d.ts +56 -0
  196. package/dist/esm/models/TenantsTenantUserResponse.js +49 -0
  197. package/dist/esm/models/TenantsUpdateRoleRequest.d.ts +32 -0
  198. package/dist/esm/models/TenantsUpdateRoleRequest.js +43 -0
  199. package/dist/esm/models/TenantsUpdateTenantUserRoleRequest.d.ts +38 -0
  200. package/dist/esm/models/TenantsUpdateTenantUserRoleRequest.js +47 -0
  201. package/dist/esm/models/TenantsUpdateTenantUserRoleResponse.d.ts +32 -0
  202. package/dist/esm/models/TenantsUpdateTenantUserRoleResponse.js +41 -0
  203. package/dist/esm/models/UpdateTenantUserRole200Response.d.ts +39 -0
  204. package/dist/esm/models/UpdateTenantUserRole200Response.js +44 -0
  205. package/dist/esm/models/V1ArchiveAllResponse.d.ts +62 -0
  206. package/dist/esm/models/V1ArchiveAllResponse.js +51 -0
  207. package/dist/esm/models/V1CheckPermissionRequest.d.ts +57 -0
  208. package/dist/esm/models/V1CheckPermissionRequest.js +56 -0
  209. package/dist/esm/models/V1CheckPermissionResponse.d.ts +32 -0
  210. package/dist/esm/models/V1CheckPermissionResponse.js +41 -0
  211. package/dist/esm/models/V1ConfigHistoryItem.d.ts +63 -0
  212. package/dist/esm/models/V1ConfigHistoryItem.js +52 -0
  213. package/dist/esm/models/V1ConfigHistoryPagination.d.ts +62 -0
  214. package/dist/esm/models/V1ConfigHistoryPagination.js +51 -0
  215. package/dist/esm/models/V1ConfigHistoryResponse.d.ts +40 -0
  216. package/dist/esm/models/V1ConfigHistoryResponse.js +45 -0
  217. package/dist/esm/models/V1CreateCheckoutRequest.d.ts +62 -0
  218. package/dist/esm/models/V1CreateCheckoutRequest.js +57 -0
  219. package/dist/esm/models/V1CreateCheckoutResponse.d.ts +38 -0
  220. package/dist/esm/models/V1CreateCheckoutResponse.js +43 -0
  221. package/dist/esm/models/V1CreatePortalRequest.d.ts +32 -0
  222. package/dist/esm/models/V1CreatePortalRequest.js +43 -0
  223. package/dist/esm/models/V1CreatePortalResponse.d.ts +32 -0
  224. package/dist/esm/models/V1CreatePortalResponse.js +43 -0
  225. package/dist/esm/models/V1CreateRelationshipRequest.d.ts +57 -0
  226. package/dist/esm/models/V1CreateRelationshipRequest.js +56 -0
  227. package/dist/esm/models/V1CreateRelationshipResponse.d.ts +39 -0
  228. package/dist/esm/models/V1CreateRelationshipResponse.js +44 -0
  229. package/dist/esm/models/V1MigrationErrorResponse.d.ts +38 -0
  230. package/dist/esm/models/V1MigrationErrorResponse.js +43 -0
  231. package/dist/esm/models/V1MigrationSuccessResponse.d.ts +38 -0
  232. package/dist/esm/models/V1MigrationSuccessResponse.js +43 -0
  233. package/dist/esm/models/V1NamespaceDeploymentResponse.d.ts +56 -0
  234. package/dist/esm/models/V1NamespaceDeploymentResponse.js +49 -0
  235. package/dist/esm/models/V1RecordUsageRequest.d.ts +38 -0
  236. package/dist/esm/models/V1RecordUsageRequest.js +47 -0
  237. package/dist/esm/models/V1StripeConfigResponse.d.ts +57 -0
  238. package/dist/esm/models/V1StripeConfigResponse.js +50 -0
  239. package/dist/esm/models/V1SubjectSetRequest.d.ts +44 -0
  240. package/dist/esm/models/V1SubjectSetRequest.js +49 -0
  241. package/dist/esm/models/index.d.ts +103 -0
  242. package/dist/esm/models/index.js +105 -0
  243. package/dist/esm/runtime.d.ts +184 -0
  244. package/dist/esm/runtime.js +334 -0
  245. package/dist/index.d.ts +3 -2
  246. package/dist/index.js +20 -158
  247. package/dist/models/AcceptInvite200Response.d.ts +39 -0
  248. package/dist/models/AcceptInvite200Response.js +51 -0
  249. package/dist/models/AssignRole200Response.d.ts +39 -0
  250. package/dist/models/AssignRole200Response.js +51 -0
  251. package/dist/models/CheckPermission200Response.d.ts +39 -0
  252. package/dist/models/CheckPermission200Response.js +51 -0
  253. package/dist/models/ClientRelationship.d.ts +57 -0
  254. package/dist/models/ClientRelationship.js +57 -0
  255. package/dist/models/ClientSubjectSet.d.ts +44 -0
  256. package/dist/models/ClientSubjectSet.js +52 -0
  257. package/dist/models/CreateCheckout200Response.d.ts +39 -0
  258. package/dist/models/CreateCheckout200Response.js +51 -0
  259. package/dist/models/CreateCustomerPortal200Response.d.ts +39 -0
  260. package/dist/models/CreateCustomerPortal200Response.js +51 -0
  261. package/dist/models/CreateInvite200Response.d.ts +39 -0
  262. package/dist/models/CreateInvite200Response.js +51 -0
  263. package/dist/models/CreateRelationship200Response.d.ts +39 -0
  264. package/dist/models/CreateRelationship200Response.js +51 -0
  265. package/dist/models/CreateRole200Response.d.ts +39 -0
  266. package/dist/models/CreateRole200Response.js +51 -0
  267. package/dist/models/CreateTenant200Response.d.ts +39 -0
  268. package/dist/models/CreateTenant200Response.js +51 -0
  269. package/dist/models/DeleteRole200Response.d.ts +39 -0
  270. package/dist/models/DeleteRole200Response.js +51 -0
  271. package/dist/models/DeleteTenant200Response.d.ts +39 -0
  272. package/dist/models/DeleteTenant200Response.js +51 -0
  273. package/dist/models/DeployPermissionNamespaces200Response.d.ts +39 -0
  274. package/dist/models/DeployPermissionNamespaces200Response.js +51 -0
  275. package/dist/models/GetRoleDefinitions200Response.d.ts +39 -0
  276. package/dist/models/GetRoleDefinitions200Response.js +51 -0
  277. package/dist/models/GetTenantBillingStatus200Response.d.ts +39 -0
  278. package/dist/models/GetTenantBillingStatus200Response.js +51 -0
  279. package/dist/models/GetTenantJWT200Response.d.ts +39 -0
  280. package/dist/models/GetTenantJWT200Response.js +51 -0
  281. package/dist/models/HandlersBadRequestResponse.d.ts +38 -0
  282. package/dist/models/HandlersBadRequestResponse.js +50 -0
  283. package/dist/models/HandlersForbiddenResponse.d.ts +38 -0
  284. package/dist/models/HandlersForbiddenResponse.js +50 -0
  285. package/dist/models/HandlersInternalServerErrorResponse.d.ts +38 -0
  286. package/dist/models/HandlersInternalServerErrorResponse.js +50 -0
  287. package/dist/models/HandlersNotFoundErrorResponse.d.ts +38 -0
  288. package/dist/models/HandlersNotFoundErrorResponse.js +50 -0
  289. package/dist/models/HandlersSuccessResponse.d.ts +38 -0
  290. package/dist/models/HandlersSuccessResponse.js +50 -0
  291. package/dist/models/HandlersUnauthorizedResponse.d.ts +38 -0
  292. package/dist/models/HandlersUnauthorizedResponse.js +50 -0
  293. package/dist/models/ListRoles200Response.d.ts +39 -0
  294. package/dist/models/ListRoles200Response.js +51 -0
  295. package/dist/models/ListTenantSubscriptions200Response.d.ts +39 -0
  296. package/dist/models/ListTenantSubscriptions200Response.js +51 -0
  297. package/dist/models/ListTenantUsers200Response.d.ts +39 -0
  298. package/dist/models/ListTenantUsers200Response.js +51 -0
  299. package/dist/models/ModelsBillingStatusResponse.d.ts +38 -0
  300. package/dist/models/ModelsBillingStatusResponse.js +50 -0
  301. package/dist/models/ModelsDeleteObjectRequest.d.ts +32 -0
  302. package/dist/models/ModelsDeleteObjectRequest.js +50 -0
  303. package/dist/models/ModelsDownloadRequest.d.ts +32 -0
  304. package/dist/models/ModelsDownloadRequest.js +50 -0
  305. package/dist/models/ModelsDownloadResponse.d.ts +32 -0
  306. package/dist/models/ModelsDownloadResponse.js +48 -0
  307. package/dist/models/ModelsMessageResponse.d.ts +32 -0
  308. package/dist/models/ModelsMessageResponse.js +48 -0
  309. package/dist/models/ModelsMeter.d.ts +65 -0
  310. package/dist/models/ModelsMeter.js +69 -0
  311. package/dist/models/ModelsMeterCustomerMapping.d.ts +45 -0
  312. package/dist/models/ModelsMeterCustomerMapping.js +61 -0
  313. package/dist/models/ModelsMeterDefaultAggregation.d.ts +41 -0
  314. package/dist/models/ModelsMeterDefaultAggregation.js +59 -0
  315. package/dist/models/ModelsMeterValueSettings.d.ts +32 -0
  316. package/dist/models/ModelsMeterValueSettings.js +50 -0
  317. package/dist/models/ModelsMeterWithStripeID.d.ts +71 -0
  318. package/dist/models/ModelsMeterWithStripeID.js +71 -0
  319. package/dist/models/ModelsNamespaceDefinition.d.ts +50 -0
  320. package/dist/models/ModelsNamespaceDefinition.js +54 -0
  321. package/dist/models/ModelsPrice.d.ts +112 -0
  322. package/dist/models/ModelsPrice.js +80 -0
  323. package/dist/models/ModelsPriceDisplay.d.ts +44 -0
  324. package/dist/models/ModelsPriceDisplay.js +52 -0
  325. package/dist/models/ModelsPriceLimit.d.ts +44 -0
  326. package/dist/models/ModelsPriceLimit.js +52 -0
  327. package/dist/models/ModelsPriceUI.d.ts +58 -0
  328. package/dist/models/ModelsPriceUI.js +58 -0
  329. package/dist/models/ModelsPriceWithStripeID.d.ts +118 -0
  330. package/dist/models/ModelsPriceWithStripeID.js +82 -0
  331. package/dist/models/ModelsProduct.d.ts +64 -0
  332. package/dist/models/ModelsProduct.js +66 -0
  333. package/dist/models/ModelsProductUI.d.ts +68 -0
  334. package/dist/models/ModelsProductUI.js +60 -0
  335. package/dist/models/ModelsProductWithStripeIDs.d.ts +70 -0
  336. package/dist/models/ModelsProductWithStripeIDs.js +68 -0
  337. package/dist/models/ModelsRole.d.ts +68 -0
  338. package/dist/models/ModelsRole.js +60 -0
  339. package/dist/models/ModelsStripeConfiguration.d.ts +46 -0
  340. package/dist/models/ModelsStripeConfiguration.js +58 -0
  341. package/dist/models/ModelsStripeConfigurationWithIDs.d.ts +46 -0
  342. package/dist/models/ModelsStripeConfigurationWithIDs.js +58 -0
  343. package/dist/models/ModelsSubscriptionResponse.d.ts +56 -0
  344. package/dist/models/ModelsSubscriptionResponse.js +56 -0
  345. package/dist/models/ModelsTenant.d.ts +69 -0
  346. package/dist/models/ModelsTenant.js +61 -0
  347. package/dist/models/ModelsTenantInvite.d.ts +87 -0
  348. package/dist/models/ModelsTenantInvite.js +67 -0
  349. package/dist/models/ModelsTenantSettings.d.ts +44 -0
  350. package/dist/models/ModelsTenantSettings.js +52 -0
  351. package/dist/models/ModelsTier.d.ts +44 -0
  352. package/dist/models/ModelsTier.js +52 -0
  353. package/dist/models/ModelsUploadRequest.d.ts +40 -0
  354. package/dist/models/ModelsUploadRequest.js +52 -0
  355. package/dist/models/ModelsUploadResponse.d.ts +38 -0
  356. package/dist/models/ModelsUploadResponse.js +50 -0
  357. package/dist/models/StorageDownloadPost200Response.d.ts +39 -0
  358. package/dist/models/StorageDownloadPost200Response.js +51 -0
  359. package/dist/models/StorageObjectDelete200Response.d.ts +39 -0
  360. package/dist/models/StorageObjectDelete200Response.js +51 -0
  361. package/dist/models/StorageUploadPost200Response.d.ts +39 -0
  362. package/dist/models/StorageUploadPost200Response.js +51 -0
  363. package/dist/models/StripeConfigArchiveAllPost200Response.d.ts +39 -0
  364. package/dist/models/StripeConfigArchiveAllPost200Response.js +51 -0
  365. package/dist/models/StripeConfigGet200Response.d.ts +39 -0
  366. package/dist/models/StripeConfigGet200Response.js +51 -0
  367. package/dist/models/StripeConfigHistoryGet200Response.d.ts +39 -0
  368. package/dist/models/StripeConfigHistoryGet200Response.js +51 -0
  369. package/dist/models/StripeConfigPullGet200Response.d.ts +39 -0
  370. package/dist/models/StripeConfigPullGet200Response.js +51 -0
  371. package/dist/models/SwitchActiveTenant200Response.d.ts +39 -0
  372. package/dist/models/SwitchActiveTenant200Response.js +51 -0
  373. package/dist/models/TenantsAcceptInviteRequest.d.ts +32 -0
  374. package/dist/models/TenantsAcceptInviteRequest.js +50 -0
  375. package/dist/models/TenantsAcceptInviteResponse.d.ts +44 -0
  376. package/dist/models/TenantsAcceptInviteResponse.js +52 -0
  377. package/dist/models/TenantsAssignRoleRequest.d.ts +38 -0
  378. package/dist/models/TenantsAssignRoleRequest.js +50 -0
  379. package/dist/models/TenantsAssignRoleResponse.d.ts +32 -0
  380. package/dist/models/TenantsAssignRoleResponse.js +48 -0
  381. package/dist/models/TenantsCreateRoleRequest.d.ts +38 -0
  382. package/dist/models/TenantsCreateRoleRequest.js +54 -0
  383. package/dist/models/TenantsCreateTenantRequest.d.ts +44 -0
  384. package/dist/models/TenantsCreateTenantRequest.js +56 -0
  385. package/dist/models/TenantsCreateTenantResponse.d.ts +45 -0
  386. package/dist/models/TenantsCreateTenantResponse.js +53 -0
  387. package/dist/models/TenantsCreateTenantUserInviteRequest.d.ts +44 -0
  388. package/dist/models/TenantsCreateTenantUserInviteRequest.js +58 -0
  389. package/dist/models/TenantsCreateTenantUserInviteResponse.d.ts +39 -0
  390. package/dist/models/TenantsCreateTenantUserInviteResponse.js +51 -0
  391. package/dist/models/TenantsDeleteRoleResponse.d.ts +32 -0
  392. package/dist/models/TenantsDeleteRoleResponse.js +48 -0
  393. package/dist/models/TenantsDeleteTenantResponse.d.ts +32 -0
  394. package/dist/models/TenantsDeleteTenantResponse.js +48 -0
  395. package/dist/models/TenantsDeleteTenantUserRequest.d.ts +32 -0
  396. package/dist/models/TenantsDeleteTenantUserRequest.js +50 -0
  397. package/dist/models/TenantsJWTTokenResponse.d.ts +32 -0
  398. package/dist/models/TenantsJWTTokenResponse.js +48 -0
  399. package/dist/models/TenantsNamespaceDefinitionsResponse.d.ts +33 -0
  400. package/dist/models/TenantsNamespaceDefinitionsResponse.js +49 -0
  401. package/dist/models/TenantsRolesListResponse.d.ts +33 -0
  402. package/dist/models/TenantsRolesListResponse.js +49 -0
  403. package/dist/models/TenantsSwitchTenantRequest.d.ts +32 -0
  404. package/dist/models/TenantsSwitchTenantRequest.js +50 -0
  405. package/dist/models/TenantsSwitchTenantResponse.d.ts +38 -0
  406. package/dist/models/TenantsSwitchTenantResponse.js +50 -0
  407. package/dist/models/TenantsTenantUserResponse.d.ts +56 -0
  408. package/dist/models/TenantsTenantUserResponse.js +56 -0
  409. package/dist/models/TenantsUpdateRoleRequest.d.ts +32 -0
  410. package/dist/models/TenantsUpdateRoleRequest.js +50 -0
  411. package/dist/models/TenantsUpdateTenantUserRoleRequest.d.ts +38 -0
  412. package/dist/models/TenantsUpdateTenantUserRoleRequest.js +54 -0
  413. package/dist/models/TenantsUpdateTenantUserRoleResponse.d.ts +32 -0
  414. package/dist/models/TenantsUpdateTenantUserRoleResponse.js +48 -0
  415. package/dist/models/UpdateTenantUserRole200Response.d.ts +39 -0
  416. package/dist/models/UpdateTenantUserRole200Response.js +51 -0
  417. package/dist/models/V1ArchiveAllResponse.d.ts +62 -0
  418. package/dist/models/V1ArchiveAllResponse.js +58 -0
  419. package/dist/models/V1CheckPermissionRequest.d.ts +57 -0
  420. package/dist/models/V1CheckPermissionRequest.js +63 -0
  421. package/dist/models/V1CheckPermissionResponse.d.ts +32 -0
  422. package/dist/models/V1CheckPermissionResponse.js +48 -0
  423. package/dist/models/V1ConfigHistoryItem.d.ts +63 -0
  424. package/dist/models/V1ConfigHistoryItem.js +59 -0
  425. package/dist/models/V1ConfigHistoryPagination.d.ts +62 -0
  426. package/dist/models/V1ConfigHistoryPagination.js +58 -0
  427. package/dist/models/V1ConfigHistoryResponse.d.ts +40 -0
  428. package/dist/models/V1ConfigHistoryResponse.js +52 -0
  429. package/dist/models/V1CreateCheckoutRequest.d.ts +62 -0
  430. package/dist/models/V1CreateCheckoutRequest.js +64 -0
  431. package/dist/models/V1CreateCheckoutResponse.d.ts +38 -0
  432. package/dist/models/V1CreateCheckoutResponse.js +50 -0
  433. package/dist/models/V1CreatePortalRequest.d.ts +32 -0
  434. package/dist/models/V1CreatePortalRequest.js +50 -0
  435. package/dist/models/V1CreatePortalResponse.d.ts +32 -0
  436. package/dist/models/V1CreatePortalResponse.js +50 -0
  437. package/dist/models/V1CreateRelationshipRequest.d.ts +57 -0
  438. package/dist/models/V1CreateRelationshipRequest.js +63 -0
  439. package/dist/models/V1CreateRelationshipResponse.d.ts +39 -0
  440. package/dist/models/V1CreateRelationshipResponse.js +51 -0
  441. package/dist/models/V1MigrationErrorResponse.d.ts +38 -0
  442. package/dist/models/V1MigrationErrorResponse.js +50 -0
  443. package/dist/models/V1MigrationSuccessResponse.d.ts +38 -0
  444. package/dist/models/V1MigrationSuccessResponse.js +50 -0
  445. package/dist/models/V1NamespaceDeploymentResponse.d.ts +56 -0
  446. package/dist/models/V1NamespaceDeploymentResponse.js +56 -0
  447. package/dist/models/V1RecordUsageRequest.d.ts +38 -0
  448. package/dist/models/V1RecordUsageRequest.js +54 -0
  449. package/dist/models/V1StripeConfigResponse.d.ts +57 -0
  450. package/dist/models/V1StripeConfigResponse.js +57 -0
  451. package/dist/models/V1SubjectSetRequest.d.ts +44 -0
  452. package/dist/models/V1SubjectSetRequest.js +56 -0
  453. package/dist/models/index.d.ts +103 -0
  454. package/dist/models/index.js +121 -0
  455. package/dist/runtime.d.ts +184 -0
  456. package/dist/runtime.js +350 -0
  457. package/docs/AcceptInvite200Response.md +36 -0
  458. package/docs/AssignRole200Response.md +36 -0
  459. package/docs/CheckPermission200Response.md +36 -0
  460. package/docs/ClientRelationship.md +42 -0
  461. package/docs/ClientSubjectSet.md +38 -0
  462. package/docs/CreateCheckout200Response.md +36 -0
  463. package/docs/CreateCustomerPortal200Response.md +36 -0
  464. package/docs/CreateInvite200Response.md +36 -0
  465. package/docs/CreateRelationship200Response.md +36 -0
  466. package/docs/CreateRole200Response.md +36 -0
  467. package/docs/CreateTenant200Response.md +36 -0
  468. package/docs/DatabaseApi.md +83 -0
  469. package/docs/DeleteRole200Response.md +36 -0
  470. package/docs/DeleteTenant200Response.md +36 -0
  471. package/docs/DeployPermissionNamespaces200Response.md +36 -0
  472. package/docs/GetRoleDefinitions200Response.md +36 -0
  473. package/docs/GetTenantBillingStatus200Response.md +36 -0
  474. package/docs/GetTenantJWT200Response.md +36 -0
  475. package/docs/HandlersBadRequestResponse.md +36 -0
  476. package/docs/HandlersForbiddenResponse.md +36 -0
  477. package/docs/HandlersInternalServerErrorResponse.md +36 -0
  478. package/docs/HandlersNotFoundErrorResponse.md +36 -0
  479. package/docs/HandlersSuccessResponse.md +36 -0
  480. package/docs/HandlersUnauthorizedResponse.md +36 -0
  481. package/docs/ListRoles200Response.md +36 -0
  482. package/docs/ListTenantSubscriptions200Response.md +36 -0
  483. package/docs/ListTenantUsers200Response.md +36 -0
  484. package/docs/ModelsBillingStatusResponse.md +36 -0
  485. package/docs/ModelsDeleteObjectRequest.md +34 -0
  486. package/docs/ModelsDownloadRequest.md +34 -0
  487. package/docs/ModelsDownloadResponse.md +34 -0
  488. package/docs/ModelsMessageResponse.md +34 -0
  489. package/docs/ModelsMeter.md +44 -0
  490. package/docs/ModelsMeterCustomerMapping.md +36 -0
  491. package/docs/ModelsMeterDefaultAggregation.md +34 -0
  492. package/docs/ModelsMeterValueSettings.md +34 -0
  493. package/docs/ModelsMeterWithStripeID.md +46 -0
  494. package/docs/ModelsNamespaceDefinition.md +40 -0
  495. package/docs/ModelsPrice.md +60 -0
  496. package/docs/ModelsPriceDisplay.md +38 -0
  497. package/docs/ModelsPriceLimit.md +38 -0
  498. package/docs/ModelsPriceUI.md +42 -0
  499. package/docs/ModelsPriceWithStripeID.md +62 -0
  500. package/docs/ModelsProduct.md +44 -0
  501. package/docs/ModelsProductUI.md +46 -0
  502. package/docs/ModelsProductWithStripeIDs.md +46 -0
  503. package/docs/ModelsRole.md +46 -0
  504. package/docs/ModelsStripeConfiguration.md +38 -0
  505. package/docs/ModelsStripeConfigurationWithIDs.md +38 -0
  506. package/docs/ModelsSubscriptionResponse.md +42 -0
  507. package/docs/ModelsTenant.md +46 -0
  508. package/docs/ModelsTenantInvite.md +52 -0
  509. package/docs/ModelsTenantSettings.md +38 -0
  510. package/docs/ModelsTier.md +38 -0
  511. package/docs/ModelsUploadRequest.md +36 -0
  512. package/docs/ModelsUploadResponse.md +36 -0
  513. package/docs/PaymentsApi.md +233 -0
  514. package/docs/PermissionsApi.md +233 -0
  515. package/docs/StorageApi.md +237 -0
  516. package/docs/StorageDownloadPost200Response.md +36 -0
  517. package/docs/StorageObjectDelete200Response.md +36 -0
  518. package/docs/StorageUploadPost200Response.md +36 -0
  519. package/docs/StripeApi.md +553 -0
  520. package/docs/StripeConfigArchiveAllPost200Response.md +36 -0
  521. package/docs/StripeConfigGet200Response.md +36 -0
  522. package/docs/StripeConfigHistoryGet200Response.md +36 -0
  523. package/docs/StripeConfigPullGet200Response.md +36 -0
  524. package/docs/SwitchActiveTenant200Response.md +36 -0
  525. package/docs/TenantsAcceptInviteRequest.md +34 -0
  526. package/docs/TenantsAcceptInviteResponse.md +38 -0
  527. package/docs/TenantsApi.md +1243 -0
  528. package/docs/TenantsAssignRoleRequest.md +36 -0
  529. package/docs/TenantsAssignRoleResponse.md +34 -0
  530. package/docs/TenantsCreateRoleRequest.md +36 -0
  531. package/docs/TenantsCreateTenantRequest.md +38 -0
  532. package/docs/TenantsCreateTenantResponse.md +38 -0
  533. package/docs/TenantsCreateTenantUserInviteRequest.md +38 -0
  534. package/docs/TenantsCreateTenantUserInviteResponse.md +36 -0
  535. package/docs/TenantsDeleteRoleResponse.md +34 -0
  536. package/docs/TenantsDeleteTenantResponse.md +34 -0
  537. package/docs/TenantsDeleteTenantUserRequest.md +34 -0
  538. package/docs/TenantsJWTTokenResponse.md +34 -0
  539. package/docs/TenantsNamespaceDefinitionsResponse.md +34 -0
  540. package/docs/TenantsRolesListResponse.md +34 -0
  541. package/docs/TenantsSwitchTenantRequest.md +34 -0
  542. package/docs/TenantsSwitchTenantResponse.md +36 -0
  543. package/docs/TenantsTenantUserResponse.md +42 -0
  544. package/docs/TenantsUpdateRoleRequest.md +34 -0
  545. package/docs/TenantsUpdateTenantUserRoleRequest.md +36 -0
  546. package/docs/TenantsUpdateTenantUserRoleResponse.md +34 -0
  547. package/docs/UpdateTenantUserRole200Response.md +36 -0
  548. package/docs/V1ArchiveAllResponse.md +44 -0
  549. package/docs/V1CheckPermissionRequest.md +42 -0
  550. package/docs/V1CheckPermissionResponse.md +34 -0
  551. package/docs/V1ConfigHistoryItem.md +44 -0
  552. package/docs/V1ConfigHistoryPagination.md +44 -0
  553. package/docs/V1ConfigHistoryResponse.md +36 -0
  554. package/docs/V1CreateCheckoutRequest.md +44 -0
  555. package/docs/V1CreateCheckoutResponse.md +36 -0
  556. package/docs/V1CreatePortalRequest.md +34 -0
  557. package/docs/V1CreatePortalResponse.md +34 -0
  558. package/docs/V1CreateRelationshipRequest.md +42 -0
  559. package/docs/V1CreateRelationshipResponse.md +36 -0
  560. package/docs/V1MigrationErrorResponse.md +36 -0
  561. package/docs/V1MigrationSuccessResponse.md +36 -0
  562. package/docs/V1NamespaceDeploymentResponse.md +42 -0
  563. package/docs/V1RecordUsageRequest.md +36 -0
  564. package/docs/V1StripeConfigResponse.md +42 -0
  565. package/docs/V1SubjectSetRequest.md +38 -0
  566. package/package.json +14 -65
  567. package/src/apis/DatabaseApi.ts +106 -0
  568. package/src/apis/PaymentsApi.ts +201 -0
  569. package/src/apis/PermissionsApi.ts +216 -0
  570. package/src/apis/StorageApi.ts +207 -0
  571. package/src/apis/StripeApi.ts +364 -0
  572. package/src/apis/TenantsApi.ts +868 -0
  573. package/src/apis/index.ts +8 -0
  574. package/src/index.ts +5 -0
  575. package/src/models/AcceptInvite200Response.ts +81 -0
  576. package/src/models/AssignRole200Response.ts +81 -0
  577. package/src/models/CheckPermission200Response.ts +81 -0
  578. package/src/models/ClientRelationship.ts +105 -0
  579. package/src/models/ClientSubjectSet.ts +81 -0
  580. package/src/models/CreateCheckout200Response.ts +81 -0
  581. package/src/models/CreateCustomerPortal200Response.ts +81 -0
  582. package/src/models/CreateInvite200Response.ts +81 -0
  583. package/src/models/CreateRelationship200Response.ts +81 -0
  584. package/src/models/CreateRole200Response.ts +81 -0
  585. package/src/models/CreateTenant200Response.ts +81 -0
  586. package/src/models/DeleteRole200Response.ts +81 -0
  587. package/src/models/DeleteTenant200Response.ts +81 -0
  588. package/src/models/DeployPermissionNamespaces200Response.ts +81 -0
  589. package/src/models/GetRoleDefinitions200Response.ts +81 -0
  590. package/src/models/GetTenantBillingStatus200Response.ts +81 -0
  591. package/src/models/GetTenantJWT200Response.ts +81 -0
  592. package/src/models/HandlersBadRequestResponse.ts +73 -0
  593. package/src/models/HandlersForbiddenResponse.ts +73 -0
  594. package/src/models/HandlersInternalServerErrorResponse.ts +73 -0
  595. package/src/models/HandlersNotFoundErrorResponse.ts +73 -0
  596. package/src/models/HandlersSuccessResponse.ts +73 -0
  597. package/src/models/HandlersUnauthorizedResponse.ts +73 -0
  598. package/src/models/ListRoles200Response.ts +81 -0
  599. package/src/models/ListTenantSubscriptions200Response.ts +81 -0
  600. package/src/models/ListTenantUsers200Response.ts +81 -0
  601. package/src/models/ModelsBillingStatusResponse.ts +73 -0
  602. package/src/models/ModelsDeleteObjectRequest.ts +66 -0
  603. package/src/models/ModelsDownloadRequest.ts +66 -0
  604. package/src/models/ModelsDownloadResponse.ts +65 -0
  605. package/src/models/ModelsMessageResponse.ts +65 -0
  606. package/src/models/ModelsMeter.ts +131 -0
  607. package/src/models/ModelsMeterCustomerMapping.ts +85 -0
  608. package/src/models/ModelsMeterDefaultAggregation.ts +78 -0
  609. package/src/models/ModelsMeterValueSettings.ts +66 -0
  610. package/src/models/ModelsMeterWithStripeID.ts +139 -0
  611. package/src/models/ModelsNamespaceDefinition.ts +89 -0
  612. package/src/models/ModelsPrice.ts +186 -0
  613. package/src/models/ModelsPriceDisplay.ts +81 -0
  614. package/src/models/ModelsPriceLimit.ts +81 -0
  615. package/src/models/ModelsPriceUI.ts +112 -0
  616. package/src/models/ModelsPriceWithStripeID.ts +194 -0
  617. package/src/models/ModelsProduct.ts +123 -0
  618. package/src/models/ModelsProductUI.ts +113 -0
  619. package/src/models/ModelsProductWithStripeIDs.ts +131 -0
  620. package/src/models/ModelsRole.ts +113 -0
  621. package/src/models/ModelsStripeConfiguration.ts +98 -0
  622. package/src/models/ModelsStripeConfigurationWithIDs.ts +98 -0
  623. package/src/models/ModelsSubscriptionResponse.ts +97 -0
  624. package/src/models/ModelsTenant.ts +121 -0
  625. package/src/models/ModelsTenantInvite.ts +145 -0
  626. package/src/models/ModelsTenantSettings.ts +81 -0
  627. package/src/models/ModelsTier.ts +81 -0
  628. package/src/models/ModelsUploadRequest.ts +74 -0
  629. package/src/models/ModelsUploadResponse.ts +73 -0
  630. package/src/models/StorageDownloadPost200Response.ts +81 -0
  631. package/src/models/StorageObjectDelete200Response.ts +81 -0
  632. package/src/models/StorageUploadPost200Response.ts +81 -0
  633. package/src/models/StripeConfigArchiveAllPost200Response.ts +81 -0
  634. package/src/models/StripeConfigGet200Response.ts +81 -0
  635. package/src/models/StripeConfigHistoryGet200Response.ts +81 -0
  636. package/src/models/StripeConfigPullGet200Response.ts +81 -0
  637. package/src/models/SwitchActiveTenant200Response.ts +81 -0
  638. package/src/models/TenantsAcceptInviteRequest.ts +66 -0
  639. package/src/models/TenantsAcceptInviteResponse.ts +81 -0
  640. package/src/models/TenantsAssignRoleRequest.ts +73 -0
  641. package/src/models/TenantsAssignRoleResponse.ts +65 -0
  642. package/src/models/TenantsCreateRoleRequest.ts +75 -0
  643. package/src/models/TenantsCreateTenantRequest.ts +83 -0
  644. package/src/models/TenantsCreateTenantResponse.ts +89 -0
  645. package/src/models/TenantsCreateTenantUserInviteRequest.ts +84 -0
  646. package/src/models/TenantsCreateTenantUserInviteResponse.ts +81 -0
  647. package/src/models/TenantsDeleteRoleResponse.ts +65 -0
  648. package/src/models/TenantsDeleteTenantResponse.ts +65 -0
  649. package/src/models/TenantsDeleteTenantUserRequest.ts +66 -0
  650. package/src/models/TenantsJWTTokenResponse.ts +65 -0
  651. package/src/models/TenantsNamespaceDefinitionsResponse.ts +73 -0
  652. package/src/models/TenantsRolesListResponse.ts +73 -0
  653. package/src/models/TenantsSwitchTenantRequest.ts +66 -0
  654. package/src/models/TenantsSwitchTenantResponse.ts +73 -0
  655. package/src/models/TenantsTenantUserResponse.ts +97 -0
  656. package/src/models/TenantsUpdateRoleRequest.ts +66 -0
  657. package/src/models/TenantsUpdateTenantUserRoleRequest.ts +75 -0
  658. package/src/models/TenantsUpdateTenantUserRoleResponse.ts +65 -0
  659. package/src/models/UpdateTenantUserRole200Response.ts +81 -0
  660. package/src/models/V1ArchiveAllResponse.ts +105 -0
  661. package/src/models/V1CheckPermissionRequest.ts +108 -0
  662. package/src/models/V1CheckPermissionResponse.ts +65 -0
  663. package/src/models/V1ConfigHistoryItem.ts +113 -0
  664. package/src/models/V1ConfigHistoryPagination.ts +105 -0
  665. package/src/models/V1ConfigHistoryResponse.ts +88 -0
  666. package/src/models/V1CreateCheckoutRequest.ts +108 -0
  667. package/src/models/V1CreateCheckoutResponse.ts +73 -0
  668. package/src/models/V1CreatePortalRequest.ts +66 -0
  669. package/src/models/V1CreatePortalResponse.ts +66 -0
  670. package/src/models/V1CreateRelationshipRequest.ts +108 -0
  671. package/src/models/V1CreateRelationshipResponse.ts +81 -0
  672. package/src/models/V1MigrationErrorResponse.ts +73 -0
  673. package/src/models/V1MigrationSuccessResponse.ts +73 -0
  674. package/src/models/V1NamespaceDeploymentResponse.ts +97 -0
  675. package/src/models/V1RecordUsageRequest.ts +75 -0
  676. package/src/models/V1StripeConfigResponse.ts +105 -0
  677. package/src/models/V1SubjectSetRequest.ts +83 -0
  678. package/src/models/index.ts +105 -0
  679. package/src/runtime.ts +432 -0
  680. package/tsconfig.esm.json +7 -0
  681. package/tsconfig.json +16 -0
  682. package/dist/auth/index.cjs +0 -18
  683. package/dist/auth/index.d.cts +0 -461
  684. package/dist/auth/index.d.ts +0 -461
  685. package/dist/auth/index.js +0 -0
  686. package/dist/auth/types.cjs +0 -18
  687. package/dist/auth/types.d.cts +0 -103
  688. package/dist/auth/types.d.ts +0 -103
  689. package/dist/auth/types.js +0 -0
  690. package/dist/chunk-4VFICD7B.js +0 -563
  691. package/dist/chunk-4WXOODCF.js +0 -579
  692. package/dist/chunk-5MDBFHTF.js +0 -555
  693. package/dist/chunk-6OGESVXW.js +0 -651
  694. package/dist/chunk-767PUXYD.js +0 -556
  695. package/dist/chunk-BZSZVT4V.js +0 -152
  696. package/dist/chunk-CUBJFCZH.js +0 -579
  697. package/dist/chunk-DDFBRGMG.js +0 -106
  698. package/dist/chunk-DQBFDKRC.js +0 -641
  699. package/dist/chunk-I6DMWC32.js +0 -129
  700. package/dist/chunk-IVPULXIA.js +0 -150
  701. package/dist/chunk-JNM7XP7L.js +0 -345
  702. package/dist/chunk-KGG7T6KJ.js +0 -546
  703. package/dist/chunk-L7EZC6WP.js +0 -560
  704. package/dist/chunk-LCEBQTB7.js +0 -563
  705. package/dist/chunk-LIS5WD3H.js +0 -560
  706. package/dist/chunk-LMDKQ6Z2.js +0 -706
  707. package/dist/chunk-NBPRDG6O.js +0 -643
  708. package/dist/chunk-PNP3T7XU.js +0 -542
  709. package/dist/chunk-QPW6G4PA.js +0 -490
  710. package/dist/chunk-QXPPBLH4.js +0 -556
  711. package/dist/chunk-TFAV5P6I.js +0 -869
  712. package/dist/chunk-V4FWENQQ.js +0 -378
  713. package/dist/chunk-V56G36FZ.js +0 -558
  714. package/dist/chunk-V6HVRJCU.js +0 -693
  715. package/dist/chunk-ZBRAIBZZ.js +0 -658
  716. package/dist/chunk-ZYLNNK7H.js +0 -555
  717. package/dist/database/index.cjs +0 -227
  718. package/dist/database/index.d.cts +0 -298
  719. package/dist/database/index.d.ts +0 -298
  720. package/dist/database/index.js +0 -199
  721. package/dist/index.cjs +0 -2024
  722. package/dist/index.d.cts +0 -2
  723. package/dist/payments/index.cjs +0 -520
  724. package/dist/payments/index.d.cts +0 -3220
  725. package/dist/payments/index.d.ts +0 -3220
  726. package/dist/payments/index.js +0 -14
  727. package/dist/permissions/index.cjs +0 -405
  728. package/dist/permissions/index.d.cts +0 -2
  729. package/dist/permissions/index.d.ts +0 -2
  730. package/dist/permissions/index.js +0 -8
  731. package/dist/storage/index.cjs +0 -153
  732. package/dist/storage/index.d.cts +0 -2
  733. package/dist/storage/index.d.ts +0 -2
  734. package/dist/storage/index.js +0 -6
  735. package/dist/stripe/index.cjs +0 -153
  736. package/dist/stripe/index.d.cts +0 -162
  737. package/dist/stripe/index.d.ts +0 -162
  738. package/dist/stripe/index.js +0 -124
  739. package/dist/tenants/index.cjs +0 -895
  740. package/dist/tenants/index.d.cts +0 -2
  741. package/dist/tenants/index.d.ts +0 -2
  742. package/dist/tenants/index.js +0 -6
  743. package/dist/types-DgsX5kVK.d.cts +0 -49
  744. package/dist/types-DgsX5kVK.d.ts +0 -49
@@ -1,3220 +0,0 @@
1
- import { RelationshipApi, PermissionApi } from '@ory/client';
2
-
3
- /**
4
- * Base API Response structure for all operations
5
- *
6
- * This generic type defines the standard response format returned by all
7
- * API endpoints. It provides a consistent structure for
8
- * handling both successful responses and error conditions across the SDK.
9
- *
10
- * @template T - The type of the response data payload
11
- *
12
- * @example
13
- * Successful response:
14
- * ```typescript
15
- * const response: ApiResponse<{ tenant: Tenant }> = {
16
- * data: { tenant: { id: '123', name: 'My Company' } },
17
- * status: 200
18
- * };
19
- * ```
20
- *
21
- * @example
22
- * Error response:
23
- * ```typescript
24
- * const response: ApiResponse<never> = {
25
- * status: 400,
26
- * error: 'Invalid tenant name provided'
27
- * };
28
- * ```
29
- *
30
- * @since 0.6.0
31
- * @public
32
- */
33
- type ApiResponse<T> = {
34
- /**
35
- * Response data payload (present only on successful operations)
36
- * Contains the actual data returned by the API endpoint
37
- */
38
- data?: T;
39
- /**
40
- * HTTP status code indicating the result of the operation
41
- * @example 200 for success, 400 for client errors, 500 for server errors
42
- */
43
- status: number;
44
- /**
45
- * Error message (present only when operation fails)
46
- * Provides human-readable description of what went wrong
47
- */
48
- error?: string;
49
- };
50
-
51
- /**
52
- * Configuration options for creating a Stripe checkout session
53
- *
54
- * Defines all parameters needed to create a checkout session for either
55
- * one-time payments or subscription billing. The checkout mode (payment vs
56
- * subscription) is automatically determined by examining the price configuration
57
- * - no need to specify it manually.
58
- *
59
- * @example
60
- * ```typescript
61
- * const options: CheckoutOptions = {
62
- * price_id: 'price_monthly_pro',
63
- * success_url: 'https://app.com/success?session_id={CHECKOUT_SESSION_ID}',
64
- * cancel_url: 'https://app.com/pricing',
65
- * };
66
- * ```
67
- *
68
- * @since 0.6.0
69
- * @public
70
- * @group Checkout
71
- */
72
- type CheckoutOptions = {
73
- /** Stripe price ID for the product/service being purchased */
74
- price_id: string;
75
- /**
76
- * URL to redirect to after successful payment
77
- * Can include {CHECKOUT_SESSION_ID} placeholder for session tracking
78
- */
79
- success_url: string;
80
- /** URL to redirect to if the user cancels the checkout */
81
- cancel_url: string;
82
- };
83
- /**
84
- * Response from creating a checkout session
85
- *
86
- * Contains the checkout session URL and ID for redirecting users
87
- * to Stripe's hosted checkout page and tracking the session.
88
- *
89
- * @since 0.6.0
90
- * @public
91
- * @group Checkout
92
- */
93
- type CreateCheckoutResponse = ApiResponse<{
94
- /** URL to redirect the user to for completing payment */
95
- url: string;
96
- /** Unique identifier for the checkout session */
97
- sessionId: string;
98
- }>;
99
- /**
100
- * Manager for Stripe checkout session operations
101
- *
102
- * Handles creation and management of Stripe checkout sessions for both
103
- * one-time payments and subscription billing. The checkout mode is automatically
104
- * determined by examining whether the price has a recurring interval - recurring
105
- * prices create subscription checkouts, while non-recurring prices create one-time
106
- * payment checkouts.
107
- *
108
- * Checkout sessions provide a secure, PCI-compliant payment flow without requiring
109
- * sensitive payment data to touch your servers. The API automatically fetches the
110
- * price details from Stripe to determine the appropriate checkout mode.
111
- *
112
- * @example
113
- * ```typescript
114
- * const checkoutManager = new CheckoutManager(omnibaseClient);
115
- *
116
- * const session = await checkoutManager.createSession({
117
- * price_id: 'price_monthly_pro',
118
- * success_url: 'https://app.com/welcome?session_id={CHECKOUT_SESSION_ID}',
119
- * cancel_url: 'https://app.com/pricing',
120
- * });
121
- *
122
- * // Redirect user to checkout
123
- * window.location.href = session.data.url;
124
- * ```
125
- *
126
- * @since 0.6.0
127
- * @public
128
- * @group Checkout
129
- */
130
- declare class CheckoutManager {
131
- private omnibaseClient;
132
- /**
133
- * Initialize the checkout manager
134
- *
135
- * @param paymentHandler - Payment handler instance for API communication
136
- *
137
- * @group Checkout
138
- */
139
- constructor(omnibaseClient: OmnibaseClient);
140
- /**
141
- * Create a new Stripe checkout session
142
- *
143
- * Creates a checkout session with the specified options and returns
144
- * the session URL for redirecting the user to complete payment.
145
- * The checkout mode (one-time payment or subscription) is automatically
146
- * determined from the price's configuration - no need to specify it manually.
147
- *
148
- * @param options - Configuration options for the checkout session
149
- * @param options.price_id - Stripe price ID for the product/service
150
- * @param options.success_url - URL to redirect after successful payment
151
- * @param options.cancel_url - URL to redirect if user cancels
152
- *
153
- * @returns Promise resolving to checkout session response with URL and session ID
154
- *
155
- * @throws {Error} When the API request fails due to network issues
156
- * @throws {Error} When the server returns an error response (invalid price_id, etc.)
157
- * @throws {ValidationError} When required parameters are missing or invalid
158
- *
159
- * @example
160
- * ```typescript
161
- * const session = await checkoutManager.createSession({
162
- * price_id: 'price_monthly_pro',
163
- * success_url: 'https://app.com/success',
164
- * cancel_url: 'https://app.com/cancel'
165
- * });
166
- *
167
- * // Redirect to Stripe checkout
168
- * if (session.data?.url) {
169
- * window.location.href = session.data.url;
170
- * }
171
- * ```
172
- *
173
- * @since 0.6.0
174
- * @group Checkout
175
- */
176
- createSession(options: CheckoutOptions): Promise<CreateCheckoutResponse>;
177
- }
178
-
179
- /**
180
- * Response from Stripe configuration API endpoints
181
- *
182
- * Contains the current Stripe configuration including products, prices,
183
- * and UI customization settings. This represents the complete billing
184
- * configuration loaded from the database.
185
- *
186
- * @since 0.6.0
187
- * @public
188
- * @group Configuration
189
- */
190
- type StripeConfigResponse = ApiResponse<{
191
- /** The complete Stripe configuration object */
192
- config: StripeConfiguration;
193
- /** Optional message from the API response */
194
- message?: string;
195
- }>;
196
- /**
197
- * Complete Stripe billing configuration
198
- *
199
- * Represents a versioned Stripe configuration containing all products,
200
- * prices, and UI customizations. This configuration is stored in the
201
- * database and enables safe deployment and rollback of pricing changes.
202
- *
203
- * @example
204
- * ```typescript
205
- * const config: StripeConfiguration = {
206
- * version: "v1.2.0",
207
- * products: [
208
- * {
209
- * id: "starter_plan",
210
- * name: "Starter Plan",
211
- * description: "Perfect for individuals and small teams",
212
- * type: "service",
213
- * prices: [...]
214
- * }
215
- * ]
216
- * };
217
- * ```
218
- *
219
- * @since 0.6.0
220
- * @public
221
- * @group Configuration
222
- */
223
- interface StripeConfiguration {
224
- /** Version identifier for this configuration */
225
- version: string;
226
- /** Array of all products in this configuration */
227
- products: Product[];
228
- }
229
- /**
230
- * Product definition in Stripe configuration
231
- *
232
- * Represents a billable product or service with associated pricing options
233
- * and UI customizations. Products can be services, physical goods, or
234
- * metered usage products.
235
- *
236
- * @example
237
- * ```typescript
238
- * const product: Product = {
239
- * id: "pro_plan",
240
- * name: "Professional Plan",
241
- * description: "Advanced features for growing businesses",
242
- * type: "service",
243
- * prices: [
244
- * { id: "monthly", amount: 2900, currency: "usd", interval: "month" },
245
- * { id: "yearly", amount: 29000, currency: "usd", interval: "year" }
246
- * ],
247
- * ui: {
248
- * display_name: "Pro",
249
- * tagline: "Most Popular",
250
- * features: ["Unlimited projects", "24/7 support"],
251
- * highlighted: true
252
- * }
253
- * };
254
- * ```
255
- *
256
- * @since 0.6.0
257
- * @public
258
- * @group Configuration
259
- */
260
- interface Product {
261
- /** Unique identifier for this product */
262
- id: string;
263
- /** Display name for the product */
264
- name: string;
265
- /** Optional detailed description */
266
- description?: string;
267
- /**
268
- * Product type affecting billing behavior
269
- * - 'service': Subscription services
270
- * - 'good': Physical or digital goods
271
- * - 'metered': Usage-based billing
272
- */
273
- type?: "service" | "good" | "metered";
274
- /** Array of pricing options for this product */
275
- prices: Price[];
276
- /** Optional UI customization settings */
277
- ui?: ProductUI;
278
- }
279
- /**
280
- * Price definition for a product
281
- *
282
- * Defines a specific pricing option including amount, currency, billing
283
- * frequency, and advanced pricing features like tiered billing. Supports
284
- * both fixed and usage-based pricing models.
285
- *
286
- * @example
287
- * Simple monthly pricing:
288
- * ```typescript
289
- * const monthlyPrice: Price = {
290
- * id: "monthly_standard",
291
- * amount: 1999, // $19.99 in cents
292
- * currency: "usd",
293
- * interval: "month",
294
- * usage_type: "licensed"
295
- * };
296
- * ```
297
- *
298
- * @example
299
- * Tiered usage pricing:
300
- * ```typescript
301
- * const tieredPrice: Price = {
302
- * id: "api_calls_tiered",
303
- * currency: "usd",
304
- * usage_type: "metered",
305
- * billing_scheme: "tiered",
306
- * tiers_mode: "graduated",
307
- * tiers: [
308
- * { up_to: 1000, unit_amount: 10 }, // First 1000 calls at $0.10 each
309
- * { up_to: "inf", unit_amount: 5 } // Additional calls at $0.05 each
310
- * ]
311
- * };
312
- * ```
313
- *
314
- * @since 0.6.0
315
- * @public
316
- * @group Configuration
317
- */
318
- interface Price {
319
- /** Unique identifier for this price */
320
- id: string;
321
- /**
322
- * Price amount in smallest currency unit (e.g., cents for USD)
323
- * Omitted for usage-based pricing with tiers
324
- */
325
- amount?: number;
326
- /** Currency code (ISO 4217) */
327
- currency: string;
328
- /**
329
- * Billing interval for recurring prices
330
- * - 'month': Monthly billing
331
- * - 'year': Annual billing
332
- * - 'week': Weekly billing
333
- * - 'day': Daily billing
334
- */
335
- interval?: "month" | "year" | "week" | "day";
336
- /**
337
- * Number of intervals between billings
338
- * @defaultValue 1
339
- */
340
- interval_count?: number;
341
- /**
342
- * Usage type determining billing model
343
- * - 'licensed': Fixed recurring pricing
344
- * - 'metered': Usage-based pricing
345
- */
346
- usage_type?: "licensed" | "metered";
347
- /**
348
- * Billing scheme for complex pricing
349
- * - 'per_unit': Simple per-unit pricing
350
- * - 'tiered': Graduated or volume-based tiers
351
- */
352
- billing_scheme?: "per_unit" | "tiered";
353
- /**
354
- * Tier calculation mode (when billing_scheme is 'tiered')
355
- * - 'graduated': Each tier applies to usage within that tier
356
- * - 'volume': Entire usage charged at the tier rate
357
- */
358
- tiers_mode?: "graduated" | "volume";
359
- /** Pricing tiers for tiered billing */
360
- tiers?: Tier[];
361
- /** Optional UI customization settings */
362
- ui?: PriceUI;
363
- }
364
- /**
365
- * Pricing tier definition for tiered billing
366
- *
367
- * Defines a usage range and associated pricing for tiered billing models.
368
- * Enables graduated pricing where different usage levels have different rates.
369
- *
370
- * @example
371
- * ```typescript
372
- * const tiers: Tier[] = [
373
- * { up_to: 100, flat_amount: 0, unit_amount: 10 }, // First 100 free, then $0.10 each
374
- * { up_to: 1000, unit_amount: 5 }, // Next 900 at $0.05 each
375
- * { up_to: "inf", unit_amount: 2 } // Beyond 1000 at $0.02 each
376
- * ];
377
- * ```
378
- *
379
- * @since 0.6.0
380
- * @public
381
- * @group Configuration
382
- */
383
- interface Tier {
384
- /**
385
- * Upper bound for this tier
386
- * Use "inf" for the highest tier with no upper limit
387
- */
388
- up_to: number | "inf";
389
- /**
390
- * Fixed amount charged for this tier (in cents)
391
- * Used for flat fees at tier boundaries
392
- */
393
- flat_amount?: number;
394
- /**
395
- * Per-unit amount for usage within this tier (in cents)
396
- * Applied to each unit of usage in this tier range
397
- */
398
- unit_amount?: number;
399
- }
400
- /**
401
- * UI customization settings for products
402
- *
403
- * Controls how products are displayed in pricing tables and marketing pages.
404
- * Provides extensive customization options for branding and presentation.
405
- *
406
- * @example
407
- * ```typescript
408
- * const productUI: ProductUI = {
409
- * display_name: "Enterprise",
410
- * tagline: "For large organizations",
411
- * features: ["SSO integration", "Advanced analytics", "Priority support"],
412
- * badge: "Most Popular",
413
- * cta_text: "Contact Sales",
414
- * highlighted: true,
415
- * sort_order: 3
416
- * };
417
- * ```
418
- *
419
- * @since 0.6.0
420
- * @public
421
- * @group UI Configuration
422
- */
423
- interface ProductUI {
424
- /** Custom display name (overrides product.name) */
425
- display_name?: string;
426
- /** Marketing tagline or subtitle */
427
- tagline?: string;
428
- /** List of key features to highlight */
429
- features?: string[];
430
- /** Optional badge text (e.g., "Popular", "Best Value") */
431
- badge?: string;
432
- /** Custom call-to-action button text */
433
- cta_text?: string;
434
- /** Whether to visually highlight this product */
435
- highlighted?: boolean;
436
- /** Sort order for display (lower numbers first) */
437
- sort_order?: number;
438
- }
439
- /**
440
- * UI customization settings for prices
441
- *
442
- * Controls how individual price options are displayed within products.
443
- * Enables custom formatting, feature lists, and usage limits display.
444
- *
445
- * @example
446
- * ```typescript
447
- * const priceUI: PriceUI = {
448
- * display_name: "Annual Billing",
449
- * price_display: {
450
- * custom_text: "$99/year",
451
- * suffix: "billed annually"
452
- * },
453
- * billing_period: "per year",
454
- * features: ["2 months free", "Priority support"],
455
- * limits: [
456
- * { text: "Up to 10 users", value: 10, unit: "users" },
457
- * { text: "100GB storage", value: 100, unit: "GB" }
458
- * ]
459
- * };
460
- * ```
461
- *
462
- * @since 0.6.0
463
- * @public
464
- * @group UI Configuration
465
- */
466
- interface PriceUI {
467
- /** Custom display name for this price option */
468
- display_name?: string;
469
- /** Custom price display formatting */
470
- price_display?: PriceDisplay;
471
- /** Custom billing period description */
472
- billing_period?: string;
473
- /** Price-specific features to highlight */
474
- features?: string[];
475
- /** Usage limits and quotas for this price */
476
- limits?: PriceLimit[];
477
- }
478
- /**
479
- * Custom price display formatting options
480
- *
481
- * Provides fine-grained control over how prices are formatted and displayed,
482
- * including custom text, currency symbols, and suffixes.
483
- *
484
- * @example
485
- * ```typescript
486
- * const priceDisplay: PriceDisplay = {
487
- * custom_text: "Contact us for pricing",
488
- * show_currency: false,
489
- * suffix: "per month"
490
- * };
491
- * ```
492
- *
493
- * @since 0.6.0
494
- * @public
495
- * @group UI Configuration
496
- */
497
- interface PriceDisplay {
498
- /**
499
- * Custom text to display instead of calculated price
500
- * Useful for "Contact us" or "Free" pricing
501
- */
502
- custom_text?: string;
503
- /**
504
- * Whether to show currency symbol
505
- * @defaultValue true
506
- */
507
- show_currency?: boolean;
508
- /** Additional text to append after the price */
509
- suffix?: string;
510
- }
511
- /**
512
- * Usage limit or quota definition
513
- *
514
- * Represents a specific limit or quota associated with a price tier,
515
- * such as user limits, storage quotas, or API call allowances.
516
- *
517
- * @example
518
- * ```typescript
519
- * const limits: PriceLimit[] = [
520
- * { text: "Up to 5 team members", value: 5, unit: "users" },
521
- * { text: "50GB storage included", value: 50, unit: "GB" },
522
- * { text: "Unlimited API calls" } // No value/unit for unlimited
523
- * ];
524
- * ```
525
- *
526
- * @since 0.6.0
527
- * @public
528
- * @group UI Configuration
529
- */
530
- interface PriceLimit {
531
- /** Human-readable description of the limit */
532
- text: string;
533
- /** Numeric value of the limit (omit for unlimited) */
534
- value?: number;
535
- /** Unit of measurement for the limit */
536
- unit?: string;
537
- }
538
- /**
539
- * UI-ready product data structure for pricing tables
540
- *
541
- * Extended product interface that includes pre-processed display data
542
- * optimized for rendering pricing tables and marketing pages. Contains
543
- * formatted prices, organized features, and display-ready content.
544
- *
545
- * This interface is returned by [`getAvailableProducts()`](config.ts) and provides
546
- * everything needed to render a complete pricing table without additional
547
- * data processing.
548
- *
549
- * @example
550
- * ```typescript
551
- * const products: ProductWithPricingUI[] = await configManager.getAvailableProducts();
552
- *
553
- * products.forEach(product => {
554
- * const display = product.pricing_display;
555
- * console.log(`${display.name}: ${display.tagline}`);
556
- *
557
- * display.prices.forEach(price => {
558
- * console.log(` ${price.display_name}: ${price.formatted_price}`);
559
- * });
560
- * });
561
- * ```
562
- *
563
- * @since 0.6.0
564
- * @public
565
- * @group UI Configuration
566
- */
567
- interface ProductWithPricingUI extends Product {
568
- /** Pre-processed display data for UI rendering */
569
- pricing_display: {
570
- /** Display name for the product */
571
- name: string;
572
- /** Marketing tagline or subtitle */
573
- tagline?: string;
574
- /** Key features to highlight */
575
- features: string[];
576
- /** Optional badge text */
577
- badge?: string;
578
- /** Call-to-action button text */
579
- cta_text: string;
580
- /** Whether this product should be visually highlighted */
581
- highlighted: boolean;
582
- /** Sort order for display */
583
- sort_order: number;
584
- /** UI-ready price information */
585
- prices: Array<{
586
- /** Price identifier */
587
- id: string;
588
- /** Display name for this price option */
589
- display_name: string;
590
- /** Formatted price string ready for display */
591
- formatted_price: string;
592
- /** Billing period description */
593
- billing_period: string;
594
- /** Price-specific features */
595
- features: string[];
596
- /** Usage limits and quotas */
597
- limits: Array<{
598
- /** Limit description */
599
- text: string;
600
- /** Numeric value (if applicable) */
601
- value?: number;
602
- /** Unit of measurement */
603
- unit?: string;
604
- }>;
605
- }>;
606
- };
607
- }
608
-
609
- declare class ConfigManager {
610
- private omnibaseClient;
611
- constructor(omnibaseClient: OmnibaseClient);
612
- /**
613
- * Get the current Stripe configuration from the database
614
- *
615
- * Retrieves the latest Stripe configuration including products, prices,
616
- * and UI customization data. This configuration represents the current
617
- * active pricing structure with all UI elements for pricing table rendering.
618
- *
619
- * @returns Promise resolving to the current Stripe configuration
620
- *
621
- * @throws {Error} When the API request fails due to network issues
622
- * @throws {Error} When the server returns an error response (4xx, 5xx status codes)
623
- *
624
- * @example
625
- * Basic usage:
626
- * ```typescript
627
- * const config = await getStripeConfig();
628
- * console.log(`Found ${config.data.config.products.length} products`);
629
- *
630
- * // Access product UI configuration
631
- * config.data.config.products.forEach(product => {
632
- * console.log(`${product.name}: ${product.ui?.tagline || 'No tagline'}`);
633
- * });
634
- * ```
635
- */
636
- getStripeConfig(): Promise<StripeConfigResponse>;
637
- /**
638
- * Get available products with UI-ready pricing data
639
- *
640
- * Transforms the raw Stripe configuration into UI-ready format for pricing
641
- * table rendering. Includes formatted pricing, features, limits, and all
642
- * display customizations needed for marketing pages.
643
- *
644
- * @returns Promise resolving to products ready for UI consumption
645
- *
646
- * @throws {Error} When the API request fails or configuration is invalid
647
- *
648
- * @example
649
- * Pricing table rendering:
650
- * ```typescript
651
- * const products = await getAvailableProducts();
652
- *
653
- * products.forEach(product => {
654
- * const display = product.pricing_display;
655
- * console.log(`${display.name} - ${display.tagline}`);
656
- *
657
- * display.prices.forEach(price => {
658
- * console.log(` ${price.display_name}: ${price.formatted_price}`);
659
- * });
660
- * });
661
- * ```
662
- */
663
- getAvailableProducts(): Promise<ProductWithPricingUI[]>;
664
- /**
665
- * Get a specific product by ID
666
- *
667
- * Retrieves a single product configuration by its ID from the current
668
- * Stripe configuration. Useful for product-specific operations.
669
- *
670
- * @param productId - The configuration product ID to retrieve
671
- * @returns Promise resolving to the product or null if not found
672
- *
673
- * @example
674
- * ```typescript
675
- * const product = await getProduct('starter_plan');
676
- * if (product) {
677
- * console.log(`Found product: ${product.name}`);
678
- * }
679
- * ```
680
- */
681
- getProduct(productId: string): Promise<Product | null>;
682
- }
683
-
684
- /**
685
- * Configuration options for creating a Stripe customer portal session
686
- *
687
- * Defines the parameters needed to create a customer portal session
688
- * that allows customers to manage their subscription, payment methods,
689
- * billing history, and other account settings.
690
- *
691
- * @example
692
- * ```typescript
693
- * const options: PortalOptions = {
694
- * return_url: 'https://app.com/billing'
695
- * };
696
- * ```
697
- *
698
- * @since 0.6.0
699
- * @public
700
- * @group Portal
701
- */
702
- type PortalOptions = {
703
- /** URL to redirect the customer to when they exit the portal */
704
- return_url: string;
705
- };
706
- /**
707
- * Response from creating a customer portal session
708
- *
709
- * Contains the portal session URL for redirecting customers to
710
- * Stripe's hosted customer portal where they can manage their
711
- * billing and subscription settings.
712
- *
713
- * @since 0.6.0
714
- * @public
715
- * @group Portal
716
- */
717
- type CreateCustomerPortalResponse = ApiResponse<{
718
- /** URL to redirect the customer to for accessing their portal */
719
- url: string;
720
- }>;
721
- /**
722
- * Manager for Stripe customer portal operations
723
- *
724
- * Handles creation of customer portal sessions that allow customers
725
- * to manage their own billing information, subscriptions, payment methods,
726
- * and download invoices through Stripe's hosted portal interface.
727
- *
728
- * The customer portal provides a secure, self-service interface that
729
- * reduces support burden by allowing customers to handle common
730
- * billing tasks independently.
731
- *
732
- * @example
733
- * ```typescript
734
- * const portalManager = new PortalManager(omnibaseClient);
735
- *
736
- * const portal = await portalManager.create({
737
- * return_url: 'https://app.com/billing'
738
- * });
739
- *
740
- * // Redirect customer to portal
741
- * window.location.href = portal.data.url;
742
- * ```
743
- *
744
- * @since 0.6.0
745
- * @public
746
- * @group Portal
747
- */
748
- declare class PortalManager {
749
- private omnibaseClient;
750
- /**
751
- * Initialize the portal manager
752
- *
753
- * @param omnibaseClient - OmnibaseClient instance for API communication
754
- *
755
- * @group Portal
756
- */
757
- constructor(omnibaseClient: OmnibaseClient);
758
- /**
759
- * Create a new customer portal session
760
- *
761
- * Creates a portal session that allows the specified customer to
762
- * manage their billing information, subscriptions, and payment methods.
763
- * Returns a URL that the customer should be redirected to.
764
- *
765
- * The portal session is temporary and expires after a short period
766
- * for security. Each access requires creating a new session.
767
- *
768
- * @param options - Configuration options for the portal session
769
- * @param options.return_url - URL to redirect to when exiting the portal
770
- *
771
- * @returns Promise resolving to portal session response with access URL
772
- *
773
- * @throws {Error} When the API request fails due to network issues
774
- * @throws {Error} When the server returns an error response
775
- * @throws {ValidationError} When required parameters are missing or invalid
776
- *
777
- * @example
778
- * ```typescript
779
- * const portal = await portalManager.create({
780
- * return_url: 'https://myapp.com/account/billing'
781
- * });
782
- *
783
- * // Redirect user to portal
784
- * if (portal.data?.url) {
785
- * window.location.href = portal.data.url;
786
- * }
787
- * ```
788
- *
789
- * @since 0.6.0
790
- * @group Portal
791
- */
792
- create(options: PortalOptions): Promise<CreateCustomerPortalResponse>;
793
- }
794
-
795
- /**
796
- * Configuration options for recording usage events
797
- *
798
- * Defines the parameters needed to record a usage event for metered billing.
799
- * Usage events are used to track consumption of metered products and calculate
800
- * charges based on actual usage rather than fixed pricing.
801
- *
802
- * @example
803
- * ```typescript
804
- * const options: UsageOptions = {
805
- * meter_event_name: 'api_calls',
806
- * value: '1'
807
- * };
808
- * ```
809
- *
810
- * @since 0.6.0
811
- * @public
812
- * @group Usage
813
- */
814
- type UsageOptions = {
815
- /**
816
- * Name of the meter event to record usage for
817
- * Must match a meter configured in your Stripe billing configuration
818
- */
819
- meter_event_name: string;
820
- /**
821
- * Usage value to record as a string
822
- * Typically represents quantity consumed (e.g., "1" for single API call, "250" for MB of storage)
823
- */
824
- value: string;
825
- };
826
- /**
827
- * Manager for usage tracking and metered billing operations
828
- *
829
- * Handles recording of usage events for metered billing products. Usage events
830
- * are used by Stripe to calculate charges for products with usage-based pricing,
831
- * such as API calls, data transfer, or storage consumption.
832
- *
833
- * Usage tracking is essential for accurate metered billing and provides
834
- * transparency to customers about their consumption patterns.
835
- *
836
- * @example
837
- * ```typescript
838
- * const usageManager = new UsageManager(omnibaseClient);
839
- *
840
- * // Record a single API call
841
- * await usageManager.recordUsage({
842
- * meter_event_name: 'api_calls',
843
- * value: '1'
844
- * });
845
- *
846
- * // Record bulk data transfer
847
- * await usageManager.recordUsage({
848
- * meter_event_name: 'data_transfer_gb',
849
- * value: '2.5'
850
- * });
851
- * ```
852
- *
853
- * @since 0.6.0
854
- * @public
855
- * @group Usage
856
- */
857
- declare class UsageManager {
858
- private omnibaseClient;
859
- /**
860
- * Initialize the usage manager
861
- *
862
- * @param omnibaseClient - OmnibaseClient instance for API communication
863
- *
864
- * @group Usage
865
- */
866
- constructor(omnibaseClient: OmnibaseClient);
867
- /**
868
- * Record a usage event for metered billing
869
- *
870
- * Records a usage event against a specific meter for billing calculation.
871
- * The event will be aggregated with other usage events for the billing period
872
- * to determine the customer's charges for metered products.
873
- *
874
- * Usage events should be recorded in real-time or as close to real-time as
875
- * possible to ensure accurate billing and provide up-to-date usage visibility
876
- * to customers.
877
- *
878
- * @param options - Usage recording options
879
- * @param options.meter_event_name - Name of the meter to record against
880
- * @param options.value - Usage quantity as string
881
- *
882
- * @returns Promise resolving to API response confirmation
883
- *
884
- * @throws {Error} When the API request fails due to network issues
885
- * @throws {Error} When the server returns an error response (invalid meter name, customer, etc.)
886
- * @throws {ValidationError} When required parameters are missing or invalid
887
- *
888
- * @example
889
- * ```typescript
890
- * // Record each API call
891
- * await usageManager.recordUsage({
892
- * meter_event_name: 'api_requests',
893
- * value: '1'
894
- * });
895
- * ```
896
- *
897
- * @since 0.6.0
898
- * @group Usage
899
- */
900
- recordUsage(options: UsageOptions): Promise<ApiResponse<"">>;
901
- }
902
-
903
- /**
904
- * Main payment handler for all payment-related operations
905
- *
906
- * This class serves as the central coordinator for all payment functionality,
907
- * providing access to checkout sessions, billing configuration, customer portals,
908
- * and usage tracking. It delegates specific operations to specialized managers
909
- * that handle checkout, configuration, portal, and usage operations.
910
- *
911
- * The handler provides a consistent interface across all payment operations,
912
- * with automatic checkout mode detection (subscription vs one-time payment)
913
- * based on the price configuration retrieved from Stripe.
914
- *
915
- * @example
916
- * ```typescript
917
- * const paymentHandler = new PaymentHandler(omnibaseClient);
918
- *
919
- * // Create a checkout session (mode auto-detected from price)
920
- * const checkout = await paymentHandler.checkout.createSession({
921
- * price_id: 'price_monthly_pro',
922
- * success_url: 'https://app.com/success',
923
- * cancel_url: 'https://app.com/cancel'
924
- * });
925
- *
926
- * // Get available products
927
- * const products = await paymentHandler.config.getAvailableProducts();
928
- * ```
929
- *
930
- * @since 0.6.0
931
- * @public
932
- * @group Client
933
- */
934
- declare class PaymentHandler {
935
- private omnibaseClient;
936
- /**
937
- * Initialize the payment handler with OmnibaseClient
938
- *
939
- * Creates a new payment handler instance with access to all payment
940
- * operations including checkout, configuration, portal, and usage tracking.
941
- * The handler uses the provided OmnibaseClient for API communication.
942
- *
943
- * @param omnibaseClient - OmnibaseClient instance for API communication
944
- *
945
- * @example
946
- * ```typescript
947
- * const paymentHandler = new PaymentHandler(omnibaseClient);
948
- * ```
949
- *
950
- * @since 0.6.0
951
- * @group Client
952
- */
953
- constructor(omnibaseClient: OmnibaseClient);
954
- /**
955
- * Checkout session management
956
- *
957
- * Provides functionality for creating and managing Stripe checkout sessions
958
- * for both one-time payments and subscription billing.
959
- *
960
- * @example
961
- * ```typescript
962
- * const session = await paymentHandler.checkout.createSession({
963
- * price_id: 'price_monthly_pro',
964
- * success_url: window.location.origin + '/success',
965
- * cancel_url: window.location.origin + '/pricing'
966
- * });
967
- *
968
- * if (session.data?.url) {
969
- * window.location.href = session.data.url;
970
- * }
971
- * ```
972
- */
973
- readonly checkout: CheckoutManager;
974
- /**
975
- * Stripe configuration management
976
- *
977
- * Handles retrieval and processing of database-backed Stripe configurations,
978
- * providing UI-ready product and pricing data for rendering pricing tables.
979
- *
980
- * @example
981
- * ```typescript
982
- * const products = await paymentHandler.config.getAvailableProducts();
983
- * const config = await paymentHandler.config.getStripeConfig();
984
- * ```
985
- */
986
- readonly config: ConfigManager;
987
- /**
988
- * Customer portal management
989
- *
990
- * Creates customer portal sessions for subscription management,
991
- * billing history, and payment method updates.
992
- *
993
- * @example
994
- * ```typescript
995
- * const portal = await paymentHandler.portal.create({
996
- * return_url: 'https://app.com/billing'
997
- * });
998
- * ```
999
- */
1000
- readonly portal: PortalManager;
1001
- /**
1002
- * Usage tracking and metered billing
1003
- *
1004
- * Records usage events for metered billing products and manages
1005
- * usage-based pricing calculations.
1006
- *
1007
- * @example
1008
- * ```typescript
1009
- * await paymentHandler.usage.recordUsage({
1010
- * meter_event_name: 'api_calls',
1011
- * value: '1'
1012
- * });
1013
- * ```
1014
- */
1015
- readonly usage: UsageManager;
1016
- }
1017
-
1018
- /**
1019
- * Types for the Permissions and Roles API
1020
- *
1021
- * This module defines TypeScript types for interacting with the Omnibase
1022
- * permissions system, including both Ory Keto relationships and the
1023
- * role-based access control (RBAC) system.
1024
- *
1025
- * @module Permissions Types
1026
- * @since 0.7.0
1027
- */
1028
- /**
1029
- * Namespace definition from the database
1030
- *
1031
- * Represents a permission namespace (e.g., Tenant, Project) and its
1032
- * available relations/permissions. Used for building role configuration UIs.
1033
- *
1034
- * @example
1035
- * ```typescript
1036
- * {
1037
- * id: 'uuid-123',
1038
- * namespace: 'Tenant',
1039
- * relations: ['invite_user', 'delete_tenant', 'manage_billing'],
1040
- * created_at: '2024-01-01T00:00:00Z',
1041
- * updated_at: '2024-01-01T00:00:00Z'
1042
- * }
1043
- * ```
1044
- *
1045
- * @since 0.7.0
1046
- * @public
1047
- */
1048
- interface NamespaceDefinition {
1049
- /**
1050
- * Unique identifier for the namespace definition
1051
- */
1052
- id: string;
1053
- /**
1054
- * Name of the namespace (e.g., 'Tenant', 'Project')
1055
- */
1056
- namespace: string;
1057
- /**
1058
- * Available relations/permissions for this namespace
1059
- * @example ['invite_user', 'delete_tenant', 'manage_billing']
1060
- */
1061
- relations: string[];
1062
- /**
1063
- * Timestamp when the namespace definition was created
1064
- */
1065
- created_at: string;
1066
- /**
1067
- * Timestamp when the namespace definition was last updated
1068
- */
1069
- updated_at: string;
1070
- }
1071
- /**
1072
- * Role model representing a collection of permissions
1073
- *
1074
- * Roles can be system-wide (tenant_id = null) or tenant-specific.
1075
- * System roles are defined in roles.config.json and apply to all tenants.
1076
- * Custom roles are created via the API and are specific to a tenant.
1077
- *
1078
- * @example
1079
- * System role:
1080
- * ```typescript
1081
- * {
1082
- * id: 'role_123',
1083
- * tenant_id: null,
1084
- * role_name: 'admin',
1085
- * permissions: ['tenant#delete_all_projects', 'tenant#manage_billing'],
1086
- * user_ids: ['user_456', 'user_789'],
1087
- * created_at: '2024-01-01T00:00:00Z',
1088
- * updated_at: '2024-01-01T00:00:00Z'
1089
- * }
1090
- * ```
1091
- *
1092
- * @example
1093
- * Custom tenant role:
1094
- * ```typescript
1095
- * {
1096
- * id: 'role_456',
1097
- * tenant_id: 'tenant_123',
1098
- * role_name: 'billing_manager',
1099
- * permissions: ['tenant#manage_billing', 'tenant#view_invoices'],
1100
- * user_ids: ['user_999'],
1101
- * created_at: '2024-01-01T00:00:00Z',
1102
- * updated_at: '2024-01-01T00:00:00Z'
1103
- * }
1104
- * ```
1105
- *
1106
- * @since 0.7.0
1107
- * @public
1108
- */
1109
- interface Role {
1110
- /**
1111
- * Unique identifier for the role
1112
- */
1113
- id: string;
1114
- /**
1115
- * Tenant ID this role belongs to, or null for system roles
1116
- *
1117
- * - `null`: System role (applies to all tenants)
1118
- * - `string`: Tenant-specific custom role
1119
- */
1120
- tenant_id: string | null;
1121
- /**
1122
- * Human-readable name for the role
1123
- * @example 'admin', 'billing_manager', 'developer'
1124
- */
1125
- role_name: string;
1126
- /**
1127
- * Array of permission strings in format: namespace#relation or namespace:id#relation
1128
- *
1129
- * @example
1130
- * Tenant-wide permissions:
1131
- * - 'tenant#invite_user'
1132
- * - 'tenant#delete_all_projects'
1133
- *
1134
- * Resource-specific permissions:
1135
- * - 'project:proj_abc123#deploy'
1136
- * - 'project:proj_abc123#view_logs'
1137
- */
1138
- permissions: string[];
1139
- /**
1140
- * Array of user IDs assigned to this role
1141
- *
1142
- * When a user is assigned to a role, their ID is added here and
1143
- * corresponding Keto relationship tuples are created for each permission.
1144
- */
1145
- user_ids: string[];
1146
- /**
1147
- * Timestamp when the role was created
1148
- */
1149
- created_at: string;
1150
- /**
1151
- * Timestamp when the role was last updated
1152
- */
1153
- updated_at: string;
1154
- }
1155
- /**
1156
- * Request body for creating a new role
1157
- *
1158
- * @example
1159
- * ```typescript
1160
- * {
1161
- * role_name: 'billing_manager',
1162
- * permissions: [
1163
- * 'tenant#manage_billing',
1164
- * 'tenant#view_invoices',
1165
- * 'tenant#update_payment_methods'
1166
- * ]
1167
- * }
1168
- * ```
1169
- *
1170
- * @since 0.7.0
1171
- * @public
1172
- */
1173
- interface CreateRoleRequest {
1174
- /**
1175
- * Name for the new role
1176
- * @example 'billing_manager', 'support_agent', 'developer'
1177
- */
1178
- role_name: string;
1179
- /**
1180
- * Array of permission strings to assign to the role
1181
- * @example ['tenant#manage_billing', 'tenant#view_invoices']
1182
- */
1183
- permissions: string[];
1184
- }
1185
- /**
1186
- * Request body for updating an existing role's permissions
1187
- *
1188
- * @example
1189
- * ```typescript
1190
- * {
1191
- * permissions: [
1192
- * 'tenant#manage_billing',
1193
- * 'tenant#view_invoices',
1194
- * 'tenant#manage_users' // Added new permission
1195
- * ]
1196
- * }
1197
- * ```
1198
- *
1199
- * @since 0.7.0
1200
- * @public
1201
- */
1202
- interface UpdateRoleRequest {
1203
- /**
1204
- * New array of permissions for the role
1205
- *
1206
- * This replaces all existing permissions. Old permissions are removed
1207
- * from Keto and new ones are created for all assigned users.
1208
- */
1209
- permissions: string[];
1210
- }
1211
- /**
1212
- * Request body for assigning a role to a user
1213
- *
1214
- * Supports assigning by either role ID or role name for flexibility.
1215
- * When using role_name, the system will find the role by name within
1216
- * the current tenant's scope (including system roles).
1217
- *
1218
- * @example
1219
- * By role ID:
1220
- * ```typescript
1221
- * {
1222
- * role_id: 'role_456'
1223
- * }
1224
- * ```
1225
- *
1226
- * @example
1227
- * By role name:
1228
- * ```typescript
1229
- * {
1230
- * role_name: 'owner'
1231
- * }
1232
- * ```
1233
- *
1234
- * @since 0.7.0
1235
- * @public
1236
- */
1237
- interface AssignRoleRequest {
1238
- /**
1239
- * ID of the role to assign to the user
1240
- * Use either role_id or role_name, not both
1241
- */
1242
- role_id?: string;
1243
- /**
1244
- * Name of the role to assign to the user
1245
- * Use either role_id or role_name, not both
1246
- * @example 'owner', 'admin', 'billing_manager'
1247
- */
1248
- role_name?: string;
1249
- }
1250
-
1251
- /**
1252
- * Handler for managing roles and role-based permissions
1253
- *
1254
- * Provides methods for creating custom roles, assigning permissions,
1255
- * and managing role assignments. Works alongside the Keto-based
1256
- * permissions system to provide dynamic RBAC capabilities.
1257
- *
1258
- * @example
1259
- * ```typescript
1260
- * // Create a custom role
1261
- * const role = await omnibase.permissions.roles.create({
1262
- * role_name: 'billing_manager',
1263
- * permissions: ['tenant#manage_billing', 'tenant#view_invoices']
1264
- * });
1265
- *
1266
- * // Assign role to user
1267
- * await omnibase.permissions.roles.assign('user_123', {
1268
- * role_id: role.id
1269
- * });
1270
- * ```
1271
- *
1272
- * @since 0.7.0
1273
- * @public
1274
- */
1275
- declare class RolesHandler {
1276
- private client;
1277
- constructor(client: OmnibaseClient);
1278
- /**
1279
- * Get available namespace definitions for UI
1280
- *
1281
- * Returns all namespaces and their available relations/permissions.
1282
- * Useful for building role configuration UIs.
1283
- *
1284
- * @returns List of namespace definitions
1285
- *
1286
- * @example
1287
- * ```typescript
1288
- * const definitions = await omnibase.permissions.roles.getDefinitions();
1289
- *
1290
- * // Output: [{ namespace: 'Tenant', relations: ['invite_user', 'delete_tenant', ...] }]
1291
- * definitions.forEach(def => {
1292
- * console.log(`${def.namespace} supports: ${def.relations.join(', ')}`);
1293
- * });
1294
- * ```
1295
- */
1296
- getDefinitions(): Promise<NamespaceDefinition[]>;
1297
- /**
1298
- * List all roles for the current tenant
1299
- *
1300
- * Returns both system roles (defined in roles.config.json) and
1301
- * custom roles created via the API. System roles have `tenant_id = null`.
1302
- *
1303
- * @returns List of roles
1304
- *
1305
- * @example
1306
- * ```typescript
1307
- * const roles = await omnibase.permissions.roles.list();
1308
- *
1309
- * const systemRoles = roles.filter(r => r.tenant_id === null);
1310
- * const customRoles = roles.filter(r => r.tenant_id !== null);
1311
- *
1312
- * console.log(`System roles: ${systemRoles.map(r => r.role_name).join(', ')}`);
1313
- * console.log(`Custom roles: ${customRoles.map(r => r.role_name).join(', ')}`);
1314
- * ```
1315
- */
1316
- list(): Promise<Role[]>;
1317
- /**
1318
- * Create a new custom role
1319
- *
1320
- * Creates a tenant-specific role with the specified permissions.
1321
- * Permissions use the format `namespace#relation` or `namespace:id#relation`.
1322
- *
1323
- * @param request - Role creation request
1324
- * @returns Created role
1325
- *
1326
- * @example
1327
- * ```typescript
1328
- * const role = await omnibase.permissions.roles.create({
1329
- * role_name: 'billing_manager',
1330
- * permissions: [
1331
- * 'tenant#manage_billing',
1332
- * 'tenant#view_invoices',
1333
- * 'tenant#update_payment_methods'
1334
- * ]
1335
- * });
1336
- *
1337
- * console.log(`Created role: ${role.id}`);
1338
- * ```
1339
- *
1340
- * @example
1341
- * Resource-specific permissions:
1342
- * ```typescript
1343
- * const devRole = await omnibase.permissions.roles.create({
1344
- * role_name: 'project_developer',
1345
- * permissions: [
1346
- * 'project:proj_abc123#deploy',
1347
- * 'project:proj_abc123#view_logs',
1348
- * 'tenant#invite_user'
1349
- * ]
1350
- * });
1351
- * ```
1352
- */
1353
- create(request: CreateRoleRequest): Promise<Role>;
1354
- /**
1355
- * Update an existing role's permissions
1356
- *
1357
- * Updates the permissions for a role and automatically updates all
1358
- * Keto relationships for users assigned to this role. Old permissions
1359
- * are removed and new ones are created.
1360
- *
1361
- * @param roleId - ID of role to update
1362
- * @param request - Update request with new permissions
1363
- * @returns Updated role
1364
- *
1365
- * @example
1366
- * ```typescript
1367
- * const updatedRole = await omnibase.permissions.roles.update('role_123', {
1368
- * permissions: [
1369
- * 'tenant#manage_billing',
1370
- * 'tenant#view_invoices',
1371
- * 'tenant#manage_users' // Added new permission
1372
- * ]
1373
- * });
1374
- *
1375
- * console.log(`Updated role with ${updatedRole.permissions.length} permissions`);
1376
- * ```
1377
- */
1378
- update(roleId: string, request: UpdateRoleRequest): Promise<Role>;
1379
- /**
1380
- * Delete a role
1381
- *
1382
- * Deletes the role and automatically removes all Keto relationships
1383
- * for users assigned to this role. Cannot delete system roles.
1384
- *
1385
- * @param roleId - ID of role to delete
1386
- *
1387
- * @example
1388
- * ```typescript
1389
- * await omnibase.permissions.roles.delete('role_123');
1390
- * console.log('Role deleted successfully');
1391
- * ```
1392
- */
1393
- delete(roleId: string): Promise<void>;
1394
- /**
1395
- * Assign a role to a user
1396
- *
1397
- * Assigns a role to a user and automatically creates all necessary
1398
- * Keto relationship tuples based on the role's permissions. The user
1399
- * immediately gains all permissions defined in the role.
1400
- *
1401
- * Supports assignment by either role ID or role name for flexibility.
1402
- *
1403
- * @param userId - ID of user to assign role to
1404
- * @param request - Assignment request with either role_id or role_name
1405
- *
1406
- * @example
1407
- * Assign by role ID:
1408
- * ```typescript
1409
- * await omnibase.permissions.roles.assign('user_123', {
1410
- * role_id: 'role_456'
1411
- * });
1412
- * ```
1413
- *
1414
- * @example
1415
- * Assign by role name (system or custom role):
1416
- * ```typescript
1417
- * // Assign system role
1418
- * await omnibase.permissions.roles.assign('user_123', {
1419
- * role_name: 'owner'
1420
- * });
1421
- *
1422
- * // Assign custom role
1423
- * await omnibase.permissions.roles.assign('user_456', {
1424
- * role_name: 'billing_manager'
1425
- * });
1426
- * ```
1427
- *
1428
- * @example
1429
- * Verify permissions after assignment:
1430
- * ```typescript
1431
- * await omnibase.permissions.roles.assign('user_123', {
1432
- * role_name: 'admin'
1433
- * });
1434
- *
1435
- * // User now has all permissions from the admin role
1436
- * const canManage = await omnibase.permissions.permissions.checkPermission(
1437
- * undefined,
1438
- * {
1439
- * namespace: 'Tenant',
1440
- * object: 'tenant_789',
1441
- * relation: 'manage_billing',
1442
- * subjectId: 'user_123'
1443
- * }
1444
- * );
1445
- * // canManage.data.allowed === true
1446
- * ```
1447
- */
1448
- assign(userId: string, request: AssignRoleRequest): Promise<void>;
1449
- }
1450
-
1451
- /**
1452
- * Client for managing permissions and relationships using Ory Keto
1453
- *
1454
- * This client provides access to Ory Keto's permission system, allowing you to
1455
- * create, manage, and check relationships between subjects and objects. It handles
1456
- * both read operations (permission checks) and write operations (relationship management).
1457
- *
1458
- * The client automatically configures separate endpoints for read and write operations
1459
- * to optimize performance and security by following Ory Keto's recommended architecture.
1460
- *
1461
- * @example
1462
- * Basic permission checking:
1463
- * ```typescript
1464
- * import { PermissionsClient } from '@omnibase/core-js/permissions';
1465
- *
1466
- * const permissionsClient = new PermissionsClient('https://api.example.com');
1467
- *
1468
- * // Check if a user can view a tenant
1469
- * const canView = await permissionsClient.permissions.checkPermission(
1470
- * undefined,
1471
- * {
1472
- * namespace: 'Tenant',
1473
- * object: 'tenant_123',
1474
- * relation: 'view',
1475
- * subjectId: 'user_456'
1476
- * }
1477
- * );
1478
- *
1479
- * if (canView.data.allowed) {
1480
- * console.log('User can view the tenant');
1481
- * }
1482
- * ```
1483
- *
1484
- * @example
1485
- * Creating tenant relationships:
1486
- * ```typescript
1487
- * // Create a relationship making a user an owner of a tenant
1488
- * await permissionsClient.relationships.createRelationship(
1489
- * undefined,
1490
- * {
1491
- * namespace: 'Tenant',
1492
- * object: 'tenant_123',
1493
- * relation: 'owners',
1494
- * subjectId: 'user_456'
1495
- * }
1496
- * );
1497
- *
1498
- * // Now the user has owner permissions on the tenant
1499
- * console.log('User is now an owner of the tenant');
1500
- * ```
1501
- *
1502
- * @example
1503
- * Complex tenant permission management:
1504
- * ```typescript
1505
- * const tenantId = 'tenant_123';
1506
- * const userId = 'user_456';
1507
- *
1508
- * // Grant admin permissions to a user
1509
- * await permissionsClient.relationships.createRelationship(
1510
- * undefined,
1511
- * {
1512
- * namespace: 'Tenant',
1513
- * object: tenantId,
1514
- * relation: 'admins',
1515
- * subjectId: userId
1516
- * }
1517
- * );
1518
- *
1519
- * // Check if user can manage members (admins and owners can)
1520
- * const canManageMembers = await permissionsClient.permissions.checkPermission(
1521
- * undefined,
1522
- * {
1523
- * namespace: 'Tenant',
1524
- * object: tenantId,
1525
- * relation: 'manage_members',
1526
- * subjectId: userId
1527
- * }
1528
- * );
1529
- *
1530
- * if (canManageMembers.data.allowed) {
1531
- * // User can invite/remove members
1532
- * console.log('User can manage tenant members');
1533
- * }
1534
- *
1535
- * // Later, remove admin permissions
1536
- * await permissionsClient.relationships.deleteRelationships(
1537
- * undefined,
1538
- * {
1539
- * namespace: 'Tenant',
1540
- * object: tenantId,
1541
- * relation: 'admins',
1542
- * subjectId: userId
1543
- * }
1544
- * );
1545
- * ```
1546
- *
1547
- * @since 1.0.0
1548
- * @public
1549
- * @group Client
1550
- */
1551
- declare class PermissionsClient {
1552
- /**
1553
- * Ory Keto RelationshipApi for managing subject-object relationships
1554
- *
1555
- * Provides methods for creating, updating, and deleting relationships between
1556
- * subjects (users, groups) and objects (tenants, resources). This API handles
1557
- * write operations and is used to establish permission structures.
1558
- *
1559
- * Key methods:
1560
- * - `createRelationship()` - Creates a new relationship tuple
1561
- * - `deleteRelationships()` - Removes existing relationship tuples
1562
- * - `getRelationships()` - Queries existing relationships
1563
- * - `patchRelationships()` - Updates multiple relationships atomically
1564
- *
1565
- * @example
1566
- * ```typescript
1567
- * // Create a relationship
1568
- * await client.relationships.createRelationship(
1569
- * undefined,
1570
- * {
1571
- * namespace: 'Tenant',
1572
- * object: 'tenant_123',
1573
- * relation: 'members',
1574
- * subjectId: 'user_456'
1575
- * }
1576
- * );
1577
- * ```
1578
- *
1579
- * @since 1.0.0
1580
- * @group Relationships
1581
- */
1582
- relationships: RelationshipApi;
1583
- /**
1584
- * Ory Keto PermissionApi for checking permissions
1585
- *
1586
- * Provides methods for querying whether a subject has a specific permission
1587
- * on an object. This API handles read operations and is optimized for fast
1588
- * permission checks in your application logic.
1589
- *
1590
- * Key methods:
1591
- * - `checkPermission()` - Checks if a subject has permission on an object
1592
- * - `checkPermissionOrError()` - Same as above but throws error if denied
1593
- * - `expandPermissions()` - Expands relationships to show all granted permissions
1594
- *
1595
- * @example
1596
- * ```typescript
1597
- * // Check permission
1598
- * const result = await client.permissions.checkPermission(
1599
- * undefined,
1600
- * {
1601
- * namespace: 'Tenant',
1602
- * object: 'tenant_123',
1603
- * relation: 'view',
1604
- * subjectId: 'user_456'
1605
- * }
1606
- * );
1607
- *
1608
- * console.log('Has permission:', result.data.allowed);
1609
- * ```
1610
- *
1611
- * @since 1.0.0
1612
- * @group Permissions
1613
- */
1614
- permissions: PermissionApi;
1615
- /**
1616
- * Handler for managing roles and role-based permissions
1617
- *
1618
- * Provides methods for creating custom roles, assigning permissions,
1619
- * and managing role assignments. Works alongside the Keto-based
1620
- * permissions system to provide dynamic RBAC capabilities.
1621
- *
1622
- * @example
1623
- * ```typescript
1624
- * // Create a custom role
1625
- * const role = await omnibase.permissions.roles.create({
1626
- * role_name: 'billing_manager',
1627
- * permissions: ['tenant#manage_billing', 'tenant#view_invoices']
1628
- * });
1629
- *
1630
- * // Assign role to user
1631
- * await omnibase.permissions.roles.assign('user_123', {
1632
- * role_id: role.id
1633
- * });
1634
- * ```
1635
- *
1636
- * @since 0.7.0
1637
- * @group Roles
1638
- */
1639
- roles: RolesHandler;
1640
- /**
1641
- * Creates a new PermissionsClient instance
1642
- *
1643
- * Initializes the client with separate endpoints for read and write operations.
1644
- * The client automatically appends the appropriate Keto API paths to the base URL
1645
- * for optimal performance and security separation.
1646
- *
1647
- * @param apiBaseUrl - The base URL for your Omnibase API instance
1648
- * @param client - The main OmnibaseClient instance (for roles handler)
1649
- *
1650
- * @throws {Error} When the base URL is invalid or cannot be reached
1651
- *
1652
- * @example
1653
- * ```typescript
1654
- * const client = new PermissionsClient('https://api.example.com', omnibaseClient);
1655
- * ```
1656
- *
1657
- * @since 1.0.0
1658
- * @group Client
1659
- */
1660
- constructor(apiBaseUrl: string, client: OmnibaseClient);
1661
- }
1662
-
1663
- interface UploadOptions {
1664
- /**
1665
- * Custom metadata to attach to the file
1666
- * This will be stored in the JSONB metadata column
1667
- */
1668
- metadata?: Record<string, any>;
1669
- }
1670
- interface UploadResult {
1671
- /**
1672
- * Pre-signed URL for uploading the file
1673
- */
1674
- upload_url: string;
1675
- /**
1676
- * Full path where the file is stored
1677
- */
1678
- path: string;
1679
- }
1680
- interface DownloadResult {
1681
- /**
1682
- * Pre-signed URL for downloading the file
1683
- */
1684
- download_url: string;
1685
- }
1686
- /**
1687
- * Storage client for file operations with path-based organization
1688
- *
1689
- * Users control the full file path and define RLS policies based on path patterns.
1690
- * Common patterns:
1691
- * - `public/*` - Public files
1692
- * - `users/{user_id}/*` - User private files
1693
- * - `teams/{team_id}/*` - Team shared files
1694
- *
1695
- * @example
1696
- * ```typescript
1697
- * const storage = omnibase.storage();
1698
- *
1699
- * // Upload to public directory
1700
- * await storage.upload('public/images/avatar.png', file);
1701
- *
1702
- * // Upload to user private directory
1703
- * await storage.upload('users/123/documents/report.pdf', file, {
1704
- * metadata: {
1705
- * department: 'engineering',
1706
- * confidential: true
1707
- * }
1708
- * });
1709
- *
1710
- * // Download file
1711
- * const { download_url } = await storage.download('public/images/avatar.png');
1712
- *
1713
- * // Delete file
1714
- * await storage.delete('users/123/documents/report.pdf');
1715
- * ```
1716
- */
1717
- declare class StorageClient {
1718
- private client;
1719
- constructor(client: OmnibaseClient);
1720
- /**
1721
- * Upload a file to storage
1722
- *
1723
- * @param path - Full path for the file (e.g., "public/images/avatar.png", "users/123/private/doc.pdf")
1724
- * @param file - File or Blob to upload
1725
- * @param options - Upload options including custom metadata
1726
- *
1727
- * @example
1728
- * ```typescript
1729
- * const result = await storage.upload(
1730
- * 'public/avatars/user-123.png',
1731
- * file,
1732
- * {
1733
- * metadata: {
1734
- * userId: '123',
1735
- * uploadedBy: 'john@example.com',
1736
- * tags: ['profile', 'avatar']
1737
- * }
1738
- * }
1739
- * );
1740
- *
1741
- * // File is automatically uploaded to S3 via the presigned URL
1742
- * console.log('File uploaded to:', result.path);
1743
- * ```
1744
- */
1745
- upload(path: string, file: File | Blob, options?: UploadOptions): Promise<UploadResult>;
1746
- /**
1747
- * Download a file from storage
1748
- *
1749
- * @param path - Full path to the file
1750
- *
1751
- * @example
1752
- * ```typescript
1753
- * const { download_url } = await storage.download('public/images/logo.png');
1754
- *
1755
- * // Download the file
1756
- * const response = await fetch(download_url);
1757
- * const blob = await response.blob();
1758
- * ```
1759
- */
1760
- download(path: string): Promise<DownloadResult>;
1761
- /**
1762
- * Delete a file from storage
1763
- *
1764
- * @param path - Full path to the file
1765
- *
1766
- * @example
1767
- * ```typescript
1768
- * await storage.delete('users/123/documents/old-report.pdf');
1769
- * ```
1770
- */
1771
- delete(path: string): Promise<void>;
1772
- }
1773
-
1774
- /**
1775
- * Request data for accepting a tenant invitation
1776
- *
1777
- * Contains the secure token that was provided in the invitation.
1778
- * This token is validated server-side to ensure the invitation
1779
- * is legitimate, not expired, and hasn't been used before.
1780
- *
1781
- * @example
1782
- * ```typescript
1783
- * const acceptData: AcceptTenantInviteRequest = {
1784
- * token: 'inv_secure_token_abc123xyz'
1785
- * };
1786
- * ```
1787
- *
1788
- * @since 0.6.0
1789
- * @public
1790
- * @group Tenant Invitations
1791
- */
1792
- type AcceptTenantInviteRequest = {
1793
- /** Secure invitation token from the email invitation */
1794
- token: string;
1795
- };
1796
- /**
1797
- * Response structure for accepting a tenant invitation
1798
- *
1799
- * Contains the ID of the tenant that the user has successfully joined
1800
- * along with a confirmation message. After accepting an invitation,
1801
- * the user becomes a member of the tenant with the role specified
1802
- * in the original invitation.
1803
- *
1804
- * @example
1805
- * ```typescript
1806
- * const response: AcceptTenantInviteResponse = {
1807
- * data: {
1808
- * tenant_id: 'tenant_abc123',
1809
- * message: 'Successfully joined tenant'
1810
- * },
1811
- * status: 200
1812
- * };
1813
- * ```
1814
- *
1815
- * @since 0.6.0
1816
- * @public
1817
- * @group Tenant Invitations
1818
- */
1819
- type AcceptTenantInviteResponse = ApiResponse<{
1820
- /** ID of the tenant the user has joined */
1821
- tenant_id: string;
1822
- /** Success message confirming the invitation acceptance */
1823
- message: string;
1824
- /** JWT token for postgrest RLS */
1825
- token: string;
1826
- }>;
1827
- /**
1828
- * Response structure for tenant user invite creation
1829
- *
1830
- * Contains the newly created invite information including the secure token
1831
- * that will be sent to the invitee. The invite has an expiration time and
1832
- * can only be used once to join the specified tenant.
1833
- *
1834
- * @example
1835
- * ```typescript
1836
- * const response: CreateTenantUserInviteResponse = {
1837
- * data: {
1838
- * invite: {
1839
- * id: 'invite_123',
1840
- * tenant_id: 'tenant_abc',
1841
- * email: 'colleague@company.com',
1842
- * role: 'member',
1843
- * token: 'inv_secure_token_xyz',
1844
- * expires_at: '2024-02-15T10:30:00Z'
1845
- * },
1846
- * message: 'Invite created successfully'
1847
- * },
1848
- * status: 201
1849
- * };
1850
- * ```
1851
- *
1852
- * @since 0.6.0
1853
- * @public
1854
- * @group Tenant Invitations
1855
- */
1856
- type CreateTenantUserInviteResponse = ApiResponse<{
1857
- /** The newly created tenant invite */
1858
- invite: TenantInvite;
1859
- /** Success message confirming invite creation */
1860
- message: string;
1861
- }>;
1862
- /**
1863
- * Tenant invitation entity structure
1864
- *
1865
- * Represents a pending invitation for a user to join a specific tenant
1866
- * with a defined role. The invite contains a secure token that expires
1867
- * after a certain time period and can only be used once.
1868
- *
1869
- * @example
1870
- * ```typescript
1871
- * const invite: TenantInvite = {
1872
- * id: 'invite_abc123',
1873
- * tenant_id: 'tenant_xyz789',
1874
- * email: 'newuser@company.com',
1875
- * role: 'member',
1876
- * token: 'inv_secure_abc123xyz',
1877
- * inviter_id: 'user_owner123',
1878
- * expires_at: '2024-02-01T12:00:00Z',
1879
- * created_at: '2024-01-25T12:00:00Z',
1880
- * used_at: undefined // null until invite is accepted
1881
- * };
1882
- * ```
1883
- *
1884
- * @since 0.6.0
1885
- * @public
1886
- * @group Tenant Invitations
1887
- */
1888
- type TenantInvite = {
1889
- /** Unique identifier for the invitation */
1890
- id: string;
1891
- /** ID of the tenant the user is being invited to */
1892
- tenant_id: string;
1893
- /** Email address of the invited user */
1894
- email: string;
1895
- /** Role the user will have in the tenant (e.g., 'owner', 'admin', 'member') */
1896
- role: string;
1897
- /** Secure token used to accept the invitation */
1898
- token: string;
1899
- /** ID of the user who created this invitation */
1900
- inviter_id: string;
1901
- /** ISO 8601 timestamp when the invitation expires */
1902
- expires_at: string;
1903
- /** ISO 8601 timestamp when the invitation was created */
1904
- created_at: string;
1905
- /** ISO 8601 timestamp when the invitation was accepted (null if unused) */
1906
- used_at?: string;
1907
- };
1908
- /**
1909
- * Required data for creating a tenant user invitation
1910
- *
1911
- * Specifies the email address of the user to invite, their intended
1912
- * role within the tenant, and the invitation URL that will be sent in the email.
1913
- * The role determines what permissions the user will have once they accept the invitation.
1914
- * The invite_url will be automatically appended with ?token=XYZ when sent to the user.
1915
- *
1916
- * @example
1917
- * ```typescript
1918
- * const inviteData: CreateTenantUserInviteRequest = {
1919
- * email: 'developer@company.com',
1920
- * role: 'admin',
1921
- * invite_url: 'https://yourapp.com/accept-invite'
1922
- * };
1923
- * ```
1924
- *
1925
- * @since 0.6.0
1926
- * @public
1927
- * @group Tenant Invitations
1928
- */
1929
- type CreateTenantUserInviteRequest = {
1930
- /** Email address of the user to invite */
1931
- email: string;
1932
- /** Role the invited user will have in the tenant */
1933
- role: string;
1934
- /** Invite URL - the link that will be sent to the user's email, automatically suffixed with ?token=XYZ */
1935
- invite_url: string;
1936
- };
1937
- /**
1938
- * Tenant invitation management handler
1939
- *
1940
- * This class handles all tenant invitation operations including creating
1941
- * invitations for new users and processing invitation acceptances. It provides
1942
- * a secure, email-based invitation workflow with role-based access control
1943
- * and token-based security.
1944
- *
1945
- * The manager handles:
1946
- * - Creating secure invitations with time-limited tokens
1947
- * - Processing invitation acceptances with validation
1948
- * - Email workflow integration (server-side)
1949
- * - Role assignment and permission setup
1950
- * - Security validation and anti-abuse measures
1951
- *
1952
- * All invitation operations respect tenant permissions and ensure that only
1953
- * authorized users can invite others to their tenants.
1954
- *
1955
- * @example
1956
- * ```typescript
1957
- * const inviteManager = new TenantInviteManager(omnibaseClient);
1958
- *
1959
- * // Create an invitation
1960
- * const invite = await inviteManager.create({
1961
- * email: 'colleague@company.com',
1962
- * role: 'member',
1963
- * invite_url: 'https://yourapp.com/accept-invite'
1964
- * });
1965
- *
1966
- * // Accept an invitation (from the invited user's session)
1967
- * const result = await inviteManager.accept('invite_token_xyz');
1968
- * console.log(`Joined tenant: ${result.data.tenant_id}`);
1969
- * ```
1970
- *
1971
- * @since 0.6.0
1972
- * @public
1973
- * @group Tenant Invitations
1974
- */
1975
- declare class TenantInviteManager {
1976
- private omnibaseClient;
1977
- /**
1978
- * Creates a new TenantInviteManager instance
1979
- *
1980
- * Initializes the manager with the provided Omnibase client for making
1981
- * authenticated API requests to tenant invitation endpoints.
1982
- *
1983
- * @param omnibaseClient - Configured Omnibase client instance
1984
- *
1985
- * @group Tenant Invitations
1986
- */
1987
- constructor(omnibaseClient: OmnibaseClient);
1988
- /**
1989
- * Accepts a tenant invitation using a secure token
1990
- *
1991
- * Processes a tenant invitation by validating the provided token and
1992
- * adding the authenticated user to the specified tenant. The invitation
1993
- * token is consumed during this process and cannot be used again.
1994
- *
1995
- * The function performs several validations:
1996
- * - Verifies the token exists and is valid
1997
- * - Checks that the invitation hasn't expired
1998
- * - Ensures the invitation hasn't already been used
1999
- * - Confirms the user is authenticated via session cookies
2000
- *
2001
- * Upon successful acceptance, the user is granted access to the tenant
2002
- * with the role specified in the original invitation. The invitation
2003
- * record is marked as used and cannot be accepted again.
2004
- *
2005
- * @param token - The secure invitation token from the email invitation
2006
- *
2007
- * @returns Promise resolving to the tenant ID and success confirmation
2008
- *
2009
- * @throws {Error} When the token parameter is missing or empty
2010
- * @throws {Error} When the invitation token is invalid or expired
2011
- * @throws {Error} When the invitation has already been accepted
2012
- * @throws {Error} When the user is not authenticated
2013
- * @throws {Error} When the API request fails due to network issues
2014
- * @throws {Error} When the server returns an error response (4xx, 5xx status codes)
2015
- *
2016
- * @example
2017
- * ```typescript
2018
- * // Typically called from an invitation link like:
2019
- * // https://app.com/accept-invite?token=inv_secure_token_abc123
2020
- *
2021
- * const urlParams = new URLSearchParams(window.location.search);
2022
- * const inviteToken = urlParams.get('token');
2023
- *
2024
- * if (inviteToken) {
2025
- * try {
2026
- * const result = await inviteManager.accept(inviteToken);
2027
- *
2028
- * // Success - redirect to tenant dashboard
2029
- * console.log(`Successfully joined tenant: ${result.data.tenant_id}`);
2030
- * window.location.href = `/dashboard?tenant=${result.data.tenant_id}`;
2031
- * } catch (error) {
2032
- * console.error('Failed to accept invitation:', error.message);
2033
- * }
2034
- * }
2035
- * ```
2036
- *
2037
- * @since 0.6.0
2038
- * @public
2039
- * @group Tenant Invitations
2040
- */
2041
- accept(token: string): Promise<AcceptTenantInviteResponse>;
2042
- /**
2043
- * Creates a new user invitation for the active tenant
2044
- *
2045
- * Generates a secure invitation that allows a user to join the currently active
2046
- * tenant with the defined role. The invitation is sent to the provided email address
2047
- * and includes a time-limited token for security. The invite URL will be automatically
2048
- * appended with ?token=XYZ when sent to the user.
2049
- *
2050
- * The function creates the invitation record in the database and triggers an email
2051
- * notification to the invited user. The invitation expires after 7 days and can only
2052
- * be used once.
2053
- *
2054
- * Only existing tenant members with appropriate permissions (invite_user permission)
2055
- * can create invitations. The inviter's authentication and tenant context are validated
2056
- * via HTTP-only cookies sent with the request.
2057
- *
2058
- * @param inviteData - Configuration object for the invitation
2059
- * @param inviteData.email - Email address of the user to invite
2060
- * @param inviteData.role - Role the user will have after joining (e.g., 'member', 'admin')
2061
- * @param inviteData.invite_url - Base URL for the invitation link (will be appended with ?token=XYZ)
2062
- *
2063
- * @returns Promise resolving to the created invitation with secure token
2064
- *
2065
- * @throws {Error} When required fields (email, role, invite_url) are missing or empty
2066
- * @throws {Error} When the user doesn't have permission to invite users to the tenant
2067
- * @throws {Error} When the API request fails due to network issues
2068
- * @throws {Error} When the server returns an error response (4xx, 5xx status codes)
2069
- *
2070
- * @example
2071
- * ```typescript
2072
- * const invite = await inviteManager.create({
2073
- * email: 'colleague@company.com',
2074
- * role: 'member',
2075
- * invite_url: 'https://yourapp.com/accept-invite'
2076
- * });
2077
- *
2078
- * console.log(`Invite sent to: ${invite.data.invite.email}`);
2079
- * console.log(`Invite token: ${invite.data.invite.token}`);
2080
- * ```
2081
- *
2082
- * @since 0.6.0
2083
- * @public
2084
- * @group Tenant Invitations
2085
- */
2086
- create(inviteData: CreateTenantUserInviteRequest): Promise<CreateTenantUserInviteResponse>;
2087
- }
2088
-
2089
- /**
2090
- * Response structure for switching the active tenant
2091
- *
2092
- * Contains a new JWT token that includes the updated tenant context
2093
- * and a confirmation message. The new token should replace the previous
2094
- * token for all subsequent API calls to ensure requests are made within
2095
- * the context of the newly active tenant.
2096
- *
2097
- * The token includes updated tenant-specific claims and permissions,
2098
- * ensuring that row-level security policies are enforced correctly
2099
- * for the new active tenant context.
2100
- *
2101
- * @example
2102
- * ```typescript
2103
- * const response: SwitchActiveTenantResponse = {
2104
- * data: {
2105
- * token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',
2106
- * message: 'Active tenant switched successfully'
2107
- * },
2108
- * status: 200
2109
- * };
2110
- * ```
2111
- *
2112
- * @since 0.6.0
2113
- * @public
2114
- * @group Tenant Management
2115
- */
2116
- type SwitchActiveTenantResponse = ApiResponse<{
2117
- /** New JWT token with updated tenant context */
2118
- token: string;
2119
- /** Success message confirming the tenant switch */
2120
- message: string;
2121
- }>;
2122
- /**
2123
- * Response structure for deleting a tenant
2124
- *
2125
- * Contains a confirmation message indicating successful tenant deletion.
2126
- * This response is only returned after the tenant and all associated data
2127
- * have been permanently removed from the system.
2128
- *
2129
- * @example
2130
- * ```typescript
2131
- * const response: DeleteTenantResponse = {
2132
- * data: {
2133
- * message: 'Tenant deleted successfully'
2134
- * },
2135
- * status: 200
2136
- * };
2137
- * ```
2138
- *
2139
- * @since 0.6.0
2140
- * @public
2141
- * @group Tenant Management
2142
- */
2143
- type DeleteTenantResponse = ApiResponse<{
2144
- /** Confirmation message indicating successful deletion */
2145
- message: string;
2146
- }>;
2147
- /**
2148
- * Response structure for tenant creation operations
2149
- *
2150
- * Contains the newly created tenant information along with an authentication
2151
- * token that provides Row-Level Security (RLS) access to the tenant's data.
2152
- * The token should be stored securely and used for subsequent API calls
2153
- * that require tenant-specific access.
2154
- *
2155
- * @example
2156
- * ```typescript
2157
- * const response: CreateTenantResponse = {
2158
- * data: {
2159
- * tenant: {
2160
- * id: 'tenant_123',
2161
- * name: 'My Company',
2162
- * stripe_customer_id: 'cus_abc123'
2163
- * },
2164
- * message: 'Tenant created successfully',
2165
- * token: 'eyJhbGciOiJIUzI1NiIs...'
2166
- * },
2167
- * status: 201
2168
- * };
2169
- * ```
2170
- *
2171
- * @since 0.6.0
2172
- * @public
2173
- * @group Tenant Management
2174
- */
2175
- type CreateTenantResponse = ApiResponse<{
2176
- /** The newly created tenant object */
2177
- tenant: Tenant;
2178
- /** Success message confirming tenant creation */
2179
- message: string;
2180
- /** JWT token for RLS policies specific to the active tenant */
2181
- token: string;
2182
- }>;
2183
- /**
2184
- * Tenant entity structure that maps to the database schema
2185
- *
2186
- * Represents a tenant in the multi-tenant system with billing integration
2187
- * via Stripe. Each tenant can have multiple users with different roles
2188
- * and maintains its own isolated data through RLS policies.
2189
- *
2190
- * @example
2191
- * ```typescript
2192
- * const tenant: Tenant = {
2193
- * id: 'tenant_abc123',
2194
- * name: 'Acme Corporation',
2195
- * stripe_customer_id: 'cus_stripe123',
2196
- * type: 'business',
2197
- * created_at: '2024-01-15T10:30:00Z',
2198
- * updated_at: '2024-01-15T10:30:00Z'
2199
- * };
2200
- * ```
2201
- *
2202
- * @since 0.6.0
2203
- * @public
2204
- * @group Tenant Management
2205
- */
2206
- type Tenant = {
2207
- /** Unique identifier for the tenant */
2208
- id: string;
2209
- /** Display name of the tenant organization */
2210
- name: string;
2211
- /** Associated Stripe customer ID for billing */
2212
- stripe_customer_id: string;
2213
- /** Type of tenant (e.g., 'individual', 'organization') */
2214
- type: string;
2215
- /** ISO 8601 timestamp when the tenant was created */
2216
- created_at: string;
2217
- /** ISO 8601 timestamp when the tenant was last updated */
2218
- updated_at: string;
2219
- };
2220
- /**
2221
- * Required data for creating a new tenant
2222
- *
2223
- * Contains the essential information needed to establish a new tenant
2224
- * in the system, including billing setup and initial user assignment.
2225
- *
2226
- * @example
2227
- * ```typescript
2228
- * const tenantData: CreateTenantRequest = {
2229
- * name: 'My New Company',
2230
- * billing_email: 'billing@mynewcompany.com',
2231
- * user_id: 'user_abc123'
2232
- * };
2233
- * ```
2234
- *
2235
- * @since 0.6.0
2236
- * @public
2237
- * @group Tenant Management
2238
- */
2239
- type CreateTenantRequest = {
2240
- /** Name of the tenant organization */
2241
- name: string;
2242
- /** Email address for billing notifications */
2243
- billing_email: string;
2244
- /** ID of the user who will own the tenant */
2245
- user_id: string;
2246
- };
2247
- /**
2248
- * Tenant management operations handler
2249
- *
2250
- * This class provides core tenant lifecycle management operations including
2251
- * creation, deletion, and active tenant switching. It handles all the fundamental
2252
- * operations needed to manage tenants in a multi-tenant application with
2253
- * integrated billing and row-level security.
2254
- *
2255
- * The manager handles:
2256
- * - Tenant creation with Stripe billing integration
2257
- * - Secure tenant deletion with data cleanup
2258
- * - Active tenant switching with JWT token management
2259
- * - User permission validation for all operations
2260
- *
2261
- * All operations are performed within the authenticated user context and
2262
- * respect tenant ownership and permission rules.
2263
- *
2264
- * @example
2265
- * ```typescript
2266
- * const tenantManager = new TenantManger(omnibaseClient);
2267
- *
2268
- * // Create a new tenant
2269
- * const tenant = await tenantManager.createTenant({
2270
- * name: 'Acme Corp',
2271
- * billing_email: 'billing@acme.com',
2272
- * user_id: 'user_123'
2273
- * });
2274
- *
2275
- * // Switch to the new tenant
2276
- * await tenantManager.switchActiveTenant(tenant.data.tenant.id);
2277
- *
2278
- * // Delete tenant (owner only)
2279
- * await tenantManager.deleteTenant(tenant.data.tenant.id);
2280
- * ```
2281
- *
2282
- * @since 0.6.0
2283
- * @public
2284
- * @group Tenant Management
2285
- */
2286
- declare class TenantManger {
2287
- private omnibaseClient;
2288
- /**
2289
- * Creates a new TenantManger instance
2290
- *
2291
- * Initializes the manager with the provided Omnibase client for making
2292
- * authenticated API requests to tenant management endpoints.
2293
- *
2294
- * @param omnibaseClient - Configured Omnibase client instance
2295
- *
2296
- * @group Tenant Management
2297
- */
2298
- constructor(omnibaseClient: OmnibaseClient);
2299
- /**
2300
- * Creates a new tenant in the multi-tenant system
2301
- *
2302
- * Establishes a new tenant with integrated Stripe billing setup and assigns
2303
- * the specified user as the tenant owner. The operation creates the necessary
2304
- * database records and returns a JWT token that enables Row-Level Security
2305
- * access to the tenant's isolated data.
2306
- *
2307
- * The function automatically handles Stripe customer creation for billing
2308
- * integration and sets up the initial tenant configuration. The returned
2309
- * token should be stored securely for subsequent API calls.
2310
- *
2311
- * @param tenantData - Configuration object for the new tenant
2312
- * @param tenantData.name - Display name for the tenant organization
2313
- * @param tenantData.billing_email - Email address for Stripe billing notifications
2314
- * @param tenantData.user_id - Unique identifier of the user who will own this tenant
2315
- *
2316
- * @returns Promise resolving to the created tenant with authentication token
2317
- *
2318
- * @throws {Error} When required fields (name, user_id) are missing or empty
2319
- * @throws {Error} When the API request fails due to network issues
2320
- * @throws {Error} When the server returns an error response (4xx, 5xx status codes)
2321
- *
2322
- * @example
2323
- * ```typescript
2324
- * const newTenant = await tenantManager.createTenant({
2325
- * name: 'Acme Corporation',
2326
- * billing_email: 'billing@acme.com',
2327
- * user_id: 'user_123'
2328
- * });
2329
- *
2330
- * console.log(`Tenant created: ${newTenant.data.tenant.id}`);
2331
- * ```
2332
- *
2333
- * @since 0.6.0
2334
- * @public
2335
- * @group Tenant Management
2336
- */
2337
- createTenant(tenantData: CreateTenantRequest): Promise<CreateTenantResponse>;
2338
- /**
2339
- * Permanently deletes a tenant and all associated data
2340
- *
2341
- * ⚠️ **WARNING: This operation is irreversible and will permanently delete:**
2342
- * - The tenant record and all metadata
2343
- * - All user memberships and invitations for this tenant
2344
- * - All tenant-specific data protected by row-level security
2345
- * - Any tenant-related billing information
2346
- * - All tenant configuration and settings
2347
- *
2348
- * **Access Control:**
2349
- * Only tenant owners can delete a tenant. This operation requires:
2350
- * - User must be authenticated
2351
- * - User must have 'owner' role for the specified tenant
2352
- * - Tenant must exist and be accessible to the user
2353
- *
2354
- * **Security Considerations:**
2355
- * - All tenant data is immediately and permanently removed
2356
- * - Other tenant members lose access immediately
2357
- * - Any active sessions for this tenant are invalidated
2358
- * - Billing subscriptions are cancelled (if applicable)
2359
- * - Audit logs for deletion are maintained for compliance
2360
- *
2361
- * @returns Promise resolving to a confirmation message
2362
- *
2363
- * @throws {Error} When the tenantId parameter is missing or empty
2364
- * @throws {Error} When the user is not authenticated
2365
- * @throws {Error} When the user is not an owner of the specified tenant
2366
- * @throws {Error} When the tenant doesn't exist or is not accessible
2367
- * @throws {Error} When the API request fails due to network issues
2368
- * @throws {Error} When the server returns an error response (4xx, 5xx status codes)
2369
- *
2370
- * @example
2371
- * ```typescript
2372
- * // Always confirm before deleting
2373
- * const userConfirmed = confirm(
2374
- * 'Are you sure you want to delete this tenant? This action cannot be undone.'
2375
- * );
2376
- *
2377
- * if (userConfirmed) {
2378
- * try {
2379
- * const result = await tenantManager.deleteTenant();
2380
- * console.log(result.data.message);
2381
- *
2382
- * // Redirect user away from deleted tenant
2383
- * window.location.href = '/dashboard';
2384
- * } catch (error) {
2385
- * console.error('Failed to delete tenant:', error);
2386
- * }
2387
- * }
2388
- * ```
2389
- *
2390
- * @since 0.6.0
2391
- * @public
2392
- * @group Tenant Management
2393
- */
2394
- deleteTenant(): Promise<DeleteTenantResponse>;
2395
- /**
2396
- * Switches the user's active tenant context
2397
- *
2398
- * Changes the user's active tenant to the specified tenant ID, updating
2399
- * their authentication context and permissions. This function is essential
2400
- * for multi-tenant applications where users belong to multiple tenants
2401
- * and need to switch between them.
2402
- *
2403
- * The function performs several operations:
2404
- * - Validates that the user has access to the specified tenant
2405
- * - Updates the user's active tenant in their session
2406
- * - Generates a new JWT token with updated tenant claims
2407
- * - Updates any cached tenant-specific data
2408
- *
2409
- * After switching tenants, all subsequent API calls will be made within
2410
- * the context of the new active tenant, with row-level security policies
2411
- * applied accordingly. The new JWT token should be used for all future
2412
- * authenticated requests.
2413
- *
2414
- * @param tenantId - The ID of the tenant to switch to (must be a tenant the user belongs to)
2415
- *
2416
- * @returns Promise resolving to a new JWT token and success confirmation
2417
- *
2418
- * @throws {Error} When the tenantId parameter is missing or empty
2419
- * @throws {Error} When the user doesn't have access to the specified tenant
2420
- * @throws {Error} When the user is not authenticated
2421
- * @throws {Error} When the specified tenant doesn't exist
2422
- * @throws {Error} When the API request fails due to network issues
2423
- * @throws {Error} When the server returns an error response (4xx, 5xx status codes)
2424
- *
2425
- * @example
2426
- * ```typescript
2427
- * const result = await tenantManager.switchActiveTenant('tenant_xyz789');
2428
- *
2429
- * // Store the new token for future requests
2430
- * console.log(`Switched to tenant. New token: ${result.data.token}`);
2431
- *
2432
- * // Now all API calls will be in the context of tenant_xyz789
2433
- * const tenantData = await getCurrentTenantData();
2434
- * ```
2435
- *
2436
- * @since 0.6.0
2437
- * @public
2438
- * @group Tenant Management
2439
- */
2440
- switchActiveTenant(tenantId: string): Promise<SwitchActiveTenantResponse>;
2441
- }
2442
-
2443
- /**
2444
- * Active subscription data returned from the API
2445
- *
2446
- * Represents a tenant's active Stripe subscription with config-based price IDs
2447
- * instead of raw Stripe IDs. Includes legacy price detection for historical
2448
- * billing configurations.
2449
- *
2450
- * @example
2451
- * ```typescript
2452
- * const subscription: TenantSubscription = {
2453
- * subscription_id: 'sub_1234567890',
2454
- * config_price_id: 'price_pro_monthly',
2455
- * status: 'active',
2456
- * is_legacy_price: false,
2457
- * current_period_end: 1735416000
2458
- * };
2459
- * ```
2460
- *
2461
- * @since 0.6.0
2462
- * @public
2463
- * @group Tenant Subscriptions
2464
- */
2465
- type TenantSubscription = {
2466
- /** Stripe subscription ID */
2467
- subscription_id: string;
2468
- /** Config-based price ID from your billing configuration */
2469
- config_price_id: string;
2470
- /** Subscription status (active, trialing, past_due) */
2471
- status: string;
2472
- /** Whether this price is from a legacy billing configuration */
2473
- is_legacy_price: boolean;
2474
- /** Unix timestamp when the current billing period ends */
2475
- current_period_end: number;
2476
- };
2477
- /**
2478
- * Response structure for getting active subscriptions
2479
- *
2480
- * @since 0.6.0
2481
- * @public
2482
- * @group Tenant Subscriptions
2483
- */
2484
- type GetActiveSubscriptionsResponse = ApiResponse<TenantSubscription[]>;
2485
- /**
2486
- * Billing status information for a tenant
2487
- *
2488
- * Indicates whether the tenant has valid billing information configured
2489
- * in their Stripe customer account.
2490
- *
2491
- * @example
2492
- * ```typescript
2493
- * const status: BillingStatus = {
2494
- * has_billing_info: true,
2495
- * is_active: true
2496
- * };
2497
- * ```
2498
- *
2499
- * @since 0.6.0
2500
- * @public
2501
- * @group Tenant Subscriptions
2502
- */
2503
- type BillingStatus = {
2504
- /** Whether the tenant has payment method(s) configured */
2505
- has_billing_info: boolean;
2506
- /** Whether the billing information is active and valid */
2507
- is_active: boolean;
2508
- };
2509
- /**
2510
- * Response structure for billing status check
2511
- *
2512
- * @since 0.6.0
2513
- * @public
2514
- * @group Tenant Subscriptions
2515
- */
2516
- type GetBillingStatusResponse = ApiResponse<BillingStatus>;
2517
- /**
2518
- * Tenant subscription and billing management
2519
- *
2520
- * Provides access to the active tenant's Stripe subscriptions and billing
2521
- * status. All operations are automatically scoped to the user's currently
2522
- * active tenant via session authentication.
2523
- *
2524
- * Key features:
2525
- * - View all active subscriptions with config-based price IDs
2526
- * - Legacy price detection for historical billing configurations
2527
- * - Billing status verification (payment method availability)
2528
- * - Automatic tenant scoping via session context
2529
- *
2530
- * @example
2531
- * ```typescript
2532
- * const subscriptionManager = new TenantSubscriptionManager(omnibaseClient);
2533
- *
2534
- * // Get all active subscriptions for the current tenant
2535
- * const subscriptions = await subscriptionManager.getActive();
2536
- * console.log(`Active subscriptions: ${subscriptions.data.length}`);
2537
- *
2538
- * // Check if tenant has billing configured
2539
- * const status = await subscriptionManager.getBillingStatus();
2540
- * if (!status.data.has_billing_info) {
2541
- * console.log('Please add a payment method');
2542
- * }
2543
- * ```
2544
- *
2545
- * @since 0.6.0
2546
- * @public
2547
- * @group Tenant Subscriptions
2548
- */
2549
- declare class TenantSubscriptionManager {
2550
- private omnibaseClient;
2551
- /**
2552
- * Creates a new TenantSubscriptionManager instance
2553
- *
2554
- * @param omnibaseClient - Configured Omnibase client instance
2555
- *
2556
- * @group Tenant Subscriptions
2557
- */
2558
- constructor(omnibaseClient: OmnibaseClient);
2559
- /**
2560
- * Get all active subscriptions for the current tenant
2561
- *
2562
- * Retrieves all active Stripe subscriptions associated with the user's
2563
- * currently active tenant. Returns subscriptions with config-based price IDs
2564
- * instead of raw Stripe IDs, making it easier to match against your billing
2565
- * configuration.
2566
- *
2567
- * The endpoint automatically:
2568
- * - Fetches subscriptions from Stripe API
2569
- * - Maps Stripe price IDs to your config price IDs
2570
- * - Checks both current and historical price mappings
2571
- * - Flags legacy prices from old billing configurations
2572
- * - Filters to only active/trialing/past_due subscriptions
2573
- *
2574
- * Returns an empty array if:
2575
- * - Tenant has no Stripe customer ID configured
2576
- * - Tenant has no active subscriptions
2577
- * - User is not authenticated
2578
- *
2579
- * @returns Promise resolving to array of active subscriptions
2580
- *
2581
- * @throws {Error} When the user is not authenticated
2582
- * @throws {Error} When the API request fails due to network issues
2583
- * @throws {Error} When the server returns an error response (4xx, 5xx)
2584
- *
2585
- * @example
2586
- * ```typescript
2587
- * const response = await subscriptionManager.getActive();
2588
- *
2589
- * if (response.data.length === 0) {
2590
- * console.log('No active subscriptions');
2591
- * } else {
2592
- * response.data.forEach(sub => {
2593
- * console.log(`Plan: ${sub.config_price_id}`);
2594
- * console.log(`Status: ${sub.status}`);
2595
- * if (sub.is_legacy_price) {
2596
- * console.log('⚠️ Using legacy pricing');
2597
- * }
2598
- * });
2599
- * }
2600
- * ```
2601
- *
2602
- * @since 0.6.0
2603
- * @public
2604
- * @group Tenant Subscriptions
2605
- */
2606
- getActive(): Promise<GetActiveSubscriptionsResponse>;
2607
- /**
2608
- * Check if the current tenant has billing information configured
2609
- *
2610
- * Verifies whether the tenant has valid payment methods attached to their
2611
- * Stripe customer account. This is useful for:
2612
- * - Showing billing setup prompts
2613
- * - Gating premium features behind payment method requirement
2614
- * - Displaying billing status indicators in UI
2615
- * - Determining if customer portal access should be shown
2616
- *
2617
- * The check verifies:
2618
- * - Default payment source (card, bank account, etc.)
2619
- * - Default payment method in invoice settings
2620
- * - Whether the payment method is valid and active
2621
- *
2622
- * Returns `false` if:
2623
- * - Tenant has no Stripe customer ID
2624
- * - No payment methods are configured
2625
- * - User is not authenticated
2626
- *
2627
- * @returns Promise resolving to billing status information
2628
- *
2629
- * @throws {Error} When the user is not authenticated
2630
- * @throws {Error} When the API request fails due to network issues
2631
- * @throws {Error} When the server returns an error response (4xx, 5xx)
2632
- *
2633
- * @example
2634
- * ```typescript
2635
- * const response = await subscriptionManager.getBillingStatus();
2636
- *
2637
- * if (!response.data.has_billing_info) {
2638
- * // Show billing setup prompt
2639
- * showBillingSetupModal();
2640
- * } else if (!response.data.is_active) {
2641
- * // Payment method exists but may be expired/invalid
2642
- * showPaymentMethodUpdatePrompt();
2643
- * } else {
2644
- * // All good - show customer portal link
2645
- * showManageBillingButton();
2646
- * }
2647
- * ```
2648
- *
2649
- * @since 0.6.0
2650
- * @public
2651
- * @group Tenant Subscriptions
2652
- */
2653
- getBillingStatus(): Promise<GetBillingStatusResponse>;
2654
- }
2655
-
2656
- /**
2657
- * Response structure for a tenant user
2658
- *
2659
- * Represents a user's information within a tenant, including their
2660
- * identification details and assigned role.
2661
- *
2662
- * @example
2663
- * ```typescript
2664
- * const user: TenantUser = {
2665
- * user_id: 'user_abc123',
2666
- * first_name: 'John',
2667
- * last_name: 'Doe',
2668
- * email: 'john@example.com',
2669
- * role: 'admin'
2670
- * };
2671
- * ```
2672
- *
2673
- * @since 1.0.0
2674
- * @public
2675
- * @group Tenant User Management
2676
- */
2677
- type TenantUser = {
2678
- /** Unique identifier for the user */
2679
- user_id: string;
2680
- /** User's first name */
2681
- first_name: string;
2682
- /** User's last name */
2683
- last_name: string;
2684
- /** User's email address */
2685
- email: string;
2686
- /** User's role within the tenant */
2687
- role: string;
2688
- };
2689
- /**
2690
- * Response from fetching all users in a tenant
2691
- *
2692
- * This type represents the API response structure returned when fetching
2693
- * the list of all users in the active tenant.
2694
- *
2695
- * @since 1.0.0
2696
- * @public
2697
- * @group Tenant User Management
2698
- */
2699
- type GetAllUsersResponse = ApiResponse<TenantUser[]>;
2700
- /**
2701
- * Request parameters for updating a user's role within a tenant
2702
- *
2703
- * This interface defines the data required to change a user's role in the active tenant.
2704
- * The operation requires appropriate permissions (typically admin or owner role) and will
2705
- * fail if the requesting user doesn't have sufficient privileges.
2706
- *
2707
- * @example
2708
- * ```typescript
2709
- * const request: UpdateTenantUserRoleRequest = {
2710
- * user_id: 'user_abc123',
2711
- * role: 'admin'
2712
- * };
2713
- * ```
2714
- *
2715
- * @since 0.6.0
2716
- * @public
2717
- * @group Tenant User Management
2718
- */
2719
- type UpdateTenantUserRoleRequest = {
2720
- /** New role to assign to the user (e.g., 'admin', 'member', 'viewer') */
2721
- role: string;
2722
- /** ID of the user whose role is being updated */
2723
- user_id: string;
2724
- };
2725
- /**
2726
- * Response from updating a user's role within a tenant
2727
- *
2728
- * This type represents the API response structure returned after successfully
2729
- * updating a user's role in the tenant.
2730
- *
2731
- * @since 1.0.0
2732
- * @public
2733
- * @group Tenant User Management
2734
- */
2735
- type UpdateTenantUserRoleResponse = ApiResponse<{
2736
- /** Confirmation message describing the role update */
2737
- message: string;
2738
- }>;
2739
- /**
2740
- * Request parameters for removing a user from a tenant
2741
- *
2742
- * This interface defines the data required to remove a user from the active tenant.
2743
- * The operation requires appropriate permissions and will fail if the user doesn't
2744
- * have the necessary rights to remove users from the tenant.
2745
- *
2746
- * @example
2747
- * ```typescript
2748
- * const request: RemoveUserRequest = {
2749
- * user_id: 'user_abc123'
2750
- * };
2751
- * ```
2752
- *
2753
- * @since 0.6.0
2754
- * @public
2755
- * @group Tenant User Management
2756
- */
2757
- type RemoveUserRequest = {
2758
- /** ID of the user being removed from the tenant */
2759
- user_id: string;
2760
- };
2761
- /**
2762
- * Manager for tenant user operations
2763
- *
2764
- * This class provides methods for managing users within a tenant, including
2765
- * removing users from the active tenant. All operations are performed within
2766
- * the context of the authenticated user and respect tenant-level permissions.
2767
- *
2768
- * User removal operations require appropriate permissions (typically admin or owner
2769
- * role) and will fail if the requesting user doesn't have sufficient privileges.
2770
- *
2771
- * @example
2772
- * ```typescript
2773
- * import { OmnibaseClient } from '@omnibase/core-js';
2774
- *
2775
- * const client = new OmnibaseClient({ apiKey: 'your-api-key' });
2776
- * const userManager = client.tenants.user;
2777
- *
2778
- * // Remove a user from the active tenant
2779
- * await userManager.remove({ user_id: 'user_123' });
2780
- * ```
2781
- *
2782
- * @since 0.6.0
2783
- * @public
2784
- * @group Tenant User Management
2785
- */
2786
- declare class TenantUserManager {
2787
- private omnibaseClient;
2788
- /**
2789
- * Creates a new tenant user manager
2790
- *
2791
- * @param omnibaseClient - Configured OmnibaseClient instance for API communication
2792
- *
2793
- * @group Tenant User Management
2794
- */
2795
- constructor(omnibaseClient: OmnibaseClient);
2796
- /**
2797
- * Retrieves all users in the active tenant
2798
- *
2799
- * This method fetches a list of all users who are members of the current active tenant,
2800
- * including their basic information (name, email) and assigned role. The operation
2801
- * requires the requesting user to have appropriate permissions to view tenant users
2802
- * (typically requires `view_users` permission).
2803
- *
2804
- * The returned list includes all tenant members regardless of their role, ordered by
2805
- * when they joined the tenant (newest first).
2806
- *
2807
- * @returns Promise resolving to an array of tenant users with their details
2808
- *
2809
- * @throws {Error} When the API request fails (includes status code and error details)
2810
- * @throws {Error} When the user doesn't have permission to view users
2811
- * @throws {Error} When the user is not authenticated or no active tenant is set
2812
- *
2813
- * @example
2814
- * ```typescript
2815
- * // Fetch all users in the active tenant
2816
- * try {
2817
- * const result = await userManager.getAll();
2818
- * console.log(`Found ${result.data.length} users`);
2819
- *
2820
- * result.data.forEach(user => {
2821
- * console.log(`${user.first_name} ${user.last_name} (${user.email}) - ${user.role}`);
2822
- * });
2823
- * } catch (error) {
2824
- * if (error.message.includes('403')) {
2825
- * console.error('Insufficient permissions to view users');
2826
- * } else {
2827
- * console.error('Failed to fetch users:', error);
2828
- * }
2829
- * }
2830
- * ```
2831
- *
2832
- * @since 1.0.0
2833
- * @public
2834
- * @group Tenant User Management
2835
- */
2836
- getAll(): Promise<GetAllUsersResponse>;
2837
- /**
2838
- * Removes a user from the active tenant
2839
- *
2840
- * This method removes a specified user from the current active tenant. The operation
2841
- * requires the requesting user to have appropriate permissions (admin or owner role).
2842
- * The user being removed will lose access to the tenant and all its resources.
2843
- *
2844
- * Note: You cannot remove yourself from a tenant using this method. To leave a tenant,
2845
- * use the appropriate leave or delete tenant operations instead.
2846
- *
2847
- * @param data - Request data containing the user ID to remove
2848
- * @param data.user_id - ID of the user to remove from the tenant
2849
- *
2850
- * @returns Promise resolving to an API response confirming the removal
2851
- *
2852
- * @throws {Error} When user_id is not provided
2853
- * @throws {Error} When the API request fails (includes status code and error details)
2854
- * @throws {Error} When the user doesn't have permission to remove users
2855
- * @throws {Error} When the specified user is not a member of the tenant
2856
- *
2857
- * @example
2858
- * ```typescript
2859
- * // Remove a user from the active tenant
2860
- * try {
2861
- * await userManager.remove({ user_id: 'user_abc123' });
2862
- * console.log('User removed successfully');
2863
- * } catch (error) {
2864
- * if (error.message.includes('403')) {
2865
- * console.error('Insufficient permissions to remove user');
2866
- * } else if (error.message.includes('404')) {
2867
- * console.error('User not found in tenant');
2868
- * } else {
2869
- * console.error('Failed to remove user:', error);
2870
- * }
2871
- * }
2872
- * ```
2873
- *
2874
- * @since 0.6.0
2875
- * @public
2876
- * @group Tenant User Management
2877
- */
2878
- remove(data: RemoveUserRequest): Promise<ApiResponse<"">>;
2879
- /**
2880
- * Updates a user's role within the active tenant
2881
- *
2882
- * This method changes the role of a specified user in the current active tenant. The operation
2883
- * requires the requesting user to have appropriate permissions (typically admin or owner role).
2884
- * Role updates take effect immediately and affect the user's permissions and access rights
2885
- * within the tenant.
2886
- *
2887
- * Common roles include 'admin', 'member', and 'viewer', but the exact roles available depend
2888
- * on your tenant's configuration. Changing a user's role will modify their ability to perform
2889
- * various operations within the tenant.
2890
- *
2891
- * @param data - Request data containing the user ID and new role
2892
- * @param data.user_id - ID of the user whose role is being updated
2893
- * @param data.role - New role to assign to the user
2894
- *
2895
- * @returns Promise resolving to an API response confirming the role update
2896
- *
2897
- * @throws {Error} When user_id or role is not provided
2898
- * @throws {Error} When the API request fails (includes status code and error details)
2899
- * @throws {Error} When the user doesn't have permission to update roles
2900
- * @throws {Error} When the specified user is not a member of the tenant
2901
- * @throws {Error} When the specified role is invalid or not allowed
2902
- *
2903
- * @example
2904
- * ```typescript
2905
- * // Update a user's role to admin
2906
- * try {
2907
- * const result = await userManager.updateRole({
2908
- * user_id: 'user_abc123',
2909
- * role: 'admin'
2910
- * });
2911
- * console.log('Role updated successfully:', result.data.message);
2912
- * } catch (error) {
2913
- * if (error.message.includes('403')) {
2914
- * console.error('Insufficient permissions to update roles');
2915
- * } else if (error.message.includes('404')) {
2916
- * console.error('User not found in tenant');
2917
- * } else {
2918
- * console.error('Failed to update role:', error);
2919
- * }
2920
- * }
2921
- * ```
2922
- *
2923
- * @since 0.6.0
2924
- * @public
2925
- * @group Tenant User Management
2926
- */
2927
- updateRole(data: UpdateTenantUserRoleRequest): Promise<UpdateTenantUserRoleResponse>;
2928
- }
2929
-
2930
- /**
2931
- * Main tenant management handler
2932
- *
2933
- * This is the primary entry point for all tenant-related operations in the
2934
- * Omnibase SDK. It provides a unified interface to tenant management,
2935
- * user management, and invitation functionality through dedicated manager instances.
2936
- *
2937
- * The handler follows the composition pattern, combining specialized managers
2938
- * for different aspects of tenant functionality:
2939
- * - `manage`: Core tenant operations (create, delete, switch)
2940
- * - `invites`: User invitation management (create, accept)
2941
- * - `user`: Tenant user operations (remove, update role)
2942
- *
2943
- * All operations are performed within the context of the authenticated user
2944
- * and respect tenant-level permissions and row-level security policies.
2945
- *
2946
- * @example
2947
- * ```typescript
2948
- * import { OmnibaseClient } from '@omnibase/core-js';
2949
- * import { TenantHandler } from '@omnibase/core-js/tenants';
2950
- *
2951
- * const client = new OmnibaseClient({ apiKey: 'your-api-key' });
2952
- * const tenantHandler = new TenantHandler(client);
2953
- *
2954
- * // Create a new tenant
2955
- * const tenant = await tenantHandler.manage.createTenant({
2956
- * name: 'My Company',
2957
- * billing_email: 'billing@company.com',
2958
- * user_id: 'user_123'
2959
- * });
2960
- *
2961
- * // Invite users to the tenant
2962
- * const invite = await tenantHandler.invites.create({
2963
- * email: 'colleague@company.com',
2964
- * role: 'member',
2965
- * invite_url: 'https://yourapp.com/accept-invite'
2966
- * });
2967
- *
2968
- * // Switch to the new tenant
2969
- * await tenantHandler.manage.switchActiveTenant(tenant.data.tenant.id);
2970
- * ```
2971
- *
2972
- * @since 0.6.0
2973
- * @public
2974
- * @group Tenant Management
2975
- */
2976
- declare class TenantHandler {
2977
- /**
2978
- * Creates a new TenantHandler instance
2979
- *
2980
- * Initializes the handler with the provided Omnibase client and sets up
2981
- * the specialized manager instances for tenant and invitation operations.
2982
- * The client is used for all underlying HTTP requests and authentication.
2983
- *
2984
- * @param omnibaseClient - Configured Omnibase client instance
2985
- *
2986
- * @example
2987
- * ```typescript
2988
- * const client = new OmnibaseClient({
2989
- * apiKey: 'your-api-key',
2990
- * baseURL: 'https://api.yourapp.com'
2991
- * });
2992
- * const tenantHandler = new TenantHandler(client);
2993
- * ```
2994
- *
2995
- * @group Tenant Management
2996
- */
2997
- constructor(omnibaseClient: OmnibaseClient);
2998
- /**
2999
- * Tenant user management operations
3000
- *
3001
- * Provides access to operations for managing users within tenants, including
3002
- * removing users from the active tenant. All operations respect user permissions
3003
- * and tenant ownership rules.
3004
- *
3005
- * @example
3006
- * ```typescript
3007
- * // Remove a user from the active tenant
3008
- * await tenantHandler.user.remove({ user_id: 'user_123' });
3009
- * ```
3010
- *
3011
- * @since 0.6.0
3012
- * @group Tenant Management
3013
- */
3014
- readonly user: TenantUserManager;
3015
- /**
3016
- * Core tenant management operations
3017
- *
3018
- * Provides access to tenant lifecycle operations including creation,
3019
- * deletion, and active tenant switching. All operations respect user
3020
- * permissions and tenant ownership rules.
3021
- *
3022
- * @example
3023
- * ```typescript
3024
- * // Create a new tenant
3025
- * const tenant = await tenantHandler.manage.createTenant({
3026
- * name: 'New Company',
3027
- * billing_email: 'billing@newcompany.com',
3028
- * user_id: 'user_456'
3029
- * });
3030
- *
3031
- * // Switch to the tenant
3032
- * await tenantHandler.manage.switchActiveTenant(tenant.data.tenant.id);
3033
- *
3034
- * // Delete the tenant (owner only)
3035
- * await tenantHandler.manage.deleteTenant(tenant.data.tenant.id);
3036
- * ```
3037
- */
3038
- readonly manage: TenantManger;
3039
- /**
3040
- * Tenant invitation management operations
3041
- *
3042
- * Provides access to user invitation functionality including creating
3043
- * invitations for new users and accepting existing invitations.
3044
- * Supports role-based access control and secure token-based workflows.
3045
- *
3046
- * @example
3047
- * ```typescript
3048
- * // Create an invitation
3049
- * const invite = await tenantHandler.invites.create({
3050
- * email: 'newuser@company.com',
3051
- * role: 'admin',
3052
- * invite_url: 'https://yourapp.com/accept-invite'
3053
- * });
3054
- *
3055
- * // Accept an invitation (from the invited user's session)
3056
- * const result = await tenantHandler.invites.accept('invite_token_xyz');
3057
- * ```
3058
- */
3059
- readonly invites: TenantInviteManager;
3060
- /**
3061
- * Tenant subscription and billing management
3062
- *
3063
- * Provides access to subscription data and billing status for the
3064
- * active tenant, including legacy price detection and payment method
3065
- * verification. All operations are automatically scoped to the user's
3066
- * currently active tenant.
3067
- *
3068
- * @example
3069
- * ```typescript
3070
- * // Get active subscriptions
3071
- * const subs = await tenantHandler.subscriptions.getActive();
3072
- *
3073
- * // Check billing status
3074
- * const status = await tenantHandler.subscriptions.getBillingStatus();
3075
- * if (!status.data.has_billing_info) {
3076
- * console.log('No payment method configured');
3077
- * }
3078
- * ```
3079
- *
3080
- * @since 0.6.0
3081
- * @group Tenant Management
3082
- */
3083
- readonly subscriptions: TenantSubscriptionManager;
3084
- }
3085
-
3086
- type OmnibaseClientConfig = {
3087
- api_url: string;
3088
- fetch?: (endpoint: string, options: RequestInit) => Promise<Response>;
3089
- };
3090
- declare class OmnibaseClient {
3091
- private config;
3092
- constructor(config: OmnibaseClientConfig);
3093
- /**
3094
- * Main payment handler for all payment-related operations
3095
- *
3096
- * This class serves as the central coordinator for all payment functionality,
3097
- * providing access to checkout sessions, billing configuration, customer portals,
3098
- * and usage tracking. It handles the low-level HTTP communication with the
3099
- * payment API and delegates specific operations to specialized managers.
3100
- *
3101
- * The handler automatically manages authentication, request formatting, and
3102
- * provides a consistent interface across all payment operations.
3103
- *
3104
- * @example
3105
- * ```typescript
3106
- * // Create a checkout session (mode auto-detected from price)
3107
- * const checkout = await omnibase.payments.checkout.createSession({
3108
- * price_id: 'price_123',
3109
- * success_url: 'https://app.com/success',
3110
- * cancel_url: 'https://app.com/cancel'
3111
- * });
3112
- *
3113
- * // Get available products
3114
- * const products = await omnibase.payments.config.getAvailableProducts();
3115
- * ```
3116
- */
3117
- readonly payments: PaymentHandler;
3118
- /**
3119
- * Main tenant management handler
3120
- *
3121
- * This is the primary entry point for all tenant-related operations in the
3122
- * Omnibase SDK. It provides a unified interface to tenant management,
3123
- * user management, and invitation functionality through dedicated manager instances.
3124
- *
3125
- * The handler follows the composition pattern, combining specialized managers
3126
- * for different aspects of tenant functionality:
3127
- * - `manage`: Core tenant operations (create, delete, switch)
3128
- * - `invites`: User invitation management (create, accept)
3129
- * - `user`: Tenant user operations (remove, update role)
3130
- *
3131
- * All operations are performed within the context of the authenticated user
3132
- * and respect tenant-level permissions and row-level security policies.
3133
- *
3134
- * @example
3135
- * ```typescript
3136
- * // Create a new tenant
3137
- * const tenant = await omnibase.tenants.manage.createTenant({
3138
- * name: 'My Company',
3139
- * billing_email: 'billing@company.com',
3140
- * user_id: 'user_123'
3141
- * });
3142
- *
3143
- * // Invite users to the tenant
3144
- * const invite = await omnibase.tenants.invites.create({
3145
- * email: 'colleague@company.com',
3146
- * role: 'member',
3147
- * invite_url: 'https://yourapp.com/accept-invite'
3148
- * });
3149
- *
3150
- * // Switch to the new tenant
3151
- * await omnibase.tenants.manage.switchActiveTenant(tenant.data.tenant.id);
3152
- * ```
3153
- *
3154
- * @since 0.6.0
3155
- * @public
3156
- * @group Tenant Management
3157
- */
3158
- readonly tenants: TenantHandler;
3159
- /**
3160
- * Client for managing permissions and relationships using Ory Keto
3161
- *
3162
- * This client provides access to Ory Keto's permission system, allowing you to
3163
- * create, manage, and check relationships between subjects and objects. It handles
3164
- * both read operations (permission checks) and write operations (relationship management).
3165
- *
3166
- * The client automatically configures separate endpoints for read and write operations
3167
- * to optimize performance and security by following Ory Keto's recommended architecture.
3168
- *
3169
- * @example
3170
- * ```typescript
3171
- * // Check if a user can view a tenant
3172
- * const canView = await omnibase.permissions.permissions.checkPermission(
3173
- * undefined,
3174
- * {
3175
- * namespace: 'Tenant',
3176
- * object: 'tenant_123',
3177
- * relation: 'view',
3178
- * subjectId: 'user_456'
3179
- * }
3180
- * );
3181
- *
3182
- * if (canView.data.allowed) {
3183
- * console.log('User can view the tenant');
3184
- * }
3185
- *
3186
- * // Create a relationship making a user an owner of a tenant
3187
- * await omnibase.permissions.relationships.createRelationship(
3188
- * undefined,
3189
- * {
3190
- * namespace: 'Tenant',
3191
- * object: 'tenant_123',
3192
- * relation: 'owners',
3193
- * subjectId: 'user_456'
3194
- * }
3195
- * );
3196
- * ```
3197
- *
3198
- * @since 0.6.0
3199
- * @public
3200
- * @group Permissions
3201
- */
3202
- readonly permissions: PermissionsClient;
3203
- /**
3204
- * Storage client for file upload/download operations
3205
- *
3206
- * @example
3207
- * ```typescript
3208
- * // Upload with metadata
3209
- * await omnibase.storage.bucket('documents').upload(
3210
- * 'report.pdf',
3211
- * file,
3212
- * { metadata: { department: 'engineering' } }
3213
- * );
3214
- * ```
3215
- */
3216
- storage: StorageClient;
3217
- fetch(endpoint: string, options?: RequestInit): Promise<Response>;
3218
- }
3219
-
3220
- export { type AssignRoleRequest as A, type BillingStatus as B, type CreateRoleRequest as C, CheckoutManager, type CheckoutOptions, ConfigManager, type CreateCheckoutResponse, type CreateCustomerPortalResponse, type DownloadResult as D, type GetActiveSubscriptionsResponse as G, type NamespaceDefinition as N, type OmnibaseClientConfig as O, PermissionsClient as P, PaymentHandler, PortalManager, type PortalOptions, type Price, type PriceDisplay, type PriceLimit, type PriceUI, type Product, type ProductUI, type ProductWithPricingUI, RolesHandler as R, StorageClient as S, type StripeConfigResponse, type StripeConfiguration, TenantHandler as T, type Tier, type UpdateRoleRequest as U, UsageManager, type UsageOptions, type Role as a, type UploadOptions as b, type UploadResult as c, type AcceptTenantInviteRequest as d, type AcceptTenantInviteResponse as e, type CreateTenantUserInviteResponse as f, type TenantInvite as g, type CreateTenantUserInviteRequest as h, TenantInviteManager as i, type SwitchActiveTenantResponse as j, type DeleteTenantResponse as k, type CreateTenantResponse as l, type Tenant as m, type CreateTenantRequest as n, TenantManger as o, type TenantSubscription as p, type GetBillingStatusResponse as q, TenantSubscriptionManager as r, OmnibaseClient as s, type ApiResponse as t };