@ekanos/harness 0.26.0 → 0.28.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.
Files changed (159) hide show
  1. package/README.md +6 -4
  2. package/dist/api-types.d.ts +4 -0
  3. package/dist/internal/components/approvals-tray.d.ts +44 -6
  4. package/dist/internal/components/approvals-tray.js +252 -30
  5. package/dist/internal/components/connect-controls.js +4 -2
  6. package/dist/internal/components/connect-dialog.d.ts +8 -1
  7. package/dist/internal/components/connect-dialog.js +23 -10
  8. package/dist/internal/components/connect-panel.d.ts +3 -2
  9. package/dist/internal/components/connect-panel.js +680 -340
  10. package/dist/internal/components/connect-steps.d.ts +72 -0
  11. package/dist/internal/components/connect-steps.js +341 -0
  12. package/dist/internal/components/console-not-found.d.ts +14 -0
  13. package/dist/internal/components/console-not-found.js +57 -0
  14. package/dist/internal/components/dashboard-grid.d.ts +10 -5
  15. package/dist/internal/components/dashboard-grid.js +8 -9
  16. package/dist/internal/components/dev-toolbar.d.ts +27 -5
  17. package/dist/internal/components/dev-toolbar.js +214 -176
  18. package/dist/internal/components/ekanos-logo.d.ts +18 -0
  19. package/dist/internal/components/ekanos-logo.js +74 -0
  20. package/dist/internal/components/events-panel.d.ts +13 -4
  21. package/dist/internal/components/events-panel.js +478 -81
  22. package/dist/internal/components/harness-widget-provider.d.ts +6 -8
  23. package/dist/internal/components/harness-widget-provider.js +5 -19
  24. package/dist/internal/components/health-panel.d.ts +8 -1
  25. package/dist/internal/components/health-panel.js +328 -31
  26. package/dist/internal/components/integration-badge.js +4 -2
  27. package/dist/internal/components/integration-tab-skeletons.d.ts +8 -0
  28. package/dist/internal/components/integration-tab-skeletons.js +76 -0
  29. package/dist/internal/components/not-found-state.d.ts +39 -0
  30. package/dist/internal/components/not-found-state.js +127 -0
  31. package/dist/internal/components/operation-runner-panel.d.ts +1 -1
  32. package/dist/internal/components/operation-runner-panel.js +624 -189
  33. package/dist/internal/components/operation-scope.d.ts +13 -0
  34. package/dist/internal/components/operation-scope.js +79 -0
  35. package/dist/internal/components/page-skeletons.d.ts +11 -0
  36. package/dist/internal/components/page-skeletons.js +61 -0
  37. package/dist/internal/components/provenance-banner.d.ts +13 -4
  38. package/dist/internal/components/provenance-banner.js +35 -10
  39. package/dist/internal/components/run-log-copy.d.ts +17 -0
  40. package/dist/internal/components/run-log-copy.js +67 -0
  41. package/dist/internal/components/run-log-detail.d.ts +22 -0
  42. package/dist/internal/components/run-log-detail.js +295 -0
  43. package/dist/internal/components/run-log-empty.d.ts +13 -0
  44. package/dist/internal/components/run-log-empty.js +46 -0
  45. package/dist/internal/components/run-log.d.ts +23 -3
  46. package/dist/internal/components/run-log.js +384 -130
  47. package/dist/internal/components/runtime-strip.d.ts +5 -1
  48. package/dist/internal/components/runtime-strip.js +115 -10
  49. package/dist/internal/components/schema-form.d.ts +2 -1
  50. package/dist/internal/components/schema-form.js +212 -79
  51. package/dist/internal/components/scrollable-nav.js +14 -2
  52. package/dist/internal/components/segmented-control.d.ts +19 -0
  53. package/dist/internal/components/segmented-control.js +46 -0
  54. package/dist/internal/components/shell-header.d.ts +25 -0
  55. package/dist/internal/components/shell-header.js +126 -0
  56. package/dist/internal/components/surface-nav.d.ts +12 -3
  57. package/dist/internal/components/surface-nav.js +72 -83
  58. package/dist/internal/components/widget-surface.d.ts +5 -1
  59. package/dist/internal/components/widget-surface.js +86 -14
  60. package/dist/internal/components/workflow-runner.d.ts +23 -10
  61. package/dist/internal/components/workflow-runner.js +451 -69
  62. package/dist/internal/lib/connect-model.d.ts +134 -0
  63. package/dist/internal/lib/connect-model.js +282 -0
  64. package/dist/internal/lib/connection-facts.js +2 -1
  65. package/dist/internal/lib/console-client.js +5 -2
  66. package/dist/internal/lib/console-hooks.d.ts +4 -1
  67. package/dist/internal/lib/console-hooks.js +3 -2
  68. package/dist/internal/lib/console-types.d.ts +6 -0
  69. package/dist/internal/lib/docs-links.d.ts +28 -0
  70. package/dist/internal/lib/docs-links.js +57 -1
  71. package/dist/internal/lib/event-delivery.d.ts +33 -0
  72. package/dist/internal/lib/event-delivery.js +66 -0
  73. package/dist/internal/lib/experience-runtime.d.ts +2 -1
  74. package/dist/internal/lib/experience-runtime.js +5 -3
  75. package/dist/internal/lib/font-files/OFL-BricolageGrotesque.txt +93 -0
  76. package/dist/internal/lib/font-files/OFL-Figtree.txt +93 -0
  77. package/dist/internal/lib/font-files/bricolage-grotesque-latin-variable.woff2 +0 -0
  78. package/dist/internal/lib/font-files/figtree-latin-variable.woff2 +0 -0
  79. package/dist/internal/lib/fonts.js +13 -12
  80. package/dist/internal/lib/health-model.d.ts +58 -0
  81. package/dist/internal/lib/health-model.js +140 -0
  82. package/dist/internal/lib/integration-console-href.d.ts +15 -0
  83. package/dist/internal/lib/integration-console-href.js +16 -0
  84. package/dist/internal/lib/oauth-setup-guide.d.ts +28 -0
  85. package/dist/internal/lib/oauth-setup-guide.js +35 -1
  86. package/dist/internal/lib/operation-catalog.d.ts +70 -0
  87. package/dist/internal/lib/operation-catalog.js +261 -0
  88. package/dist/internal/lib/overview-model.d.ts +34 -0
  89. package/dist/internal/lib/overview-model.js +91 -0
  90. package/dist/internal/lib/registry-entry.d.ts +8 -0
  91. package/dist/internal/lib/registry-entry.js +11 -0
  92. package/dist/internal/lib/repo-name.d.ts +9 -0
  93. package/dist/internal/lib/repo-name.js +21 -0
  94. package/dist/internal/lib/run-log-view.d.ts +66 -1
  95. package/dist/internal/lib/run-log-view.js +183 -4
  96. package/dist/internal/lib/runner-view.d.ts +15 -0
  97. package/dist/internal/lib/runner-view.js +18 -0
  98. package/dist/internal/lib/schema-form-model.d.ts +17 -0
  99. package/dist/internal/lib/schema-form-model.js +50 -0
  100. package/dist/internal/lib/setup-checklist.d.ts +34 -0
  101. package/dist/internal/lib/setup-checklist.js +79 -0
  102. package/dist/internal/lib/toolbar-context.d.ts +0 -1
  103. package/dist/internal/lib/toolbar-context.js +0 -2
  104. package/dist/internal/lib/toolbar-visibility.d.ts +9 -2
  105. package/dist/internal/lib/toolbar-visibility.js +5 -0
  106. package/dist/internal/lib/use-operation-effects.d.ts +7 -0
  107. package/dist/internal/lib/use-operation-effects.js +28 -0
  108. package/dist/internal/lib/use-run-log-query.d.ts +9 -0
  109. package/dist/internal/lib/use-run-log-query.js +35 -0
  110. package/dist/internal/lib/widget-grid-gaps.d.ts +18 -0
  111. package/dist/internal/lib/widget-grid-gaps.js +41 -0
  112. package/dist/internal/lib/workflow-summary.d.ts +54 -0
  113. package/dist/internal/lib/workflow-summary.js +147 -0
  114. package/dist/internal/routes/console-home-page.js +2 -1
  115. package/dist/internal/routes/experience-connect-page.js +51 -22
  116. package/dist/internal/routes/experience-layout-page.js +75 -26
  117. package/dist/internal/routes/experience-page-host.js +63 -5
  118. package/dist/internal/routes/experience-review-queue-page.d.ts +4 -1
  119. package/dist/internal/routes/experience-review-queue-page.js +108 -12
  120. package/dist/internal/routes/experience-runs-page.js +57 -4
  121. package/dist/internal/routes/experience-summary-page.d.ts +19 -0
  122. package/dist/internal/routes/experience-summary-page.js +219 -62
  123. package/dist/internal/routes/experience-widget-page.js +58 -7
  124. package/dist/internal/routes/experience-widgets-page.d.ts +2 -3
  125. package/dist/internal/routes/experience-widgets-page.js +29 -4
  126. package/dist/internal/routes/experience-workflow-page.js +81 -9
  127. package/dist/internal/routes/experience-workflows-page.js +85 -21
  128. package/dist/internal/routes/integration-layout.js +28 -3
  129. package/dist/internal/routes/integrations-connect-page.js +16 -6
  130. package/dist/internal/routes/integrations-events-page.js +22 -1
  131. package/dist/internal/routes/integrations-health-page.js +16 -1
  132. package/dist/internal/routes/integrations-layout.js +28 -4
  133. package/dist/internal/routes/integrations-list-page.d.ts +0 -1
  134. package/dist/internal/routes/integrations-list-page.js +11 -9
  135. package/dist/internal/routes/integrations-operation-page.js +53 -17
  136. package/dist/internal/routes/integrations-operations-page.js +539 -49
  137. package/dist/internal/routes/integrations-overview-page.js +332 -69
  138. package/dist/internal/routes/integrations-runs-page.js +53 -3
  139. package/dist/internal/routes/integrations-scope.d.ts +15 -2
  140. package/dist/internal/routes/integrations-scope.js +66 -18
  141. package/dist/internal/routes/preview-index-page.js +2 -2
  142. package/dist/internal/routes/repo-home-page.d.ts +2 -2
  143. package/dist/internal/routes/repo-home-page.js +428 -236
  144. package/dist/internal/routes/repo-layout.d.ts +12 -0
  145. package/dist/internal/routes/repo-layout.js +50 -38
  146. package/dist/internal/routes/repo-package-layouts.js +22 -8
  147. package/dist/internal/routes/single-widget-page.d.ts +1 -1
  148. package/dist/internal/routes/single-widget-page.js +28 -5
  149. package/dist/internal/routes/tile-page.d.ts +1 -1
  150. package/dist/internal/routes/tile-page.js +1 -2
  151. package/dist/internal/routes/widgets-page.d.ts +1 -1
  152. package/dist/internal/routes/widgets-page.js +5 -3
  153. package/dist/internal/server/ekanos-api-router.js +20 -5
  154. package/dist/internal/server/repo-api-router.js +20 -7
  155. package/dist/registry.d.ts +4 -5
  156. package/dist/registry.js +0 -1
  157. package/dist/routes.d.ts +5 -0
  158. package/dist/routes.js +2 -0
  159. package/package.json +8 -8
