riverbankcms 0.4.2 → 0.5.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/README.md CHANGED
@@ -30,3 +30,42 @@ a new identifier, or delete and upload the asset again in the dashboard.
30
30
  Every persisted media asset now has a canonical, site-unique identifier. Backup
31
31
  restore preserves an existing asset's identifier and rejects an archive that
32
32
  tries to replace it.
33
+
34
+ ## Media library commands
35
+
36
+ Linked SDK projects can manage library assets by stable identifier:
37
+
38
+ ```sh
39
+ riverbankcms media add ./hero.jpg --env local
40
+ riverbankcms media list --search hero --env both
41
+ riverbankcms media download hero --output ./downloads --env remote
42
+ riverbankcms media delete hero --dry-run --env both
43
+ riverbankcms media delete hero --yes --env both
44
+ ```
45
+
46
+ `media add` accepts explicit regular files only. For multiple files, identifiers
47
+ come from filenames; `--identifier` and `--title` are single-file options. Add
48
+ and delete preflight every selected environment before mutation, and delete
49
+ refuses assets still referenced by content. `media download` preserves the
50
+ stored safe filename, refuses overwrites unless `--overwrite` is present, and
51
+ uses `local/` and `remote/` subdirectories for `--env both`.
52
+
53
+ These commands manage library records and bytes. They do not rewrite media
54
+ references inside pages, entries, blocks, or other content.
55
+
56
+ ## Account site backups
57
+
58
+ Signed-in account owners can export a safe-profile backup and import it as a
59
+ new, independent site without linking a project:
60
+
61
+ ```sh
62
+ riverbankcms sites export my-site --account-env staging
63
+ riverbankcms sites import my-site-backup.zip --account-env local
64
+ ```
65
+
66
+ Exports include media and exclude memberships, access, and credentials. The
67
+ default filename is `<site-slug>-backup.zip`; existing files require
68
+ `--overwrite`. Imports are limited to 100 MB, show the server preview before a
69
+ single confirmation, always create a fresh site identity, and never run
70
+ `riverbankcms link` automatically. Use `--yes` for JSON or non-interactive
71
+ imports.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import "../src-BRAF1Dee.mjs";
3
- import "../sdk-event-upsert-C6zsxDcf.mjs";
4
- import { t as eventUpsertInputSchema } from "../eventUpsertInputSchema-Dg60PKJI.mjs";
2
+ import "../src-DKm0bLEA.mjs";
3
+ import "../sdk-event-upsert-Dy08IXYL.mjs";
4
+ import { t as eventUpsertInputSchema } from "../eventUpsertInputSchema-7QFvBuxF.mjs";
5
5
 
6
6
  //#region src/acceptance/matrix-builders.ts
