@nextblock-cms/db 0.21.3 → 0.22.0
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/README.md +47 -47
- package/package.json +1 -1
- package/supabase/functions/nextblock-migration-ingest/index.ts +8 -8
- package/supabase/migrations/02000_catchup_gen1.sql +5880 -5880
- package/supabase/migrations/02001_baseline_schema.sql +2734 -2734
- package/supabase/migrations/02002_baseline_constraints_and_indexes.sql +1262 -1262
- package/supabase/migrations/02003_baseline_security_and_grants.sql +1577 -1577
- package/supabase/migrations/02004_baseline_seed.sql +565 -565
- package/supabase/migrations/02005_home_live_demo_promo_cadence_15min.sql +53 -53
- package/supabase/migrations/02006_home_marketing_contrast.sql +56 -56
- package/supabase/migrations/02007_home_pillar_caption_contrast.sql +44 -44
- package/supabase/migrations/02008_home_fr_parity.sql +89 -89
- package/supabase/migrations/02009_fr_cortex_posts.sql +67 -67
- package/supabase/migrations/02010_shop_hero_redesign.sql +72 -72
- package/supabase/migrations/02011_drop_backdrop_blur_on_pages.sql +26 -26
- package/supabase/migrations/02012_drop_variant_backdrop_blur.sql +17 -17
- package/supabase/migrations/02013_advisor_rls_and_trigger_grants.sql +102 -102
- package/supabase/migrations/02014_package_activations_staff_read.sql +18 -18
- package/supabase/migrations/02018_install_paths_and_seed_copy_accuracy.sql +1820 -1820
- package/supabase/migrations/02019_open_handed_licensing_and_mcp_clients.sql +448 -448
- package/supabase/migrations/02020_commerce_product_accuracy.sql +93 -93
- package/supabase/migrations/02021_profiles_staff_read_and_role_guard.sql +362 -0
package/README.md
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
# @nextblock-cms/db
|
|
2
|
-
|
|
3
|
-
The database layer of [NextBlock](https://github.com/nextblock-cms/nextblock), the open-core CMS
|
|
4
|
-
for Next.js and Supabase: Supabase clients for each trust level, the generated `Database` types,
|
|
5
|
-
secret encryption, and the premium-package license check. It also ships the NextBlock database
|
|
6
|
-
migrations.
|
|
7
|
-
|
|
8
|
-
Projects created with `npm create nextblock@latest` already depend on it. It is built for
|
|
9
|
-
NextBlock projects (Next.js 16, React 19, `@supabase/ssr`) rather than as a general-purpose
|
|
10
|
-
library.
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
npm install @nextblock-cms/db
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
## Entry points
|
|
17
|
-
|
|
18
|
-
| Import | Use it from | What it holds |
|
|
19
|
-
| :-- | :-- | :-- |
|
|
20
|
-
| `@nextblock-cms/db` | client | The browser Supabase client (`createClient`), the `Database` types, and client-side profile and language lookups |
|
|
21
|
-
| `@nextblock-cms/db/server` | server only | `createClient()` scoped to the request cookies, `getSsgSupabaseClient()` for public reads, `getServiceRoleSupabaseClient()` for admin work only (it bypasses Row Level Security), `verifyPackageOnline()`, secret encryption and config resolution |
|
|
22
|
-
| `@nextblock-cms/db/secrets` | server only | Secret encryption (`encryptSecret`, `decryptSecret`) and config resolution, without the Supabase clients |
|
|
23
|
-
| `@nextblock-cms/db/types` | types only | The generated `Database` types |
|
|
24
|
-
|
|
25
|
-
Pick the server client by trust level. Use the service-role client only in code that has
|
|
26
|
-
already checked the caller's role.
|
|
27
|
-
|
|
28
|
-
## Environment
|
|
29
|
-
|
|
30
|
-
The clients read `NEXT_PUBLIC_SUPABASE_URL` or `SUPABASE_URL`, the publishable (anon) key under
|
|
31
|
-
either its `NEXT_PUBLIC_` or its plain name, and, for the service-role client,
|
|
32
|
-
`SUPABASE_SERVICE_ROLE_KEY` or `SUPABASE_SECRET_KEY`. The alternative names are the ones the
|
|
33
|
-
Vercel Supabase integration injects.
|
|
34
|
-
|
|
35
|
-
## Migrations
|
|
36
|
-
|
|
37
|
-
The package includes `supabase/` with the NextBlock migrations. `npm run update` in a NextBlock
|
|
38
|
-
project copies them into the project's `supabase/migrations` and applies the pending ones.
|
|
39
|
-
|
|
40
|
-
## Documentation
|
|
41
|
-
|
|
42
|
-
- [Database and auth](https://github.com/nextblock-cms/nextblock/blob/master/docs/04-DATABASE-AND-AUTH.md)
|
|
43
|
-
- [Staying up to date](https://github.com/nextblock-cms/nextblock/blob/master/docs/13-STAYING-UP-TO-DATE.md)
|
|
44
|
-
|
|
45
|
-
## License
|
|
46
|
-
|
|
47
|
-
AGPL-3.0-or-later.
|
|
1
|
+
# @nextblock-cms/db
|
|
2
|
+
|
|
3
|
+
The database layer of [NextBlock](https://github.com/nextblock-cms/nextblock), the open-core CMS
|
|
4
|
+
for Next.js and Supabase: Supabase clients for each trust level, the generated `Database` types,
|
|
5
|
+
secret encryption, and the premium-package license check. It also ships the NextBlock database
|
|
6
|
+
migrations.
|
|
7
|
+
|
|
8
|
+
Projects created with `npm create nextblock@latest` already depend on it. It is built for
|
|
9
|
+
NextBlock projects (Next.js 16, React 19, `@supabase/ssr`) rather than as a general-purpose
|
|
10
|
+
library.
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @nextblock-cms/db
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Entry points
|
|
17
|
+
|
|
18
|
+
| Import | Use it from | What it holds |
|
|
19
|
+
| :-- | :-- | :-- |
|
|
20
|
+
| `@nextblock-cms/db` | client | The browser Supabase client (`createClient`), the `Database` types, and client-side profile and language lookups |
|
|
21
|
+
| `@nextblock-cms/db/server` | server only | `createClient()` scoped to the request cookies, `getSsgSupabaseClient()` for public reads, `getServiceRoleSupabaseClient()` for admin work only (it bypasses Row Level Security), `verifyPackageOnline()`, secret encryption and config resolution |
|
|
22
|
+
| `@nextblock-cms/db/secrets` | server only | Secret encryption (`encryptSecret`, `decryptSecret`) and config resolution, without the Supabase clients |
|
|
23
|
+
| `@nextblock-cms/db/types` | types only | The generated `Database` types |
|
|
24
|
+
|
|
25
|
+
Pick the server client by trust level. Use the service-role client only in code that has
|
|
26
|
+
already checked the caller's role.
|
|
27
|
+
|
|
28
|
+
## Environment
|
|
29
|
+
|
|
30
|
+
The clients read `NEXT_PUBLIC_SUPABASE_URL` or `SUPABASE_URL`, the publishable (anon) key under
|
|
31
|
+
either its `NEXT_PUBLIC_` or its plain name, and, for the service-role client,
|
|
32
|
+
`SUPABASE_SERVICE_ROLE_KEY` or `SUPABASE_SECRET_KEY`. The alternative names are the ones the
|
|
33
|
+
Vercel Supabase integration injects.
|
|
34
|
+
|
|
35
|
+
## Migrations
|
|
36
|
+
|
|
37
|
+
The package includes `supabase/` with the NextBlock migrations. `npm run update` in a NextBlock
|
|
38
|
+
project copies them into the project's `supabase/migrations` and applies the pending ones.
|
|
39
|
+
|
|
40
|
+
## Documentation
|
|
41
|
+
|
|
42
|
+
- [Database and auth](https://github.com/nextblock-cms/nextblock/blob/master/docs/04-DATABASE-AND-AUTH.md)
|
|
43
|
+
- [Staying up to date](https://github.com/nextblock-cms/nextblock/blob/master/docs/13-STAYING-UP-TO-DATE.md)
|
|
44
|
+
|
|
45
|
+
## License
|
|
46
|
+
|
|
47
|
+
AGPL-3.0-or-later.
|
package/package.json
CHANGED
|
@@ -461,17 +461,17 @@ Deno.serve(async (req: Request) => {
|
|
|
461
461
|
status: item.status,
|
|
462
462
|
author_id: author_id,
|
|
463
463
|
meta_title: item.seo?.meta_title || null,
|
|
464
|
-
meta_description: item.seo?.meta_description || null,
|
|
465
|
-
feature_image_id,
|
|
466
|
-
created_at: item.created_at,
|
|
467
|
-
updated_at: item.updated_at,
|
|
468
|
-
};
|
|
464
|
+
meta_description: item.seo?.meta_description || null,
|
|
465
|
+
feature_image_id,
|
|
466
|
+
created_at: item.created_at,
|
|
467
|
+
updated_at: item.updated_at,
|
|
468
|
+
};
|
|
469
469
|
|
|
470
470
|
// Posts specific fields
|
|
471
471
|
if (entity_type === 'post') {
|
|
472
|
-
baseData.excerpt = item.excerpt;
|
|
473
|
-
baseData.published_at = item.published_at;
|
|
474
|
-
}
|
|
472
|
+
baseData.excerpt = item.excerpt;
|
|
473
|
+
baseData.published_at = item.published_at;
|
|
474
|
+
}
|
|
475
475
|
|
|
476
476
|
processedEntities.push(baseData);
|
|
477
477
|
|