@aeptus/aexeo-emdash 0.8.16 → 0.8.17

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/CHANGELOG.md CHANGED
@@ -6,6 +6,49 @@ and the project follows [Semantic Versioning](https://semver.org/).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.8.17] - 2026-05-29
10
+
11
+ Hotfix release. Closes the production admin-route regression
12
+ Aeptus reported on 0.8.16 + emdash@0.17.2.
13
+
14
+ ### Fixed
15
+
16
+ - **`TypeError: Cannot read properties of undefined (reading 'type')`
17
+ at `/_emdash/api/plugins/aexeo-emdash/admin`.** The legacy
18
+ Block Kit admin route assumed `ctx.input` is always a complete
19
+ `BlockInteraction`. EmDash 0.17 reaches the endpoint with
20
+ empty / partial bodies on admin and widget hydration paths;
21
+ the first `body.type === "page_load"` read crashed on
22
+ undefined.
23
+ Fix: added `normalizeInteraction(input: unknown): BlockInteraction`
24
+ at the top of dispatch in both `configured.ts` (production-hit
25
+ path) and `sandbox-entry.ts` (same bug shape in the sandbox-
26
+ bundled flavor). Defaults follow Aeptus's hardening
27
+ suggestion:
28
+ - Missing / non-object input → `page_load /findings`.
29
+ - `page_load` with missing or empty `page` → `/findings`.
30
+ - `block_action` with missing `action_id` → `""` (falls
31
+ through to `notFound("")` rather than throwing).
32
+ - `form_submit` with missing `values` → `{}` (downstream
33
+ code already guards "no route picked").
34
+ Verified against 10 edge-case inputs (undefined, null, empty
35
+ object, missing/empty page, missing action_id, missing
36
+ values, unknown type, string input, valid payload) — all
37
+ produce the expected default without throwing.
38
+ - **`RouteContext` / `RouteInput` types loosened.** `input`
39
+ goes from `BlockInteraction` to `unknown` because the
40
+ upstream guarantee from emdash 0.17 is genuinely weaker. The
41
+ compile-time shape now lives inside the normalizer's return
42
+ type, where it can be enforced uniformly across both
43
+ handlers.
44
+
45
+ ### Bundle deltas
46
+
47
+ - `configured.js` +985 bytes
48
+ - `sandbox-entry.js` +940 bytes
49
+ - `admin.js` unchanged (React admin pages don't include the
50
+ Block Kit admin route)
51
+
9
52
  ## [0.8.16] - 2026-05-29
10
53
 
11
54
  Plugin-only release confirming source-level compatibility with
@@ -1215,7 +1215,7 @@ function globToMatcher(pattern) {
1215
1215
  }
1216
1216
 
1217
1217
  // src/version.ts
1218
- var PACKAGE_VERSION = "0.8.16";
1218
+ var PACKAGE_VERSION = "0.8.17";
1219
1219
 
1220
1220
  // src/configured.ts
1221
1221
  import { definePlugin } from "emdash";
@@ -1371,8 +1371,37 @@ function createPlugin(options = {}) {
1371
1371
  });
1372
1372
  }
1373
1373
  var configured_default = createPlugin;
