spine-framework 0.1.21 → 0.1.23
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/.framework/cli/commands/init.ts +0 -2
- package/.framework/cli/index.ts +58 -51
- package/.framework/functions/_shared/db.ts +3 -3
- package/.framework/migrations/000_foundation.sql +21 -12
- package/.framework/migrations/002_seed_constraints.sql +9 -3
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -96,8 +96,6 @@ function writeEnvFile(dryRun: boolean): void {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
function copyFrameworkFiles(dryRun: boolean): void {
|
|
99
|
-
console.log(` package: ${PACKAGE_ROOT}`)
|
|
100
|
-
console.log(` project: ${PROJECT_ROOT}`)
|
|
101
99
|
// Directories and files to copy from the package root into the consumer project root
|
|
102
100
|
const items = [
|
|
103
101
|
{ src: '.framework', dest: '.framework' },
|
package/.framework/cli/index.ts
CHANGED
|
@@ -39,7 +39,6 @@
|
|
|
39
39
|
* @seeAlso functions/_shared/index.ts (core functions exposed to CLI)
|
|
40
40
|
*/
|
|
41
41
|
|
|
42
|
-
import './env-loader.ts'
|
|
43
42
|
import { Command } from 'commander'
|
|
44
43
|
|
|
45
44
|
const program = new Command()
|
|
@@ -50,59 +49,67 @@ program
|
|
|
50
49
|
.version('2.0.0')
|
|
51
50
|
.option('--account <id>', 'Override the account ID for this command')
|
|
52
51
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
{ registerItemCommands },
|
|
57
|
-
{ registerAgentCommands },
|
|
58
|
-
{ registerMigrationCommands },
|
|
59
|
-
{ registerDoctorCommands },
|
|
60
|
-
{ registerDevCommands },
|
|
61
|
-
{ registerTestCommands },
|
|
62
|
-
{ registerSystemCommands },
|
|
63
|
-
{ registerGenerateCommands },
|
|
64
|
-
{ registerCreateAppCommands },
|
|
65
|
-
{ registerInitCommands },
|
|
66
|
-
{ registerInstallAppCommands },
|
|
67
|
-
{ registerStatusCommands },
|
|
68
|
-
{ registerUninstallAppCommands },
|
|
69
|
-
{ registerMigrateCommands },
|
|
70
|
-
] = await Promise.all([
|
|
71
|
-
import('./commands/auth.ts'),
|
|
72
|
-
import('./commands/pipelines.ts'),
|
|
73
|
-
import('./commands/items.ts'),
|
|
74
|
-
import('./commands/agents.ts'),
|
|
75
|
-
import('./commands/migrations.ts'),
|
|
76
|
-
import('./commands/doctor.ts'),
|
|
77
|
-
import('./commands/dev.ts'),
|
|
78
|
-
import('./commands/test.ts'),
|
|
79
|
-
import('./commands/system.ts'),
|
|
80
|
-
import('./commands/generate.ts'),
|
|
81
|
-
import('./commands/create-app.ts'),
|
|
82
|
-
import('./commands/init.ts'),
|
|
83
|
-
import('./commands/install-app.ts'),
|
|
84
|
-
import('./commands/status.ts'),
|
|
85
|
-
import('./commands/uninstall-app.ts'),
|
|
86
|
-
import('./commands/migrate.ts'),
|
|
87
|
-
])
|
|
88
|
-
|
|
89
|
-
registerAuthCommands(program)
|
|
90
|
-
registerPipelineCommands(program)
|
|
91
|
-
registerItemCommands(program)
|
|
92
|
-
registerAgentCommands(program)
|
|
93
|
-
registerMigrationCommands(program)
|
|
94
|
-
registerDoctorCommands(program)
|
|
95
|
-
registerDevCommands(program)
|
|
96
|
-
registerTestCommands(program)
|
|
97
|
-
registerSystemCommands(program)
|
|
98
|
-
registerGenerateCommands(program)
|
|
99
|
-
registerCreateAppCommands(program)
|
|
52
|
+
// Commands that do NOT need DB/env — safe to run on a fresh install
|
|
53
|
+
const { registerInitCommands } = await import('./commands/init.ts')
|
|
54
|
+
const { registerMigrateCommands } = await import('./commands/migrate.ts')
|
|
100
55
|
registerInitCommands(program)
|
|
101
|
-
registerInstallAppCommands(program)
|
|
102
|
-
registerStatusCommands(program)
|
|
103
|
-
registerUninstallAppCommands(program)
|
|
104
56
|
registerMigrateCommands(program)
|
|
105
57
|
|
|
58
|
+
// All other commands require SUPABASE_URL to be set — only load if not init/migrate
|
|
59
|
+
const subcommand = process.argv[2]
|
|
60
|
+
const noDbCommands = ['init', 'migrate', '--help', '-h', '--version', '-V', undefined]
|
|
61
|
+
|
|
62
|
+
if (!noDbCommands.includes(subcommand)) {
|
|
63
|
+
await import('./env-loader.ts')
|
|
64
|
+
|
|
65
|
+
const [
|
|
66
|
+
{ registerAuthCommands },
|
|
67
|
+
{ registerPipelineCommands },
|
|
68
|
+
{ registerItemCommands },
|
|
69
|
+
{ registerAgentCommands },
|
|
70
|
+
{ registerMigrationCommands },
|
|
71
|
+
{ registerDoctorCommands },
|
|
72
|
+
{ registerDevCommands },
|
|
73
|
+
{ registerTestCommands },
|
|
74
|
+
{ registerSystemCommands },
|
|
75
|
+
{ registerGenerateCommands },
|
|
76
|
+
{ registerCreateAppCommands },
|
|
77
|
+
{ registerInstallAppCommands },
|
|
78
|
+
{ registerStatusCommands },
|
|
79
|
+
{ registerUninstallAppCommands },
|
|
80
|
+
] = await Promise.all([
|
|
81
|
+
import('./commands/auth.ts'),
|
|
82
|
+
import('./commands/pipelines.ts'),
|
|
83
|
+
import('./commands/items.ts'),
|
|
84
|
+
import('./commands/agents.ts'),
|
|
85
|
+
import('./commands/migrations.ts'),
|
|
86
|
+
import('./commands/doctor.ts'),
|
|
87
|
+
import('./commands/dev.ts'),
|
|
88
|
+
import('./commands/test.ts'),
|
|
89
|
+
import('./commands/system.ts'),
|
|
90
|
+
import('./commands/generate.ts'),
|
|
91
|
+
import('./commands/create-app.ts'),
|
|
92
|
+
import('./commands/install-app.ts'),
|
|
93
|
+
import('./commands/status.ts'),
|
|
94
|
+
import('./commands/uninstall-app.ts'),
|
|
95
|
+
])
|
|
96
|
+
|
|
97
|
+
registerAuthCommands(program)
|
|
98
|
+
registerPipelineCommands(program)
|
|
99
|
+
registerItemCommands(program)
|
|
100
|
+
registerAgentCommands(program)
|
|
101
|
+
registerMigrationCommands(program)
|
|
102
|
+
registerDoctorCommands(program)
|
|
103
|
+
registerDevCommands(program)
|
|
104
|
+
registerTestCommands(program)
|
|
105
|
+
registerSystemCommands(program)
|
|
106
|
+
registerGenerateCommands(program)
|
|
107
|
+
registerCreateAppCommands(program)
|
|
108
|
+
registerInstallAppCommands(program)
|
|
109
|
+
registerStatusCommands(program)
|
|
110
|
+
registerUninstallAppCommands(program)
|
|
111
|
+
}
|
|
112
|
+
|
|
106
113
|
program.parseAsync(process.argv).catch((err) => {
|
|
107
114
|
console.error('Error:', err.message)
|
|
108
115
|
process.exit(1)
|
|
@@ -31,9 +31,9 @@ import { createClient } from '@supabase/supabase-js'
|
|
|
31
31
|
* @calledBy adminDb, getUserDb (applied at client construction time)
|
|
32
32
|
*/
|
|
33
33
|
const _env = (globalThis as any).process?.env || {}
|
|
34
|
-
const supabaseUrl: string = _env.SUPABASE_URL
|
|
35
|
-
const supabaseServiceKey: string = _env.SUPABASE_SERVICE_ROLE_KEY
|
|
36
|
-
const supabaseAnonKey: string = _env.SUPABASE_ANON_KEY
|
|
34
|
+
const supabaseUrl: string = _env.SUPABASE_URL || 'https://placeholder.supabase.co'
|
|
35
|
+
const supabaseServiceKey: string = _env.SUPABASE_SERVICE_ROLE_KEY || ''
|
|
36
|
+
const supabaseAnonKey: string = _env.SUPABASE_ANON_KEY || ''
|
|
37
37
|
const dbSchema: string = _env.DB_SCHEMA || 'public'
|
|
38
38
|
|
|
39
39
|
// ─── CLIENTS ─────────────────────────────────────────────────────────────────
|
|
@@ -239,22 +239,31 @@ CREATE TABLE IF NOT EXISTS public.people (
|
|
|
239
239
|
);
|
|
240
240
|
|
|
241
241
|
-- add deferred FKs now that people exists
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
ALTER TABLE public.people
|
|
247
|
-
|
|
242
|
+
DO $$ BEGIN
|
|
243
|
+
ALTER TABLE public.accounts ADD CONSTRAINT accounts_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.people(id) ON DELETE SET NULL;
|
|
244
|
+
EXCEPTION WHEN duplicate_object THEN NULL; END $$;
|
|
245
|
+
DO $$ BEGIN
|
|
246
|
+
ALTER TABLE public.accounts ADD CONSTRAINT accounts_updated_by_fkey FOREIGN KEY (updated_by) REFERENCES public.people(id) ON DELETE SET NULL;
|
|
247
|
+
EXCEPTION WHEN duplicate_object THEN NULL; END $$;
|
|
248
|
+
DO $$ BEGIN
|
|
249
|
+
ALTER TABLE public.people ADD CONSTRAINT people_created_by_fkey FOREIGN KEY (created_by) REFERENCES public.people(id) ON DELETE SET NULL;
|
|
250
|
+
EXCEPTION WHEN duplicate_object THEN NULL; END $$;
|
|
248
251
|
|
|
249
252
|
-- add FK on roles.account_id and roles.app_id
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
+
DO $$ BEGIN
|
|
254
|
+
ALTER TABLE public.roles ADD CONSTRAINT roles_account_id_fkey FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE CASCADE;
|
|
255
|
+
EXCEPTION WHEN duplicate_object THEN NULL; END $$;
|
|
256
|
+
DO $$ BEGIN
|
|
257
|
+
ALTER TABLE public.roles ADD CONSTRAINT roles_app_id_fkey FOREIGN KEY (app_id) REFERENCES public.apps(id) ON DELETE CASCADE;
|
|
258
|
+
EXCEPTION WHEN duplicate_object THEN NULL; END $$;
|
|
253
259
|
|
|
254
260
|
-- add FK on apps.account_id and apps.owner_account_id
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
261
|
+
DO $$ BEGIN
|
|
262
|
+
ALTER TABLE public.apps ADD CONSTRAINT apps_account_id_fkey FOREIGN KEY (account_id) REFERENCES public.accounts(id) ON DELETE SET NULL;
|
|
263
|
+
EXCEPTION WHEN duplicate_object THEN NULL; END $$;
|
|
264
|
+
DO $$ BEGIN
|
|
265
|
+
ALTER TABLE public.apps ADD CONSTRAINT apps_owner_account_id_fkey FOREIGN KEY (owner_account_id) REFERENCES public.accounts(id) ON DELETE SET NULL;
|
|
266
|
+
EXCEPTION WHEN duplicate_object THEN NULL; END $$;
|
|
258
267
|
|
|
259
268
|
-- items (depends on accounts, types, apps)
|
|
260
269
|
CREATE TABLE IF NOT EXISTS public.items (
|
|
@@ -4,10 +4,16 @@
|
|
|
4
4
|
-- =============================================================================
|
|
5
5
|
|
|
6
6
|
-- link_types needs unique on (app_id, slug) for seed upserts
|
|
7
|
-
|
|
7
|
+
DO $$ BEGIN
|
|
8
|
+
ALTER TABLE public.link_types ADD CONSTRAINT link_types_app_id_slug_key UNIQUE (app_id, slug);
|
|
9
|
+
EXCEPTION WHEN duplicate_object THEN NULL; END $$;
|
|
8
10
|
|
|
9
11
|
-- triggers needs unique on (app_id, name) for seed upserts
|
|
10
|
-
|
|
12
|
+
DO $$ BEGIN
|
|
13
|
+
ALTER TABLE public.triggers ADD CONSTRAINT triggers_app_id_name_key UNIQUE (app_id, name);
|
|
14
|
+
EXCEPTION WHEN duplicate_object THEN NULL; END $$;
|
|
11
15
|
|
|
12
16
|
-- pipelines needs unique on (app_id, name) for seed upserts
|
|
13
|
-
|
|
17
|
+
DO $$ BEGIN
|
|
18
|
+
ALTER TABLE public.pipelines ADD CONSTRAINT pipelines_app_id_name_key UNIQUE (app_id, name);
|
|
19
|
+
EXCEPTION WHEN duplicate_object THEN NULL; END $$;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../.framework/cli/commands/init.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../.framework/cli/commands/init.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AA0IxC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,QAcpD"}
|
package/dist/cli/index.d.ts
CHANGED
package/dist/cli/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../.framework/cli/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../.framework/cli/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG"}
|