@beechcms/core 0.4.0 → 0.4.2
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/auth/password-reset-token.repository.d.ts +0 -1
- package/dist/auth/password-reset-token.repository.d.ts.map +1 -1
- package/dist/automations-grammar-words.d.ts +2 -0
- package/dist/automations-grammar-words.d.ts.map +1 -0
- package/dist/automations-grammar-words.js +6 -0
- package/dist/automations.repository.interface.d.ts +19 -0
- package/dist/automations.repository.interface.d.ts.map +1 -0
- package/dist/automations.repository.interface.js +1 -0
- package/dist/automations.runner.interface.d.ts +10 -0
- package/dist/automations.runner.interface.d.ts.map +1 -0
- package/dist/automations.runner.interface.js +1 -0
- package/dist/automations.runner.stub.d.ts +5 -0
- package/dist/automations.runner.stub.d.ts.map +1 -0
- package/dist/automations.runner.stub.js +5 -0
- package/dist/automations.types.d.ts +73 -0
- package/dist/automations.types.d.ts.map +1 -0
- package/dist/automations.types.js +1 -0
- package/dist/clock.d.ts +25 -0
- package/dist/clock.d.ts.map +1 -0
- package/dist/clock.js +9 -0
- package/dist/content-scan.repository.d.ts +9 -0
- package/dist/content-scan.repository.d.ts.map +1 -0
- package/dist/content-scan.repository.js +1 -0
- package/dist/engine.d.ts +24 -24
- package/dist/engine.js +22 -22
- package/dist/id-generator.d.ts +19 -0
- package/dist/id-generator.d.ts.map +1 -0
- package/dist/id-generator.js +7 -0
- package/dist/index.d.ts +27 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -3
- package/dist/notifications/notification-service.d.ts +29 -0
- package/dist/notifications/notification-service.d.ts.map +1 -0
- package/dist/notifications/notification-service.js +1 -0
- package/dist/notifications/notification.repository.d.ts +51 -0
- package/dist/notifications/notification.repository.d.ts.map +1 -0
- package/dist/notifications/notification.repository.js +10 -0
- package/dist/observability/activity-log.repository.d.ts +58 -0
- package/dist/observability/activity-log.repository.d.ts.map +1 -0
- package/dist/observability/activity-log.repository.js +1 -0
- package/dist/observability/activity-logger.d.ts +49 -0
- package/dist/observability/activity-logger.d.ts.map +1 -0
- package/dist/observability/activity-logger.js +12 -0
- package/dist/observability/analytics.repository.d.ts +37 -0
- package/dist/observability/analytics.repository.d.ts.map +1 -0
- package/dist/observability/analytics.repository.js +1 -0
- package/dist/scheduler.interface.d.ts +4 -0
- package/dist/scheduler.interface.d.ts.map +1 -0
- package/dist/scheduler.interface.js +1 -0
- package/dist/scheduler.stub.d.ts +5 -0
- package/dist/scheduler.stub.d.ts.map +1 -0
- package/dist/scheduler.stub.js +5 -0
- package/dist/search/search.repository.d.ts +45 -0
- package/dist/search/search.repository.d.ts.map +1 -0
- package/dist/search/search.repository.js +1 -0
- package/dist/seed-registry.d.ts +49 -0
- package/dist/seed-registry.d.ts.map +1 -0
- package/dist/seed-registry.js +38 -0
- package/dist/slug-utils.d.ts.map +1 -1
- package/dist/slug-utils.js +4 -3
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/validation.d.ts +7 -7
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +29 -106
- package/dist/widget/widget.repository.d.ts +113 -0
- package/dist/widget/widget.repository.d.ts.map +1 -0
- package/dist/widget/widget.repository.js +1 -0
- package/package.json +9 -3
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notification repository contract.
|
|
3
|
+
*
|
|
4
|
+
* Persists in-app notifications (admin inbox) and exposes the aggregate stats
|
|
5
|
+
* the GET /notifications handler needs to build a strong ETag without reading
|
|
6
|
+
* every row.
|
|
7
|
+
*
|
|
8
|
+
* @module @beechcms/core/notifications/notification.repository
|
|
9
|
+
*/
|
|
10
|
+
export type NotificationType = 'info' | 'success' | 'warning' | 'error';
|
|
11
|
+
export interface NotificationRecord {
|
|
12
|
+
id: string;
|
|
13
|
+
title: string;
|
|
14
|
+
message: string;
|
|
15
|
+
type: NotificationType;
|
|
16
|
+
isRead: boolean;
|
|
17
|
+
createdAt: number;
|
|
18
|
+
}
|
|
19
|
+
export interface NotificationStats {
|
|
20
|
+
totalCount: number;
|
|
21
|
+
latestCreatedAt: number;
|
|
22
|
+
readCount: number;
|
|
23
|
+
}
|
|
24
|
+
export interface INotificationRepository {
|
|
25
|
+
/**
|
|
26
|
+
* Return the most recent notifications, newest first.
|
|
27
|
+
*
|
|
28
|
+
* The `limit` parameter is required to prevent unbounded reads — the inbox
|
|
29
|
+
* could grow large over time and clients only ever render a window.
|
|
30
|
+
*/
|
|
31
|
+
list(limit: number): Promise<NotificationRecord[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Return aggregate counters used to build the GET /notifications ETag.
|
|
34
|
+
*
|
|
35
|
+
* Computing `totalCount`, `latestCreatedAt` and `readCount` on the database
|
|
36
|
+
* side lets the handler skip serialising the full list when nothing has
|
|
37
|
+
* changed since the client's last poll, saving bandwidth on the dashboard.
|
|
38
|
+
*/
|
|
39
|
+
stats(): Promise<NotificationStats>;
|
|
40
|
+
/**
|
|
41
|
+
* Insert a new notification and return its generated id so callers (e.g.
|
|
42
|
+
* the public form submission flow) can correlate the notification with the
|
|
43
|
+
* triggering request.
|
|
44
|
+
*/
|
|
45
|
+
create(record: Omit<NotificationRecord, 'id' | 'createdAt' | 'isRead'>): Promise<string>;
|
|
46
|
+
markRead(notificationId: string): Promise<void>;
|
|
47
|
+
markUnread(notificationId: string): Promise<void>;
|
|
48
|
+
markAllRead(): Promise<void>;
|
|
49
|
+
delete(notificationId: string): Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=notification.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification.repository.d.ts","sourceRoot":"","sources":["../../src/notifications/notification.repository.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAA;AAEvE,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,gBAAgB,CAAA;IACtB,MAAM,EAAE,OAAO,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;IACvB,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,uBAAuB;IACtC;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAA;IAElD;;;;;;OAMG;IACH,KAAK,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAAA;IAEnC;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,GAAG,WAAW,GAAG,QAAQ,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAExF,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC/C,UAAU,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACjD,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5B,MAAM,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC9C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notification repository contract.
|
|
3
|
+
*
|
|
4
|
+
* Persists in-app notifications (admin inbox) and exposes the aggregate stats
|
|
5
|
+
* the GET /notifications handler needs to build a strong ETag without reading
|
|
6
|
+
* every row.
|
|
7
|
+
*
|
|
8
|
+
* @module @beechcms/core/notifications/notification.repository
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Activity Log read-side repository contract.
|
|
3
|
+
*
|
|
4
|
+
* Used by handlers that surface the audit trail back to the user (settings
|
|
5
|
+
* activity tab, recent activity feed on the dashboard). Kept separate from
|
|
6
|
+
* {@link IActivityLogger} because writers and readers have different
|
|
7
|
+
* lifecycles: writes are fire-and-forget background tasks; reads are blocking
|
|
8
|
+
* request paths that need filters and pagination.
|
|
9
|
+
*
|
|
10
|
+
* @module @beechcms/core/observability/activity-log.repository
|
|
11
|
+
*/
|
|
12
|
+
import type { ActivityAction, EntityType } from './activity-logger.js';
|
|
13
|
+
export interface ActivityLogRecord {
|
|
14
|
+
id: string;
|
|
15
|
+
userId: string;
|
|
16
|
+
userEmail: string;
|
|
17
|
+
userName: string | null;
|
|
18
|
+
action: ActivityAction;
|
|
19
|
+
entityType: EntityType;
|
|
20
|
+
entityId: string;
|
|
21
|
+
entitySlug: string | null;
|
|
22
|
+
details: Record<string, unknown> | null;
|
|
23
|
+
createdAt: number;
|
|
24
|
+
}
|
|
25
|
+
export interface ActivityLogListOptions {
|
|
26
|
+
/** Restrict the result to a specific user. Used by the per-user activity tab. */
|
|
27
|
+
userId?: string;
|
|
28
|
+
/** Restrict the result to a specific content seed. Used by per-seed feeds. */
|
|
29
|
+
entitySlug?: string;
|
|
30
|
+
/** Hard upper bound on the number of rows returned. */
|
|
31
|
+
limit: number;
|
|
32
|
+
}
|
|
33
|
+
export interface CountSinceOptions {
|
|
34
|
+
action: ActivityAction;
|
|
35
|
+
entityType: EntityType;
|
|
36
|
+
/** Lower bound (inclusive) for `createdAt` in seconds since epoch. */
|
|
37
|
+
sinceTimestamp: number;
|
|
38
|
+
}
|
|
39
|
+
export interface IActivityLogRepository {
|
|
40
|
+
/**
|
|
41
|
+
* Return the most recent activity entries matching the given filters.
|
|
42
|
+
*
|
|
43
|
+
* The list is always ordered by `createdAt` DESC so callers get newest-first
|
|
44
|
+
* data without paying extra sort costs in TypeScript. Used by the settings
|
|
45
|
+
* activity tab (per-user) and by the stats recent-activity feed (global).
|
|
46
|
+
*/
|
|
47
|
+
list(options: ActivityLogListOptions): Promise<ActivityLogRecord[]>;
|
|
48
|
+
/**
|
|
49
|
+
* Count entries with the given `action` and `entityType` whose `createdAt`
|
|
50
|
+
* is greater-than-or-equal to `sinceTimestamp`.
|
|
51
|
+
*
|
|
52
|
+
* Used by the dashboard `/stats/total` widget to surface today/week/month
|
|
53
|
+
* create-event counts without hardcoding SQL in the handler. Each period
|
|
54
|
+
* is one call so the repository contract stays narrow and deterministic.
|
|
55
|
+
*/
|
|
56
|
+
countSince(options: CountSinceOptions): Promise<number>;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=activity-log.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-log.repository.d.ts","sourceRoot":"","sources":["../../src/observability/activity-log.repository.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAA;AAEtE,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,MAAM,EAAE,cAAc,CAAA;IACtB,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IACvC,SAAS,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,8EAA8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,cAAc,CAAA;IACtB,UAAU,EAAE,UAAU,CAAA;IACtB,sEAAsE;IACtE,cAAc,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,sBAAsB;IACrC;;;;;;OAMG;IACH,IAAI,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAA;IAEnE;;;;;;;OAOG;IACH,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CACxD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Activity Logger contract.
|
|
3
|
+
*
|
|
4
|
+
* Records side-effect events ("a user did X to entity Y") for the audit trail
|
|
5
|
+
* displayed in the dashboard's settings activity tab and the recent activity
|
|
6
|
+
* feed. The interface is intentionally framework-agnostic so it can be
|
|
7
|
+
* fulfilled in production by a D1-backed implementation, in tests by an
|
|
8
|
+
* in-memory implementation, and in the future by remote sinks.
|
|
9
|
+
*
|
|
10
|
+
* @module @beechcms/core/observability/activity-logger
|
|
11
|
+
*/
|
|
12
|
+
export type ActivityAction = 'create' | 'update' | 'delete' | 'upload';
|
|
13
|
+
export type EntityType = 'content' | 'media';
|
|
14
|
+
/**
|
|
15
|
+
* Identifies the human (or machine) actor that triggered the event.
|
|
16
|
+
*
|
|
17
|
+
* The actor MUST be assembled by the caller (typically a Hono handler that has
|
|
18
|
+
* already authenticated the request). The logger never reaches into a
|
|
19
|
+
* framework-specific context to discover who is acting — this avoids hidden
|
|
20
|
+
* coupling and lets the same logger run inside CLI scripts and background
|
|
21
|
+
* jobs.
|
|
22
|
+
*/
|
|
23
|
+
export interface ActivityActor {
|
|
24
|
+
id: string;
|
|
25
|
+
email: string;
|
|
26
|
+
name?: string | null;
|
|
27
|
+
}
|
|
28
|
+
export interface ActivityLogEntry {
|
|
29
|
+
action: ActivityAction;
|
|
30
|
+
entityType: EntityType;
|
|
31
|
+
entityId: string;
|
|
32
|
+
entitySlug?: string;
|
|
33
|
+
details?: Record<string, unknown>;
|
|
34
|
+
actor: ActivityActor;
|
|
35
|
+
}
|
|
36
|
+
export interface IActivityLogger {
|
|
37
|
+
/**
|
|
38
|
+
* Persist a single activity entry.
|
|
39
|
+
*
|
|
40
|
+
* Implementations decide whether to fire-and-forget (Cloudflare
|
|
41
|
+
* `executionCtx.waitUntil`) or to wait inline (test environments).
|
|
42
|
+
* In either case the call MUST NOT throw to the caller: logging is
|
|
43
|
+
* observability, never a hard dependency of the request being served.
|
|
44
|
+
* Internal errors must be swallowed and logged via `console.error` so the
|
|
45
|
+
* mainline response path is never disturbed by audit-trail failures.
|
|
46
|
+
*/
|
|
47
|
+
log(entry: ActivityLogEntry): Promise<void> | void;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=activity-logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity-logger.d.ts","sourceRoot":"","sources":["../../src/observability/activity-logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;AACtE,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,OAAO,CAAA;AAE5C;;;;;;;;GAQG;AACH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,cAAc,CAAA;IACtB,UAAU,EAAE,UAAU,CAAA;IACtB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,KAAK,EAAE,aAAa,CAAA;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;OASG;IACH,GAAG,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;CACnD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Activity Logger contract.
|
|
3
|
+
*
|
|
4
|
+
* Records side-effect events ("a user did X to entity Y") for the audit trail
|
|
5
|
+
* displayed in the dashboard's settings activity tab and the recent activity
|
|
6
|
+
* feed. The interface is intentionally framework-agnostic so it can be
|
|
7
|
+
* fulfilled in production by a D1-backed implementation, in tests by an
|
|
8
|
+
* in-memory implementation, and in the future by remote sinks.
|
|
9
|
+
*
|
|
10
|
+
* @module @beechcms/core/observability/activity-logger
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metric tracked by the analytics table. Today only request counts and
|
|
3
|
+
* unique-visitor counts are recorded; new metric names should be appended
|
|
4
|
+
* to this union and to the implementation's switch statement.
|
|
5
|
+
*/
|
|
6
|
+
export type AnalyticsMetric = 'requests' | 'visitors';
|
|
7
|
+
/**
|
|
8
|
+
* Read/write contract for the analytics counters that power the dashboard
|
|
9
|
+
* widgets (per-day request totals, sparklines, system health proxy).
|
|
10
|
+
*
|
|
11
|
+
* Implementations must use idempotent upserts so the recording middleware
|
|
12
|
+
* can be invoked once per request without producing duplicates when the
|
|
13
|
+
* same day/seed/metric tuple is touched repeatedly.
|
|
14
|
+
*/
|
|
15
|
+
export interface IAnalyticsRepository {
|
|
16
|
+
/**
|
|
17
|
+
* Upserts a request counter for the given seed at the current day bucket.
|
|
18
|
+
* The day bucket (Unix timestamp truncated to midnight UTC) is computed
|
|
19
|
+
* internally from the implementation's clock so callers never need to
|
|
20
|
+
* pass a timestamp. Implementations must use INSERT ... ON CONFLICT DO
|
|
21
|
+
* UPDATE to remain idempotent under concurrent calls within the same day.
|
|
22
|
+
*/
|
|
23
|
+
recordRequest(seedSlug: string): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Returns the total count for the given metric since sinceTimestamp.
|
|
26
|
+
* Used by the stats handler for total request counts and visitor counts.
|
|
27
|
+
* The aggregation sums the stored counter values, not row counts.
|
|
28
|
+
*/
|
|
29
|
+
sumByMetric(metric: AnalyticsMetric, seedSlug: string, sinceTimestamp: number): Promise<number>;
|
|
30
|
+
/**
|
|
31
|
+
* Returns a map of date strings (YYYY-MM-DD) to request counts since
|
|
32
|
+
* sinceTimestamp, suitable for chart rendering without further
|
|
33
|
+
* transformation by the caller.
|
|
34
|
+
*/
|
|
35
|
+
groupByMetric(seedSlug: string, sinceTimestamp: number): Promise<Record<string, number>>;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=analytics.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.repository.d.ts","sourceRoot":"","sources":["../../src/observability/analytics.repository.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,UAAU,CAAA;AAErD;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAE9C;;;;OAIG;IACH,WAAW,CACT,MAAM,EAAE,eAAe,EACvB,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,MAAM,CAAC,CAAA;IAElB;;;;OAIG;IACH,aAAa,CACX,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.interface.d.ts","sourceRoot":"","sources":["../src/scheduler.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;CAC3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.stub.d.ts","sourceRoot":"","sources":["../src/scheduler.stub.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE1D,qBAAa,aAAc,YAAW,UAAU;IAC9C,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,IAAI;CAG5C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { Seed } from '../types.js';
|
|
2
|
+
export interface SearchQueryOptions {
|
|
3
|
+
queryText: string;
|
|
4
|
+
schemaSlug: string | null;
|
|
5
|
+
statusFilter: string | null;
|
|
6
|
+
limit: number;
|
|
7
|
+
cursor: string | null;
|
|
8
|
+
}
|
|
9
|
+
export interface SearchResultRow {
|
|
10
|
+
entryId: string;
|
|
11
|
+
schemaSlug: string;
|
|
12
|
+
slug: string | null;
|
|
13
|
+
status: string;
|
|
14
|
+
title: string | null;
|
|
15
|
+
excerpt: string;
|
|
16
|
+
rank: number;
|
|
17
|
+
}
|
|
18
|
+
export interface SearchCountResult {
|
|
19
|
+
total: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Read-only contract for the global FTS5 search route.
|
|
23
|
+
*
|
|
24
|
+
* Implementations encapsulate the UNION ALL query that fans out across all
|
|
25
|
+
* `fts_<seed>` virtual tables. The route handler stays free of D1 and only
|
|
26
|
+
* shapes the final response.
|
|
27
|
+
*/
|
|
28
|
+
export interface ISearchRepository {
|
|
29
|
+
/**
|
|
30
|
+
* Executes a UNION ALL full-text search across all FTS-enabled seed tables.
|
|
31
|
+
* Returns at most options.limit + 1 rows so the caller can detect hasMore
|
|
32
|
+
* without a separate count query for the cursor case.
|
|
33
|
+
* Implementations must propagate the EMPTY_QUERY error thrown by
|
|
34
|
+
* buildFtsQuery so the route handler can return an empty result set rather
|
|
35
|
+
* than a 500.
|
|
36
|
+
*/
|
|
37
|
+
search(options: SearchQueryOptions, seeds: Seed[]): Promise<SearchResultRow[]>;
|
|
38
|
+
/**
|
|
39
|
+
* Runs the count variant of the FTS query to support the `total` field in
|
|
40
|
+
* the search response. Called in parallel with search() by the route handler
|
|
41
|
+
* with the same filter inputs but without limit/cursor.
|
|
42
|
+
*/
|
|
43
|
+
count(options: Omit<SearchQueryOptions, 'limit' | 'cursor'>, seeds: Seed[]): Promise<SearchCountResult>;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=search.repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.repository.d.ts","sourceRoot":"","sources":["../../src/search/search.repository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAEvC,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;;;OAOG;IACH,MAAM,CAAC,OAAO,EAAE,kBAAkB,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAAA;IAE9E;;;;OAIG;IACH,KAAK,CACH,OAAO,EAAE,IAAI,CAAC,kBAAkB,EAAE,OAAO,GAAG,QAAQ,CAAC,EACrD,KAAK,EAAE,IAAI,EAAE,GACZ,OAAO,CAAC,iBAAiB,CAAC,CAAA;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { Seed } from './types.js';
|
|
2
|
+
export interface ISeedRegistry {
|
|
3
|
+
/**
|
|
4
|
+
* Returns all seeds as a flat array, preserving insertion order.
|
|
5
|
+
* Decouples callers from the internal storage shape so the registry
|
|
6
|
+
* implementation can change without touching every route handler.
|
|
7
|
+
*/
|
|
8
|
+
all(): Seed[];
|
|
9
|
+
/**
|
|
10
|
+
* Returns the seed with the given slug, or null if not found.
|
|
11
|
+
* Provides a single lookup point that can be overridden in tests
|
|
12
|
+
* without rebuilding the full registry object.
|
|
13
|
+
*/
|
|
14
|
+
get(slug: string): Seed | null;
|
|
15
|
+
/**
|
|
16
|
+
* Returns seeds that are visible in the dashboard sidebar.
|
|
17
|
+
* A seed is visible when dashboard.hidden is not explicitly true.
|
|
18
|
+
* Eliminates the seeds.filter(s => !s.dashboard?.hidden) pattern
|
|
19
|
+
* that would otherwise be duplicated across route handlers.
|
|
20
|
+
*/
|
|
21
|
+
visibleInDashboard(): Seed[];
|
|
22
|
+
/**
|
|
23
|
+
* Returns seeds that have allowPublicRead enabled.
|
|
24
|
+
* Eliminates the seeds.filter(s => s.allowPublicRead) pattern.
|
|
25
|
+
*/
|
|
26
|
+
publicReadable(): Seed[];
|
|
27
|
+
/**
|
|
28
|
+
* Returns seeds that have the draft workflow enabled.
|
|
29
|
+
* Eliminates the seeds.filter(s => s.allowDrafts) pattern.
|
|
30
|
+
*/
|
|
31
|
+
draftEnabled(): Seed[];
|
|
32
|
+
}
|
|
33
|
+
export declare class SeedRegistry implements ISeedRegistry {
|
|
34
|
+
private readonly seedMap;
|
|
35
|
+
private readonly orderedSeeds;
|
|
36
|
+
constructor(seeds: Seed[]);
|
|
37
|
+
all(): Seed[];
|
|
38
|
+
get(slug: string): Seed | null;
|
|
39
|
+
visibleInDashboard(): Seed[];
|
|
40
|
+
publicReadable(): Seed[];
|
|
41
|
+
draftEnabled(): Seed[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Named subclass of SeedRegistry for use in test suites.
|
|
45
|
+
* Gives tests a semantic name without requiring any dependency on factory.ts.
|
|
46
|
+
*/
|
|
47
|
+
export declare class InMemorySeedRegistry extends SeedRegistry {
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=seed-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seed-registry.d.ts","sourceRoot":"","sources":["../src/seed-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAGtC,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,GAAG,IAAI,IAAI,EAAE,CAAA;IAEb;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAA;IAE9B;;;;;OAKG;IACH,kBAAkB,IAAI,IAAI,EAAE,CAAA;IAE5B;;;OAGG;IACH,cAAc,IAAI,IAAI,EAAE,CAAA;IAExB;;;OAGG;IACH,YAAY,IAAI,IAAI,EAAE,CAAA;CACvB;AAED,qBAAa,YAAa,YAAW,aAAa;IAChD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAQ;gBAEzB,KAAK,EAAE,IAAI,EAAE;IAezB,GAAG,IAAI,IAAI,EAAE;IAIb,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAI9B,kBAAkB,IAAI,IAAI,EAAE;IAI5B,cAAc,IAAI,IAAI,EAAE;IAIxB,YAAY,IAAI,IAAI,EAAE;CAGvB;AAED;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,YAAY;CAAG"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AUTOMATION_RESERVED_WORDS } from './automations-grammar-words.js';
|
|
2
|
+
export class SeedRegistry {
|
|
3
|
+
seedMap;
|
|
4
|
+
orderedSeeds;
|
|
5
|
+
constructor(seeds) {
|
|
6
|
+
for (const seed of seeds) {
|
|
7
|
+
for (const branch of seed.branches) {
|
|
8
|
+
if (AUTOMATION_RESERVED_WORDS.has(branch.alias)) {
|
|
9
|
+
throw new Error(`Seed "${seed.slug}" uses reserved alias "${branch.alias}". `
|
|
10
|
+
+ `Pick a different alias — this word is used by the automation template grammar.`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
this.orderedSeeds = seeds;
|
|
15
|
+
this.seedMap = new Map(seeds.map(seed => [seed.slug, seed]));
|
|
16
|
+
}
|
|
17
|
+
all() {
|
|
18
|
+
return this.orderedSeeds;
|
|
19
|
+
}
|
|
20
|
+
get(slug) {
|
|
21
|
+
return this.seedMap.get(slug) ?? null;
|
|
22
|
+
}
|
|
23
|
+
visibleInDashboard() {
|
|
24
|
+
return this.orderedSeeds.filter(seed => seed.dashboard?.hidden !== true);
|
|
25
|
+
}
|
|
26
|
+
publicReadable() {
|
|
27
|
+
return this.orderedSeeds.filter(seed => seed.allowPublicRead === true);
|
|
28
|
+
}
|
|
29
|
+
draftEnabled() {
|
|
30
|
+
return this.orderedSeeds.filter(seed => seed.allowDrafts === true);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Named subclass of SeedRegistry for use in test suites.
|
|
35
|
+
* Gives tests a semantic name without requiring any dependency on factory.ts.
|
|
36
|
+
*/
|
|
37
|
+
export class InMemorySeedRegistry extends SeedRegistry {
|
|
38
|
+
}
|
package/dist/slug-utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slug-utils.d.ts","sourceRoot":"","sources":["../src/slug-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"slug-utils.d.ts","sourceRoot":"","sources":["../src/slug-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAU7C;AAGD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CASnG"}
|
package/dist/slug-utils.js
CHANGED
|
@@ -9,12 +9,13 @@
|
|
|
9
9
|
export function slugify(value) {
|
|
10
10
|
return value
|
|
11
11
|
.normalize('NFKD') // Normalizza caratteri accentati
|
|
12
|
-
.replace(/[^\w\s-]/g, '') // Rimuove tutto ciò che non è alfanumerico
|
|
12
|
+
.replace(/[^\w\s-]/g, '') // Rimuove tutto ciò che non è alfanumerico
|
|
13
13
|
.trim()
|
|
14
14
|
.toLowerCase()
|
|
15
|
-
.replace(/[\s_-]+/g, '-') // Sostituisce spazi
|
|
15
|
+
.replace(/[\s_-]+/g, '-') // Sostituisce spazi e underscore con trattino
|
|
16
16
|
.replace(/^-+|-+$/g, '') // Rimuove trattini all'inizio o alla fine
|
|
17
|
-
.slice(0, 15)
|
|
17
|
+
.slice(0, 15) // Limita a 15 caratteri
|
|
18
|
+
.replace(/-+$/g, ''); // Rimuove trattini rimasti alla fine dopo il taglio
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
20
21
|
* Genera uno slug da un input (es. titolo o nome) o un fallback UUID.
|
package/dist/types.d.ts
CHANGED
|
@@ -100,7 +100,7 @@ export type FilterOperator = 'eq' | 'neq' | 'gt' | 'gte' | 'lt' | 'lte' | 'conta
|
|
|
100
100
|
export type FilterType = 'text' | 'number' | 'date' | 'boolean' | 'tags' | 'select' | 'system' | 'json';
|
|
101
101
|
export interface FilterCondition {
|
|
102
102
|
op: FilterOperator;
|
|
103
|
-
value: string | number | boolean | null;
|
|
103
|
+
value: string | number | boolean | null | string[] | number[];
|
|
104
104
|
}
|
|
105
105
|
export interface FilterGroup {
|
|
106
106
|
/** Nome colonna: system column (id/slug/status/created_at/updated_at) o branch alias */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAA;AAEvG,sEAAsE;AACtE,MAAM,WAAW,MAAM;IACrB,iGAAiG;IACjG,KAAK,EAAE,MAAM,CAAA;IACb,0BAA0B;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,sBAAsB;IACtB,IAAI,EAAE,UAAU,CAAA;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,YAAY,CAAA;IAC3E;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,+EAA+E;IAC/E,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,mCAAmC;IACnC,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE;Q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AA;KAAE,CAAA;IAC9C,sDAAsD;IACtD,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,EAAE,CAAA;CAC/C"}
|
package/dist/validation.d.ts
CHANGED
|
@@ -21,18 +21,18 @@ export interface ValidateSeedPayloadResult {
|
|
|
21
21
|
hasAnyValidField: boolean;
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
24
|
+
* Common foundation for schema-driven validation and sanitization of payloads.
|
|
25
|
+
* Used by the Public API and reusable in the Botanical Engine.
|
|
26
26
|
*
|
|
27
|
-
*
|
|
27
|
+
* Mandatory execution order at the time of writing:
|
|
28
28
|
* validate raw → hash (privacy policy) → store
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* Hashing occurs AFTER validation, not before.
|
|
30
|
+
* This ensures that the validated value is the original raw value,
|
|
31
|
+
* not the digest — avoiding false failures on fields with formats (e.g., email).
|
|
32
32
|
*/
|
|
33
33
|
export declare function validateAndSanitizeSeedPayload(seed: Seed, payload: Record<string, unknown>, options?: ValidateSeedPayloadOptions): ValidateSeedPayloadResult;
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* Validates content status supported by the CMS.
|
|
36
36
|
*/
|
|
37
37
|
export declare function isValidContentStatus(value: unknown): value is 'draft' | 'review' | 'published';
|
|
38
38
|
/**
|
package/dist/validation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AACA,OAAO,K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