@newhomestar/sdk 0.7.24 → 0.7.25
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/dist/credentials.js +10 -0
- package/package.json +58 -58
package/dist/credentials.js
CHANGED
|
@@ -246,6 +246,16 @@ export async function resolveCredentialsViaHttp(authBaseUrl, slug, bearerToken,
|
|
|
246
246
|
const expiresAt = creds.expiresAt
|
|
247
247
|
? new Date(creds.expiresAt)
|
|
248
248
|
: new Date(Date.now() + 3600 * 1000); // default 1h if not provided
|
|
249
|
+
// ── Safety net: if the auth server returned an already-expired token,
|
|
250
|
+
// auto-retry with forceRefresh=true to trigger a server-side refresh.
|
|
251
|
+
// This guards against clock skew or a stale cached token on the auth server.
|
|
252
|
+
// Only retry once (when forceRefresh is not already true) to prevent infinite loops.
|
|
253
|
+
if (expiresAt.getTime() < Date.now() && !forceRefresh) {
|
|
254
|
+
console.warn(`[nova-sdk] ⚠️ Auth server returned an already-expired token for "${slug}" ` +
|
|
255
|
+
`(expired ${expiresAt.toISOString()}, now ${new Date().toISOString()}). ` +
|
|
256
|
+
`Auto-retrying with forceRefresh=true…`);
|
|
257
|
+
return resolveCredentialsViaHttp(authBaseUrl, slug, bearerToken, userId, { forceRefresh: true });
|
|
258
|
+
}
|
|
249
259
|
console.log(`[nova-sdk] ✅ Standard auth: received access token for "${slug}" — expires ${expiresAt.toISOString()}`);
|
|
250
260
|
return {
|
|
251
261
|
accessToken: creds.accessToken,
|
package/package.json
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@newhomestar/sdk",
|
|
3
|
-
"version": "0.7.
|
|
4
|
-
"description": "Type-safe SDK for building Nova pipelines (workers & functions)",
|
|
5
|
-
"homepage": "https://github.com/newhomestar/nova-node-sdk#readme",
|
|
6
|
-
"bugs": {
|
|
7
|
-
"url": "https://github.com/newhomestar/nova-node-sdk/issues"
|
|
8
|
-
},
|
|
9
|
-
"repository": {
|
|
10
|
-
"type": "git",
|
|
11
|
-
"url": "git+https://github.com/newhomestar/nova-node-sdk.git"
|
|
12
|
-
},
|
|
13
|
-
"license": "ISC",
|
|
14
|
-
"author": "Christian Gomez",
|
|
15
|
-
"type": "module",
|
|
16
|
-
"main": "dist/index.js",
|
|
17
|
-
"types": "dist/index.d.ts",
|
|
18
|
-
"exports": {
|
|
19
|
-
".": {
|
|
20
|
-
"import": "./dist/index.js",
|
|
21
|
-
"types": "./dist/index.d.ts"
|
|
22
|
-
},
|
|
23
|
-
"./next": {
|
|
24
|
-
"import": "./dist/next.js",
|
|
25
|
-
"types": "./dist/next.d.ts"
|
|
26
|
-
},
|
|
27
|
-
"./events": {
|
|
28
|
-
"import": "./dist/events.js",
|
|
29
|
-
"types": "./dist/events.d.ts"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"files": [
|
|
33
|
-
"dist"
|
|
34
|
-
],
|
|
35
|
-
"scripts": {
|
|
36
|
-
"build": "tsc"
|
|
37
|
-
},
|
|
38
|
-
"dependencies": {
|
|
39
|
-
"@openfga/sdk": "^0.9.0",
|
|
40
|
-
"@orpc/openapi": "1.7.4",
|
|
41
|
-
"@orpc/server": "1.7.4",
|
|
42
|
-
"@supabase/supabase-js": "^2.39.0",
|
|
43
|
-
"body-parser": "^1.20.2",
|
|
44
|
-
"dotenv": "^16.4.3",
|
|
45
|
-
"express": "^4.18.2",
|
|
46
|
-
"express-oauth2-jwt-bearer": "^1.7.4",
|
|
47
|
-
"undici": "^7.24.4",
|
|
48
|
-
"yaml": "^2.7.1"
|
|
49
|
-
},
|
|
50
|
-
"peerDependencies": {
|
|
51
|
-
"zod": ">=4.0.0"
|
|
52
|
-
},
|
|
53
|
-
"devDependencies": {
|
|
54
|
-
"@types/node": "^20.11.17",
|
|
55
|
-
"typescript": "^5.4.4",
|
|
56
|
-
"zod": "^4.3.0"
|
|
57
|
-
}
|
|
58
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@newhomestar/sdk",
|
|
3
|
+
"version": "0.7.25",
|
|
4
|
+
"description": "Type-safe SDK for building Nova pipelines (workers & functions)",
|
|
5
|
+
"homepage": "https://github.com/newhomestar/nova-node-sdk#readme",
|
|
6
|
+
"bugs": {
|
|
7
|
+
"url": "https://github.com/newhomestar/nova-node-sdk/issues"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/newhomestar/nova-node-sdk.git"
|
|
12
|
+
},
|
|
13
|
+
"license": "ISC",
|
|
14
|
+
"author": "Christian Gomez",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "dist/index.js",
|
|
17
|
+
"types": "dist/index.d.ts",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"import": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts"
|
|
22
|
+
},
|
|
23
|
+
"./next": {
|
|
24
|
+
"import": "./dist/next.js",
|
|
25
|
+
"types": "./dist/next.d.ts"
|
|
26
|
+
},
|
|
27
|
+
"./events": {
|
|
28
|
+
"import": "./dist/events.js",
|
|
29
|
+
"types": "./dist/events.d.ts"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"dist"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsc"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@openfga/sdk": "^0.9.0",
|
|
40
|
+
"@orpc/openapi": "1.7.4",
|
|
41
|
+
"@orpc/server": "1.7.4",
|
|
42
|
+
"@supabase/supabase-js": "^2.39.0",
|
|
43
|
+
"body-parser": "^1.20.2",
|
|
44
|
+
"dotenv": "^16.4.3",
|
|
45
|
+
"express": "^4.18.2",
|
|
46
|
+
"express-oauth2-jwt-bearer": "^1.7.4",
|
|
47
|
+
"undici": "^7.24.4",
|
|
48
|
+
"yaml": "^2.7.1"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"zod": ">=4.0.0"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/node": "^20.11.17",
|
|
55
|
+
"typescript": "^5.4.4",
|
|
56
|
+
"zod": "^4.3.0"
|
|
57
|
+
}
|
|
58
|
+
}
|