@omnibase/core-js 0.8.0 → 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 (745) 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-5B37CXXH.js +0 -447
  693. package/dist/chunk-5MDBFHTF.js +0 -555
  694. package/dist/chunk-6OGESVXW.js +0 -651
  695. package/dist/chunk-767PUXYD.js +0 -556
  696. package/dist/chunk-BZSZVT4V.js +0 -152
  697. package/dist/chunk-CUBJFCZH.js +0 -579
  698. package/dist/chunk-DDFBRGMG.js +0 -106
  699. package/dist/chunk-DQBFDKRC.js +0 -641
  700. package/dist/chunk-I6DMWC32.js +0 -129
  701. package/dist/chunk-IVPULXIA.js +0 -150
  702. package/dist/chunk-JNM7XP7L.js +0 -345
  703. package/dist/chunk-KGG7T6KJ.js +0 -546
  704. package/dist/chunk-L7EZC6WP.js +0 -560
  705. package/dist/chunk-LCEBQTB7.js +0 -563
  706. package/dist/chunk-LIS5WD3H.js +0 -560
  707. package/dist/chunk-LMDKQ6Z2.js +0 -706
  708. package/dist/chunk-NBPRDG6O.js +0 -643
  709. package/dist/chunk-PNP3T7XU.js +0 -542
  710. package/dist/chunk-QPW6G4PA.js +0 -490
  711. package/dist/chunk-QXPPBLH4.js +0 -556
  712. package/dist/chunk-TFAV5P6I.js +0 -869
  713. package/dist/chunk-V4FWENQQ.js +0 -378
  714. package/dist/chunk-V56G36FZ.js +0 -558
  715. package/dist/chunk-V6HVRJCU.js +0 -693
  716. package/dist/chunk-ZBRAIBZZ.js +0 -658
  717. package/dist/chunk-ZYLNNK7H.js +0 -555
  718. package/dist/database/index.cjs +0 -227
  719. package/dist/database/index.d.cts +0 -298
  720. package/dist/database/index.d.ts +0 -298
  721. package/dist/database/index.js +0 -199
  722. package/dist/index.cjs +0 -2093
  723. package/dist/index.d.cts +0 -2
  724. package/dist/payments/index.cjs +0 -520
  725. package/dist/payments/index.d.cts +0 -3287
  726. package/dist/payments/index.d.ts +0 -3287
  727. package/dist/payments/index.js +0 -14
  728. package/dist/permissions/index.cjs +0 -474
  729. package/dist/permissions/index.d.cts +0 -2
  730. package/dist/permissions/index.d.ts +0 -2
  731. package/dist/permissions/index.js +0 -8
  732. package/dist/storage/index.cjs +0 -153
  733. package/dist/storage/index.d.cts +0 -2
  734. package/dist/storage/index.d.ts +0 -2
  735. package/dist/storage/index.js +0 -6
  736. package/dist/stripe/index.cjs +0 -153
  737. package/dist/stripe/index.d.cts +0 -162
  738. package/dist/stripe/index.d.ts +0 -162
  739. package/dist/stripe/index.js +0 -124
  740. package/dist/tenants/index.cjs +0 -895
  741. package/dist/tenants/index.d.cts +0 -2
  742. package/dist/tenants/index.d.ts +0 -2
  743. package/dist/tenants/index.js +0 -6
  744. package/dist/types-DgsX5kVK.d.cts +0 -49
  745. package/dist/types-DgsX5kVK.d.ts +0 -49
