@omnibase/core-js 0.7.6 → 0.8.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.
@@ -79,6 +79,21 @@ type CheckoutOptions = {
79
79
  success_url: string;
80
80
  /** URL to redirect to if the user cancels the checkout */
81
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;
82
97
  };
83
98
  /**
84
99
  * Response from creating a checkout session
@@ -1451,97 +1466,80 @@ declare class RolesHandler {
1451
1466
  /**
1452
1467
  * Client for managing permissions and relationships using Ory Keto
1453
1468
  *
1454
- * This client provides access to Ory Keto's permission system, allowing you to
1455
- * create, manage, and check relationships between subjects and objects. It handles
1456
- * both read operations (permission checks) and write operations (relationship management).
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`
1457
1476
  *
1458
- * The client automatically configures separate endpoints for read and write operations
1459
- * to optimize performance and security by following Ory Keto's recommended architecture.
1477
+ * This separation optimizes performance and security by following Ory Keto's recommended architecture.
1460
1478
  *
1461
1479
  * @example
1462
- * Basic permission checking:
1480
+ * Initialize the permissions client:
1463
1481
  * ```typescript
1464
- * import { PermissionsClient } from '@omnibase/core-js/permissions';
1482
+ * import { OmnibaseClient } from '@omnibase/core-js';
1465
1483
  *
1466
- * const permissionsClient = new PermissionsClient('https://api.example.com');
1484
+ * const omnibase = new OmnibaseClient({
1485
+ * apiUrl: 'https://api.example.com'
1486
+ * });
1467
1487
  *
1488
+ * // Access permissions client
1489
+ * const permissions = omnibase.permissions;
1490
+ * ```
1491
+ *
1492
+ * @example
1493
+ * Check if a user has permission:
1494
+ * ```typescript
1468
1495
  * // Check if a user can view a tenant
1469
- * const canView = await permissionsClient.permissions.checkPermission(
1470
- * undefined,
1471
- * {
1472
- * namespace: 'Tenant',
1473
- * object: 'tenant_123',
1474
- * relation: 'view',
1475
- * subjectId: 'user_456'
1476
- * }
1477
- * );
1496
+ * const result = await omnibase.permissions.permissions.checkPermission({
1497
+ * namespace: 'Tenant',
1498
+ * object: 'tenant_123',
1499
+ * relation: 'view',
1500
+ * subjectId: 'user_456'
1501
+ * });
1478
1502
  *
1479
- * if (canView.data.allowed) {
1503
+ * if (result.data.allowed) {
1480
1504
  * console.log('User can view the tenant');
1481
1505
  * }
1482
1506
  * ```
1483
1507
  *
1484
1508
  * @example
1485
- * Creating tenant relationships:
1509
+ * Create relationships:
1486
1510
  * ```typescript
1487
- * // Create a relationship making a user an owner of a tenant
1488
- * await permissionsClient.relationships.createRelationship(
1489
- * undefined,
1490
- * {
1491
- * namespace: 'Tenant',
1492
- * object: 'tenant_123',
1493
- * relation: 'owners',
1494
- * subjectId: 'user_456'
1495
- * }
1496
- * );
1497
- *
1498
- * // Now the user has owner permissions on the tenant
1499
- * console.log('User is now an owner of the tenant');
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
+ * });
1500
1518
  * ```
1501
1519
  *
1502
1520
  * @example
1503
- * Complex tenant permission management:
1521
+ * Query existing relationships:
1504
1522
  * ```typescript
1505
- * const tenantId = 'tenant_123';
1506
- * const userId = 'user_456';
1507
- *
1508
- * // Grant admin permissions to a user
1509
- * await permissionsClient.relationships.createRelationship(
1510
- * undefined,
1511
- * {
1512
- * namespace: 'Tenant',
1513
- * object: tenantId,
1514
- * relation: 'admins',
1515
- * subjectId: userId
1516
- * }
1517
- * );
1518
- *
1519
- * // Check if user can manage members (admins and owners can)
1520
- * const canManageMembers = await permissionsClient.permissions.checkPermission(
1521
- * undefined,
1522
- * {
1523
- * namespace: 'Tenant',
1524
- * object: tenantId,
1525
- * relation: 'manage_members',
1526
- * subjectId: userId
1527
- * }
1528
- * );
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
1529
  *
1530
- * if (canManageMembers.data.allowed) {
1531
- * // User can invite/remove members
1532
- * console.log('User can manage tenant members');
1533
- * }
1530
+ * console.log('Tenant members:', relationships.data.relation_tuples);
1531
+ * ```
1534
1532
  *
1535
- * // Later, remove admin permissions
1536
- * await permissionsClient.relationships.deleteRelationships(
1537
- * undefined,
1538
- * {
1539
- * namespace: 'Tenant',
1540
- * object: tenantId,
1541
- * relation: 'admins',
1542
- * subjectId: userId
1543
- * }
1544
- * );
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
+ * });
1545
1543
  * ```
1546
1544
  *
1547
1545
  * @since 1.0.0
@@ -1587,25 +1585,56 @@ declare class PermissionsClient {
1587
1585
  * on an object. This API handles read operations and is optimized for fast
1588
1586
  * permission checks in your application logic.
1589
1587
  *
1588
+ * All operations are proxied through Omnibase's API at `/api/v1/permissions/read`.
1589
+ *
1590
1590
  * Key methods:
1591
- * - `checkPermission()` - Checks if a subject has permission on an object
1592
- * - `checkPermissionOrError()` - Same as above but throws error if denied
1593
- * - `expandPermissions()` - Expands relationships to show all granted permissions
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
1594
1595
  *
1595
1596
  * @example
1597
+ * Check a single permission:
1596
1598
  * ```typescript
1597
- * // Check permission
1598
- * const result = await client.permissions.checkPermission(
1599
- * undefined,
1600
- * {
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({
1601
1628
  * namespace: 'Tenant',
1602
1629
  * object: 'tenant_123',
1603
- * relation: 'view',
1630
+ * relation: 'edit',
1604
1631
  * subjectId: 'user_456'
1605
- * }
1606
- * );
1607
- *
1608
- * console.log('Has permission:', result.data.allowed);
1632
+ * });
1633
+ * // Permission granted
1634
+ * } catch (error) {
1635
+ * // Permission denied
1636
+ * console.error('Access denied');
1637
+ * }
1609
1638
  * ```
1610
1639
  *
1611
1640
  * @since 1.0.0
@@ -1619,20 +1648,34 @@ declare class PermissionsClient {
1619
1648
  * and managing role assignments. Works alongside the Keto-based
1620
1649
  * permissions system to provide dynamic RBAC capabilities.
1621
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
+ *
1622
1655
  * @example
1656
+ * Create a custom role:
1623
1657
  * ```typescript
1624
- * // Create a custom role
1625
1658
  * const role = await omnibase.permissions.roles.create({
1626
1659
  * role_name: 'billing_manager',
1627
1660
  * permissions: ['tenant#manage_billing', 'tenant#view_invoices']
1628
1661
  * });
1662
+ * ```
1629
1663
  *
1630
- * // Assign role to user
1664
+ * @example
1665
+ * Assign role to a user:
1666
+ * ```typescript
1631
1667
  * await omnibase.permissions.roles.assign('user_123', {
1632
1668
  * role_id: role.id
1633
1669
  * });
1634
1670
  * ```
1635
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
+ *
1636
1679
  * @since 0.7.0
1637
1680
  * @group Roles
1638
1681
  */