@@ -0,0 +1,66 @@
1
+ import { classify, objectProperties } from "./schema-form-model.js";
2
+ function asRecord(value) {
3
+ return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
4
+ }
5
+ function parseDeliveryDetail(detail) {
6
+ if (!detail) return null;
7
+ let parsed;
8
+ try {
9
+ parsed = JSON.parse(detail);
10
+ } catch {
11
+ return { kind: "unknown", text: detail };
12
+ }
13
+ const record = asRecord(parsed);
14
+ if (record?.reason === "no_handler") {
15
+ const webhooks = Array.isArray(record.webhooks) ? record.webhooks.filter((id) => typeof id === "string") : [];
16
+ return { kind: "no_handler", webhooks };
17
+ }
18
+ if (record && typeof record.webhook === "string") {
19
+ return {
20
+ kind: "ran",
21
+ webhook: record.webhook,
22
+ status: String(record.status ?? "unknown"),
23
+ ...typeof record.detail === "string" ? { detail: record.detail } : {},
24
+ ...Array.isArray(record.events) ? { events: record.events.length } : {}
25
+ };
26
+ }
27
+ return { kind: "unknown", text: detail };
28
+ }
29
+ function schemaTypeLabel(schema) {
30
+ const { kind, nullable, schema: inner } = classify(schema);
31
+ let label;
32
+ if (kind === "enum" && Array.isArray(inner.enum)) {
33
+ label = inner.enum.map((value) => JSON.stringify(value)).join(" | ");
34
+ } else if (kind === "array") {
35
+ const items = asRecord(inner.items);
36
+ label = items ? `${schemaTypeLabel(items)}[]` : "array";
37
+ } else if (kind === "unsupported") {
38
+ label = Array.isArray(inner.type) ? inner.type.join(" | ") : typeof inner.type === "string" ? inner.type : "any";
39
+ } else {
40
+ label = kind;
41
+ }
42
+ return nullable ? `${label} or null` : label;
43
+ }
44
+ function payloadFields(schema) {
45
+ return objectProperties(schema).map((property) => ({
46
+ key: property.key,
47
+ type: schemaTypeLabel(property.schema),
48
+ required: property.required,
49
+ ...typeof property.schema.description === "string" ? { description: property.schema.description } : {}
50
+ }));
51
+ }
52
+ function eventDescription(event) {
53
+ if (event.description) return event.description;
54
+ return typeof event.payloadSchema.description === "string" ? event.payloadSchema.description : null;
55
+ }
56
+ function eventDeliveries(runs, integration, event, limit = 5) {
57
+ const key = `event/${event}`;
58
+ return runs.filter((run) => run.integration === integration && run.opKey === key).slice().reverse().slice(0, limit);
59
+ }
60
+ export {
61
+ eventDeliveries,
62
+ eventDescription,
63
+ parseDeliveryDetail,
64
+ payloadFields,
65
+ schemaTypeLabel
66
+ };
@@ -26,7 +26,8 @@ export interface ExperienceRuntimeLinks {
26
26
  * of this experience by `id` (`<experience>/pages/<id>`, the route
27
27
  * `ExperiencePageHost` serves) and where to connect an integration (a repo
28
28
  * shell's `<experience>/connect` tab; a single project's
29
- * `/integrations/<name>/connect`). `navigate` is injectable for tests.
29
+ * `/integrations/<name>/connect`, or the experience view for a namespaced
30
+ * one). `navigate` is injectable for tests.
30
31
  */
