@stackbe/sdk 0.7.2 → 0.7.4

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/dist/index.d.mts CHANGED
@@ -779,9 +779,13 @@ declare class CustomersClient {
779
779
  /**
780
780
  * Send a magic link to a customer for passwordless authentication.
781
781
  *
782
+ * @deprecated Use `stackbe.auth.sendMagicLink()` instead, which uses the app-specific endpoint
783
+ * and supports dev callback URLs.
784
+ *
782
785
  * @example
783
786
  * ```typescript
784
- * await stackbe.customers.sendMagicLink('user@example.com', {
787
+ * // Deprecated - use auth.sendMagicLink instead:
788
+ * await stackbe.auth.sendMagicLink('user@example.com', {
785
789
  * redirectUrl: 'https://myapp.com/dashboard'
786
790
  * });
787
791
  * ```
@@ -793,10 +797,14 @@ declare class CustomersClient {
793
797
  * Get the current session for a customer token.
794
798
  * Use this to validate tokens and get customer data.
795
799
  *
800
+ * @deprecated Use `stackbe.auth.getSession()` instead, which includes caching,
801
+ * tenant/org context extraction, and proper error handling.
802
+ *
796
803
  * @example
797
804
  * ```typescript
798
- * const session = await stackbe.customers.getSession(token);
799
- * console.log(session.customer.email);
805
+ * // Deprecated - use auth.getSession instead:
806
+ * const session = await stackbe.auth.getSession(token);
807
+ * console.log(session.customerId);
800
808
  * console.log(session.entitlements);
801
809
  * ```
802
810
  */
@@ -1413,6 +1421,8 @@ interface CreateFeatureRequestOptions {
1413
1421
  title: string;
1414
1422
  description?: string;
1415
1423
  category?: string;
1424
+ /** Customer ID for server-side creation with API key */
1425
+ customerId?: string;
1416
1426
  }
1417
1427
  interface ListFeatureRequestsOptions {
1418
1428
  status?: 'new' | 'under_review' | 'planned' | 'in_progress' | 'completed' | 'declined';
@@ -1422,10 +1432,11 @@ interface ListFeatureRequestsOptions {
1422
1432
  offset?: number;
1423
1433
  }
1424
1434
  interface FeatureRequestListResponse {
1425
- data: FeatureRequest[];
1435
+ items: FeatureRequest[];
1426
1436
  total: number;
1427
1437
  limit: number;
1428
- offset: number;
1438
+ page: number;
1439
+ hasMore: boolean;
1429
1440
  }
1430
1441
  interface InterestedCustomer {
1431
1442
  customerId: string;
@@ -1474,27 +1485,38 @@ declare class FeatureRequestsClient {
1474
1485
  * @example
1475
1486
  * ```typescript
1476
1487
  * // Get all feature requests
1477
- * const { data, total } = await stackbe.featureRequests.list();
1488
+ * const { items, total, hasMore } = await stackbe.featureRequests.list();
1478
1489
  *
1479
1490
  * // Filter by status
1480
1491
  * const planned = await stackbe.featureRequests.list({ status: 'planned' });
1481
1492
  *
1482
1493
  * // Sort by votes
1483
1494
  * const popular = await stackbe.featureRequests.list({ sortBy: 'votes' });
1495
+ *
1496
+ * // Paginate
1497
+ * const page2 = await stackbe.featureRequests.list({ offset: 50, limit: 50 });
1484
1498
  * ```
1485
1499
  */
1486
1500
  list(options?: ListFeatureRequestsOptions): Promise<FeatureRequestListResponse>;
1487
1501
  /**
1488
1502
  * Submit a new feature request.
1489
- * Requires customer session token.
1503
+ * Requires customer session token, OR API key with customerId.
1490
1504
  *
1491
1505
  * @example
1492
1506
  * ```typescript
1507
+ * // With customer session token
1493
1508
  * const request = await stackbe.featureRequests.create({
1494
1509
  * title: 'Dark mode support',
1495
1510
  * description: 'Would love to have a dark theme option',
1496
1511
  * category: 'UI',
1497
1512
  * });
1513
+ *
1514
+ * // With API key (server-side)
1515
+ * const request = await stackbe.featureRequests.create({
1516
+ * title: 'Dark mode support',
1517
+ * description: 'Would love to have a dark theme option',
1518
+ * customerId: 'cust_123',
1519
+ * });
1498
1520
  * ```
1499
1521
  */
1500
1522
  create(options: CreateFeatureRequestOptions): Promise<FeatureRequest>;
@@ -1547,17 +1569,25 @@ declare class FeatureRequestsClient {
1547
1569
  }>;
1548
1570
  /**
1549
1571
  * Add a comment to a feature request.
1550
- * Requires customer session token.
1572
+ * Requires customer session token, OR API key with customerId.
1551
1573
  *
1552
1574
  * @example
1553
1575
  * ```typescript
1576
+ * // With customer session token
1577
+ * await stackbe.featureRequests.addComment('req_123', {
1578
+ * content: 'This would be really helpful for my workflow!',
1579
+ * });
1580
+ *
1581
+ * // With API key (server-side)
1554
1582
  * await stackbe.featureRequests.addComment('req_123', {
1555
1583
  * content: 'This would be really helpful for my workflow!',
1584
+ * customerId: 'cust_456',
1556
1585
  * });
1557
1586
  * ```
1558
1587
  */
1559
1588
  addComment(requestId: string, options: {
1560
1589
  content: string;
1590
+ customerId?: string;
1561
1591
  }): Promise<FeatureRequestComment>;
1562
1592
  /**
1563
1593
  * Update a feature request status or category.
package/dist/index.d.ts CHANGED
@@ -779,9 +779,13 @@ declare class CustomersClient {
779
779
  /**
780
780
  * Send a magic link to a customer for passwordless authentication.
781
781
  *
782
+ * @deprecated Use `stackbe.auth.sendMagicLink()` instead, which uses the app-specific endpoint
783
+ * and supports dev callback URLs.
784
+ *
782
785
  * @example
783
786
  * ```typescript
784
- * await stackbe.customers.sendMagicLink('user@example.com', {
787
+ * // Deprecated - use auth.sendMagicLink instead:
788
+ * await stackbe.auth.sendMagicLink('user@example.com', {
785
789
  * redirectUrl: 'https://myapp.com/dashboard'
786
790
  * });
787
791
  * ```
@@ -793,10 +797,14 @@ declare class CustomersClient {
793
797
  * Get the current session for a customer token.
794
798
  * Use this to validate tokens and get customer data.
795
799
  *
800
+ * @deprecated Use `stackbe.auth.getSession()` instead, which includes caching,
801
+ * tenant/org context extraction, and proper error handling.
802
+ *
796
803
  * @example
797
804
  * ```typescript
798
- * const session = await stackbe.customers.getSession(token);
799
- * console.log(session.customer.email);
805
+ * // Deprecated - use auth.getSession instead:
806
+ * const session = await stackbe.auth.getSession(token);
807
+ * console.log(session.customerId);
800
808
  * console.log(session.entitlements);
801
809
  * ```
802
810
  */
@@ -1413,6 +1421,8 @@ interface CreateFeatureRequestOptions {
1413
1421
  title: string;
1414
1422
  description?: string;
1415
1423
  category?: string;
1424
+ /** Customer ID for server-side creation with API key */
1425
+ customerId?: string;
1416
1426
  }
1417
1427
  interface ListFeatureRequestsOptions {
1418
1428
  status?: 'new' | 'under_review' | 'planned' | 'in_progress' | 'completed' | 'declined';
@@ -1422,10 +1432,11 @@ interface ListFeatureRequestsOptions {
1422
1432
  offset?: number;
1423
1433
  }
1424
1434
  interface FeatureRequestListResponse {
1425
- data: FeatureRequest[];
1435
+ items: FeatureRequest[];
1426
1436
  total: number;
1427
1437
  limit: number;
1428
- offset: number;
1438
+ page: number;
1439
+ hasMore: boolean;
1429
1440
  }
1430
1441
  interface InterestedCustomer {
1431
1442
  customerId: string;
@@ -1474,27 +1485,38 @@ declare class FeatureRequestsClient {
1474
1485
  * @example
1475
1486
  * ```typescript
1476
1487
  * // Get all feature requests
1477
- * const { data, total } = await stackbe.featureRequests.list();
1488
+ * const { items, total, hasMore } = await stackbe.featureRequests.list();
1478
1489
  *
1479
1490
  * // Filter by status
1480
1491
  * const planned = await stackbe.featureRequests.list({ status: 'planned' });
1481
1492
  *
1482
1493
  * // Sort by votes
1483
1494
  * const popular = await stackbe.featureRequests.list({ sortBy: 'votes' });
1495
+ *
1496
+ * // Paginate
1497
+ * const page2 = await stackbe.featureRequests.list({ offset: 50, limit: 50 });
1484
1498
  * ```
1485
1499
  */
1486
1500
  list(options?: ListFeatureRequestsOptions): Promise<FeatureRequestListResponse>;
1487
1501
  /**
1488
1502
  * Submit a new feature request.
1489
- * Requires customer session token.
1503
+ * Requires customer session token, OR API key with customerId.
1490
1504
  *
1491
1505
  * @example
1492
1506
  * ```typescript
1507
+ * // With customer session token
1493
1508
  * const request = await stackbe.featureRequests.create({
1494
1509
  * title: 'Dark mode support',
1495
1510
  * description: 'Would love to have a dark theme option',
1496
1511
  * category: 'UI',
1497
1512
  * });
1513
+ *
1514
+ * // With API key (server-side)
1515
+ * const request = await stackbe.featureRequests.create({
1516
+ * title: 'Dark mode support',
1517
+ * description: 'Would love to have a dark theme option',
1518
+ * customerId: 'cust_123',
1519
+ * });
1498
1520
  * ```
1499
1521
  */
1500
1522
  create(options: CreateFeatureRequestOptions): Promise<FeatureRequest>;
@@ -1547,17 +1569,25 @@ declare class FeatureRequestsClient {
1547
1569
  }>;
1548
1570
  /**
1549
1571
  * Add a comment to a feature request.
1550
- * Requires customer session token.
1572
+ * Requires customer session token, OR API key with customerId.
1551
1573
  *
1552
1574
  * @example
1553
1575
  * ```typescript
1576
+ * // With customer session token
1577
+ * await stackbe.featureRequests.addComment('req_123', {
1578
+ * content: 'This would be really helpful for my workflow!',
1579
+ * });
1580
+ *
1581
+ * // With API key (server-side)
1554
1582
  * await stackbe.featureRequests.addComment('req_123', {
1555
1583
  * content: 'This would be really helpful for my workflow!',
1584
+ * customerId: 'cust_456',
1556
1585
  * });
1557
1586
  * ```
1558
1587
  */
1559
1588
  addComment(requestId: string, options: {
1560
1589
  content: string;
1590
+ customerId?: string;
1561
1591
  }): Promise<FeatureRequestComment>;
1562
1592
  /**
1563
1593
  * Update a feature request status or category.
package/dist/index.js CHANGED
@@ -566,9 +566,13 @@ var CustomersClient = class {
566
566
  /**
567
567
  * Send a magic link to a customer for passwordless authentication.
568
568
  *
569
+ * @deprecated Use `stackbe.auth.sendMagicLink()` instead, which uses the app-specific endpoint
570
+ * and supports dev callback URLs.
571
+ *
569
572
  * @example
570
573
  * ```typescript
571
- * await stackbe.customers.sendMagicLink('user@example.com', {
574
+ * // Deprecated - use auth.sendMagicLink instead:
575
+ * await stackbe.auth.sendMagicLink('user@example.com', {
572
576
  * redirectUrl: 'https://myapp.com/dashboard'
573
577
  * });
574
578
  * ```
@@ -583,15 +587,28 @@ var CustomersClient = class {
583
587
  * Get the current session for a customer token.
584
588
  * Use this to validate tokens and get customer data.
585
589
  *
590
+ * @deprecated Use `stackbe.auth.getSession()` instead, which includes caching,
591
+ * tenant/org context extraction, and proper error handling.
592
+ *
586
593
  * @example
587
594
  * ```typescript
588
- * const session = await stackbe.customers.getSession(token);
589
- * console.log(session.customer.email);
595
+ * // Deprecated - use auth.getSession instead:
596
+ * const session = await stackbe.auth.getSession(token);
597
+ * console.log(session.customerId);
590
598
  * console.log(session.entitlements);
591
599
  * ```
592
600
  */
593
601
  async getSession(token) {
594
- return this.http.get("/v1/auth/session", void 0);
602
+ const response = await fetch(`${this.http.baseUrl}/v1/apps/${this.appId}/auth/session`, {
603
+ headers: {
604
+ Authorization: `Bearer ${token}`,
605
+ "Content-Type": "application/json"
606
+ }
607
+ });
608
+ if (!response.ok) {
609
+ throw new Error("Failed to get session");
610
+ }
611
+ return response.json();
595
612
  }
596
613
  };
597
614
 
@@ -1473,13 +1490,16 @@ var FeatureRequestsClient = class {
1473
1490
  * @example
1474
1491
  * ```typescript
1475
1492
  * // Get all feature requests
1476
- * const { data, total } = await stackbe.featureRequests.list();
1493
+ * const { items, total, hasMore } = await stackbe.featureRequests.list();
1477
1494
  *
1478
1495
  * // Filter by status
1479
1496
  * const planned = await stackbe.featureRequests.list({ status: 'planned' });
1480
1497
  *
1481
1498
  * // Sort by votes
1482
1499
  * const popular = await stackbe.featureRequests.list({ sortBy: 'votes' });
1500
+ *
1501
+ * // Paginate
1502
+ * const page2 = await stackbe.featureRequests.list({ offset: 50, limit: 50 });
1483
1503
  * ```
1484
1504
  */
1485
1505
  async list(options = {}) {
@@ -1496,15 +1516,23 @@ var FeatureRequestsClient = class {
1496
1516
  }
1497
1517
  /**
1498
1518
  * Submit a new feature request.
1499
- * Requires customer session token.
1519
+ * Requires customer session token, OR API key with customerId.
1500
1520
  *
1501
1521
  * @example
1502
1522
  * ```typescript
1523
+ * // With customer session token
1503
1524
  * const request = await stackbe.featureRequests.create({
1504
1525
  * title: 'Dark mode support',
1505
1526
  * description: 'Would love to have a dark theme option',
1506
1527
  * category: 'UI',
1507
1528
  * });
1529
+ *
1530
+ * // With API key (server-side)
1531
+ * const request = await stackbe.featureRequests.create({
1532
+ * title: 'Dark mode support',
1533
+ * description: 'Would love to have a dark theme option',
1534
+ * customerId: 'cust_123',
1535
+ * });
1508
1536
  * ```
1509
1537
  */
1510
1538
  async create(options) {
@@ -1567,13 +1595,20 @@ var FeatureRequestsClient = class {
1567
1595
  }
1568
1596
  /**
1569
1597
  * Add a comment to a feature request.
1570
- * Requires customer session token.
1598
+ * Requires customer session token, OR API key with customerId.
1571
1599
  *
1572
1600
  * @example
1573
1601
  * ```typescript
1602
+ * // With customer session token
1574
1603
  * await stackbe.featureRequests.addComment('req_123', {
1575
1604
  * content: 'This would be really helpful for my workflow!',
1576
1605
  * });
1606
+ *
1607
+ * // With API key (server-side)
1608
+ * await stackbe.featureRequests.addComment('req_123', {
1609
+ * content: 'This would be really helpful for my workflow!',
1610
+ * customerId: 'cust_456',
1611
+ * });
1577
1612
  * ```
1578
1613
  */
1579
1614
  async addComment(requestId, options) {
package/dist/index.mjs CHANGED
@@ -529,9 +529,13 @@ var CustomersClient = class {
529
529
  /**
530
530
  * Send a magic link to a customer for passwordless authentication.
531
531
  *
532
+ * @deprecated Use `stackbe.auth.sendMagicLink()` instead, which uses the app-specific endpoint
533
+ * and supports dev callback URLs.
534
+ *
532
535
  * @example
533
536
  * ```typescript
534
- * await stackbe.customers.sendMagicLink('user@example.com', {
537
+ * // Deprecated - use auth.sendMagicLink instead:
538
+ * await stackbe.auth.sendMagicLink('user@example.com', {
535
539
  * redirectUrl: 'https://myapp.com/dashboard'
536
540
  * });
537
541
  * ```
@@ -546,15 +550,28 @@ var CustomersClient = class {
546
550
  * Get the current session for a customer token.
547
551
  * Use this to validate tokens and get customer data.
548
552
  *
553
+ * @deprecated Use `stackbe.auth.getSession()` instead, which includes caching,
554
+ * tenant/org context extraction, and proper error handling.
555
+ *
549
556
  * @example
550
557
  * ```typescript
551
- * const session = await stackbe.customers.getSession(token);
552
- * console.log(session.customer.email);
558
+ * // Deprecated - use auth.getSession instead:
559
+ * const session = await stackbe.auth.getSession(token);
560
+ * console.log(session.customerId);
553
561
  * console.log(session.entitlements);
554
562
  * ```
555
563
  */
556
564
  async getSession(token) {
557
- return this.http.get("/v1/auth/session", void 0);
565
+ const response = await fetch(`${this.http.baseUrl}/v1/apps/${this.appId}/auth/session`, {
566
+ headers: {
567
+ Authorization: `Bearer ${token}`,
568
+ "Content-Type": "application/json"
569
+ }
570
+ });
571
+ if (!response.ok) {
572
+ throw new Error("Failed to get session");
573
+ }
574
+ return response.json();
558
575
  }
559
576
  };
560
577
 
@@ -1436,13 +1453,16 @@ var FeatureRequestsClient = class {
1436
1453
  * @example
1437
1454
  * ```typescript
1438
1455
  * // Get all feature requests
1439
- * const { data, total } = await stackbe.featureRequests.list();
1456
+ * const { items, total, hasMore } = await stackbe.featureRequests.list();
1440
1457
  *
1441
1458
  * // Filter by status
1442
1459
  * const planned = await stackbe.featureRequests.list({ status: 'planned' });
1443
1460
  *
1444
1461
  * // Sort by votes
1445
1462
  * const popular = await stackbe.featureRequests.list({ sortBy: 'votes' });
1463
+ *
1464
+ * // Paginate
1465
+ * const page2 = await stackbe.featureRequests.list({ offset: 50, limit: 50 });
1446
1466
  * ```
1447
1467
  */
1448
1468
  async list(options = {}) {
@@ -1459,15 +1479,23 @@ var FeatureRequestsClient = class {
1459
1479
  }
1460
1480
  /**
1461
1481
  * Submit a new feature request.
1462
- * Requires customer session token.
1482
+ * Requires customer session token, OR API key with customerId.
1463
1483
  *
1464
1484
  * @example
1465
1485
  * ```typescript
1486
+ * // With customer session token
1466
1487
  * const request = await stackbe.featureRequests.create({
1467
1488
  * title: 'Dark mode support',
1468
1489
  * description: 'Would love to have a dark theme option',
1469
1490
  * category: 'UI',
1470
1491
  * });
1492
+ *
1493
+ * // With API key (server-side)
1494
+ * const request = await stackbe.featureRequests.create({
1495
+ * title: 'Dark mode support',
1496
+ * description: 'Would love to have a dark theme option',
1497
+ * customerId: 'cust_123',
1498
+ * });
1471
1499
  * ```
1472
1500
  */
1473
1501
  async create(options) {
@@ -1530,13 +1558,20 @@ var FeatureRequestsClient = class {
1530
1558
  }
1531
1559
  /**
1532
1560
  * Add a comment to a feature request.
1533
- * Requires customer session token.
1561
+ * Requires customer session token, OR API key with customerId.
1534
1562
  *
1535
1563
  * @example
1536
1564
  * ```typescript
1565
+ * // With customer session token
1537
1566
  * await stackbe.featureRequests.addComment('req_123', {
1538
1567
  * content: 'This would be really helpful for my workflow!',
1539
1568
  * });
1569
+ *
1570
+ * // With API key (server-side)
1571
+ * await stackbe.featureRequests.addComment('req_123', {
1572
+ * content: 'This would be really helpful for my workflow!',
1573
+ * customerId: 'cust_456',
1574
+ * });
1540
1575
  * ```
1541
1576
  */
1542
1577
  async addComment(requestId, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stackbe/sdk",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "Official JavaScript/TypeScript SDK for StackBE - the billing backend for your side project",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",