spine-framework 0.1.54 → 0.1.56
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.
|
@@ -267,12 +267,43 @@ async function upsertPipelines(appId: string, records: any[], dryRun: boolean):
|
|
|
267
267
|
return result
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
+
async function upsertRoles(appId: string, records: any[], dryRun: boolean): Promise<SeedResult> {
|
|
271
|
+
const result: SeedResult = { table: 'roles', inserted: 0, skipped: 0, errors: [] }
|
|
272
|
+
|
|
273
|
+
for (const record of records) {
|
|
274
|
+
if (dryRun) {
|
|
275
|
+
console.log(` [dry-run] Would upsert role: ${record.slug}`)
|
|
276
|
+
result.inserted++
|
|
277
|
+
continue
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const { error } = await adminDb
|
|
281
|
+
.from('roles')
|
|
282
|
+
.upsert({
|
|
283
|
+
...record,
|
|
284
|
+
app_id: appId,
|
|
285
|
+
}, {
|
|
286
|
+
onConflict: 'app_id,slug',
|
|
287
|
+
ignoreDuplicates: false
|
|
288
|
+
})
|
|
289
|
+
|
|
290
|
+
if (error) {
|
|
291
|
+
result.errors.push(`${record.slug}: ${error.message}`)
|
|
292
|
+
} else {
|
|
293
|
+
result.inserted++
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
return result
|
|
298
|
+
}
|
|
299
|
+
|
|
270
300
|
const SEED_HANDLERS: Record<string, (appId: string, records: any[], dryRun: boolean) => Promise<SeedResult>> = {
|
|
271
301
|
'types.json': upsertTypes,
|
|
272
302
|
'link-types.json': upsertLinkTypes,
|
|
273
303
|
'triggers.json': upsertTriggers,
|
|
274
304
|
'accounts.json': upsertAccounts,
|
|
275
305
|
'pipelines.json': upsertPipelines,
|
|
306
|
+
'roles.json': upsertRoles,
|
|
276
307
|
}
|
|
277
308
|
|
|
278
309
|
async function recordInstallation(appSlug: string, accountId: string | null, dryRun: boolean): Promise<void> {
|
|
@@ -63,11 +63,19 @@ ON CONFLICT (slug) DO NOTHING;
|
|
|
63
63
|
-- accounts.type_id and people.type_id are both NOT NULL, so these must exist
|
|
64
64
|
-- before any account or person can be created.
|
|
65
65
|
-- ---------------------------------------------------------------------------
|
|
66
|
-
INSERT INTO public.types (app_id, kind, slug, name, description, ownership, is_active)
|
|
66
|
+
INSERT INTO public.types (app_id, kind, slug, name, description, ownership, is_active, design_schema, validation_schema)
|
|
67
67
|
VALUES
|
|
68
|
-
((SELECT id FROM public.apps WHERE slug = 'spine-core'), 'account', 'account', 'Account', 'Organization or tenant account', 'pack', true
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
((SELECT id FROM public.apps WHERE slug = 'spine-core'), 'account', 'account', 'Account', 'Organization or tenant account', 'pack', true,
|
|
69
|
+
'{"views":{"default_list":{"type":"list","label":"Accounts","fields":{"slug":{"sortable":true,"display_type":"text"},"is_active":{"sortable":true,"display_type":"badge"},"display_name":{"sortable":true,"display_type":"text"}},"display":"table"},"default_detail":{"type":"detail","label":"Account","sections":[{"title":"Overview","fields":["slug","display_name","description","is_active"]},{"title":"Metadata","fields":["created_at","updated_at"]}]}},"fields":{"slug":{"label":"Slug","system":true,"required":true,"data_type":"text","validation":null},"is_active":{"label":"Active","system":true,"required":true,"data_type":"boolean","validation":null},"created_at":{"label":"Created","system":true,"readonly":true,"required":false,"data_type":"datetime","validation":null},"updated_at":{"label":"Updated","system":true,"readonly":true,"required":false,"data_type":"datetime","validation":null},"description":{"label":"Description","system":true,"required":false,"data_type":"textarea","validation":null},"display_name":{"label":"Display Name","system":true,"required":true,"data_type":"text","validation":null}},"record_permissions":{"member":["create","read","update"],"support":["create","read","update"],"system_admin":["create","read","update","delete"]}}'::jsonb,
|
|
70
|
+
'{}'::jsonb),
|
|
71
|
+
((SELECT id FROM public.apps WHERE slug = 'spine-core'), 'person', 'person', 'Person', 'User or contact person', 'pack', true,
|
|
72
|
+
'{"views":{"default_list":{"type":"list","label":"People","fields":{"email":{"sortable":true,"display_type":"text"},"status":{"sortable":true,"display_type":"badge"},"full_name":{"sortable":true,"display_type":"text"},"is_active":{"sortable":true,"display_type":"badge"}},"display":"table"},"default_detail":{"type":"detail","label":"Person","sections":[{"title":"Profile","fields":["full_name","email","phone","avatar_url"]},{"title":"Status","fields":["status","is_active"]},{"title":"Metadata","fields":["created_at","updated_at"]}]}},"fields":{"email":{"label":"Email","system":true,"required":true,"data_type":"email","validation":null},"phone":{"label":"Phone","system":true,"required":false,"data_type":"phone","validation":null},"status":{"label":"Status","system":true,"required":true,"data_type":"text","validation":null},"full_name":{"label":"Full Name","system":true,"required":true,"data_type":"text","validation":null},"is_active":{"label":"Active","system":true,"required":true,"data_type":"boolean","validation":null},"avatar_url":{"label":"Avatar URL","system":true,"required":false,"data_type":"url","validation":null},"created_at":{"label":"Created","system":true,"readonly":true,"required":false,"data_type":"datetime","validation":null},"updated_at":{"label":"Updated","system":true,"readonly":true,"required":false,"data_type":"datetime","validation":null}},"record_permissions":{"member":["create","read","update"],"support":["create","read","update"],"system_admin":["create","read","update","delete"]}}'::jsonb,
|
|
73
|
+
'{}'::jsonb)
|
|
74
|
+
ON CONFLICT (app_id, kind, slug) DO UPDATE
|
|
75
|
+
SET design_schema = EXCLUDED.design_schema,
|
|
76
|
+
validation_schema = EXCLUDED.validation_schema,
|
|
77
|
+
name = EXCLUDED.name,
|
|
78
|
+
description = EXCLUDED.description;
|
|
71
79
|
|
|
72
80
|
-- ---------------------------------------------------------------------------
|
|
73
81
|
-- 4. Root System Account
|
|
@@ -77,15 +85,19 @@ ON CONFLICT (app_id, kind, slug) DO NOTHING;
|
|
|
77
85
|
-- via Supabase Auth invite + the onboarding flow, which stamps type_id and
|
|
78
86
|
-- role_id onto the resulting people row.
|
|
79
87
|
-- ---------------------------------------------------------------------------
|
|
80
|
-
INSERT INTO public.accounts (type_id, slug, display_name, description, is_active)
|
|
88
|
+
INSERT INTO public.accounts (type_id, slug, display_name, description, is_active, design_schema, validation_schema)
|
|
81
89
|
VALUES (
|
|
82
90
|
(SELECT id FROM public.types WHERE kind = 'account' AND slug = 'account'),
|
|
83
91
|
'spine-system',
|
|
84
92
|
'Spine System',
|
|
85
93
|
'Root system account for the Spine framework',
|
|
86
|
-
true
|
|
94
|
+
true,
|
|
95
|
+
(SELECT design_schema FROM public.types WHERE kind = 'account' AND slug = 'account'),
|
|
96
|
+
'{}'::jsonb
|
|
87
97
|
)
|
|
88
|
-
ON CONFLICT (slug) DO
|
|
98
|
+
ON CONFLICT (slug) DO UPDATE
|
|
99
|
+
SET design_schema = EXCLUDED.design_schema,
|
|
100
|
+
validation_schema = EXCLUDED.validation_schema;
|
|
89
101
|
|
|
90
102
|
-- ---------------------------------------------------------------------------
|
|
91
103
|
-- 5. Core Spine Types
|
|
@@ -14,9 +14,13 @@ DECLARE
|
|
|
14
14
|
v_type_id uuid;
|
|
15
15
|
v_role_id uuid;
|
|
16
16
|
v_is_first boolean;
|
|
17
|
+
v_design_schema jsonb;
|
|
18
|
+
v_validation_schema jsonb;
|
|
17
19
|
BEGIN
|
|
18
20
|
SELECT id INTO v_account_id FROM public.accounts WHERE slug = 'spine-system' LIMIT 1;
|
|
19
|
-
SELECT id
|
|
21
|
+
SELECT id, design_schema, validation_schema
|
|
22
|
+
INTO v_type_id, v_design_schema, v_validation_schema
|
|
23
|
+
FROM public.types WHERE kind = 'person' AND slug = 'person' LIMIT 1;
|
|
20
24
|
|
|
21
25
|
IF v_account_id IS NULL OR v_type_id IS NULL THEN
|
|
22
26
|
RAISE WARNING 'handle_new_auth_user: spine-system account or person type not found — skipping people insert';
|
|
@@ -37,7 +41,9 @@ BEGIN
|
|
|
37
41
|
account_id,
|
|
38
42
|
type_id,
|
|
39
43
|
role_id,
|
|
40
|
-
is_active
|
|
44
|
+
is_active,
|
|
45
|
+
design_schema,
|
|
46
|
+
validation_schema
|
|
41
47
|
) VALUES (
|
|
42
48
|
NEW.id,
|
|
43
49
|
NEW.id,
|
|
@@ -46,7 +52,9 @@ BEGIN
|
|
|
46
52
|
v_account_id,
|
|
47
53
|
v_type_id,
|
|
48
54
|
v_role_id,
|
|
49
|
-
true
|
|
55
|
+
true,
|
|
56
|
+
v_design_schema,
|
|
57
|
+
COALESCE(v_validation_schema, '{}'::jsonb)
|
|
50
58
|
)
|
|
51
59
|
ON CONFLICT (id) DO NOTHING;
|
|
52
60
|
|
|
@@ -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;
|
|
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;AAgexC,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,OAAO,QAgB1D"}
|
package/package-project.json
CHANGED
|
@@ -45,7 +45,13 @@
|
|
|
45
45
|
"@radix-ui/react-label": "^1.0.0",
|
|
46
46
|
"@radix-ui/react-popover": "^1.0.0",
|
|
47
47
|
"tailwindcss-animate": "^1.0.0",
|
|
48
|
-
"ws": "^8.0.0"
|
|
48
|
+
"ws": "^8.0.0",
|
|
49
|
+
"@tiptap/react": "^3.24.0",
|
|
50
|
+
"@tiptap/starter-kit": "^3.24.0",
|
|
51
|
+
"@tiptap/extension-code-block-lowlight": "^3.24.0",
|
|
52
|
+
"@tiptap/extension-placeholder": "^3.24.0",
|
|
53
|
+
"lowlight": "^3.3.0",
|
|
54
|
+
"highlight.js": "^11.11.1"
|
|
49
55
|
},
|
|
50
56
|
"devDependencies": {
|
|
51
57
|
"vite": "^6.4.3",
|