31
32
  export declare function withExperienceLinks(runtime: ExperienceRuntime, options: {
32
33
  links: ExperienceRuntimeLinks;
@@ -45,6 +45,10 @@ function createExperienceRuntime(apiPrefix, options = {}) {
45
45
  }))
46
46
  };
47
47
  }
48
+ function connectHref(integration, links) {
49
+ if (links.repoHome !== null) return `${links.experience}/connect`;
50
+ return integration.includes("/") ? links.experience : `/integrations/${encodeURIComponent(integration)}/connect`;
51
+ }
48
52
  function withExperienceLinks(runtime, options) {
49
53
  const navigate = options.navigate ?? ((href) => globalThis.location.assign(href));
50
54
  return {
@@ -52,9 +56,7 @@ function withExperienceLinks(runtime, options) {
52
56
  pageHref: (page) => options.pageIds.includes(page) ? `${options.links.experience}/pages/${encodeURIComponent(page)}` : null,
53
57
  connect: (integration) => {
54
58
  if (!options.integrationNames().includes(integration)) return false;
55
- navigate(
56
- options.links.repoHome === null ? `/integrations/${encodeURIComponent(integration)}/connect` : `${options.links.experience}/connect`
57
- );
59
+ navigate(connectHref(integration, options.links));
58
60
  return true;
59
61
  }
60
62
  };
@@ -0,0 +1,93 @@
1
+ Copyright 2022 The Bricolage Grotesque Project Authors (https://github.com/ateliertriay/bricolage)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ https://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,93 @@
1
+ Copyright 2022 The Figtree Project Authors (https://github.com/erikdkennedy/figtree)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -1,20 +1,21 @@
1
- import {
2
- Bricolage_Grotesque as HeadingFont,
3
- Figtree as SansFont
4
- } from "next/font/google";
5
- const sans = SansFont({
6
- subsets: ["latin"],
1
+ import localFont from "next/font/local";
2
+ const sans = localFont({
3
+ src: "./font-files/figtree-latin-variable.woff2",
4
+ weight: "300 700",
5
+ style: "normal",
6
+ display: "swap",
7
7
  variable: "--font-sans-fallback",
8
8
  fallback: ["system-ui", "Helvetica Neue", "Helvetica", "Arial"],
9
- preload: true,
10
- weight: ["300", "400", "500", "600", "700"]
9
+ preload: true
11
10
  });
12
- const heading = HeadingFont({
13
- subsets: ["latin"],
11
+ const heading = localFont({
12
+ src: "./font-files/bricolage-grotesque-latin-variable.woff2",
13
+ weight: "200 800",
14
+ style: "normal",
15
+ display: "swap",
14
16
  variable: "--font-heading-fallback",
15
17
  fallback: ["system-ui", "Helvetica Neue", "Helvetica", "Arial"],
16
- preload: true,
17
- weight: ["200", "300", "400", "500", "600", "700", "800"]
18
+ preload: true
18
19
  });
19
20
  const fontVariables = [sans, heading].map((f) => f.variable).join(" ");
20
21
  export {
@@ -0,0 +1,58 @@
1
+ import type { IntegrationConnectionFacts } from '../../api-types.js';
2
+ import type { HealthResult } from './console-types.js';
3
+ /** The last Run check this session, kept in the query cache under `healthKey`. */
4
+ export type HealthRecord = {
5
+ kind: 'result';
6
+ result: HealthResult;
7
+ at: string;
8
+ } | {
9
+ kind: 'error';
10
+ message: string;
11
+ at: string;
12
+ };
13
+ export declare const healthKey: (integration: string) => readonly ['console', 'health', string];
14
+ type Tone = 'clear' | 'warning' | 'destructive' | 'neutral';
15
+ export interface HealthVerdict {
16
+ tone: Tone;
17
+ headline: string;
18
+ detail: string;
19
+ }
20
+ /**
21
+ * The one-line answer at the top of the Health tab. `declared` is whether the
22
+ * definition has a `health.check` (undefined when the shell gave no
23
+ * definition to read).
24
+ */
25
+ export declare function healthVerdict(args: {
26
+ last: HealthRecord | null;
27
+ declared: boolean | undefined;
28
+ slug: string;
29
+ }): HealthVerdict;
30
+ /**
31
+ * Whether there is a check to run: false once the definition is known to
32
+ * declare none, or the server answered that it ran nothing.
33
+ */
34
+ export declare function hasHealthCheck(args: {
35
+ last: HealthRecord | null;
36
+ declared: boolean | undefined;
37
+ }): boolean;
38
+ /**
39
+ * The few lines a developer adds to `defineIntegration({ … })` to declare a
40
+ * check, probing the first literal origin the integration's egress allows.
41
+ * `check` gets the integration context and resolves a status and an optional
42
+ * detail (`IntegrationHealthDeclaration` in the SDK).
43
+ */
44
+ export declare function healthCheckSnippet(egress?: readonly string[]): string;
45
+ export interface HealthCheckRow {
46
+ id: 'connection' | 'probe';
47
+ label: string;
48
+ detail: string;
49
+ status: string;
50
+ tone: Tone;
51
+ }
52
+ /** The individual checks: the connection the probe needs, then the probe. */
53
+ export declare function healthCheckRows(args: {
54
+ facts: IntegrationConnectionFacts | null;
55
+ last: HealthRecord | null;
56
+ declared: boolean | undefined;
57
+ }): HealthCheckRow[];
58
+ export {};
@@ -0,0 +1,140 @@
1
+ import { CONNECTION_STATE_LABEL } from "./connection-facts.js";
2
+ const healthKey = (integration) => ["console", "health", integration];
3
+ function healthVerdict(args) {
4
+ const { last, declared, slug } = args;
5
+ if (last?.kind === "error") {
6
+ return {
7
+ tone: "destructive",
8
+ headline: "The check could not run",
9
+ detail: last.message
10
+ };
11
+ }
12
+ if (last?.kind === "result" && last.result.checked === false) {
13
+ return noCheck(slug);
14
+ }
15
+ if (!last) {
16
+ if (declared === false) return noCheck(slug);
17
+ return {
18
+ tone: "neutral",
19
+ headline: "Not checked yet",
20
+ detail: `Run the check to see whether ${slug} answers with the connection it has now.`
21
+ };
22
+ }
23
+ const { status, message } = last.result;
24
+ switch (status) {
25
+ case "healthy":
26
+ return {
27
+ tone: "clear",
28
+ headline: "Healthy",
29
+ detail: message ?? `${slug} answered its health check.`
30
+ };
31
+ case "degraded":
32
+ return {
33
+ tone: "warning",
34
+ headline: "Degraded",
35
+ detail: message ?? `${slug} answered, but reported a problem.`
36
+ };
37
+ case "unhealthy":
38
+ return {
39
+ tone: "destructive",
40
+ headline: "Failing",
41
+ detail: message ?? `${slug} did not pass its health check.`
42
+ };
43
+ default:
44
+ return {
45
+ tone: "neutral",
46
+ headline: "Unknown",
47
+ detail: message ?? `${slug}'s check could not tell either way.`
48
+ };
49
+ }
50
+ }
51
+ function noCheck(slug) {
52
+ return {
53
+ tone: "neutral",
54
+ headline: "No health check declared",
55
+ detail: `${slug} has no health.check in its definition, so there is nothing to run here. A check probes the vendor with the live connection.`
56
+ };
57
+ }
58
+ function hasHealthCheck(args) {
59
+ if (args.last?.kind === "result" && args.last.result.checked === false) {
60
+ return false;
61
+ }
62
+ return args.declared !== false;
63
+ }
64
+ const PLACEHOLDER_ORIGIN = "https://api.example.com";
65
+ function healthCheckSnippet(egress) {
66
+ const origin = egress?.find((entry) => !/[*{]/.test(entry))?.replace(/\/$/, "") ?? PLACEHOLDER_ORIGIN;
67
+ return [
68
+ "health: {",
69
+ " async check(ctx) {",
70
+ " // Any cheap call that needs the connection.",
71
+ ` const response = await ctx.fetch('${origin}/');`,
72
+ " return response.ok",
73
+ " ? { status: 'healthy' }",
74
+ " : { status: 'unhealthy', detail: `HTTP ${response.status}` };",
75
+ " },",
76
+ "},"
77
+ ].join("\n");
78
+ }
79
+ const CONNECTION_TONE = {
80
+ connected: "clear",
81
+ not_connected: "warning",
82
+ no_connection_needed: "clear",
83
+ managed: "neutral",
84
+ unreadable: "destructive"
85
+ };
86
+ const PROBE = {
87
+ healthy: { status: "Healthy", tone: "clear" },
88
+ degraded: { status: "Degraded", tone: "warning" },
89
+ unhealthy: { status: "Failing", tone: "destructive" },
90
+ unknown: { status: "Unknown", tone: "neutral" }
91
+ };
92
+ function healthCheckRows(args) {
93
+ const { facts, last, declared } = args;
94
+ const connection = facts ? {
95
+ id: "connection",
96
+ label: "Connection",
97
+ detail: facts.state === "not_connected" ? "Credentials are missing, so a live call cannot authenticate." : facts.state === "no_connection_needed" ? "Nothing to connect: live calls need no credentials." : facts.state === "connected" ? "Credentials are saved on this machine." : facts.detail ?? CONNECTION_STATE_LABEL[facts.state],
98
+ status: CONNECTION_STATE_LABEL[facts.state],
99
+ tone: CONNECTION_TONE[facts.state]
100
+ } : {
101
+ id: "connection",
102
+ label: "Connection",
103
+ detail: "Reading the stored credentials.",
104
+ status: "Checking",
105
+ tone: "neutral"
106
+ };
107
+ const notDeclared = last?.kind === "result" && last.result.checked === false || !last && declared === false;
108
+ const probe = notDeclared ? {
109
+ id: "probe",
110
+ label: "Vendor health check",
111
+ detail: "The definition declares no health.check.",
112
+ status: "Not declared",
113
+ tone: "neutral"
114
+ } : last?.kind === "error" ? {
115
+ id: "probe",
116
+ label: "Vendor health check",
117
+ detail: last.message,
118
+ status: "Error",
119
+ tone: "destructive"
120
+ } : last?.kind === "result" ? {
121
+ id: "probe",
122
+ label: "Vendor health check",
123
+ detail: last.result.message ?? "The integration\u2019s health.check ran.",
124
+ ...PROBE[last.result.status]
125
+ } : {
126
+ id: "probe",
127
+ label: "Vendor health check",
128
+ detail: "The integration\u2019s own health.check, run against the vendor.",
129
+ status: "Not run",
130
+ tone: "neutral"
131
+ };
132
+ return [connection, probe];
133
+ }
134
+ export {
135
+ hasHealthCheck,
136
+ healthCheckRows,
137
+ healthCheckSnippet,
138
+ healthKey,
139
+ healthVerdict
140
+ };
@@ -0,0 +1,15 @@
1
+ import type { ConsoleIntegration } from './console-types.js';
2
+ /**
3
+ * Where an integration's console lives, or null when this harness serves none.
4
+ *
5
+ * The console route is one `[slug]` segment, so a namespaced id
6
+ * (`vastly-internal/news`) never routes as written. A package of this same repo
7
+ * is served under its bare slug; a bare id is served as itself; anything else
8
+ * (a registry or published integration) has no console here.
9
+ */
10
+ export declare function integrationConsoleHref(integration: Pick<ConsoleIntegration, 'integration' | 'provenance'>): string | null;
11
+ /**
12
+ * The integration a console `[slug]` segment names: the id itself, or the
13
+ * namespaced integration whose console is served under that bare slug.
14
+ */
15
+ export declare function integrationForSlug<T extends Pick<ConsoleIntegration, 'integration' | 'provenance'>>(integrations: readonly T[], slug: string): T | undefined;
@@ -0,0 +1,16 @@
1
+ function integrationConsoleHref(integration) {
2
+ const id = integration.integration;
3
+ const slash = id.lastIndexOf("/");
4
+ if (slash === -1) return `/integrations/${id}`;
5
+ const { provenance } = integration;
6
+ return provenance.kind === "local" && provenance.scope === "repo" ? `/integrations/${id.slice(slash + 1)}` : null;
7
+ }
8
+ function integrationForSlug(integrations, slug) {
9
+ return integrations.find((entry) => entry.integration === slug) ?? integrations.find(
10
+ (entry) => integrationConsoleHref(entry) === `/integrations/${slug}`
11
+ );
12
+ }
13
+ export {
14
+ integrationConsoleHref,
15
+ integrationForSlug
16
+ };
@@ -41,3 +41,31 @@ export declare function buildOAuthSetupGuide(args: {
41
41
  entry: Pick<HarnessIntegration, 'oauth'>;
42
42
  redirectUri: string;
43
43
  }): OAuthSetupGuide | null;
44
+ /**
45
+ * One OAuth connection's "where do I get these" guide for the Connect tab:
46
+ * the definition's own `setup` (console, guide, steps) for that connection,
47
+ * with `{callbackUrl}` and `{scopes}` filled the way the host fills them
48
+ * (`renderOAuthSetupSteps` in `@ekanos/integration-schema`), plus the harness
49
+ * entry's console label and notes for the main connection.
50
+ */
51
+ export interface ConnectionSetupGuide {
52
+ console: {
53
+ url: string;
54
+ label: string;
55
+ } | null;
56
+ guideUrl: string | null;
57
+ steps: string[];
58
+ notes: readonly string[];
59
+ redirectUri: string | null;
60
+ scopes: readonly string[];
61
+ }
62
+ export declare function buildConnectionSetupGuide(args: {
63
+ definition: Pick<IntegrationDefinition, 'oauth' | 'oauthConnections'>;
64
+ entry?: Pick<HarnessIntegration, 'oauth'>;
65
+ connectionId: string;
66
+ redirectUri: string | null;
67
+ }): ConnectionSetupGuide | null;
68
+ export declare function renderSetupSteps(steps: readonly string[], values: {
69
+ callbackUrl: string;
70
+ scopes: readonly string[];
71
+ }): string[];
@@ -16,6 +16,38 @@ function buildOAuthSetupGuide(args) {
16
16
  notes: setup?.notes ?? []
17
17
  };
18
18
  }
19
+ const MAIN_CONNECTION_ID = "default";
20
+ function buildConnectionSetupGuide(args) {
21
+ const main = args.connectionId === MAIN_CONNECTION_ID;
22
+ const declaration = main ? args.definition.oauth : args.definition.oauthConnections?.[args.connectionId];
23
+ if (!declaration) return null;
24
+ const entrySetup = main ? args.entry?.oauth?.setup : void 0;
25
+ const consoleUrl = entrySetup?.consoleUrl ?? declaration.setup?.consoleUrl;
26
+ const scopes = declaration.provider.scopes;
27
+ const callbackUrl = args.redirectUri ?? "the redirect URI shown here";
28
+ const guide = {
29
+ console: consoleUrl ? {
30
+ url: consoleUrl,
31
+ label: entrySetup?.consoleLabel ?? hostOf(consoleUrl)
32
+ } : null,
33
+ guideUrl: declaration.setup?.guideUrl ?? declaration.teamApp?.guideUrl ?? null,
34
+ steps: renderSetupSteps(declaration.setup?.steps ?? [], {
35
+ callbackUrl,
36
+ scopes
37
+ }),
38
+ notes: entrySetup?.notes ?? [],
39
+ redirectUri: args.redirectUri,
40
+ scopes
41
+ };
42
+ const empty = !guide.console && !guide.guideUrl && guide.steps.length === 0 && guide.notes.length === 0 && !guide.redirectUri;
43
+ return empty ? null : guide;
44
+ }
45
+ function renderSetupSteps(steps, values) {
46
+ const scopes = values.scopes.length > 0 ? values.scopes.join(", ") : "none";
47
+ return steps.map(
48
+ (step) => step.replaceAll("{callbackUrl}", values.callbackUrl).replaceAll("{scopes}", scopes)
49
+ );
50
+ }
19
51
  function hostOf(url) {
20
52
  try {
21
53
  return new URL(url).host;
@@ -24,5 +56,7 @@ function hostOf(url) {
24
56
  }
25
57
  }
26
58
  export {
27
- buildOAuthSetupGuide
59
+ buildConnectionSetupGuide,
60
+ buildOAuthSetupGuide,
61
+ renderSetupSteps
28
62
  };