spine-framework 0.1.46 → 0.1.48

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.
@@ -61,11 +61,20 @@ async function resolveAppId(slug: string): Promise<string | null> {
61
61
  return data?.id || null
62
62
  }
63
63
 
64
+ async function resolveSystemAccountId(): Promise<string | null> {
65
+ const { data } = await adminDb
66
+ .from('accounts')
67
+ .select('id')
68
+ .eq('slug', 'spine-system')
69
+ .maybeSingle()
70
+ return data?.id || null
71
+ }
72
+
64
73
  async function ensureAppRecord(slug: string, name: string): Promise<string> {
65
74
  let appId = await resolveAppId(slug)
66
75
 
67
76
  if (!appId) {
68
- // Read manifest for display name
77
+ const ownerAccountId = await resolveSystemAccountId()
69
78
  const { error: insertErr, data } = await adminDb
70
79
  .from('apps')
71
80
  .insert({
@@ -75,6 +84,7 @@ async function ensureAppRecord(slug: string, name: string): Promise<string> {
75
84
  renderer: 'custom',
76
85
  is_active: true,
77
86
  is_system: false,
87
+ owner_account_id: ownerAccountId,
78
88
  })
79
89
  .select('id')
80
90
  .single()
@@ -308,27 +318,9 @@ function resolveSlugFromPackage(pkg: string): string {
308
318
  return pkg.replace(/^spine-framework-/, '').replace(/^@[^/]+\//, '')
309
319
  }
310
320
 
311
- async function checkPrerequisites(slug: string): Promise<void> {
312
- const PREREQS: Record<string, string[]> = {
313
- 'customer-portal': ['cortex'],
314
- }
315
- const required = PREREQS[slug]
316
- if (!required || required.length === 0) return
317
-
318
- for (const prereq of required) {
319
- const { data } = await adminDb
320
- .from('app_installations')
321
- .select('id')
322
- .eq('app_slug', prereq)
323
- .eq('is_enabled', true)
324
- .maybeSingle()
325
-
326
- if (!data) {
327
- console.error(` ❌ Prerequisite not installed: '${prereq}'`)
328
- console.error(` Run: spine-framework install-app spine-framework-${prereq}`)
329
- process.exit(1)
330
- }
331
- }
321
+ async function checkPrerequisites(_slug: string): Promise<void> {
322
+ // Apps are independently installable — no hardcoded prereqs.
323
+ // Future: read prereqs from the app's manifest.json if needed.
332
324
  }
333
325
 
334
326
  function copyAppFiles(pkg: string, slug: string): void {
@@ -38,18 +38,17 @@ export function LoginPage() {
38
38
  return
39
39
  }
40
40
 
41
- // Find app matching user's role
42
- const userRole = user.roles?.[0] // Single role per person
43
- if (userRole) {
44
- const matchingApp = apps.find(app => app.min_role === userRole)
45
- if (matchingApp?.route_prefix) {
46
- navigate(matchingApp.route_prefix, { replace: true })
47
- return
48
- }
41
+ // Find app matching user's role, or fall back to first routable app
42
+ const userRole = user.roles?.[0]
43
+ const routableApps = apps.filter(a => a.route_prefix && a.renderer !== 'none')
44
+ const matchingApp = (userRole && routableApps.find(app => app.min_role === userRole))
45
+ || routableApps[0]
46
+ if (matchingApp?.route_prefix) {
47
+ navigate(matchingApp.route_prefix, { replace: true })
48
+ return
49
49
  }
50
50
 
51
- // No matching app - show 404
52
- // The 404 will be handled by the catch-all route in App.tsx
51
+ // No routable apps installed — stay on login
53
52
  }
54
53
  }, [user, loading, apps, navigate])
55
54
 
@@ -1 +1 @@
1
- {"version":3,"file":"install-app.d.ts","sourceRoot":"","sources":["../../../.framework/cli/commands/install-app.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAocxC,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,QAgB1D"}
1
+ {"version":3,"file":"install-app.d.ts","sourceRoot":"","sources":["../../../.framework/cli/commands/install-app.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AA4bxC,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,QAgB1D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spine-framework",
3
- "version": "0.1.46",
3
+ "version": "0.1.48",
4
4
  "private": false,
5
5
  "description": "Spine — enterprise application framework built on Supabase + Netlify + React",
6
6
  "type": "module",