@koda-sl/baker-cli 0.264.0 → 0.265.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/cli.js CHANGED
@@ -12503,6 +12503,22 @@ var analyticsBeaconPayloadSchema = z24.object({
12503
12503
  siteKey: z24.string().max(64).optional()
12504
12504
  });
12505
12505
 
12506
+ // ../api/src/analytics/submissionAnswers.ts
12507
+ var MAX_ANSWER_CHARS = 16384;
12508
+ var MAX_ANSWER_NAME_CHARS = 120;
12509
+ var TRUNCATED = "\u2026";
12510
+ function cutToLength(value, max) {
12511
+ if (value.length <= max) return value;
12512
+ return `${[...value].slice(0, max - 1).join("")}${TRUNCATED}`;
12513
+ }
12514
+ function boundSubmissionAnswers(answers) {
12515
+ const kept = {};
12516
+ for (const [name, value] of Object.entries(answers)) {
12517
+ kept[cutToLength(name, MAX_ANSWER_NAME_CHARS)] = cutToLength(value, MAX_ANSWER_CHARS);
12518
+ }
12519
+ return kept;
12520
+ }
12521
+
12506
12522
  // ../api/src/analytics/trackingTemplate.ts
12507
12523
  function placeholderKey(raw) {
12508
12524
  return raw.replace(/[{}]/g, "").replace(/^_+|_+$/g, "").trim().toLowerCase();
@@ -13888,29 +13904,48 @@ var analyticsTrackingResponseSchema = z25.object({
13888
13904
  data: z25.object({ days: z25.number(), platforms: z25.array(analyticsTrackingPlatformSchema) }),
13889
13905
  hints: z25.array(z25.string()).optional()
13890
13906
  });
13907
+ var boundedReference = (max) => z25.string().transform((value) => cutToLength(value, max));
13891
13908
  var submissionRecordRequestSchema = z25.object({
13892
- /** Injected by the Worker from the host or the site key. Never from the page. */
13909
+ /**
13910
+ * Injected by the Worker from the host or the site key. Never from the page.
13911
+ *
13912
+ * One of the two fields that is still required, because a copy that cannot
13913
+ * be filed under a company cannot be found again by anybody. Bounding it
13914
+ * would produce a row belonging to a company that does not exist, which is
13915
+ * worse than refusing — this is the case where refusing is right.
13916
+ */
13893
13917
  companyId: z25.string().min(1),
13894
13918
  /** Shared with every destination this submit was sent to, and with its event. */
13895
- submissionId: z25.string().min(1).max(128),
13896
- flowSlug: z25.string().max(120).default(""),
13897
- nodeId: z25.string().max(120).default(""),
13898
- nodeType: z25.string().max(40).default(""),
13899
- landingId: z25.string().max(120).default(""),
13900
- release: z25.string().max(64).default(""),
13901
- pageUrl: z25.string().max(2048).default(""),
13919
+ submissionId: z25.string().min(1).pipe(boundedReference(128)),
13920
+ flowSlug: boundedReference(120).default(""),
13921
+ nodeId: boundedReference(120).default(""),
13922
+ nodeType: boundedReference(40).default(""),
13923
+ landingId: boundedReference(120).default(""),
13924
+ release: boundedReference(64).default(""),
13925
+ pageUrl: boundedReference(2048).default(""),
13902
13926
  /**
13903
13927
  * A SHA-256 digest, or absent. Never an address.
13904
13928
  *
13905
13929
  * The join from a recovered copy to every session the same person had,
13906
13930
  * without anybody having to open the copy to get there.
13907
13931
  */
13908
- identityHash: z25.string().max(128).optional(),
13909
- identityKind: z25.enum(["email", "phone"]).optional(),
13932
+ identityHash: boundedReference(128).optional(),
13933
+ /**
13934
+ * Degraded rather than refused, like everything else here: an unrecognised
13935
+ * kind costs the copy one label, and refusing it would cost the copy.
13936
+ */
13937
+ identityKind: z25.enum(["email", "phone"]).optional().catch(void 0),
13910
13938
  /** Injected by the Worker's edge. Kept exactly here and as a /24 everywhere else. */
13911
- clientIp: z25.string().max(64).nullish(),
13912
- /** Every answer on the step, free text included. Sealed on arrival. */
13913
- answers: z25.record(z25.string().max(120), z25.string().max(4096))
13939
+ clientIp: boundedReference(64).nullish(),
13940
+ /**
13941
+ * Every answer on the step, free text included. Sealed on arrival.
13942
+ *
13943
+ * Bounded rather than length-checked, and that is the whole of it: a `max()`
13944
+ * here refused the **entire copy** over one long answer, so a visitor who
13945
+ * pasted a paragraph into a free-text field lost the email and the budget
13946
+ * beside it too. See {@link boundSubmissionAnswers}.
13947
+ */
13948
+ answers: z25.record(z25.string(), z25.string()).transform(boundSubmissionAnswers)
13914
13949
  });
13915
13950
 
13916
13951
  // src/commands/ads/google/mapping-hints.ts