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