package/dist/index.cjs DELETED
@@ -1,2093 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- OmnibaseClient: () => OmnibaseClient,
24
- PermissionsClient: () => PermissionsClient,
25
- RolesHandler: () => RolesHandler,
26
- StorageClient: () => StorageClient
27
- });
28
- module.exports = __toCommonJS(index_exports);
29
-
30
- // src/payments/checkout.ts
31
- var CheckoutManager = class {
32
- /**
33
- * Initialize the checkout manager
34
- *
35
- * @param paymentHandler - Payment handler instance for API communication
36
- *
37
- * @group Checkout
38
- */
39
- constructor(omnibaseClient) {
40
- this.omnibaseClient = omnibaseClient;
41
- }
42
- /**
43
- * Create a new Stripe checkout session
44
- *
45
- * Creates a checkout session with the specified options and returns
46
- * the session URL for redirecting the user to complete payment.
47
- * The checkout mode (one-time payment or subscription) is automatically
48
- * determined from the price's configuration - no need to specify it manually.
49
- *
50
- * @param options - Configuration options for the checkout session
51
- * @param options.price_id - Stripe price ID for the product/service
52
- * @param options.success_url - URL to redirect after successful payment
53
- * @param options.cancel_url - URL to redirect if user cancels
54
- *
55
- * @returns Promise resolving to checkout session response with URL and session ID
56
- *
57
- * @throws {Error} When the API request fails due to network issues
58
- * @throws {Error} When the server returns an error response (invalid price_id, etc.)
59
- * @throws {ValidationError} When required parameters are missing or invalid
60
- *
61
- * @example
62
- * ```typescript
63
- * const session = await checkoutManager.createSession({
64
- * price_id: 'price_monthly_pro',
65
- * success_url: 'https://app.com/success',
66
- * cancel_url: 'https://app.com/cancel'
67
- * });
68
- *
69
- * // Redirect to Stripe checkout
70
- * if (session.data?.url) {
71
- * window.location.href = session.data.url;
72
- * }
73
- * ```
74
- *
75
- * @since 0.6.0
76
- * @group Checkout
77
- */
78
- async createSession(options) {
79
- const response = await this.omnibaseClient.fetch(
80
- "/api/v1/payments/checkout",
81
- {
82
- method: "POST",
83
- headers: {
84
- "Content-Type": "application/json"
85
- },
86
- body: JSON.stringify(options)
87
- }
88
- );
89
- if (!response.ok) {
90
- const errorData = await response.text();
91
- throw new Error(
92
- `Failed to create checkout session: ${response.status} - ${errorData}`
93
- );
94
- }
95
- const result = await response.json();
96
- return result;
97
- }
98
- };
99
-
100
- // src/payments/config.ts
101
- var ConfigManager = class {
102
- constructor(omnibaseClient) {
103
- this.omnibaseClient = omnibaseClient;
104
- }
105
- /**
106
- * Get the current Stripe configuration from the database
107
- *
108
- * Retrieves the latest Stripe configuration including products, prices,
109
- * and UI customization data. This configuration represents the current
110
- * active pricing structure with all UI elements for pricing table rendering.
111
- *
112
- * @returns Promise resolving to the current Stripe configuration
113
- *
114
- * @throws {Error} When the API request fails due to network issues
115
- * @throws {Error} When the server returns an error response (4xx, 5xx status codes)
116
- *
117
- * @example
118
- * Basic usage:
119
- * ```typescript
120
- * const config = await getStripeConfig();
121
- * console.log(`Found ${config.data.config.products.length} products`);
122
- *
123
- * // Access product UI configuration
124
- * config.data.config.products.forEach(product => {
125
- * console.log(`${product.name}: ${product.ui?.tagline || 'No tagline'}`);
126
- * });
127
- * ```
128
- */
129
- async getStripeConfig() {
130
- try {
131
- const response = await this.omnibaseClient.fetch(
132
- `/api/v1/stripe/config`,
133
- {
134
- method: "GET",
135
- headers: {
136
- "Content-Type": "application/json"
137
- },
138
- credentials: "include"
139
- }
140
- );
141
- if (!response.ok) {
142
- const errorData = await response.text();
143
- throw new Error(
144
- `Failed to get Stripe config: ${response.status} - ${errorData}`
145
- );
146
- }
147
- const data = await response.json();
148
- return data;
149
- } catch (error) {
150
- console.error("Error getting Stripe config:", error);
151
- throw error;
152
- }
153
- }
154
- /**
155
- * Get available products with UI-ready pricing data
156
- *
157
- * Transforms the raw Stripe configuration into UI-ready format for pricing
158
- * table rendering. Includes formatted pricing, features, limits, and all
159
- * display customizations needed for marketing pages.
160
- *
161
- * @returns Promise resolving to products ready for UI consumption
162
- *
163
- * @throws {Error} When the API request fails or configuration is invalid
164
- *
165
- * @example
166
- * Pricing table rendering:
167
- * ```typescript
168
- * const products = await getAvailableProducts();
169
- *
170
- * products.forEach(product => {
171
- * const display = product.pricing_display;
172
- * console.log(`${display.name} - ${display.tagline}`);
173
- *
174
- * display.prices.forEach(price => {
175
- * console.log(` ${price.display_name}: ${price.formatted_price}`);
176
- * });
177
- * });
178
- * ```
179
- */
180
- async getAvailableProducts() {
181
- const configResponse = await this.getStripeConfig();
182
- if (!configResponse.data?.config) {
183
- throw new Error("No Stripe configuration found");
184
- }
185
- const products = configResponse.data.config.products;
186
- return products.map(transformProductToUIReady).sort(
187
- (a, b) => a.pricing_display.sort_order - b.pricing_display.sort_order
188
- );
189
- }
190
- /**
191
- * Get a specific product by ID
192
- *
193
- * Retrieves a single product configuration by its ID from the current
194
- * Stripe configuration. Useful for product-specific operations.
195
- *
196
- * @param productId - The configuration product ID to retrieve
197
- * @returns Promise resolving to the product or null if not found
198
- *
199
- * @example
200
- * ```typescript
201
- * const product = await getProduct('starter_plan');
202
- * if (product) {
203
- * console.log(`Found product: ${product.name}`);
204
- * }
205
- * ```
206
- */
207
- async getProduct(productId) {
208
- const configResponse = await this.getStripeConfig();
209
- if (!configResponse.data?.config) {
210
- return null;
211
- }
212
- const product = configResponse.data.config.products.find(
213
- (p) => p.id === productId
214
- );
215
- return product || null;
216
- }
217
- };
218
- function transformProductToUIReady(product) {
219
- const ui = product.ui || {};
220
- return {
221
- ...product,
222
- pricing_display: {
223
- name: ui.display_name || product.name,
224
- tagline: ui.tagline,
225
- features: ui.features || [],
226
- badge: ui.badge,
227
- cta_text: ui.cta_text || "Choose Plan",
228
- highlighted: ui.highlighted || false,
229
- sort_order: ui.sort_order || 0,
230
- prices: product.prices.map((price) => {
231
- const priceUI = price.ui || {};
232
- return {
233
- id: price.id,
234
- display_name: priceUI.display_name || formatDefaultPriceName(price),
235
- formatted_price: formatPrice(price, priceUI),
236
- billing_period: priceUI.billing_period || formatDefaultBillingPeriod(price),
237
- features: priceUI.features || [],
238
- limits: priceUI.limits || []
239
- };
240
- })
241
- }
242
- };
243
- }
244
- function formatPrice(price, priceUI) {
245
- if (priceUI.price_display?.custom_text) {
246
- return priceUI.price_display.custom_text;
247
- }
248
- if (!price.amount || price.amount === 0) {
249
- return "Free";
250
- }
251
- const amount = price.amount / 100;
252
- const currency = price.currency.toUpperCase();
253
- let formattedPrice = "";
254
- if (priceUI.price_display?.show_currency !== false) {
255
- const currencySymbol = getCurrencySymbol(currency);
256
- formattedPrice = `${currencySymbol}${amount.toFixed(2)}`;
257
- } else {
258
- formattedPrice = amount.toFixed(2);
259
- }
260
- if (priceUI.price_display?.suffix) {
261
- formattedPrice += ` ${priceUI.price_display.suffix}`;
262
- }
263
- return formattedPrice;
264
- }
265
- function getCurrencySymbol(currency) {
266
- const symbols = {
267
- USD: "$",
268
- EUR: "\u20AC",
269
- GBP: "\xA3",
270
- JPY: "\xA5",
271
- CAD: "C$",
272
- AUD: "A$"
273
- };
274
- return symbols[currency] || currency;
275
- }
276
- function formatDefaultPriceName(price) {
277
- if (price.interval) {
278
- return price.interval.charAt(0).toUpperCase() + price.interval.slice(1);
279
- }
280
- return "One-time";
281
- }
282
- function formatDefaultBillingPeriod(price) {
283
- if (price.interval) {
284
- const count = price.interval_count || 1;
285
- const period = count === 1 ? price.interval : `${count} ${price.interval}s`;
286
- return `per ${period}`;
287
- }
288
- return "one-time";
289
- }
290
-
291
- // src/payments/portal.ts
292
- var PortalManager = class {
293
- /**
294
- * Initialize the portal manager
295
- *
296
- * @param omnibaseClient - OmnibaseClient instance for API communication
297
- *
298
- * @group Portal
299
- */
300
- constructor(omnibaseClient) {
301
- this.omnibaseClient = omnibaseClient;
302
- }
303
- /**
304
- * Create a new customer portal session
305
- *
306
- * Creates a portal session that allows the specified customer to
307
- * manage their billing information, subscriptions, and payment methods.
308
- * Returns a URL that the customer should be redirected to.
309
- *
310
- * The portal session is temporary and expires after a short period
311
- * for security. Each access requires creating a new session.
312
- *
313
- * @param options - Configuration options for the portal session
314
- * @param options.return_url - URL to redirect to when exiting the portal
315
- *
316
- * @returns Promise resolving to portal session response with access URL
317
- *
318
- * @throws {Error} When the API request fails due to network issues
319
- * @throws {Error} When the server returns an error response
320
- * @throws {ValidationError} When required parameters are missing or invalid
321
- *
322
- * @example
323
- * ```typescript
324
- * const portal = await portalManager.create({
325
- * return_url: 'https://myapp.com/account/billing'
326
- * });
327
- *
328
- * // Redirect user to portal
329
- * if (portal.data?.url) {
330
- * window.location.href = portal.data.url;
331
- * }
332
- * ```
333
- *
334
- * @since 0.6.0
335
- * @group Portal
336
- */
337
- async create(options) {
338
- const response = await this.omnibaseClient.fetch(
339
- "/api/v1/payments/portal",
340
- {
341
- method: "POST",
342
- headers: {
343
- "Content-Type": "application/json"
344
- },
345
- body: JSON.stringify(options)
346
- }
347
- );
348
- if (!response.ok) {
349
- const errorData = await response.text();
350
- throw new Error(
351
- `Failed to create customer portal: ${response.status} - ${errorData}`
352
- );
353
- }
354
- const result = await response.json();
355
- return result;
356
- }
357
- };
358
-
359
- // src/payments/usage.ts
360
- var UsageManager = class {
361
- /**
362
- * Initialize the usage manager
363
- *
364
- * @param omnibaseClient - OmnibaseClient instance for API communication
365
- *
366
- * @group Usage
367
- */
368
- constructor(omnibaseClient) {
369
- this.omnibaseClient = omnibaseClient;
370
- }
371
- /**
372
- * Record a usage event for metered billing
373
- *
374
- * Records a usage event against a specific meter for billing calculation.
375
- * The event will be aggregated with other usage events for the billing period
376
- * to determine the customer's charges for metered products.
377
- *
378
- * Usage events should be recorded in real-time or as close to real-time as
379
- * possible to ensure accurate billing and provide up-to-date usage visibility
380
- * to customers.
381
- *
382
- * @param options - Usage recording options
383
- * @param options.meter_event_name - Name of the meter to record against
384
- * @param options.value - Usage quantity as string
385
- *
386
- * @returns Promise resolving to API response confirmation
387
- *
388
- * @throws {Error} When the API request fails due to network issues
389
- * @throws {Error} When the server returns an error response (invalid meter name, customer, etc.)
390
- * @throws {ValidationError} When required parameters are missing or invalid
391
- *
392
- * @example
393
- * ```typescript
394
- * // Record each API call
395
- * await usageManager.recordUsage({
396
- * meter_event_name: 'api_requests',
397
- * value: '1'
398
- * });
399
- * ```
400
- *
401
- * @since 0.6.0
402
- * @group Usage
403
- */
404
- async recordUsage(options) {
405
- const response = await this.omnibaseClient.fetch("/api/v1/payments/usage", {
406
- method: "POST",
407
- headers: {
408
- "Content-Type": "application/json"
409
- },
410
- body: JSON.stringify(options)
411
- });
412
- if (!response.ok) {
413
- const errorData = await response.text();
414
- throw new Error(
415
- `Failed to record usage: ${response.status} - ${errorData}`
416
- );
417
- }
418
- const result = await response.json();
419
- return result;
420
- }
421
- };
422
-
423
- // src/payments/handler.ts
424
- var PaymentHandler = class {
425
- /**
426
- * Initialize the payment handler with OmnibaseClient
427
- *
428
- * Creates a new payment handler instance with access to all payment
429
- * operations including checkout, configuration, portal, and usage tracking.
430
- * The handler uses the provided OmnibaseClient for API communication.
431
- *
432
- * @param omnibaseClient - OmnibaseClient instance for API communication
433
- *
434
- * @example
435
- * ```typescript
436
- * const paymentHandler = new PaymentHandler(omnibaseClient);
437
- * ```
438
- *
439
- * @since 0.6.0
440
- * @group Client
441
- */
442
- constructor(omnibaseClient) {
443
- this.omnibaseClient = omnibaseClient;
444
- this.checkout = new CheckoutManager(this.omnibaseClient);
445
- this.config = new ConfigManager(this.omnibaseClient);
446
- this.portal = new PortalManager(this.omnibaseClient);
447
- this.usage = new UsageManager(this.omnibaseClient);
448
- }
449
- /**
450
- * Checkout session management
451
- *
452
- * Provides functionality for creating and managing Stripe checkout sessions
453
- * for both one-time payments and subscription billing.
454
- *
455
- * @example
456
- * ```typescript
457
- * const session = await paymentHandler.checkout.createSession({
458
- * price_id: 'price_monthly_pro',
459
- * success_url: window.location.origin + '/success',
460
- * cancel_url: window.location.origin + '/pricing'
461
- * });
462
- *
463
- * if (session.data?.url) {
464
- * window.location.href = session.data.url;
465
- * }
466
- * ```
467
- */
468
- checkout;
469
- /**
470
- * Stripe configuration management
471
- *
472
- * Handles retrieval and processing of database-backed Stripe configurations,
473
- * providing UI-ready product and pricing data for rendering pricing tables.
474
- *
475
- * @example
476
- * ```typescript
477
- * const products = await paymentHandler.config.getAvailableProducts();
478
- * const config = await paymentHandler.config.getStripeConfig();
479
- * ```
480
- */
481
- config;
482
- /**
483
- * Customer portal management
484
- *
485
- * Creates customer portal sessions for subscription management,
486
- * billing history, and payment method updates.
487
- *
488
- * @example
489
- * ```typescript
490
- * const portal = await paymentHandler.portal.create({
491
- * return_url: 'https://app.com/billing'
492
- * });
493
- * ```
494
- */
495
- portal;
496
- /**
497
- * Usage tracking and metered billing
498
- *
499
- * Records usage events for metered billing products and manages
500
- * usage-based pricing calculations.
501
- *
502
- * @example
503
- * ```typescript
504
- * await paymentHandler.usage.recordUsage({
505
- * meter_event_name: 'api_calls',
506
- * value: '1'
507
- * });
508
- * ```
509
- */
510
- usage;
511
- };
512
-
513
- // src/permissions/handler.ts
514
- var import_client = require("@ory/client");
515
-
516
- // src/permissions/roles.ts
517
- var RolesHandler = class {
518
- constructor(client) {
519
- this.client = client;
520
- }
521
- /**
522
- * Get available namespace definitions for UI
523
- *
524
- * Returns all namespaces and their available relations/permissions.
525
- * Useful for building role configuration UIs.
526
- *
527
- * @returns List of namespace definitions
528
- *
529
- * @example
530
- * ```typescript
531
- * const definitions = await omnibase.permissions.roles.getDefinitions();
532
- *
533
- * // Output: [{ namespace: 'Tenant', relations: ['invite_user', 'delete_tenant', ...] }]
534
- * definitions.forEach(def => {
535
- * console.log(`${def.namespace} supports: ${def.relations.join(', ')}`);
536
- * });
537
- * ```
538
- */
539
- async getDefinitions() {
540
- const response = await this.client.fetch(
541
- "/api/v1/permissions/definitions",
542
- {
543
- method: "GET"
544
- }
545
- );
546
- const data = await response.json();
547
- if (!response.ok || data.error) {
548
- throw new Error(data.error || "Failed to fetch definitions");
549
- }
550
- return data.data.definitions;
551
- }
552
- /**
553
- * List all roles for the current tenant
554
- *
555
- * Returns both system roles (defined in roles.config.json) and
556
- * custom roles created via the API. System roles have `tenant_id = null`.
557
- *
558
- * @returns List of roles
559
- *
560
- * @example
561
- * ```typescript
562
- * const roles = await omnibase.permissions.roles.list();
563
- *
564
- * const systemRoles = roles.filter(r => r.tenant_id === null);
565
- * const customRoles = roles.filter(r => r.tenant_id !== null);
566
- *
567
- * console.log(`System roles: ${systemRoles.map(r => r.role_name).join(', ')}`);
568
- * console.log(`Custom roles: ${customRoles.map(r => r.role_name).join(', ')}`);
569
- * ```
570
- */
571
- async list() {
572
- const response = await this.client.fetch("/api/v1/permissions/roles", {
573
- method: "GET"
574
- });
575
- const data = await response.json();
576
- if (!response.ok || data.error) {
577
- throw new Error(data.error || "Failed to list roles");
578
- }
579
- return data.data.roles;
580
- }
581
- /**
582
- * Create a new custom role
583
- *
584
- * Creates a tenant-specific role with the specified permissions.
585
- * Permissions use the format `namespace#relation` or `namespace:id#relation`.
586
- *
587
- * @param request - Role creation request
588
- * @returns Created role
589
- *
590
- * @example
591
- * ```typescript
592
- * const role = await omnibase.permissions.roles.create({
593
- * role_name: 'billing_manager',
594
- * permissions: [
595
- * 'tenant#manage_billing',
596
- * 'tenant#view_invoices',
597
- * 'tenant#update_payment_methods'
598
- * ]
599
- * });
600
- *
601
- * console.log(`Created role: ${role.id}`);
602
- * ```
603
- *
604
- * @example
605
- * Resource-specific permissions:
606
- * ```typescript
607
- * const devRole = await omnibase.permissions.roles.create({
608
- * role_name: 'project_developer',
609
- * permissions: [
610
- * 'project:proj_abc123#deploy',
611
- * 'project:proj_abc123#view_logs',
612
- * 'tenant#invite_user'
613
- * ]
614
- * });
615
- * ```
616
- */
617
- async create(request) {
618
- const response = await this.client.fetch("/api/v1/permissions/roles", {
619
- method: "POST",
620
- headers: { "Content-Type": "application/json" },
621
- body: JSON.stringify(request)
622
- });
623
- const data = await response.json();
624
- if (!response.ok || data.error) {
625
- throw new Error(data.error || "Failed to create role");
626
- }
627
- return data.data;
628
- }
629
- /**
630
- * Update an existing role's permissions
631
- *
632
- * Updates the permissions for a role and automatically updates all
633
- * Keto relationships for users assigned to this role. Old permissions
634
- * are removed and new ones are created.
635
- *
636
- * @param roleId - ID of role to update
637
- * @param request - Update request with new permissions
638
- * @returns Updated role
639
- *
640
- * @example
641
- * ```typescript
642
- * const updatedRole = await omnibase.permissions.roles.update('role_123', {
643
- * permissions: [
644
- * 'tenant#manage_billing',
645
- * 'tenant#view_invoices',
646
- * 'tenant#manage_users' // Added new permission
647
- * ]
648
- * });
649
- *
650
- * console.log(`Updated role with ${updatedRole.permissions.length} permissions`);
651
- * ```
652
- */
653
- async update(roleId, request) {
654
- const response = await this.client.fetch(
655
- `/api/v1/permissions/roles/${roleId}`,
656
- {
657
- method: "PUT",
658
- headers: { "Content-Type": "application/json" },
659
- body: JSON.stringify(request)
660
- }
661
- );
662
- const data = await response.json();
663
- if (!response.ok || data.error) {
664
- throw new Error(data.error || "Failed to update role");
665
- }
666
- return data.data;
667
- }
668
- /**
669
- * Delete a role
670
- *
671
- * Deletes the role and automatically removes all Keto relationships
672
- * for users assigned to this role. Cannot delete system roles.
673
- *
674
- * @param roleId - ID of role to delete
675
- *
676
- * @example
677
- * ```typescript
678
- * await omnibase.permissions.roles.delete('role_123');
679
- * console.log('Role deleted successfully');
680
- * ```
681
- */
682
- async delete(roleId) {
683
- const response = await this.client.fetch(
684
- `/api/v1/permissions/roles/${roleId}`,
685
- {
686
- method: "DELETE"
687
- }
688
- );
689
- const data = await response.json();
690
- if (!response.ok || data.error) {
691
- throw new Error(data.error || "Failed to delete role");
692
- }
693
- }
694
- /**
695
- * Assign a role to a user
696
- *
697
- * Assigns a role to a user and automatically creates all necessary
698
- * Keto relationship tuples based on the role's permissions. The user
699
- * immediately gains all permissions defined in the role.
700
- *
701
- * Supports assignment by either role ID or role name for flexibility.
702
- *
703
- * @param userId - ID of user to assign role to
704
- * @param request - Assignment request with either role_id or role_name
705
- *
706
- * @example
707
- * Assign by role ID:
708
- * ```typescript
709
- * await omnibase.permissions.roles.assign('user_123', {
710
- * role_id: 'role_456'
711
- * });
712
- * ```
713
- *
714
- * @example
715
- * Assign by role name (system or custom role):
716
- * ```typescript
717
- * // Assign system role
718
- * await omnibase.permissions.roles.assign('user_123', {
719
- * role_name: 'owner'
720
- * });
721
- *
722
- * // Assign custom role
723
- * await omnibase.permissions.roles.assign('user_456', {
724
- * role_name: 'billing_manager'
725
- * });
726
- * ```
727
- *
728
- * @example
729
- * Verify permissions after assignment:
730
- * ```typescript
731
- * await omnibase.permissions.roles.assign('user_123', {
732
- * role_name: 'admin'
733
- * });
734
- *
735
- * // User now has all permissions from the admin role
736
- * const canManage = await omnibase.permissions.permissions.checkPermission(
737
- * undefined,
738
- * {
739
- * namespace: 'Tenant',
740
- * object: 'tenant_789',
741
- * relation: 'manage_billing',
742
- * subjectId: 'user_123'
743
- * }
744
- * );
745
- * // canManage.data.allowed === true
746
- * ```
747
- */
748
- async assign(userId, request) {
749
- const response = await this.client.fetch(
750
- `/api/v1/permissions/users/${userId}/roles`,
751
- {
752
- method: "POST",
753
- headers: { "Content-Type": "application/json" },
754
- body: JSON.stringify(request)
755
- }
756
- );
757
- const data = await response.json();
758
- if (!response.ok || data.error) {
759
- throw new Error(data.error || "Failed to assign role");
760
- }
761
- }
762
- };
763
-
764
- // src/permissions/handler.ts
765
- var PermissionsClient = class {
766
- /**
767
- * Ory Keto RelationshipApi for managing subject-object relationships
768
- *
769
- * Provides methods for creating, updating, and deleting relationships between
770
- * subjects (users, groups) and objects (tenants, resources). This API handles
771
- * write operations and is used to establish permission structures.
772
- *
773
- * Key methods:
774
- * - `createRelationship()` - Creates a new relationship tuple
775
- * - `deleteRelationships()` - Removes existing relationship tuples
776
- * - `getRelationships()` - Queries existing relationships
777
- * - `patchRelationships()` - Updates multiple relationships atomically
778
- *
779
- * @example
780
- * ```typescript
781
- * // Create a relationship
782
- * await client.relationships.createRelationship(
783
- * undefined,
784
- * {
785
- * namespace: 'Tenant',
786
- * object: 'tenant_123',
787
- * relation: 'members',
788
- * subjectId: 'user_456'
789
- * }
790
- * );
791
- * ```
792
- *
793
- * @since 1.0.0
794
- * @group Relationships
795
- */
796
- relationships;
797
- /**
798
- * Ory Keto PermissionApi for checking permissions
799
- *
800
- * Provides methods for querying whether a subject has a specific permission
801
- * on an object. This API handles read operations and is optimized for fast
802
- * permission checks in your application logic.
803
- *
804
- * All operations are proxied through Omnibase's API at `/api/v1/permissions/read`.
805
- *
806
- * Key methods:
807
- * - `checkPermission(params)` - Checks if a subject has permission on an object
808
- * - `checkPermissionOrError(params)` - Same as above but throws error if denied
809
- * - `expandPermissions(namespace, object, relation, maxDepth?)` - Expands relationships to show all granted permissions
810
- * - `postCheckPermission(maxDepth?, body)` - POST variant of permission check
811
- *
812
- * @example
813
- * Check a single permission:
814
- * ```typescript
815
- * const result = await omnibase.permissions.permissions.checkPermission({
816
- * namespace: 'Tenant',
817
- * object: 'tenant_123',
818
- * relation: 'view',
819
- * subjectId: 'user_456'
820
- * });
821
- *
822
- * if (result.data.allowed) {
823
- * console.log('User has permission');
824
- * }
825
- * ```
826
- *
827
- * @example
828
- * Expand permission tree:
829
- * ```typescript
830
- * const tree = await omnibase.permissions.permissions.expandPermissions(
831
- * 'Tenant',
832
- * 'tenant_123',
833
- * 'view'
834
- * );
835
- *
836
- * console.log('Permission tree:', tree.data);
837
- * ```
838
- *
839
- * @example
840
- * Check permission or throw error:
841
- * ```typescript
842
- * try {
843
- * await omnibase.permissions.permissions.checkPermissionOrError({
844
- * namespace: 'Tenant',
845
- * object: 'tenant_123',
846
- * relation: 'edit',
847
- * subjectId: 'user_456'
848
- * });
849
- * // Permission granted
850
- * } catch (error) {
851
- * // Permission denied
852
- * console.error('Access denied');
853
- * }
854
- * ```
855
- *
856
- * @since 1.0.0
857
- * @group Permissions
858
- */
859
- permissions;
860
- /**
861
- * Handler for managing roles and role-based permissions
862
- *
863
- * Provides methods for creating custom roles, assigning permissions,
864
- * and managing role assignments. Works alongside the Keto-based
865
- * permissions system to provide dynamic RBAC capabilities.
866
- *
867
- * Roles are stored in the database and automatically synchronized with
868
- * Ory Keto relationships, providing a higher-level abstraction over
869
- * raw relationship tuples.
870
- *
871
- * @example
872
- * Create a custom role:
873
- * ```typescript
874
- * const role = await omnibase.permissions.roles.create({
875
- * role_name: 'billing_manager',
876
- * permissions: ['tenant#manage_billing', 'tenant#view_invoices']
877
- * });
878
- * ```
879
- *
880
- * @example
881
- * Assign role to a user:
882
- * ```typescript
883
- * await omnibase.permissions.roles.assign('user_123', {
884
- * role_id: role.id
885
- * });
886
- * ```
887
- *
888
- * @example
889
- * List all roles:
890
- * ```typescript
891
- * const roles = await omnibase.permissions.roles.list();
892
- * console.log('Available roles:', roles);
893
- * ```
894
- *
895
- * @since 0.7.0
896
- * @group Roles
897
- */
898
- roles;
899
- /**
900
- * Creates a new PermissionsClient instance
901
- *
902
- * Initializes the client with separate endpoints for read and write operations.
903
- * The client automatically configures the Ory Keto client libraries to use
904
- * Omnibase's permission proxy endpoints:
905
- * - Write endpoint: `${apiBaseUrl}/api/v1/permissions/write`
906
- * - Read endpoint: `${apiBaseUrl}/api/v1/permissions/read`
907
- *
908
- * This separation follows Ory Keto's recommended architecture for optimal
909
- * performance and security.
910
- *
911
- * @param apiBaseUrl - The base URL for your Omnibase API instance (e.g., 'https://api.example.com')
912
- * @param client - The main OmnibaseClient instance (required for roles handler)
913
- *
914
- * @throws {Error} When the base URL is invalid or cannot be reached
915
- *
916
- * @example
917
- * Direct instantiation (not recommended - use OmnibaseClient instead):
918
- * ```typescript
919
- * const client = new PermissionsClient('https://api.example.com', omnibaseClient);
920
- * ```
921
- *
922
- * @example
923
- * Recommended usage via OmnibaseClient:
924
- * ```typescript
925
- * import { OmnibaseClient } from '@omnibase/core-js';
926
- *
927
- * const omnibase = new OmnibaseClient({
928
- * apiUrl: 'https://api.example.com'
929
- * });
930
- *
931
- * // Use the permissions client
932
- * await omnibase.permissions.permissions.checkPermission({
933
- * namespace: 'Tenant',
934
- * object: 'tenant_123',
935
- * relation: 'view',
936
- * subjectId: 'user_456'
937
- * });
938
- * ```
939
- *
940
- * @since 1.0.0
941
- * @group Client
942
- */
943
- constructor(apiBaseUrl, client) {
944
- this.relationships = new import_client.RelationshipApi(
945
- void 0,
946
- `${apiBaseUrl}/api/v1/permissions/write`
947
- );
948
- this.permissions = new import_client.PermissionApi(
949
- void 0,
950
- `${apiBaseUrl}/api/v1/permissions/read`
951
- );
952
- this.roles = new RolesHandler(client);
953
- }
954
- };
955
-
956
- // src/storage/index.ts
957
- var StorageClient = class {
958
- constructor(client) {
959
- this.client = client;
960
- }
961
- /**
962
- * Upload a file to storage
963
- *
964
- * @param path - Full path for the file (e.g., "public/images/avatar.png", "users/123/private/doc.pdf")
965
- * @param file - File or Blob to upload
966
- * @param options - Upload options including custom metadata
967
- *
968
- * @example
969
- * ```typescript
970
- * const result = await storage.upload(
971
- * 'public/avatars/user-123.png',
972
- * file,
973
- * {
974
- * metadata: {
975
- * userId: '123',
976
- * uploadedBy: 'john@example.com',
977
- * tags: ['profile', 'avatar']
978
- * }
979
- * }
980
- * );
981
- *
982
- * // File is automatically uploaded to S3 via the presigned URL
983
- * console.log('File uploaded to:', result.path);
984
- * ```
985
- */
986
- async upload(path, file, options) {
987
- const metadata = {
988
- // File metadata
989
- filename: file instanceof File ? file.name : "blob",
990
- size: file.size,
991
- mime_type: file.type,
992
- uploaded_at: (/* @__PURE__ */ new Date()).toISOString(),
993
- // Merge custom metadata
994
- ...options?.metadata || {}
995
- };
996
- const response = await this.client.fetch("/api/v1/storage/upload", {
997
- method: "POST",
998
- headers: {
999
- "Content-Type": "application/json"
1000
- },
1001
- body: JSON.stringify({
1002
- path,
1003
- metadata
1004
- })
1005
- });
1006
- if (!response.ok) {
1007
- const error = await response.json().catch(() => ({ error: "Upload failed" }));
1008
- throw new Error(error.error || "Failed to get upload URL");
1009
- }
1010
- const responseData = await response.json();
1011
- const result = responseData.data;
1012
- const uploadResponse = await fetch(result.upload_url, {
1013
- method: "PUT",
1014
- body: file,
1015
- headers: {
1016
- "Content-Type": file.type
1017
- }
1018
- });
1019
- if (!uploadResponse.ok) {
1020
- throw new Error("Failed to upload file to storage");
1021
- }
1022
- return result;
1023
- }
1024
- /**
1025
- * Download a file from storage
1026
- *
1027
- * @param path - Full path to the file
1028
- *
1029
- * @example
1030
- * ```typescript
1031
- * const { download_url } = await storage.download('public/images/logo.png');
1032
- *
1033
- * // Download the file
1034
- * const response = await fetch(download_url);
1035
- * const blob = await response.blob();
1036
- * ```
1037
- */
1038
- async download(path) {
1039
- const response = await this.client.fetch("/api/v1/storage/download", {
1040
- method: "POST",
1041
- headers: {
1042
- "Content-Type": "application/json"
1043
- },
1044
- body: JSON.stringify({
1045
- path
1046
- })
1047
- });
1048
- if (!response.ok) {
1049
- const error = await response.json().catch(() => ({ error: "Download failed" }));
1050
- throw new Error(error.error || "Failed to get download URL");
1051
- }
1052
- const responseData = await response.json();
1053
- return responseData.data;
1054
- }
1055
- /**
1056
- * Delete a file from storage
1057
- *
1058
- * @param path - Full path to the file
1059
- *
1060
- * @example
1061
- * ```typescript
1062
- * await storage.delete('users/123/documents/old-report.pdf');
1063
- * ```
1064
- */
1065
- async delete(path) {
1066
- const response = await this.client.fetch("/api/v1/storage/object", {
1067
- method: "DELETE",
1068
- headers: {
1069
- "Content-Type": "application/json"
1070
- },
1071
- body: JSON.stringify({
1072
- path
1073
- })
1074
- });
1075
- if (!response.ok) {
1076
- const error = await response.json().catch(() => ({ error: "Delete failed" }));
1077
- throw new Error(error.error || "Failed to delete file");
1078
- }
1079
- }
1080
- };
1081
-
1082
- // src/tenants/invites.ts
1083
- var TenantInviteManager = class {
1084
- /**
1085
- * Creates a new TenantInviteManager instance
1086
- *
1087
- * Initializes the manager with the provided Omnibase client for making
1088
- * authenticated API requests to tenant invitation endpoints.
1089
- *
1090
- * @param omnibaseClient - Configured Omnibase client instance
1091
- *
1092
- * @group Tenant Invitations
1093
- */
1094
- constructor(omnibaseClient) {
1095
- this.omnibaseClient = omnibaseClient;
1096
- }
1097
- /**
1098
- * Accepts a tenant invitation using a secure token
1099
- *
1100
- * Processes a tenant invitation by validating the provided token and
1101
- * adding the authenticated user to the specified tenant. The invitation
1102
- * token is consumed during this process and cannot be used again.
1103
- *
1104
- * The function performs several validations:
1105
- * - Verifies the token exists and is valid
1106
- * - Checks that the invitation hasn't expired
1107
- * - Ensures the invitation hasn't already been used
1108
- * - Confirms the user is authenticated via session cookies
1109
- *
1110
- * Upon successful acceptance, the user is granted access to the tenant
1111
- * with the role specified in the original invitation. The invitation
1112
- * record is marked as used and cannot be accepted again.
1113
- *
1114
- * @param token - The secure invitation token from the email invitation
1115
- *
1116
- * @returns Promise resolving to the tenant ID and success confirmation
1117
- *
1118
- * @throws {Error} When the token parameter is missing or empty
1119
- * @throws {Error} When the invitation token is invalid or expired
1120
- * @throws {Error} When the invitation has already been accepted
1121
- * @throws {Error} When the user is not authenticated
1122
- * @throws {Error} When the API request fails due to network issues
1123
- * @throws {Error} When the server returns an error response (4xx, 5xx status codes)
1124
- *
1125
- * @example
1126
- * ```typescript
1127
- * // Typically called from an invitation link like:
1128
- * // https://app.com/accept-invite?token=inv_secure_token_abc123
1129
- *
1130
- * const urlParams = new URLSearchParams(window.location.search);
1131
- * const inviteToken = urlParams.get('token');
1132
- *
1133
- * if (inviteToken) {
1134
- * try {
1135
- * const result = await inviteManager.accept(inviteToken);
1136
- *
1137
- * // Success - redirect to tenant dashboard
1138
- * console.log(`Successfully joined tenant: ${result.data.tenant_id}`);
1139
- * window.location.href = `/dashboard?tenant=${result.data.tenant_id}`;
1140
- * } catch (error) {
1141
- * console.error('Failed to accept invitation:', error.message);
1142
- * }
1143
- * }
1144
- * ```
1145
- *
1146
- * @since 0.6.0
1147
- * @public
1148
- * @group Tenant Invitations
1149
- */
1150
- async accept(token) {
1151
- if (!token) {
1152
- throw new Error("Invite token is required");
1153
- }
1154
- const requestBody = {
1155
- token
1156
- };
1157
- try {
1158
- const response = await this.omnibaseClient.fetch(
1159
- `/api/v1/tenants/invites/accept`,
1160
- {
1161
- method: "PUT",
1162
- headers: {
1163
- "Content-Type": "application/json"
1164
- },
1165
- body: JSON.stringify(requestBody),
1166
- credentials: "include"
1167
- }
1168
- );
1169
- if (!response.ok) {
1170
- const errorData = await response.text();
1171
- throw new Error(
1172
- `Failed to accept invite: ${response.status} - ${errorData}`
1173
- );
1174
- }
1175
- const data = await response.json();
1176
- return data;
1177
- } catch (error) {
1178
- console.error("Error accepting tenant invite:", error);
1179
- throw error;
1180
- }
1181
- }
1182
- /**
1183
- * Creates a new user invitation for the active tenant
1184
- *
1185
- * Generates a secure invitation that allows a user to join the currently active
1186
- * tenant with the defined role. The invitation is sent to the provided email address
1187
- * and includes a time-limited token for security. The invite URL will be automatically
1188
- * appended with ?token=XYZ when sent to the user.
1189
- *
1190
- * The function creates the invitation record in the database and triggers an email
1191
- * notification to the invited user. The invitation expires after 7 days and can only
1192
- * be used once.
1193
- *
1194
- * Only existing tenant members with appropriate permissions (invite_user permission)
1195
- * can create invitations. The inviter's authentication and tenant context are validated
1196
- * via HTTP-only cookies sent with the request.
1197
- *
1198
- * @param inviteData - Configuration object for the invitation
1199
- * @param inviteData.email - Email address of the user to invite
1200
- * @param inviteData.role - Role the user will have after joining (e.g., 'member', 'admin')
1201
- * @param inviteData.invite_url - Base URL for the invitation link (will be appended with ?token=XYZ)
1202
- *
1203
- * @returns Promise resolving to the created invitation with secure token
1204
- *
1205
- * @throws {Error} When required fields (email, role, invite_url) are missing or empty
1206
- * @throws {Error} When the user doesn't have permission to invite users to the tenant
1207
- * @throws {Error} When the API request fails due to network issues
1208
- * @throws {Error} When the server returns an error response (4xx, 5xx status codes)
1209
- *
1210
- * @example
1211
- * ```typescript
1212
- * const invite = await inviteManager.create({
1213
- * email: 'colleague@company.com',
1214
- * role: 'member',
1215
- * invite_url: 'https://yourapp.com/accept-invite'
1216
- * });
1217
- *
1218
- * console.log(`Invite sent to: ${invite.data.invite.email}`);
1219
- * console.log(`Invite token: ${invite.data.invite.token}`);
1220
- * ```
1221
- *
1222
- * @since 0.6.0
1223
- * @public
1224
- * @group Tenant Invitations
1225
- */
1226
- async create(inviteData) {
1227
- if (!inviteData.email || !inviteData.role || !inviteData.invite_url) {
1228
- throw new Error(
1229
- "Missing data in `create` - email, role, and invite_url are required"
1230
- );
1231
- }
1232
- try {
1233
- const response = await this.omnibaseClient.fetch(
1234
- `/api/v1/tenants/invites`,
1235
- {
1236
- method: "POST",
1237
- headers: {
1238
- "Content-Type": "application/json"
1239
- },
1240
- body: JSON.stringify(inviteData),
1241
- credentials: "include"
1242
- }
1243
- );
1244
- if (!response.ok) {
1245
- const errorData = await response.text();
1246
- throw new Error(
1247
- `Failed to create invite: ${response.status} - ${errorData}`
1248
- );
1249
- }
1250
- const data = await response.json();
1251
- return data;
1252
- } catch (error) {
1253
- console.error("Error creating tenant user invite:", error);
1254
- throw error;
1255
- }
1256
- }
1257
- };
1258
-
1259
- // src/tenants/management.ts
1260
- var TenantManger = class {
1261
- /**
1262
- * Creates a new TenantManger instance
1263
- *
1264
- * Initializes the manager with the provided Omnibase client for making
1265
- * authenticated API requests to tenant management endpoints.
1266
- *
1267
- * @param omnibaseClient - Configured Omnibase client instance
1268
- *
1269
- * @group Tenant Management
1270
- */
1271
- constructor(omnibaseClient) {
1272
- this.omnibaseClient = omnibaseClient;
1273
- }
1274
- /**
1275
- * Creates a new tenant in the multi-tenant system
1276
- *
1277
- * Establishes a new tenant with integrated Stripe billing setup and assigns
1278
- * the specified user as the tenant owner. The operation creates the necessary
1279
- * database records and returns a JWT token that enables Row-Level Security
1280
- * access to the tenant's isolated data.
1281
- *
1282
- * The function automatically handles Stripe customer creation for billing
1283
- * integration and sets up the initial tenant configuration. The returned
1284
- * token should be stored securely for subsequent API calls.
1285
- *
1286
- * @param tenantData - Configuration object for the new tenant
1287
- * @param tenantData.name - Display name for the tenant organization
1288
- * @param tenantData.billing_email - Email address for Stripe billing notifications
1289
- * @param tenantData.user_id - Unique identifier of the user who will own this tenant
1290
- *
1291
- * @returns Promise resolving to the created tenant with authentication token
1292
- *
1293
- * @throws {Error} When required fields (name, user_id) are missing or empty
1294
- * @throws {Error} When the API request fails due to network issues
1295
- * @throws {Error} When the server returns an error response (4xx, 5xx status codes)
1296
- *
1297
- * @example
1298
- * ```typescript
1299
- * const newTenant = await tenantManager.createTenant({
1300
- * name: 'Acme Corporation',
1301
- * billing_email: 'billing@acme.com',
1302
- * user_id: 'user_123'
1303
- * });
1304
- *
1305
- * console.log(`Tenant created: ${newTenant.data.tenant.id}`);
1306
- * ```
1307
- *
1308
- * @since 0.6.0
1309
- * @public
1310
- * @group Tenant Management
1311
- */
1312
- async createTenant(tenantData) {
1313
- if (!tenantData.name || !tenantData.user_id) {
1314
- throw new Error("Name and user_id are required");
1315
- }
1316
- try {
1317
- const response = await this.omnibaseClient.fetch(`/api/v1/tenants`, {
1318
- method: "POST",
1319
- headers: {
1320
- "Content-Type": "application/json"
1321
- },
1322
- body: JSON.stringify(tenantData),
1323
- credentials: "include"
1324
- });
1325
- if (!response.ok) {
1326
- const errorData = await response.text();
1327
- throw new Error(
1328
- `Failed to create tenant: ${response.status} - ${errorData}`
1329
- );
1330
- }
1331
- const data = await response.json();
1332
- return data;
1333
- } catch (error) {
1334
- console.error("Error creating tenant:", error);
1335
- throw error;
1336
- }
1337
- }
1338
- /**
1339
- * Permanently deletes a tenant and all associated data
1340
- *
1341
- * ⚠️ **WARNING: This operation is irreversible and will permanently delete:**
1342
- * - The tenant record and all metadata
1343
- * - All user memberships and invitations for this tenant
1344
- * - All tenant-specific data protected by row-level security
1345
- * - Any tenant-related billing information
1346
- * - All tenant configuration and settings
1347
- *
1348
- * **Access Control:**
1349
- * Only tenant owners can delete a tenant. This operation requires:
1350
- * - User must be authenticated
1351
- * - User must have 'owner' role for the specified tenant
1352
- * - Tenant must exist and be accessible to the user
1353
- *
1354
- * **Security Considerations:**
1355
- * - All tenant data is immediately and permanently removed
1356
- * - Other tenant members lose access immediately
1357
- * - Any active sessions for this tenant are invalidated
1358
- * - Billing subscriptions are cancelled (if applicable)
1359
- * - Audit logs for deletion are maintained for compliance
1360
- *
1361
- * @returns Promise resolving to a confirmation message
1362
- *
1363
- * @throws {Error} When the tenantId parameter is missing or empty
1364
- * @throws {Error} When the user is not authenticated
1365
- * @throws {Error} When the user is not an owner of the specified tenant
1366
- * @throws {Error} When the tenant doesn't exist or is not accessible
1367
- * @throws {Error} When the API request fails due to network issues
1368
- * @throws {Error} When the server returns an error response (4xx, 5xx status codes)
1369
- *
1370
- * @example
1371
- * ```typescript
1372
- * // Always confirm before deleting
1373
- * const userConfirmed = confirm(
1374
- * 'Are you sure you want to delete this tenant? This action cannot be undone.'
1375
- * );
1376
- *
1377
- * if (userConfirmed) {
1378
- * try {
1379
- * const result = await tenantManager.deleteTenant();
1380
- * console.log(result.data.message);
1381
- *
1382
- * // Redirect user away from deleted tenant
1383
- * window.location.href = '/dashboard';
1384
- * } catch (error) {
1385
- * console.error('Failed to delete tenant:', error);
1386
- * }
1387
- * }
1388
- * ```
1389
- *
1390
- * @since 0.6.0
1391
- * @public
1392
- * @group Tenant Management
1393
- */
1394
- async deleteTenant() {
1395
- try {
1396
- const response = await this.omnibaseClient.fetch(`/api/v1/tenants`, {
1397
- method: "DELETE",
1398
- headers: {
1399
- "Content-Type": "application/json"
1400
- },
1401
- credentials: "include"
1402
- });
1403
- if (!response.ok) {
1404
- const errorData = await response.text();
1405
- throw new Error(
1406
- `Failed to delete tenant: ${response.status} - ${errorData}`
1407
- );
1408
- }
1409
- const data = await response.json();
1410
- return data;
1411
- } catch (error) {
1412
- console.error("Error deleting tenant:", error);
1413
- throw error;
1414
- }
1415
- }
1416
- /**
1417
- * Switches the user's active tenant context
1418
- *
1419
- * Changes the user's active tenant to the specified tenant ID, updating
1420
- * their authentication context and permissions. This function is essential
1421
- * for multi-tenant applications where users belong to multiple tenants
1422
- * and need to switch between them.
1423
- *
1424
- * The function performs several operations:
1425
- * - Validates that the user has access to the specified tenant
1426
- * - Updates the user's active tenant in their session
1427
- * - Generates a new JWT token with updated tenant claims
1428
- * - Updates any cached tenant-specific data
1429
- *
1430
- * After switching tenants, all subsequent API calls will be made within
1431
- * the context of the new active tenant, with row-level security policies
1432
- * applied accordingly. The new JWT token should be used for all future
1433
- * authenticated requests.
1434
- *
1435
- * @param tenantId - The ID of the tenant to switch to (must be a tenant the user belongs to)
1436
- *
1437
- * @returns Promise resolving to a new JWT token and success confirmation
1438
- *
1439
- * @throws {Error} When the tenantId parameter is missing or empty
1440
- * @throws {Error} When the user doesn't have access to the specified tenant
1441
- * @throws {Error} When the user is not authenticated
1442
- * @throws {Error} When the specified tenant doesn't exist
1443
- * @throws {Error} When the API request fails due to network issues
1444
- * @throws {Error} When the server returns an error response (4xx, 5xx status codes)
1445
- *
1446
- * @example
1447
- * ```typescript
1448
- * const result = await tenantManager.switchActiveTenant('tenant_xyz789');
1449
- *
1450
- * // Store the new token for future requests
1451
- * console.log(`Switched to tenant. New token: ${result.data.token}`);
1452
- *
1453
- * // Now all API calls will be in the context of tenant_xyz789
1454
- * const tenantData = await getCurrentTenantData();
1455
- * ```
1456
- *
1457
- * @since 0.6.0
1458
- * @public
1459
- * @group Tenant Management
1460
- */
1461
- async switchActiveTenant(tenantId) {
1462
- if (!tenantId) {
1463
- throw new Error("Tenant ID is required");
1464
- }
1465
- const requestBody = {
1466
- tenant_id: tenantId
1467
- };
1468
- try {
1469
- const response = await this.omnibaseClient.fetch(
1470
- `/api/v1/tenants/switch-active`,
1471
- {
1472
- method: "PUT",
1473
- headers: {
1474
- "Content-Type": "application/json"
1475
- },
1476
- body: JSON.stringify(requestBody),
1477
- credentials: "include"
1478
- }
1479
- );
1480
- if (!response.ok) {
1481
- const errorData = await response.text();
1482
- throw new Error(
1483
- `Failed to switch tenant: ${response.status} - ${errorData}`
1484
- );
1485
- }
1486
- const data = await response.json();
1487
- return data;
1488
- } catch (error) {
1489
- console.error("Error switching active tenant:", error);
1490
- throw error;
1491
- }
1492
- }
1493
- };
1494
-
1495
- // src/tenants/subscriptions.ts
1496
- var TenantSubscriptionManager = class {
1497
- /**
1498
- * Creates a new TenantSubscriptionManager instance
1499
- *
1500
- * @param omnibaseClient - Configured Omnibase client instance
1501
- *
1502
- * @group Tenant Subscriptions
1503
- */
1504
- constructor(omnibaseClient) {
1505
- this.omnibaseClient = omnibaseClient;
1506
- }
1507
- /**
1508
- * Get all active subscriptions for the current tenant
1509
- *
1510
- * Retrieves all active Stripe subscriptions associated with the user's
1511
- * currently active tenant. Returns subscriptions with config-based price IDs
1512
- * instead of raw Stripe IDs, making it easier to match against your billing
1513
- * configuration.
1514
- *
1515
- * The endpoint automatically:
1516
- * - Fetches subscriptions from Stripe API
1517
- * - Maps Stripe price IDs to your config price IDs
1518
- * - Checks both current and historical price mappings
1519
- * - Flags legacy prices from old billing configurations
1520
- * - Filters to only active/trialing/past_due subscriptions
1521
- *
1522
- * Returns an empty array if:
1523
- * - Tenant has no Stripe customer ID configured
1524
- * - Tenant has no active subscriptions
1525
- * - User is not authenticated
1526
- *
1527
- * @returns Promise resolving to array of active subscriptions
1528
- *
1529
- * @throws {Error} When the user is not authenticated
1530
- * @throws {Error} When the API request fails due to network issues
1531
- * @throws {Error} When the server returns an error response (4xx, 5xx)
1532
- *
1533
- * @example
1534
- * ```typescript
1535
- * const response = await subscriptionManager.getActive();
1536
- *
1537
- * if (response.data.length === 0) {
1538
- * console.log('No active subscriptions');
1539
- * } else {
1540
- * response.data.forEach(sub => {
1541
- * console.log(`Plan: ${sub.config_price_id}`);
1542
- * console.log(`Status: ${sub.status}`);
1543
- * if (sub.is_legacy_price) {
1544
- * console.log('⚠️ Using legacy pricing');
1545
- * }
1546
- * });
1547
- * }
1548
- * ```
1549
- *
1550
- * @since 0.6.0
1551
- * @public
1552
- * @group Tenant Subscriptions
1553
- */
1554
- async getActive() {
1555
- try {
1556
- const response = await this.omnibaseClient.fetch(
1557
- `/api/v1/tenants/subscriptions`,
1558
- {
1559
- method: "GET",
1560
- credentials: "include"
1561
- }
1562
- );
1563
- if (!response.ok) {
1564
- const errorData = await response.text();
1565
- throw new Error(
1566
- `Failed to fetch subscriptions: ${response.status} - ${errorData}`
1567
- );
1568
- }
1569
- const data = await response.json();
1570
- return data;
1571
- } catch (error) {
1572
- console.error("Error fetching tenant subscriptions:", error);
1573
- throw error;
1574
- }
1575
- }
1576
- /**
1577
- * Check if the current tenant has billing information configured
1578
- *
1579
- * Verifies whether the tenant has valid payment methods attached to their
1580
- * Stripe customer account. This is useful for:
1581
- * - Showing billing setup prompts
1582
- * - Gating premium features behind payment method requirement
1583
- * - Displaying billing status indicators in UI
1584
- * - Determining if customer portal access should be shown
1585
- *
1586
- * The check verifies:
1587
- * - Default payment source (card, bank account, etc.)
1588
- * - Default payment method in invoice settings
1589
- * - Whether the payment method is valid and active
1590
- *
1591
- * Returns `false` if:
1592
- * - Tenant has no Stripe customer ID
1593
- * - No payment methods are configured
1594
- * - User is not authenticated
1595
- *
1596
- * @returns Promise resolving to billing status information
1597
- *
1598
- * @throws {Error} When the user is not authenticated
1599
- * @throws {Error} When the API request fails due to network issues
1600
- * @throws {Error} When the server returns an error response (4xx, 5xx)
1601
- *
1602
- * @example
1603
- * ```typescript
1604
- * const response = await subscriptionManager.getBillingStatus();
1605
- *
1606
- * if (!response.data.has_billing_info) {
1607
- * // Show billing setup prompt
1608
- * showBillingSetupModal();
1609
- * } else if (!response.data.is_active) {
1610
- * // Payment method exists but may be expired/invalid
1611
- * showPaymentMethodUpdatePrompt();
1612
- * } else {
1613
- * // All good - show customer portal link
1614
- * showManageBillingButton();
1615
- * }
1616
- * ```
1617
- *
1618
- * @since 0.6.0
1619
- * @public
1620
- * @group Tenant Subscriptions
1621
- */
1622
- async getBillingStatus() {
1623
- try {
1624
- const response = await this.omnibaseClient.fetch(
1625
- `/api/v1/tenants/billing-status`,
1626
- {
1627
- method: "GET",
1628
- credentials: "include"
1629
- }
1630
- );
1631
- if (!response.ok) {
1632
- const errorData = await response.text();
1633
- throw new Error(
1634
- `Failed to fetch billing status: ${response.status} - ${errorData}`
1635
- );
1636
- }
1637
- const data = await response.json();
1638
- return data;
1639
- } catch (error) {
1640
- console.error("Error fetching billing status:", error);
1641
- throw error;
1642
- }
1643
- }
1644
- };
1645
-
1646
- // src/tenants/user.ts
1647
- var TenantUserManager = class {
1648
- /**
1649
- * Creates a new tenant user manager
1650
- *
1651
- * @param omnibaseClient - Configured OmnibaseClient instance for API communication
1652
- *
1653
- * @group Tenant User Management
1654
- */
1655
- constructor(omnibaseClient) {
1656
- this.omnibaseClient = omnibaseClient;
1657
- }
1658
- /**
1659
- * Retrieves all users in the active tenant
1660
- *
1661
- * This method fetches a list of all users who are members of the current active tenant,
1662
- * including their basic information (name, email) and assigned role. The operation
1663
- * requires the requesting user to have appropriate permissions to view tenant users
1664
- * (typically requires `view_users` permission).
1665
- *
1666
- * The returned list includes all tenant members regardless of their role, ordered by
1667
- * when they joined the tenant (newest first).
1668
- *
1669
- * @returns Promise resolving to an array of tenant users with their details
1670
- *
1671
- * @throws {Error} When the API request fails (includes status code and error details)
1672
- * @throws {Error} When the user doesn't have permission to view users
1673
- * @throws {Error} When the user is not authenticated or no active tenant is set
1674
- *
1675
- * @example
1676
- * ```typescript
1677
- * // Fetch all users in the active tenant
1678
- * try {
1679
- * const result = await userManager.getAll();
1680
- * console.log(`Found ${result.data.length} users`);
1681
- *
1682
- * result.data.forEach(user => {
1683
- * console.log(`${user.first_name} ${user.last_name} (${user.email}) - ${user.role}`);
1684
- * });
1685
- * } catch (error) {
1686
- * if (error.message.includes('403')) {
1687
- * console.error('Insufficient permissions to view users');
1688
- * } else {
1689
- * console.error('Failed to fetch users:', error);
1690
- * }
1691
- * }
1692
- * ```
1693
- *
1694
- * @since 1.0.0
1695
- * @public
1696
- * @group Tenant User Management
1697
- */
1698
- async getAll() {
1699
- const response = await this.omnibaseClient.fetch("/api/v1/tenants/users", {
1700
- method: "GET"
1701
- });
1702
- if (!response.ok) {
1703
- const errorData = await response.text();
1704
- throw new Error(
1705
- `Failed to fetch tenant users: ${response.status} - ${errorData}`
1706
- );
1707
- }
1708
- return await response.json();
1709
- }
1710
- /**
1711
- * Removes a user from the active tenant
1712
- *
1713
- * This method removes a specified user from the current active tenant. The operation
1714
- * requires the requesting user to have appropriate permissions (admin or owner role).
1715
- * The user being removed will lose access to the tenant and all its resources.
1716
- *
1717
- * Note: You cannot remove yourself from a tenant using this method. To leave a tenant,
1718
- * use the appropriate leave or delete tenant operations instead.
1719
- *
1720
- * @param data - Request data containing the user ID to remove
1721
- * @param data.user_id - ID of the user to remove from the tenant
1722
- *
1723
- * @returns Promise resolving to an API response confirming the removal
1724
- *
1725
- * @throws {Error} When user_id is not provided
1726
- * @throws {Error} When the API request fails (includes status code and error details)
1727
- * @throws {Error} When the user doesn't have permission to remove users
1728
- * @throws {Error} When the specified user is not a member of the tenant
1729
- *
1730
- * @example
1731
- * ```typescript
1732
- * // Remove a user from the active tenant
1733
- * try {
1734
- * await userManager.remove({ user_id: 'user_abc123' });
1735
- * console.log('User removed successfully');
1736
- * } catch (error) {
1737
- * if (error.message.includes('403')) {
1738
- * console.error('Insufficient permissions to remove user');
1739
- * } else if (error.message.includes('404')) {
1740
- * console.error('User not found in tenant');
1741
- * } else {
1742
- * console.error('Failed to remove user:', error);
1743
- * }
1744
- * }
1745
- * ```
1746
- *
1747
- * @since 0.6.0
1748
- * @public
1749
- * @group Tenant User Management
1750
- */
1751
- async remove(data) {
1752
- if (!data.user_id) {
1753
- throw new Error("user_id is required");
1754
- }
1755
- const response = await this.omnibaseClient.fetch("/api/v1/tenants/users", {
1756
- method: "DELETE",
1757
- body: JSON.stringify(data)
1758
- });
1759
- if (!response.ok) {
1760
- const errorData = await response.text();
1761
- throw new Error(
1762
- `Failed to delete user from tenant: ${response.status} - ${errorData}`
1763
- );
1764
- }
1765
- return await response.json();
1766
- }
1767
- /**
1768
- * Updates a user's role within the active tenant
1769
- *
1770
- * This method changes the role of a specified user in the current active tenant. The operation
1771
- * requires the requesting user to have appropriate permissions (typically admin or owner role).
1772
- * Role updates take effect immediately and affect the user's permissions and access rights
1773
- * within the tenant.
1774
- *
1775
- * Common roles include 'admin', 'member', and 'viewer', but the exact roles available depend
1776
- * on your tenant's configuration. Changing a user's role will modify their ability to perform
1777
- * various operations within the tenant.
1778
- *
1779
- * @param data - Request data containing the user ID and new role
1780
- * @param data.user_id - ID of the user whose role is being updated
1781
- * @param data.role - New role to assign to the user
1782
- *
1783
- * @returns Promise resolving to an API response confirming the role update
1784
- *
1785
- * @throws {Error} When user_id or role is not provided
1786
- * @throws {Error} When the API request fails (includes status code and error details)
1787
- * @throws {Error} When the user doesn't have permission to update roles
1788
- * @throws {Error} When the specified user is not a member of the tenant
1789
- * @throws {Error} When the specified role is invalid or not allowed
1790
- *
1791
- * @example
1792
- * ```typescript
1793
- * // Update a user's role to admin
1794
- * try {
1795
- * const result = await userManager.updateRole({
1796
- * user_id: 'user_abc123',
1797
- * role: 'admin'
1798
- * });
1799
- * console.log('Role updated successfully:', result.data.message);
1800
- * } catch (error) {
1801
- * if (error.message.includes('403')) {
1802
- * console.error('Insufficient permissions to update roles');
1803
- * } else if (error.message.includes('404')) {
1804
- * console.error('User not found in tenant');
1805
- * } else {
1806
- * console.error('Failed to update role:', error);
1807
- * }
1808
- * }
1809
- * ```
1810
- *
1811
- * @since 0.6.0
1812
- * @public
1813
- * @group Tenant User Management
1814
- */
1815
- async updateRole(data) {
1816
- if (!data.role || !data.user_id)
1817
- throw new Error("user_id and role is required");
1818
- const response = await this.omnibaseClient.fetch("/api/v1/tenants/users", {
1819
- method: "PUT",
1820
- body: JSON.stringify(data)
1821
- });
1822
- if (!response.ok) {
1823
- const errorData = await response.text();
1824
- throw new Error(
1825
- `Failed to update users role: ${response.status} - ${errorData}`
1826
- );
1827
- }
1828
- return await response.json();
1829
- }
1830
- };
1831
-
1832
- // src/tenants/handler.ts
1833
- var TenantHandler = class {
1834
- /**
1835
- * Creates a new TenantHandler instance
1836
- *
1837
- * Initializes the handler with the provided Omnibase client and sets up
1838
- * the specialized manager instances for tenant and invitation operations.
1839
- * The client is used for all underlying HTTP requests and authentication.
1840
- *
1841
- * @param omnibaseClient - Configured Omnibase client instance
1842
- *
1843
- * @example
1844
- * ```typescript
1845
- * const client = new OmnibaseClient({
1846
- * apiKey: 'your-api-key',
1847
- * baseURL: 'https://api.yourapp.com'
1848
- * });
1849
- * const tenantHandler = new TenantHandler(client);
1850
- * ```
1851
- *
1852
- * @group Tenant Management
1853
- */
1854
- constructor(omnibaseClient) {
1855
- this.invites = new TenantInviteManager(omnibaseClient);
1856
- this.manage = new TenantManger(omnibaseClient);
1857
- this.subscriptions = new TenantSubscriptionManager(omnibaseClient);
1858
- this.user = new TenantUserManager(omnibaseClient);
1859
- }
1860
- /**
1861
- * Tenant user management operations
1862
- *
1863
- * Provides access to operations for managing users within tenants, including
1864
- * removing users from the active tenant. All operations respect user permissions
1865
- * and tenant ownership rules.
1866
- *
1867
- * @example
1868
- * ```typescript
1869
- * // Remove a user from the active tenant
1870
- * await tenantHandler.user.remove({ user_id: 'user_123' });
1871
- * ```
1872
- *
1873
- * @since 0.6.0
1874
- * @group Tenant Management
1875
- */
1876
- user;
1877
- /**
1878
- * Core tenant management operations
1879
- *
1880
- * Provides access to tenant lifecycle operations including creation,
1881
- * deletion, and active tenant switching. All operations respect user
1882
- * permissions and tenant ownership rules.
1883
- *
1884
- * @example
1885
- * ```typescript
1886
- * // Create a new tenant
1887
- * const tenant = await tenantHandler.manage.createTenant({
1888
- * name: 'New Company',
1889
- * billing_email: 'billing@newcompany.com',
1890
- * user_id: 'user_456'
1891
- * });
1892
- *
1893
- * // Switch to the tenant
1894
- * await tenantHandler.manage.switchActiveTenant(tenant.data.tenant.id);
1895
- *
1896
- * // Delete the tenant (owner only)
1897
- * await tenantHandler.manage.deleteTenant(tenant.data.tenant.id);
1898
- * ```
1899
- */
1900
- manage;
1901
- /**
1902
- * Tenant invitation management operations
1903
- *
1904
- * Provides access to user invitation functionality including creating
1905
- * invitations for new users and accepting existing invitations.
1906
- * Supports role-based access control and secure token-based workflows.
1907
- *
1908
- * @example
1909
- * ```typescript
1910
- * // Create an invitation
1911
- * const invite = await tenantHandler.invites.create({
1912
- * email: 'newuser@company.com',
1913
- * role: 'admin',
1914
- * invite_url: 'https://yourapp.com/accept-invite'
1915
- * });
1916
- *
1917
- * // Accept an invitation (from the invited user's session)
1918
- * const result = await tenantHandler.invites.accept('invite_token_xyz');
1919
- * ```
1920
- */
1921
- invites;
1922
- /**
1923
- * Tenant subscription and billing management
1924
- *
1925
- * Provides access to subscription data and billing status for the
1926
- * active tenant, including legacy price detection and payment method
1927
- * verification. All operations are automatically scoped to the user's
1928
- * currently active tenant.
1929
- *
1930
- * @example
1931
- * ```typescript
1932
- * // Get active subscriptions
1933
- * const subs = await tenantHandler.subscriptions.getActive();
1934
- *
1935
- * // Check billing status
1936
- * const status = await tenantHandler.subscriptions.getBillingStatus();
1937
- * if (!status.data.has_billing_info) {
1938
- * console.log('No payment method configured');
1939
- * }
1940
- * ```
1941
- *
1942
- * @since 0.6.0
1943
- * @group Tenant Management
1944
- */
1945
- subscriptions;
1946
- };
1947
-
1948
- // src/client.ts
1949
- var OmnibaseClient = class {
1950
- constructor(config) {
1951
- this.config = config;
1952
- this.permissions = new PermissionsClient(this.config.api_url, this);
1953
- }
1954
- /**
1955
- * Main payment handler for all payment-related operations
1956
- *
1957
- * This class serves as the central coordinator for all payment functionality,
1958
- * providing access to checkout sessions, billing configuration, customer portals,
1959
- * and usage tracking. It handles the low-level HTTP communication with the
1960
- * payment API and delegates specific operations to specialized managers.
1961
- *
1962
- * The handler automatically manages authentication, request formatting, and
1963
- * provides a consistent interface across all payment operations.
1964
- *
1965
- * @example
1966
- * ```typescript
1967
- * // Create a checkout session (mode auto-detected from price)
1968
- * const checkout = await omnibase.payments.checkout.createSession({
1969
- * price_id: 'price_123',
1970
- * success_url: 'https://app.com/success',
1971
- * cancel_url: 'https://app.com/cancel'
1972
- * });
1973
- *
1974
- * // Get available products
1975
- * const products = await omnibase.payments.config.getAvailableProducts();
1976
- * ```
1977
- */
1978
- payments = new PaymentHandler(this);
1979
- /**
1980
- * Main tenant management handler
1981
- *
1982
- * This is the primary entry point for all tenant-related operations in the
1983
- * Omnibase SDK. It provides a unified interface to tenant management,
1984
- * user management, and invitation functionality through dedicated manager instances.
1985
- *
1986
- * The handler follows the composition pattern, combining specialized managers
1987
- * for different aspects of tenant functionality:
1988
- * - `manage`: Core tenant operations (create, delete, switch)
1989
- * - `invites`: User invitation management (create, accept)
1990
- * - `user`: Tenant user operations (remove, update role)
1991
- *
1992
- * All operations are performed within the context of the authenticated user
1993
- * and respect tenant-level permissions and row-level security policies.
1994
- *
1995
- * @example
1996
- * ```typescript
1997
- * // Create a new tenant
1998
- * const tenant = await omnibase.tenants.manage.createTenant({
1999
- * name: 'My Company',
2000
- * billing_email: 'billing@company.com',
2001
- * user_id: 'user_123'
2002
- * });
2003
- *
2004
- * // Invite users to the tenant
2005
- * const invite = await omnibase.tenants.invites.create({
2006
- * email: 'colleague@company.com',
2007
- * role: 'member',
2008
- * invite_url: 'https://yourapp.com/accept-invite'
2009
- * });
2010
- *
2011
- * // Switch to the new tenant
2012
- * await omnibase.tenants.manage.switchActiveTenant(tenant.data.tenant.id);
2013
- * ```
2014
- *
2015
- * @since 0.6.0
2016
- * @public
2017
- * @group Tenant Management
2018
- */
2019
- tenants = new TenantHandler(this);
2020
- /**
2021
- * Client for managing permissions and relationships using Ory Keto
2022
- *
2023
- * This client provides access to Ory Keto's permission system, allowing you to
2024
- * create, manage, and check relationships between subjects and objects. It handles
2025
- * both read operations (permission checks) and write operations (relationship management).
2026
- *
2027
- * The client automatically configures separate endpoints for read and write operations
2028
- * to optimize performance and security by following Ory Keto's recommended architecture.
2029
- *
2030
- * @example
2031
- * ```typescript
2032
- * // Check if a user can view a tenant
2033
- * const canView = await omnibase.permissions.permissions.checkPermission(
2034
- * undefined,
2035
- * {
2036
- * namespace: 'Tenant',
2037
- * object: 'tenant_123',
2038
- * relation: 'view',
2039
- * subjectId: 'user_456'
2040
- * }
2041
- * );
2042
- *
2043
- * if (canView.data.allowed) {
2044
- * console.log('User can view the tenant');
2045
- * }
2046
- *
2047
- * // Create a relationship making a user an owner of a tenant
2048
- * await omnibase.permissions.relationships.createRelationship(
2049
- * undefined,
2050
- * {
2051
- * namespace: 'Tenant',
2052
- * object: 'tenant_123',
2053
- * relation: 'owners',
2054
- * subjectId: 'user_456'
2055
- * }
2056
- * );
2057
- * ```
2058
- *
2059
- * @since 0.6.0
2060
- * @public
2061
- * @group Permissions
2062
- */
2063
- permissions;
2064
- /**
2065
- * Storage client for file upload/download operations
2066
- *
2067
- * @example
2068
- * ```typescript
2069
- * // Upload with metadata
2070
- * await omnibase.storage.bucket('documents').upload(
2071
- * 'report.pdf',
2072
- * file,
2073
- * { metadata: { department: 'engineering' } }
2074
- * );
2075
- * ```
2076
- */
2077
- storage = new StorageClient(this);
2078
- async fetch(endpoint, options = {}) {
2079
- if (this.config.fetch)
2080
- return this.config.fetch(this.config.api_url + endpoint, options);
2081
- return fetch(this.config.api_url + endpoint, {
2082
- ...options,
2083
- credentials: "include"
2084
- });
2085
- }
2086
- };
2087
- // Annotate the CommonJS export names for ESM import in node:
2088
- 0 && (module.exports = {
2089
- OmnibaseClient,
2090
- PermissionsClient,
2091
- RolesHandler,
2092
- StorageClient
2093
- });