@wefunder/sdk 0.1.0-beta.4 → 0.1.0-beta.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 +3 -3
- package/dist/index.cjs +8 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -102,10 +102,10 @@ const wf = new Wefunder({
|
|
|
102
102
|
|
|
103
103
|
OAuth uses two hosts, independently overridable:
|
|
104
104
|
|
|
105
|
-
- **
|
|
106
|
-
- **
|
|
105
|
+
- **token host** — `/token` + refresh (`fromClientCredentials`, `exchangeCode`, refresh). Defaults to `https://api.wefunder.com/oauth`. The edge gateway routes by the credential's mode (a `pk_test_` grant mints in sandbox, `pk_live_` in live), so one host serves both. Override via `tokenBaseUrl` (or set both with `oauthBaseUrl`).
|
|
106
|
+
- **authorize host** — the browser consent redirect (`createAuthorizationUrl`). Picked from the `client_id`: `pk_test_` → `https://oauth.wefunder-sandbox.com/oauth` (sandbox consent), otherwise `https://wefunder.com/oauth` (live). Override via `authorizeBaseUrl`.
|
|
107
107
|
|
|
108
|
-
The **API base** is `WefunderOptions.baseUrl` (default `https://api.wefunder.com
|
|
108
|
+
The **API base** is `WefunderOptions.baseUrl` (default `https://api.wefunder.com`, version-free). The API version is pinned by the `Wefunder-Version` header, not the path; `/api/v2` remains a working back-compat alias.
|
|
109
109
|
|
|
110
110
|
## Pagination
|
|
111
111
|
|
package/dist/index.cjs
CHANGED
|
@@ -28,6 +28,7 @@ __export(index_exports, {
|
|
|
28
28
|
DELIVERY_ID_HEADER: () => DELIVERY_ID_HEADER,
|
|
29
29
|
EVENT_HEADER: () => EVENT_HEADER,
|
|
30
30
|
REQUEST_ID_HEADER: () => REQUEST_ID_HEADER,
|
|
31
|
+
SANDBOX_AUTHORIZE_BASE_URL: () => SANDBOX_AUTHORIZE_BASE_URL,
|
|
31
32
|
SIGNATURE_HEADER: () => SIGNATURE_HEADER,
|
|
32
33
|
TIMESTAMP_HEADER: () => TIMESTAMP_HEADER,
|
|
33
34
|
Wefunder: () => Wefunder,
|
|
@@ -946,10 +947,11 @@ function createFetch(deps) {
|
|
|
946
947
|
// src/oauth.ts
|
|
947
948
|
var import_node_crypto = require("crypto");
|
|
948
949
|
var DEFAULT_AUTHORIZE_BASE_URL = "https://wefunder.com/oauth";
|
|
949
|
-
var
|
|
950
|
+
var SANDBOX_AUTHORIZE_BASE_URL = "https://oauth.wefunder-sandbox.com/oauth";
|
|
951
|
+
var DEFAULT_TOKEN_BASE_URL = "https://api.wefunder.com/oauth";
|
|
950
952
|
var DEFAULT_OAUTH_BASE_URL = DEFAULT_AUTHORIZE_BASE_URL;
|
|
951
|
-
function
|
|
952
|
-
return
|
|
953
|
+
function defaultAuthorizeBase(clientId) {
|
|
954
|
+
return clientId.startsWith("pk_test_") ? SANDBOX_AUTHORIZE_BASE_URL : DEFAULT_AUTHORIZE_BASE_URL;
|
|
953
955
|
}
|
|
954
956
|
function resolveTokenBase(o) {
|
|
955
957
|
return o.tokenBaseUrl ?? o.oauthBaseUrl ?? DEFAULT_TOKEN_BASE_URL;
|
|
@@ -989,7 +991,7 @@ function generatePkce() {
|
|
|
989
991
|
return { codeVerifier, codeChallenge, codeChallengeMethod: "S256" };
|
|
990
992
|
}
|
|
991
993
|
function createAuthorizationUrl(opts) {
|
|
992
|
-
const base =
|
|
994
|
+
const base = opts.authorizeBaseUrl ?? opts.oauthBaseUrl ?? defaultAuthorizeBase(opts.clientId);
|
|
993
995
|
const q = new URLSearchParams({
|
|
994
996
|
response_type: "code",
|
|
995
997
|
client_id: opts.clientId,
|
|
@@ -1503,7 +1505,7 @@ var revokePartnerInvite = (options) => (options.client ?? client).delete({
|
|
|
1503
1505
|
});
|
|
1504
1506
|
|
|
1505
1507
|
// src/client.ts
|
|
1506
|
-
var DEFAULT_API_BASE_URL = "https://api.wefunder.com
|
|
1508
|
+
var DEFAULT_API_BASE_URL = "https://api.wefunder.com";
|
|
1507
1509
|
var DEFAULT_API_VERSION = "2025-01-15";
|
|
1508
1510
|
function modeForToken(token) {
|
|
1509
1511
|
if (token.startsWith("at_live_")) return "live";
|
|
@@ -1728,6 +1730,7 @@ function constructEvent(payload, headers, secret, opts) {
|
|
|
1728
1730
|
DELIVERY_ID_HEADER,
|
|
1729
1731
|
EVENT_HEADER,
|
|
1730
1732
|
REQUEST_ID_HEADER,
|
|
1733
|
+
SANDBOX_AUTHORIZE_BASE_URL,
|
|
1731
1734
|
SIGNATURE_HEADER,
|
|
1732
1735
|
TIMESTAMP_HEADER,
|
|
1733
1736
|
Wefunder,
|