@rebasepro/studio 0.6.0 → 0.6.1
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/dist/{RLSEditor-CTxYbBdW.js → RLSEditor-DpF1u9EC.js} +190 -183
- package/dist/RLSEditor-DpF1u9EC.js.map +1 -0
- package/dist/{StorageView-nDaC2foF.js → StorageView-CvrnHmDG.js} +89 -76
- package/dist/StorageView-CvrnHmDG.js.map +1 -0
- package/dist/index.es.js +2 -2
- package/dist/index.umd.js +277 -257
- package/dist/index.umd.js.map +1 -1
- package/package.json +8 -8
- package/src/components/RLSEditor/PolicyEditor.tsx +1 -0
- package/src/components/StorageView/StorageView.tsx +3 -3
- package/dist/RLSEditor-CTxYbBdW.js.map +0 -1
- package/dist/StorageView-nDaC2foF.js.map +0 -1
|
@@ -373,194 +373,201 @@ var PolicyEditor = ({ policy, schema, table, onSave, onCancel }) => {
|
|
|
373
373
|
open: helpOpen,
|
|
374
374
|
onOpenChange: setHelpOpen,
|
|
375
375
|
maxWidth: "3xl",
|
|
376
|
-
children: [
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
className: "text-text-secondary dark:text-text-secondary-dark",
|
|
399
|
-
children: t("studio_policy_help_step1_desc")
|
|
400
|
-
})]
|
|
401
|
-
}),
|
|
402
|
-
/* @__PURE__ */ jsxs(Paper, {
|
|
403
|
-
className: cls("p-4 sm:p-5 flex flex-col gap-1", defaultBorderMixin),
|
|
404
|
-
children: [
|
|
405
|
-
/* @__PURE__ */ jsx(Typography, {
|
|
406
|
-
variant: "subtitle2",
|
|
407
|
-
className: "text-primary dark:text-primary-light font-medium",
|
|
408
|
-
children: t("studio_policy_help_step2_title")
|
|
409
|
-
}),
|
|
410
|
-
/* @__PURE__ */ jsx(Typography, {
|
|
411
|
-
variant: "body2",
|
|
412
|
-
className: "text-text-secondary dark:text-text-secondary-dark mb-1",
|
|
413
|
-
children: t("studio_policy_help_step2_desc")
|
|
414
|
-
}),
|
|
415
|
-
/* @__PURE__ */ jsxs("ul", {
|
|
416
|
-
className: "list-disc pl-5 space-y-1 text-sm text-text-secondary dark:text-text-secondary-dark",
|
|
417
|
-
children: [
|
|
418
|
-
/* @__PURE__ */ jsxs("li", { children: [
|
|
419
|
-
/* @__PURE__ */ jsx("strong", { children: "public" }),
|
|
420
|
-
": ",
|
|
421
|
-
t("studio_policy_help_role_public")
|
|
422
|
-
] }),
|
|
423
|
-
/* @__PURE__ */ jsxs("li", { children: [
|
|
424
|
-
/* @__PURE__ */ jsx("strong", { children: "authenticated" }),
|
|
425
|
-
": ",
|
|
426
|
-
t("studio_policy_help_role_authenticated")
|
|
427
|
-
] }),
|
|
428
|
-
/* @__PURE__ */ jsxs("li", { children: [
|
|
429
|
-
/* @__PURE__ */ jsx("strong", { children: "anon" }),
|
|
430
|
-
": ",
|
|
431
|
-
t("studio_policy_help_role_anon")
|
|
432
|
-
] })
|
|
433
|
-
]
|
|
434
|
-
})
|
|
435
|
-
]
|
|
436
|
-
}),
|
|
437
|
-
/* @__PURE__ */ jsxs(Paper, {
|
|
438
|
-
className: cls("p-4 sm:p-5 flex flex-col gap-1", defaultBorderMixin),
|
|
439
|
-
children: [
|
|
440
|
-
/* @__PURE__ */ jsx(Typography, {
|
|
441
|
-
variant: "subtitle2",
|
|
442
|
-
className: "text-primary dark:text-primary-light font-medium",
|
|
443
|
-
children: t("studio_policy_help_step3_title")
|
|
444
|
-
}),
|
|
445
|
-
/* @__PURE__ */ jsx(Typography, {
|
|
446
|
-
variant: "body2",
|
|
447
|
-
className: "text-text-secondary dark:text-text-secondary-dark mb-1",
|
|
448
|
-
children: t("studio_policy_help_step3_desc")
|
|
449
|
-
}),
|
|
450
|
-
/* @__PURE__ */ jsx("div", {
|
|
451
|
-
className: cls("bg-surface-100 dark:bg-surface-950 px-3 py-2 rounded-md font-mono text-sm my-2", defaultBorderMixin),
|
|
452
|
-
children: "Example: auth.uid() = user_id"
|
|
453
|
-
}),
|
|
454
|
-
/* @__PURE__ */ jsx(Typography, {
|
|
455
|
-
variant: "caption",
|
|
456
|
-
className: "text-text-secondary dark:text-text-secondary-dark",
|
|
457
|
-
children: t("studio_policy_help_step3_example")
|
|
458
|
-
})
|
|
459
|
-
]
|
|
460
|
-
}),
|
|
461
|
-
/* @__PURE__ */ jsxs(Paper, {
|
|
462
|
-
className: cls("p-4 sm:p-5 flex flex-col gap-1", defaultBorderMixin),
|
|
463
|
-
children: [
|
|
464
|
-
/* @__PURE__ */ jsx(Typography, {
|
|
465
|
-
variant: "subtitle2",
|
|
466
|
-
className: "text-primary dark:text-primary-light font-medium",
|
|
467
|
-
children: t("studio_policy_help_step4_title")
|
|
468
|
-
}),
|
|
469
|
-
/* @__PURE__ */ jsx(Typography, {
|
|
470
|
-
variant: "body2",
|
|
471
|
-
className: "text-text-secondary dark:text-text-secondary-dark mb-1",
|
|
472
|
-
children: t("studio_policy_help_step4_desc")
|
|
473
|
-
}),
|
|
474
|
-
/* @__PURE__ */ jsx("div", {
|
|
475
|
-
className: cls("bg-surface-100 dark:bg-surface-950 px-3 py-2 rounded-md font-mono text-sm my-2", defaultBorderMixin),
|
|
476
|
-
children: "Example: auth.uid() = user_id"
|
|
477
|
-
}),
|
|
478
|
-
/* @__PURE__ */ jsx(Typography, {
|
|
479
|
-
variant: "caption",
|
|
480
|
-
className: "text-text-secondary dark:text-text-secondary-dark",
|
|
481
|
-
children: t("studio_policy_help_step4_example")
|
|
482
|
-
})
|
|
483
|
-
]
|
|
484
|
-
}),
|
|
485
|
-
/* @__PURE__ */ jsxs(Paper, {
|
|
486
|
-
className: cls("p-4 sm:p-5 flex flex-col gap-2 bg-primary/5 dark:bg-primary-bg-dark/10", defaultBorderMixin),
|
|
487
|
-
children: [
|
|
488
|
-
/* @__PURE__ */ jsx(Typography, {
|
|
376
|
+
children: [
|
|
377
|
+
/* @__PURE__ */ jsx(DialogTitle, {
|
|
378
|
+
hidden: true,
|
|
379
|
+
children: "Row-Level Security Help"
|
|
380
|
+
}),
|
|
381
|
+
/* @__PURE__ */ jsxs(DialogContent, {
|
|
382
|
+
className: "p-4 sm:p-6 lg:p-8 flex flex-col gap-6",
|
|
383
|
+
children: [
|
|
384
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Typography, {
|
|
385
|
+
variant: "h5",
|
|
386
|
+
className: "mb-2",
|
|
387
|
+
children: t("studio_policy_help_title")
|
|
388
|
+
}), /* @__PURE__ */ jsx(Typography, {
|
|
389
|
+
className: "text-text-secondary dark:text-text-secondary-dark",
|
|
390
|
+
children: t("studio_policy_help_intro")
|
|
391
|
+
})] }),
|
|
392
|
+
/* @__PURE__ */ jsxs("div", {
|
|
393
|
+
className: "flex flex-col gap-4",
|
|
394
|
+
children: [
|
|
395
|
+
/* @__PURE__ */ jsxs(Paper, {
|
|
396
|
+
className: cls("p-4 sm:p-5 flex flex-col gap-1", defaultBorderMixin),
|
|
397
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
489
398
|
variant: "subtitle2",
|
|
490
399
|
className: "text-primary dark:text-primary-light font-medium",
|
|
491
|
-
children: t("
|
|
492
|
-
}),
|
|
493
|
-
/* @__PURE__ */ jsx(Typography, {
|
|
400
|
+
children: t("studio_policy_help_step1_title")
|
|
401
|
+
}), /* @__PURE__ */ jsx(Typography, {
|
|
494
402
|
variant: "body2",
|
|
495
403
|
className: "text-text-secondary dark:text-text-secondary-dark",
|
|
496
|
-
children: t("
|
|
497
|
-
})
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
})
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
})
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
404
|
+
children: t("studio_policy_help_step1_desc")
|
|
405
|
+
})]
|
|
406
|
+
}),
|
|
407
|
+
/* @__PURE__ */ jsxs(Paper, {
|
|
408
|
+
className: cls("p-4 sm:p-5 flex flex-col gap-1", defaultBorderMixin),
|
|
409
|
+
children: [
|
|
410
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
411
|
+
variant: "subtitle2",
|
|
412
|
+
className: "text-primary dark:text-primary-light font-medium",
|
|
413
|
+
children: t("studio_policy_help_step2_title")
|
|
414
|
+
}),
|
|
415
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
416
|
+
variant: "body2",
|
|
417
|
+
className: "text-text-secondary dark:text-text-secondary-dark mb-1",
|
|
418
|
+
children: t("studio_policy_help_step2_desc")
|
|
419
|
+
}),
|
|
420
|
+
/* @__PURE__ */ jsxs("ul", {
|
|
421
|
+
className: "list-disc pl-5 space-y-1 text-sm text-text-secondary dark:text-text-secondary-dark",
|
|
422
|
+
children: [
|
|
423
|
+
/* @__PURE__ */ jsxs("li", { children: [
|
|
424
|
+
/* @__PURE__ */ jsx("strong", { children: "public" }),
|
|
425
|
+
": ",
|
|
426
|
+
t("studio_policy_help_role_public")
|
|
427
|
+
] }),
|
|
428
|
+
/* @__PURE__ */ jsxs("li", { children: [
|
|
429
|
+
/* @__PURE__ */ jsx("strong", { children: "authenticated" }),
|
|
430
|
+
": ",
|
|
431
|
+
t("studio_policy_help_role_authenticated")
|
|
432
|
+
] }),
|
|
433
|
+
/* @__PURE__ */ jsxs("li", { children: [
|
|
434
|
+
/* @__PURE__ */ jsx("strong", { children: "anon" }),
|
|
435
|
+
": ",
|
|
436
|
+
t("studio_policy_help_role_anon")
|
|
437
|
+
] })
|
|
438
|
+
]
|
|
439
|
+
})
|
|
440
|
+
]
|
|
441
|
+
}),
|
|
442
|
+
/* @__PURE__ */ jsxs(Paper, {
|
|
443
|
+
className: cls("p-4 sm:p-5 flex flex-col gap-1", defaultBorderMixin),
|
|
444
|
+
children: [
|
|
445
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
446
|
+
variant: "subtitle2",
|
|
447
|
+
className: "text-primary dark:text-primary-light font-medium",
|
|
448
|
+
children: t("studio_policy_help_step3_title")
|
|
449
|
+
}),
|
|
450
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
451
|
+
variant: "body2",
|
|
452
|
+
className: "text-text-secondary dark:text-text-secondary-dark mb-1",
|
|
453
|
+
children: t("studio_policy_help_step3_desc")
|
|
454
|
+
}),
|
|
455
|
+
/* @__PURE__ */ jsx("div", {
|
|
456
|
+
className: cls("bg-surface-100 dark:bg-surface-950 px-3 py-2 rounded-md font-mono text-sm my-2", defaultBorderMixin),
|
|
457
|
+
children: "Example: auth.uid() = user_id"
|
|
458
|
+
}),
|
|
459
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
460
|
+
variant: "caption",
|
|
461
|
+
className: "text-text-secondary dark:text-text-secondary-dark",
|
|
462
|
+
children: t("studio_policy_help_step3_example")
|
|
463
|
+
})
|
|
464
|
+
]
|
|
465
|
+
}),
|
|
466
|
+
/* @__PURE__ */ jsxs(Paper, {
|
|
467
|
+
className: cls("p-4 sm:p-5 flex flex-col gap-1", defaultBorderMixin),
|
|
468
|
+
children: [
|
|
469
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
470
|
+
variant: "subtitle2",
|
|
471
|
+
className: "text-primary dark:text-primary-light font-medium",
|
|
472
|
+
children: t("studio_policy_help_step4_title")
|
|
473
|
+
}),
|
|
474
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
475
|
+
variant: "body2",
|
|
476
|
+
className: "text-text-secondary dark:text-text-secondary-dark mb-1",
|
|
477
|
+
children: t("studio_policy_help_step4_desc")
|
|
478
|
+
}),
|
|
479
|
+
/* @__PURE__ */ jsx("div", {
|
|
480
|
+
className: cls("bg-surface-100 dark:bg-surface-950 px-3 py-2 rounded-md font-mono text-sm my-2", defaultBorderMixin),
|
|
481
|
+
children: "Example: auth.uid() = user_id"
|
|
482
|
+
}),
|
|
483
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
484
|
+
variant: "caption",
|
|
485
|
+
className: "text-text-secondary dark:text-text-secondary-dark",
|
|
486
|
+
children: t("studio_policy_help_step4_example")
|
|
487
|
+
})
|
|
488
|
+
]
|
|
489
|
+
}),
|
|
490
|
+
/* @__PURE__ */ jsxs(Paper, {
|
|
491
|
+
className: cls("p-4 sm:p-5 flex flex-col gap-2 bg-primary/5 dark:bg-primary-bg-dark/10", defaultBorderMixin),
|
|
492
|
+
children: [
|
|
493
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
494
|
+
variant: "subtitle2",
|
|
495
|
+
className: "text-primary dark:text-primary-light font-medium",
|
|
496
|
+
children: t("studio_policy_help_auth_vars_title")
|
|
497
|
+
}),
|
|
498
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
499
|
+
variant: "body2",
|
|
500
|
+
className: "text-text-secondary dark:text-text-secondary-dark",
|
|
501
|
+
children: t("studio_policy_help_auth_vars_desc")
|
|
502
|
+
}),
|
|
503
|
+
/* @__PURE__ */ jsxs("ul", {
|
|
504
|
+
className: "list-disc pl-5 space-y-2 text-sm text-text-secondary dark:text-text-secondary-dark font-normal",
|
|
505
|
+
children: [
|
|
506
|
+
/* @__PURE__ */ jsxs("li", { children: [/* @__PURE__ */ jsx("code", {
|
|
507
|
+
className: "bg-surface-100 dark:bg-surface-950 px-1.5 py-0.5 rounded mr-1 whitespace-nowrap",
|
|
508
|
+
children: "auth.uid()"
|
|
509
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
510
|
+
className: "block mt-0.5",
|
|
511
|
+
children: ["Returns the current user's ID as text. Example: ", /* @__PURE__ */ jsx("code", {
|
|
512
|
+
className: "bg-surface-100 dark:bg-surface-950 px-1 py-0.5 rounded text-[11px]",
|
|
513
|
+
children: "auth.uid() = user_id"
|
|
514
|
+
})]
|
|
515
|
+
})] }),
|
|
516
|
+
/* @__PURE__ */ jsxs("li", { children: [/* @__PURE__ */ jsx("code", {
|
|
517
|
+
className: "bg-surface-100 dark:bg-surface-950 px-1.5 py-0.5 rounded mr-1 whitespace-nowrap",
|
|
518
|
+
children: "auth.jwt()"
|
|
519
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
520
|
+
className: "block mt-0.5",
|
|
521
|
+
children: ["Returns the full JWT payload as JSONB so you can check custom claims. Example: ", /* @__PURE__ */ jsx("code", {
|
|
522
|
+
className: "bg-surface-100 dark:bg-surface-950 px-1 py-0.5 rounded text-[11px]",
|
|
523
|
+
children: "auth.jwt() ->> 'email' = 'admin@example.com'"
|
|
524
|
+
})]
|
|
525
|
+
})] }),
|
|
526
|
+
/* @__PURE__ */ jsxs("li", { children: [/* @__PURE__ */ jsx("code", {
|
|
527
|
+
className: "bg-surface-100 dark:bg-surface-950 px-1.5 py-0.5 rounded mr-1 whitespace-nowrap",
|
|
528
|
+
children: "auth.roles()"
|
|
529
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
530
|
+
className: "block mt-0.5",
|
|
531
|
+
children: ["Returns the user's role IDs as a comma-separated string. Best used with: ", /* @__PURE__ */ jsx("code", {
|
|
532
|
+
className: "bg-surface-100 dark:bg-surface-950 px-1 py-0.5 rounded text-[11px]",
|
|
533
|
+
children: "string_to_array(auth.roles(), ',') @> ARRAY['admin']"
|
|
534
|
+
})]
|
|
535
|
+
})] })
|
|
536
|
+
]
|
|
537
|
+
})
|
|
538
|
+
]
|
|
539
|
+
})
|
|
540
|
+
]
|
|
541
|
+
}),
|
|
542
|
+
/* @__PURE__ */ jsxs("div", {
|
|
543
|
+
className: cls("mt-2 flex flex-col sm:flex-row justify-between items-start sm:items-center bg-primary/5 dark:bg-primary-bg-dark/10 p-4 rounded-xl border border-primary/10 dark:border-primary/20", defaultBorderMixin),
|
|
544
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
545
|
+
variant: "body2",
|
|
546
|
+
className: "text-primary dark:text-primary-light mb-4 sm:mb-0 max-w-md",
|
|
547
|
+
children: t("studio_policy_help_docs_cta")
|
|
548
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
549
|
+
component: "a",
|
|
550
|
+
href: "https://www.postgresql.org/docs/current/sql-createpolicy.html",
|
|
551
|
+
target: "_blank",
|
|
552
|
+
variant: "outlined",
|
|
553
|
+
color: "primary",
|
|
554
|
+
size: "small",
|
|
555
|
+
className: "whitespace-nowrap flex-shrink-0",
|
|
556
|
+
children: t("studio_policy_help_read_docs")
|
|
557
|
+
})]
|
|
558
|
+
})
|
|
559
|
+
]
|
|
560
|
+
}),
|
|
561
|
+
/* @__PURE__ */ jsx(DialogActions, {
|
|
562
|
+
className: "p-4 sm:px-6 sm:pb-6 pt-0 border-t-0",
|
|
563
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
564
|
+
onClick: () => setHelpOpen(false),
|
|
565
|
+
variant: "filled",
|
|
566
|
+
color: "primary",
|
|
567
|
+
children: t("studio_policy_help_got_it")
|
|
553
568
|
})
|
|
554
|
-
]
|
|
555
|
-
}), /* @__PURE__ */ jsx(DialogActions, {
|
|
556
|
-
className: "p-4 sm:px-6 sm:pb-6 pt-0 border-t-0",
|
|
557
|
-
children: /* @__PURE__ */ jsx(Button, {
|
|
558
|
-
onClick: () => setHelpOpen(false),
|
|
559
|
-
variant: "filled",
|
|
560
|
-
color: "primary",
|
|
561
|
-
children: t("studio_policy_help_got_it")
|
|
562
569
|
})
|
|
563
|
-
|
|
570
|
+
]
|
|
564
571
|
})
|
|
565
572
|
] });
|
|
566
573
|
};
|
|
@@ -1359,4 +1366,4 @@ var RLSEditor = ({ apiUrl = "" }) => {
|
|
|
1359
1366
|
//#endregion
|
|
1360
1367
|
export { RLSEditor };
|
|
1361
1368
|
|
|
1362
|
-
//# sourceMappingURL=RLSEditor-
|
|
1369
|
+
//# sourceMappingURL=RLSEditor-DpF1u9EC.js.map
|