7
7
  const workflow = (scenario, stepId) => ({
@@ -56,6 +56,18 @@ const writeFileStep = (id, path, content) => ({
56
56
  path,
57
57
  content: `${JSON.stringify(content, null, 2)}\n`
58
58
  });
59
+ const writeBase64FileStep = (id, path, base64) => ({
60
+ kind: "write_base64_file",
61
+ id,
62
+ path,
63
+ base64
64
+ });
65
+ const assertFilesEqualStep = (id, leftPath, rightPath) => ({
66
+ kind: "assert_files_equal",
67
+ id,
68
+ leftPath,
69
+ rightPath
70
+ });
59
71
  const assertJsonFileStep = (id, path, jsonPath, expected) => ({
60
72
  kind: "assert_json_file",
61
73
  id,
@@ -301,6 +313,174 @@ const bookingSettingsScenario = {
301
313
  ]
302
314
  };
303
315
 
316
+ //#endregion
317
+ //#region src/acceptance/media-scenario.ts
318
+ const ONE_PIXEL_PNG = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAOaQqR0AAAAASUVORK5CYII=";
319
+ const mediaScenario = {
320
+ id: "media-library-lifecycle",
321
+ steps: [
322
+ writeBase64FileStep("fixture", ".acceptance/media/acceptance-media.png", ONE_PIXEL_PNG),
323
+ commandStep("add", "media add", [
324
+ "media",
325
+ "add",
326
+ ".acceptance/media/acceptance-media.png",
327
+ "--identifier",
328
+ "acceptance-media",
329
+ "--yes",
330
+ "--env=local",
331
+ "--json"
332
+ ], { jsonAssertions: [{
333
+ jsonPath: [
334
+ "result",
335
+ "environments",
336
+ "0",
337
+ "result",
338
+ "items",
339
+ "0",
340
+ "status"
341
+ ],
342
+ expected: "created"
343
+ }] }),
344
+ commandStep("repeat", "media add", [
345
+ "media",
346
+ "add",
347
+ ".acceptance/media/acceptance-media.png",
348
+ "--identifier",
349
+ "acceptance-media",
350
+ "--yes",
351
+ "--env=local",
352
+ "--json"
353
+ ], { jsonAssertions: [{
354
+ jsonPath: [
355
+ "result",
356
+ "environments",
357
+ "0",
358
+ "result",
359
+ "items",
360
+ "0",
361
+ "status"
362
+ ],
363
+ expected: "unchanged"
364
+ }] }),
365
+ commandStep("alias-conflict", "media add", [
366
+ "media",
367
+ "add",
368
+ ".acceptance/media/acceptance-media.png",
369
+ "--identifier",
370
+ "acceptance-media-alias",
371
+ "--yes",
372
+ "--env=local",
373
+ "--json"
374
+ ], { expectedExitCode: 1 }),
375
+ commandStep("list", "media list", [
376
+ "media",
377
+ "list",
378
+ "--search",
379
+ "acceptance-media",
380
+ "--env=local",
381
+ "--json"
382
+ ], { jsonAssertions: [{
383
+ jsonPath: [
384
+ "result",
385
+ "environments",
386
+ "0",
387
+ "result",
388
+ "items",
389
+ "0",
390
+ "identifier"
391
+ ],
392
+ expected: "acceptance-media"
393
+ }] }),
394
+ commandStep("download", "media download", [
395
+ "media",
396
+ "download",
397
+ "acceptance-media",
398
+ "--output",
399
+ ".acceptance/media-download",
400
+ "--env=local",
401
+ "--json"
402
+ ]),
403
+ assertFilesEqualStep("download-local-equal", ".acceptance/media/acceptance-media.png", ".acceptance/media-download/acceptance-media.png"),
404
+ commandStep("reference-page", "page upsert", [
405
+ "page",
406
+ "upsert",
407
+ "acceptance-media-page",
408
+ "--title",
409
+ "CLI acceptance media page",
410
+ "--path",
411
+ "/cli-acceptance-media",
412
+ "--env=local",
413
+ "--json"
414
+ ]),
415
+ commandStep("reference-block", "block upsert", [
416
+ "block",
417
+ "upsert",
418
+ capture("reference-page", "result", "identifier"),
419
+ "acceptance-media-block",
420
+ "--kind",
421
+ "block.media-text",
422
+ "--data",
423
+ JSON.stringify({
424
+ text: richText("CLI acceptance media reference."),
425
+ images: [{ image: { identifier: "acceptance-media" } }]
426
+ }),
427
+ "--env=local",
428
+ "--json"
429
+ ]),
430
+ commandStep("guarded-delete", "media delete", [
431
+ "media",
432
+ "delete",
433
+ "acceptance-media",
434
+ "--yes",
435
+ "--env=local",
436
+ "--json"
437
+ ], { expectedExitCode: 1 }),
438
+ commandStep("remove-reference", "delete block", [
439
+ "delete",
440
+ "block",
441
+ capture("reference-page", "result", "identifier"),
442
+ capture("reference-block", "result", "identifier"),
443
+ "--yes",
444
+ "--env=local",
445
+ "--json"
446
+ ]),
447
+ commandStep("delete-preview", "media delete", [
448
+ "media",
449
+ "delete",
450
+ "acceptance-media",
451
+ "--dry-run",
452
+ "--env=local",
453
+ "--json"
454
+ ], { jsonAssertions: [{
455
+ jsonPath: [
456
+ "result",
457
+ "environments",
458
+ "0",
459
+ "result",
460
+ "kind"
461
+ ],
462
+ expected: "dry_run"
463
+ }] }),
464
+ commandStep("delete", "media delete", [
465
+ "media",
466
+ "delete",
467
+ "acceptance-media",
468
+ "--yes",
469
+ "--env=local",
470
+ "--json"
471
+ ], { jsonAssertions: [{
472
+ jsonPath: [
473
+ "result",
474
+ "environments",
475
+ "0",
476
+ "result",
477
+ "kind"
478
+ ],
479
+ expected: "deleted"
480
+ }] })
481
+ ]
482
+ };
483
+
304
484
  //#endregion
305
485
  //#region src/acceptance/matrix.ts
306
486
  const entryScenario = {
@@ -749,6 +929,10 @@ const acceptanceTuples = [
749
929
  "--json"
750
930
  ])],
751
931
  ["settings booking configure", workflow(bookingSettingsScenario, "apply")],
932
+ ["media add", workflow(mediaScenario, "add")],
933
+ ["media list", workflow(mediaScenario, "list")],
934
+ ["media download", workflow(mediaScenario, "download")],
935
+ ["media delete", workflow(mediaScenario, "delete")],
752
936
  ["login", scratchExecute([
753
937
  "login",
754
938
  "--account-env=local",
@@ -786,6 +970,21 @@ const acceptanceTuples = [
786
970
  "--yes",
787
971
  "--json"
788
972
  ], { expectedExitCode: 1 })],
973
+ ["sites export", scratchExecute([
974
+ "sites",
975
+ "export",
976
+ "acceptance-site",
977
+ "--account-env=local",
978
+ "--json"
979
+ ], { expectedExitCode: 1 })],
980
+ ["sites import", scratchExecute([
981
+ "sites",
982
+ "import",
983
+ "acceptance-backup.zip",
984
+ "--account-env=local",
985
+ "--yes",
986
+ "--json"
987
+ ], { expectedExitCode: 1 })],
789
988
  ["link", scratchExecute([
790
989
  "link",
791
990
  "--project",