spaps-sdk 1.6.6 → 1.6.7
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/CHANGELOG.md +4 -0
- package/README.md +15 -2
- package/dist/index.d.mts +9 -4
- package/dist/index.d.ts +9 -4
- package/dist/index.js +20 -2
- package/dist/index.mjs +20 -2
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,10 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
|
|
|
8
8
|
|
|
9
9
|
- No changes yet.
|
|
10
10
|
|
|
11
|
+
## [1.6.6] - 2026-04-20
|
|
12
|
+
|
|
13
|
+
- Docs: note the current `dayrate.getCheckoutStatus` SDK gap and align package metadata with the published version.
|
|
14
|
+
|
|
11
15
|
## [1.6.5] - 2026-04-05
|
|
12
16
|
|
|
13
17
|
- Docs: align package README metadata with published version.
|
package/README.md
CHANGED
|
@@ -53,6 +53,9 @@ const issues = await spaps.issueReporting.list({
|
|
|
53
53
|
console.log(auth.user.id, me.data.email, issues.total);
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
+
Issue-reporting reads are user-scoped in the stock SPAPS API. The SDK accepts `scope: "mine"`
|
|
57
|
+
for explicitness and rejects wider scopes until SPAPS exposes a dedicated tenant queue endpoint.
|
|
58
|
+
|
|
56
59
|
## Configuration
|
|
57
60
|
|
|
58
61
|
Constructor values take precedence over environment variables.
|
|
@@ -80,7 +83,7 @@ Relevant environment variables:
|
|
|
80
83
|
| `payments` | Checkout sessions, products, prices, subscriptions, and crypto helpers |
|
|
81
84
|
| `sessions` | Session lookup, validation, and lifecycle helpers |
|
|
82
85
|
| `secureMessages` | Secure-message create/list helpers |
|
|
83
|
-
| `issueReporting` | Status, history, create, update, and
|
|
86
|
+
| `issueReporting` | Status, history, create, update, reply, and voice-token flows |
|
|
84
87
|
| `email` | Template lookup, preview, and send helpers |
|
|
85
88
|
| `entitlements` | User and resource entitlement queries |
|
|
86
89
|
| `dayrate` | Availability and booking helpers |
|
|
@@ -107,6 +110,16 @@ await spaps.secureMessages.create({
|
|
|
107
110
|
});
|
|
108
111
|
```
|
|
109
112
|
|
|
113
|
+
### Issue Reporting Voice Token
|
|
114
|
+
|
|
115
|
+
Browser issue-reporting voice input should request a short-lived token from SPAPS instead of exposing an ElevenLabs API key.
|
|
116
|
+
|
|
117
|
+
```ts
|
|
118
|
+
const voiceToken = await spaps.issueReporting.createVoiceToken();
|
|
119
|
+
|
|
120
|
+
console.log(voiceToken.provider, voiceToken.model_id);
|
|
121
|
+
```
|
|
122
|
+
|
|
110
123
|
### Permission Helpers With Explicit Admin Config
|
|
111
124
|
|
|
112
125
|
```ts
|
|
@@ -202,7 +215,7 @@ npm run test:readme
|
|
|
202
215
|
## Metadata
|
|
203
216
|
|
|
204
217
|
- `package_name`: `spaps-sdk`
|
|
205
|
-
- `latest_version`: `1.6.
|
|
218
|
+
- `latest_version`: `1.6.6`
|
|
206
219
|
- `minimum_runtime`: `Node.js >=14.0.0`
|
|
207
220
|
- `api_base_url`: `https://api.sweetpotato.dev`
|
|
208
221
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as spaps_types from 'spaps-types';
|
|
2
|
-
import { ResourceType, Entitlement, CreateProductRequest, Product, UpdateProductRequest, CreatePriceRequest, Price, ProductSyncResult, CryptoReconcileRequest, CreateSecureMessageRequest, SecureMessage, IssueReportScope, IssueReportStatusResult, IssueReportStatus, IssueReportListResult, IssueReport, CreateIssueReportRequest, UpdateIssueReportRequest, ReplyIssueReportRequest, AuthResponse, User as User$1, CreateCryptoInvoiceRequest, CryptoInvoiceStatusSnapshot, CheckoutSession, DayrateAvailabilityResponse, DayrateBookingRequest, DayrateBookingResponse, DayrateMultiBookingRequest, DayrateMultiBookingResponse, Subscription, UsageBalance, VerifyCryptoWebhookSignatureOptions } from 'spaps-types';
|
|
3
|
-
export { AdminPermission, AdminRole, AdminUser, ApiResponse, AuthResponse, CheckoutSession, CreateCryptoInvoiceRequest, CreateIssueReportRequest, CreatePriceRequest, CreateProductRequest, CreateSecureMessageInput, CreateSecureMessageRequest, CryptoInvoice, CryptoInvoiceResponse, CryptoInvoiceStatusSnapshot, CryptoReconcileRequest, DayrateAvailabilityResponse, DayrateAvailableSlot, DayrateBookingRequest, DayrateBookingResponse, DayrateDayOfWeek, DayrateMultiBookingRequest, DayrateMultiBookingResponse, DayratePriceBreakdown, DayrateSlotType, Entitlement, IssueReport, IssueReportListResult, IssueReportStatus, IssueReportStatusResult, IssueReportTarget, LinkedIssueReportCase, Price, Product, ProductSyncResult, ReplyIssueReportRequest, ResourceType, SecureMessage, SecureMessageOutput, Subscription, TokenPair, UpdateIssueReportRequest, UpdateProductRequest, UsageBalance, User, UserProfile, UserRole, UserWallet, VerifyCryptoWebhookSignatureOptions, createSecureMessageRequestSchema, secureMessageMetadataSchema, secureMessageSchema } from 'spaps-types';
|
|
2
|
+
import { ResourceType, Entitlement, CreateProductRequest, Product, UpdateProductRequest, CreatePriceRequest, Price, ProductSyncResult, CryptoReconcileRequest, CreateSecureMessageRequest, SecureMessage, IssueReportScope, IssueReportStatusResult, IssueReportStatus, IssueReportListResult, IssueReport, CreateIssueReportRequest, IssueReportingVoiceTokenResult, UpdateIssueReportRequest, ReplyIssueReportRequest, AuthResponse, User as User$1, CreateCryptoInvoiceRequest, CryptoInvoiceStatusSnapshot, CheckoutSession, DayrateAvailabilityResponse, DayrateBookingRequest, DayrateBookingResponse, DayrateMultiBookingRequest, DayrateMultiBookingResponse, Subscription, UsageBalance, VerifyCryptoWebhookSignatureOptions } from 'spaps-types';
|
|
3
|
+
export { AdminPermission, AdminRole, AdminUser, ApiResponse, AuthResponse, CheckoutSession, CreateCryptoInvoiceRequest, CreateIssueReportRequest, CreatePriceRequest, CreateProductRequest, CreateSecureMessageInput, CreateSecureMessageRequest, CryptoInvoice, CryptoInvoiceResponse, CryptoInvoiceStatusSnapshot, CryptoReconcileRequest, DayrateAvailabilityResponse, DayrateAvailableSlot, DayrateBookingRequest, DayrateBookingResponse, DayrateDayOfWeek, DayrateMultiBookingRequest, DayrateMultiBookingResponse, DayratePriceBreakdown, DayrateSlotType, Entitlement, IssueReport, IssueReportListResult, IssueReportStatus, IssueReportStatusResult, IssueReportTarget, IssueReportingInputMode, IssueReportingVoiceProvider, IssueReportingVoiceTokenResult, LinkedIssueReportCase, Price, Product, ProductSyncResult, ReplyIssueReportRequest, ResourceType, SecureMessage, SecureMessageOutput, Subscription, TokenPair, UpdateIssueReportRequest, UpdateProductRequest, UsageBalance, User, UserProfile, UserRole, UserWallet, VerifyCryptoWebhookSignatureOptions, createSecureMessageRequestSchema, secureMessageMetadataSchema, secureMessageSchema } from 'spaps-types';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Permission checking utilities for SPAPS SDK
|
|
@@ -344,14 +344,15 @@ interface EntitlementCheckResult {
|
|
|
344
344
|
/** The matching entitlement, if any */
|
|
345
345
|
entitlement?: Entitlement;
|
|
346
346
|
}
|
|
347
|
+
type SupportedIssueReportScope = Extract<IssueReportScope, 'mine'>;
|
|
347
348
|
interface IssueReportListParams {
|
|
348
349
|
status?: IssueReportStatus;
|
|
349
|
-
scope?:
|
|
350
|
+
scope?: SupportedIssueReportScope;
|
|
350
351
|
limit?: number;
|
|
351
352
|
offset?: number;
|
|
352
353
|
}
|
|
353
354
|
interface IssueReportStatusParams {
|
|
354
|
-
scope?:
|
|
355
|
+
scope?: SupportedIssueReportScope;
|
|
355
356
|
}
|
|
356
357
|
|
|
357
358
|
declare class SPAPSClient<SecureMessageMetadata extends Record<string, any> = Record<string, any>> {
|
|
@@ -458,6 +459,10 @@ declare class SPAPSClient<SecureMessageMetadata extends Record<string, any> = Re
|
|
|
458
459
|
* Create a new canonical issue report.
|
|
459
460
|
*/
|
|
460
461
|
create: (payload: CreateIssueReportRequest) => Promise<IssueReport>;
|
|
462
|
+
/**
|
|
463
|
+
* Create a short-lived voice transcription token for issue reporting.
|
|
464
|
+
*/
|
|
465
|
+
createVoiceToken: () => Promise<IssueReportingVoiceTokenResult>;
|
|
461
466
|
/**
|
|
462
467
|
* Update the note for an unresolved issue report.
|
|
463
468
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as spaps_types from 'spaps-types';
|
|
2
|
-
import { ResourceType, Entitlement, CreateProductRequest, Product, UpdateProductRequest, CreatePriceRequest, Price, ProductSyncResult, CryptoReconcileRequest, CreateSecureMessageRequest, SecureMessage, IssueReportScope, IssueReportStatusResult, IssueReportStatus, IssueReportListResult, IssueReport, CreateIssueReportRequest, UpdateIssueReportRequest, ReplyIssueReportRequest, AuthResponse, User as User$1, CreateCryptoInvoiceRequest, CryptoInvoiceStatusSnapshot, CheckoutSession, DayrateAvailabilityResponse, DayrateBookingRequest, DayrateBookingResponse, DayrateMultiBookingRequest, DayrateMultiBookingResponse, Subscription, UsageBalance, VerifyCryptoWebhookSignatureOptions } from 'spaps-types';
|
|
3
|
-
export { AdminPermission, AdminRole, AdminUser, ApiResponse, AuthResponse, CheckoutSession, CreateCryptoInvoiceRequest, CreateIssueReportRequest, CreatePriceRequest, CreateProductRequest, CreateSecureMessageInput, CreateSecureMessageRequest, CryptoInvoice, CryptoInvoiceResponse, CryptoInvoiceStatusSnapshot, CryptoReconcileRequest, DayrateAvailabilityResponse, DayrateAvailableSlot, DayrateBookingRequest, DayrateBookingResponse, DayrateDayOfWeek, DayrateMultiBookingRequest, DayrateMultiBookingResponse, DayratePriceBreakdown, DayrateSlotType, Entitlement, IssueReport, IssueReportListResult, IssueReportStatus, IssueReportStatusResult, IssueReportTarget, LinkedIssueReportCase, Price, Product, ProductSyncResult, ReplyIssueReportRequest, ResourceType, SecureMessage, SecureMessageOutput, Subscription, TokenPair, UpdateIssueReportRequest, UpdateProductRequest, UsageBalance, User, UserProfile, UserRole, UserWallet, VerifyCryptoWebhookSignatureOptions, createSecureMessageRequestSchema, secureMessageMetadataSchema, secureMessageSchema } from 'spaps-types';
|
|
2
|
+
import { ResourceType, Entitlement, CreateProductRequest, Product, UpdateProductRequest, CreatePriceRequest, Price, ProductSyncResult, CryptoReconcileRequest, CreateSecureMessageRequest, SecureMessage, IssueReportScope, IssueReportStatusResult, IssueReportStatus, IssueReportListResult, IssueReport, CreateIssueReportRequest, IssueReportingVoiceTokenResult, UpdateIssueReportRequest, ReplyIssueReportRequest, AuthResponse, User as User$1, CreateCryptoInvoiceRequest, CryptoInvoiceStatusSnapshot, CheckoutSession, DayrateAvailabilityResponse, DayrateBookingRequest, DayrateBookingResponse, DayrateMultiBookingRequest, DayrateMultiBookingResponse, Subscription, UsageBalance, VerifyCryptoWebhookSignatureOptions } from 'spaps-types';
|
|
3
|
+
export { AdminPermission, AdminRole, AdminUser, ApiResponse, AuthResponse, CheckoutSession, CreateCryptoInvoiceRequest, CreateIssueReportRequest, CreatePriceRequest, CreateProductRequest, CreateSecureMessageInput, CreateSecureMessageRequest, CryptoInvoice, CryptoInvoiceResponse, CryptoInvoiceStatusSnapshot, CryptoReconcileRequest, DayrateAvailabilityResponse, DayrateAvailableSlot, DayrateBookingRequest, DayrateBookingResponse, DayrateDayOfWeek, DayrateMultiBookingRequest, DayrateMultiBookingResponse, DayratePriceBreakdown, DayrateSlotType, Entitlement, IssueReport, IssueReportListResult, IssueReportStatus, IssueReportStatusResult, IssueReportTarget, IssueReportingInputMode, IssueReportingVoiceProvider, IssueReportingVoiceTokenResult, LinkedIssueReportCase, Price, Product, ProductSyncResult, ReplyIssueReportRequest, ResourceType, SecureMessage, SecureMessageOutput, Subscription, TokenPair, UpdateIssueReportRequest, UpdateProductRequest, UsageBalance, User, UserProfile, UserRole, UserWallet, VerifyCryptoWebhookSignatureOptions, createSecureMessageRequestSchema, secureMessageMetadataSchema, secureMessageSchema } from 'spaps-types';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Permission checking utilities for SPAPS SDK
|
|
@@ -344,14 +344,15 @@ interface EntitlementCheckResult {
|
|
|
344
344
|
/** The matching entitlement, if any */
|
|
345
345
|
entitlement?: Entitlement;
|
|
346
346
|
}
|
|
347
|
+
type SupportedIssueReportScope = Extract<IssueReportScope, 'mine'>;
|
|
347
348
|
interface IssueReportListParams {
|
|
348
349
|
status?: IssueReportStatus;
|
|
349
|
-
scope?:
|
|
350
|
+
scope?: SupportedIssueReportScope;
|
|
350
351
|
limit?: number;
|
|
351
352
|
offset?: number;
|
|
352
353
|
}
|
|
353
354
|
interface IssueReportStatusParams {
|
|
354
|
-
scope?:
|
|
355
|
+
scope?: SupportedIssueReportScope;
|
|
355
356
|
}
|
|
356
357
|
|
|
357
358
|
declare class SPAPSClient<SecureMessageMetadata extends Record<string, any> = Record<string, any>> {
|
|
@@ -458,6 +459,10 @@ declare class SPAPSClient<SecureMessageMetadata extends Record<string, any> = Re
|
|
|
458
459
|
* Create a new canonical issue report.
|
|
459
460
|
*/
|
|
460
461
|
create: (payload: CreateIssueReportRequest) => Promise<IssueReport>;
|
|
462
|
+
/**
|
|
463
|
+
* Create a short-lived voice transcription token for issue reporting.
|
|
464
|
+
*/
|
|
465
|
+
createVoiceToken: () => Promise<IssueReportingVoiceTokenResult>;
|
|
461
466
|
/**
|
|
462
467
|
* Update the note for an unresolved issue report.
|
|
463
468
|
*/
|
package/dist/index.js
CHANGED
|
@@ -503,6 +503,13 @@ var WebSocketAuthHelper = class {
|
|
|
503
503
|
if (typeof globalThis.fetch === "undefined") {
|
|
504
504
|
require("cross-fetch/polyfill");
|
|
505
505
|
}
|
|
506
|
+
function appendSupportedIssueReportScope(q, scope) {
|
|
507
|
+
if (scope === void 0) return;
|
|
508
|
+
if (scope !== "mine") {
|
|
509
|
+
throw new Error('SPAPS issue reporting currently supports scope="mine" only');
|
|
510
|
+
}
|
|
511
|
+
q.append("scope", scope);
|
|
512
|
+
}
|
|
506
513
|
var SPAPSClient = class {
|
|
507
514
|
client;
|
|
508
515
|
apiKey;
|
|
@@ -639,7 +646,7 @@ var SPAPSClient = class {
|
|
|
639
646
|
*/
|
|
640
647
|
getStatus: async (params) => {
|
|
641
648
|
const q = new URLSearchParams();
|
|
642
|
-
|
|
649
|
+
appendSupportedIssueReportScope(q, params?.scope);
|
|
643
650
|
const qs = q.toString();
|
|
644
651
|
const res = await this.client.get(
|
|
645
652
|
`/api/v1/issue-reports/status${qs ? `?${qs}` : ""}`,
|
|
@@ -653,7 +660,7 @@ var SPAPSClient = class {
|
|
|
653
660
|
list: async (params) => {
|
|
654
661
|
const q = new URLSearchParams();
|
|
655
662
|
if (params?.status) q.append("status", params.status);
|
|
656
|
-
|
|
663
|
+
appendSupportedIssueReportScope(q, params?.scope);
|
|
657
664
|
if (params?.limit !== void 0) q.append("limit", String(params.limit));
|
|
658
665
|
if (params?.offset !== void 0) q.append("offset", String(params.offset));
|
|
659
666
|
const qs = q.toString();
|
|
@@ -684,6 +691,17 @@ var SPAPSClient = class {
|
|
|
684
691
|
);
|
|
685
692
|
return this.unwrapApiResponse(res, "Failed to create issue report");
|
|
686
693
|
},
|
|
694
|
+
/**
|
|
695
|
+
* Create a short-lived voice transcription token for issue reporting.
|
|
696
|
+
*/
|
|
697
|
+
createVoiceToken: async () => {
|
|
698
|
+
const res = await this.client.post(
|
|
699
|
+
"/api/v1/issue-reports/voice-token",
|
|
700
|
+
void 0,
|
|
701
|
+
this.accessToken ? { headers: { Authorization: `Bearer ${this.accessToken}` } } : void 0
|
|
702
|
+
);
|
|
703
|
+
return this.unwrapApiResponse(res, "Failed to create issue report voice token");
|
|
704
|
+
},
|
|
687
705
|
/**
|
|
688
706
|
* Update the note for an unresolved issue report.
|
|
689
707
|
*/
|
package/dist/index.mjs
CHANGED
|
@@ -473,6 +473,13 @@ var WebSocketAuthHelper = class {
|
|
|
473
473
|
if (typeof globalThis.fetch === "undefined") {
|
|
474
474
|
__require("cross-fetch/polyfill");
|
|
475
475
|
}
|
|
476
|
+
function appendSupportedIssueReportScope(q, scope) {
|
|
477
|
+
if (scope === void 0) return;
|
|
478
|
+
if (scope !== "mine") {
|
|
479
|
+
throw new Error('SPAPS issue reporting currently supports scope="mine" only');
|
|
480
|
+
}
|
|
481
|
+
q.append("scope", scope);
|
|
482
|
+
}
|
|
476
483
|
var SPAPSClient = class {
|
|
477
484
|
client;
|
|
478
485
|
apiKey;
|
|
@@ -609,7 +616,7 @@ var SPAPSClient = class {
|
|
|
609
616
|
*/
|
|
610
617
|
getStatus: async (params) => {
|
|
611
618
|
const q = new URLSearchParams();
|
|
612
|
-
|
|
619
|
+
appendSupportedIssueReportScope(q, params?.scope);
|
|
613
620
|
const qs = q.toString();
|
|
614
621
|
const res = await this.client.get(
|
|
615
622
|
`/api/v1/issue-reports/status${qs ? `?${qs}` : ""}`,
|
|
@@ -623,7 +630,7 @@ var SPAPSClient = class {
|
|
|
623
630
|
list: async (params) => {
|
|
624
631
|
const q = new URLSearchParams();
|
|
625
632
|
if (params?.status) q.append("status", params.status);
|
|
626
|
-
|
|
633
|
+
appendSupportedIssueReportScope(q, params?.scope);
|
|
627
634
|
if (params?.limit !== void 0) q.append("limit", String(params.limit));
|
|
628
635
|
if (params?.offset !== void 0) q.append("offset", String(params.offset));
|
|
629
636
|
const qs = q.toString();
|
|
@@ -654,6 +661,17 @@ var SPAPSClient = class {
|
|
|
654
661
|
);
|
|
655
662
|
return this.unwrapApiResponse(res, "Failed to create issue report");
|
|
656
663
|
},
|
|
664
|
+
/**
|
|
665
|
+
* Create a short-lived voice transcription token for issue reporting.
|
|
666
|
+
*/
|
|
667
|
+
createVoiceToken: async () => {
|
|
668
|
+
const res = await this.client.post(
|
|
669
|
+
"/api/v1/issue-reports/voice-token",
|
|
670
|
+
void 0,
|
|
671
|
+
this.accessToken ? { headers: { Authorization: `Bearer ${this.accessToken}` } } : void 0
|
|
672
|
+
);
|
|
673
|
+
return this.unwrapApiResponse(res, "Failed to create issue report voice token");
|
|
674
|
+
},
|
|
657
675
|
/**
|
|
658
676
|
* Update the note for an unresolved issue report.
|
|
659
677
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spaps-sdk",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.7",
|
|
4
4
|
"description": "Sweet Potato Authentication & Payment Service SDK - Zero-config client with built-in permission checking, role-based access control, and dayrate scheduling",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"email": "buildooor@gmail.com"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"axios": "^1.
|
|
51
|
+
"axios": "^1.15.1",
|
|
52
52
|
"cross-fetch": "^4.0.0",
|
|
53
|
-
"spaps-types": "^1.1.
|
|
53
|
+
"spaps-types": "^1.1.3"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/node": "^20.10.0",
|