@continuous-excellence/ze-great-dashboard-aws 0.31.29 → 0.31.31

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
@@ -86,6 +86,28 @@ var positionSchema = z2.union([
86
86
  ]);
87
87
  var panelDensities = ["auto", "comfortable", "compact"];
88
88
  var panelDensitySchema = z2.enum(panelDensities);
89
+ var githubActionsBuildEvents = [
90
+ "push",
91
+ "pull_request",
92
+ "pull_request_target",
93
+ "pull_request_review",
94
+ "pull_request_review_comment",
95
+ "workflow_dispatch",
96
+ "workflow_run",
97
+ "merge_group"
98
+ ];
99
+ var githubActionsBuildEventSchema = z2.enum(githubActionsBuildEvents);
100
+ var githubActionsBuildEventsSchema = z2.array(githubActionsBuildEventSchema).min(1).superRefine((events, ctx) => {
101
+ events.forEach((event, index) => {
102
+ if (events.indexOf(event) !== index)
103
+ ctx.addIssue({
104
+ code: "custom",
105
+ path: [index],
106
+ message: `duplicate build event "${event}"`,
107
+ params: { constraint: "Use each build event at most once." }
108
+ });
109
+ });
110
+ });
89
111
  var attentionTreatments = ["beacon", "alarm", "steady"];
90
112
  var attentionTreatmentSchema = z2.enum(attentionTreatments);
91
113
  var httpValueJsonPathSchema = z2.string().regex(/^\$(?:\.[A-Za-z_][A-Za-z0-9_]*|\[\d+\])*$/, "must be a simple JSON path");
