spaps-sdk 1.1.1 → 1.1.2

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.
Files changed (2) hide show
  1. package/README.md +36 -0
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @spaps/sdk
2
2
 
3
+ <a href="https://www.npmjs.com/package/spaps-sdk"><img alt="npm" src="https://img.shields.io/npm/v/spaps-sdk.svg"></a>
4
+ <img alt="node" src="https://img.shields.io/badge/node-%3E%3D14-brightgreen">
5
+ <img alt="types" src="https://img.shields.io/badge/types-TypeScript-blue">
6
+
3
7
  > Sweet Potato Authentication & Payment Service SDK
4
8
 
5
9
  Zero-config client for SPAPS authentication, payments, and permission checking. Works automatically with local development mode.
@@ -111,6 +115,38 @@ if (spaps.isAuthenticated()) {
111
115
  }
112
116
  ```
113
117
 
118
+ ## Local Mode Explained
119
+
120
+ - If `apiUrl` is omitted or points to `localhost`/`127.0.0.1`, the SDK runs in local mode.
121
+ - Local mode integrates seamlessly with the `spaps` CLI (`npx spaps local`), defaulting to `http://localhost:3300`.
122
+ - No API key is required in local mode; tokens and data are managed locally for development.
123
+
124
+ You can check the mode at runtime:
125
+
126
+ ```ts
127
+ spaps.isLocalMode(); // true | false
128
+ ```
129
+
130
+ ## Environment Variables
131
+
132
+ The SDK can read configuration from environment variables (useful in Next.js and Node):
133
+
134
+ - `SPAPS_API_URL` or `NEXT_PUBLIC_SPAPS_API_URL` — API base URL
135
+ - `SPAPS_API_KEY` — API key for production use
136
+
137
+ Example (Node):
138
+
139
+ ```bash
140
+ export SPAPS_API_URL=https://api.sweetpotato.dev
141
+ export SPAPS_API_KEY=spaps_xxx
142
+ ```
143
+
144
+ Example (Next.js):
145
+
146
+ ```env
147
+ NEXT_PUBLIC_SPAPS_API_URL=https://api.sweetpotato.dev
148
+ ```
149
+
114
150
  ## Features
115
151
 
116
152
  ### 🚀 Zero Configuration
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spaps-sdk",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Sweet Potato Authentication & Payment Service SDK - Zero-config client with built-in permission checking and role-based access control",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -17,8 +17,8 @@
17
17
  }
18
18
  },
19
19
  "scripts": {
20
- "build": "tsup src/index.ts --format cjs,esm --dts --clean",
21
- "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
20
+ "build": "tsup --tsconfig tsconfig.json src/index.ts --format cjs,esm --dts --clean",
21
+ "dev": "tsup --tsconfig tsconfig.json src/index.ts --format cjs,esm --dts --watch",
22
22
  "test": "echo \"No tests yet\"",
23
23
  "smoke-test": "npm run build && node smoke-test.js",
24
24
  "prepublishOnly": "npm run build && npm run smoke-test"