@plutocms/supabase 0.23.0 → 0.24.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/CHANGELOG.md +7 -0
- package/FEATURES.md +1 -1
- package/package.json +2 -2
- package/server/utils/content-adapter.ts +25 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.24.0](https://github.com/plutocms/supabase/compare/v0.23.0...v0.24.0) (2026-11-06)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **supabase-blog:** tags and categories for posts ([#225](https://github.com/plutocms/supabase/issues/225)) ([36263de](https://github.com/plutocms/supabase/commit/36263def50c4f1e1a4226be5cd14b270d27bb097))
|
|
9
|
+
|
|
3
10
|
## [0.23.0](https://github.com/plutocms/supabase/compare/v0.22.0...v0.23.0) (2026-11-03)
|
|
4
11
|
|
|
5
12
|
|
package/FEATURES.md
CHANGED
|
@@ -16,7 +16,7 @@ policies shared by every project here.
|
|
|
16
16
|
@.claude/skills/users-and-roles/SKILL.md
|
|
17
17
|
- Content adapter: a Supabase/PostgREST-backed `PlutoContentAdapter`, plugging any layer's
|
|
18
18
|
declared content type into `@plutocms/core`'s generic content routes. It supports query
|
|
19
|
-
filters
|
|
19
|
+
filters (a filter on a `multiple` reference matches a list column) and `ids`, puts the timestamps on items, and reads the public API of core with an anonymous client.
|
|
20
20
|
It keeps the revisions of every item (`pluto_content_revisions`, migration 011) for the History of core.
|
|
21
21
|
@.claude/skills/content-adapter/SKILL.md
|
|
22
22
|
- Auth driver: plugs Supabase sign-in into the admin shell that pluto core owns (navbar, sign-in
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plutocms/supabase",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.24.0",
|
|
5
5
|
"description": "Supabase backend layer for Pluto",
|
|
6
6
|
"author": "Victor Ribeiro",
|
|
7
7
|
"homepage": "https://github.com/plutocms/supabase/tree/main/packages/supabase#readme",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@nuxt/ui": "^4.12.0",
|
|
32
32
|
"@nuxtjs/supabase": "^2.1.0",
|
|
33
|
-
"@plutocms/core": ">=0.
|
|
33
|
+
"@plutocms/core": ">=0.58.0 <1.0.0",
|
|
34
34
|
"@supabase/supabase-js": "^2.117.3",
|
|
35
35
|
"postgres": "^3.4.9",
|
|
36
36
|
"supabase": "^2.121.0",
|
|
@@ -253,15 +253,31 @@ function resolveFieldColumn(
|
|
|
253
253
|
return fieldName
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
+
/** Whether a field stores a list in one column: a `multiple` reference. */
|
|
257
|
+
function isListField(type: PlutoContentType, fieldName: string): boolean {
|
|
258
|
+
const field = type.fields.find((candidate) => candidate.name === fieldName)
|
|
259
|
+
|
|
260
|
+
return field?.type === 'reference' && field.multiple === true
|
|
261
|
+
}
|
|
262
|
+
|
|
256
263
|
async function list(
|
|
257
264
|
ctx: PlutoContentContext,
|
|
258
265
|
query: PlutoContentQuery
|
|
259
266
|
): Promise<PlutoContentListResult> {
|
|
267
|
+
// An empty id list matches no item: no query.
|
|
268
|
+
if (query.ids && query.ids.length === 0) {
|
|
269
|
+
return { data: [], total: 0 }
|
|
270
|
+
}
|
|
271
|
+
|
|
260
272
|
const client = await getClient(ctx.event)
|
|
261
273
|
const pkColumn = ctx.type.primaryKey ?? 'id'
|
|
262
274
|
|
|
263
275
|
let builder = client.from(ctx.type.source).select('*', { count: 'exact' })
|
|
264
276
|
|
|
277
|
+
if (query.ids) {
|
|
278
|
+
builder = builder.in(pkColumn, query.ids)
|
|
279
|
+
}
|
|
280
|
+
|
|
265
281
|
const statusColumn = resolveStatusColumn(ctx.type)
|
|
266
282
|
if (statusColumn && query.includeUnpublished !== true) {
|
|
267
283
|
const publishedValue =
|
|
@@ -270,7 +286,12 @@ async function list(
|
|
|
270
286
|
}
|
|
271
287
|
|
|
272
288
|
for (const [field, value] of Object.entries(query.filters ?? {})) {
|
|
273
|
-
|
|
289
|
+
const column = resolveFieldColumn(ctx.type, field, 'filter')
|
|
290
|
+
|
|
291
|
+
// A list column (a `multiple` reference) matches when it holds the value.
|
|
292
|
+
builder = isListField(ctx.type, field)
|
|
293
|
+
? builder.contains(column, [value])
|
|
294
|
+
: builder.eq(column, value)
|
|
274
295
|
}
|
|
275
296
|
|
|
276
297
|
if (query.search) {
|
|
@@ -498,7 +519,9 @@ async function update(
|
|
|
498
519
|
updateAction(
|
|
499
520
|
ctx.type,
|
|
500
521
|
existing && statusColumn ? existing[statusColumn] : undefined,
|
|
501
|
-
statusColumn && Object.hasOwn(values, 'status')
|
|
522
|
+
statusColumn && Object.hasOwn(values, 'status')
|
|
523
|
+
? values.status
|
|
524
|
+
: undefined
|
|
502
525
|
)
|
|
503
526
|
)
|
|
504
527
|
return item
|