@momentumcms/core 0.5.9 → 0.5.11

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": "@momentumcms/core",
3
- "version": "0.5.9",
3
+ "version": "0.5.11",
4
4
  "description": "Core collection config, fields, hooks, and access control for Momentum CMS",
5
5
  "license": "MIT",
6
6
  "author": "Momentum CMS Contributors",
@@ -60,6 +60,9 @@ export interface HooksConfig {
60
60
  afterRestore?: HookFunction[];
61
61
  }
62
62
  export interface AdminConfig {
63
+ /** Icon name for the admin sidebar (e.g. 'heroNewspaper', 'heroUsers').
64
+ * All heroicons/outline names are available by default. */
65
+ icon?: `hero${string}` | (string & {});
63
66
  /** Field to use as the document title in the admin UI */
64
67
  useAsTitle?: string;
65
68
  /** Default columns to show in list view */
@@ -296,6 +299,8 @@ export interface EndpointArgs {
296
299
  collection: CollectionConfig;
297
300
  /** Request body (for POST/PUT/PATCH endpoints) */
298
301
  body?: Record<string, unknown>;
302
+ /** Query string parameters from the request URL */
303
+ params?: Record<string, unknown>;
299
304
  /**
300
305
  * Async helper to query any collection.
301
306
  * Returns the raw API result (find returns { docs, totalDocs }, findById returns doc, etc.).
@@ -313,7 +318,7 @@ export interface EndpointQueryHelper {
313
318
  totalDocs: number;
314
319
  }>;
315
320
  findById: (slug: string, id: string) => Promise<Record<string, unknown> | null>;
316
- count: (slug: string) => Promise<number>;
321
+ count: (slug: string, where?: Record<string, unknown>) => Promise<number>;
317
322
  create: (slug: string, data: Record<string, unknown>) => Promise<Record<string, unknown>>;
318
323
  update: (slug: string, id: string, data: Record<string, unknown>) => Promise<Record<string, unknown>>;
319
324
  delete: (slug: string, id: string) => Promise<{
@@ -21,6 +21,12 @@ export interface DatabaseAdapter {
21
21
  */
22
22
  dialect?: 'postgresql' | 'sqlite';
23
23
  find(collection: string, query: Record<string, unknown>): Promise<Record<string, unknown>[]>;
24
+ /**
25
+ * Count documents matching a query using SELECT COUNT(*).
26
+ * More efficient than find() + .length for large collections.
27
+ * Optional — if not implemented, the API layer falls back to find().
28
+ */
29
+ count?(collection: string, query: Record<string, unknown>): Promise<number>;
24
30
  findById(collection: string, id: string): Promise<Record<string, unknown> | null>;
25
31
  create(collection: string, data: Record<string, unknown>): Promise<Record<string, unknown>>;
26
32
  update(collection: string, id: string, data: Record<string, unknown>): Promise<Record<string, unknown>>;
@@ -60,8 +60,9 @@ export interface PluginAdminRouteDescriptor {
60
60
  data?: Record<string, unknown>;
61
61
  /** Sidebar display label */
62
62
  label: string;
63
- /** Icon name from ng-icons (e.g., 'heroChartBarSquare') */
64
- icon: string;
63
+ /** Icon name from ng-icons (e.g., 'heroChartBarSquare').
64
+ * All heroicons/outline names are available by default. */
65
+ icon: `hero${string}` | (string & {});
65
66
  /** Sidebar section name. @default 'Plugins' */
66
67
  group?: string;
67
68
  }