@selvajs/supabase-provider 0.19.5 → 0.19.7
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@selvajs/supabase-provider",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.7",
|
|
4
4
|
"description": "Supabase (Auth + Postgres + Storage) implementations of @selvajs/platform interfaces",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "VektorNode",
|
|
@@ -70,15 +70,15 @@
|
|
|
70
70
|
"!**/*.spec.*"
|
|
71
71
|
],
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@supabase/supabase-js": "^2.
|
|
73
|
+
"@supabase/supabase-js": "^2.117.2",
|
|
74
74
|
"sharp": "^0.35.4",
|
|
75
75
|
"@selvajs/platform": "^0.20.1"
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@types/node": "^26.
|
|
79
|
-
"supabase": "^2.
|
|
78
|
+
"@types/node": "^26.6.2",
|
|
79
|
+
"supabase": "^2.118.0",
|
|
80
80
|
"typescript": "~6.0.3",
|
|
81
|
-
"vitest": "^
|
|
81
|
+
"vitest": "^5.0.2",
|
|
82
82
|
"@selvajs/config": "0.0.4"
|
|
83
83
|
},
|
|
84
84
|
"scripts": {
|
|
@@ -120,11 +120,13 @@ create trigger trg_auth_user_created
|
|
|
120
120
|
|
|
121
121
|
alter table selva.user_profiles enable row level security;
|
|
122
122
|
|
|
123
|
+
drop policy if exists "user_profiles: any authenticated can read" on selva.user_profiles;
|
|
123
124
|
create policy "user_profiles: any authenticated can read"
|
|
124
125
|
on selva.user_profiles for select
|
|
125
126
|
to authenticated
|
|
126
127
|
using (true);
|
|
127
128
|
|
|
129
|
+
drop policy if exists "user_profiles: users can update own" on selva.user_profiles;
|
|
128
130
|
create policy "user_profiles: users can update own"
|
|
129
131
|
on selva.user_profiles for update
|
|
130
132
|
to authenticated
|
|
@@ -216,12 +218,16 @@ create index if not exists idx_project_members_user
|
|
|
216
218
|
-- 4. updated_at triggers
|
|
217
219
|
-- ============================================================================
|
|
218
220
|
|
|
221
|
+
drop trigger if exists trg_orgs_updated_at on selva.orgs;
|
|
219
222
|
create trigger trg_orgs_updated_at before update on selva.orgs
|
|
220
223
|
for each row execute function selva.set_updated_at();
|
|
224
|
+
drop trigger if exists trg_projects_updated_at on selva.projects;
|
|
221
225
|
create trigger trg_projects_updated_at before update on selva.projects
|
|
222
226
|
for each row execute function selva.set_updated_at();
|
|
227
|
+
drop trigger if exists trg_org_members_updated_at on selva.org_members;
|
|
223
228
|
create trigger trg_org_members_updated_at before update on selva.org_members
|
|
224
229
|
for each row execute function selva.set_updated_at();
|
|
230
|
+
drop trigger if exists trg_project_members_updated_at on selva.project_members;
|
|
225
231
|
create trigger trg_project_members_updated_at before update on selva.project_members
|
|
226
232
|
for each row execute function selva.set_updated_at();
|
|
227
233
|
|
|
@@ -328,22 +334,26 @@ alter table selva.orgs enable row level security;
|
|
|
328
334
|
-- triggers a PostgREST re-read against the SELECT policy, which then filters
|
|
329
335
|
-- out the just-tombstoned row and surfaces as "new row violates RLS". Same
|
|
330
336
|
-- trap for `revoked_at` on share_links below.
|
|
337
|
+
drop policy if exists "orgs: members and instance admins can read" on selva.orgs;
|
|
331
338
|
create policy "orgs: members and instance admins can read"
|
|
332
339
|
on selva.orgs for select
|
|
333
340
|
to authenticated
|
|
334
341
|
using (selva.is_instance_admin() or selva.is_org_member(id));
|
|
335
342
|
|
|
343
|
+
drop policy if exists "orgs: authenticated can create their own" on selva.orgs;
|
|
336
344
|
create policy "orgs: authenticated can create their own"
|
|
337
345
|
on selva.orgs for insert
|
|
338
346
|
to authenticated
|
|
339
347
|
with check (selva.is_instance_admin() or owner_id = auth.uid());
|
|
340
348
|
|
|
349
|
+
drop policy if exists "orgs: owners and instance admins can update" on selva.orgs;
|
|
341
350
|
create policy "orgs: owners and instance admins can update"
|
|
342
351
|
on selva.orgs for update
|
|
343
352
|
to authenticated
|
|
344
353
|
using (selva.is_instance_admin() or selva.is_org_owner(id))
|
|
345
354
|
with check (selva.is_instance_admin() or selva.is_org_owner(id));
|
|
346
355
|
|
|
356
|
+
drop policy if exists "orgs: owners and instance admins can delete" on selva.orgs;
|
|
347
357
|
create policy "orgs: owners and instance admins can delete"
|
|
348
358
|
on selva.orgs for delete
|
|
349
359
|
to authenticated
|
|
@@ -351,22 +361,26 @@ using (selva.is_instance_admin() or selva.is_org_owner(id));
|
|
|
351
361
|
|
|
352
362
|
alter table selva.org_members enable row level security;
|
|
353
363
|
|
|
364
|
+
drop policy if exists "org_members: org members can read roster" on selva.org_members;
|
|
354
365
|
create policy "org_members: org members can read roster"
|
|
355
366
|
on selva.org_members for select
|
|
356
367
|
to authenticated
|
|
357
368
|
using (selva.is_instance_admin() or selva.is_org_member(org_id));
|
|
358
369
|
|
|
370
|
+
drop policy if exists "org_members: admins can insert" on selva.org_members;
|
|
359
371
|
create policy "org_members: admins can insert"
|
|
360
372
|
on selva.org_members for insert
|
|
361
373
|
to authenticated
|
|
362
374
|
with check (selva.is_instance_admin() or selva.is_org_admin(org_id));
|
|
363
375
|
|
|
376
|
+
drop policy if exists "org_members: admins can update" on selva.org_members;
|
|
364
377
|
create policy "org_members: admins can update"
|
|
365
378
|
on selva.org_members for update
|
|
366
379
|
to authenticated
|
|
367
380
|
using (selva.is_instance_admin() or selva.is_org_admin(org_id))
|
|
368
381
|
with check (selva.is_instance_admin() or selva.is_org_admin(org_id));
|
|
369
382
|
|
|
383
|
+
drop policy if exists "org_members: admins can delete" on selva.org_members;
|
|
370
384
|
create policy "org_members: admins can delete"
|
|
371
385
|
on selva.org_members for delete
|
|
372
386
|
to authenticated
|
|
@@ -374,23 +388,27 @@ using (selva.is_instance_admin() or selva.is_org_admin(org_id));
|
|
|
374
388
|
|
|
375
389
|
alter table selva.projects enable row level security;
|
|
376
390
|
|
|
391
|
+
drop policy if exists "projects: visible to members" on selva.projects;
|
|
377
392
|
create policy "projects: visible to members"
|
|
378
393
|
on selva.projects for select
|
|
379
394
|
to authenticated
|
|
380
395
|
using (selva.visible_project(id));
|
|
381
396
|
|
|
397
|
+
drop policy if exists "projects: manage_projects can create" on selva.projects;
|
|
382
398
|
create policy "projects: manage_projects can create"
|
|
383
399
|
on selva.projects for insert
|
|
384
400
|
to authenticated
|
|
385
401
|
with check (selva.has_org_permission(org_id, 'manage_projects'));
|
|
386
402
|
|
|
387
403
|
-- Project settings (name, slug, description, visibility, flags) are owner-only.
|
|
404
|
+
drop policy if exists "projects: owners can update" on selva.projects;
|
|
388
405
|
create policy "projects: owners can update"
|
|
389
406
|
on selva.projects for update
|
|
390
407
|
to authenticated
|
|
391
408
|
using (selva.is_instance_admin() or owner_id = auth.uid())
|
|
392
409
|
with check (selva.is_instance_admin() or owner_id = auth.uid());
|
|
393
410
|
|
|
411
|
+
drop policy if exists "projects: owners can delete" on selva.projects;
|
|
394
412
|
create policy "projects: owners can delete"
|
|
395
413
|
on selva.projects for delete
|
|
396
414
|
to authenticated
|
|
@@ -398,6 +416,7 @@ using (selva.is_instance_admin() or owner_id = auth.uid());
|
|
|
398
416
|
|
|
399
417
|
alter table selva.project_members enable row level security;
|
|
400
418
|
|
|
419
|
+
drop policy if exists "project_members: visible to project members" on selva.project_members;
|
|
401
420
|
create policy "project_members: visible to project members"
|
|
402
421
|
on selva.project_members for select
|
|
403
422
|
to authenticated
|
|
@@ -405,6 +424,7 @@ using (selva.is_instance_admin() or selva.visible_project(project_id));
|
|
|
405
424
|
|
|
406
425
|
-- canManage (§5) collapses to owner-only; org admins no longer silently
|
|
407
426
|
-- manage project members.
|
|
427
|
+
drop policy if exists "project_members: managers can insert" on selva.project_members;
|
|
408
428
|
create policy "project_members: managers can insert"
|
|
409
429
|
on selva.project_members for insert
|
|
410
430
|
to authenticated
|
|
@@ -416,6 +436,7 @@ with check (
|
|
|
416
436
|
)
|
|
417
437
|
);
|
|
418
438
|
|
|
439
|
+
drop policy if exists "project_members: managers can update" on selva.project_members;
|
|
419
440
|
create policy "project_members: managers can update"
|
|
420
441
|
on selva.project_members for update
|
|
421
442
|
to authenticated
|
|
@@ -434,6 +455,7 @@ with check (
|
|
|
434
455
|
)
|
|
435
456
|
);
|
|
436
457
|
|
|
458
|
+
drop policy if exists "project_members: managers can delete" on selva.project_members;
|
|
437
459
|
create policy "project_members: managers can delete"
|
|
438
460
|
on selva.project_members for delete
|
|
439
461
|
to authenticated
|
|
@@ -488,6 +510,7 @@ create index if not exists idx_definitions_pending_updated
|
|
|
488
510
|
on selva.definitions(updated_at)
|
|
489
511
|
where status = 'pending' and deleted_at is null;
|
|
490
512
|
|
|
513
|
+
drop trigger if exists trg_definitions_updated_at on selva.definitions;
|
|
491
514
|
create trigger trg_definitions_updated_at before update on selva.definitions
|
|
492
515
|
for each row execute function selva.set_updated_at();
|
|
493
516
|
|
|
@@ -508,11 +531,17 @@ create index if not exists idx_definition_versions_def
|
|
|
508
531
|
|
|
509
532
|
-- Spec §6 deletion protection: cannot delete a version while it's serving
|
|
510
533
|
-- either channel. Postgres raises 23503; the store maps that to 409.
|
|
534
|
+
alter table selva.definitions
|
|
535
|
+
drop constraint if exists fk_definitions_live_version;
|
|
536
|
+
|
|
511
537
|
alter table selva.definitions
|
|
512
538
|
add constraint fk_definitions_live_version
|
|
513
539
|
foreign key (live_version_id) references selva.definition_versions(id)
|
|
514
540
|
on delete restrict;
|
|
515
541
|
|
|
542
|
+
alter table selva.definitions
|
|
543
|
+
drop constraint if exists fk_definitions_draft_version;
|
|
544
|
+
|
|
516
545
|
alter table selva.definitions
|
|
517
546
|
add constraint fk_definitions_draft_version
|
|
518
547
|
foreign key (draft_version_id) references selva.definition_versions(id)
|
|
@@ -532,11 +561,13 @@ grant execute on function selva.increment_run_count(uuid) to authenticated, serv
|
|
|
532
561
|
|
|
533
562
|
alter table selva.definitions enable row level security;
|
|
534
563
|
|
|
564
|
+
drop policy if exists "definitions: visible via project" on selva.definitions;
|
|
535
565
|
create policy "definitions: visible via project"
|
|
536
566
|
on selva.definitions for select
|
|
537
567
|
to authenticated
|
|
538
568
|
using (selva.visible_project(project_id));
|
|
539
569
|
|
|
570
|
+
drop policy if exists "definitions: editors can insert" on selva.definitions;
|
|
540
571
|
create policy "definitions: editors can insert"
|
|
541
572
|
on selva.definitions for insert
|
|
542
573
|
to authenticated
|
|
@@ -562,6 +593,7 @@ with check (
|
|
|
562
593
|
)
|
|
563
594
|
);
|
|
564
595
|
|
|
596
|
+
drop policy if exists "definitions: editors can update" on selva.definitions;
|
|
565
597
|
create policy "definitions: editors can update"
|
|
566
598
|
on selva.definitions for update
|
|
567
599
|
to authenticated
|
|
@@ -600,6 +632,7 @@ with check (
|
|
|
600
632
|
)
|
|
601
633
|
);
|
|
602
634
|
|
|
635
|
+
drop policy if exists "definitions: editors can delete" on selva.definitions;
|
|
603
636
|
create policy "definitions: editors can delete"
|
|
604
637
|
on selva.definitions for delete
|
|
605
638
|
to authenticated
|
|
@@ -625,6 +658,7 @@ alter table selva.definition_versions enable row level security;
|
|
|
625
658
|
|
|
626
659
|
-- Versions inherit visibility from the parent definition (which inherits
|
|
627
660
|
-- from the parent project). Versions are immutable — no UPDATE policy.
|
|
661
|
+
drop policy if exists "definition_versions: visible via parent" on selva.definition_versions;
|
|
628
662
|
create policy "definition_versions: visible via parent"
|
|
629
663
|
on selva.definition_versions for select
|
|
630
664
|
to authenticated
|
|
@@ -637,6 +671,7 @@ using (
|
|
|
637
671
|
)
|
|
638
672
|
);
|
|
639
673
|
|
|
674
|
+
drop policy if exists "definition_versions: editors can insert" on selva.definition_versions;
|
|
640
675
|
create policy "definition_versions: editors can insert"
|
|
641
676
|
on selva.definition_versions for insert
|
|
642
677
|
to authenticated
|
|
@@ -670,6 +705,7 @@ with check (
|
|
|
670
705
|
-- returns success without removing anything, and the FK ON DELETE RESTRICT on
|
|
671
706
|
-- `definitions.live_version_id` / `draft_version_id` never gets a chance to
|
|
672
707
|
-- raise the 23503 the store maps to a 409. Same authority as INSERT.
|
|
708
|
+
drop policy if exists "definition_versions: editors can delete" on selva.definition_versions;
|
|
673
709
|
create policy "definition_versions: editors can delete"
|
|
674
710
|
on selva.definition_versions for delete
|
|
675
711
|
to authenticated
|
|
@@ -702,6 +738,7 @@ using (
|
|
|
702
738
|
-- (which caches the compute-extracted UI schema, migration 0002) returns
|
|
703
739
|
-- success without persisting anything for a user-scoped caller. Same authority
|
|
704
740
|
-- as INSERT/DELETE: project owner/editor, or instance admin.
|
|
741
|
+
drop policy if exists "definition_versions: editors can update" on selva.definition_versions;
|
|
705
742
|
create policy "definition_versions: editors can update"
|
|
706
743
|
on selva.definition_versions for update
|
|
707
744
|
to authenticated
|
|
@@ -764,22 +801,26 @@ create index if not exists idx_invites_org on selva.invites(org_id, created_at d
|
|
|
764
801
|
|
|
765
802
|
alter table selva.invites enable row level security;
|
|
766
803
|
|
|
804
|
+
drop policy if exists "invites: manage_org_members can read org invites" on selva.invites;
|
|
767
805
|
create policy "invites: manage_org_members can read org invites"
|
|
768
806
|
on selva.invites for select
|
|
769
807
|
to authenticated
|
|
770
808
|
using (selva.has_org_permission(org_id, 'manage_org_members'));
|
|
771
809
|
|
|
810
|
+
drop policy if exists "invites: manage_org_members can insert" on selva.invites;
|
|
772
811
|
create policy "invites: manage_org_members can insert"
|
|
773
812
|
on selva.invites for insert
|
|
774
813
|
to authenticated
|
|
775
814
|
with check (selva.has_org_permission(org_id, 'manage_org_members'));
|
|
776
815
|
|
|
816
|
+
drop policy if exists "invites: manage_org_members can update" on selva.invites;
|
|
777
817
|
create policy "invites: manage_org_members can update"
|
|
778
818
|
on selva.invites for update
|
|
779
819
|
to authenticated
|
|
780
820
|
using (selva.has_org_permission(org_id, 'manage_org_members'))
|
|
781
821
|
with check (selva.has_org_permission(org_id, 'manage_org_members'));
|
|
782
822
|
|
|
823
|
+
drop policy if exists "invites: manage_org_members can delete" on selva.invites;
|
|
783
824
|
create policy "invites: manage_org_members can delete"
|
|
784
825
|
on selva.invites for delete
|
|
785
826
|
to authenticated
|
|
@@ -894,6 +935,7 @@ alter table selva.compute_server_platform_default enable row level security;
|
|
|
894
935
|
-- user belongs to → that user
|
|
895
936
|
-- * platform server that is the current global default → all (floor)
|
|
896
937
|
-- * org server → only members of owner_org_id
|
|
938
|
+
drop policy if exists "compute_servers: visibility-scoped read" on selva.compute_servers;
|
|
897
939
|
create policy "compute_servers: visibility-scoped read"
|
|
898
940
|
on selva.compute_servers for select
|
|
899
941
|
to authenticated
|
|
@@ -913,6 +955,7 @@ using (
|
|
|
913
955
|
-- Writes:
|
|
914
956
|
-- * scope = 'platform' → instance_admin only.
|
|
915
957
|
-- * scope = 'org' → manage_org_compute on owner_org_id.
|
|
958
|
+
drop policy if exists "compute_servers: scoped write" on selva.compute_servers;
|
|
916
959
|
create policy "compute_servers: scoped write"
|
|
917
960
|
on selva.compute_servers for all
|
|
918
961
|
to authenticated
|
|
@@ -927,33 +970,39 @@ with check (
|
|
|
927
970
|
and selva.has_org_permission(owner_org_id, 'manage_org_compute'))
|
|
928
971
|
);
|
|
929
972
|
|
|
973
|
+
drop policy if exists "compute_server_shares: read" on selva.compute_server_shares;
|
|
930
974
|
create policy "compute_server_shares: read"
|
|
931
975
|
on selva.compute_server_shares for select
|
|
932
976
|
to authenticated
|
|
933
977
|
using (selva.is_instance_admin() or selva.is_org_member(org_id));
|
|
934
978
|
|
|
979
|
+
drop policy if exists "compute_server_shares: admin write" on selva.compute_server_shares;
|
|
935
980
|
create policy "compute_server_shares: admin write"
|
|
936
981
|
on selva.compute_server_shares for all
|
|
937
982
|
to authenticated
|
|
938
983
|
using (selva.is_instance_admin())
|
|
939
984
|
with check (selva.is_instance_admin());
|
|
940
985
|
|
|
986
|
+
drop policy if exists "compute_server_org_defaults: members can read" on selva.compute_server_org_defaults;
|
|
941
987
|
create policy "compute_server_org_defaults: members can read"
|
|
942
988
|
on selva.compute_server_org_defaults for select
|
|
943
989
|
to authenticated
|
|
944
990
|
using (selva.is_instance_admin() or selva.is_org_member(org_id));
|
|
945
991
|
|
|
992
|
+
drop policy if exists "compute_server_org_defaults: manage_org_compute can write" on selva.compute_server_org_defaults;
|
|
946
993
|
create policy "compute_server_org_defaults: manage_org_compute can write"
|
|
947
994
|
on selva.compute_server_org_defaults for all
|
|
948
995
|
to authenticated
|
|
949
996
|
using (selva.is_instance_admin() or selva.has_org_permission(org_id, 'manage_org_compute'))
|
|
950
997
|
with check (selva.is_instance_admin() or selva.has_org_permission(org_id, 'manage_org_compute'));
|
|
951
998
|
|
|
999
|
+
drop policy if exists "compute_server_platform_default: read all" on selva.compute_server_platform_default;
|
|
952
1000
|
create policy "compute_server_platform_default: read all"
|
|
953
1001
|
on selva.compute_server_platform_default for select
|
|
954
1002
|
to authenticated
|
|
955
1003
|
using (true);
|
|
956
1004
|
|
|
1005
|
+
drop policy if exists "compute_server_platform_default: admin write" on selva.compute_server_platform_default;
|
|
957
1006
|
create policy "compute_server_platform_default: admin write"
|
|
958
1007
|
on selva.compute_server_platform_default for all
|
|
959
1008
|
to authenticated
|
|
@@ -1013,6 +1062,7 @@ alter table selva.share_links enable row level security;
|
|
|
1013
1062
|
-- uses the SECURITY DEFINER RPC + service-role and bypasses RLS — the token
|
|
1014
1063
|
-- IS the credential there.
|
|
1015
1064
|
|
|
1065
|
+
drop policy if exists "share_links: editors can read" on selva.share_links;
|
|
1016
1066
|
create policy "share_links: editors can read"
|
|
1017
1067
|
on selva.share_links for select
|
|
1018
1068
|
to authenticated
|
|
@@ -1040,6 +1090,7 @@ using (
|
|
|
1040
1090
|
)
|
|
1041
1091
|
);
|
|
1042
1092
|
|
|
1093
|
+
drop policy if exists "share_links: editors can insert" on selva.share_links;
|
|
1043
1094
|
create policy "share_links: editors can insert"
|
|
1044
1095
|
on selva.share_links for insert
|
|
1045
1096
|
to authenticated
|
|
@@ -1068,6 +1119,7 @@ with check (
|
|
|
1068
1119
|
);
|
|
1069
1120
|
|
|
1070
1121
|
-- UPDATE policy covers `revoke` (set revoked_at). Same authority as insert.
|
|
1122
|
+
drop policy if exists "share_links: editors can revoke" on selva.share_links;
|
|
1071
1123
|
create policy "share_links: editors can revoke"
|
|
1072
1124
|
on selva.share_links for update
|
|
1073
1125
|
to authenticated
|