@easy-cms/core 1.15.0 → 1.16.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.
@@ -166,6 +166,25 @@ function zipType(data) {
166
166
  if (contains(data, "ppt/presentation.xml")) return OFFICE[2];
167
167
  return "application/zip";
168
168
  }
169
+ function isSvg(text) {
170
+ let rest = text;
171
+ if (rest.slice(0, 5).toLowerCase() === "<?xml") {
172
+ const end = rest.indexOf(">");
173
+ if (end < 0) return false;
174
+ rest = rest.slice(end + 1).trimStart();
175
+ }
176
+ while (rest.startsWith("<!--")) {
177
+ const end = rest.indexOf("-->", 4);
178
+ if (end < 0) return false;
179
+ rest = rest.slice(end + 3).trimStart();
180
+ }
181
+ if (/^<!DOCTYPE svg/i.test(rest)) {
182
+ const end = rest.indexOf(">");
183
+ if (end < 0) return false;
184
+ rest = rest.slice(end + 1).trimStart();
185
+ }
186
+ return /^<svg[\s>]/i.test(rest);
187
+ }
169
188
  function sniffMimeType(data, name = "") {
170
189
  if (startsWith(data, [137, 80, 78, 71, 13, 10, 26, 10])) return "image/png";
171
190
  if (startsWith(data, [255, 216, 255])) return "image/jpeg";
@@ -195,8 +214,7 @@ function sniffMimeType(data, name = "") {
195
214
  return void 0;
196
215
  }
197
216
  const trimmed = text.replace(/^/, "").trimStart();
198
- if (/^(<\?xml[^>]*>\s*)?(<!--[\s\S]*?-->\s*)*(<!DOCTYPE svg[^>]*>\s*)?<svg[\s>]/i.test(trimmed))
199
- return "image/svg+xml";
217
+ if (isSvg(trimmed)) return "image/svg+xml";
200
218
  return /\.csv$/i.test(name) ? "text/csv" : "text/plain";
201
219
  }
