riverbankcms 0.22.2 → 0.24.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.
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { _ as normalizeLinkValue, a as classifySdkEventSchedule, g as linkSchema, i as sdkEventUpsertOptionalFieldSchemas, n as sdkCourseBookingSettingsSchema, o as classifySdkEventBookingOffer } from "./sdk-event-upsert-zWw5VolM.mjs";
3
- import { u as EVENT_PRESET_VALUES } from "./src-ZACBG29u.mjs";
2
+ import { _ as normalizeLinkValue, a as classifySdkEventSchedule, g as linkSchema, i as sdkEventUpsertOptionalFieldSchemas, n as sdkCourseBookingSettingsSchema, o as classifySdkEventBookingOffer } from "./sdk-event-upsert-DmNSeHgP.mjs";
3
+ import { d as EVENT_PRESET_VALUES } from "./src-B03aw4Tv.mjs";
4
4
  import { z } from "zod";
5
5
 
6
6
  //#region ../blocks/src/lib/typeGuards.ts
@@ -2311,6 +2311,53 @@ const BINDING_TRANSFORM_VALUES = Object.values(BINDING_TRANSFORMS);
2311
2311
  //#endregion
2312
2312
  //#region ../content-model/src/templates/types.ts
2313
2313
  const TEMPLATE_BINDING_TRANSFORMS = BINDING_TRANSFORMS;
2314
+ function isUnknownArray(value) {
2315
+ return Array.isArray(value);
2316
+ }
2317
+ function readTemplateFallbackOptions(binding) {
2318
+ if (typeof binding !== "object" || binding === null) return undefined;
2319
+ if ("options" in binding && isUnknownArray(binding.options)) return binding.options;
2320
+ return "sources" in binding && isUnknownArray(binding.sources) ? binding.sources : undefined;
2321
+ }
2322
+ function normalizeStoredBindingDescriptor(value) {
2323
+ return typeof value === "object" && value !== null && "source" in value && value.source === "fallback" ? {
2324
+ ...value,
2325
+ options: readTemplateFallbackOptions(value)
2326
+ } : value;
2327
+ }
2328
+ /** Parse stored binding values without treating malformed descriptors as nested records. */
2329
+ const bindingDescriptorSchema = z.lazy(() => z.preprocess(normalizeStoredBindingDescriptor, bindingDescriptorVariants));
2330
+ const bindingValueSchema = z.lazy(() => z.union([
2331
+ z.string(),
2332
+ bindingDescriptorSchema,
2333
+ z.record(z.string(), bindingValueSchema).refine((record) => typeof record.source !== "string" || !descriptorSources.has(record.source), "Malformed binding descriptor")
2334
+ ]));
2335
+ const bindingDescriptorVariants = z.discriminatedUnion("source", [
2336
+ z.object({
2337
+ source: z.literal("field"),
2338
+ path: z.string()
2339
+ }),
2340
+ z.object({
2341
+ source: z.literal("meta"),
2342
+ path: z.string()
2343
+ }),
2344
+ z.object({
2345
+ source: z.literal("literal"),
2346
+ value: z.unknown()
2347
+ }),
2348
+ z.object({
2349
+ source: z.literal("transform"),
2350
+ transform: z.enum(BINDING_TRANSFORM_VALUES),
2351
+ path: z.string().optional(),
2352
+ input: z.union([bindingDescriptorSchema, z.string()]).optional()
2353
+ }),
2354
+ z.object({
2355
+ source: z.literal("fallback"),
2356
+ options: z.array(bindingValueSchema)
2357
+ })
2358
+ ]);
2359
+ const descriptorSources = new Set(bindingDescriptorVariants.options.map((variant) => variant.shape.source.value));
2360
+ const TemplateBindingRecordSchema = z.record(z.string(), bindingValueSchema);
2314
2361
 
2315
2362
  //#endregion
2316
2363
  //#region ../content-model/src/templates/bindingBuilders.ts
@@ -2584,6 +2631,10 @@ function validateBlockKindForEntrySlot(definition, blockKind) {
2584
2631
  }
2585
2632
  return ok(normalized);
2586
2633
  }