@@ -1641,19 +1684,43 @@ declare class PermissionsClient {
1641
1684
  * Creates a new PermissionsClient instance
1642
1685
  *
1643
1686
  * Initializes the client with separate endpoints for read and write operations.
1644
- * The client automatically appends the appropriate Keto API paths to the base URL
1645
- * for optimal performance and security separation.
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`
1646
1691
  *
1647
- * @param apiBaseUrl - The base URL for your Omnibase API instance
1648
- * @param client - The main OmnibaseClient instance (for roles handler)
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)
1649
1697
  *
1650
1698
  * @throws {Error} When the base URL is invalid or cannot be reached
1651
1699
  *
1652
1700
  * @example
1701
+ * Direct instantiation (not recommended - use OmnibaseClient instead):
1653
1702
  * ```typescript
1654
1703
  * const client = new PermissionsClient('https://api.example.com', omnibaseClient);
1655
1704
  * ```
1656
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
+ *
1657
1724
  * @since 1.0.0
1658
1725
  * @group Client
1659
1726
  */
@@ -79,6 +79,21 @@ type CheckoutOptions = {
79
79
  success_url: string;
80
80
  /** URL to redirect to if the user cancels the checkout */
81
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;
82
97
  };
83
98
  /**
84
99
  * Response from creating a checkout session
@@ -1451,97 +1466,80 @@ declare class RolesHandler {
1451
1466
  /**
1452
1467
  * Client for managing permissions and relationships using Ory Keto
1453
1468
  *
1454
- * This client provides access to Ory Keto's permission system, allowing you to
1455
- * create, manage, and check relationships between subjects and objects. It handles
1456
- * both read operations (permission checks) and write operations (relationship management).
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`
1457
1476
  *
1458
- * The client automatically configures separate endpoints for read and write operations
1459
- * to optimize performance and security by following Ory Keto's recommended architecture.
1477
+ * This separation optimizes performance and security by following Ory Keto's recommended architecture.
1460
1478
  *
1461
1479
  * @example
1462
- * Basic permission checking:
1480
+ * Initialize the permissions client:
1463
1481
  * ```typescript
1464
- * import { PermissionsClient } from '@omnibase/core-js/permissions';
1482
+ * import { OmnibaseClient } from '@omnibase/core-js';
1465
1483
  *
1466
- * const permissionsClient = new PermissionsClient('https://api.example.com');
1484
+ * const omnibase = new OmnibaseClient({
1485
+ * apiUrl: 'https://api.example.com'
1486
+ * });
1467
1487
  *
1488
+ * // Access permissions client
1489
+ * const permissions = omnibase.permissions;
1490
+ * ```
1491
+ *
1492
+ * @example
1493
+ * Check if a user has permission:
1494
+ * ```typescript
1468
1495
  * // Check if a user can view a tenant
1469
- * const canView = await permissionsClient.permissions.checkPermission(
1470
- * undefined,
1471
- * {
1472
- * namespace: 'Tenant',
1473
- * object: 'tenant_123',
1474
- * relation: 'view',
1475
- * subjectId: 'user_456'
1476
- * }
1477
- * );
1496
+ * const result = await omnibase.permissions.permissions.checkPermission({
1497
+ * namespace: 'Tenant',
1498
+ * object: 'tenant_123',
1499
+ * relation: 'view',
1500
+ * subjectId: 'user_456'
1501
+ * });
1478
1502
  *
1479
- * if (canView.data.allowed) {
1503
+ * if (result.data.allowed) {
1480
1504
  * console.log('User can view the tenant');
1481
1505
  * }
1482
1506
  * ```
1483
1507
  *
1484
1508
  * @example
1485
- * Creating tenant relationships:
1509
+ * Create relationships:
1486
1510
  * ```typescript
1487
- * // Create a relationship making a user an owner of a tenant
1488
- * await permissionsClient.relationships.createRelationship(
1489
- * undefined,
1490
- * {
1491
- * namespace: 'Tenant',
1492
- * object: 'tenant_123',
1493
- * relation: 'owners',
1494
- * subjectId: 'user_456'
1495
- * }
1496
- * );
1497
- *
1498
- * // Now the user has owner permissions on the tenant
1499
- * console.log('User is now an owner of the tenant');
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
+ * });
1500
1518
  * ```
1501
1519
  *
1502
1520
  * @example
1503
- * Complex tenant permission management:
1521
+ * Query existing relationships:
1504
1522
  * ```typescript
1505
- * const tenantId = 'tenant_123';
1506
- * const userId = 'user_456';
1507
- *
1508
- * // Grant admin permissions to a user
1509
- * await permissionsClient.relationships.createRelationship(
1510
- * undefined,
1511
- * {
1512
- * namespace: 'Tenant',
1513
- * object: tenantId,
1514
- * relation: 'admins',
1515
- * subjectId: userId
1516
- * }
1517
- * );
1518
- *
1519
- * // Check if user can manage members (admins and owners can)
1520
- * const canManageMembers = await permissionsClient.permissions.checkPermission(
1521
- * undefined,
1522
- * {
1523
- * namespace: 'Tenant',
1524
- * object: tenantId,
1525
- * relation: 'manage_members',
1526
- * subjectId: userId
1527
- * }
1528
- * );
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
1529
  *
1530
- * if (canManageMembers.data.allowed) {
1531
- * // User can invite/remove members
1532
- * console.log('User can manage tenant members');
1533
- * }
1530
+ * console.log('Tenant members:', relationships.data.relation_tuples);
1531
+ * ```
1534
1532
  *
1535
- * // Later, remove admin permissions
1536
- * await permissionsClient.relationships.deleteRelationships(
1537
- * undefined,
1538
- * {
1539
- * namespace: 'Tenant',
1540
- * object: tenantId,
1541
- * relation: 'admins',
1542
- * subjectId: userId
1543
- * }
1544
- * );
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
+ * });
1545
1543
  * ```
1546
1544
  *
1547
1545
  * @since 1.0.0
@@ -1587,25 +1585,56 @@ declare class PermissionsClient {
1587
1585
  * on an object. This API handles read operations and is optimized for fast
1588
1586
  * permission checks in your application logic.
1589
1587
  *
1588
+ * All operations are proxied through Omnibase's API at `/api/v1/permissions/read`.
1589
+ *
1590
1590
  * Key methods:
1591
- * - `checkPermission()` - Checks if a subject has permission on an object
1592
- * - `checkPermissionOrError()` - Same as above but throws error if denied
1593
- * - `expandPermissions()` - Expands relationships to show all granted permissions
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
1594
1595
  *
1595
1596
  * @example
1597
+ * Check a single permission:
1596
1598
  * ```typescript