1374
+ function normalizeInteraction(input) {
1375
+ if (!input || typeof input !== "object") {
1376
+ return { type: "page_load", page: "/findings" };
1377
+ }
1378
+ const raw = input;
1379
+ if (raw.type === "page_load") {
1380
+ return {
1381
+ type: "page_load",
1382
+ page: typeof raw.page === "string" && raw.page.length > 0 ? raw.page : "/findings"
1383
+ };
1384
+ }
1385
+ if (raw.type === "block_action") {
1386
+ return {
1387
+ type: "block_action",
1388
+ action_id: typeof raw.action_id === "string" ? raw.action_id : "",
1389
+ ...typeof raw.block_id === "string" ? { block_id: raw.block_id } : {},
1390
+ value: raw.value
1391
+ };
1392
+ }
1393
+ if (raw.type === "form_submit") {
1394
+ return {
1395
+ type: "form_submit",
1396
+ action_id: typeof raw.action_id === "string" ? raw.action_id : "",
1397
+ ...typeof raw.block_id === "string" ? { block_id: raw.block_id } : {},
1398
+ values: raw.values && typeof raw.values === "object" ? raw.values : {}
1399
+ };
1400
+ }
1401
+ return { type: "page_load", page: "/findings" };
1402
+ }
1374
1403
  async function handleAdminRoute(ctx, collections) {
1375
- const body = ctx.input;
1404
+ const body = normalizeInteraction(ctx.input);
1376
1405
  if (body.type === "page_load") {
1377
1406
  return handlePageLoad(ctx, body.page);
1378
1407
  }
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ function buildAllowedHosts(evaluatorHost) {
23
23
  }
24
24
 
25
25
  // src/version.ts
26
- var PACKAGE_VERSION = "0.8.16";
26
+ var PACKAGE_VERSION = "0.8.17";
27
27
 
28
28
  // src/sandbox.ts
29
29
  function aexeoPluginSandboxed(options = {}) {
@@ -15,7 +15,7 @@ export type BlockInteraction = {
15
15
  values: Record<string, unknown>;
16
16
  };
17
17
  export interface RouteInput {
18
- input: BlockInteraction;
18
+ input?: unknown;
19
19
  request?: unknown;
20
20
  requestMeta?: unknown;
21
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"sandbox-entry.d.ts","sourceRoot":"","sources":["../src/sandbox-entry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EAEX,UAAU,EAEX,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,eAAe,EAKhB,MAAM,aAAa,CAAC;AAiBrB,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACnC;IACE,IAAI,EAAE,cAAc,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,GACD;IACE,IAAI,EAAE,aAAa,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC,CAAC;AAON,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,gBAAgB,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAID,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,gBAAgB,CAAC;IACvB,EAAE,EAAE,WAAW,CAAC;IAChB,GAAG,EAAE,UAAU,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,OAAO,EAAE,CAAC;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,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,SAAS,GAAG,OAAO,GAAG,MAAM,CAAA;KAAE,CAAC;CACjE;AAMD,iBAAe,gBAAgB,CAC7B,KAAK,EAAE,UAAU,EACjB,GAAG,EAAE,UAAU,GACd,OAAO,CAAC,aAAa,CAAC,CAwBxB;;;;;;;;;;;;AAkhBD,wBAWG"}
@@ -439,26 +439,56 @@ var tools = [checkTool, indexNowSubmitTool];
439
439
  function definePlugin(plugin) {
440
440
  return plugin;
441
441
  }
442
+ function normalizeInteraction(input) {
443
+ if (!input || typeof input !== "object") {
444
+ return { type: "page_load", page: "/findings" };
445
+ }
446
+ const raw = input;
447
+ if (raw.type === "page_load") {
448
+ return {
449
+ type: "page_load",
450
+ page: typeof raw.page === "string" && raw.page.length > 0 ? raw.page : "/findings"
451
+ };
452
+ }
453
+ if (raw.type === "block_action") {
454
+ return {
455
+ type: "block_action",
456
+ action_id: typeof raw.action_id === "string" ? raw.action_id : "",
457
+ ...typeof raw.block_id === "string" ? { block_id: raw.block_id } : {},
458
+ value: raw.value
459
+ };
460
+ }
461
+ if (raw.type === "form_submit") {
462
+ return {
463
+ type: "form_submit",
464
+ action_id: typeof raw.action_id === "string" ? raw.action_id : "",
465
+ ...typeof raw.block_id === "string" ? { block_id: raw.block_id } : {},
466
+ values: raw.values && typeof raw.values === "object" ? raw.values : {}
467
+ };
468
+ }
469
+ return { type: "page_load", page: "/findings" };
470
+ }
442
471
  async function handleAdminRoute(input, ctx) {
472
+ const body = normalizeInteraction(input?.input);
443
473
  ctx.log?.info?.(
444
- `aexeo route: type=${input.input?.type} page=${input.input?.page ?? ""}`
474
+ `aexeo route: type=${body.type} page=${body.type === "page_load" ? body.page : ""}`
445
475
  );
446
- const dispatch = { body: input.input, kv: ctx.kv, ctx };
447
- if (dispatch.body.type === "page_load") {
448
- return handlePageLoad(dispatch, dispatch.body.page);
476
+ const dispatch = { body, kv: ctx.kv, ctx };
477
+ if (body.type === "page_load") {
478
+ return handlePageLoad(dispatch, body.page);
449
479
  }
450
- if (dispatch.body.type === "block_action") {
480
+ if (body.type === "block_action") {
451
481
  return handleBlockAction(
452
482
  dispatch,
453
- dispatch.body.action_id,
454
- dispatch.body.value
483
+ body.action_id,
484
+ body.value
455
485
  );
456
486
  }
457
- if (dispatch.body.type === "form_submit") {
487
+ if (body.type === "form_submit") {
458
488
  return handleFormSubmit(
459
489
  dispatch,
460
- dispatch.body.action_id,
461
- dispatch.body.values
490
+ body.action_id,
491
+ body.values
462
492
  );
463
493
  }
464
494
  return handlePageLoad(dispatch, "findings");
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const PACKAGE_VERSION = "0.8.16";
1
+ export declare const PACKAGE_VERSION = "0.8.17";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeptus/aexeo-emdash",
3
- "version": "0.8.16",
3
+ "version": "0.8.17",
4
4
  "description": "Aexeo SEO/GEO content evaluator as an emdash plugin",
5
5
  "license": "MIT",
6
6
  "author": "Aeptus",
Binary file