2634
+ /**
2635
+ * Kinds that read the entry a template is rendering (its event, its slots),
2636
+ * so they have nothing to show anywhere but a content type's template.
2637
+ */
2587
2638
  function isTemplateOnlyBlockKind(blockKind) {
2588
2639
  return blockKind.startsWith("system.") || TEMPLATE_ONLY_BLOCK_KINDS.includes(blockKind);
2589
2640
  }
@@ -4127,7 +4178,7 @@ function validateDescriptor(binding, context) {
4127
4178
  }
4128
4179
  case "literal": return [];
4129
4180
  case "transform": return validateTransform(binding, context);
4130
- case "fallback": return readFallbackOptions(binding).flatMap((option) => validateBinding(option, { ...context }).map((err$1) => err$1.kind === "typeIncompatible" && err$1.via === "direct" ? {
4181
+ case "fallback": return (readTemplateFallbackOptions(binding) ?? []).flatMap((option) => validateBinding(option, { ...context }).map((err$1) => err$1.kind === "typeIncompatible" && err$1.via === "direct" ? {
4131
4182
  ...err$1,
4132
4183
  via: "fallbackOption"
4133
4184
  } : err$1));
@@ -4188,14 +4239,6 @@ function validateTransform(binding, context) {
4188
4239
  }
4189
4240
  return errors;
4190
4241
  }
4191
- function isTemplateBindingValueArray(value) {
4192
- return Array.isArray(value);
4193
- }
4194
- function readFallbackOptions(binding) {
4195
- if (isTemplateBindingValueArray(binding.options)) return binding.options;
4196
- const legacy = binding.sources;
4197
- return isTemplateBindingValueArray(legacy) ? legacy : [];
4198
- }
4199
4242
  function resolveTransformInput(binding) {
4200
4243
  if (binding.input !== undefined) {
4201
4244
  if (typeof binding.input === "string") {
@@ -4443,15 +4486,16 @@ function manifestToValidationShape(manifest) {
4443
4486
  //#endregion
4444
4487
  //#region ../content-model/src/templates/auditBindings.ts
4445
4488
  /**
4446
- * Build a zero-initialised counter map keyed on every error variant.
4489
+ * Build a zero-initialised counter map keyed on every audit error variant.
4447
4490
  *
4448
4491
  * The literal *is* the source of truth: adding a new variant to
4449
- * `BindingValidationError` without a key here is a compile error. The
4492
+ * `AuditFinding['error']` without a key here is a compile error. The
4450
4493
  * `ALL_ERROR_KINDS` derived list and the runtime exhaustiveness in
4451
4494
  * `emptyByKind` both flow from this single declaration.
4452
4495
  */
4453
4496
  function emptyByKind() {
4454
4497
  const counters = {
4498
+ malformedBindings: 0,
4455
4499
  unknownBlockKind: 0,
4456
4500
  invalidBindingKey: 0,
4457
4501
  invalidFieldPath: 0,
@@ -4470,23 +4514,20 @@ const ALL_ERROR_KINDS = Object.keys(emptyByKind());
4470
4514
  * effects.
4471
4515
  */
4472
4516
  function auditSite(input, getManifest) {
4473
- const findings = [];
4474
- const byKind = emptyByKind();
4475
- for (const ct of input.contentTypes) {
4476
- for (const template of ct.templates) {
4477
- const errors = validateTemplateBindings(template, ct.schema, getManifest);
4478
- for (const error of errors) {
4479
- findings.push({
4480
- siteId: input.siteId,
4481
- contentTypeKey: ct.contentTypeKey,
4482
- templateKey: template.templateKey,
4483
- templateName: template.name,
4484
- error
4485
- });
4486
- byKind[error.kind] += 1;
4487
- }
4488
- }
4489
- }
4517
+ const findings = input.contentTypes.flatMap((ct) => ct.templates.flatMap((template) => {
4518
+ const errors = [...template.malformedBindings ?? [], ...validateTemplateBindings(template, ct.schema, getManifest)];
4519
+ return errors.map((error) => ({
4520
+ siteId: input.siteId,
4521
+ contentTypeKey: ct.contentTypeKey,
4522
+ templateKey: template.templateKey,
4523
+ templateName: template.name,
4524
+ error
4525
+ }));
4526
+ }));
4527
+ const byKind = findings.reduce((counts, finding) => ({
4528
+ ...counts,
4529
+ [finding.error.kind]: counts[finding.error.kind] + 1
4530
+ }), emptyByKind());
4490
4531
  return {
4491
4532
  siteId: input.siteId,
4492
4533
  findings,
@@ -4585,12 +4626,13 @@ function groupFindings(findings) {
4585
4626
  /**
4586
4627
  * Audit-report rendering of a validation error.
4587
4628
  *
4588
- * Delegates to the canonical `bindingValidationErrorMessage` so a single
4629
+ * Stored parse failures stay audit-specific. Semantic errors delegate to
4630
+ * the canonical `bindingValidationErrorMessage` so a single
4589
4631
  * source of truth covers both editor inline-display and audit report
4590
4632
  * surfaces — adding a new error variant updates both consumers from one
4591
4633
  * exhaustive switch.
4592
4634
  */
4593
- const describeError = bindingValidationErrorMessage;
4635
+ const describeError = (error) => error.kind === "malformedBindings" ? `Malformed stored bindings: ${error.message}` : bindingValidationErrorMessage(error);
4594
4636
 
4595
4637
  //#endregion
4596
4638
  //#region ../content-model/src/templates/editorState.ts
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { t as loadConfigFile } from "./load-config-h2Ri_tDO.mjs";
3
+
4
+ export { loadConfigFile };
@@ -7,7 +7,7 @@ import { existsSync as existsSync$1 } from "fs";
7
7
  import { fileURLToPath } from "url";
8
8
 
9
9
  //#region package.json
10
- var version = "0.22.2";
10
+ var version = "0.24.0";
11
11
  var peerDependencies = { "@riverbankcms/sdk": ">=0.157.0 <1.0.0" };
12
12
  var package_default = {
13
13
  name: "riverbankcms",
@@ -83,7 +83,7 @@ var package_default = {
83
83
  //#endregion
84
84
  //#region src/version.ts
85
85
  /** The package manifest is the source-run fallback; builds inject this value. */
86
- const CLI_VERSION = typeof "0.22.2" === "string" ? "0.22.2" : version;
86
+ const CLI_VERSION = typeof "0.24.0" === "string" ? "0.24.0" : version;
87
87
  /**
88
88
  * The CLI's SDK peer range is bundled from the CLI manifest alongside its
89
89
  * version. Runtime config loading uses this value as the single compatibility
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { Hn as err, Un as ok, un as parseSiteId } from "./src-ZACBG29u.mjs";
2
+ import { Xn as err, Zn as ok, vn as parseSiteId } from "./src-B03aw4Tv.mjs";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
4
  import { dirname, isAbsolute, join, parse, relative, resolve, sep } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import "../src-ZACBG29u.mjs";
3
- import { a as prepareScaffoldExecution, d as loadGeneratedPackageRanges, i as preflightScaffoldTargets, l as deriveGeneratedPackageRanges, o as writeScaffoldFiles, r as preflightScaffoldPlan, s as deriveScaffoldLocalManifest, t as deriveScaffoldPlan, u as findPackageManifestPath } from "../plan-CFMj_Hee.mjs";
2
+ import "../src-B03aw4Tv.mjs";
3
+ import { a as prepareScaffoldExecution, d as loadGeneratedPackageRanges, i as preflightScaffoldTargets, l as deriveGeneratedPackageRanges, o as writeScaffoldFiles, r as preflightScaffoldPlan, s as deriveScaffoldLocalManifest, t as deriveScaffoldPlan, u as findPackageManifestPath } from "../plan-Dyv1rMTT.mjs";
4
4
 
5
5
  export { deriveGeneratedPackageRanges, deriveScaffoldLocalManifest, deriveScaffoldPlan, findPackageManifestPath, loadGeneratedPackageRanges, preflightScaffoldPlan, preflightScaffoldTargets, prepareScaffoldExecution, writeScaffoldFiles };