@momentumcms/core 0.5.10 → 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.10",
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",
@@ -299,6 +299,8 @@ export interface EndpointArgs {
299
299
  collection: CollectionConfig;
300
300
  /** Request body (for POST/PUT/PATCH endpoints) */
301
301
  body?: Record<string, unknown>;
302
+ /** Query string parameters from the request URL */
303
+ params?: Record<string, unknown>;
302
304
  /**
303
305
  * Async helper to query any collection.
304
306
  * Returns the raw API result (find returns { docs, totalDocs }, findById returns doc, etc.).
@@ -316,7 +318,7 @@ export interface EndpointQueryHelper {
316
318
  totalDocs: number;
317
319
  }>;
318
320
  findById: (slug: string, id: string) => Promise<Record<string, unknown> | null>;
319
- count: (slug: string) => Promise<number>;
321
+ count: (slug: string, where?: Record<string, unknown>) => Promise<number>;
320
322
  create: (slug: string, data: Record<string, unknown>) => Promise<Record<string, unknown>>;
321
323
  update: (slug: string, id: string, data: Record<string, unknown>) => Promise<Record<string, unknown>>;
322
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>>;