@easy-cms/core 0.49.0 → 0.61.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.
@@ -369,6 +369,23 @@ function defineConfig(config) {
369
369
  return config;
370
370
  }
371
371
 
372
+ // src/deprecation.ts
373
+ var KEY = /* @__PURE__ */ Symbol.for("easy-cms.deprecations");
374
+ function warned() {
375
+ const store = globalThis;
376
+ store[KEY] ??= /* @__PURE__ */ new Set();
377
+ return store[KEY];
378
+ }
379
+ function warnDeprecated(code, message) {
380
+ const seen = warned();
381
+ if (seen.has(code)) return;
382
+ seen.add(code);
383
+ const node = globalThis.process;
384
+ if (typeof node?.emitWarning === "function")
385
+ node.emitWarning(message, { type: "DeprecationWarning", code });
386
+ else console.warn(`[${code}] DeprecationWarning: ${message}`);
387
+ }
388
+
372
389
  // src/field-types.ts
373
390
  var FIELD_TYPE_BASES = [
374
391
  "text",
@@ -527,6 +544,7 @@ export {
527
544
  PLUGIN_API_VERSION,
528
545
  definePlugin,
529
546
  defineConfig,
547
+ warnDeprecated,
530
548
  FIELD_TYPE_BASES,
531
549
  defineFieldType,
532
550
  fieldTypeModules,
@@ -32,8 +32,9 @@ import {
32
32
  storageKey,
33
33
  typeFromName,
34
34
  uniqueWithinOf,
35
+ warnDeprecated,
35
36
  withPrivacy
36
- } from "./chunk-CGVNZUW4.js";
37
+ } from "./chunk-FPFWLQB5.js";
37
38
 
38
39
  // src/access.ts
39
40
  var isSystemAdmin = (user) => user?.role === "admin" && !user.apiKey && user.scoped !== true;
@@ -8788,7 +8789,7 @@ async function readAdminModule(cms, index) {
8788
8789
  }
8789
8790
 
8790
8791
  // src/version.ts
8791
- var VERSION = true ? "0.49.0" : "0.0.0-dev";
8792
+ var VERSION = true ? "0.61.0" : "0.0.0-dev";
8792
8793
 
8793
8794
  // src/rest/admin-deliveries.ts
8794
8795
  var PER_PAGE = 50;
@@ -9895,6 +9896,11 @@ async function route(cms, ctx, method, path, options) {
9895
9896
  if (first === "admin" && ctx.user?.member === true) throw new ForbiddenError();
9896
9897
  const authAction = third === void 0 && second !== void 0 ? first === "auth" && AUTH_ACTIONS.has(second) || first === USERS && !/^\d+$/.test(second) : false;
9897
9898
  if (first === "auth" && !authAction) return ssoRoute(cms, ctx, method, segments);
9899
+ if (authAction && first === USERS && second !== void 0 && AUTH_ACTIONS.has(second))
9900
+ warnDeprecated(
9901
+ "EASY_CMS_DEP001",
9902
+ `${method} <api>/users/${second} is now <api>/auth/${second}; the old path works through 1.x.`
9903
+ );
9898
9904
  if (authAction && second !== void 0) {
9899
9905
  switch (`${method} ${second}`) {
9900
9906
  case "POST login": {
@@ -10303,6 +10309,8 @@ async function route(cms, ctx, method, path, options) {
10303
10309
  return { body: await cms.findGlobal(second, { ...access, ...parseDepth(ctx.url), draft }) };
10304
10310
  }
10305
10311
  if (method === "PATCH" || method === "POST") {
10312
+ if (method === "POST")
10313
+ warnDeprecated("EASY_CMS_DEP002", "Globals are updated with PATCH; POST works through 1.x.");
10306
10314
  const body = await readJson(ctx.request);
10307
10315
  return { body: await cms.updateGlobal(second, body, { ...access, ...parseDepth(ctx.url) }) };
10308
10316
  }
@@ -10550,7 +10558,13 @@ function scheduleJob(body) {
10550
10558
  }
10551
10559
  function parseLocale(url) {
10552
10560
  const locale = url.searchParams.get("locale");
10553
- const fallback = url.searchParams.get("fallbackLocale") ?? url.searchParams.get("fallback-locale");
10561
+ const old = url.searchParams.get("fallback-locale");
10562
+ if (old !== null)
10563
+ warnDeprecated(
10564
+ "EASY_CMS_DEP003",
10565
+ "?fallback-locale= is now ?fallbackLocale=; the old name works through 1.x."
10566
+ );
10567
+ const fallback = url.searchParams.get("fallbackLocale") ?? old;
10554
10568
  return {
10555
10569
  ...locale ? { locale } : {},
10556
10570
  ...fallback === "false" || fallback === "true" ? { fallbackLocale: fallback === "true" } : {}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { P as PaginatedDocs, I as ID, E as EmailSetting } from './config-jzFGsNL6.js';
2
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 CustomField, aj as CustomFieldTypes, ak as DashboardWidget, al as Database, am as DatabaseAdapter, an as DatabaseInitArgs, ao as DatabaseTransfer, ap as DateField, aq as DepthOptions, ar as DirectUpload, as as DiskStorageOptions, at as DocumentOf, au as EasyCMS, av as EasyCMSError, aw as EmailAdapter, ax as EmailField, ay as EmailMessage, az as Endpoint, aA as EndpointRequest, aB as ErrorCode, aC as FIELD_TYPES, aD as Field, aE as FieldAccess, aF as FieldAccessFn, aG as FieldAdmin, aH as FieldError, aI as FieldRule, aJ as FieldType, aK as FieldTypeBase, aL as FieldTypeDefinition, aM as FieldTypeValidateContext, aN as FieldValidate, aO as FieldValidateContext, aP as FieldValue, aQ as FieldsInput, aR as FieldsValue, aS as FilterOptions, aT as FilterOptionsArgs, aU as FindArgs, aV as FindOptions, aW as FolderLevel, aX as FolderPermissions, aY as ForbiddenError, aZ as GlobalAccess, a_ as GlobalConfig, a$ as GlobalDocument, b0 as GlobalHooks, b1 as GlobalInput, b2 as GlobalSlug, b3 as GroupField, b4 as ImageSize, b5 as IncrementOptions, b6 as InferCollection, b7 as InferGlobal, b8 as JobConfig, b9 as JsonField, ba as Label, bb as LayoutNode, bc as LivePreview, bd as LocalizationConfig, be as Logger, bf as LoginArgs, bg as MediaDocument, bh as MediaSize, bi as MembersConfig, bj as MembersSignup, bk as MigrationInfo, bl as NavGroup, bm as NotFoundError, bn as NumberField, bo as OnRequest, bp as OnRequestArgs, bq as Operation, br as PLUGIN_API_VERSION, bs as PasswordEmail, bt as PasswordEmailArgs, bu as PasswordEmailFn, bv as PasswordLinkOptions, bw as PayloadTooLargeError, bx as Plugin, by as PluginInfo, bz as PluginTypes, bA as PreviewTarget, bB as PreviewURL, bC as QueryError, bD as ROLE_OPERATIONS, bE as RawDocument, bF as ReadOptions, bG as RelationshipField, bH as RequestContext, bI as ResolvedConfig, bJ as RichTextDocument, bK as RichTextField, bL as Role, bM as RoleOperation, bN as RolePermissions, bO as Roles, bP as RoutesConfig, bQ as ScheduledPublish, bR as SchemaError, bS as SchemaMode, bT as SelectField, bU as SelectOption, bV as Session, bW as SidebarPanel, bX as SignupArgs, bY as SignupResult, bZ as SingleSignOn, b_ as SlugField, b$ as SlugOf, c0 as SsoOutcome, c1 as SsoProviderRef, c2 as StorageAdapter, c3 as StoredFile, c4 as TextField, c5 as TextareaField, c6 as TooManyRequestsError, c7 as TypedPlugin, c8 as UnauthorizedError, c9 as UpdateInput, ca as UpdateOptions, cb as UploadConfig, cc as UploadField, cd as UploadFromURLConfig, ce as UserIdentity, cf as ValidationError, cg as Version, ch as VersionSummary, ci as VersionsConfig, cj as WEBHOOK_EVENTS, ck as WebhookConfig, cl as WebhookEvent, cm as WebhookPayload, cn as Where, co as WhereOperators, cp as anyone, cq as consoleEmail, cr as consoleLogger, cs as createEasyCMS, ct as defineConfig, cu as defineFieldType, cv as definePlugin, cw as diskStorage, cx as hasRows, cy as isAdmin, cz as isHasMany, cA as isSignedIn, cB as isStaff, cC as isSystemAdmin, cD as mimeAllowedBy, cE as rowFields, cF as silentLogger, cG as uniqueWithinOf } from './config-jzFGsNL6.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 } from './plugin-EX9OHwR3.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-C19Bt8ux.js';
4
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-CMA1LIq7.js';
5
5
  export { FieldCondition, matchesCondition } from './conditions.js';
6
6
 
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ import {
23
23
  sharedEasyCMS,
24
24
  silentLogger,
25
25
  slugify
26
- } from "./chunk-4PGEDNBY.js";
26
+ } from "./chunk-HTE5O3EG.js";
27
27
  import {
28
28
  matchesCondition
29
29
  } from "./chunk-U266LV4M.js";
@@ -46,8 +46,9 @@ import {
46
46
  ValidationError,
47
47
  defineConfig,
48
48
  defineFieldType,
49
- definePlugin
50
- } from "./chunk-CGVNZUW4.js";
49
+ definePlugin,
50
+ warnDeprecated
51
+ } from "./chunk-FPFWLQB5.js";
51
52
  export {
52
53
  ADAPTER_API_VERSION,
53
54
  ADMIN_API_VERSION,
@@ -90,5 +91,6 @@ export {
90
91
  resolveConfig,
91
92
  sharedEasyCMS,
92
93
  silentLogger,
93
- slugify
94
+ slugify,
95
+ warnDeprecated
94
96
  };
package/dist/internal.js CHANGED
@@ -52,7 +52,7 @@ import {
52
52
  verifyPassword,
53
53
  verifyTurnstile,
54
54
  writeBackupFile
55
- } from "./chunk-4PGEDNBY.js";
55
+ } from "./chunk-HTE5O3EG.js";
56
56
  import {
57
57
  conditionIssues
58
58
  } from "./chunk-U266LV4M.js";
@@ -70,7 +70,7 @@ import {
70
70
  rowFields,
71
71
  sniffMimeType,
72
72
  uniqueWithinOf
73
- } from "./chunk-CGVNZUW4.js";
73
+ } from "./chunk-FPFWLQB5.js";
74
74
 
75
75
  // src/typegen.ts
76
76
  var pascal = (name) => name.split(/[^A-Za-z0-9]+/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
@@ -323,4 +323,18 @@ interface SetFieldDetail {
323
323
  readonly value: unknown;
324
324
  }
325
325
 
326
- export { ADMIN_API_VERSION as A, type SetFieldDetail as S, type AdminCollection as a, type AdminComponentRef as b, type AdminElementProps as c, type AdminField as d, type AdminGlobal as e, type AdminLayoutNode as f, type AdminNavGroup as g, type AdminNavItem as h, type AdminNavNode as i, type AdminPageRef as j, type AdminPageRoute as k, type AdminSchema as l, type AdminWidgetRef as m };
326
+ /**
327
+ * Logs that something deprecated was used, once per `code` and process. On Node.js it is a
328
+ * `DeprecationWarning` (`process.emitWarning`), so `--no-deprecation` hides it,
329
+ * `--throw-deprecation` turns it into an error and `--trace-deprecation` shows where it came
330
+ * from; elsewhere `console.warn`.
331
+ *
332
+ * Plugins use codes of their own, e.g. `ACME_SEO_DEP001`.
333
+ *
334
+ * ```ts
335
+ * warnDeprecated('ACME_DEP001', '`acmePlugin({ key })` is now `apiKey`; `key` goes in 2.0.')
336
+ * ```
337
+ */
338
+ declare function warnDeprecated(code: string, message: string): void;
339
+
340
+ export { ADMIN_API_VERSION as A, type SetFieldDetail as S, type AdminCollection as a, type AdminComponentRef as b, type AdminElementProps as c, type AdminField as d, type AdminGlobal as e, type AdminLayoutNode as f, type AdminNavGroup as g, type AdminNavItem as h, type AdminNavNode as i, type AdminPageRef as j, type AdminPageRoute as k, type AdminSchema as l, type AdminWidgetRef as m, warnDeprecated as w };
package/dist/plugin.d.ts CHANGED
@@ -1,3 +1,3 @@
1
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, ak as DashboardWidget, av as EasyCMSError, az as Endpoint, aA as EndpointRequest, aB as ErrorCode, aD as Field, aE as FieldAccess, aH as FieldError, aK as FieldTypeBase, aL as FieldTypeDefinition, aM as FieldTypeValidateContext, aY as ForbiddenError, a_ as GlobalConfig, I as ID, b8 as JobConfig, ba as Label, bl as NavGroup, bm as NotFoundError, bo as OnRequest, bp as OnRequestArgs, br as PLUGIN_API_VERSION, bw as PayloadTooLargeError, bx as Plugin, by as PluginInfo, bz as PluginTypes, bC as QueryError, bH as RequestContext, c6 as TooManyRequestsError, c7 as TypedPlugin, c8 as UnauthorizedError, cf as ValidationError, cn as Where, cu as defineFieldType, cv as definePlugin } from './config-jzFGsNL6.js';
2
- export { A as ADMIN_API_VERSION, c as AdminElementProps, k as AdminPageRoute, S as SetFieldDetail } from './plugin-EX9OHwR3.js';
2
+ export { A as ADMIN_API_VERSION, c as AdminElementProps, k as AdminPageRoute, S as SetFieldDetail, w as warnDeprecated } from './plugin-C19Bt8ux.js';
3
3
  import './conditions.js';
package/dist/plugin.js CHANGED
@@ -14,8 +14,9 @@ import {
14
14
  UnauthorizedError,
15
15
  ValidationError,
16
16
  defineFieldType,
17
- definePlugin
18
- } from "./chunk-CGVNZUW4.js";
17
+ definePlugin,
18
+ warnDeprecated
19
+ } from "./chunk-FPFWLQB5.js";
19
20
  export {
20
21
  ADMIN_API_VERSION,
21
22
  ADMIN_ICONS,
@@ -30,5 +31,6 @@ export {
30
31
  UnauthorizedError,
31
32
  ValidationError,
32
33
  defineFieldType,
33
- definePlugin
34
+ definePlugin,
35
+ warnDeprecated
34
36
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easy-cms/core",
3
- "version": "0.49.0",
3
+ "version": "0.61.0",
4
4
  "description": "Embedded, code-first headless CMS for Nuxt and Next.js",
5
5
  "license": "MIT",
6
6
  "type": "module",