@newhomestar/sdk 0.8.11 → 0.8.12
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/index.js +12 -0
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import dotenv from "dotenv";
|
|
2
|
+
import cors from "cors";
|
|
2
3
|
import { createClient } from "@supabase/supabase-js";
|
|
3
4
|
import { OpenFgaClient } from "@openfga/sdk";
|
|
4
5
|
import { createServer } from "node:http";
|
|
@@ -648,6 +649,17 @@ import { auth } from "express-oauth2-jwt-bearer";
|
|
|
648
649
|
*/
|
|
649
650
|
export function runHttpServer(def, opts = {}) {
|
|
650
651
|
const app = express();
|
|
652
|
+
// ── CORS (must be registered BEFORE auth so OPTIONS preflight bypasses JWKS) ──
|
|
653
|
+
// Permissive by default — integrations are called by the Odyssey admin UI
|
|
654
|
+
// from browser origins (localhost:3000, admin dashboards, etc.). The actual
|
|
655
|
+
// security boundary is the JWT Bearer token verified by JWKS below.
|
|
656
|
+
app.use(cors({
|
|
657
|
+
origin: true, // reflect request origin
|
|
658
|
+
credentials: true,
|
|
659
|
+
methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'],
|
|
660
|
+
allowedHeaders: ['Content-Type', 'Authorization', 'X-Requested-With'],
|
|
661
|
+
maxAge: 86400,
|
|
662
|
+
}));
|
|
651
663
|
app.use(bodyParser.json());
|
|
652
664
|
// ── Determine whether auth is enabled ──
|
|
653
665
|
const skipAuth = opts.skipAuth ??
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newhomestar/sdk",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.12",
|
|
4
4
|
"description": "Type-safe SDK for building Nova pipelines (workers & functions)",
|
|
5
5
|
"homepage": "https://github.com/newhomestar/nova-node-sdk#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"@orpc/server": "1.7.4",
|
|
42
42
|
"@supabase/supabase-js": "^2.39.0",
|
|
43
43
|
"body-parser": "^1.20.2",
|
|
44
|
+
"cors": "^2.8.6",
|
|
44
45
|
"dotenv": "^16.4.3",
|
|
45
46
|
"express": "^4.18.2",
|
|
46
47
|
"express-oauth2-jwt-bearer": "^1.7.4",
|
|
@@ -51,6 +52,7 @@
|
|
|
51
52
|
"zod": ">=4.0.0"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
55
|
+
"@types/cors": "^2.8.19",
|
|
54
56
|
"@types/node": "^20.11.17",
|
|
55
57
|
"typescript": "^5.4.4",
|
|
56
58
|
"zod": "^4.3.0"
|