@ekanos/harness 0.18.0 → 0.20.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/api-types.d.ts +490 -0
- package/dist/api-types.js +6 -0
- package/dist/api.d.ts +33 -0
- package/dist/api.js +36 -1
- package/dist/app.js +6 -1
- package/dist/internal/components/approvals-tray.d.ts +17 -0
- package/dist/internal/components/approvals-tray.js +116 -0
- package/dist/internal/components/ask-assistant-bridge.js +1 -1
- package/dist/internal/components/connect-controls.d.ts +12 -0
- package/dist/internal/components/connect-controls.js +69 -0
- package/dist/internal/components/connect-dialog.d.ts +19 -0
- package/dist/internal/components/connect-dialog.js +61 -0
- package/dist/internal/components/connect-panel.d.ts +25 -0
- package/dist/internal/components/connect-panel.js +292 -0
- package/dist/internal/components/connection-chip.d.ts +14 -0
- package/dist/internal/components/connection-chip.js +75 -0
- package/dist/internal/components/dashboard-grid.js +38 -24
- package/dist/internal/components/dev-toolbar.js +176 -103
- package/dist/internal/components/events-panel.d.ts +10 -0
- package/dist/internal/components/events-panel.js +111 -0
- package/dist/internal/components/health-panel.d.ts +4 -0
- package/dist/internal/components/health-panel.js +56 -0
- package/dist/internal/components/integration-badge.d.ts +29 -0
- package/dist/internal/components/integration-badge.js +105 -0
- package/dist/internal/components/local-oauth-panel.js +21 -1
- package/dist/internal/components/operation-runner-panel.d.ts +12 -0
- package/dist/internal/components/operation-runner-panel.js +331 -0
- package/dist/internal/components/provenance-banner.d.ts +12 -0
- package/dist/internal/components/provenance-banner.js +107 -0
- package/dist/internal/components/repo-connection.d.ts +10 -0
- package/dist/internal/components/repo-connection.js +32 -0
- package/dist/internal/components/run-log.d.ts +9 -0
- package/dist/internal/components/run-log.js +228 -0
- package/dist/internal/components/runtime-strip.d.ts +12 -0
- package/dist/internal/components/runtime-strip.js +158 -0
- package/dist/internal/components/schema-form.d.ts +13 -0
- package/dist/internal/components/schema-form.js +382 -0
- package/dist/internal/components/scrollable-nav.d.ts +12 -0
- package/dist/internal/components/scrollable-nav.js +68 -0
- package/dist/internal/components/surface-nav.d.ts +31 -1
- package/dist/internal/components/surface-nav.js +244 -31
- package/dist/internal/components/workflow-runner.d.ts +14 -0
- package/dist/internal/components/workflow-runner.js +104 -0
- package/dist/internal/lib/bundled-secrets.d.ts +9 -0
- package/dist/internal/lib/bundled-secrets.js +24 -0
- package/dist/internal/lib/chrome-slot.d.ts +2 -0
- package/dist/internal/lib/chrome-slot.js +25 -0
- package/dist/internal/lib/connection-facts.d.ts +44 -0
- package/dist/internal/lib/connection-facts.js +116 -0
- package/dist/internal/lib/console-client.d.ts +55 -0
- package/dist/internal/lib/console-client.js +295 -0
- package/dist/internal/lib/console-context.d.ts +56 -0
- package/dist/internal/lib/console-context.js +67 -0
- package/dist/internal/lib/console-hooks.d.ts +33 -0
- package/dist/internal/lib/console-hooks.js +118 -0
- package/dist/internal/lib/console-types.d.ts +279 -0
- package/dist/internal/lib/console-types.js +0 -0
- package/dist/internal/lib/experience-runtime.d.ts +8 -0
- package/dist/internal/lib/experience-runtime.js +22 -0
- package/dist/internal/lib/preview-sections.d.ts +13 -0
- package/dist/internal/lib/preview-sections.js +32 -0
- package/dist/internal/lib/repo-context.d.ts +20 -0
- package/dist/internal/lib/repo-context.js +64 -0
- package/dist/internal/lib/run-log-view.d.ts +24 -0
- package/dist/internal/lib/run-log-view.js +57 -0
- package/dist/internal/lib/schema-form-model.d.ts +34 -0
- package/dist/internal/lib/schema-form-model.js +272 -0
- package/dist/internal/lib/toolbar-context.d.ts +9 -1
- package/dist/internal/lib/toolbar-context.js +13 -3
- package/dist/internal/lib/toolbar-visibility.d.ts +16 -0
- package/dist/internal/lib/toolbar-visibility.js +31 -0
- package/dist/internal/registry-context.d.ts +2 -0
- package/dist/internal/registry-context.js +11 -9
- package/dist/internal/routes/activation-page.js +44 -20
- package/dist/internal/routes/console-home-page.d.ts +5 -0
- package/dist/internal/routes/console-home-page.js +18 -0
- package/dist/internal/routes/experience-connect-page.d.ts +6 -0
- package/dist/internal/routes/experience-connect-page.js +127 -0
- package/dist/internal/routes/experience-layout-page.d.ts +8 -0
- package/dist/internal/routes/experience-layout-page.js +126 -0
- package/dist/internal/routes/experience-page-host.d.ts +7 -0
- package/dist/internal/routes/experience-page-host.js +79 -0
- package/dist/internal/routes/experience-review-queue-page.d.ts +2 -0
- package/dist/internal/routes/experience-review-queue-page.js +60 -0
- package/dist/internal/routes/experience-runs-page.d.ts +1 -0
- package/dist/internal/routes/experience-runs-page.js +13 -0
- package/dist/internal/routes/experience-summary-page.d.ts +1 -0
- package/dist/internal/routes/experience-summary-page.js +101 -0
- package/dist/internal/routes/experience-widget-page.d.ts +1 -0
- package/dist/internal/routes/experience-widget-page.js +26 -0
- package/dist/internal/routes/experience-widgets-page.d.ts +6 -0
- package/dist/internal/routes/experience-widgets-page.js +22 -0
- package/dist/internal/routes/experience-workflow-page.d.ts +1 -0
- package/dist/internal/routes/experience-workflow-page.js +24 -0
- package/dist/internal/routes/experience-workflows-page.d.ts +1 -0
- package/dist/internal/routes/experience-workflows-page.js +44 -0
- package/dist/internal/routes/index-page.d.ts +10 -9
- package/dist/internal/routes/index-page.js +3 -68
- package/dist/internal/routes/integration-layout.d.ts +12 -1
- package/dist/internal/routes/integration-layout.js +20 -6
- package/dist/internal/routes/integrations-connect-page.d.ts +1 -0
- package/dist/internal/routes/integrations-connect-page.js +19 -0
- package/dist/internal/routes/integrations-events-page.d.ts +1 -0
- package/dist/internal/routes/integrations-events-page.js +10 -0
- package/dist/internal/routes/integrations-health-page.d.ts +1 -0
- package/dist/internal/routes/integrations-health-page.js +10 -0
- package/dist/internal/routes/integrations-layout.d.ts +17 -0
- package/dist/internal/routes/integrations-layout.js +106 -0
- package/dist/internal/routes/integrations-list-page.d.ts +2 -0
- package/dist/internal/routes/integrations-list-page.js +94 -0
- package/dist/internal/routes/integrations-operation-page.d.ts +1 -0
- package/dist/internal/routes/integrations-operation-page.js +29 -0
- package/dist/internal/routes/integrations-operations-page.d.ts +1 -0
- package/dist/internal/routes/integrations-operations-page.js +61 -0
- package/dist/internal/routes/integrations-overview-page.d.ts +1 -0
- package/dist/internal/routes/integrations-overview-page.js +90 -0
- package/dist/internal/routes/integrations-runs-page.d.ts +1 -0
- package/dist/internal/routes/integrations-runs-page.js +14 -0
- package/dist/internal/routes/integrations-scope.d.ts +12 -0
- package/dist/internal/routes/integrations-scope.js +39 -0
- package/dist/internal/routes/legacy-preview-redirect.d.ts +6 -0
- package/dist/internal/routes/legacy-preview-redirect.js +12 -0
- package/dist/internal/routes/preview-index-page.d.ts +2 -0
- package/dist/internal/routes/preview-index-page.js +14 -0
- package/dist/internal/routes/repo-connections-page.d.ts +6 -0
- package/dist/internal/routes/repo-connections-page.js +8 -0
- package/dist/internal/routes/repo-home-page.d.ts +2 -0
- package/dist/internal/routes/repo-home-page.js +320 -0
- package/dist/internal/routes/repo-layout.d.ts +7 -0
- package/dist/internal/routes/repo-layout.js +76 -0
- package/dist/internal/routes/repo-package-layouts.d.ts +20 -0
- package/dist/internal/routes/repo-package-layouts.js +104 -0
- package/dist/internal/routes/root-layout.d.ts +3 -1
- package/dist/internal/routes/root-layout.js +13 -3
- package/dist/internal/routes/single-widget-page.js +5 -12
- package/dist/internal/routes/tile-page.js +20 -41
- package/dist/internal/routes/triggers-page.js +55 -62
- package/dist/internal/routes/widgets-page.js +1 -1
- package/dist/internal/server/api-router.js +46 -4
- package/dist/internal/server/approvals.d.ts +44 -0
- package/dist/internal/server/approvals.js +76 -0
- package/dist/internal/server/contract-sources.d.ts +28 -0
- package/dist/internal/server/contract-sources.js +83 -0
- package/dist/internal/server/definition-loader.d.ts +22 -0
- package/dist/internal/server/definition-loader.js +125 -0
- package/dist/internal/server/ekanos-api-router.d.ts +34 -0
- package/dist/internal/server/ekanos-api-router.js +835 -0
- package/dist/internal/server/experience-loader.d.ts +57 -0
- package/dist/internal/server/experience-loader.js +146 -0
- package/dist/internal/server/integration-lookup.d.ts +29 -0
- package/dist/internal/server/integration-lookup.js +33 -0
- package/dist/internal/server/integration-resolver.d.ts +121 -0
- package/dist/internal/server/integration-resolver.js +605 -0
- package/dist/internal/server/live-invoker.d.ts +11 -0
- package/dist/internal/server/live-invoker.js +106 -0
- package/dist/internal/server/local-secrets.d.ts +82 -1
- package/dist/internal/server/local-secrets.js +112 -1
- package/dist/internal/server/local-state.d.ts +12 -0
- package/dist/internal/server/local-state.js +45 -0
- package/dist/internal/server/oauth-persistence.d.ts +19 -0
- package/dist/internal/server/oauth-persistence.js +76 -0
- package/dist/internal/server/operation-runner.d.ts +95 -0
- package/dist/internal/server/operation-runner.js +231 -0
- package/dist/internal/server/project-manifest.d.ts +71 -0
- package/dist/internal/server/project-manifest.js +215 -0
- package/dist/internal/server/registry-cache.d.ts +68 -0
- package/dist/internal/server/registry-cache.js +328 -0
- package/dist/internal/server/repo-api-router.d.ts +33 -0
- package/dist/internal/server/repo-api-router.js +391 -0
- package/dist/internal/server/run-log.d.ts +22 -0
- package/dist/internal/server/run-log.js +32 -0
- package/dist/internal/server/semantics.d.ts +28 -0
- package/dist/internal/server/semantics.js +67 -0
- package/dist/internal/server/session-catalog.d.ts +67 -0
- package/dist/internal/server/session-catalog.js +18 -0
- package/dist/internal/server/workflow-runner.d.ts +36 -0
- package/dist/internal/server/workflow-runner.js +183 -0
- package/dist/registry.d.ts +7 -0
- package/dist/resolver.d.ts +145 -0
- package/dist/resolver.js +211 -0
- package/dist/routes.d.ts +66 -2
- package/dist/routes.js +61 -3
- package/dist/runtime.d.ts +46 -0
- package/dist/runtime.js +60 -0
- package/package.json +23 -9
- package/dist/internal/routes/integration-index-page.d.ts +0 -13
- package/dist/internal/routes/integration-index-page.js +0 -17
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
const UNSUPPORTED_KEYWORDS = [
|
|
2
|
+
"oneOf",
|
|
3
|
+
"allOf",
|
|
4
|
+
"$ref",
|
|
5
|
+
"if",
|
|
6
|
+
"then",
|
|
7
|
+
"else",
|
|
8
|
+
"not",
|
|
9
|
+
"patternProperties",
|
|
10
|
+
"prefixItems",
|
|
11
|
+
"dependentSchemas"
|
|
12
|
+
];
|
|
13
|
+
function asRecord(value) {
|
|
14
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
15
|
+
}
|
|
16
|
+
function asArray(value) {
|
|
17
|
+
return Array.isArray(value) ? value : null;
|
|
18
|
+
}
|
|
19
|
+
function stripNull(schema) {
|
|
20
|
+
const type = schema.type;
|
|
21
|
+
if (Array.isArray(type)) {
|
|
22
|
+
const rest = type.filter((entry) => entry !== "null");
|
|
23
|
+
const nullable = rest.length !== type.length;
|
|
24
|
+
if (rest.length === 1) {
|
|
25
|
+
return { schema: { ...schema, type: rest[0] }, nullable, ok: true };
|
|
26
|
+
}
|
|
27
|
+
return { schema, nullable, ok: false };
|
|
28
|
+
}
|
|
29
|
+
const anyOf = asArray(schema.anyOf);
|
|
30
|
+
if (anyOf) {
|
|
31
|
+
const rest = anyOf.map(asRecord).filter((entry) => entry !== null && entry.type !== "null");
|
|
32
|
+
if (rest.length === 1 && anyOf.length === 2 && rest[0]) {
|
|
33
|
+
const { anyOf: _drop, ...outer } = schema;
|
|
34
|
+
return { schema: { ...outer, ...rest[0] }, nullable: true, ok: true };
|
|
35
|
+
}
|
|
36
|
+
return { schema, nullable: false, ok: false };
|
|
37
|
+
}
|
|
38
|
+
return { schema, nullable: false, ok: true };
|
|
39
|
+
}
|
|
40
|
+
function classify(input) {
|
|
41
|
+
const { schema, nullable, ok } = stripNull(input);
|
|
42
|
+
if (!ok || UNSUPPORTED_KEYWORDS.some((keyword) => keyword in schema)) {
|
|
43
|
+
return { kind: "unsupported", nullable, schema };
|
|
44
|
+
}
|
|
45
|
+
if (asArray(schema.enum)) return { kind: "enum", nullable, schema };
|
|
46
|
+
switch (schema.type) {
|
|
47
|
+
case "object":
|
|
48
|
+
return asRecord(schema.properties) ? { kind: "object", nullable, schema } : { kind: "unsupported", nullable, schema };
|
|
49
|
+
case "array":
|
|
50
|
+
return asRecord(schema.items) ? { kind: "array", nullable, schema } : { kind: "unsupported", nullable, schema };
|
|
51
|
+
case "string":
|
|
52
|
+
case "number":
|
|
53
|
+
case "integer":
|
|
54
|
+
case "boolean":
|
|
55
|
+
return { kind: schema.type, nullable, schema };
|
|
56
|
+
default:
|
|
57
|
+
return { kind: "unsupported", nullable, schema };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function objectProperties(schema) {
|
|
61
|
+
const properties = asRecord(schema.properties) ?? {};
|
|
62
|
+
const required = new Set(
|
|
63
|
+
(asArray(schema.required) ?? []).filter(
|
|
64
|
+
(entry) => typeof entry === "string"
|
|
65
|
+
)
|
|
66
|
+
);
|
|
67
|
+
return Object.entries(properties).flatMap(([key, value]) => {
|
|
68
|
+
const child = asRecord(value);
|
|
69
|
+
return child ? [{ key, schema: child, required: required.has(key) }] : [];
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function initialValue(input) {
|
|
73
|
+
if ("default" in input) return input.default;
|
|
74
|
+
const examples = asArray(input.examples);
|
|
75
|
+
if (examples && examples.length > 0) return examples[0];
|
|
76
|
+
const { kind, schema } = classify(input);
|
|
77
|
+
switch (kind) {
|
|
78
|
+
case "object": {
|
|
79
|
+
const entries = objectProperties(schema).filter((property) => property.required).map((property) => [property.key, initialValue(property.schema)]);
|
|
80
|
+
return Object.fromEntries(entries);
|
|
81
|
+
}
|
|
82
|
+
case "array":
|
|
83
|
+
return [];
|
|
84
|
+
case "boolean":
|
|
85
|
+
return false;
|
|
86
|
+
case "string":
|
|
87
|
+
return "";
|
|
88
|
+
case "enum":
|
|
89
|
+
return asArray(schema.enum)?.[0];
|
|
90
|
+
default:
|
|
91
|
+
return void 0;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function typeOf(value) {
|
|
95
|
+
if (value === null) return "null";
|
|
96
|
+
if (Array.isArray(value)) return "array";
|
|
97
|
+
return typeof value;
|
|
98
|
+
}
|
|
99
|
+
function check(input, value, path, issues) {
|
|
100
|
+
const { kind, nullable, schema } = classify(input);
|
|
101
|
+
if (value === null) {
|
|
102
|
+
if (!nullable && kind !== "unsupported") {
|
|
103
|
+
issues.push({ path, message: "must not be null" });
|
|
104
|
+
}
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const enumValues = asArray(schema.enum);
|
|
108
|
+
if (enumValues) {
|
|
109
|
+
if (!enumValues.some((entry) => entry === value)) {
|
|
110
|
+
issues.push({
|
|
111
|
+
path,
|
|
112
|
+
message: `must be one of ${enumValues.map(String).join(", ")}`
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
switch (kind) {
|
|
118
|
+
case "string": {
|
|
119
|
+
if (typeof value !== "string") {
|
|
120
|
+
issues.push({
|
|
121
|
+
path,
|
|
122
|
+
message: `must be a string, got ${typeOf(value)}`
|
|
123
|
+
});
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const min = schema.minLength;
|
|
127
|
+
const max = schema.maxLength;
|
|
128
|
+
if (typeof min === "number" && value.length < min) {
|
|
129
|
+
issues.push({ path, message: `must be at least ${min} characters` });
|
|
130
|
+
}
|
|
131
|
+
if (typeof max === "number" && value.length > max) {
|
|
132
|
+
issues.push({ path, message: `must be at most ${max} characters` });
|
|
133
|
+
}
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
case "number":
|
|
137
|
+
case "integer": {
|
|
138
|
+
if (typeof value !== "number" || Number.isNaN(value)) {
|
|
139
|
+
issues.push({
|
|
140
|
+
path,
|
|
141
|
+
message: `must be a number, got ${typeOf(value)}`
|
|
142
|
+
});
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (kind === "integer" && !Number.isInteger(value)) {
|
|
146
|
+
issues.push({ path, message: "must be an integer" });
|
|
147
|
+
}
|
|
148
|
+
const min = schema.minimum;
|
|
149
|
+
const max = schema.maximum;
|
|
150
|
+
if (typeof min === "number" && value < min) {
|
|
151
|
+
issues.push({ path, message: `must be at least ${min}` });
|
|
152
|
+
}
|
|
153
|
+
if (typeof max === "number" && value > max) {
|
|
154
|
+
issues.push({ path, message: `must be at most ${max}` });
|
|
155
|
+
}
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
case "boolean":
|
|
159
|
+
if (typeof value !== "boolean") {
|
|
160
|
+
issues.push({
|
|
161
|
+
path,
|
|
162
|
+
message: `must be a boolean, got ${typeOf(value)}`
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
return;
|
|
166
|
+
case "array": {
|
|
167
|
+
if (!Array.isArray(value)) {
|
|
168
|
+
issues.push({
|
|
169
|
+
path,
|
|
170
|
+
message: `must be an array, got ${typeOf(value)}`
|
|
171
|
+
});
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
const min = schema.minItems;
|
|
175
|
+
const max = schema.maxItems;
|
|
176
|
+
if (typeof min === "number" && value.length < min) {
|
|
177
|
+
issues.push({ path, message: `must have at least ${min} items` });
|
|
178
|
+
}
|
|
179
|
+
if (typeof max === "number" && value.length > max) {
|
|
180
|
+
issues.push({ path, message: `must have at most ${max} items` });
|
|
181
|
+
}
|
|
182
|
+
const items = asRecord(schema.items);
|
|
183
|
+
if (items) {
|
|
184
|
+
value.forEach(
|
|
185
|
+
(item, index) => check(items, item, `${path}/${index}`, issues)
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
case "object": {
|
|
191
|
+
const record = asRecord(value);
|
|
192
|
+
if (!record) {
|
|
193
|
+
issues.push({
|
|
194
|
+
path,
|
|
195
|
+
message: `must be an object, got ${typeOf(value)}`
|
|
196
|
+
});
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const properties = objectProperties(schema);
|
|
200
|
+
for (const property of properties) {
|
|
201
|
+
const child = record[property.key];
|
|
202
|
+
if (child === void 0) {
|
|
203
|
+
if (property.required) {
|
|
204
|
+
issues.push({
|
|
205
|
+
path: `${path}/${property.key}`,
|
|
206
|
+
message: "is required"
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
check(property.schema, child, `${path}/${property.key}`, issues);
|
|
212
|
+
}
|
|
213
|
+
if (schema.additionalProperties === false) {
|
|
214
|
+
const known = new Set(properties.map((property) => property.key));
|
|
215
|
+
for (const key of Object.keys(record)) {
|
|
216
|
+
if (!known.has(key)) {
|
|
217
|
+
issues.push({
|
|
218
|
+
path: `${path}/${key}`,
|
|
219
|
+
message: "is not an allowed property"
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
default:
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
function validateValue(schema, value) {
|
|
231
|
+
const issues = [];
|
|
232
|
+
if (value === void 0) {
|
|
233
|
+
const { kind } = classify(schema);
|
|
234
|
+
if (kind !== "unsupported") {
|
|
235
|
+
issues.push({ path: "", message: "a value is required" });
|
|
236
|
+
}
|
|
237
|
+
return issues;
|
|
238
|
+
}
|
|
239
|
+
check(schema, value, "", issues);
|
|
240
|
+
return issues;
|
|
241
|
+
}
|
|
242
|
+
function issuesByPath(issues) {
|
|
243
|
+
const map = /* @__PURE__ */ new Map();
|
|
244
|
+
for (const issue of issues) {
|
|
245
|
+
if (!map.has(issue.path)) map.set(issue.path, issue.message);
|
|
246
|
+
}
|
|
247
|
+
return map;
|
|
248
|
+
}
|
|
249
|
+
function parseJsonText(text) {
|
|
250
|
+
if (text.trim() === "") return { ok: true, value: void 0 };
|
|
251
|
+
try {
|
|
252
|
+
const value = JSON.parse(text);
|
|
253
|
+
return { ok: true, value };
|
|
254
|
+
} catch (error) {
|
|
255
|
+
return {
|
|
256
|
+
ok: false,
|
|
257
|
+
error: error instanceof Error ? error.message : "Invalid JSON"
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
function formatJson(value) {
|
|
262
|
+
return value === void 0 ? "" : JSON.stringify(value, null, 2);
|
|
263
|
+
}
|
|
264
|
+
export {
|
|
265
|
+
classify,
|
|
266
|
+
formatJson,
|
|
267
|
+
initialValue,
|
|
268
|
+
issuesByPath,
|
|
269
|
+
objectProperties,
|
|
270
|
+
parseJsonText,
|
|
271
|
+
validateValue
|
|
272
|
+
};
|
|
@@ -53,9 +53,17 @@ export interface ToolbarState {
|
|
|
53
53
|
* harness has one obvious place to mount toolbar state and callers use a hook
|
|
54
54
|
* rather than reaching into module internals.
|
|
55
55
|
*/
|
|
56
|
-
export declare function ToolbarProvider({ children }: {
|
|
56
|
+
export declare function ToolbarProvider({ children, repo, }: {
|
|
57
57
|
children: ReactNode;
|
|
58
|
+
/** The shell serves a repo root, where each integration picks live or fixtures per operation. */
|
|
59
|
+
repo?: boolean;
|
|
58
60
|
}): import("react").JSX.Element;
|
|
61
|
+
/**
|
|
62
|
+
* True in a repo-root shell. There the global Data switch is replaced by each
|
|
63
|
+
* integration's own live or fixtures choice in its operation console, so the
|
|
64
|
+
* toolbar does not offer it.
|
|
65
|
+
*/
|
|
66
|
+
export declare function useRepoMode(): boolean;
|
|
59
67
|
export declare function useToolbar(): {
|
|
60
68
|
state: ToolbarState;
|
|
61
69
|
setState: (patch: Partial<ToolbarState>) => void;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import {
|
|
4
|
+
createContext,
|
|
5
|
+
use,
|
|
4
6
|
useCallback,
|
|
5
7
|
useMemo,
|
|
6
8
|
useSyncExternalStore
|
|
@@ -102,8 +104,15 @@ function writeState(next) {
|
|
|
102
104
|
}
|
|
103
105
|
listeners.forEach((listener) => listener());
|
|
104
106
|
}
|
|
105
|
-
function ToolbarProvider({
|
|
106
|
-
|
|
107
|
+
function ToolbarProvider({
|
|
108
|
+
children,
|
|
109
|
+
repo = false
|
|
110
|
+
}) {
|
|
111
|
+
return /* @__PURE__ */ jsx(RepoModeContext, { value: repo, children });
|
|
112
|
+
}
|
|
113
|
+
const RepoModeContext = createContext(false);
|
|
114
|
+
function useRepoMode() {
|
|
115
|
+
return use(RepoModeContext);
|
|
107
116
|
}
|
|
108
117
|
function useToolbar() {
|
|
109
118
|
const state = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
@@ -125,5 +134,6 @@ export {
|
|
|
125
134
|
RENDER_STATES,
|
|
126
135
|
ToolbarProvider,
|
|
127
136
|
VIEWPORTS,
|
|
137
|
+
useRepoMode,
|
|
128
138
|
useToolbar
|
|
129
139
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which dev-toolbar controls a page earns. Pure, so it is testable without a
|
|
3
|
+
* DOM.
|
|
4
|
+
*
|
|
5
|
+
* Render state, fixture scenario, viewport, collapsed and unhealthy drive the
|
|
6
|
+
* widget machinery, so they appear only where widgets render: an experience's
|
|
7
|
+
* Widgets tab and an integration's Preview surfaces. The Data switch also
|
|
8
|
+
* reaches the Triggers surface.
|
|
9
|
+
*/
|
|
10
|
+
export interface ToolbarControls {
|
|
11
|
+
/** Render state, fixture scenario, viewport, collapsed, unhealthy. */
|
|
12
|
+
widget: boolean;
|
|
13
|
+
/** The global Data switch (fixtures or live API). */
|
|
14
|
+
data: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function toolbarControlsFor(pathname: string): ToolbarControls;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
const RESERVED_FIRST_SEGMENTS = /* @__PURE__ */ new Set([
|
|
2
|
+
"integrations",
|
|
3
|
+
"experience",
|
|
4
|
+
"experiences",
|
|
5
|
+
"connections",
|
|
6
|
+
"api",
|
|
7
|
+
"__ekanos"
|
|
8
|
+
]);
|
|
9
|
+
const PREVIEW_WIDGET_SURFACES = /* @__PURE__ */ new Set(["widgets", "tile", "activation"]);
|
|
10
|
+
function previewSurface(segments) {
|
|
11
|
+
if (segments[0] === "integrations" && segments[2] === "preview") {
|
|
12
|
+
return segments[3] ?? null;
|
|
13
|
+
}
|
|
14
|
+
const first = segments[0];
|
|
15
|
+
if (first && !RESERVED_FIRST_SEGMENTS.has(first)) return segments[1] ?? null;
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
function isExperienceWidgets(segments) {
|
|
19
|
+
if (segments[0] === "experience") return segments[1] === "widgets";
|
|
20
|
+
if (segments[0] === "experiences") return segments[2] === "widgets";
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
function toolbarControlsFor(pathname) {
|
|
24
|
+
const segments = pathname.split("/").filter(Boolean);
|
|
25
|
+
const surface = previewSurface(segments);
|
|
26
|
+
const widget = isExperienceWidgets(segments) || surface !== null && PREVIEW_WIDGET_SURFACES.has(surface);
|
|
27
|
+
return { widget, data: widget || surface === "triggers" };
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
toolbarControlsFor
|
|
31
|
+
};
|
|
@@ -14,6 +14,8 @@ export declare function HarnessRegistryProvider({ integrations, children, }: {
|
|
|
14
14
|
* a wiring bug into a page that looks like it is working correctly.
|
|
15
15
|
*/
|
|
16
16
|
export declare function useHarnessRegistry(): HarnessIntegration[];
|
|
17
|
+
/** The registry when a provider is mounted, else `[]` (console tests, embeds). */
|
|
18
|
+
export declare function useOptionalHarnessRegistry(): HarnessIntegration[];
|
|
17
19
|
/**
|
|
18
20
|
* The integration named by the current `[slug]` segment, or `null`.
|
|
19
21
|
*
|
|
@@ -3,16 +3,14 @@ import { jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { createContext, use, useEffect } from "react";
|
|
4
4
|
import { useParams } from "next/navigation";
|
|
5
5
|
import { findIntegration } from "../registry.js";
|
|
6
|
+
import {
|
|
7
|
+
bundledSecretsWarning,
|
|
8
|
+
findBundledSecrets
|
|
9
|
+
} from "./lib/bundled-secrets.js";
|
|
6
10
|
const HarnessRegistryContext = createContext(null);
|
|
7
11
|
function warnAboutBundledSecrets(integrations) {
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
return Object.keys(secrets?.account ?? {}).length > 0 || Object.keys(secrets?.admin ?? {}).length > 0;
|
|
11
|
-
}).map((integration) => integration.slug);
|
|
12
|
-
if (withSecrets.length === 0) return;
|
|
13
|
-
console.warn(
|
|
14
|
-
`[harness] ${withSecrets.join(", ")} seed triggerMocks.secrets, and those literals are compiled into the browser bundle and written into the .next build output \u2014 the registry has to reach the client, so this is inherent, not a bug. Keep them fake, and do not commit or deploy the build directory.`
|
|
15
|
-
);
|
|
12
|
+
const warning = bundledSecretsWarning(findBundledSecrets(integrations));
|
|
13
|
+
if (warning) console.warn(warning);
|
|
16
14
|
}
|
|
17
15
|
let warnedAboutSecrets = false;
|
|
18
16
|
function HarnessRegistryProvider({
|
|
@@ -35,6 +33,9 @@ function useHarnessRegistry() {
|
|
|
35
33
|
}
|
|
36
34
|
return integrations;
|
|
37
35
|
}
|
|
36
|
+
function useOptionalHarnessRegistry() {
|
|
37
|
+
return use(HarnessRegistryContext) ?? [];
|
|
38
|
+
}
|
|
38
39
|
function useHarnessIntegration() {
|
|
39
40
|
const integrations = useHarnessRegistry();
|
|
40
41
|
const params = useParams();
|
|
@@ -47,5 +48,6 @@ export {
|
|
|
47
48
|
HarnessRegistryProvider,
|
|
48
49
|
useHarnessIntegration,
|
|
49
50
|
useHarnessRegistry,
|
|
50
|
-
useHarnessWidgetId
|
|
51
|
+
useHarnessWidgetId,
|
|
52
|
+
useOptionalHarnessRegistry
|
|
51
53
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useMemo, useState } from "react";
|
|
4
|
+
import Link from "next/link";
|
|
4
5
|
import { notFound } from "next/navigation";
|
|
5
6
|
import { Alert, AlertDescription, AlertTitle } from "@ekanos/ui/alert";
|
|
6
7
|
import { Badge } from "@ekanos/ui/badge";
|
|
@@ -15,7 +16,10 @@ import {
|
|
|
15
16
|
} from "@ekanos/ui/dialog";
|
|
16
17
|
import { StatusBadge } from "@ekanos/ui/status-badge";
|
|
17
18
|
import { HARNESS_ACCOUNT_ID } from "../../registry.js";
|
|
19
|
+
import { ConnectionChip } from "../components/connection-chip.js";
|
|
18
20
|
import { LocalOAuthPanel } from "../components/local-oauth-panel.js";
|
|
21
|
+
import { useOptionalConsoleClient } from "../lib/console-context.js";
|
|
22
|
+
import { useConnection } from "../lib/console-hooks.js";
|
|
19
23
|
import { useDefinitionMockContext } from "../lib/definition-mock-context.js";
|
|
20
24
|
import {
|
|
21
25
|
useHarnessDataMode,
|
|
@@ -30,14 +34,26 @@ import {
|
|
|
30
34
|
} from "../lib/trigger-runner.js";
|
|
31
35
|
import { useHarnessIntegration } from "../registry-context.js";
|
|
32
36
|
function ActivationPage() {
|
|
37
|
+
const client = useOptionalConsoleClient();
|
|
38
|
+
const integration = useHarnessIntegration();
|
|
39
|
+
if (!client) return /* @__PURE__ */ jsx(ActivationPageBody, { facts: null });
|
|
40
|
+
return /* @__PURE__ */ jsx(WithConnectionFacts, { slug: integration?.slug ?? "", children: (facts) => /* @__PURE__ */ jsx(ActivationPageBody, { facts }) });
|
|
41
|
+
}
|
|
42
|
+
function WithConnectionFacts({
|
|
43
|
+
slug,
|
|
44
|
+
children
|
|
45
|
+
}) {
|
|
46
|
+
const connection = useConnection(slug);
|
|
47
|
+
return /* @__PURE__ */ jsx(Fragment, { children: children(connection.data?.facts ?? null) });
|
|
48
|
+
}
|
|
49
|
+
function ActivationPageBody({
|
|
50
|
+
facts
|
|
51
|
+
}) {
|
|
33
52
|
const integration = useHarnessIntegration();
|
|
34
53
|
const [flow, setFlow] = useState(() => ({
|
|
35
|
-
//
|
|
36
|
-
//
|
|
37
|
-
|
|
38
|
-
// on top of it. Everything else opens straight into the connect flow.
|
|
39
|
-
open: !integration?.definition?.oauth,
|
|
40
|
-
connected: false,
|
|
54
|
+
// The dialog opens when the dev asks for it, never on arrival: the page
|
|
55
|
+
// reports the real connection first.
|
|
56
|
+
open: false,
|
|
41
57
|
result: null,
|
|
42
58
|
revealed: false,
|
|
43
59
|
activationHook: null
|
|
@@ -57,6 +73,7 @@ function ActivationPage() {
|
|
|
57
73
|
}, [integration, definition, mode, ctx]);
|
|
58
74
|
if (!integration) notFound();
|
|
59
75
|
const ActivationForm = integration.activationForm;
|
|
76
|
+
const connected = facts?.state === "connected";
|
|
60
77
|
const capabilities = definition?.capabilities ?? [];
|
|
61
78
|
const permissions = definition?.permissions ?? [];
|
|
62
79
|
const summary = definition?.description ?? integration.description;
|
|
@@ -67,18 +84,28 @@ function ActivationPage() {
|
|
|
67
84
|
"data-test": "activation",
|
|
68
85
|
children: [
|
|
69
86
|
/* @__PURE__ */ jsxs(Alert, { children: [
|
|
70
|
-
/* @__PURE__ */ jsx(AlertTitle, { children:
|
|
87
|
+
/* @__PURE__ */ jsx(AlertTitle, { children: "Activation preview" }),
|
|
71
88
|
/* @__PURE__ */ jsxs(AlertDescription, { children: [
|
|
72
|
-
/* @__PURE__ */ jsxs("p", { children: [
|
|
73
|
-
|
|
74
|
-
mode === "live" ? null : /* @__PURE__ */ jsx("code", { children: "ActivationResult" }),
|
|
75
|
-
mode === "live" ? "The" : "your form handed back instead of persisting it \u2014 which is the part worth checking, since that payload is what the real activation action would store. The",
|
|
76
|
-
"dialog, the capability and permission sections and the connected state are the real ones, rendered from your",
|
|
89
|
+
/* @__PURE__ */ jsxs("p", { "data-test": "activation-lead", children: [
|
|
90
|
+
"Preview of the activation form. Submitting saves to this machine. The dialog, the capability and permission sections and the connected state are the real ones, rendered from your",
|
|
77
91
|
" ",
|
|
78
92
|
/* @__PURE__ */ jsx("code", { children: "defineIntegration()" }),
|
|
79
93
|
" declaration."
|
|
80
94
|
] }),
|
|
81
|
-
/* @__PURE__ */ jsx("p", { "data-test": "activation-mode-notice-top", children: mode === "live" ? "Live API: an OAuth form\u2019s Connect runs the real loop
|
|
95
|
+
/* @__PURE__ */ jsx("p", { "data-test": "activation-mode-notice-top", children: mode === "live" ? "Live API: an OAuth form\u2019s Connect runs the real loop on localhost (see Local OAuth below), and widgets reach real vendors through useIntegrationFetch(). The host runs the same declarations, with real enforcement, after you publish." : "Fixtures: an OAuth form reads its connection status from oauth.connected in your harness entry, and nothing leaves your machine." }),
|
|
96
|
+
mode === "live" ? null : /* @__PURE__ */ jsxs("p", { "data-test": "activation-connect-hint", children: [
|
|
97
|
+
"To store real credentials for live operations, use the",
|
|
98
|
+
" ",
|
|
99
|
+
/* @__PURE__ */ jsx(
|
|
100
|
+
Link,
|
|
101
|
+
{
|
|
102
|
+
href: `/integrations/${integration.slug}/connect`,
|
|
103
|
+
className: "underline",
|
|
104
|
+
children: "Connect tab"
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
"."
|
|
108
|
+
] })
|
|
82
109
|
] })
|
|
83
110
|
] }),
|
|
84
111
|
/* @__PURE__ */ jsxs(
|
|
@@ -88,8 +115,8 @@ function ActivationPage() {
|
|
|
88
115
|
className: "flex flex-wrap items-center justify-between gap-3 p-5",
|
|
89
116
|
children: [
|
|
90
117
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
91
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
92
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-meta", children:
|
|
118
|
+
/* @__PURE__ */ jsx("span", { className: "flex flex-wrap items-center gap-x-3 gap-y-1", children: facts ? /* @__PURE__ */ jsx(ConnectionChip, { facts }) : /* @__PURE__ */ jsx("span", { className: "text-label", children: "Activation preview" }) }),
|
|
119
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-meta", children: connected ? "The dialog shows the manage view, whose only action is Disconnect." : definition?.oauth ? "Save your local OAuth credentials below, then open the connect dialog and click Connect." : "The dialog shows the scope disclosure and your activation form." })
|
|
93
120
|
] }),
|
|
94
121
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
95
122
|
/* @__PURE__ */ jsx(
|
|
@@ -111,7 +138,6 @@ function ActivationPage() {
|
|
|
111
138
|
clearLiveActivationData(integration.slug);
|
|
112
139
|
setFlow({
|
|
113
140
|
open: false,
|
|
114
|
-
connected: false,
|
|
115
141
|
result: null,
|
|
116
142
|
revealed: false,
|
|
117
143
|
activationHook: null
|
|
@@ -149,7 +175,7 @@ function ActivationPage() {
|
|
|
149
175
|
/* @__PURE__ */ jsxs("div", { className: "flex max-h-[70vh] flex-col gap-5 overflow-y-auto", children: [
|
|
150
176
|
/* @__PURE__ */ jsx(CapabilityList, { capabilities }),
|
|
151
177
|
/* @__PURE__ */ jsx(PermissionList, { permissions }),
|
|
152
|
-
|
|
178
|
+
connected ? /* @__PURE__ */ jsx(
|
|
153
179
|
ConnectedState,
|
|
154
180
|
{
|
|
155
181
|
name: integration.name,
|
|
@@ -159,7 +185,6 @@ function ActivationPage() {
|
|
|
159
185
|
clearLiveActivationData(integration.slug);
|
|
160
186
|
setFlow({
|
|
161
187
|
open: true,
|
|
162
|
-
connected: false,
|
|
163
188
|
result: null,
|
|
164
189
|
revealed: false,
|
|
165
190
|
activationHook: null
|
|
@@ -182,7 +207,6 @@ function ActivationPage() {
|
|
|
182
207
|
const activationHook = runner ? await runner.activate() : { status: "skipped" };
|
|
183
208
|
setFlow({
|
|
184
209
|
open: false,
|
|
185
|
-
connected: true,
|
|
186
210
|
result: result ?? null,
|
|
187
211
|
revealed: false,
|
|
188
212
|
activationHook
|
|
@@ -325,7 +349,7 @@ function ConnectedState({
|
|
|
325
349
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5", children: [
|
|
326
350
|
/* @__PURE__ */ jsxs("p", { className: "text-muted-foreground text-meta", children: [
|
|
327
351
|
name,
|
|
328
|
-
" is connected
|
|
352
|
+
" is connected."
|
|
329
353
|
] }),
|
|
330
354
|
/* @__PURE__ */ jsx(
|
|
331
355
|
"p",
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { redirect } from "next/navigation";
|
|
4
|
+
import { useProject } from "../lib/console-hooks.js";
|
|
5
|
+
function ConsoleHomePage() {
|
|
6
|
+
const project = useProject();
|
|
7
|
+
if (!project.data) {
|
|
8
|
+
return /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-meta", children: "Loading\u2026" });
|
|
9
|
+
}
|
|
10
|
+
const first = project.data.integrations[0];
|
|
11
|
+
if (project.data.kind === "integration" && first) {
|
|
12
|
+
redirect(`/integrations/${first.integration}`);
|
|
13
|
+
}
|
|
14
|
+
redirect("/experience");
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
ConsoleHomePage
|
|
18
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RepoClient } from '../lib/console-client.js';
|
|
2
|
+
/** `/experiences/<name>/connect`: what to connect before this experience runs live. */
|
|
3
|
+
export declare function ExperienceConnectPage({ client, name, }: {
|
|
4
|
+
client?: RepoClient;
|
|
5
|
+
name?: string;
|
|
6
|
+
}): import("react").JSX.Element;
|