@easy-cms/core 1.11.0 → 1.13.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/dist/{chunk-TMO4JTGJ.js → chunk-MHXQUX74.js} +930 -92
- package/dist/{config-n7PtGl4V.d.ts → config-B-bT0hIn.d.ts} +204 -8
- package/dist/{handler-DV-1ICVz.d.ts → handler-COsNEVx0.d.ts} +1 -1
- package/dist/index.d.ts +31 -6
- package/dist/index.js +3 -1
- package/dist/internal.d.ts +2 -2
- package/dist/internal.js +1 -1
- package/dist/{plugin-C_vknKa2.d.ts → plugin-CI6r3SK1.d.ts} +1 -1
- package/dist/plugin.d.ts +2 -2
- package/package.json +1 -1
|
@@ -201,6 +201,17 @@ interface CreateMigrationResult {
|
|
|
201
201
|
readonly file: string;
|
|
202
202
|
readonly statements: readonly string[];
|
|
203
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* A row written with a document, in the same transaction (`outbox: true` in the config): a write
|
|
206
|
+
* that commits leaves it, one that doesn't leaves nothing. Not written when an `update` with
|
|
207
|
+
* `where` doesn't match.
|
|
208
|
+
*/
|
|
209
|
+
interface OutboxRow {
|
|
210
|
+
/** The collection the row goes to. */
|
|
211
|
+
readonly collection: string;
|
|
212
|
+
/** The row's fields, given the written document's id (`null` for a global). */
|
|
213
|
+
data(id: ID | null): Record<string, unknown>;
|
|
214
|
+
}
|
|
204
215
|
/** A connected database bound to one config. Returned by `DatabaseAdapter.init`. */
|
|
205
216
|
interface Database {
|
|
206
217
|
find(args: FindArgs): Promise<PaginatedDocs<RawDocument>>;
|
|
@@ -231,6 +242,7 @@ interface Database {
|
|
|
231
242
|
create(args: {
|
|
232
243
|
collection: string;
|
|
233
244
|
data: Record<string, unknown>;
|
|
245
|
+
outbox?: OutboxRow | undefined;
|
|
234
246
|
}): Promise<RawDocument>;
|
|
235
247
|
/**
|
|
236
248
|
* `data` holds the whole document after merging. Runs in one transaction. With `where`, only
|
|
@@ -241,12 +253,14 @@ interface Database {
|
|
|
241
253
|
collection: string;
|
|
242
254
|
id: ID;
|
|
243
255
|
data: Record<string, unknown>;
|
|
256
|
+
outbox?: OutboxRow | undefined;
|
|
244
257
|
}): Promise<RawDocument>;
|
|
245
258
|
update(args: {
|
|
246
259
|
collection: string;
|
|
247
260
|
id: ID;
|
|
248
261
|
data: Record<string, unknown>;
|
|
249
262
|
where: Where;
|
|
263
|
+
outbox?: OutboxRow | undefined;
|
|
250
264
|
}): Promise<RawDocument | null>;
|
|
251
265
|
/**
|
|
252
266
|
* Adds `by` to a top-level number field in one statement, safe against concurrent calls; an
|
|
@@ -264,6 +278,7 @@ interface Database {
|
|
|
264
278
|
delete(args: {
|
|
265
279
|
collection: string;
|
|
266
280
|
id: ID;
|
|
281
|
+
outbox?: OutboxRow | undefined;
|
|
267
282
|
}): Promise<void>;
|
|
268
283
|
findGlobal(args: {
|
|
269
284
|
slug: string;
|
|
@@ -271,7 +286,13 @@ interface Database {
|
|
|
271
286
|
updateGlobal(args: {
|
|
272
287
|
slug: string;
|
|
273
288
|
data: Record<string, unknown>;
|
|
289
|
+
outbox?: OutboxRow | undefined;
|
|
274
290
|
}): Promise<Record<string, unknown>>;
|
|
291
|
+
/**
|
|
292
|
+
* True when `create`, `update`, `delete` and `updateGlobal` take `outbox`, a row written in
|
|
293
|
+
* the same transaction. Required by `outbox: true` in the config.
|
|
294
|
+
*/
|
|
295
|
+
readonly outbox?: boolean | undefined;
|
|
275
296
|
/** Writes a migration file for the difference between the config and the latest migration. `null` when nothing changed. */
|
|
276
297
|
createMigration(args: {
|
|
277
298
|
name: string;
|
|
@@ -1727,13 +1748,34 @@ interface FindOptions extends ReadOptions {
|
|
|
1727
1748
|
*/
|
|
1728
1749
|
readonly cursor?: string;
|
|
1729
1750
|
}
|
|
1751
|
+
interface SearchOptions extends DepthOptions {
|
|
1752
|
+
/** Searchable collections to look in. Default: every collection with `search`. */
|
|
1753
|
+
readonly collections?: readonly string[];
|
|
1754
|
+
/** Default 10, at most 100. */
|
|
1755
|
+
readonly limit?: number;
|
|
1756
|
+
/** 1-based. Default 1. */
|
|
1757
|
+
readonly page?: number;
|
|
1758
|
+
}
|
|
1759
|
+
/** What `cms.search()` finds: documents, best match first. */
|
|
1760
|
+
interface SearchResults {
|
|
1761
|
+
readonly hits: readonly {
|
|
1762
|
+
readonly collection: string;
|
|
1763
|
+
readonly doc: Record<string, unknown>;
|
|
1764
|
+
}[];
|
|
1765
|
+
/** Matches before access rules: a page can hold fewer than `limit`. */
|
|
1766
|
+
readonly total: number;
|
|
1767
|
+
readonly page: number;
|
|
1768
|
+
readonly limit: number;
|
|
1769
|
+
readonly hasNextPage: boolean;
|
|
1770
|
+
}
|
|
1730
1771
|
interface CreateEasyCMSOptions {
|
|
1731
1772
|
/** Project root. Default `process.cwd()`. */
|
|
1732
1773
|
readonly cwd?: string;
|
|
1733
1774
|
/**
|
|
1734
1775
|
* Run due scheduled jobs and webhook retries every minute in this process. Default: on when
|
|
1735
1776
|
* a collection or global has `schedule`, or `webhooks`, `email` or `jobs` is set. Turn it off
|
|
1736
|
-
* where a cron calls `runJobs` (or `GET <api>/jobs/run`) instead.
|
|
1777
|
+
* where a cron calls `runJobs` (or `GET <api>/jobs/run`) instead. Off, an in-memory `search`
|
|
1778
|
+
* index (`memorySearch()`) isn't built at start either: call `reindexSearch()`.
|
|
1737
1779
|
*/
|
|
1738
1780
|
readonly scheduler?: boolean;
|
|
1739
1781
|
/** Default `verify` when `NODE_ENV=production`, otherwise `push`. */
|
|
@@ -1778,6 +1820,10 @@ declare class EasyCMS<C extends Config = Config> {
|
|
|
1778
1820
|
private readonly versions;
|
|
1779
1821
|
private readonly webhooks;
|
|
1780
1822
|
private readonly mailer;
|
|
1823
|
+
/** With `outbox: true`: runs after hooks and events from rows saves write. */
|
|
1824
|
+
private readonly outbox;
|
|
1825
|
+
/** With `search`: keeps the index in step with published documents. */
|
|
1826
|
+
private readonly searchIndex;
|
|
1781
1827
|
/**
|
|
1782
1828
|
* The user and context of a request, as the REST API works them out: its session cookie or
|
|
1783
1829
|
* Bearer token, then `onRequest`. For framework routes and server code that act for a visitor;
|
|
@@ -2038,6 +2084,29 @@ declare class EasyCMS<C extends Config = Config> {
|
|
|
2038
2084
|
flushEmails(): Promise<void>;
|
|
2039
2085
|
/** Emails queued until sent, stored in `email-deliveries`. */
|
|
2040
2086
|
private emailQueue;
|
|
2087
|
+
/**
|
|
2088
|
+
* Waits until the outbox (`outbox: true`) ran what saves left so far, e.g. before a serverless
|
|
2089
|
+
* function returns. What fails stays queued for its retry.
|
|
2090
|
+
*/
|
|
2091
|
+
flushOutbox(): Promise<void>;
|
|
2092
|
+
/**
|
|
2093
|
+
* Searches the collections that have `search` with the config's `search` adapter: published
|
|
2094
|
+
* documents, best match first, read with the access options given (pass `overrideAccess: false`
|
|
2095
|
+
* and `user` to apply access rules). `total` counts matches before access rules, so a page can
|
|
2096
|
+
* hold fewer documents than `limit`.
|
|
2097
|
+
*/
|
|
2098
|
+
search(query: string, options?: SearchOptions): Promise<SearchResults>;
|
|
2099
|
+
/**
|
|
2100
|
+
* Builds the search index again from the database, for every searchable collection or one:
|
|
2101
|
+
* after adding `search` to a collection, changing its fields, or to repair the index
|
|
2102
|
+
* (`easy-cms search:reindex`).
|
|
2103
|
+
*/
|
|
2104
|
+
reindexSearch(collection?: string): Promise<{
|
|
2105
|
+
collection: string;
|
|
2106
|
+
documents: number;
|
|
2107
|
+
}[]>;
|
|
2108
|
+
/** Published documents of a collection in a locale, a page at a time, for the search index. */
|
|
2109
|
+
private publishedPages;
|
|
2041
2110
|
destroy(): Promise<void>;
|
|
2042
2111
|
private schedulerTimer;
|
|
2043
2112
|
private running;
|
|
@@ -2065,6 +2134,11 @@ declare class EasyCMS<C extends Config = Config> {
|
|
|
2065
2134
|
ran: number;
|
|
2066
2135
|
failed: number;
|
|
2067
2136
|
};
|
|
2137
|
+
/** Outbox entries (`outbox: true`) run, and those that failed (to be retried). */
|
|
2138
|
+
outbox: {
|
|
2139
|
+
ran: number;
|
|
2140
|
+
failed: number;
|
|
2141
|
+
};
|
|
2068
2142
|
}>;
|
|
2069
2143
|
private runJobsNow;
|
|
2070
2144
|
/**
|
|
@@ -2184,13 +2258,27 @@ declare class EasyCMS<C extends Config = Config> {
|
|
|
2184
2258
|
/** Replaces published documents that have a newer draft with that draft. */
|
|
2185
2259
|
private withDrafts;
|
|
2186
2260
|
/**
|
|
2187
|
-
* `httpCache.purge
|
|
2188
|
-
* published document saved, published, unpublished or deleted).
|
|
2189
|
-
|
|
2261
|
+
* The tags `httpCache.purge` gets for a change: what readers see changed (anything, without
|
|
2262
|
+
* drafts; with drafts, a published document saved, published, unpublished or deleted).
|
|
2263
|
+
*/
|
|
2264
|
+
private purgeTags;
|
|
2265
|
+
/** Whether a change may change what the search index holds: a save of the document itself. */
|
|
2266
|
+
private searches;
|
|
2267
|
+
private isGlobal;
|
|
2268
|
+
/** The webhook events of a change; `before` is the stored status before it, if any. */
|
|
2269
|
+
private changeEvents;
|
|
2270
|
+
/**
|
|
2271
|
+
* Sends webhook events for a change and purges the HTTP cache. Not awaited; purge failures
|
|
2272
|
+
* are logged.
|
|
2190
2273
|
*/
|
|
2191
|
-
private purgePublic;
|
|
2192
|
-
/** Sends webhook events for a change; `before` is the stored status before it, if any. */
|
|
2193
2274
|
private emitChange;
|
|
2275
|
+
/**
|
|
2276
|
+
* The outbox row of a save (`outbox: true`): written in its transaction, then run by the outbox
|
|
2277
|
+
* in place of its after hooks and events. `undefined` without the outbox, or with nothing to run.
|
|
2278
|
+
*/
|
|
2279
|
+
private outboxRow;
|
|
2280
|
+
/** Runs an outbox entry: what its save would have run right after it, without the outbox. */
|
|
2281
|
+
private runOutbox;
|
|
2194
2282
|
/**
|
|
2195
2283
|
* Writes the audit log entry for a change (`audit`): publishing, unpublishing and restoring
|
|
2196
2284
|
* are told apart from other saves.
|
|
@@ -2557,6 +2645,93 @@ interface FieldTypeDefinition {
|
|
|
2557
2645
|
/** Declares a field type; returns it unchanged. */
|
|
2558
2646
|
declare function defineFieldType(definition: FieldTypeDefinition): FieldTypeDefinition;
|
|
2559
2647
|
|
|
2648
|
+
/** One document in one locale, as a search engine indexes it: plain text per field. */
|
|
2649
|
+
interface SearchEntry {
|
|
2650
|
+
readonly collection: string;
|
|
2651
|
+
readonly id: string;
|
|
2652
|
+
/** `null` without `localization`. */
|
|
2653
|
+
readonly locale: string | null;
|
|
2654
|
+
/** The collection's `search.fields`, in their order (most important first), as plain text. */
|
|
2655
|
+
readonly text: Readonly<Record<string, string>>;
|
|
2656
|
+
}
|
|
2657
|
+
interface SearchQuery {
|
|
2658
|
+
/** What the person typed. */
|
|
2659
|
+
readonly query: string;
|
|
2660
|
+
/** Searchable collections to look in; never empty. */
|
|
2661
|
+
readonly collections: readonly string[];
|
|
2662
|
+
/** The locale to search; `null` without `localization`. */
|
|
2663
|
+
readonly locale: string | null;
|
|
2664
|
+
readonly limit: number;
|
|
2665
|
+
readonly offset: number;
|
|
2666
|
+
}
|
|
2667
|
+
interface SearchHits {
|
|
2668
|
+
/** Best match first. */
|
|
2669
|
+
readonly hits: readonly {
|
|
2670
|
+
readonly collection: string;
|
|
2671
|
+
readonly id: string;
|
|
2672
|
+
}[];
|
|
2673
|
+
/** Matches in all, for paging. */
|
|
2674
|
+
readonly total: number;
|
|
2675
|
+
}
|
|
2676
|
+
/** One setting a search adapter shows to admins (`describe()`). */
|
|
2677
|
+
interface SearchSetting {
|
|
2678
|
+
readonly key: string;
|
|
2679
|
+
/** `null`: not set. */
|
|
2680
|
+
readonly value: string | null;
|
|
2681
|
+
}
|
|
2682
|
+
/**
|
|
2683
|
+
* Indexes published documents for relevance-ranked full-text search (`search` in the config):
|
|
2684
|
+
* `memorySearch()`, or an adapter for a search engine. Easy CMS turns documents into plain text,
|
|
2685
|
+
* calls `index` and `remove` as they change, and reads the hits back with the user's access.
|
|
2686
|
+
*/
|
|
2687
|
+
interface SearchAdapter {
|
|
2688
|
+
/** E.g. `memory`; shown to admins on the dashboard (System). */
|
|
2689
|
+
readonly name?: string;
|
|
2690
|
+
/**
|
|
2691
|
+
* The adapter interface it is written for (`ADAPTER_API_VERSION`); Easy CMS refuses another.
|
|
2692
|
+
* Leave it out to skip the check.
|
|
2693
|
+
*/
|
|
2694
|
+
readonly apiVersion?: number;
|
|
2695
|
+
/**
|
|
2696
|
+
* The index starts empty in each process (it lives in memory): Easy CMS builds it when it
|
|
2697
|
+
* starts, and searches wait until it is built.
|
|
2698
|
+
*/
|
|
2699
|
+
readonly ephemeral?: boolean;
|
|
2700
|
+
/** Creates or updates the indexes for these collections; runs before a reindex. */
|
|
2701
|
+
setup?(collections: readonly {
|
|
2702
|
+
slug: string;
|
|
2703
|
+
fields: readonly string[];
|
|
2704
|
+
}[]): Promise<void>;
|
|
2705
|
+
/** Adds or replaces entries (same collection, id and locale). */
|
|
2706
|
+
index(entries: readonly SearchEntry[]): Promise<void>;
|
|
2707
|
+
/** Removes documents, in every locale. */
|
|
2708
|
+
remove(documents: readonly {
|
|
2709
|
+
collection: string;
|
|
2710
|
+
id: string;
|
|
2711
|
+
}[]): Promise<void>;
|
|
2712
|
+
/** Removes every document of a collection, before a reindex. */
|
|
2713
|
+
clear(collection: string): Promise<void>;
|
|
2714
|
+
search(query: SearchQuery): Promise<SearchHits>;
|
|
2715
|
+
/** The settings in use, for admins. Never return secrets. */
|
|
2716
|
+
describe?(): readonly SearchSetting[];
|
|
2717
|
+
}
|
|
2718
|
+
/** What `search` of a collection says: the fields to index, most important first. */
|
|
2719
|
+
interface CollectionSearch {
|
|
2720
|
+
/**
|
|
2721
|
+
* Field names, or paths through groups such as `seo.description`: text, textarea, email, slug,
|
|
2722
|
+
* select and rich text fields, or arrays, groups and blocks (all the text inside them).
|
|
2723
|
+
*/
|
|
2724
|
+
readonly fields: readonly string[];
|
|
2725
|
+
}
|
|
2726
|
+
/**
|
|
2727
|
+
* A search index in memory, for development, tests and small sites with one process: built when
|
|
2728
|
+
* the server starts, and lost when it stops. Words are split with `Intl.Segmenter`, so Thai text
|
|
2729
|
+
* is found by its words. Every word searched must be in the document, at the start of one of its
|
|
2730
|
+
* words or across words; documents whose first fields (`search.fields`) match, and match whole
|
|
2731
|
+
* words, rank first.
|
|
2732
|
+
*/
|
|
2733
|
+
declare function memorySearch(): SearchAdapter;
|
|
2734
|
+
|
|
2560
2735
|
declare const WEBHOOK_EVENTS: readonly ["create", "update", "delete", "publish", "unpublish", "draft"];
|
|
2561
2736
|
/**
|
|
2562
2737
|
* `create`, `update`, `delete`: the stored document changed. `publish` / `unpublish`: its status
|
|
@@ -2797,6 +2972,11 @@ interface CollectionConfig {
|
|
|
2797
2972
|
* Overrides the config's `httpCache` for this one; `false` keeps every read `no-store`.
|
|
2798
2973
|
*/
|
|
2799
2974
|
readonly httpCache?: false | HttpCacheTimes;
|
|
2975
|
+
/**
|
|
2976
|
+
* Relevance-ranked search of this collection's published documents with the config's `search`
|
|
2977
|
+
* adapter: `cms.search()` and `GET <api>/search`. The fields to index, most important first.
|
|
2978
|
+
*/
|
|
2979
|
+
readonly search?: CollectionSearch;
|
|
2800
2980
|
/** Live preview: the page that shows a document, e.g. `({ doc }) => \`/posts/${doc.slug}\``. */
|
|
2801
2981
|
readonly preview?: PreviewURL;
|
|
2802
2982
|
readonly access?: CollectionAccess;
|
|
@@ -3420,6 +3600,22 @@ interface Config {
|
|
|
3420
3600
|
* requests get `400`, pointing to `cursor`. Deep pages are read row by row. Default: no limit.
|
|
3421
3601
|
*/
|
|
3422
3602
|
readonly maxPage?: number;
|
|
3603
|
+
/**
|
|
3604
|
+
* Runs `afterChange` and `afterDelete` hooks, webhooks and `httpCache.purge` from an outbox:
|
|
3605
|
+
* saving a document also queues them, in the same database transaction, and a worker runs them
|
|
3606
|
+
* after it commits, retrying what fails. A save that succeeds always gets its side effects (at
|
|
3607
|
+
* least once; hooks must be safe to run again), and the response doesn't wait for them. Hooks
|
|
3608
|
+
* then get the user who saved but no `context`. Needs a migration for the `outbox` table.
|
|
3609
|
+
* Default `false`: hooks run in the request, after the save.
|
|
3610
|
+
*/
|
|
3611
|
+
readonly outbox?: boolean;
|
|
3612
|
+
/**
|
|
3613
|
+
* Relevance-ranked search of the collections that have `search`, e.g. `memorySearch()` for
|
|
3614
|
+
* development and small sites, or an adapter for a search engine. Published documents are
|
|
3615
|
+
* indexed as they change; `easy-cms search:reindex` builds the index again. Without it, `like`
|
|
3616
|
+
* (with `index: 'trigram'` on Postgres) still finds text.
|
|
3617
|
+
*/
|
|
3618
|
+
readonly search?: SearchAdapter;
|
|
3423
3619
|
readonly plugins?: readonly Plugin[];
|
|
3424
3620
|
}
|
|
3425
3621
|
/** The config after plugins ran, validation passed and defaults were applied. */
|
|
@@ -3451,5 +3647,5 @@ interface ResolvedConfig extends Omit<Config, 'cors' | 'localization' | 'routes'
|
|
|
3451
3647
|
*/
|
|
3452
3648
|
declare function defineConfig<const TConfig extends Config>(config: TConfig): TConfig;
|
|
3453
3649
|
|
|
3454
|
-
export { ADAPTER_API_VERSION as A, AuditLog as J, Auth as M, ADMIN_ICONS as a,
|
|
3455
|
-
export type { BuiltinMediaCollection as $, ApiKeyOperation as B, ApiKeyPermissions as C, ArrayField as D, EmailSetting as E, AuditChange as F, AuditConfig as G, AuditEntry as H, ID as I, AuditPage as K, AuditVerification as L, AuthConfig as N, AuthProvider as O, PaginatedDocs as P, AuthProviderProfile as Q, AuthProviderRequest as R, AuthUser as S, BackupsConfig as T, BeforeChangeHook as U, BeforeDeleteHook as V, BeforeValidateHook as W, Block as X, BlocksField as Y, BooleanField as Z, BuiltinApiKeysCollection as _,
|
|
3650
|
+
export { ADAPTER_API_VERSION as A, AuditLog as J, Auth as M, ADMIN_ICONS as a, ForbiddenError as a$, FIELD_TYPES as aE, ConfigError as ad, EasyCMS as aw, EasyCMSError as ax, PayloadTooLargeError as bE, QueryError as bK, ROLE_OPERATIONS as bL, Roles as bW, SchemaError as bZ, NotFoundError as bt, PLUGIN_API_VERSION as bz, API_KEY_OPERATIONS as c$, anyone as cF, consoleEmail as cG, consoleLogger as cH, createEasyCMS as cI, defineConfig as cJ, defineFieldType as cK, definePlugin as cL, diskStorage as cM, hasRows as cN, isAdmin as cO, isHasMany as cP, isSignedIn as cQ, isStaff as cR, isSystemAdmin as cS, jsonLogger as cT, memorySearch as cU, mimeAllowedBy as cV, rowFields as cW, silentLogger as cX, uniqueWithinOf as cY, API_KEYS as cZ, API_KEY_GLOBAL_OPERATIONS as c_, SingleSignOn as cc, TooManyRequestsError as cl, UnauthorizedError as cn, ValidationError as cv, WEBHOOK_EVENTS as cz, DEFAULT_MAX_VERSIONS as d0, DEFAULT_PASSWORD_EMAILS as d1, FIELD_TYPE_BASES as d2, FOLDER_LEVELS as d3, MediaFolders as d4, SSO_COOKIE as d5, codeOfStatus as d6, isJsonLogger as d7, keyAllows as d8, logFormat as d9 };
|
|
3651
|
+
export type { BuiltinMediaCollection as $, ApiKeyOperation as B, ApiKeyPermissions as C, ArrayField as D, EmailSetting as E, AuditChange as F, AuditConfig as G, AuditEntry as H, ID as I, AuditPage as K, AuditVerification as L, AuthConfig as N, AuthProvider as O, PaginatedDocs as P, AuthProviderProfile as Q, AuthProviderRequest as R, AuthUser as S, BackupsConfig as T, BeforeChangeHook as U, BeforeDeleteHook as V, BeforeValidateHook as W, Block as X, BlocksField as Y, BooleanField as Z, BuiltinApiKeysCollection as _, BuiltinMediaFoldersCollection as a0, BuiltinUsersCollection as a1, BundleHints as a2, CliCommand as a3, CollectionAccess as a4, CollectionAdmin as a5, CollectionConfig as a6, CollectionDocument as a7, CollectionHooks as a8, CollectionListAdmin as a9, EmailMessage as aA, Endpoint as aB, EndpointRequest as aC, ErrorCode as aD, Field as aF, FieldAccess as aG, FieldAccessFn as aH, FieldAdmin as aI, FieldError as aJ, FieldRule as aK, FieldType as aL, FieldTypeBase as aM, FieldTypeDefinition as aN, FieldTypeValidateContext as aO, FieldValidate as aP, FieldValidateContext as aQ, FieldValue as aR, FieldsInput as aS, FieldsValue as aT, FilterOptions as aU, FilterOptionsArgs as aV, FindAfterArgs as aW, FindArgs as aX, FindOptions as aY, FolderLevel as aZ, FolderPermissions as a_, CollectionSearch as aa, CollectionSlug as ab, Config as ac, ConfigIssue as ae, ContainerAdmin as af, CreateEasyCMSOptions as ag, CreateInput as ah, CreateMigrationResult as ai, CursorDocs as aj, CustomField as ak, CustomFieldTypes as al, DashboardWidget as am, Database as an, DatabaseAdapter as ao, DatabaseInitArgs as ap, DatabaseTransfer as aq, DateField as ar, DepthOptions as as, DirectUpload as at, DiskStorageOptions as au, DocumentOf as av, EmailAdapter as ay, EmailField as az, Access as b, SearchAdapter as b$, GlobalAccess as b0, GlobalConfig as b1, GlobalDocument as b2, GlobalHooks as b3, GlobalInput as b4, GlobalSlug as b5, GroupField as b6, ImageSize as b7, IncrementOptions as b8, InferCollection as b9, PasswordEmail as bA, PasswordEmailArgs as bB, PasswordEmailFn as bC, PasswordLinkOptions as bD, Plugin as bF, PluginInfo as bG, PluginTypes as bH, PreviewTarget as bI, PreviewURL as bJ, RawDocument as bM, ReadOptions as bN, RelationshipField as bO, RequestContext as bP, ResolvedConfig as bQ, RichTextDocument as bR, RichTextField as bS, Role as bT, RoleOperation as bU, RolePermissions as bV, RoutesConfig as bX, ScheduledPublish as bY, SchemaMode as b_, InferGlobal as ba, JobConfig as bb, JsonField as bc, KeysetPage as bd, Label as be, LayoutNode as bf, LivePreview as bg, LocaleOf as bh, LocalizationConfig as bi, LogDetails as bj, Logger as bk, LoginArgs as bl, LogsConfig as bm, MediaDocument as bn, MediaSize as bo, MembersConfig as bp, MembersSignup as bq, MigrationInfo as br, NavGroup as bs, NumberField as bu, OnRequest as bv, OnRequestArgs as bw, Operation as bx, OutboxRow as by, AccessArgs as c, SearchEntry as c0, SearchHits as c1, SearchOptions as c2, SearchQuery as c3, SearchResults as c4, SearchSetting as c5, SelectField as c6, SelectOption as c7, Session as c8, SidebarPanel as c9, WebhookConfig as cA, WebhookEvent as cB, WebhookPayload as cC, Where as cD, WhereOperators as cE, SignupArgs as ca, SignupResult as cb, SlugField as cd, SlugOf as ce, SsoOutcome as cf, SsoProviderRef as cg, StorageAdapter as ch, StoredFile as ci, TextField as cj, TextareaField as ck, TypedPlugin as cm, UncountedDocs as co, UpdateInput as cp, UpdateOptions as cq, UploadConfig as cr, UploadField as cs, UploadFromURLConfig as ct, UserIdentity as cu, Version as cw, VersionSummary as cx, VersionsConfig as cy, AccessOptions as d, AdminBrand as e, AdminCommand as f, AdminComponent as g, AdminConfig as h, AdminFieldArgs as i, AdminIcon as j, AdminLocale as k, AdminPage as l, AdminRole as m, AdminRoleChange as n, AdminRoleField as o, AdminRoleTarget as p, AdminRoleView as q, AdminRoles as r, AdminSso as s, AdminSwitcher as t, AdminViewAccess as u, AfterChangeHook as v, AfterDeleteHook as w, AfterReadHook as x, ApiKeyContext as y, ApiKeyGlobalOperation as z };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as ID,
|
|
1
|
+
import { I as ID, ac as Config, aw as EasyCMS, bi as LocalizationConfig, aF as Field, aJ as FieldError, aU as FilterOptions, ag as CreateEasyCMSOptions, bQ as ResolvedConfig } from './config-B-bT0hIn.js';
|
|
2
2
|
|
|
3
3
|
/** Decrypts a file from `encryptBackup`; throws for another key or a changed file. */
|
|
4
4
|
declare function decryptBackup(data: Uint8Array, encryptionKey: string): Uint8Array;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { P as PaginatedDocs, I as ID, E as EmailSetting } from './config-
|
|
2
|
-
export { A as ADAPTER_API_VERSION, a as ADMIN_ICONS, b as Access, c as AccessArgs, d as AccessOptions, e as AdminBrand, f as AdminCommand, g as AdminComponent, h as AdminConfig, i as AdminFieldArgs, j as AdminIcon, k as AdminLocale, l as AdminPage, m as AdminRole, n as AdminRoleChange, o as AdminRoleField, p as AdminRoleTarget, q as AdminRoleView, r as AdminRoles, s as AdminSso, t as AdminSwitcher, u as AdminViewAccess, v as AfterChangeHook, w as AfterDeleteHook, x as AfterReadHook, y as ApiKeyContext, z as ApiKeyGlobalOperation, B as ApiKeyOperation, C as ApiKeyPermissions, D as ArrayField, F as AuditChange, G as AuditConfig, H as AuditEntry, J as AuditLog, K as AuditPage, L as AuditVerification, M as Auth, N as AuthConfig, O as AuthProvider, Q as AuthProviderProfile, R as AuthProviderRequest, S as AuthUser, T as BackupsConfig, U as BeforeChangeHook, V as BeforeDeleteHook, W as BeforeValidateHook, X as Block, Y as BlocksField, Z as BooleanField, _ as BuiltinApiKeysCollection, $ as BuiltinMediaCollection, a0 as BuiltinMediaFoldersCollection, a1 as BuiltinUsersCollection, a2 as BundleHints, a3 as CliCommand, a4 as CollectionAccess, a5 as CollectionAdmin, a6 as CollectionConfig, a7 as CollectionDocument, a8 as CollectionHooks, a9 as CollectionListAdmin, aa as
|
|
3
|
-
export { A as ADMIN_API_VERSION, a as AdminCollection, b as AdminComponentRef, c as AdminElementProps, d as AdminField, e as AdminGlobal, f as AdminLayoutNode, g as AdminNavGroup, h as AdminNavItem, i as AdminNavNode, j as AdminPageRef, k as AdminPageRoute, l as AdminSchema, m as AdminWidgetRef, S as SetFieldDetail, w as warnDeprecated } from './plugin-
|
|
4
|
-
export { A as AdminBackup, a as AdminBackups, b as ApiHandlerOptions, B as BackupState, L as LoadConfigOptions, R as RestHandler, c as RestHandlerOptions, d as createApiHandler, e as createRestHandler, l as loadConfig, r as resolveConfig, s as sharedEasyCMS, f as slugify } from './handler-
|
|
1
|
+
import { P as PaginatedDocs, I as ID, E as EmailSetting } from './config-B-bT0hIn.js';
|
|
2
|
+
export { A as ADAPTER_API_VERSION, a as ADMIN_ICONS, b as Access, c as AccessArgs, d as AccessOptions, e as AdminBrand, f as AdminCommand, g as AdminComponent, h as AdminConfig, i as AdminFieldArgs, j as AdminIcon, k as AdminLocale, l as AdminPage, m as AdminRole, n as AdminRoleChange, o as AdminRoleField, p as AdminRoleTarget, q as AdminRoleView, r as AdminRoles, s as AdminSso, t as AdminSwitcher, u as AdminViewAccess, v as AfterChangeHook, w as AfterDeleteHook, x as AfterReadHook, y as ApiKeyContext, z as ApiKeyGlobalOperation, B as ApiKeyOperation, C as ApiKeyPermissions, D as ArrayField, F as AuditChange, G as AuditConfig, H as AuditEntry, J as AuditLog, K as AuditPage, L as AuditVerification, M as Auth, N as AuthConfig, O as AuthProvider, Q as AuthProviderProfile, R as AuthProviderRequest, S as AuthUser, T as BackupsConfig, U as BeforeChangeHook, V as BeforeDeleteHook, W as BeforeValidateHook, X as Block, Y as BlocksField, Z as BooleanField, _ as BuiltinApiKeysCollection, $ as BuiltinMediaCollection, a0 as BuiltinMediaFoldersCollection, a1 as BuiltinUsersCollection, a2 as BundleHints, a3 as CliCommand, a4 as CollectionAccess, a5 as CollectionAdmin, a6 as CollectionConfig, a7 as CollectionDocument, a8 as CollectionHooks, a9 as CollectionListAdmin, aa as CollectionSearch, ab as CollectionSlug, ac as Config, ad as ConfigError, ae as ConfigIssue, af as ContainerAdmin, ag as CreateEasyCMSOptions, ah as CreateInput, ai as CreateMigrationResult, aj as CursorDocs, ak as CustomField, al as CustomFieldTypes, am as DashboardWidget, an as Database, ao as DatabaseAdapter, ap as DatabaseInitArgs, aq as DatabaseTransfer, ar as DateField, as as DepthOptions, at as DirectUpload, au as DiskStorageOptions, av as DocumentOf, aw as EasyCMS, ax as EasyCMSError, ay as EmailAdapter, az as EmailField, aA as EmailMessage, aB as Endpoint, aC as EndpointRequest, aD as ErrorCode, aE as FIELD_TYPES, aF as Field, aG as FieldAccess, aH as FieldAccessFn, aI as FieldAdmin, aJ as FieldError, aK as FieldRule, aL as FieldType, aM as FieldTypeBase, aN as FieldTypeDefinition, aO as FieldTypeValidateContext, aP as FieldValidate, aQ as FieldValidateContext, aR as FieldValue, aS as FieldsInput, aT as FieldsValue, aU as FilterOptions, aV as FilterOptionsArgs, aW as FindAfterArgs, aX as FindArgs, aY as FindOptions, aZ as FolderLevel, a_ as FolderPermissions, a$ as ForbiddenError, b0 as GlobalAccess, b1 as GlobalConfig, b2 as GlobalDocument, b3 as GlobalHooks, b4 as GlobalInput, b5 as GlobalSlug, b6 as GroupField, b7 as ImageSize, b8 as IncrementOptions, b9 as InferCollection, ba as InferGlobal, bb as JobConfig, bc as JsonField, bd as KeysetPage, be as Label, bf as LayoutNode, bg as LivePreview, bh as LocaleOf, bi as LocalizationConfig, bj as LogDetails, bk as Logger, bl as LoginArgs, bm as LogsConfig, bn as MediaDocument, bo as MediaSize, bp as MembersConfig, bq as MembersSignup, br as MigrationInfo, bs as NavGroup, bt as NotFoundError, bu as NumberField, bv as OnRequest, bw as OnRequestArgs, bx as Operation, by as OutboxRow, bz as PLUGIN_API_VERSION, bA as PasswordEmail, bB as PasswordEmailArgs, bC as PasswordEmailFn, bD as PasswordLinkOptions, bE as PayloadTooLargeError, bF as Plugin, bG as PluginInfo, bH as PluginTypes, bI as PreviewTarget, bJ as PreviewURL, bK as QueryError, bL as ROLE_OPERATIONS, bM as RawDocument, bN as ReadOptions, bO as RelationshipField, bP as RequestContext, bQ as ResolvedConfig, bR as RichTextDocument, bS as RichTextField, bT as Role, bU as RoleOperation, bV as RolePermissions, bW as Roles, bX as RoutesConfig, bY as ScheduledPublish, bZ as SchemaError, b_ as SchemaMode, b$ as SearchAdapter, c0 as SearchEntry, c1 as SearchHits, c2 as SearchOptions, c3 as SearchQuery, c4 as SearchResults, c5 as SearchSetting, c6 as SelectField, c7 as SelectOption, c8 as Session, c9 as SidebarPanel, ca as SignupArgs, cb as SignupResult, cc as SingleSignOn, cd as SlugField, ce as SlugOf, cf as SsoOutcome, cg as SsoProviderRef, ch as StorageAdapter, ci as StoredFile, cj as TextField, ck as TextareaField, cl as TooManyRequestsError, cm as TypedPlugin, cn as UnauthorizedError, co as UncountedDocs, cp as UpdateInput, cq as UpdateOptions, cr as UploadConfig, cs as UploadField, ct as UploadFromURLConfig, cu as UserIdentity, cv as ValidationError, cw as Version, cx as VersionSummary, cy as VersionsConfig, cz as WEBHOOK_EVENTS, cA as WebhookConfig, cB as WebhookEvent, cC as WebhookPayload, cD as Where, cE as WhereOperators, cF as anyone, cG as consoleEmail, cH as consoleLogger, cI as createEasyCMS, cJ as defineConfig, cK as defineFieldType, cL as definePlugin, cM as diskStorage, cN as hasRows, cO as isAdmin, cP as isHasMany, cQ as isSignedIn, cR as isStaff, cS as isSystemAdmin, cT as jsonLogger, cU as memorySearch, cV as mimeAllowedBy, cW as rowFields, cX as silentLogger, cY as uniqueWithinOf } from './config-B-bT0hIn.js';
|
|
3
|
+
export { A as ADMIN_API_VERSION, a as AdminCollection, b as AdminComponentRef, c as AdminElementProps, d as AdminField, e as AdminGlobal, f as AdminLayoutNode, g as AdminNavGroup, h as AdminNavItem, i as AdminNavNode, j as AdminPageRef, k as AdminPageRoute, l as AdminSchema, m as AdminWidgetRef, S as SetFieldDetail, w as warnDeprecated } from './plugin-CI6r3SK1.js';
|
|
4
|
+
export { A as AdminBackup, a as AdminBackups, b as ApiHandlerOptions, B as BackupState, L as LoadConfigOptions, R as RestHandler, c as RestHandlerOptions, d as createApiHandler, e as createRestHandler, l as loadConfig, r as resolveConfig, s as sharedEasyCMS, f as slugify } from './handler-COsNEVx0.js';
|
|
5
5
|
export { FieldCondition, matchesCondition } from './conditions.js';
|
|
6
6
|
|
|
7
7
|
type DeliveryKind = 'webhook' | 'email';
|
|
@@ -112,9 +112,30 @@ interface AdminScheduledJob {
|
|
|
112
112
|
global?: string;
|
|
113
113
|
doc: ID;
|
|
114
114
|
}
|
|
115
|
+
/** An outbox entry (`outbox: true`) that failed: being retried, or given up on. */
|
|
116
|
+
interface AdminOutboxEntry {
|
|
117
|
+
id: ID;
|
|
118
|
+
event: 'create' | 'update' | 'draft' | 'delete';
|
|
119
|
+
/** The document's collection, or the global (`global`), and the document's id. */
|
|
120
|
+
collection?: string;
|
|
121
|
+
global?: string;
|
|
122
|
+
doc: string | null;
|
|
123
|
+
attempts: number;
|
|
124
|
+
/** `pending`: retried at `nextAttemptAt`; `failed`: given up, until someone retries it. */
|
|
125
|
+
state: 'pending' | 'running' | 'failed';
|
|
126
|
+
error: string | null;
|
|
127
|
+
nextAttemptAt: string;
|
|
128
|
+
}
|
|
129
|
+
interface AdminOutbox {
|
|
130
|
+
/** Entries waiting to run (new, or to be retried). */
|
|
131
|
+
waiting: number;
|
|
132
|
+
failed: number;
|
|
133
|
+
/** Entries that failed at least once, latest first (at most 100). */
|
|
134
|
+
entries: AdminOutboxEntry[];
|
|
135
|
+
}
|
|
115
136
|
/** What Settings → Jobs shows (`GET <api>/admin/jobs`). */
|
|
116
137
|
/** Work Easy CMS itself does with every run of the jobs, when it is set up. */
|
|
117
|
-
type BuiltInJob = 'scheduled' | 'webhooks' | 'emails' | 'backups' | 'audit';
|
|
138
|
+
type BuiltInJob = 'scheduled' | 'webhooks' | 'emails' | 'outbox' | 'backups' | 'audit';
|
|
118
139
|
interface AdminJobs {
|
|
119
140
|
jobs: AdminJob[];
|
|
120
141
|
/** When jobs last ran (the scheduler, the cron endpoint), `null` if never. */
|
|
@@ -127,6 +148,8 @@ interface AdminJobs {
|
|
|
127
148
|
canChange: boolean;
|
|
128
149
|
/** `null` when nothing uses `schedule`. */
|
|
129
150
|
scheduled: AdminScheduledJob[] | null;
|
|
151
|
+
/** `null` without `outbox: true`. */
|
|
152
|
+
outbox: AdminOutbox | null;
|
|
130
153
|
}
|
|
131
154
|
|
|
132
155
|
interface SearchHit {
|
|
@@ -207,6 +230,8 @@ interface AdminStatus {
|
|
|
207
230
|
storage: string;
|
|
208
231
|
/** The email adapter's name, `custom` when it has none, or `null` without email. */
|
|
209
232
|
email: string | null;
|
|
233
|
+
/** The search adapter's name, `custom` when it has none, or `null` without `search`. */
|
|
234
|
+
search: string | null;
|
|
210
235
|
/** The config's plugins, with their name and version when they give them. */
|
|
211
236
|
plugins: {
|
|
212
237
|
name?: string;
|
|
@@ -233,4 +258,4 @@ declare const cacheTags: {
|
|
|
233
258
|
declare const VERSION: string;
|
|
234
259
|
|
|
235
260
|
export { EmailSetting, ID, PaginatedDocs, VERSION, cacheTags };
|
|
236
|
-
export type { AdminAttention, AdminDeliveries, AdminDelivery, AdminEmail, AdminEmailDelivery, AdminJob, AdminJobs, AdminScheduledJob, AdminStatus, AdminWebhookDelivery, BuiltInJob, DeliveryKind, DeliveryState, EmailCheck, SearchHit };
|
|
261
|
+
export type { AdminAttention, AdminDeliveries, AdminDelivery, AdminEmail, AdminEmailDelivery, AdminJob, AdminJobs, AdminOutbox, AdminOutboxEntry, AdminScheduledJob, AdminStatus, AdminWebhookDelivery, BuiltInJob, DeliveryKind, DeliveryState, EmailCheck, SearchHit };
|
package/dist/index.js
CHANGED
|
@@ -21,11 +21,12 @@ import {
|
|
|
21
21
|
isSystemAdmin,
|
|
22
22
|
jsonLogger,
|
|
23
23
|
loadConfig,
|
|
24
|
+
memorySearch,
|
|
24
25
|
resolveConfig,
|
|
25
26
|
sharedEasyCMS,
|
|
26
27
|
silentLogger,
|
|
27
28
|
slugify
|
|
28
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-MHXQUX74.js";
|
|
29
30
|
import {
|
|
30
31
|
matchesCondition
|
|
31
32
|
} from "./chunk-U266LV4M.js";
|
|
@@ -92,6 +93,7 @@ export {
|
|
|
92
93
|
jsonLogger,
|
|
93
94
|
loadConfig,
|
|
94
95
|
matchesCondition,
|
|
96
|
+
memorySearch,
|
|
95
97
|
resolveConfig,
|
|
96
98
|
sharedEasyCMS,
|
|
97
99
|
silentLogger,
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Config, Database, EasyCMS, NavGroup, CollectionConfig, ID, RawDocument, Field, ResolvedConfig, ConfigIssue } from './index.js';
|
|
2
|
-
export {
|
|
3
|
-
export { C as CONFIG_FILE_NAMES, g as CSRF_COOKIE, h as CSRF_HEADER, D as DEFAULT_ADMIN_PATH, i as DEFAULT_API_PATH, j as DEFAULT_MAX_FILE_SIZE, k as DEFAULT_TOKEN_EXPIRATION, m as applyDefaults, n as applyPlugins, o as createRootEndpointHandler, p as decryptBackup, q as fillMissing, t as findConfigFile, u as forwardedClientIp, v as generateSlugs, w as importConfig, x as mergeForUpdate, y as parseId, z as platformClientIp, E as readCookie, F as validateFields, G as writeBackupFile } from './handler-
|
|
2
|
+
export { cZ as API_KEYS, c_ as API_KEY_GLOBAL_OPERATIONS, c$ as API_KEY_OPERATIONS, d0 as DEFAULT_MAX_VERSIONS, d1 as DEFAULT_PASSWORD_EMAILS, d2 as FIELD_TYPE_BASES, d3 as FOLDER_LEVELS, d4 as MediaFolders, d5 as SSO_COOKIE, d6 as codeOfStatus, cN as hasRows, cP as isHasMany, d7 as isJsonLogger, d8 as keyAllows, d9 as logFormat, cV as mimeAllowedBy, cW as rowFields, cY as uniqueWithinOf } from './config-B-bT0hIn.js';
|
|
3
|
+
export { C as CONFIG_FILE_NAMES, g as CSRF_COOKIE, h as CSRF_HEADER, D as DEFAULT_ADMIN_PATH, i as DEFAULT_API_PATH, j as DEFAULT_MAX_FILE_SIZE, k as DEFAULT_TOKEN_EXPIRATION, m as applyDefaults, n as applyPlugins, o as createRootEndpointHandler, p as decryptBackup, q as fillMissing, t as findConfigFile, u as forwardedClientIp, v as generateSlugs, w as importConfig, x as mergeForUpdate, y as parseId, z as platformClientIp, E as readCookie, F as validateFields, G as writeBackupFile } from './handler-COsNEVx0.js';
|
|
4
4
|
export { conditionIssues } from './conditions.js';
|
|
5
5
|
|
|
6
6
|
/** The session cookie the REST API sets at login. */
|
package/dist/internal.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { be as Label, aF as Field, I as ID, k as AdminLocale, t as AdminSwitcher, cg as SsoProviderRef } from './config-B-bT0hIn.js';
|
|
2
2
|
import { FieldCondition } from './conditions.js';
|
|
3
3
|
|
|
4
4
|
/** A Web Component from an admin module, with its `props` (plain JSON). */
|
package/dist/plugin.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { a as ADMIN_ICONS, g as AdminComponent, j as AdminIcon, S as AuthUser, a3 as CliCommand, a4 as CollectionAccess, a6 as CollectionConfig,
|
|
2
|
-
export { A as ADMIN_API_VERSION, c as AdminElementProps, k as AdminPageRoute, S as SetFieldDetail, w as warnDeprecated } from './plugin-
|
|
1
|
+
export { a as ADMIN_ICONS, g as AdminComponent, j as AdminIcon, S as AuthUser, a3 as CliCommand, a4 as CollectionAccess, a6 as CollectionConfig, ac as Config, ad as ConfigError, am as DashboardWidget, ax as EasyCMSError, aB as Endpoint, aC as EndpointRequest, aD as ErrorCode, aF as Field, aG as FieldAccess, aJ as FieldError, aM as FieldTypeBase, aN as FieldTypeDefinition, aO as FieldTypeValidateContext, a$ as ForbiddenError, b1 as GlobalConfig, I as ID, bb as JobConfig, be as Label, bs as NavGroup, bt as NotFoundError, bv as OnRequest, bw as OnRequestArgs, bz as PLUGIN_API_VERSION, bE as PayloadTooLargeError, bF as Plugin, bG as PluginInfo, bH as PluginTypes, bK as QueryError, bP as RequestContext, cl as TooManyRequestsError, cm as TypedPlugin, cn as UnauthorizedError, cv as ValidationError, cD as Where, cK as defineFieldType, cL as definePlugin } from './config-B-bT0hIn.js';
|
|
2
|
+
export { A as ADMIN_API_VERSION, c as AdminElementProps, k as AdminPageRoute, S as SetFieldDetail, w as warnDeprecated } from './plugin-CI6r3SK1.js';
|
|
3
3
|
import './conditions.js';
|