@easy-cms/core 1.7.1 → 1.9.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-ERXCJ3V6.js → chunk-HAHGAHFD.js} +82 -8
- package/dist/conditions.d.ts +2 -1
- package/dist/{config-CzW6kBeb.d.ts → config-BZgVbC3f.d.ts} +73 -1
- package/dist/{handler-BsBQ-2qf.d.ts → handler-j6s6J723.d.ts} +3 -2
- package/dist/index.d.ts +6 -5
- package/dist/index.js +1 -1
- package/dist/internal.d.ts +5 -4
- package/dist/internal.js +1 -1
- package/dist/live-preview.d.ts +2 -1
- package/dist/{plugin-BmKxHxuu.d.ts → plugin-DlSta1rd.d.ts} +3 -2
- package/dist/plugin.d.ts +2 -2
- package/package.json +1 -1
|
@@ -3874,7 +3874,7 @@ var VersionStore = class {
|
|
|
3874
3874
|
};
|
|
3875
3875
|
|
|
3876
3876
|
// src/local-api.ts
|
|
3877
|
-
import { createHmac as createHmac6, randomBytes as randomBytes6, randomUUID as randomUUID3, timingSafeEqual as timingSafeEqual5 } from "crypto";
|
|
3877
|
+
import { createHash as createHash4, createHmac as createHmac6, randomBytes as randomBytes6, randomUUID as randomUUID3, timingSafeEqual as timingSafeEqual5 } from "crypto";
|
|
3878
3878
|
|
|
3879
3879
|
// src/auth/common-passwords.ts
|
|
3880
3880
|
var LIST = `
|
|
@@ -4426,7 +4426,7 @@ function read(response, maxBytes, deadline) {
|
|
|
4426
4426
|
var keys = (list) => new Set(list.split(/\s+/).filter(Boolean));
|
|
4427
4427
|
var CONFIG = keys(`secret db serverURL cors cronSecret timeZone webhooks events jobs localization routes admin
|
|
4428
4428
|
upload auth collections globals endpoints cliCommands onRequest fieldTypes apiKeys email backups
|
|
4429
|
-
audit logs plugins`);
|
|
4429
|
+
audit logs countCacheSeconds maxPage plugins`);
|
|
4430
4430
|
var ADMIN = keys("path locale brand siteURL nav commands modules pages dashboard switcher");
|
|
4431
4431
|
var AUTH = keys(`roles rbac tokenExpiration maxLoginAttempts lockWindow trustedOrigins
|
|
4432
4432
|
resetPasswordExpiration inviteExpiration providers providerSignUp password setupCode members emails`);
|
|
@@ -4888,6 +4888,8 @@ function validateConfig(config) {
|
|
|
4888
4888
|
validateBackups(config, add, (issue) => issues.push(issue));
|
|
4889
4889
|
validateAudit(config, add);
|
|
4890
4890
|
validateLogs(config, add);
|
|
4891
|
+
validateCountCache(config, add);
|
|
4892
|
+
validateMaxPage(config, add);
|
|
4891
4893
|
validateAuth(config, add);
|
|
4892
4894
|
validateCors(config.cors, add);
|
|
4893
4895
|
validateLocalization(config, add);
|
|
@@ -5510,6 +5512,16 @@ function validateUpload(config, add) {
|
|
|
5510
5512
|
var FOLDER_KEY = /^[a-z0-9][a-z0-9_-]{0,59}$/;
|
|
5511
5513
|
var MIME_PATTERN = /^([\w.+-]+\/(\*|[\w.+-]+)|documents|office|archives)$/i;
|
|
5512
5514
|
var HOST_PATTERN = /^(\*|(\*\.)?[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*)$/i;
|
|
5515
|
+
function validateMaxPage(config, add) {
|
|
5516
|
+
const max = config.maxPage;
|
|
5517
|
+
if (max !== void 0 && !(Number.isInteger(max) && max >= 1))
|
|
5518
|
+
add("maxPage", "must be a whole number, 1 or more");
|
|
5519
|
+
}
|
|
5520
|
+
function validateCountCache(config, add) {
|
|
5521
|
+
const seconds = config.countCacheSeconds;
|
|
5522
|
+
if (seconds !== void 0 && !(typeof seconds === "number" && Number.isFinite(seconds) && seconds >= 0))
|
|
5523
|
+
add("countCacheSeconds", "must be a number of seconds, 0 or more");
|
|
5524
|
+
}
|
|
5513
5525
|
function validateLogs(config, add) {
|
|
5514
5526
|
const logs = config.logs;
|
|
5515
5527
|
if (logs === void 0) return;
|
|
@@ -6534,7 +6546,29 @@ var EasyCMS = class {
|
|
|
6534
6546
|
locale === ALL_LOCALES ? this.config.localization?.defaultLocale ?? locale : locale,
|
|
6535
6547
|
this.config.localization?.locales ?? []
|
|
6536
6548
|
);
|
|
6537
|
-
|
|
6549
|
+
if (options.cursor !== void 0) {
|
|
6550
|
+
if (options.page !== void 0) throw new QueryError("Use either cursor or page, not both");
|
|
6551
|
+
if (limit === 0) throw new QueryError("A cursor needs a limit above 0");
|
|
6552
|
+
if (!this.db.findAfter) throw new QueryError("This database adapter has no cursor pagination");
|
|
6553
|
+
const query = cursorQuery(collection2, options.where, requested, locale, draft);
|
|
6554
|
+
const after = readCursor(options.cursor, query);
|
|
6555
|
+
const result2 = await this.db.findAfter({ collection: collection2, where, sort, limit, after });
|
|
6556
|
+
const found2 = draft ? await this.withDrafts(config, result2.docs) : result2.docs;
|
|
6557
|
+
const docs2 = await this.output(config, found2, guard, { ...options, draft });
|
|
6558
|
+
return {
|
|
6559
|
+
docs: docs2,
|
|
6560
|
+
limit,
|
|
6561
|
+
nextCursor: result2.hasNextPage && result2.next ? writeCursor(result2.next, query) : null,
|
|
6562
|
+
hasNextPage: result2.hasNextPage,
|
|
6563
|
+
hasPrevPage: after !== null,
|
|
6564
|
+
totalDocs: null,
|
|
6565
|
+
totalPages: null,
|
|
6566
|
+
page: null
|
|
6567
|
+
};
|
|
6568
|
+
}
|
|
6569
|
+
const args = { collection: collection2, where, sort, limit, page };
|
|
6570
|
+
const count = options.count !== false || limit === 0;
|
|
6571
|
+
const result = count ? await this.db.find(args) : this.db.findPage ? await this.db.findPage(args) : { ...await this.db.find(args), totalDocs: null, totalPages: null };
|
|
6538
6572
|
const found = draft ? await this.withDrafts(config, result.docs) : result.docs;
|
|
6539
6573
|
const docs = await this.output(config, found, guard, { ...options, draft });
|
|
6540
6574
|
return { ...result, docs };
|
|
@@ -9030,6 +9064,28 @@ function durationSeconds(value) {
|
|
|
9030
9064
|
if (seconds > MAX_LINK) throw new QueryError("expiresIn can be at most 7 days");
|
|
9031
9065
|
return Math.floor(seconds);
|
|
9032
9066
|
}
|
|
9067
|
+
function cursorQuery(collection2, where, sort, locale, draft) {
|
|
9068
|
+
const key = JSON.stringify([collection2, where ?? null, sort, locale ?? null, draft]);
|
|
9069
|
+
return createHash4("sha256").update(key).digest("base64url").slice(0, 16);
|
|
9070
|
+
}
|
|
9071
|
+
function writeCursor(keys2, query) {
|
|
9072
|
+
return Buffer.from(JSON.stringify({ k: keys2, q: query })).toString("base64url");
|
|
9073
|
+
}
|
|
9074
|
+
function readCursor(cursor, query) {
|
|
9075
|
+
if (cursor === "") return null;
|
|
9076
|
+
let parsed;
|
|
9077
|
+
try {
|
|
9078
|
+
parsed = JSON.parse(Buffer.from(cursor, "base64url").toString("utf8"));
|
|
9079
|
+
} catch {
|
|
9080
|
+
throw new QueryError("cursor is not a cursor from this API");
|
|
9081
|
+
}
|
|
9082
|
+
const { k, q } = parsed ?? {};
|
|
9083
|
+
if (!Array.isArray(k) || typeof q !== "string")
|
|
9084
|
+
throw new QueryError("cursor is not a cursor from this API");
|
|
9085
|
+
if (q !== query)
|
|
9086
|
+
throw new QueryError("cursor was made for another query: keep where, sort and locale the same");
|
|
9087
|
+
return k;
|
|
9088
|
+
}
|
|
9033
9089
|
|
|
9034
9090
|
// src/rest/admin-jobs.ts
|
|
9035
9091
|
var has = (config, slug2) => config.collections.some((c) => c.slug === slug2);
|
|
@@ -9761,7 +9817,7 @@ function rank(role, config) {
|
|
|
9761
9817
|
}
|
|
9762
9818
|
|
|
9763
9819
|
// src/rest/admin-modules.ts
|
|
9764
|
-
import { createHash as
|
|
9820
|
+
import { createHash as createHash5 } from "crypto";
|
|
9765
9821
|
import { readFile as readFile3 } from "fs/promises";
|
|
9766
9822
|
import { createRequire } from "module";
|
|
9767
9823
|
import { join as join3 } from "path";
|
|
@@ -9802,11 +9858,11 @@ async function readAdminModule(cms, index) {
|
|
|
9802
9858
|
if (!file) return void 0;
|
|
9803
9859
|
const body = await readFile3(file, "utf8").catch(() => void 0);
|
|
9804
9860
|
if (body === void 0) return void 0;
|
|
9805
|
-
return { body, etag: `"${
|
|
9861
|
+
return { body, etag: `"${createHash5("sha1").update(body).digest("base64url")}"` };
|
|
9806
9862
|
}
|
|
9807
9863
|
|
|
9808
9864
|
// src/version.ts
|
|
9809
|
-
var VERSION = true ? "1.
|
|
9865
|
+
var VERSION = true ? "1.9.0" : "0.0.0-dev";
|
|
9810
9866
|
|
|
9811
9867
|
// src/rest/handler.ts
|
|
9812
9868
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
@@ -10695,6 +10751,15 @@ function parseListQuery(url) {
|
|
|
10695
10751
|
if (sort) query.sort = sort;
|
|
10696
10752
|
const depth = integer("depth", params.depth, 0, 3);
|
|
10697
10753
|
if (depth !== void 0) query.depth = depth;
|
|
10754
|
+
if (params.cursor !== void 0) {
|
|
10755
|
+
if (typeof params.cursor !== "string") throw new QueryError("cursor must be a string");
|
|
10756
|
+
if (params.page !== void 0) throw new QueryError("Use either cursor or page, not both");
|
|
10757
|
+
query.cursor = params.cursor;
|
|
10758
|
+
}
|
|
10759
|
+
if (params.count !== void 0 && params.count !== "true") {
|
|
10760
|
+
if (params.count !== "false") throw new QueryError("count must be true or false");
|
|
10761
|
+
query.count = false;
|
|
10762
|
+
}
|
|
10698
10763
|
return query;
|
|
10699
10764
|
}
|
|
10700
10765
|
function parseDepth(url) {
|
|
@@ -11512,10 +11577,19 @@ async function route(cms, ctx, method, path, options) {
|
|
|
11512
11577
|
}
|
|
11513
11578
|
if (second === void 0) {
|
|
11514
11579
|
if (method === "GET") {
|
|
11515
|
-
const query = parseListQuery(ctx.url);
|
|
11580
|
+
const { page, ...query } = parseListQuery(ctx.url);
|
|
11516
11581
|
const filter = await pickerFilter(cms, ctx.url, collection2, ctx.user, ctx.context);
|
|
11517
11582
|
if (filter) query.where = query.where ? { and: [query.where, filter] } : filter;
|
|
11518
|
-
|
|
11583
|
+
const { maxPage } = cms.config;
|
|
11584
|
+
if (maxPage !== void 0 && ctx.via !== "cookie" && page > maxPage)
|
|
11585
|
+
throw new QueryError(`page can be at most ${maxPage}: use cursor to go further`);
|
|
11586
|
+
const options2 = { ...access, ...query, draft };
|
|
11587
|
+
return {
|
|
11588
|
+
body: await cms.find(
|
|
11589
|
+
collection2,
|
|
11590
|
+
query.cursor === void 0 ? { ...options2, page } : options2
|
|
11591
|
+
)
|
|
11592
|
+
};
|
|
11519
11593
|
}
|
|
11520
11594
|
if (method === "POST") {
|
|
11521
11595
|
const body = await readJson(ctx.request);
|
package/dist/conditions.d.ts
CHANGED
|
@@ -30,4 +30,5 @@ declare function matchesCondition(condition: FieldCondition, data: Data): boolea
|
|
|
30
30
|
/** Problems with a condition, for the config's checks; `[]` when it's fine. */
|
|
31
31
|
declare function conditionIssues(condition: unknown, siblings: readonly string[]): string[];
|
|
32
32
|
|
|
33
|
-
export {
|
|
33
|
+
export { conditionIssues, matchesCondition };
|
|
34
|
+
export type { FieldCondition };
|
|
@@ -136,6 +136,26 @@ interface PaginatedDocs<T> {
|
|
|
136
136
|
hasNextPage: boolean;
|
|
137
137
|
hasPrevPage: boolean;
|
|
138
138
|
}
|
|
139
|
+
/**
|
|
140
|
+
* A page read with a `cursor`: the documents after the cursor, and `nextCursor` for the page after
|
|
141
|
+
* them (`null` at the end). No page numbers or totals.
|
|
142
|
+
*/
|
|
143
|
+
interface CursorDocs<T> {
|
|
144
|
+
docs: T[];
|
|
145
|
+
limit: number;
|
|
146
|
+
nextCursor: string | null;
|
|
147
|
+
hasNextPage: boolean;
|
|
148
|
+
/** Whether the cursor started after the first document. */
|
|
149
|
+
hasPrevPage: boolean;
|
|
150
|
+
totalDocs: null;
|
|
151
|
+
totalPages: null;
|
|
152
|
+
page: null;
|
|
153
|
+
}
|
|
154
|
+
/** A page read with `count: false`: no totals, which saves counting every matching document. */
|
|
155
|
+
interface UncountedDocs<T> extends Omit<PaginatedDocs<T>, 'totalDocs' | 'totalPages'> {
|
|
156
|
+
totalDocs: null;
|
|
157
|
+
totalPages: null;
|
|
158
|
+
}
|
|
139
159
|
/**
|
|
140
160
|
* How the adapter treats the database schema on startup.
|
|
141
161
|
* - `push`: apply schema changes directly (development).
|
|
@@ -161,6 +181,17 @@ interface FindArgs {
|
|
|
161
181
|
readonly limit: number;
|
|
162
182
|
readonly page: number;
|
|
163
183
|
}
|
|
184
|
+
/** `Database.findAfter`: a find with no page, from after a row's keys. */
|
|
185
|
+
interface FindAfterArgs extends Omit<FindArgs, 'page'> {
|
|
186
|
+
/** The keys `findAfter` returned for the last row of the page before; `null` for the first page. */
|
|
187
|
+
readonly after: readonly unknown[] | null;
|
|
188
|
+
}
|
|
189
|
+
interface KeysetPage {
|
|
190
|
+
docs: RawDocument[];
|
|
191
|
+
hasNextPage: boolean;
|
|
192
|
+
/** The keys of the last row (its sort values, then its id), to continue after; `null` when empty. */
|
|
193
|
+
next: unknown[] | null;
|
|
194
|
+
}
|
|
164
195
|
interface MigrationInfo {
|
|
165
196
|
readonly name: string;
|
|
166
197
|
readonly applied: boolean;
|
|
@@ -173,6 +204,16 @@ interface CreateMigrationResult {
|
|
|
173
204
|
/** A connected database bound to one config. Returned by `DatabaseAdapter.init`. */
|
|
174
205
|
interface Database {
|
|
175
206
|
find(args: FindArgs): Promise<PaginatedDocs<RawDocument>>;
|
|
207
|
+
/**
|
|
208
|
+
* A page without counting the matching documents (`find` with `count: false`): `hasNextPage`
|
|
209
|
+
* from one row more. Optional: without it, `find` runs and its totals are dropped.
|
|
210
|
+
*/
|
|
211
|
+
findPage?(args: FindArgs): Promise<UncountedDocs<RawDocument>>;
|
|
212
|
+
/**
|
|
213
|
+
* Keyset pagination, for `find` with a `cursor`: the rows after `after` in the sort's order (with
|
|
214
|
+
* `id` last). Optional: without it, cursors are refused.
|
|
215
|
+
*/
|
|
216
|
+
findAfter?(args: FindAfterArgs): Promise<KeysetPage>;
|
|
176
217
|
findById(args: {
|
|
177
218
|
collection: string;
|
|
178
219
|
id: ID;
|
|
@@ -1670,6 +1711,16 @@ interface FindOptions extends ReadOptions {
|
|
|
1670
1711
|
readonly limit?: number;
|
|
1671
1712
|
/** 1-based. Default 1. */
|
|
1672
1713
|
readonly page?: number;
|
|
1714
|
+
/**
|
|
1715
|
+
* `false` skips counting the matching documents: `totalDocs` and `totalPages` are `null`, and
|
|
1716
|
+
* `hasNextPage` still says whether there is more. Default `true`.
|
|
1717
|
+
*/
|
|
1718
|
+
readonly count?: boolean;
|
|
1719
|
+
/**
|
|
1720
|
+
* Cursor pagination instead of `page`: `''` for the first page, then the `nextCursor` of the
|
|
1721
|
+
* page before. Fast on deep pages of large collections; no page numbers or totals.
|
|
1722
|
+
*/
|
|
1723
|
+
readonly cursor?: string;
|
|
1673
1724
|
}
|
|
1674
1725
|
interface CreateEasyCMSOptions {
|
|
1675
1726
|
/** Project root. Default `process.cwd()`. */
|
|
@@ -1731,6 +1782,14 @@ declare class EasyCMS<C extends Config = Config> {
|
|
|
1731
1782
|
user: AuthUser | null;
|
|
1732
1783
|
context: RequestContext;
|
|
1733
1784
|
}>;
|
|
1785
|
+
find<S extends Slug<C>, L extends string | undefined = undefined>(collection: S, options: FindOptions & {
|
|
1786
|
+
readonly locale?: L;
|
|
1787
|
+
readonly cursor: string;
|
|
1788
|
+
}): Promise<CursorDocs<Doc<C, S, L>>>;
|
|
1789
|
+
find<S extends Slug<C>, L extends string | undefined = undefined>(collection: S, options: FindOptions & {
|
|
1790
|
+
readonly locale?: L;
|
|
1791
|
+
readonly count: false;
|
|
1792
|
+
}): Promise<UncountedDocs<Doc<C, S, L>>>;
|
|
1734
1793
|
find<S extends Slug<C>, L extends string | undefined = undefined>(collection: S, options?: FindOptions & {
|
|
1735
1794
|
readonly locale?: L;
|
|
1736
1795
|
}): Promise<PaginatedDocs<Doc<C, S, L>>>;
|
|
@@ -3308,6 +3367,18 @@ interface Config {
|
|
|
3308
3367
|
* request id. Ignored when `createEasyCMS` is given a `logger`.
|
|
3309
3368
|
*/
|
|
3310
3369
|
readonly logs?: LogsConfig;
|
|
3370
|
+
/**
|
|
3371
|
+
* How long, in seconds, the total of a paginated list (`totalDocs`, `totalPages`) is reused for
|
|
3372
|
+
* the same query. Counting reads every matching document, and many people open the same lists.
|
|
3373
|
+
* The documents themselves are always current; a total can be this old. `0` counts every time.
|
|
3374
|
+
* Default 5.
|
|
3375
|
+
*/
|
|
3376
|
+
readonly countCacheSeconds?: number;
|
|
3377
|
+
/**
|
|
3378
|
+
* The deepest `page` the REST API serves to API clients (not to the signed-in admin); deeper
|
|
3379
|
+
* requests get `400`, pointing to `cursor`. Deep pages are read row by row. Default: no limit.
|
|
3380
|
+
*/
|
|
3381
|
+
readonly maxPage?: number;
|
|
3311
3382
|
readonly plugins?: readonly Plugin[];
|
|
3312
3383
|
}
|
|
3313
3384
|
/** The config after plugins ran, validation passed and defaults were applied. */
|
|
@@ -3339,4 +3410,5 @@ interface ResolvedConfig extends Omit<Config, 'cors' | 'localization' | 'routes'
|
|
|
3339
3410
|
*/
|
|
3340
3411
|
declare function defineConfig<const TConfig extends Config>(config: TConfig): TConfig;
|
|
3341
3412
|
|
|
3342
|
-
export {
|
|
3413
|
+
export { ADAPTER_API_VERSION as A, AuditLog as J, Auth as M, ADMIN_ICONS as a, FIELD_TYPES as aD, ForbiddenError as a_, ConfigError as ac, EasyCMS as av, EasyCMSError as aw, PayloadTooLargeError as bC, QueryError as bI, ROLE_OPERATIONS as bJ, Roles as bU, SchemaError as bX, NotFoundError as bs, PLUGIN_API_VERSION as bx, logFormat as c$, SingleSignOn as c3, defineConfig as cA, defineFieldType as cB, definePlugin as cC, diskStorage as cD, hasRows as cE, isAdmin as cF, isHasMany as cG, isSignedIn as cH, isStaff as cI, isSystemAdmin as cJ, jsonLogger as cK, mimeAllowedBy as cL, rowFields as cM, silentLogger as cN, uniqueWithinOf as cO, API_KEYS as cP, API_KEY_GLOBAL_OPERATIONS as cQ, API_KEY_OPERATIONS as cR, DEFAULT_MAX_VERSIONS as cS, DEFAULT_PASSWORD_EMAILS as cT, FIELD_TYPE_BASES as cU, FOLDER_LEVELS as cV, MediaFolders as cW, SSO_COOKIE as cX, codeOfStatus as cY, isJsonLogger as cZ, keyAllows as c_, TooManyRequestsError as cc, UnauthorizedError as ce, ValidationError as cm, WEBHOOK_EVENTS as cq, anyone as cw, consoleEmail as cx, consoleLogger as cy, createEasyCMS as cz };
|
|
3414
|
+
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 _, GlobalAccess as a$, 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, Endpoint as aA, EndpointRequest as aB, ErrorCode as aC, Field as aE, FieldAccess as aF, FieldAccessFn as aG, FieldAdmin as aH, FieldError as aI, FieldRule as aJ, FieldType as aK, FieldTypeBase as aL, FieldTypeDefinition as aM, FieldTypeValidateContext as aN, FieldValidate as aO, FieldValidateContext as aP, FieldValue as aQ, FieldsInput as aR, FieldsValue as aS, FilterOptions as aT, FilterOptionsArgs as aU, FindAfterArgs as aV, FindArgs as aW, FindOptions as aX, FolderLevel as aY, FolderPermissions as aZ, CollectionSlug as aa, Config as ab, ConfigIssue as ad, ContainerAdmin as ae, CreateEasyCMSOptions as af, CreateInput as ag, CreateMigrationResult as ah, CursorDocs as ai, CustomField as aj, CustomFieldTypes as ak, DashboardWidget as al, Database as am, DatabaseAdapter as an, DatabaseInitArgs as ao, DatabaseTransfer as ap, DateField as aq, DepthOptions as ar, DirectUpload as as, DiskStorageOptions as at, DocumentOf as au, EmailAdapter as ax, EmailField as ay, EmailMessage as az, Access as b, Session as b$, GlobalConfig as b0, GlobalDocument as b1, GlobalHooks as b2, GlobalInput as b3, GlobalSlug as b4, GroupField as b5, ImageSize as b6, IncrementOptions as b7, InferCollection as b8, InferGlobal as b9, PasswordEmailFn as bA, PasswordLinkOptions as bB, Plugin as bD, PluginInfo as bE, PluginTypes as bF, PreviewTarget as bG, PreviewURL as bH, RawDocument as bK, ReadOptions as bL, RelationshipField as bM, RequestContext as bN, ResolvedConfig as bO, RichTextDocument as bP, RichTextField as bQ, Role as bR, RoleOperation as bS, RolePermissions as bT, RoutesConfig as bV, ScheduledPublish as bW, SchemaMode as bY, SelectField as bZ, SelectOption as b_, JobConfig as ba, JsonField as bb, KeysetPage as bc, Label as bd, LayoutNode as be, LivePreview as bf, LocaleOf as bg, LocalizationConfig as bh, LogDetails as bi, Logger as bj, LoginArgs as bk, LogsConfig as bl, MediaDocument as bm, MediaSize as bn, MembersConfig as bo, MembersSignup as bp, MigrationInfo as bq, NavGroup as br, NumberField as bt, OnRequest as bu, OnRequestArgs as bv, Operation as bw, PasswordEmail as by, PasswordEmailArgs as bz, AccessArgs as c, SidebarPanel as c0, SignupArgs as c1, SignupResult as c2, SlugField as c4, SlugOf as c5, SsoOutcome as c6, SsoProviderRef as c7, StorageAdapter as c8, StoredFile as c9, TextField as ca, TextareaField as cb, TypedPlugin as cd, UncountedDocs as cf, UpdateInput as cg, UpdateOptions as ch, UploadConfig as ci, UploadField as cj, UploadFromURLConfig as ck, UserIdentity as cl, Version as cn, VersionSummary as co, VersionsConfig as cp, WebhookConfig as cr, WebhookEvent as cs, WebhookPayload as ct, Where as cu, WhereOperators as cv, 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, ab as Config,
|
|
1
|
+
import { I as ID, ab as Config, av as EasyCMS, bh as LocalizationConfig, aE as Field, aI as FieldError, aT as FilterOptions, af as CreateEasyCMSOptions, bO as ResolvedConfig } from './config-BZgVbC3f.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;
|
|
@@ -193,4 +193,5 @@ declare function createRootEndpointHandler<C extends Config>(instance: EasyCMS<C
|
|
|
193
193
|
/** A cookie of the request; the `__Host-` one (set over HTTPS) first. */
|
|
194
194
|
declare function readCookie(request: Request, name: string): string | undefined;
|
|
195
195
|
|
|
196
|
-
export {
|
|
196
|
+
export { CONFIG_FILE_NAMES as C, DEFAULT_ADMIN_PATH as D, readCookie as E, validateFields as F, writeBackupFile as G, createApiHandler as d, createRestHandler as e, slugify as f, CSRF_COOKIE as g, CSRF_HEADER as h, DEFAULT_API_PATH as i, DEFAULT_MAX_FILE_SIZE as j, DEFAULT_TOKEN_EXPIRATION as k, loadConfig as l, applyDefaults as m, applyPlugins as n, createRootEndpointHandler as o, decryptBackup as p, fillMissing as q, resolveConfig as r, sharedEasyCMS as s, findConfigFile as t, forwardedClientIp as u, generateSlugs as v, importConfig as w, mergeForUpdate as x, parseId as y, platformClientIp as z };
|
|
197
|
+
export type { AdminBackup as A, BackupState as B, LoadConfigOptions as L, RestHandler as R, AdminBackups as a, ApiHandlerOptions as b, RestHandlerOptions as c };
|
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 CollectionSlug, ab as Config, ac as ConfigError, ad as ConfigIssue, ae as ContainerAdmin, af as CreateEasyCMSOptions, ag as CreateInput, ah as CreateMigrationResult, ai 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-BZgVbC3f.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 CollectionSlug, ab as Config, ac as ConfigError, ad as ConfigIssue, ae as ContainerAdmin, af as CreateEasyCMSOptions, ag as CreateInput, ah as CreateMigrationResult, ai as CursorDocs, aj as CustomField, ak as CustomFieldTypes, al as DashboardWidget, am as Database, an as DatabaseAdapter, ao as DatabaseInitArgs, ap as DatabaseTransfer, aq as DateField, ar as DepthOptions, as as DirectUpload, at as DiskStorageOptions, au as DocumentOf, av as EasyCMS, aw as EasyCMSError, ax as EmailAdapter, ay as EmailField, az as EmailMessage, aA as Endpoint, aB as EndpointRequest, aC as ErrorCode, aD as FIELD_TYPES, aE as Field, aF as FieldAccess, aG as FieldAccessFn, aH as FieldAdmin, aI as FieldError, aJ as FieldRule, aK as FieldType, aL as FieldTypeBase, aM as FieldTypeDefinition, aN as FieldTypeValidateContext, aO as FieldValidate, aP as FieldValidateContext, aQ as FieldValue, aR as FieldsInput, aS as FieldsValue, aT as FilterOptions, aU as FilterOptionsArgs, aV as FindAfterArgs, aW as FindArgs, aX as FindOptions, aY as FolderLevel, aZ as FolderPermissions, a_ as ForbiddenError, a$ as GlobalAccess, b0 as GlobalConfig, b1 as GlobalDocument, b2 as GlobalHooks, b3 as GlobalInput, b4 as GlobalSlug, b5 as GroupField, b6 as ImageSize, b7 as IncrementOptions, b8 as InferCollection, b9 as InferGlobal, ba as JobConfig, bb as JsonField, bc as KeysetPage, bd as Label, be as LayoutNode, bf as LivePreview, bg as LocaleOf, bh as LocalizationConfig, bi as LogDetails, bj as Logger, bk as LoginArgs, bl as LogsConfig, bm as MediaDocument, bn as MediaSize, bo as MembersConfig, bp as MembersSignup, bq as MigrationInfo, br as NavGroup, bs as NotFoundError, bt as NumberField, bu as OnRequest, bv as OnRequestArgs, bw as Operation, bx as PLUGIN_API_VERSION, by as PasswordEmail, bz as PasswordEmailArgs, bA as PasswordEmailFn, bB as PasswordLinkOptions, bC as PayloadTooLargeError, bD as Plugin, bE as PluginInfo, bF as PluginTypes, bG as PreviewTarget, bH as PreviewURL, bI as QueryError, bJ as ROLE_OPERATIONS, bK as RawDocument, bL as ReadOptions, bM as RelationshipField, bN as RequestContext, bO as ResolvedConfig, bP as RichTextDocument, bQ as RichTextField, bR as Role, bS as RoleOperation, bT as RolePermissions, bU as Roles, bV as RoutesConfig, bW as ScheduledPublish, bX as SchemaError, bY as SchemaMode, bZ as SelectField, b_ as SelectOption, b$ as Session, c0 as SidebarPanel, c1 as SignupArgs, c2 as SignupResult, c3 as SingleSignOn, c4 as SlugField, c5 as SlugOf, c6 as SsoOutcome, c7 as SsoProviderRef, c8 as StorageAdapter, c9 as StoredFile, ca as TextField, cb as TextareaField, cc as TooManyRequestsError, cd as TypedPlugin, ce as UnauthorizedError, cf as UncountedDocs, cg as UpdateInput, ch as UpdateOptions, ci as UploadConfig, cj as UploadField, ck as UploadFromURLConfig, cl as UserIdentity, cm as ValidationError, cn as Version, co as VersionSummary, cp as VersionsConfig, cq as WEBHOOK_EVENTS, cr as WebhookConfig, cs as WebhookEvent, ct as WebhookPayload, cu as Where, cv as WhereOperators, cw as anyone, cx as consoleEmail, cy as consoleLogger, cz as createEasyCMS, cA as defineConfig, cB as defineFieldType, cC as definePlugin, cD as diskStorage, cE as hasRows, cF as isAdmin, cG as isHasMany, cH as isSignedIn, cI as isStaff, cJ as isSystemAdmin, cK as jsonLogger, cL as mimeAllowedBy, cM as rowFields, cN as silentLogger, cO as uniqueWithinOf } from './config-BZgVbC3f.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-DlSta1rd.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-j6s6J723.js';
|
|
5
5
|
export { FieldCondition, matchesCondition } from './conditions.js';
|
|
6
6
|
|
|
7
7
|
type DeliveryKind = 'webhook' | 'email';
|
|
@@ -221,4 +221,5 @@ interface AdminStatus {
|
|
|
221
221
|
/** The version of `@easy-cms/core`, set when the package is built. */
|
|
222
222
|
declare const VERSION: string;
|
|
223
223
|
|
|
224
|
-
export {
|
|
224
|
+
export { EmailSetting, ID, PaginatedDocs, VERSION };
|
|
225
|
+
export type { AdminAttention, AdminDeliveries, AdminDelivery, AdminEmail, AdminEmailDelivery, AdminJob, AdminJobs, AdminScheduledJob, AdminStatus, AdminWebhookDelivery, BuiltInJob, DeliveryKind, DeliveryState, EmailCheck, SearchHit };
|
package/dist/index.js
CHANGED
package/dist/internal.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
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-
|
|
1
|
+
import { Config, Database, EasyCMS, NavGroup, CollectionConfig, ID, RawDocument, Field, ResolvedConfig, ConfigIssue } from './index.js';
|
|
2
|
+
export { cP as API_KEYS, cQ as API_KEY_GLOBAL_OPERATIONS, cR as API_KEY_OPERATIONS, cS as DEFAULT_MAX_VERSIONS, cT as DEFAULT_PASSWORD_EMAILS, cU as FIELD_TYPE_BASES, cV as FOLDER_LEVELS, cW as MediaFolders, cX as SSO_COOKIE, cY as codeOfStatus, cE as hasRows, cG as isHasMany, cZ as isJsonLogger, c_ as keyAllows, c$ as logFormat, cL as mimeAllowedBy, cM as rowFields, cO as uniqueWithinOf } from './config-BZgVbC3f.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-j6s6J723.js';
|
|
4
4
|
export { conditionIssues } from './conditions.js';
|
|
5
5
|
|
|
6
6
|
/** The session cookie the REST API sets at login. */
|
|
@@ -141,4 +141,5 @@ declare const BUILTIN_COLLECTIONS: readonly ["users", "media"];
|
|
|
141
141
|
/** Checks a config and returns every problem found. An empty array means it is valid. */
|
|
142
142
|
declare function validateConfig(config: Config): ConfigIssue[];
|
|
143
143
|
|
|
144
|
-
export { BUILTIN_COLLECTIONS, BUILTIN_NAV,
|
|
144
|
+
export { BUILTIN_COLLECTIONS, BUILTIN_NAV, DEFAULT_DEPTH, EXTENSIONS, INTERNAL_COLLECTIONS, MAX_DEPTH, MEDIA, MEDIA_FOLDERS, MIME_GROUPS, MIN_PASSWORD_LENGTH, MIN_SECRET_LENGTH, SESSION_COOKIE, checkFormToken, checkRenamedOptions, configSignature, copyDatabase, expandMimeTypes, formToken, generateTypes, hashPassword, healthResponse, honeypotName, imageDimensions, mimeAllowed, populate, rateKeys, resolveAdminModule, singularize, sniffMimeType, validateConfig, verifyPassword, verifyTurnstile };
|
|
145
|
+
export type { CopyProgress, CopyResult, HealthCheck };
|
package/dist/internal.js
CHANGED
package/dist/live-preview.d.ts
CHANGED
|
@@ -37,4 +37,5 @@ declare function isLivePreview(): boolean;
|
|
|
37
37
|
*/
|
|
38
38
|
declare function subscribeLivePreview<T = Record<string, unknown>>(onChange: (doc: T, message: LivePreviewMessage<T>) => void, options?: LivePreviewOptions): () => void;
|
|
39
39
|
|
|
40
|
-
export {
|
|
40
|
+
export { PREVIEW_PARAM, READY_MESSAGE, getPreviewToken, isLivePreview, subscribeLivePreview };
|
|
41
|
+
export type { LivePreviewMessage, LivePreviewOptions };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bd as Label, aE as Field, I as ID, k as AdminLocale, t as AdminSwitcher, c7 as SsoProviderRef } from './config-BZgVbC3f.js';
|
|
2
2
|
import { FieldCondition } from './conditions.js';
|
|
3
3
|
|
|
4
4
|
/** A Web Component from an admin module, with its `props` (plain JSON). */
|
|
@@ -339,4 +339,5 @@ interface SetFieldDetail {
|
|
|
339
339
|
*/
|
|
340
340
|
declare function warnDeprecated(code: string, message: string): void;
|
|
341
341
|
|
|
342
|
-
export { ADMIN_API_VERSION as A,
|
|
342
|
+
export { ADMIN_API_VERSION as A, warnDeprecated as w };
|
|
343
|
+
export type { SetFieldDetail as S, AdminCollection as a, AdminComponentRef as b, AdminElementProps as c, AdminField as d, AdminGlobal as e, AdminLayoutNode as f, AdminNavGroup as g, AdminNavItem as h, AdminNavNode as i, AdminPageRef as j, AdminPageRoute as k, AdminSchema as l, AdminWidgetRef as m };
|
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, ab as Config, ac as ConfigError,
|
|
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, ab as Config, ac as ConfigError, al as DashboardWidget, aw as EasyCMSError, aA as Endpoint, aB as EndpointRequest, aC as ErrorCode, aE as Field, aF as FieldAccess, aI as FieldError, aL as FieldTypeBase, aM as FieldTypeDefinition, aN as FieldTypeValidateContext, a_ as ForbiddenError, b0 as GlobalConfig, I as ID, ba as JobConfig, bd as Label, br as NavGroup, bs as NotFoundError, bu as OnRequest, bv as OnRequestArgs, bx as PLUGIN_API_VERSION, bC as PayloadTooLargeError, bD as Plugin, bE as PluginInfo, bF as PluginTypes, bI as QueryError, bN as RequestContext, cc as TooManyRequestsError, cd as TypedPlugin, ce as UnauthorizedError, cm as ValidationError, cu as Where, cB as defineFieldType, cC as definePlugin } from './config-BZgVbC3f.js';
|
|
2
|
+
export { A as ADMIN_API_VERSION, c as AdminElementProps, k as AdminPageRoute, S as SetFieldDetail, w as warnDeprecated } from './plugin-DlSta1rd.js';
|
|
3
3
|
import './conditions.js';
|