@stackbe/sdk 0.7.2 → 0.7.3
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 +31 -5
- package/dist/index.d.ts +31 -5
- package/dist/index.js +38 -6
- package/dist/index.mjs +38 -6
- package/package.json +1 -1
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
|
-
*
|
|
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
|
-
*
|
|
799
|
-
*
|
|
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';
|
|
@@ -1486,15 +1496,23 @@ declare class FeatureRequestsClient {
|
|
|
1486
1496
|
list(options?: ListFeatureRequestsOptions): Promise<FeatureRequestListResponse>;
|
|
1487
1497
|
/**
|
|
1488
1498
|
* Submit a new feature request.
|
|
1489
|
-
* Requires customer session token.
|
|
1499
|
+
* Requires customer session token, OR API key with customerId.
|
|
1490
1500
|
*
|
|
1491
1501
|
* @example
|
|
1492
1502
|
* ```typescript
|
|
1503
|
+
* // With customer session token
|
|
1493
1504
|
* const request = await stackbe.featureRequests.create({
|
|
1494
1505
|
* title: 'Dark mode support',
|
|
1495
1506
|
* description: 'Would love to have a dark theme option',
|
|
1496
1507
|
* category: 'UI',
|
|
1497
1508
|
* });
|
|
1509
|
+
*
|
|
1510
|
+
* // With API key (server-side)
|
|
1511
|
+
* const request = await stackbe.featureRequests.create({
|
|
1512
|
+
* title: 'Dark mode support',
|
|
1513
|
+
* description: 'Would love to have a dark theme option',
|
|
1514
|
+
* customerId: 'cust_123',
|
|
1515
|
+
* });
|
|
1498
1516
|
* ```
|
|
1499
1517
|
*/
|
|
1500
1518
|
create(options: CreateFeatureRequestOptions): Promise<FeatureRequest>;
|
|
@@ -1547,17 +1565,25 @@ declare class FeatureRequestsClient {
|
|
|
1547
1565
|
}>;
|
|
1548
1566
|
/**
|
|
1549
1567
|
* Add a comment to a feature request.
|
|
1550
|
-
* Requires customer session token.
|
|
1568
|
+
* Requires customer session token, OR API key with customerId.
|
|
1551
1569
|
*
|
|
1552
1570
|
* @example
|
|
1553
1571
|
* ```typescript
|
|
1572
|
+
* // With customer session token
|
|
1554
1573
|
* await stackbe.featureRequests.addComment('req_123', {
|
|
1555
1574
|
* content: 'This would be really helpful for my workflow!',
|
|
1556
1575
|
* });
|
|
1576
|
+
*
|
|
1577
|
+
* // With API key (server-side)
|
|
1578
|
+
* await stackbe.featureRequests.addComment('req_123', {
|
|
1579
|
+
* content: 'This would be really helpful for my workflow!',
|
|
1580
|
+
* customerId: 'cust_456',
|
|
1581
|
+
* });
|
|
1557
1582
|
* ```
|
|
1558
1583
|
*/
|
|
1559
1584
|
addComment(requestId: string, options: {
|
|
1560
1585
|
content: string;
|
|
1586
|
+
customerId?: string;
|
|
1561
1587
|
}): Promise<FeatureRequestComment>;
|
|
1562
1588
|
/**
|
|
1563
1589
|
* 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
|
-
*
|
|
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
|
-
*
|
|
799
|
-
*
|
|
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';
|
|
@@ -1486,15 +1496,23 @@ declare class FeatureRequestsClient {
|
|
|
1486
1496
|
list(options?: ListFeatureRequestsOptions): Promise<FeatureRequestListResponse>;
|
|
1487
1497
|
/**
|
|
1488
1498
|
* Submit a new feature request.
|
|
1489
|
-
* Requires customer session token.
|
|
1499
|
+
* Requires customer session token, OR API key with customerId.
|
|
1490
1500
|
*
|
|
1491
1501
|
* @example
|
|
1492
1502
|
* ```typescript
|
|
1503
|
+
* // With customer session token
|
|
1493
1504
|
* const request = await stackbe.featureRequests.create({
|
|
1494
1505
|
* title: 'Dark mode support',
|
|
1495
1506
|
* description: 'Would love to have a dark theme option',
|
|
1496
1507
|
* category: 'UI',
|
|
1497
1508
|
* });
|
|
1509
|
+
*
|
|
1510
|
+
* // With API key (server-side)
|
|
1511
|
+
* const request = await stackbe.featureRequests.create({
|
|
1512
|
+
* title: 'Dark mode support',
|
|
1513
|
+
* description: 'Would love to have a dark theme option',
|
|
1514
|
+
* customerId: 'cust_123',
|
|
1515
|
+
* });
|
|
1498
1516
|
* ```
|
|
1499
1517
|
*/
|
|
1500
1518
|
create(options: CreateFeatureRequestOptions): Promise<FeatureRequest>;
|
|
@@ -1547,17 +1565,25 @@ declare class FeatureRequestsClient {
|
|
|
1547
1565
|
}>;
|
|
1548
1566
|
/**
|
|
1549
1567
|
* Add a comment to a feature request.
|
|
1550
|
-
* Requires customer session token.
|
|
1568
|
+
* Requires customer session token, OR API key with customerId.
|
|
1551
1569
|
*
|
|
1552
1570
|
* @example
|
|
1553
1571
|
* ```typescript
|
|
1572
|
+
* // With customer session token
|
|
1554
1573
|
* await stackbe.featureRequests.addComment('req_123', {
|
|
1555
1574
|
* content: 'This would be really helpful for my workflow!',
|
|
1556
1575
|
* });
|
|
1576
|
+
*
|
|
1577
|
+
* // With API key (server-side)
|
|
1578
|
+
* await stackbe.featureRequests.addComment('req_123', {
|
|
1579
|
+
* content: 'This would be really helpful for my workflow!',
|
|
1580
|
+
* customerId: 'cust_456',
|
|
1581
|
+
* });
|
|
1557
1582
|
* ```
|
|
1558
1583
|
*/
|
|
1559
1584
|
addComment(requestId: string, options: {
|
|
1560
1585
|
content: string;
|
|
1586
|
+
customerId?: string;
|
|
1561
1587
|
}): Promise<FeatureRequestComment>;
|
|
1562
1588
|
/**
|
|
1563
1589
|
* 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
|
-
*
|
|
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
|
-
*
|
|
589
|
-
*
|
|
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
|
-
|
|
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
|
|
|
@@ -1496,15 +1513,23 @@ var FeatureRequestsClient = class {
|
|
|
1496
1513
|
}
|
|
1497
1514
|
/**
|
|
1498
1515
|
* Submit a new feature request.
|
|
1499
|
-
* Requires customer session token.
|
|
1516
|
+
* Requires customer session token, OR API key with customerId.
|
|
1500
1517
|
*
|
|
1501
1518
|
* @example
|
|
1502
1519
|
* ```typescript
|
|
1520
|
+
* // With customer session token
|
|
1503
1521
|
* const request = await stackbe.featureRequests.create({
|
|
1504
1522
|
* title: 'Dark mode support',
|
|
1505
1523
|
* description: 'Would love to have a dark theme option',
|
|
1506
1524
|
* category: 'UI',
|
|
1507
1525
|
* });
|
|
1526
|
+
*
|
|
1527
|
+
* // With API key (server-side)
|
|
1528
|
+
* const request = await stackbe.featureRequests.create({
|
|
1529
|
+
* title: 'Dark mode support',
|
|
1530
|
+
* description: 'Would love to have a dark theme option',
|
|
1531
|
+
* customerId: 'cust_123',
|
|
1532
|
+
* });
|
|
1508
1533
|
* ```
|
|
1509
1534
|
*/
|
|
1510
1535
|
async create(options) {
|
|
@@ -1567,13 +1592,20 @@ var FeatureRequestsClient = class {
|
|
|
1567
1592
|
}
|
|
1568
1593
|
/**
|
|
1569
1594
|
* Add a comment to a feature request.
|
|
1570
|
-
* Requires customer session token.
|
|
1595
|
+
* Requires customer session token, OR API key with customerId.
|
|
1571
1596
|
*
|
|
1572
1597
|
* @example
|
|
1573
1598
|
* ```typescript
|
|
1599
|
+
* // With customer session token
|
|
1574
1600
|
* await stackbe.featureRequests.addComment('req_123', {
|
|
1575
1601
|
* content: 'This would be really helpful for my workflow!',
|
|
1576
1602
|
* });
|
|
1603
|
+
*
|
|
1604
|
+
* // With API key (server-side)
|
|
1605
|
+
* await stackbe.featureRequests.addComment('req_123', {
|
|
1606
|
+
* content: 'This would be really helpful for my workflow!',
|
|
1607
|
+
* customerId: 'cust_456',
|
|
1608
|
+
* });
|
|
1577
1609
|
* ```
|
|
1578
1610
|
*/
|
|
1579
1611
|
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
|
-
*
|
|
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
|
-
*
|
|
552
|
-
*
|
|
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
|
-
|
|
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
|
|
|
@@ -1459,15 +1476,23 @@ var FeatureRequestsClient = class {
|
|
|
1459
1476
|
}
|
|
1460
1477
|
/**
|
|
1461
1478
|
* Submit a new feature request.
|
|
1462
|
-
* Requires customer session token.
|
|
1479
|
+
* Requires customer session token, OR API key with customerId.
|
|
1463
1480
|
*
|
|
1464
1481
|
* @example
|
|
1465
1482
|
* ```typescript
|
|
1483
|
+
* // With customer session token
|
|
1466
1484
|
* const request = await stackbe.featureRequests.create({
|
|
1467
1485
|
* title: 'Dark mode support',
|
|
1468
1486
|
* description: 'Would love to have a dark theme option',
|
|
1469
1487
|
* category: 'UI',
|
|
1470
1488
|
* });
|
|
1489
|
+
*
|
|
1490
|
+
* // With API key (server-side)
|
|
1491
|
+
* const request = await stackbe.featureRequests.create({
|
|
1492
|
+
* title: 'Dark mode support',
|
|
1493
|
+
* description: 'Would love to have a dark theme option',
|
|
1494
|
+
* customerId: 'cust_123',
|
|
1495
|
+
* });
|
|
1471
1496
|
* ```
|
|
1472
1497
|
*/
|
|
1473
1498
|
async create(options) {
|
|
@@ -1530,13 +1555,20 @@ var FeatureRequestsClient = class {
|
|
|
1530
1555
|
}
|
|
1531
1556
|
/**
|
|
1532
1557
|
* Add a comment to a feature request.
|
|
1533
|
-
* Requires customer session token.
|
|
1558
|
+
* Requires customer session token, OR API key with customerId.
|
|
1534
1559
|
*
|
|
1535
1560
|
* @example
|
|
1536
1561
|
* ```typescript
|
|
1562
|
+
* // With customer session token
|
|
1537
1563
|
* await stackbe.featureRequests.addComment('req_123', {
|
|
1538
1564
|
* content: 'This would be really helpful for my workflow!',
|
|
1539
1565
|
* });
|
|
1566
|
+
*
|
|
1567
|
+
* // With API key (server-side)
|
|
1568
|
+
* await stackbe.featureRequests.addComment('req_123', {
|
|
1569
|
+
* content: 'This would be really helpful for my workflow!',
|
|
1570
|
+
* customerId: 'cust_456',
|
|
1571
|
+
* });
|
|
1540
1572
|
* ```
|
|
1541
1573
|
*/
|
|
1542
1574
|
async addComment(requestId, options) {
|
package/package.json
CHANGED