spine-framework 0.1.8 → 0.1.10
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.
|
@@ -36,16 +36,6 @@ const supabaseServiceKey: string = _env.SUPABASE_SERVICE_ROLE_KEY!
|
|
|
36
36
|
const supabaseAnonKey: string = _env.SUPABASE_ANON_KEY!
|
|
37
37
|
const dbSchema: string = _env.DB_SCHEMA || 'public'
|
|
38
38
|
|
|
39
|
-
function getEnv() {
|
|
40
|
-
const e = (globalThis as any).process?.env || {}
|
|
41
|
-
return {
|
|
42
|
-
supabaseUrl: e.SUPABASE_URL as string,
|
|
43
|
-
supabaseServiceKey: e.SUPABASE_SERVICE_ROLE_KEY as string,
|
|
44
|
-
supabaseAnonKey: e.SUPABASE_ANON_KEY as string,
|
|
45
|
-
dbSchema: (e.DB_SCHEMA || 'public') as string,
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
39
|
// ─── CLIENTS ─────────────────────────────────────────────────────────────────
|
|
50
40
|
|
|
51
41
|
/**
|
|
@@ -83,7 +73,8 @@ function getEnv() {
|
|
|
83
73
|
* ```
|
|
84
74
|
*/
|
|
85
75
|
export const adminDb = createClient(supabaseUrl, supabaseServiceKey, {
|
|
86
|
-
db: { schema: dbSchema }
|
|
76
|
+
db: { schema: dbSchema },
|
|
77
|
+
realtime: { transport: typeof WebSocket !== 'undefined' ? WebSocket : undefined } as any,
|
|
87
78
|
})
|
|
88
79
|
|
|
89
80
|
// ─── CHUNK_START: SHARED_DB_GET_USER_DB ──────────────────────────────────────────────
|
|
@@ -101,7 +92,6 @@ export const adminDb = createClient(supabaseUrl, supabaseServiceKey, {
|
|
|
101
92
|
* @tags database, supabase, rls, authentication, user-scoped
|
|
102
93
|
*/
|
|
103
94
|
export function getUserDb(jwt: string) {
|
|
104
|
-
const { supabaseUrl, supabaseAnonKey, dbSchema } = getEnv()
|
|
105
95
|
return createClient(supabaseUrl, supabaseAnonKey, {
|
|
106
96
|
db: {
|
|
107
97
|
schema: dbSchema
|
package/bin/spine-framework.cjs
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// This file is the npm bin entry point for spine-framework.
|
|
4
4
|
const { execFileSync } = require('child_process')
|
|
5
5
|
const { resolve } = require('path')
|
|
6
|
+
const fs = require('fs')
|
|
6
7
|
|
|
7
8
|
const pkgRoot = resolve(__dirname, '..')
|
|
8
9
|
const projectRoot = resolve(pkgRoot, '../..')
|
|
@@ -13,10 +14,19 @@ if (process.argv.length === 2) {
|
|
|
13
14
|
process.exit(0)
|
|
14
15
|
}
|
|
15
16
|
|
|
17
|
+
// Pre-parse credential flags so db.ts sees them as env vars at module load time.
|
|
18
|
+
// tsx evaluates db.ts before Commander parses args, so we must inject here.
|
|
19
|
+
const args = process.argv.slice(2)
|
|
20
|
+
const childEnv = { ...process.env }
|
|
21
|
+
for (let i = 0; i < args.length; i++) {
|
|
22
|
+
if (args[i] === '--url' && args[i + 1]) childEnv.SUPABASE_URL = args[++i]
|
|
23
|
+
if (args[i] === '--anon-key' && args[i + 1]) childEnv.SUPABASE_ANON_KEY = args[++i]
|
|
24
|
+
if (args[i] === '--service-role-key' && args[i + 1]) childEnv.SUPABASE_SERVICE_ROLE_KEY = args[++i]
|
|
25
|
+
}
|
|
26
|
+
|
|
16
27
|
const entry = resolve(pkgRoot, '.framework/cli/index.ts')
|
|
17
28
|
|
|
18
29
|
// Find tsx: prefer consuming project's copy, fall back to our own
|
|
19
|
-
const fs = require('fs')
|
|
20
30
|
const tsxPaths = [
|
|
21
31
|
resolve(projectRoot, 'node_modules/.bin/tsx'),
|
|
22
32
|
resolve(pkgRoot, 'node_modules/.bin/tsx'),
|
|
@@ -29,7 +39,7 @@ if (!tsx) {
|
|
|
29
39
|
}
|
|
30
40
|
|
|
31
41
|
try {
|
|
32
|
-
execFileSync(tsx, [entry, ...process.argv.slice(2)], { stdio: 'inherit' })
|
|
42
|
+
execFileSync(tsx, [entry, ...process.argv.slice(2)], { stdio: 'inherit', env: childEnv })
|
|
33
43
|
} catch (e) {
|
|
34
44
|
process.exit(e.status ?? 1)
|
|
35
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../../.framework/functions/_shared/db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../../.framework/functions/_shared/db.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA0BH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,eAAO,MAAM,OAAO,iFAGlB,CAAA;AAGF;;;;;;;;;;;;GAYG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,mFAWpC;AAKD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI;IACxB,IAAI,EAAE,CAAC,GAAG,IAAI,CAAA;IACd,KAAK,EAAE,GAAG,CAAA;CACX,CAAA;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,KAAK;;;;;;;;CAQjB,CAAA"}
|