1597
- * // Check permission
1598
- * const result = await client.permissions.checkPermission(
1599
- * undefined,
1600
- * {
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({
1601
1628
  * namespace: 'Tenant',
1602
1629
  * object: 'tenant_123',
1603
- * relation: 'view',
1630
+ * relation: 'edit',
1604
1631
  * subjectId: 'user_456'
1605
- * }
1606
- * );
1607
- *
1608
- * console.log('Has permission:', result.data.allowed);
1632
+ * });
1633
+ * // Permission granted
1634
+ * } catch (error) {
1635
+ * // Permission denied
1636
+ * console.error('Access denied');
1637
+ * }
1609
1638
  * ```
1610
1639
  *
1611
1640
  * @since 1.0.0
@@ -1619,20 +1648,34 @@ declare class PermissionsClient {
1619
1648
  * and managing role assignments. Works alongside the Keto-based
1620
1649
  * permissions system to provide dynamic RBAC capabilities.
1621
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
+ *
1622
1655
  * @example
1656
+ * Create a custom role:
1623
1657
  * ```typescript
1624
- * // Create a custom role
1625
1658
  * const role = await omnibase.permissions.roles.create({
1626
1659
  * role_name: 'billing_manager',
1627
1660
  * permissions: ['tenant#manage_billing', 'tenant#view_invoices']
1628
1661
  * });
