riverbankcms 0.22.2 → 0.23.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-BnBxyTR6.mjs";
3
+ import { d as EVENT_PRESET_VALUES } from "./src-BPh_OivC.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
@@ -4127,7 +4174,7 @@ function validateDescriptor(binding, context) {
4127
4174
  }
4128
4175
  case "literal": return [];
4129
4176
  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" ? {
4177
+ case "fallback": return (readTemplateFallbackOptions(binding) ?? []).flatMap((option) => validateBinding(option, { ...context }).map((err$1) => err$1.kind === "typeIncompatible" && err$1.via === "direct" ? {
4131
4178
  ...err$1,
4132
4179
  via: "fallbackOption"
4133
4180
  } : err$1));
@@ -4188,14 +4235,6 @@ function validateTransform(binding, context) {
4188
4235
  }
4189
4236
  return errors;
4190
4237
  }
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
4238
  function resolveTransformInput(binding) {
4200
4239
  if (binding.input !== undefined) {
4201
4240
  if (typeof binding.input === "string") {
@@ -4443,15 +4482,16 @@ function manifestToValidationShape(manifest) {
4443
4482
  //#endregion
4444
4483
  //#region ../content-model/src/templates/auditBindings.ts
4445
4484
  /**
4446
- * Build a zero-initialised counter map keyed on every error variant.
4485
+ * Build a zero-initialised counter map keyed on every audit error variant.
4447
4486
  *
4448
4487
  * The literal *is* the source of truth: adding a new variant to
4449
- * `BindingValidationError` without a key here is a compile error. The
4488
+ * `AuditFinding['error']` without a key here is a compile error. The
4450
4489
  * `ALL_ERROR_KINDS` derived list and the runtime exhaustiveness in
4451
4490
  * `emptyByKind` both flow from this single declaration.
4452
4491
  */
4453
4492
  function emptyByKind() {
4454
4493
  const counters = {
4494
+ malformedBindings: 0,
4455
4495
  unknownBlockKind: 0,
4456
4496
  invalidBindingKey: 0,
4457
4497
  invalidFieldPath: 0,
@@ -4470,23 +4510,20 @@ const ALL_ERROR_KINDS = Object.keys(emptyByKind());
4470
4510
  * effects.
4471
4511
  */
4472
4512
  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
- }
4513
+ const findings = input.contentTypes.flatMap((ct) => ct.templates.flatMap((template) => {
4514
+ const errors = [...template.malformedBindings ?? [], ...validateTemplateBindings(template, ct.schema, getManifest)];
4515
+ return errors.map((error) => ({
4516
+ siteId: input.siteId,
4517
+ contentTypeKey: ct.contentTypeKey,
4518
+ templateKey: template.templateKey,
4519
+ templateName: template.name,
4520
+ error
4521
+ }));
4522
+ }));
4523
+ const byKind = findings.reduce((counts, finding) => ({
4524
+ ...counts,
4525
+ [finding.error.kind]: counts[finding.error.kind] + 1
4526
+ }), emptyByKind());
4490
4527
  return {
4491
4528
  siteId: input.siteId,
4492
4529
  findings,
@@ -4585,12 +4622,13 @@ function groupFindings(findings) {
4585
4622
  /**
4586
4623
  * Audit-report rendering of a validation error.
4587
4624
  *
4588
- * Delegates to the canonical `bindingValidationErrorMessage` so a single
4625
+ * Stored parse failures stay audit-specific. Semantic errors delegate to
4626
+ * the canonical `bindingValidationErrorMessage` so a single
4589
4627
  * source of truth covers both editor inline-display and audit report
4590
4628
  * surfaces — adding a new error variant updates both consumers from one
4591
4629
  * exhaustive switch.
4592
4630
  */
4593
- const describeError = bindingValidationErrorMessage;
4631
+ const describeError = (error) => error.kind === "malformedBindings" ? `Malformed stored bindings: ${error.message}` : bindingValidationErrorMessage(error);
4594
4632
 
4595
4633
  //#endregion
4596
4634
  //#region ../content-model/src/templates/editorState.ts
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { t as loadConfigFile } from "./load-config-D5DDfmv1.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.23.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.23.0" === "string" ? "0.23.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 { Un as err, Wn as ok, dn as parseSiteId } from "./src-BPh_OivC.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-BPh_OivC.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-6m8gsGI8.mjs";
4
4
 
5
5
  export { deriveGeneratedPackageRanges, deriveScaffoldLocalManifest, deriveScaffoldPlan, findPackageManifestPath, loadGeneratedPackageRanges, preflightScaffoldPlan, preflightScaffoldTargets, prepareScaffoldExecution, writeScaffoldFiles };