202
220
  function mimeAllowed(type, allowed) {
@@ -295,6 +313,7 @@ function rowFields(field, row) {
295
313
  const type = row && typeof row === "object" ? row.blockType : void 0;
296
314
  return field.blocks.find((block) => block.slug === type)?.fields;
297
315
  }
316
+ var TRIGRAM_LIKE_MIN = 3;
298
317
  var FIELD_TYPES = [
299
318
  "text",
300
319
  "textarea",
@@ -546,6 +565,7 @@ export {
546
565
  mimeAllowedBy,
547
566
  hasRows,
548
567
  rowFields,
568
+ TRIGRAM_LIKE_MIN,
549
569
  FIELD_TYPES,
550
570
  ADMIN_ICONS,
551
571
  PLUGIN_API_VERSION,
@@ -14,6 +14,7 @@ import {
14
14
  PRIVATE_KEY,
15
15
  PayloadTooLargeError,
16
16
  QueryError,
17
+ TRIGRAM_LIKE_MIN,
17
18
  TooManyRequestsError,
18
19
  UnauthorizedError,
19
20
  ValidationError,
@@ -35,7 +36,7 @@ import {
35
36
  warnDeprecated,
36
37
  withCharset,
37
38
  withPrivacy
38
- } from "./chunk-RTKWMVAC.js";
39
+ } from "./chunk-RJGKAYUU.js";
39
40
 
40
41
  // src/access.ts
41
42
  var isSystemAdmin = (user) => user?.role === "admin" && !user.apiKey && user.scoped !== true;
@@ -2314,7 +2315,10 @@ var ADAPTER_API_VERSION = 1;
2314
2315
 
2315
2316
  // src/document.ts
2316
2317
  import { randomUUID } from "crypto";
2317
- var EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
2318
+ function isEmail(value) {
2319
+ const at = value.indexOf("@");
2320
+ return at > 0 && !value.includes("@", at + 1) && !/\s/.test(value) && value.slice(at + 2, -1).includes(".");
2321
+ }
2318
2322
  var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
2319
2323
  function itemsOf(field, n) {
2320
2324
  const unit = field.type === "upload" ? "file" : field.type === "relationship" ? "document" : "row";
@@ -2522,8 +2526,7 @@ async function normalizeValue(field, raw, path, options, fail, errors, reference
2522
2526
  return raw;
2523
2527
  }
2524
2528
  case "email": {
2525
- if (typeof raw !== "string" || !EMAIL_PATTERN.test(raw))
2526
- return fail("must be a valid email address");
2529
+ if (typeof raw !== "string" || !isEmail(raw)) return fail("must be a valid email address");
2527
2530
  return raw.trim().toLowerCase();
2528
2531
  }
2529
2532
  case "number": {
@@ -3735,6 +3738,7 @@ async function populate(load, collections, fields, docs, depth) {
3735
3738
  }
3736
3739
  function collectSlots(fields, data, bySlug, slots) {
3737
3740
  for (const field of fields) {
3741
+ if (field.name === "__proto__") continue;
3738
3742
  const value = data[field.name];
3739
3743
  if (value === null || value === void 0) continue;
3740
3744
  if (field.type === "group") {
@@ -4440,7 +4444,10 @@ for (const [net, prefix] of [
4440
4444
  ["::1", 128],
4441
4445
  ["64:ff9b:1::", 48],
4442
4446
  ["100::", 64],
4447
+ // Teredo and 6to4 tunnel to an IPv4 address the IPv6 one carries: any of them, private too.
4448
+ ["2001::", 32],
4443
4449
  ["2001:db8::", 32],
4450
+ ["2002::", 16],
4444
4451
  ["fc00::", 7],
4445
4452
  ["fe80::", 10],
4446
4453
  ["ff00::", 8]
@@ -6406,6 +6413,15 @@ function validateFields2(fields, path, reserved, collectionSlugs, add) {
6406
6413
  add(`${path}[${i}].name`, `must be a valid identifier (got ${JSON.stringify(name)})`);
6407
6414
  return;
6408
6415
  }
6416
+ if (name === "__proto__") {
6417
+ add(`${path}[${i}].name`, '"__proto__" is reserved by JavaScript');
6418
+ return;
6419
+ }
6420
+ if (name === "constructor" || name === "prototype")
6421
+ warnDeprecated(
6422
+ "EASY_CMS_DEP006",
6423
+ `A field named "${name}" (${path}.${name}) works through 1.x; rename it before 2.0.`
6424
+ );
6409
6425
  if (reserved.has(name)) {
6410
6426
  add(`${path}.${name}`, `"${name}" is reserved`, "Easy CMS adds this field automatically");
6411
6427
  }
@@ -7030,7 +7046,7 @@ function cacheableResponse(request, body, status, headers, times, tags) {
7030
7046
  }
7031
7047
 
7032
7048
  // src/version.ts
7033
- var VERSION = true ? "1.15.0" : "0.0.0-dev";
7049
+ var VERSION = true ? "1.16.0" : "0.0.0-dev";
7034
7050
 
7035
7051
  // src/telemetry.ts
7036
7052
  var DB_CALLS = /* @__PURE__ */ new Set([
@@ -8774,8 +8790,13 @@ var EasyCMS = class {
8774
8790
  if (!found.hasNextPage) return;
8775
8791
  }
8776
8792
  }
8777
- /** A Local API call in a span (`easy-cms <operation> <collection>`) with `telemetry`. */
8778
- traced(operation, target, fn) {
8793
+ /**
8794
+ * A Local API call in a span (`easy-cms <operation> <collection>`) with `telemetry`; writes on
8795
+ * the database's connections for writes, when it has some.
8796
+ */
8797
+ traced(operation, target, task) {
8798
+ const writing = WRITES.has(operation) ? this.db.writing?.bind(this.db) : void 0;
8799
+ const fn = writing ? () => writing(task) : task;
8779
8800
  if (!this.telemetry) return fn();
8780
8801
  return this.telemetry.span(
8781
8802
  `easy-cms ${operation}${target ? ` ${target}` : ""}`,
@@ -8887,7 +8908,7 @@ var EasyCMS = class {
8887
8908
  };
8888
8909
  let claimed;
8889
8910
  if (row) {
8890
- if (!due(row.lastRunAt)) continue;
8911
+ if (row.lastRunAt === stamp || !due(row.lastRunAt)) continue;
8891
8912
  claimed = await this.claim(
8892
8913
  JOB_RUNS,
8893
8914
  row,
@@ -10145,6 +10166,7 @@ function wherePaths(where) {
10145
10166
  return out;
10146
10167
  }
10147
10168
  var NO_CONTEXT = Object.freeze({});
10169
+ var WRITES = /* @__PURE__ */ new Set(["create", "update", "delete", "updateGlobal"]);
10148
10170
  function withoutContext(permissions) {
10149
10171
  const { context: _context, ...rest } = permissions ?? {};
10150
10172
  return rest;
@@ -11183,7 +11205,6 @@ async function deleteFailedDeliveries(cms, kind) {
11183
11205
  }
11184
11206
 
11185
11207
  // src/rest/admin-email.ts
11186
- var EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
11187
11208
  var LIMIT = 5;
11188
11209
  var WINDOW = 10 * 6e4;
11189
11210
  var sentAt = /* @__PURE__ */ new WeakMap();
@@ -11232,7 +11253,7 @@ async function sendTestEmail(cms, user, to, locale) {
11232
11253
  const adapter = cms.config.email;
11233
11254
  if (!adapter) return { ok: false, error: "Email is not set up (`email` in the config)" };
11234
11255
  const address = typeof to === "string" && to.trim() ? to.trim() : user.email;
11235
- if (!EMAIL.test(address))
11256
+ if (!isEmail(address))
11236
11257
  throw new ValidationError("email", [{ field: "to", message: "must be an email address" }]);
11237
11258
  const times = sentAt.get(cms) ?? /* @__PURE__ */ new Map();
11238
11259
  sentAt.set(cms, times);
@@ -11412,6 +11433,9 @@ async function collection(cms, config, user, localized, roles, context) {
11412
11433
  };
11413
11434
  if (config.labels) result.labels = config.labels;
11414
11435
  if (config.useAsTitle) result.useAsTitle = config.useAsTitle;
11436
+ const titleField = config.useAsTitle ?? "title";
11437
+ if (config.fields.some((f) => f.name === titleField && f.index === "trigram"))
11438
+ result.searchMin = TRIGRAM_LIKE_MIN;
11415
11439
  if (config.admin?.icon) result.icon = config.admin.icon;
11416
11440
  if (config.admin?.sidebar?.length) result.sidebar = config.admin.sidebar.map(panelRef);
11417
11441
  if (config.admin?.layout?.length) result.layout = layoutOf(config.admin.layout, fields);
@@ -11717,7 +11741,8 @@ async function adminSearch(cms, who, q, perCollection = 5) {
11717
11741
  listed(cms).map(async (c) => {
11718
11742
  const title = c.useAsTitle ?? (c.fields.some((f) => f.name === "title") ? "title" : void 0);
11719
11743
  const conditions = [];
11720
- if (title) conditions.push({ [title]: { like: query } });
11744
+ const short = c.fields.find((f) => f.name === title)?.index === "trigram" && [...query].length < TRIGRAM_LIKE_MIN;
11745
+ if (title && !short) conditions.push({ [title]: { like: query } });
11721
11746
  if (/^\d+$/.test(query)) conditions.push({ id: { equals: Number(query) } });
11722
11747
  const indexed = cms.config.search !== void 0 && c.search !== void 0;
11723
11748
  if (conditions.length === 0 && !indexed || !await readable(cms, c, who)) return [];
@@ -13354,13 +13379,14 @@ function errorResponse(cms, error, headers, production) {
13354
13379
  }
13355
13380
  return new Response(JSON.stringify({ errors }), { status: error.status, headers });
13356
13381
  }
13357
- const message2 = error instanceof Error ? error.message : String(error);
13358
- cms.logger.error(`REST request failed: ${message2}`, { error });
13359
- const body = {
13360
- errors: [
13361
- { message: production ? "Internal Server Error" : message2, code: "INTERNAL_SERVER_ERROR" }
13362
- ]
13363
- };
13382
+ cms.logger.error(
13383
+ `REST request failed: ${error instanceof Error ? error.message : String(error)}`,
13384
+ {
13385
+ error
13386
+ }
13387
+ );
13388
+ const message2 = !production && error instanceof Error ? error.message : "Internal Server Error";
13389
+ const body = { errors: [{ message: message2, code: "INTERNAL_SERVER_ERROR" }] };
13364
13390
  return new Response(JSON.stringify(body), { status: 500, headers });
13365
13391
  }
13366
13392
 
@@ -13496,6 +13522,7 @@ export {
13496
13522
  SSO_COOKIE,
13497
13523
  Auth,
13498
13524
  ADAPTER_API_VERSION,
13525
+ isEmail,
13499
13526
  slugify,
13500
13527
  applyDefaults,
13501
13528
  fillMissing,
@@ -294,6 +294,12 @@ interface Database {
294
294
  * the same transaction. Required by `outbox: true` in the config.
295
295
  */
296
296
  readonly outbox?: boolean | undefined;
297
+ /**
298
+ * Runs `fn`, a create, update or delete with every read it makes, on connections kept for
299
+ * writes, when the adapter has some (`writeConnections` of `postgres()`): saves then don't wait
300
+ * behind slow reads that hold the others.
301
+ */
302
+ writing?<T>(fn: () => Promise<T>): Promise<T>;
297
303
  /** Writes a migration file for the difference between the config and the latest migration. `null` when nothing changed. */
298
304
  createMigration(args: {
299
305
  name: string;
@@ -813,7 +819,8 @@ interface BaseField<TType extends string, TValue> {
813
819
  /**
814
820
  * `true` for a database index (filters and sorts on this field). `'trigram'`, on text, textarea
815
821
  * and email fields: an index for `like`, which finds any part of the text, in Thai as in other
816
- * languages. Postgres only (pg_trgm); nothing on SQLite.
822
+ * languages. Postgres only (pg_trgm); nothing on SQLite. There, `like` needs at least three
823
+ * characters, and the admin's searches wait for them.
817
824
  */
818
825
  readonly index?: boolean | 'trigram';
819
826
  readonly defaultValue?: TValue;
@@ -960,6 +967,11 @@ declare const hasRows: (field: Field) => field is ArrayField | BlocksField;
960
967
  declare function rowFields(field: ArrayField | BlocksField, row: unknown): readonly Field[] | undefined;
961
968
  type Field = CustomField | TextField | TextareaField | NumberField | BooleanField | DateField | EmailField | JsonField | SelectField | SlugField | RichTextField | UploadField | RelationshipField | ArrayField | GroupField | BlocksField;
962
969
  type FieldType = Field['type'];
970
+ /**
971
+ * The shortest `like` on a field with `index: 'trigram'`: trigrams are three characters, so a
972
+ * shorter search can't use the index and would read every row.
973
+ */
974
+ declare const TRIGRAM_LIKE_MIN = 3;
963
975
  declare const FIELD_TYPES: readonly ["text", "textarea", "number", "boolean", "date", "email", "json", "select", "slug", "richText", "upload", "relationship", "array", "group", "blocks"];
964
976
 
965
977
  type Simplify<T> = {
@@ -2108,7 +2120,10 @@ declare class EasyCMS<C extends Config = Config> {
2108
2120
  }[]>;
2109
2121
  /** Published documents of a collection in a locale, a page at a time, for the search index. */
2110
2122
  private publishedPages;
2111
- /** A Local API call in a span (`easy-cms <operation> <collection>`) with `telemetry`. */
2123
+ /**
2124
+ * A Local API call in a span (`easy-cms <operation> <collection>`) with `telemetry`; writes on
2125
+ * the database's connections for writes, when it has some.
2126
+ */
2112
2127
  private traced;
2113
2128
  destroy(): Promise<void>;
2114
2129
  private schedulerTimer;
@@ -3667,5 +3682,5 @@ interface ResolvedConfig extends Omit<Config, 'cors' | 'localization' | 'routes'
3667
3682
  */
3668
3683
  declare function defineConfig<const TConfig extends Config>(config: TConfig): TConfig;
3669
3684
 
3670
- 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_GLOBAL_OPERATIONS as c$, WEBHOOK_EVENTS as cA, anyone as cG, consoleEmail as cH, consoleLogger as cI, createEasyCMS as cJ, defineConfig as cK, defineFieldType as cL, definePlugin as cM, diskStorage as cN, hasRows as cO, isAdmin as cP, isHasMany as cQ, isSignedIn as cR, isStaff as cS, isSystemAdmin as cT, jsonLogger as cU, memorySearch as cV, mimeAllowedBy as cW, rowFields as cX, silentLogger as cY, uniqueWithinOf as cZ, API_KEYS as c_, SingleSignOn as cc, TooManyRequestsError as cm, UnauthorizedError as co, ValidationError as cw, API_KEY_OPERATIONS as d0, DEFAULT_MAX_VERSIONS as d1, DEFAULT_PASSWORD_EMAILS as d2, FIELD_TYPE_BASES as d3, FOLDER_LEVELS as d4, MediaFolders as d5, SSO_COOKIE as d6, codeOfStatus as d7, isJsonLogger as d8, keyAllows as d9, logFormat as da };
3671
- 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 cB, WebhookEvent as cC, WebhookPayload as cD, Where as cE, WhereOperators as cF, SignupArgs as ca, SignupResult as cb, SlugField as cd, SlugOf as ce, SsoOutcome as cf, SsoProviderRef as cg, StorageAdapter as ch, StoredFile as ci, TelemetryConfig as cj, TextField as ck, TextareaField as cl, TypedPlugin as cn, UncountedDocs as cp, UpdateInput as cq, UpdateOptions as cr, UploadConfig as cs, UploadField as ct, UploadFromURLConfig as cu, UserIdentity as cv, Version as cx, VersionSummary as cy, VersionsConfig as cz, 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 };
3685
+ 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_KEYS as c$, WEBHOOK_EVENTS as cB, anyone as cH, consoleEmail as cI, consoleLogger as cJ, createEasyCMS as cK, defineConfig as cL, defineFieldType as cM, definePlugin as cN, diskStorage as cO, hasRows as cP, isAdmin as cQ, isHasMany as cR, isSignedIn as cS, isStaff as cT, isSystemAdmin as cU, jsonLogger as cV, memorySearch as cW, mimeAllowedBy as cX, rowFields as cY, silentLogger as cZ, uniqueWithinOf as c_, SingleSignOn as cc, TRIGRAM_LIKE_MIN as cj, TooManyRequestsError as cn, UnauthorizedError as cp, ValidationError as cx, API_KEY_GLOBAL_OPERATIONS as d0, API_KEY_OPERATIONS as d1, DEFAULT_MAX_VERSIONS as d2, DEFAULT_PASSWORD_EMAILS as d3, FIELD_TYPE_BASES as d4, FOLDER_LEVELS as d5, MediaFolders as d6, SSO_COOKIE as d7, codeOfStatus as d8, isJsonLogger as d9, keyAllows as da, logFormat as db };
3686
+ 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, VersionsConfig as cA, WebhookConfig as cC, WebhookEvent as cD, WebhookPayload as cE, Where as cF, WhereOperators as cG, SignupArgs as ca, SignupResult as cb, SlugField as cd, SlugOf as ce, SsoOutcome as cf, SsoProviderRef as cg, StorageAdapter as ch, StoredFile as ci, TelemetryConfig as ck, TextField as cl, TextareaField as cm, TypedPlugin as co, UncountedDocs as cq, UpdateInput as cr, UpdateOptions as cs, UploadConfig as ct, UploadField as cu, UploadFromURLConfig as cv, UserIdentity as cw, Version as cy, VersionSummary as cz, 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, 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-BLxN8qcy.js';
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-BODu0yjp.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;
@@ -45,6 +45,11 @@ declare function writeBackupFile<C extends Config>(cms: EasyCMS<C>, file: string
45
45
  type Localization = Required<LocalizationConfig>;
46
46
 
47
47
  type Data = Record<string, unknown>;
48
+ /**
49
+ * `name@host.tld`: no whitespace, one `@`, and a dot inside the part after it. String operations,
50
+ * not a regex: `/^[^\s@]+@[^\s@]+\.[^\s@]+$/` takes time quadratic in the length.
51
+ */
52
+ declare function isEmail(value: string): boolean;
48
53
  /**
49
54
  * Turns text into a URL slug. Keeps letters and digits of any script,
50
55
  * so Thai titles stay readable: "สวัสดี World!" → "สวัสดี-world".
@@ -193,5 +198,5 @@ declare function createRootEndpointHandler<C extends Config>(instance: EasyCMS<C
193
198
  /** A cookie of the request; the `__Host-` one (set over HTTPS) first. */
194
199
  declare function readCookie(request: Request, name: string): string | undefined;
195
200
 
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 };
201
+ export { CONFIG_FILE_NAMES as C, DEFAULT_ADMIN_PATH as D, platformClientIp as E, readCookie as F, validateFields as G, writeBackupFile as H, 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, isEmail as x, mergeForUpdate as y, parseId as z };
197
202
  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-BLxN8qcy.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 TelemetryConfig, ck as TextField, cl as TextareaField, cm as TooManyRequestsError, cn as TypedPlugin, co as UnauthorizedError, cp as UncountedDocs, cq as UpdateInput, cr as UpdateOptions, cs as UploadConfig, ct as UploadField, cu as UploadFromURLConfig, cv as UserIdentity, cw as ValidationError, cx as Version, cy as VersionSummary, cz as VersionsConfig, cA as WEBHOOK_EVENTS, cB as WebhookConfig, cC as WebhookEvent, cD as WebhookPayload, cE as Where, cF as WhereOperators, cG as anyone, cH as consoleEmail, cI as consoleLogger, cJ as createEasyCMS, cK as defineConfig, cL as defineFieldType, cM as definePlugin, cN as diskStorage, cO as hasRows, cP as isAdmin, cQ as isHasMany, cR as isSignedIn, cS as isStaff, cT as isSystemAdmin, cU as jsonLogger, cV as memorySearch, cW as mimeAllowedBy, cX as rowFields, cY as silentLogger, cZ as uniqueWithinOf } from './config-BLxN8qcy.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-JIb70PKm.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-BjlBwaiO.js';
1
+ import { P as PaginatedDocs, I as ID, E as EmailSetting } from './config-BODu0yjp.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 TRIGRAM_LIKE_MIN, ck as TelemetryConfig, cl as TextField, cm as TextareaField, cn as TooManyRequestsError, co as TypedPlugin, cp as UnauthorizedError, cq as UncountedDocs, cr as UpdateInput, cs as UpdateOptions, ct as UploadConfig, cu as UploadField, cv as UploadFromURLConfig, cw as UserIdentity, cx as ValidationError, cy as Version, cz as VersionSummary, cA as VersionsConfig, cB as WEBHOOK_EVENTS, cC as WebhookConfig, cD as WebhookEvent, cE as WebhookPayload, cF as Where, cG as WhereOperators, cH as anyone, cI as consoleEmail, cJ as consoleLogger, cK as createEasyCMS, cL as defineConfig, cM as defineFieldType, cN as definePlugin, cO as diskStorage, cP as hasRows, cQ as isAdmin, cR as isHasMany, cS as isSignedIn, cT as isStaff, cU as isSystemAdmin, cV as jsonLogger, cW as memorySearch, cX as mimeAllowedBy, cY as rowFields, cZ as silentLogger, c_ as uniqueWithinOf } from './config-BODu0yjp.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-PyUqbeK2.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-DOMtk2Vi.js';
5
5
  export { FieldCondition, matchesCondition } from './conditions.js';
6
6
 
7
7
  type DeliveryKind = 'webhook' | 'email';
package/dist/index.js CHANGED
@@ -26,7 +26,7 @@ import {
26
26
  sharedEasyCMS,
27
27
  silentLogger,
28
28
  slugify
29
- } from "./chunk-63UEVLN6.js";
29
+ } from "./chunk-WGECYA3K.js";
30
30
  import {
31
31
  matchesCondition
32
32
  } from "./chunk-U266LV4M.js";
@@ -51,7 +51,7 @@ import {
51
51
  defineFieldType,
52
52
  definePlugin,
53
53
  warnDeprecated
54
- } from "./chunk-RTKWMVAC.js";
54
+ } from "./chunk-RJGKAYUU.js";
55
55
  export {
56
56
  ADAPTER_API_VERSION,
57
57
  ADMIN_API_VERSION,
@@ -1,6 +1,6 @@
1
1
  import { Config, Database, EasyCMS, NavGroup, CollectionConfig, ID, RawDocument, Field, ResolvedConfig, ConfigIssue } from './index.js';
2
- export { c_ as API_KEYS, c$ as API_KEY_GLOBAL_OPERATIONS, d0 as API_KEY_OPERATIONS, d1 as DEFAULT_MAX_VERSIONS, d2 as DEFAULT_PASSWORD_EMAILS, d3 as FIELD_TYPE_BASES, d4 as FOLDER_LEVELS, d5 as MediaFolders, d6 as SSO_COOKIE, d7 as codeOfStatus, cO as hasRows, cQ as isHasMany, d8 as isJsonLogger, d9 as keyAllows, da as logFormat, cW as mimeAllowedBy, cX as rowFields, cZ as uniqueWithinOf } from './config-BLxN8qcy.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-BjlBwaiO.js';
2
+ export { c$ as API_KEYS, d0 as API_KEY_GLOBAL_OPERATIONS, d1 as API_KEY_OPERATIONS, d2 as DEFAULT_MAX_VERSIONS, d3 as DEFAULT_PASSWORD_EMAILS, d4 as FIELD_TYPE_BASES, d5 as FOLDER_LEVELS, d6 as MediaFolders, d7 as SSO_COOKIE, cj as TRIGRAM_LIKE_MIN, d8 as codeOfStatus, cP as hasRows, cR as isHasMany, d9 as isJsonLogger, da as keyAllows, db as logFormat, cX as mimeAllowedBy, cY as rowFields, c_ as uniqueWithinOf } from './config-BODu0yjp.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 isEmail, y as mergeForUpdate, z as parseId, E as platformClientIp, F as readCookie, G as validateFields, H as writeBackupFile } from './handler-DOMtk2Vi.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
@@ -41,6 +41,7 @@ import {
41
41
  healthResponse,
42
42
  honeypotName,
43
43
  importConfig,
44
+ isEmail,
44
45
  isJsonLogger,
45
46
  keyAllows,
46
47
  logFormat,
@@ -56,7 +57,7 @@ import {
56
57
  verifyPassword,
57
58
  verifyTurnstile,
58
59
  writeBackupFile
59
- } from "./chunk-63UEVLN6.js";
60
+ } from "./chunk-WGECYA3K.js";
60
61
  import {
61
62
  conditionIssues
62
63
  } from "./chunk-U266LV4M.js";
@@ -64,6 +65,7 @@ import {
64
65
  EXTENSIONS,
65
66
  FIELD_TYPE_BASES,
66
67
  MIME_GROUPS,
68
+ TRIGRAM_LIKE_MIN,
67
69
  codeOfStatus,
68
70
  expandMimeTypes,
69
71
  hasRows,
@@ -74,7 +76,7 @@ import {
74
76
  rowFields,
75
77
  sniffMimeType,
76
78
  uniqueWithinOf
77
- } from "./chunk-RTKWMVAC.js";
79
+ } from "./chunk-RJGKAYUU.js";
78
80
 
79
81
  // src/typegen.ts
80
82
  var pascal = (name) => name.split(/[^A-Za-z0-9]+/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
@@ -270,6 +272,7 @@ export {
270
272
  MediaFolders,
271
273
  SESSION_COOKIE,
272
274
  SSO_COOKIE,
275
+ TRIGRAM_LIKE_MIN,
273
276
  applyDefaults,
274
277
  applyPlugins,
275
278
  checkFormToken,
@@ -293,6 +296,7 @@ export {
293
296
  honeypotName,
294
297
  imageDimensions,
295
298
  importConfig,
299
+ isEmail,
296
300
  isHasMany,
297
301
  isJsonLogger,
298
302
  keyAllows,
@@ -1,4 +1,4 @@
1
- import { be as Label, aF as Field, I as ID, k as AdminLocale, t as AdminSwitcher, cg as SsoProviderRef } from './config-BLxN8qcy.js';
1
+ import { be as Label, aF as Field, I as ID, k as AdminLocale, t as AdminSwitcher, cg as SsoProviderRef } from './config-BODu0yjp.js';
2
2
  import { FieldCondition } from './conditions.js';
3
3
 
4
4
  /** A Web Component from an admin module, with its `props` (plain JSON). */
@@ -123,6 +123,8 @@ interface AdminCollection {
123
123
  };
124
124
  icon?: string;
125
125
  useAsTitle?: string;
126
+ /** Searches by title wait for this many characters (a title with `index: 'trigram'`). */
127
+ searchMin?: number;
126
128
  /** Documents open in a panel over the list. */
127
129
  editIn?: 'drawer';
128
130
  drafts: boolean;
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, 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, cm as TooManyRequestsError, cn as TypedPlugin, co as UnauthorizedError, cw as ValidationError, cE as Where, cL as defineFieldType, cM as definePlugin } from './config-BLxN8qcy.js';
2
- export { A as ADMIN_API_VERSION, c as AdminElementProps, k as AdminPageRoute, S as SetFieldDetail, w as warnDeprecated } from './plugin-JIb70PKm.js';
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, cn as TooManyRequestsError, co as TypedPlugin, cp as UnauthorizedError, cx as ValidationError, cF as Where, cM as defineFieldType, cN as definePlugin } from './config-BODu0yjp.js';
2
+ export { A as ADMIN_API_VERSION, c as AdminElementProps, k as AdminPageRoute, S as SetFieldDetail, w as warnDeprecated } from './plugin-PyUqbeK2.js';
3
3
  import './conditions.js';
package/dist/plugin.js CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  defineFieldType,
17
17
  definePlugin,
18
18
  warnDeprecated
19
- } from "./chunk-RTKWMVAC.js";
19
+ } from "./chunk-RJGKAYUU.js";
20
20
  export {
21
21
  ADMIN_API_VERSION,
22
22
  ADMIN_ICONS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easy-cms/core",
3
- "version": "1.15.0",
3
+ "version": "1.16.0",
4
4
  "description": "Embedded, code-first headless CMS for Nuxt and Next.js",
5
5
  "license": "MIT",
6
6
  "type": "module",