1662
+ * ```
1629
1663
  *
1630
- * // Assign role to user
1664
+ * @example
1665
+ * Assign role to a user:
1666
+ * ```typescript
1631
1667
  * await omnibase.permissions.roles.assign('user_123', {
1632
1668
  * role_id: role.id
1633
1669
  * });
1634
1670
  * ```
1635
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
+ *
1636
1679
  * @since 0.7.0
1637
1680
  * @group Roles
1638
1681
  */
@@ -1641,19 +1684,43 @@ declare class PermissionsClient {
1641
1684
  * Creates a new PermissionsClient instance
1642
1685
  *
1643
1686
  * Initializes the client with separate endpoints for read and write operations.
1644
- * The client automatically appends the appropriate Keto API paths to the base URL
1645
- * for optimal performance and security separation.
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`
1646
1691
  *
1647
- * @param apiBaseUrl - The base URL for your Omnibase API instance
1648
- * @param client - The main OmnibaseClient instance (for roles handler)
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)
1649
1697
  *
1650
1698
  * @throws {Error} When the base URL is invalid or cannot be reached
1651
1699
  *
1652
1700
  * @example
1701
+ * Direct instantiation (not recommended - use OmnibaseClient instead):
1653
1702
  * ```typescript
1654
1703
  * const client = new PermissionsClient('https://api.example.com', omnibaseClient);
1655
1704
  * ```
1656
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
+ *
1657
1724
  * @since 1.0.0
1658
1725
  * @group Client
1659
1726
  */