@stacksjs/cms 0.72.23 → 0.72.24
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/authors/destroy.d.ts +2 -1
- package/dist/authors/fetch.d.ts +2 -1
- package/dist/authors/store.d.ts +2 -1
- package/dist/authors/update.d.ts +2 -1
- package/dist/menus/index.js +1 -1
- package/dist/pages/fetch.d.ts +2 -1
- package/dist/pages/update.d.ts +2 -1
- package/dist/results.d.ts +1 -1
- package/package.json +3 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RowOf } from '@stacksjs/database';
|
|
1
2
|
/**
|
|
2
3
|
* Delete an author by ID
|
|
3
4
|
*
|
|
@@ -12,4 +13,4 @@ export declare function destroy(id: number): Promise<AuthorJsonResponse>;
|
|
|
12
13
|
* @returns The number of deleted authors
|
|
13
14
|
*/
|
|
14
15
|
export declare function destroyMany(ids: number[]): Promise<number>;
|
|
15
|
-
declare type AuthorJsonResponse =
|
|
16
|
+
declare type AuthorJsonResponse = RowOf<'authors'>;
|
package/dist/authors/fetch.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RowOf } from '@stacksjs/database';
|
|
1
2
|
/**
|
|
2
3
|
* Fetch an author by ID
|
|
3
4
|
*/
|
|
@@ -22,4 +23,4 @@ export declare function findByUuid(uuid: string): Promise<AuthorJsonResponse | u
|
|
|
22
23
|
* Fetch authors by user ID
|
|
23
24
|
*/
|
|
24
25
|
export declare function findByUserId(userId: number): Promise<AuthorJsonResponse | undefined>;
|
|
25
|
-
declare type AuthorJsonResponse =
|
|
26
|
+
declare type AuthorJsonResponse = RowOf<'authors'>;
|
package/dist/authors/store.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RowOf } from '@stacksjs/database';
|
|
1
2
|
/**
|
|
2
3
|
* Find an existing author by name or email, or create a new one if not found
|
|
3
4
|
*
|
|
@@ -16,5 +17,5 @@ declare interface AuthorData {
|
|
|
16
17
|
name: string
|
|
17
18
|
email: string
|
|
18
19
|
}
|
|
19
|
-
declare type AuthorJsonResponse =
|
|
20
|
+
declare type AuthorJsonResponse = RowOf<'authors'>;
|
|
20
21
|
declare type NewAuthor = NewModelData<typeof Author>;
|
package/dist/authors/update.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RowOf } from '@stacksjs/database';
|
|
1
2
|
/**
|
|
2
3
|
* Update an existing author
|
|
3
4
|
*
|
|
@@ -6,5 +7,5 @@
|
|
|
6
7
|
* @returns The updated author record
|
|
7
8
|
*/
|
|
8
9
|
export declare function update(id: number, data: Partial<NewAuthor>): Promise<AuthorJsonResponse | undefined>;
|
|
9
|
-
declare type AuthorJsonResponse =
|
|
10
|
+
declare type AuthorJsonResponse = RowOf<'authors'>;
|
|
10
11
|
declare type NewAuthor = NewModelData<typeof Author>;
|
package/dist/menus/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getDb}from"../database";export async function fetchMenuTree(siteId,handle){const db=await getDb(),menu=await db.selectFrom("menus").where("site_id","=",siteId).where("handle","=",handle).select(["id"]).executeTakeFirst();if(!menu)return[];const rows=await db.selectFrom("menu_items").leftJoin("pages","pages.id","=","menu_items.page_id").where("menu_items.menu_id","=",menu.id).select(["menu_items.id as id","menu_items.label as label","menu_items.url as url","menu_items.target as target","menu_items.parent_id as parent_id","menu_items.position as position","menu_items.visibility as visibility","pages.path as page_path","pages.status as page_status"]).orderBy("menu_items.position","asc").execute(),toItem=(row)=>{const href=row.url??(row.page_status==="published"?row.page_path:null);if(!href)return null;return{id:row.id,label:row.label,href,target:row.target==="_blank"?"_blank":"_self",visibility:row.visibility==="auth"?"auth":"public",children:[]}},byId=new Map,roots=[];for(const row of rows){const item=toItem(row);if(item)byId.set(row.id,item)}for(const row of rows){const item=byId.get(row.id);if(!item)continue;const parent=row.parent_id?byId.get(row.parent_id):void 0;if(parent)parent.children.push(item);else roots.push(item)}return roots}
|
|
1
|
+
import{asRows}from"@stacksjs/database";import{getDb}from"../database";export async function fetchMenuTree(siteId,handle){const db=await getDb(),menu=await db.selectFrom("menus").where("site_id","=",siteId).where("handle","=",handle).select(["id"]).executeTakeFirst();if(!menu)return[];const rows=asRows(await db.selectFrom("menu_items").leftJoin("pages","pages.id","=","menu_items.page_id").where("menu_items.menu_id","=",menu.id).select(["menu_items.id as id","menu_items.label as label","menu_items.url as url","menu_items.target as target","menu_items.parent_id as parent_id","menu_items.position as position","menu_items.visibility as visibility","pages.path as page_path","pages.status as page_status"]).orderBy("menu_items.position","asc").execute()),toItem=(row)=>{const href=row.url??(row.page_status==="published"?row.page_path:null);if(!href)return null;return{id:row.id,label:row.label,href,target:row.target==="_blank"?"_blank":"_self",visibility:row.visibility==="auth"?"auth":"public",children:[]}},byId=new Map,roots=[];for(const row of rows){const item=toItem(row);if(item)byId.set(row.id,item)}for(const row of rows){const item=byId.get(row.id);if(!item)continue;const parent=row.parent_id?byId.get(row.parent_id):void 0;if(parent)parent.children.push(item);else roots.push(item)}return roots}
|
package/dist/pages/fetch.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RowOf } from '@stacksjs/database';
|
|
1
2
|
/**
|
|
2
3
|
* Fetch a page by ID
|
|
3
4
|
*/
|
|
@@ -26,4 +27,4 @@ export declare function fetchByMinConversions(minConversions: number): Promise<P
|
|
|
26
27
|
* Fetch pages published after a specific date
|
|
27
28
|
*/
|
|
28
29
|
export declare function fetchPublishedAfter(timestamp: number): Promise<PageJsonResponse[]>;
|
|
29
|
-
declare type PageJsonResponse =
|
|
30
|
+
declare type PageJsonResponse = RowOf<'pages'>;
|
package/dist/pages/update.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RowOf } from '@stacksjs/database';
|
|
1
2
|
/**
|
|
2
3
|
* Update a page.
|
|
3
4
|
*
|
|
@@ -14,5 +15,5 @@
|
|
|
14
15
|
* @returns The updated page record
|
|
15
16
|
*/
|
|
16
17
|
export declare function update(id: number, data: Partial<PageUpdate>): Promise<PageJsonResponse>;
|
|
17
|
-
declare type PageJsonResponse =
|
|
18
|
+
declare type PageJsonResponse = RowOf<'pages'>;
|
|
18
19
|
declare type PageUpdate = UpdateModelData<typeof Page>;
|
package/dist/results.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare function insertedId(result: unknown): number | undefined;
|
|
|
12
12
|
* Returns the driver's RETURNING row when there is one, otherwise re-selects
|
|
13
13
|
* the row by the id it reported.
|
|
14
14
|
*/
|
|
15
|
-
export declare function resolveWrittenRow<T extends object>(
|
|
15
|
+
export declare function resolveWrittenRow<T extends object>(table: string, result: unknown): Promise<T | undefined>;
|
|
16
16
|
/**
|
|
17
17
|
* The number of rows affected by a delete/update.
|
|
18
18
|
*
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/cms",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.72.
|
|
5
|
+
"version": "0.72.24",
|
|
6
6
|
"description": "Stacks cms utilities.",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"prepublishOnly": "bun run build"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@stacksjs/sites": "0.72.
|
|
62
|
-
"@stacksjs/validation": "0.72.
|
|
61
|
+
"@stacksjs/sites": "0.72.24",
|
|
62
|
+
"@stacksjs/validation": "0.72.24",
|
|
63
63
|
"ts-slug": "^0.1.0",
|
|
64
64
|
"ts-spreadsheets": "^0.2.0"
|
|
65
65
|
},
|