spaps-sdk 1.6.4 → 1.6.5
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/README.md +86 -107
- package/dist/index.d.mts +7 -3
- package/dist/index.d.ts +7 -3
- package/dist/index.js +6 -2
- package/dist/index.mjs +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,78 +1,69 @@
|
|
|
1
1
|
# spaps-sdk
|
|
2
2
|
|
|
3
|
-
TypeScript
|
|
3
|
+
Typed TypeScript client for SPAPS-compatible APIs.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Examples in this README use placeholders such as `user@example.com`, `admin@example.com`, and `https://api.example.test`. Replace them with values from your own deployment.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
**The Solution**: `spaps-sdk` exposes a typed `SPAPSClient` with source-backed namespaces for the major SPAPS surfaces and a small set of permission helpers for app code.
|
|
10
|
-
|
|
11
|
-
### Why Use `spaps-sdk`?
|
|
12
|
-
|
|
13
|
-
| Feature | What It Does |
|
|
14
|
-
| --- | --- |
|
|
15
|
-
| Zero-config local mode | Point at `localhost` and the SDK automatically treats it as local mode |
|
|
16
|
-
| Typed namespaces | Use `auth`, `payments`, `sessions`, `secureMessages`, `issueReporting`, `email`, `entitlements`, `dayrate`, `cfo`, and `admin` from one client |
|
|
17
|
-
| Browser and server key support | Configure with `publishableKey`, `secretKey`, or the legacy `apiKey` field |
|
|
18
|
-
| Shared contracts | Re-exports many `spaps-types` definitions so apps can stay on one dependency surface |
|
|
19
|
-
|
|
20
|
-
## Metadata
|
|
21
|
-
|
|
22
|
-
- `package_name`: `spaps-sdk`
|
|
23
|
-
- `latest_version`: `1.6.3`
|
|
24
|
-
- `minimum_runtime`: `Node.js >=14.0.0`
|
|
25
|
-
- `api_base_url`: `https://api.sweetpotato.dev`
|
|
26
|
-
|
|
27
|
-
## Installation
|
|
28
|
-
|
|
29
|
-
### npm
|
|
7
|
+
## Install
|
|
30
8
|
|
|
31
9
|
```bash
|
|
32
10
|
npm install spaps-sdk
|
|
33
11
|
```
|
|
34
12
|
|
|
35
|
-
|
|
13
|
+
Alternative package managers:
|
|
36
14
|
|
|
37
15
|
```bash
|
|
38
16
|
pnpm add spaps-sdk
|
|
17
|
+
yarn add spaps-sdk
|
|
39
18
|
```
|
|
40
19
|
|
|
41
|
-
|
|
20
|
+
This package targets `Node.js >=14`.
|
|
42
21
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
22
|
+
## When It Fits
|
|
23
|
+
|
|
24
|
+
| Need | Package gives you |
|
|
25
|
+
| --- | --- |
|
|
26
|
+
| One client for many SPAPS surfaces | `auth`, `payments`, `sessions`, `secureMessages`, `issueReporting`, `email`, `entitlements`, `dayrate`, `admin`, and `cfo` namespaces |
|
|
27
|
+
| Local development without extra config | Localhost URLs automatically enable local mode |
|
|
28
|
+
| Browser and server usage | `publishableKey`, `secretKey`, or legacy `apiKey` support |
|
|
29
|
+
| Shared contracts | Re-exports a large slice of `spaps-types` |
|
|
46
30
|
|
|
47
|
-
## Quick
|
|
31
|
+
## Quick Start
|
|
48
32
|
|
|
49
|
-
```
|
|
50
|
-
import { SPAPSClient } from
|
|
33
|
+
```ts
|
|
34
|
+
import { SPAPSClient } from "spaps-sdk";
|
|
51
35
|
|
|
52
36
|
const spaps = new SPAPSClient({
|
|
53
|
-
apiUrl:
|
|
37
|
+
apiUrl: "http://localhost:3301",
|
|
38
|
+
publishableKey: "spaps_pub_example",
|
|
54
39
|
});
|
|
55
40
|
|
|
56
|
-
const
|
|
57
|
-
|
|
41
|
+
const auth = await spaps.auth.signInWithPassword({
|
|
42
|
+
email: "user@example.com",
|
|
43
|
+
password: "correct-horse-battery-staple",
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const me = await spaps.getUser();
|
|
47
|
+
const issues = await spaps.issueReporting.list({
|
|
48
|
+
status: "open",
|
|
49
|
+
scope: "mine",
|
|
50
|
+
limit: 20,
|
|
51
|
+
});
|
|
58
52
|
|
|
59
|
-
|
|
60
|
-
const me = await spaps.getUser();
|
|
61
|
-
console.log(me.data.email);
|
|
62
|
-
}
|
|
53
|
+
console.log(auth.user.id, me.data.email, issues.total);
|
|
63
54
|
```
|
|
64
55
|
|
|
65
56
|
## Configuration
|
|
66
57
|
|
|
67
|
-
Constructor values
|
|
58
|
+
Constructor values take precedence over environment variables.
|
|
68
59
|
|
|
69
60
|
| Option | Purpose |
|
|
70
61
|
| --- | --- |
|
|
71
|
-
| `apiUrl` | Base API URL. Localhost
|
|
62
|
+
| `apiUrl` | Base API URL. Localhost values enable local mode automatically |
|
|
72
63
|
| `publishableKey` | Browser-safe key for client-side usage |
|
|
73
|
-
| `secretKey` | Server-side key for
|
|
74
|
-
| `apiKey` |
|
|
75
|
-
| `timeout` |
|
|
64
|
+
| `secretKey` | Server-side key for privileged access |
|
|
65
|
+
| `apiKey` | Legacy key field kept for compatibility |
|
|
66
|
+
| `timeout` | Request timeout override |
|
|
76
67
|
|
|
77
68
|
Relevant environment variables:
|
|
78
69
|
|
|
@@ -81,84 +72,72 @@ Relevant environment variables:
|
|
|
81
72
|
- `SPAPS_API_KEY`
|
|
82
73
|
- `NEXT_PUBLIC_SPAPS_API_KEY`
|
|
83
74
|
|
|
84
|
-
##
|
|
75
|
+
## Core Surface
|
|
85
76
|
|
|
86
|
-
| Namespace |
|
|
77
|
+
| Namespace | Covers |
|
|
87
78
|
| --- | --- |
|
|
88
|
-
| `auth` | Password, wallet, magic-link, refresh, and
|
|
89
|
-
| `payments` | Checkout sessions, products, prices, subscriptions, and crypto
|
|
90
|
-
| `sessions` |
|
|
91
|
-
| `secureMessages` |
|
|
92
|
-
| `issueReporting` | Status, history, create,
|
|
93
|
-
| `email` | Template lookup,
|
|
79
|
+
| `auth` | Password, wallet, magic-link, refresh, logout, and password-management flows |
|
|
80
|
+
| `payments` | Checkout sessions, products, prices, subscriptions, and crypto helpers |
|
|
81
|
+
| `sessions` | Session lookup, validation, and lifecycle helpers |
|
|
82
|
+
| `secureMessages` | Secure-message create/list helpers |
|
|
83
|
+
| `issueReporting` | Status, history, create, update, and reply flows |
|
|
84
|
+
| `email` | Template lookup, preview, and send helpers |
|
|
94
85
|
| `entitlements` | User and resource entitlement queries |
|
|
95
86
|
| `dayrate` | Availability and booking helpers |
|
|
96
87
|
| `admin` | Product and pricing admin helpers |
|
|
97
|
-
| `cfo` | CFO-
|
|
88
|
+
| `cfo` | CFO-facing reporting endpoints |
|
|
98
89
|
|
|
99
|
-
## Common
|
|
90
|
+
## Common Patterns
|
|
100
91
|
|
|
101
|
-
### Typed Secure
|
|
92
|
+
### Typed Secure Messages
|
|
102
93
|
|
|
103
|
-
```
|
|
104
|
-
type SecureMessageMetadata = { urgency:
|
|
94
|
+
```ts
|
|
95
|
+
type SecureMessageMetadata = { urgency: "low" | "high"; tags?: string[] };
|
|
105
96
|
|
|
106
97
|
const spaps = new SPAPSClient<SecureMessageMetadata>({
|
|
107
|
-
apiUrl:
|
|
98
|
+
apiUrl: "https://api.example.test",
|
|
108
99
|
secretKey: process.env.SPAPS_API_KEY,
|
|
109
100
|
});
|
|
110
101
|
|
|
111
102
|
await spaps.secureMessages.create({
|
|
112
|
-
patientId:
|
|
113
|
-
practitionerId:
|
|
114
|
-
content:
|
|
115
|
-
metadata: { urgency:
|
|
103
|
+
patientId: "3d6f0a51-8d77-4b38-8248-2d1b2f1f6c7f",
|
|
104
|
+
practitionerId: "a3d7f431-6c9d-4cbc-9f78-4e5b6a7c8d9e",
|
|
105
|
+
content: "Follow up scheduled for next week.",
|
|
106
|
+
metadata: { urgency: "low", tags: ["follow-up"] },
|
|
116
107
|
});
|
|
117
108
|
```
|
|
118
109
|
|
|
119
|
-
###
|
|
120
|
-
|
|
121
|
-
```typescript
|
|
122
|
-
spaps.setAccessToken('jwt-token');
|
|
123
|
-
|
|
124
|
-
const summary = await spaps.issueReporting.getStatus();
|
|
125
|
-
const history = await spaps.issueReporting.list({ status: 'open' });
|
|
126
|
-
|
|
127
|
-
if (!summary.has_open && history.total === 0) {
|
|
128
|
-
await spaps.issueReporting.create({
|
|
129
|
-
target: {
|
|
130
|
-
component_key: 'patient_protocol_widget',
|
|
131
|
-
component_label: 'Patient Protocol Widget',
|
|
132
|
-
page_url: '/patients/123/protocol',
|
|
133
|
-
metadata: { section: 'daily log' },
|
|
134
|
-
},
|
|
135
|
-
note: 'The save action silently fails after I edit today.',
|
|
136
|
-
reporter_role_hint: 'practitioner',
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
```
|
|
110
|
+
### Permission Helpers With Explicit Admin Config
|
|
140
111
|
|
|
141
|
-
|
|
112
|
+
```ts
|
|
113
|
+
import {
|
|
114
|
+
canAccessAdmin,
|
|
115
|
+
createPermissionChecker,
|
|
116
|
+
isAdminAccount,
|
|
117
|
+
} from "spaps-sdk";
|
|
142
118
|
|
|
143
|
-
|
|
144
|
-
|
|
119
|
+
const customAdmins = ["admin@example.com"];
|
|
120
|
+
const checker = createPermissionChecker(customAdmins);
|
|
145
121
|
|
|
146
|
-
const role =
|
|
147
|
-
const adminCheck = canAccessAdmin(
|
|
148
|
-
|
|
122
|
+
const role = checker.getRole("staff@example.com");
|
|
123
|
+
const adminCheck = canAccessAdmin(
|
|
124
|
+
{ id: "user_123", email: "admin@example.com" },
|
|
125
|
+
customAdmins,
|
|
126
|
+
);
|
|
127
|
+
const isAdmin = isAdminAccount("admin@example.com", customAdmins);
|
|
149
128
|
|
|
150
129
|
console.log(role, adminCheck.allowed, isAdmin);
|
|
151
130
|
```
|
|
152
131
|
|
|
153
|
-
###
|
|
132
|
+
### Convenience Helpers
|
|
154
133
|
|
|
155
|
-
```
|
|
156
|
-
const spaps = new SPAPSClient({ apiUrl:
|
|
134
|
+
```ts
|
|
135
|
+
const spaps = new SPAPSClient({ apiUrl: "http://localhost:3301" });
|
|
157
136
|
|
|
158
137
|
spaps.isLocalMode();
|
|
159
138
|
spaps.isAuthenticated();
|
|
160
139
|
spaps.getAccessToken();
|
|
161
|
-
spaps.setAccessToken(
|
|
140
|
+
spaps.setAccessToken("token");
|
|
162
141
|
await spaps.health();
|
|
163
142
|
```
|
|
164
143
|
|
|
@@ -177,41 +156,41 @@ npm run test
|
|
|
177
156
|
|
|
178
157
|
### `401 Unauthorized`
|
|
179
158
|
|
|
180
|
-
Check the access token
|
|
159
|
+
Check the access token, API key choice, and target environment. Browser apps should generally use `publishableKey`, not a server secret.
|
|
181
160
|
|
|
182
161
|
### Local mode is not activating
|
|
183
162
|
|
|
184
|
-
Use a localhost URL such as `http://localhost:3301`,
|
|
163
|
+
Use a localhost URL such as `http://localhost:3301`, then confirm with `spaps.isLocalMode()`.
|
|
185
164
|
|
|
186
|
-
###
|
|
165
|
+
### I need shared types in app code
|
|
187
166
|
|
|
188
|
-
|
|
167
|
+
Import them from `spaps-sdk` if the re-export exists, or install `spaps-types` directly for a narrower dependency.
|
|
189
168
|
|
|
190
169
|
## Limitations
|
|
191
170
|
|
|
192
|
-
- The SDK
|
|
171
|
+
- The SDK is handwritten around the current SPAPS surface. It is not a generated client for every backend route.
|
|
193
172
|
- Some admin and entitlement flows still depend on upstream permissions and token context.
|
|
194
|
-
- The legacy `apiKey`
|
|
173
|
+
- The legacy `apiKey` field remains for compatibility, but new integrations should prefer `publishableKey` or `secretKey`.
|
|
195
174
|
|
|
196
175
|
## FAQ
|
|
197
176
|
|
|
198
177
|
### Does this work in browsers?
|
|
199
178
|
|
|
200
|
-
Yes. The package is
|
|
179
|
+
Yes. The package is intended for both browser and server use.
|
|
201
180
|
|
|
202
|
-
### Does it include fetch
|
|
181
|
+
### Does it include a fetch polyfill?
|
|
203
182
|
|
|
204
|
-
Yes. It loads `cross-fetch/polyfill` when `fetch` is
|
|
183
|
+
Yes. It loads `cross-fetch/polyfill` when `fetch` is missing.
|
|
205
184
|
|
|
206
|
-
### Can I use it
|
|
185
|
+
### Can I use it from plain JavaScript?
|
|
207
186
|
|
|
208
|
-
Yes. The runtime works in JavaScript projects and ships bundled type declarations for
|
|
187
|
+
Yes. The runtime works in JavaScript projects and ships bundled type declarations for TypeScript users.
|
|
209
188
|
|
|
210
189
|
### Does it re-export shared types?
|
|
211
190
|
|
|
212
191
|
Yes. Many `spaps-types` exports are re-exported for convenience.
|
|
213
192
|
|
|
214
|
-
### How do I validate README
|
|
193
|
+
### How do I validate the README snippets?
|
|
215
194
|
|
|
216
195
|
Run:
|
|
217
196
|
|
|
@@ -222,7 +201,7 @@ npm run test:readme
|
|
|
222
201
|
|
|
223
202
|
## About Contributions
|
|
224
203
|
|
|
225
|
-
*About Contributions:* Please don't take this the wrong way, but I do not accept outside contributions for any of my projects. I simply don't have the mental bandwidth to review anything, and it's my name on the thing, so I'm responsible for any problems it causes; thus, the risk-reward is highly asymmetric from my perspective. I'd also have to worry about other "stakeholders," which seems unwise for tools I mostly make for myself for free. Feel free to submit issues, and even PRs if you want to illustrate a proposed fix, but know I won't merge them directly. Instead, I'll have Claude or Codex review submissions via `gh` and independently decide whether and how to address them. Bug reports in particular are welcome. Sorry if this offends, but I want to avoid wasted time and hurt feelings. I understand this isn't in sync with the prevailing open-source ethos that seeks community contributions, but it's the only way I can move at this velocity and keep my sanity.
|
|
204
|
+
> *About Contributions:* Please don't take this the wrong way, but I do not accept outside contributions for any of my projects. I simply don't have the mental bandwidth to review anything, and it's my name on the thing, so I'm responsible for any problems it causes; thus, the risk-reward is highly asymmetric from my perspective. I'd also have to worry about other "stakeholders," which seems unwise for tools I mostly make for myself for free. Feel free to submit issues, and even PRs if you want to illustrate a proposed fix, but know I won't merge them directly. Instead, I'll have Claude or Codex review submissions via `gh` and independently decide whether and how to address them. Bug reports in particular are welcome. Sorry if this offends, but I want to avoid wasted time and hurt feelings. I understand this isn't in sync with the prevailing open-source ethos that seeks community contributions, but it's the only way I can move at this velocity and keep my sanity.
|
|
226
205
|
|
|
227
206
|
## License
|
|
228
207
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as spaps_types from 'spaps-types';
|
|
2
|
-
import { ResourceType, Entitlement, CreateProductRequest, Product, UpdateProductRequest, CreatePriceRequest, Price, ProductSyncResult, CryptoReconcileRequest, CreateSecureMessageRequest, SecureMessage, 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';
|
|
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
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';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -346,9 +346,13 @@ interface EntitlementCheckResult {
|
|
|
346
346
|
}
|
|
347
347
|
interface IssueReportListParams {
|
|
348
348
|
status?: IssueReportStatus;
|
|
349
|
+
scope?: IssueReportScope;
|
|
349
350
|
limit?: number;
|
|
350
351
|
offset?: number;
|
|
351
352
|
}
|
|
353
|
+
interface IssueReportStatusParams {
|
|
354
|
+
scope?: IssueReportScope;
|
|
355
|
+
}
|
|
352
356
|
|
|
353
357
|
declare class SPAPSClient<SecureMessageMetadata extends Record<string, any> = Record<string, any>> {
|
|
354
358
|
private client;
|
|
@@ -441,7 +445,7 @@ declare class SPAPSClient<SecureMessageMetadata extends Record<string, any> = Re
|
|
|
441
445
|
/**
|
|
442
446
|
* Return canonical issue-report summary for the shared floating entrypoint.
|
|
443
447
|
*/
|
|
444
|
-
getStatus: () => Promise<IssueReportStatusResult>;
|
|
448
|
+
getStatus: (params?: IssueReportStatusParams) => Promise<IssueReportStatusResult>;
|
|
445
449
|
/**
|
|
446
450
|
* List the caller's issue reports inside the active application scope.
|
|
447
451
|
*/
|
|
@@ -929,4 +933,4 @@ declare function createServerClient(secretKey: string, options?: Omit<SPAPSConfi
|
|
|
929
933
|
*/
|
|
930
934
|
declare function detectKeyType(key: string): ApiKeyType | null;
|
|
931
935
|
|
|
932
|
-
export { type AdminConfig, type ApiKeyType, type CheckoutLineItem, type CheckoutLineItemPriceData, type CreateCheckoutSessionPayload, DEFAULT_ADMIN_ACCOUNTS, type EmailSendOptions, type EmailSendResult, type EmailTemplate, type EmailTemplatePreview, type EntitlementCheckResult, type EntitlementListParams, type FeatureContext, type FeatureDefinition, FeatureEvaluator, type IssueReportListParams, type PermissionCheckResult, PermissionChecker, RoleHierarchy, SPAPSClient as SPAPS, SPAPSClient, type SPAPSConfig, type TemplateVariable, TokenManager, WalletUtils, WebSocketAuthHelper, type WebSocketAuthHelperConfig, canAccessAdmin, createBrowserClient, createPermissionChecker, createServerClient, SPAPSClient as default, defaultPermissionChecker, detectKeyType, getRoleAwareErrorMessage, getUserDisplay, getUserRole, hasPermission, isAdminAccount, verifyCryptoWebhookSignature };
|
|
936
|
+
export { type AdminConfig, type ApiKeyType, type CheckoutLineItem, type CheckoutLineItemPriceData, type CreateCheckoutSessionPayload, DEFAULT_ADMIN_ACCOUNTS, type EmailSendOptions, type EmailSendResult, type EmailTemplate, type EmailTemplatePreview, type EntitlementCheckResult, type EntitlementListParams, type FeatureContext, type FeatureDefinition, FeatureEvaluator, type IssueReportListParams, type IssueReportStatusParams, type PermissionCheckResult, PermissionChecker, RoleHierarchy, SPAPSClient as SPAPS, SPAPSClient, type SPAPSConfig, type TemplateVariable, TokenManager, WalletUtils, WebSocketAuthHelper, type WebSocketAuthHelperConfig, canAccessAdmin, createBrowserClient, createPermissionChecker, createServerClient, SPAPSClient as default, defaultPermissionChecker, detectKeyType, getRoleAwareErrorMessage, getUserDisplay, getUserRole, hasPermission, isAdminAccount, verifyCryptoWebhookSignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as spaps_types from 'spaps-types';
|
|
2
|
-
import { ResourceType, Entitlement, CreateProductRequest, Product, UpdateProductRequest, CreatePriceRequest, Price, ProductSyncResult, CryptoReconcileRequest, CreateSecureMessageRequest, SecureMessage, 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';
|
|
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
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';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -346,9 +346,13 @@ interface EntitlementCheckResult {
|
|
|
346
346
|
}
|
|
347
347
|
interface IssueReportListParams {
|
|
348
348
|
status?: IssueReportStatus;
|
|
349
|
+
scope?: IssueReportScope;
|
|
349
350
|
limit?: number;
|
|
350
351
|
offset?: number;
|
|
351
352
|
}
|
|
353
|
+
interface IssueReportStatusParams {
|
|
354
|
+
scope?: IssueReportScope;
|
|
355
|
+
}
|
|
352
356
|
|
|
353
357
|
declare class SPAPSClient<SecureMessageMetadata extends Record<string, any> = Record<string, any>> {
|
|
354
358
|
private client;
|
|
@@ -441,7 +445,7 @@ declare class SPAPSClient<SecureMessageMetadata extends Record<string, any> = Re
|
|
|
441
445
|
/**
|
|
442
446
|
* Return canonical issue-report summary for the shared floating entrypoint.
|
|
443
447
|
*/
|
|
444
|
-
getStatus: () => Promise<IssueReportStatusResult>;
|
|
448
|
+
getStatus: (params?: IssueReportStatusParams) => Promise<IssueReportStatusResult>;
|
|
445
449
|
/**
|
|
446
450
|
* List the caller's issue reports inside the active application scope.
|
|
447
451
|
*/
|
|
@@ -929,4 +933,4 @@ declare function createServerClient(secretKey: string, options?: Omit<SPAPSConfi
|
|
|
929
933
|
*/
|
|
930
934
|
declare function detectKeyType(key: string): ApiKeyType | null;
|
|
931
935
|
|
|
932
|
-
export { type AdminConfig, type ApiKeyType, type CheckoutLineItem, type CheckoutLineItemPriceData, type CreateCheckoutSessionPayload, DEFAULT_ADMIN_ACCOUNTS, type EmailSendOptions, type EmailSendResult, type EmailTemplate, type EmailTemplatePreview, type EntitlementCheckResult, type EntitlementListParams, type FeatureContext, type FeatureDefinition, FeatureEvaluator, type IssueReportListParams, type PermissionCheckResult, PermissionChecker, RoleHierarchy, SPAPSClient as SPAPS, SPAPSClient, type SPAPSConfig, type TemplateVariable, TokenManager, WalletUtils, WebSocketAuthHelper, type WebSocketAuthHelperConfig, canAccessAdmin, createBrowserClient, createPermissionChecker, createServerClient, SPAPSClient as default, defaultPermissionChecker, detectKeyType, getRoleAwareErrorMessage, getUserDisplay, getUserRole, hasPermission, isAdminAccount, verifyCryptoWebhookSignature };
|
|
936
|
+
export { type AdminConfig, type ApiKeyType, type CheckoutLineItem, type CheckoutLineItemPriceData, type CreateCheckoutSessionPayload, DEFAULT_ADMIN_ACCOUNTS, type EmailSendOptions, type EmailSendResult, type EmailTemplate, type EmailTemplatePreview, type EntitlementCheckResult, type EntitlementListParams, type FeatureContext, type FeatureDefinition, FeatureEvaluator, type IssueReportListParams, type IssueReportStatusParams, type PermissionCheckResult, PermissionChecker, RoleHierarchy, SPAPSClient as SPAPS, SPAPSClient, type SPAPSConfig, type TemplateVariable, TokenManager, WalletUtils, WebSocketAuthHelper, type WebSocketAuthHelperConfig, canAccessAdmin, createBrowserClient, createPermissionChecker, createServerClient, SPAPSClient as default, defaultPermissionChecker, detectKeyType, getRoleAwareErrorMessage, getUserDisplay, getUserRole, hasPermission, isAdminAccount, verifyCryptoWebhookSignature };
|
package/dist/index.js
CHANGED
|
@@ -637,9 +637,12 @@ var SPAPSClient = class {
|
|
|
637
637
|
/**
|
|
638
638
|
* Return canonical issue-report summary for the shared floating entrypoint.
|
|
639
639
|
*/
|
|
640
|
-
getStatus: async () => {
|
|
640
|
+
getStatus: async (params) => {
|
|
641
|
+
const q = new URLSearchParams();
|
|
642
|
+
if (params?.scope) q.append("scope", params.scope);
|
|
643
|
+
const qs = q.toString();
|
|
641
644
|
const res = await this.client.get(
|
|
642
|
-
|
|
645
|
+
`/api/v1/issue-reports/status${qs ? `?${qs}` : ""}`,
|
|
643
646
|
this.accessToken ? { headers: { Authorization: `Bearer ${this.accessToken}` } } : void 0
|
|
644
647
|
);
|
|
645
648
|
return this.unwrapApiResponse(res, "Failed to get issue report status");
|
|
@@ -650,6 +653,7 @@ var SPAPSClient = class {
|
|
|
650
653
|
list: async (params) => {
|
|
651
654
|
const q = new URLSearchParams();
|
|
652
655
|
if (params?.status) q.append("status", params.status);
|
|
656
|
+
if (params?.scope) q.append("scope", params.scope);
|
|
653
657
|
if (params?.limit !== void 0) q.append("limit", String(params.limit));
|
|
654
658
|
if (params?.offset !== void 0) q.append("offset", String(params.offset));
|
|
655
659
|
const qs = q.toString();
|
package/dist/index.mjs
CHANGED
|
@@ -607,9 +607,12 @@ var SPAPSClient = class {
|
|
|
607
607
|
/**
|
|
608
608
|
* Return canonical issue-report summary for the shared floating entrypoint.
|
|
609
609
|
*/
|
|
610
|
-
getStatus: async () => {
|
|
610
|
+
getStatus: async (params) => {
|
|
611
|
+
const q = new URLSearchParams();
|
|
612
|
+
if (params?.scope) q.append("scope", params.scope);
|
|
613
|
+
const qs = q.toString();
|
|
611
614
|
const res = await this.client.get(
|
|
612
|
-
|
|
615
|
+
`/api/v1/issue-reports/status${qs ? `?${qs}` : ""}`,
|
|
613
616
|
this.accessToken ? { headers: { Authorization: `Bearer ${this.accessToken}` } } : void 0
|
|
614
617
|
);
|
|
615
618
|
return this.unwrapApiResponse(res, "Failed to get issue report status");
|
|
@@ -620,6 +623,7 @@ var SPAPSClient = class {
|
|
|
620
623
|
list: async (params) => {
|
|
621
624
|
const q = new URLSearchParams();
|
|
622
625
|
if (params?.status) q.append("status", params.status);
|
|
626
|
+
if (params?.scope) q.append("scope", params.scope);
|
|
623
627
|
if (params?.limit !== void 0) q.append("limit", String(params.limit));
|
|
624
628
|
if (params?.offset !== void 0) q.append("offset", String(params.offset));
|
|
625
629
|
const qs = q.toString();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spaps-sdk",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.5",
|
|
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",
|