@@ -146,7 +168,9 @@ var panelSchema = z2.looseObject({
146
168
  /** Small, deliberate JSON path subset: $.version, $.deployment.version, or $.response.docs[0].latestVersion. */
147
169
  json_path: httpValueJsonPathSchema.optional(),
148
170
  /** Up to four independently fetched source-agnostic readings in one visual panel. */
149
- facts: httpValueGroupedPanelSchema.shape.facts.optional()
171
+ facts: httpValueGroupedPanelSchema.shape.facts.optional(),
172
+ /** Optional GitHub Actions-only restriction on which workflow triggers count as build evidence. */
173
+ build_events: githubActionsBuildEventsSchema.optional()
150
174
  }).superRefine((panel, ctx) => {
151
175
  if ("display" in panel) {
152
176
  ctx.addIssue({
@@ -388,6 +412,16 @@ var boardConfigSchema = z2.object({
388
412
  for (const [boardName, board] of Object.entries(config.boards)) {
389
413
  board.panels.forEach((panel, panelIndex) => {
390
414
  const source = panel.source ? config.sources[panel.source] : void 0;
415
+ if (panel.build_events !== void 0 && (panel.type !== "pull-request-health" || source?.type !== "github-actions")) {
416
+ ctx.addIssue({
417
+ code: "custom",
418
+ path: ["boards", boardName, "panels", panelIndex, "build_events"],
419
+ message: "build_events is available only on pull-request-health panels using a github-actions source",
420
+ params: {
421
+ constraint: "Configure build_events only for GitHub Actions pull-request health panels."
422
+ }
423
+ });
424
+ }
391
425
  if (panel.type !== "pipeline-status" || source?.type !== "azure-devops") return;
392
426
  if (typeof panel.pipeline !== "number" || !Number.isInteger(panel.pipeline) || panel.pipeline <= 0) {
393
427
  ctx.addIssue({
@@ -656,7 +690,8 @@ var pullRequestHealthPanelSchema = z7.object({
656
690
  branch_prefixes: z7.array(z7.string().min(1)).min(1)
657
691
  })
658
692
  ).min(1),
659
- build_workflow: z7.string().min(1)
693
+ build_workflow: z7.string().min(1),
694
+ build_events: githubActionsBuildEventsSchema.optional()
660
695
  });
661
696
  var runSchema = z7.object({
662
697
  id: z7.number().int().positive().optional(),
@@ -664,6 +699,8 @@ var runSchema = z7.object({
664
699
  conclusion: z7.string().nullable(),
665
700
  name: z7.string().min(1),
666
701
  html_url: z7.url(),
702
+ /** The GitHub Actions trigger that started this run. */
703
+ event: z7.string().min(1).optional(),
667
704
  /** The branch that produced this run; absent for some event types. */
668
705
  head_branch: z7.string().min(1).nullable().optional(),
669
706
  // Timestamp quality should only remove timing advice, never make an otherwise useful run unreadable.
package/dist/index.js CHANGED
@@ -767,6 +767,28 @@ var positionSchema = z2.union([
767
767
  ]);
768
768
  var panelDensities = ["auto", "comfortable", "compact"];
769
769
  var panelDensitySchema = z2.enum(panelDensities);
770
+ var githubActionsBuildEvents = [
771
+ "push",
772
+ "pull_request",
773
+ "pull_request_target",
774
+ "pull_request_review",
775
+ "pull_request_review_comment",
776
+ "workflow_dispatch",
777
+ "workflow_run",
778
+ "merge_group"
779
+ ];
780
+ var githubActionsBuildEventSchema = z2.enum(githubActionsBuildEvents);
781
+ var githubActionsBuildEventsSchema = z2.array(githubActionsBuildEventSchema).min(1).superRefine((events, ctx) => {
782
+ events.forEach((event, index) => {
783
+ if (events.indexOf(event) !== index)
784
+ ctx.addIssue({
785
+ code: "custom",
786
+ path: [index],
787
+ message: `duplicate build event "${event}"`,
788
+ params: { constraint: "Use each build event at most once." }
789
+ });
790
+ });
791
+ });
770
792
  var attentionTreatments = ["beacon", "alarm", "steady"];
771
793
  var attentionTreatmentSchema = z2.enum(attentionTreatments);
772
794
  var httpValueJsonPathSchema = z2.string().regex(/^\$(?:\.[A-Za-z_][A-Za-z0-9_]*|\[\d+\])*$/, "must be a simple JSON path");
@@ -827,7 +849,9 @@ var panelSchema = z2.looseObject({
827
849
  /** Small, deliberate JSON path subset: $.version, $.deployment.version, or $.response.docs[0].latestVersion. */
828
850
  json_path: httpValueJsonPathSchema.optional(),
829
851
  /** Up to four independently fetched source-agnostic readings in one visual panel. */
830
- facts: httpValueGroupedPanelSchema.shape.facts.optional()
852
+ facts: httpValueGroupedPanelSchema.shape.facts.optional(),
853
+ /** Optional GitHub Actions-only restriction on which workflow triggers count as build evidence. */
854
+ build_events: githubActionsBuildEventsSchema.optional()
831
855
  }).superRefine((panel, ctx) => {
832
856
  if ("display" in panel) {
833
857
  ctx.addIssue({
@@ -1069,6 +1093,16 @@ var boardConfigSchema = z2.object({
1069
1093
  for (const [boardName, board] of Object.entries(config.boards)) {
1070
1094
  board.panels.forEach((panel, panelIndex) => {
1071
1095
  const source = panel.source ? config.sources[panel.source] : void 0;
1096
+ if (panel.build_events !== void 0 && (panel.type !== "pull-request-health" || source?.type !== "github-actions")) {
1097
+ ctx.addIssue({
1098
+ code: "custom",
1099
+ path: ["boards", boardName, "panels", panelIndex, "build_events"],
1100
+ message: "build_events is available only on pull-request-health panels using a github-actions source",
1101
+ params: {
1102
+ constraint: "Configure build_events only for GitHub Actions pull-request health panels."
1103
+ }
1104
+ });
1105
+ }
1072
1106
  if (panel.type !== "pipeline-status" || source?.type !== "azure-devops") return;
1073
1107
  if (typeof panel.pipeline !== "number" || !Number.isInteger(panel.pipeline) || panel.pipeline <= 0) {
1074
1108
  ctx.addIssue({
@@ -1337,7 +1371,8 @@ var pullRequestHealthPanelSchema = z7.object({
1337
1371
  branch_prefixes: z7.array(z7.string().min(1)).min(1)
1338
1372
  })
1339
1373
  ).min(1),
1340
- build_workflow: z7.string().min(1)
1374
+ build_workflow: z7.string().min(1),
1375
+ build_events: githubActionsBuildEventsSchema.optional()
1341
1376
  });
1342
1377
  var runSchema = z7.object({
1343
1378
  id: z7.number().int().positive().optional(),
@@ -1345,6 +1380,8 @@ var runSchema = z7.object({
1345
1380
  conclusion: z7.string().nullable(),
1346
1381
  name: z7.string().min(1),
1347
1382
  html_url: z7.url(),
1383
+ /** The GitHub Actions trigger that started this run. */
1384
+ event: z7.string().min(1).optional(),
1348
1385
  /** The branch that produced this run; absent for some event types. */
1349
1386
  head_branch: z7.string().min(1).nullable().optional(),
1350
1387
  // Timestamp quality should only remove timing advice, never make an otherwise useful run unreadable.
package/dist/lambda.mjs CHANGED
@@ -26174,7 +26174,7 @@ var require_dist_cjs16 = __commonJS({
26174
26174
  Region: { type: "builtInParams", name: "region" },
26175
26175
  UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
26176
26176
  };
26177
- var version2 = "3.1149.0";
26177
+ var version2 = "3.1150.0";
26178
26178
  var packageInfo = {
26179
26179
  version: version2
26180
26180
  };
@@ -27965,7 +27965,7 @@ var require_dist_cjs17 = __commonJS({
27965
27965
  Region: { type: "builtInParams", name: "region" },
27966
27966
  UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
27967
27967
  };
27968
- var version2 = "3.1149.0";
27968
+ var version2 = "3.1150.0";
27969
27969
  var packageInfo = {
27970
27970
  version: version2
27971
27971
  };
@@ -69389,6 +69389,28 @@ var positionSchema = external_exports.union([
69389
69389
  ]);
69390
69390
  var panelDensities = ["auto", "comfortable", "compact"];
69391
69391
  var panelDensitySchema = external_exports.enum(panelDensities);
69392
+ var githubActionsBuildEvents = [
69393
+ "push",
69394
+ "pull_request",
69395
+ "pull_request_target",
69396
+ "pull_request_review",
69397
+ "pull_request_review_comment",
69398
+ "workflow_dispatch",
69399
+ "workflow_run",
69400
+ "merge_group"
69401
+ ];
69402
+ var githubActionsBuildEventSchema = external_exports.enum(githubActionsBuildEvents);
69403
+ var githubActionsBuildEventsSchema = external_exports.array(githubActionsBuildEventSchema).min(1).superRefine((events, ctx) => {
69404
+ events.forEach((event, index) => {
69405
+ if (events.indexOf(event) !== index)
69406
+ ctx.addIssue({
69407
+ code: "custom",
69408
+ path: [index],
69409
+ message: `duplicate build event "${event}"`,
69410
+ params: { constraint: "Use each build event at most once." }
69411
+ });
69412
+ });
69413
+ });
69392
69414
  var attentionTreatments = ["beacon", "alarm", "steady"];
69393
69415
  var attentionTreatmentSchema = external_exports.enum(attentionTreatments);
69394
69416
  var httpValueJsonPathSchema = external_exports.string().regex(/^\$(?:\.[A-Za-z_][A-Za-z0-9_]*|\[\d+\])*$/, "must be a simple JSON path");
@@ -69449,7 +69471,9 @@ var panelSchema = external_exports.looseObject({
69449
69471
  /** Small, deliberate JSON path subset: $.version, $.deployment.version, or $.response.docs[0].latestVersion. */
69450
69472
  json_path: httpValueJsonPathSchema.optional(),
69451
69473
  /** Up to four independently fetched source-agnostic readings in one visual panel. */
69452
- facts: httpValueGroupedPanelSchema.shape.facts.optional()
69474
+ facts: httpValueGroupedPanelSchema.shape.facts.optional(),
69475
+ /** Optional GitHub Actions-only restriction on which workflow triggers count as build evidence. */
69476
+ build_events: githubActionsBuildEventsSchema.optional()
69453
69477
  }).superRefine((panel, ctx) => {
69454
69478
  if ("display" in panel) {
69455
69479
  ctx.addIssue({
@@ -69696,6 +69720,16 @@ var boardConfigSchema = external_exports.object({
69696
69720
  for (const [boardName, board] of Object.entries(config2.boards)) {
69697
69721
  board.panels.forEach((panel, panelIndex) => {
69698
69722
  const source = panel.source ? config2.sources[panel.source] : void 0;
69723
+ if (panel.build_events !== void 0 && (panel.type !== "pull-request-health" || source?.type !== "github-actions")) {
69724
+ ctx.addIssue({
69725
+ code: "custom",
69726
+ path: ["boards", boardName, "panels", panelIndex, "build_events"],
69727
+ message: "build_events is available only on pull-request-health panels using a github-actions source",
69728
+ params: {
69729
+ constraint: "Configure build_events only for GitHub Actions pull-request health panels."
69730
+ }
69731
+ });
69732
+ }
69699
69733
  if (panel.type !== "pipeline-status" || source?.type !== "azure-devops") return;
69700
69734
  if (typeof panel.pipeline !== "number" || !Number.isInteger(panel.pipeline) || panel.pipeline <= 0) {
69701
69735
  ctx.addIssue({
@@ -70473,7 +70507,8 @@ var pullRequestHealthPanelSchema = external_exports.object({
70473
70507
  branch_prefixes: external_exports.array(external_exports.string().min(1)).min(1)
70474
70508
  })
70475
70509
  ).min(1),
70476
- build_workflow: external_exports.string().min(1)
70510
+ build_workflow: external_exports.string().min(1),
70511
+ build_events: githubActionsBuildEventsSchema.optional()
70477
70512
  });
70478
70513
  var runSchema = external_exports.object({
70479
70514
  id: external_exports.number().int().positive().optional(),
@@ -70481,6 +70516,8 @@ var runSchema = external_exports.object({
70481
70516
  conclusion: external_exports.string().nullable(),
70482
70517
  name: external_exports.string().min(1),
70483
70518
  html_url: external_exports.url(),
70519
+ /** The GitHub Actions trigger that started this run. */
70520
+ event: external_exports.string().min(1).optional(),
70484
70521
  /** The branch that produced this run; absent for some event types. */
70485
70522
  head_branch: external_exports.string().min(1).nullable().optional(),
70486
70523
  // Timestamp quality should only remove timing advice, never make an otherwise useful run unreadable.
@@ -70598,9 +70635,19 @@ async function fetchGithubActionsPullRequestBuild(args) {
70598
70635
  return githubObservation(
70599
70636
  args,
70600
70637
  source,
70601
- githubRunsCall(source, panel.build_workflow, args.branch, "pull_request"),
70638
+ githubRunsCall(
70639
+ source,
70640
+ panel.build_workflow,
70641
+ args.branch,
70642
+ void 0,
70643
+ panel.build_events ? 100 : 1
70644
+ ),
70602
70645
  (value, observedAt4) => {
70603
- const run = runsSchema.parse(value).workflow_runs[0];
70646
+ const run = runsSchema.parse(value).workflow_runs.find((candidate) => {
70647
+ if (!panel.build_events) return true;
70648
+ const event = githubActionsBuildEventSchema.safeParse(candidate.event);
70649
+ return event.success && panel.build_events.includes(event.data);
70650
+ });
70604
70651
  return {
70605
70652
  panelId: panel.id,
70606
70653
  state: "ok",
@@ -70609,7 +70656,7 @@ async function fetchGithubActionsPullRequestBuild(args) {
70609
70656
  signal: {
70610
70657
  type: "pull-request-build",
70611
70658
  branch: args.branch,
70612
- item: healthItem(args.branch, run, args.branch)
70659
+ item: healthItem(args.branch, run, args.branch, void 0, true)
70613
70660
  }
70614
70661
  };
70615
70662
  }
@@ -70696,11 +70743,11 @@ function githubRunsCall(source, workflow, branch, event, perPage = 1, created) {
70696
70743
  url2.searchParams.set("per_page", String(perPage));
70697
70744
  return { url: url2.toString(), headers: new Headers() };
70698
70745
  }
70699
- function healthItem(label, run, detail, link) {
70746
+ function healthItem(label, run, detail, link, includeEvent = false) {
70700
70747
  return {
70701
70748
  label,
70702
70749
  status: run ? normalizeStatus2(run.status, run.conclusion) : "unknown",
70703
- detail: run ? `${detail} \xB7 ${run.conclusion ?? run.status}` : `${detail} \xB7 No run found`,
70750
+ detail: run ? `${detail}${includeEvent ? ` \xB7 ${run.event ?? "unknown trigger"}` : ""} \xB7 ${run.conclusion ?? run.status}` : `${detail} \xB7 No run found`,
70704
70751
  link: link ?? run?.html_url ?? null
70705
70752
  };
70706
70753
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@continuous-excellence/ze-great-dashboard-aws",
3
- "version": "0.31.29",
3
+ "version": "0.31.31",
4
4
  "type": "module",
5
5
  "description": "AWS server runtime and CloudFormation deployment tooling for Ze Great Dashboard.",
6
6
  "keywords": [