spaps-sdk 0.1.0 → 1.0.1
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/.env.example +23 -0
- package/README.md +579 -103
- package/admin-utils.ts +243 -0
- package/dist/index.js +886 -134
- package/dist/index.mjs +876 -121
- package/package.json +34 -40
- package/dist/index.d.mts +0 -82
- package/dist/index.d.ts +0 -82
package/package.json
CHANGED
|
@@ -1,62 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "spaps-sdk",
|
|
3
|
-
"version": "0.1
|
|
4
|
-
"
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "https://github.com/sweet-potato/spaps-sdk"
|
|
7
|
+
},
|
|
8
|
+
"homepage": "https://github.com/sweet-potato/spaps-sdk#readme",
|
|
9
|
+
"bugs": {
|
|
10
|
+
"url": "https://github.com/sweet-potato/spaps-sdk/issues"
|
|
11
|
+
},
|
|
12
|
+
"description": "Sweet Potato Authentication & Payment Service SDK",
|
|
5
13
|
"main": "dist/index.js",
|
|
14
|
+
"module": "dist/index.mjs",
|
|
6
15
|
"types": "dist/index.d.ts",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"./client": {
|
|
14
|
-
"types": "./dist/index.d.ts",
|
|
15
|
-
"import": "./dist/index.mjs",
|
|
16
|
-
"require": "./dist/index.js"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"admin-utils.ts",
|
|
19
|
+
"README.md",
|
|
20
|
+
".env.example"
|
|
21
|
+
],
|
|
19
22
|
"scripts": {
|
|
20
|
-
"build": "tsup
|
|
21
|
-
"dev": "tsup
|
|
22
|
-
"test": "echo \"No tests yet\"",
|
|
23
|
+
"build": "tsup index.ts --format cjs,esm --clean",
|
|
24
|
+
"dev": "tsup index.ts --format cjs,esm --dts --watch",
|
|
23
25
|
"prepublishOnly": "npm run build"
|
|
24
26
|
},
|
|
25
27
|
"keywords": [
|
|
26
28
|
"authentication",
|
|
27
29
|
"payments",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"sweet-potato",
|
|
33
|
-
"wallet-auth"
|
|
30
|
+
"wallet",
|
|
31
|
+
"solana",
|
|
32
|
+
"ethereum",
|
|
33
|
+
"sdk"
|
|
34
34
|
],
|
|
35
|
-
"author": "
|
|
35
|
+
"author": "Sweet Potato Team",
|
|
36
36
|
"license": "MIT",
|
|
37
|
-
"repository": {
|
|
38
|
-
"type": "git",
|
|
39
|
-
"url": "https://github.com/yourusername/sweet-potato"
|
|
40
|
-
},
|
|
41
|
-
"homepage": "https://sweetpotato.dev",
|
|
42
37
|
"dependencies": {
|
|
43
|
-
"axios": "^1.
|
|
38
|
+
"axios": "^1.11.0"
|
|
44
39
|
},
|
|
45
40
|
"devDependencies": {
|
|
46
|
-
"
|
|
47
|
-
"tsup": "^8.0.1",
|
|
41
|
+
"tsup": "^8.5.0",
|
|
48
42
|
"typescript": "^5.3.2"
|
|
49
43
|
},
|
|
50
44
|
"peerDependencies": {
|
|
51
|
-
"
|
|
45
|
+
"@solana/web3.js": "^1.87.6",
|
|
46
|
+
"ethers": "^6.9.0"
|
|
52
47
|
},
|
|
53
48
|
"peerDependenciesMeta": {
|
|
54
|
-
"
|
|
49
|
+
"@solana/web3.js": {
|
|
50
|
+
"optional": true
|
|
51
|
+
},
|
|
52
|
+
"ethers": {
|
|
55
53
|
"optional": true
|
|
56
54
|
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
"dist",
|
|
60
|
-
"README.md"
|
|
61
|
-
]
|
|
62
|
-
}
|
|
55
|
+
}
|
|
56
|
+
}
|
package/dist/index.d.mts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @spaps/sdk - Sweet Potato Authentication & Payment Service SDK
|
|
3
|
-
* Zero-config client for SPAPS authentication and payments
|
|
4
|
-
*/
|
|
5
|
-
interface SPAPSConfig {
|
|
6
|
-
apiUrl?: string;
|
|
7
|
-
apiKey?: string;
|
|
8
|
-
autoDetect?: boolean;
|
|
9
|
-
timeout?: number;
|
|
10
|
-
}
|
|
11
|
-
interface AuthResponse {
|
|
12
|
-
access_token: string;
|
|
13
|
-
refresh_token: string;
|
|
14
|
-
user: User;
|
|
15
|
-
}
|
|
16
|
-
interface User {
|
|
17
|
-
id: string;
|
|
18
|
-
email?: string;
|
|
19
|
-
wallet_address?: string;
|
|
20
|
-
chain_type?: string;
|
|
21
|
-
role: string;
|
|
22
|
-
created_at?: string;
|
|
23
|
-
}
|
|
24
|
-
interface CheckoutSession {
|
|
25
|
-
sessionId: string;
|
|
26
|
-
url: string;
|
|
27
|
-
}
|
|
28
|
-
interface Subscription {
|
|
29
|
-
id: string;
|
|
30
|
-
status: string;
|
|
31
|
-
plan: string;
|
|
32
|
-
current_period_end: string;
|
|
33
|
-
}
|
|
34
|
-
interface UsageBalance {
|
|
35
|
-
balance: number;
|
|
36
|
-
currency: string;
|
|
37
|
-
updated_at: string;
|
|
38
|
-
}
|
|
39
|
-
declare class SPAPSClient {
|
|
40
|
-
private client;
|
|
41
|
-
private apiKey?;
|
|
42
|
-
private accessToken?;
|
|
43
|
-
private refreshToken?;
|
|
44
|
-
private _isLocalMode;
|
|
45
|
-
constructor(config?: SPAPSConfig);
|
|
46
|
-
login(email: string, password: string): Promise<{
|
|
47
|
-
data: AuthResponse;
|
|
48
|
-
}>;
|
|
49
|
-
register(email: string, password: string): Promise<{
|
|
50
|
-
data: AuthResponse;
|
|
51
|
-
}>;
|
|
52
|
-
walletSignIn(walletAddress: string, signature: string, message: string, chainType?: 'solana' | 'ethereum'): Promise<{
|
|
53
|
-
data: AuthResponse;
|
|
54
|
-
}>;
|
|
55
|
-
refresh(refreshToken?: string): Promise<{
|
|
56
|
-
data: AuthResponse;
|
|
57
|
-
}>;
|
|
58
|
-
logout(): Promise<void>;
|
|
59
|
-
getUser(): Promise<{
|
|
60
|
-
data: User;
|
|
61
|
-
}>;
|
|
62
|
-
createCheckoutSession(priceId: string, successUrl: string, cancelUrl?: string): Promise<{
|
|
63
|
-
data: CheckoutSession;
|
|
64
|
-
}>;
|
|
65
|
-
getSubscription(): Promise<{
|
|
66
|
-
data: Subscription;
|
|
67
|
-
}>;
|
|
68
|
-
cancelSubscription(): Promise<void>;
|
|
69
|
-
getUsageBalance(): Promise<{
|
|
70
|
-
data: UsageBalance;
|
|
71
|
-
}>;
|
|
72
|
-
recordUsage(feature: string, amount: number): Promise<void>;
|
|
73
|
-
isAuthenticated(): boolean;
|
|
74
|
-
getAccessToken(): string | undefined;
|
|
75
|
-
setAccessToken(token: string): void;
|
|
76
|
-
isLocalMode(): boolean;
|
|
77
|
-
health(): Promise<{
|
|
78
|
-
data: any;
|
|
79
|
-
}>;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export { type AuthResponse, type CheckoutSession, SPAPSClient as SPAPS, SPAPSClient, type SPAPSConfig, type Subscription, SPAPSClient as SweetPotatoSDK, type UsageBalance, type User, SPAPSClient as default };
|
package/dist/index.d.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @spaps/sdk - Sweet Potato Authentication & Payment Service SDK
|
|
3
|
-
* Zero-config client for SPAPS authentication and payments
|
|
4
|
-
*/
|
|
5
|
-
interface SPAPSConfig {
|
|
6
|
-
apiUrl?: string;
|
|
7
|
-
apiKey?: string;
|
|
8
|
-
autoDetect?: boolean;
|
|
9
|
-
timeout?: number;
|
|
10
|
-
}
|
|
11
|
-
interface AuthResponse {
|
|
12
|
-
access_token: string;
|
|
13
|
-
refresh_token: string;
|
|
14
|
-
user: User;
|
|
15
|
-
}
|
|
16
|
-
interface User {
|
|
17
|
-
id: string;
|
|
18
|
-
email?: string;
|
|
19
|
-
wallet_address?: string;
|
|
20
|
-
chain_type?: string;
|
|
21
|
-
role: string;
|
|
22
|
-
created_at?: string;
|
|
23
|
-
}
|
|
24
|
-
interface CheckoutSession {
|
|
25
|
-
sessionId: string;
|
|
26
|
-
url: string;
|
|
27
|
-
}
|
|
28
|
-
interface Subscription {
|
|
29
|
-
id: string;
|
|
30
|
-
status: string;
|
|
31
|
-
plan: string;
|
|
32
|
-
current_period_end: string;
|
|
33
|
-
}
|
|
34
|
-
interface UsageBalance {
|
|
35
|
-
balance: number;
|
|
36
|
-
currency: string;
|
|
37
|
-
updated_at: string;
|
|
38
|
-
}
|
|
39
|
-
declare class SPAPSClient {
|
|
40
|
-
private client;
|
|
41
|
-
private apiKey?;
|
|
42
|
-
private accessToken?;
|
|
43
|
-
private refreshToken?;
|
|
44
|
-
private _isLocalMode;
|
|
45
|
-
constructor(config?: SPAPSConfig);
|
|
46
|
-
login(email: string, password: string): Promise<{
|
|
47
|
-
data: AuthResponse;
|
|
48
|
-
}>;
|
|
49
|
-
register(email: string, password: string): Promise<{
|
|
50
|
-
data: AuthResponse;
|
|
51
|
-
}>;
|
|
52
|
-
walletSignIn(walletAddress: string, signature: string, message: string, chainType?: 'solana' | 'ethereum'): Promise<{
|
|
53
|
-
data: AuthResponse;
|
|
54
|
-
}>;
|
|
55
|
-
refresh(refreshToken?: string): Promise<{
|
|
56
|
-
data: AuthResponse;
|
|
57
|
-
}>;
|
|
58
|
-
logout(): Promise<void>;
|
|
59
|
-
getUser(): Promise<{
|
|
60
|
-
data: User;
|
|
61
|
-
}>;
|
|
62
|
-
createCheckoutSession(priceId: string, successUrl: string, cancelUrl?: string): Promise<{
|
|
63
|
-
data: CheckoutSession;
|
|
64
|
-
}>;
|
|
65
|
-
getSubscription(): Promise<{
|
|
66
|
-
data: Subscription;
|
|
67
|
-
}>;
|
|
68
|
-
cancelSubscription(): Promise<void>;
|
|
69
|
-
getUsageBalance(): Promise<{
|
|
70
|
-
data: UsageBalance;
|
|
71
|
-
}>;
|
|
72
|
-
recordUsage(feature: string, amount: number): Promise<void>;
|
|
73
|
-
isAuthenticated(): boolean;
|
|
74
|
-
getAccessToken(): string | undefined;
|
|
75
|
-
setAccessToken(token: string): void;
|
|
76
|
-
isLocalMode(): boolean;
|
|
77
|
-
health(): Promise<{
|
|
78
|
-
data: any;
|
|
79
|
-
}>;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export { type AuthResponse, type CheckoutSession, SPAPSClient as SPAPS, SPAPSClient, type SPAPSConfig, type Subscription, SPAPSClient as SweetPotatoSDK, type UsageBalance, type User, SPAPSClient as default };
|