easy-cms 1.11.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  run
4
- } from "./chunk-BKK4GU35.js";
4
+ } from "./chunk-L3XDY7HM.js";
5
5
 
6
6
  // src/bin.ts
7
7
  process.exitCode = await run(process.argv.slice(2));
@@ -210,6 +210,7 @@ Commands:
210
210
  admin:create Create an admin user (also: create-admin)
211
211
  serve Run the CMS as its own server (admin + REST API)
212
212
  jobs:run Run due scheduled publishes, jobs, webhook and email retries (also: run-scheduled)
213
+ search:reindex [slug] Build the search index again from the database
213
214
  backup <file> Copy the database to a SQLite file while the CMS runs
214
215
  backup:decrypt <file> Decrypt a backup made with backups.encryptionKey
215
216
  copy --from <config> Copy all content from another config's database into this one
@@ -275,6 +276,12 @@ Stop writing to the source while copying, or copy from a backup.
275
276
 
276
277
  Runs due scheduled publishes and unpublishes, and retries failed webhook deliveries, once:
277
278
  for a cron job where no server process keeps running. Servers do this every minute on their own.
279
+ `,
280
+ "search:reindex": `Usage: easy-cms search:reindex [collection] [options]
281
+
282
+ Builds the search index (\`search\` in the config) again from the published documents of every
283
+ collection with \`search\`, or of one: after adding \`search\` to a collection or changing its
284
+ fields, or when indexing failed. An in-memory index (memorySearch) is built when the server starts.
278
285
  `,
279
286
  serve: `Usage: easy-cms serve [--port <n>] [--host <host>] [--watch] [--trust-proxy] [options]
280
287
 
@@ -399,7 +406,7 @@ async function run(argv, io = defaultIO) {
399
406
  return 0;
400
407
  }
401
408
  case "jobs:run": {
402
- const { scheduled, webhooks, emails } = await cms.runJobs();
409
+ const { scheduled, webhooks, emails, outbox } = await cms.runJobs();
403
410
  const { ran, failed } = scheduled;
404
411
  io.out(`Ran ${ran} scheduled job(s)${failed ? `, ${failed} failed` : ""}.`);
405
412
  if (webhooks.sent || webhooks.failed)
@@ -410,8 +417,28 @@ async function run(argv, io = defaultIO) {
410
417
  io.out(
411
418
  `Retried emails: ${emails.sent} sent${emails.failed ? `, ${emails.failed} gave up` : ""}.`
412
419
  );
420
+ if (outbox.ran || outbox.failed)
421
+ io.out(
422
+ `Outbox: ${outbox.ran} ran${outbox.failed ? `, ${outbox.failed} failed (retried later)` : ""}.`
423
+ );
413
424
  return failed ? 1 : 0;
414
425
  }
426
+ case "search:reindex": {
427
+ if (!cms.config.search) {
428
+ io.err("Set `search` in the config first, e.g. search: memorySearch().");
429
+ return 1;
430
+ }
431
+ if (cms.config.search.ephemeral) {
432
+ io.out(
433
+ "This search index lives in the memory of the server process and is built when it starts: restart the server instead."
434
+ );
435
+ return 0;
436
+ }
437
+ const slug = rest.join(" ").trim();
438
+ for (const done of await cms.reindexSearch(slug || void 0))
439
+ io.out(`Indexed ${done.documents} document(s) of ${done.collection}.`);
440
+ return 0;
441
+ }
415
442
  case "migrate": {
416
443
  const applied = await cms.db.migrate();
417
444
  io.out(
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  createStandaloneHandler,
3
3
  run,
4
4
  startServer
5
- } from "./chunk-BKK4GU35.js";
5
+ } from "./chunk-L3XDY7HM.js";
6
6
  export {
7
7
  createStandaloneHandler,
8
8
  run,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-cms",
3
- "version": "1.11.0",
3
+ "version": "1.13.0",
4
4
  "description": "Command line tool for Easy CMS",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -21,11 +21,11 @@
21
21
  "node": ">=22.12"
22
22
  },
23
23
  "dependencies": {
24
- "@easy-cms/core": "^1.11.0",
25
- "@easy-cms/admin": "^1.11.0"
24
+ "@easy-cms/core": "^1.13.0",
25
+ "@easy-cms/admin": "^1.13.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@easy-cms/db-sqlite": "^1.11.0"
28
+ "@easy-cms/db-sqlite": "^1.13.0"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public"