@checkstack/ui 1.8.3 → 1.10.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/CHANGELOG.md +83 -0
- package/package.json +6 -2
- package/scripts/generate-stdlib-types.ts +90 -0
- package/src/components/CodeEditor/CodeEditor.tsx +7 -0
- package/src/components/CodeEditor/MonacoEditor.tsx +203 -117
- package/src/components/CodeEditor/generateTypeDefinitions.ts +19 -26
- package/src/components/CodeEditor/generated/stdlib-types.json +1 -0
- package/src/components/CodeEditor/index.ts +7 -0
- package/src/components/CodeEditor/monacoStdlib.ts +62 -0
- package/src/components/CodeEditor/monacoWorkers.ts +118 -0
- package/src/components/CodeEditor/scriptContext.test.ts +280 -0
- package/src/components/CodeEditor/scriptContext.ts +467 -0
- package/src/components/CodeEditor/shellEnvVarMatcher.test.ts +95 -0
- package/src/components/CodeEditor/shellEnvVarMatcher.ts +70 -0
- package/src/components/DynamicForm/DynamicForm.tsx +6 -0
- package/src/components/DynamicForm/FormField.tsx +15 -0
- package/src/components/DynamicForm/MultiTypeEditorField.tsx +111 -6
- package/src/components/DynamicForm/index.ts +2 -0
- package/src/components/DynamicForm/starterTemplateSelector.test.ts +96 -0
- package/src/components/DynamicForm/starterTemplateSelector.ts +32 -0
- package/src/components/DynamicForm/types.ts +34 -1
- package/src/components/ListEmptyState.tsx +51 -0
- package/src/components/QueryErrorState.tsx +64 -0
- package/src/components/ResponsiveTable.tsx +92 -0
- package/src/components/Skeleton.tsx +39 -0
- package/src/hooks/useInitOnceForKey.test.ts +127 -0
- package/src/hooks/useInitOnceForKey.ts +87 -0
- package/src/index.ts +6 -0
- package/src/utils/toastTemplates.test.ts +82 -0
- package/src/utils/toastTemplates.ts +47 -0
- package/stories/ListEmptyState.stories.tsx +48 -0
- package/stories/QueryErrorState.stories.tsx +40 -0
- package/stories/ResponsiveTable.stories.tsx +93 -0
- package/stories/Skeleton.stories.tsx +53 -0
- package/stories/toastTemplates.stories.tsx +60 -0
- package/tsconfig.json +3 -1
|
@@ -63,55 +63,48 @@ declare const context: {
|
|
|
63
63
|
`);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
// Healthcheck script context (config-based)
|
|
66
|
+
// Healthcheck script context (config-based, ESM module).
|
|
67
|
+
// The runner spawns a Bun subprocess, sets \`globalThis.context\`, then
|
|
68
|
+
// dynamically imports the user module. So scripts can \`import\` from the
|
|
69
|
+
// Node standard library and \`export default\` their result.
|
|
67
70
|
if (options.collectorConfigSchema) {
|
|
68
71
|
const configType = jsonSchemaToTypeScript(options.collectorConfigSchema);
|
|
69
72
|
|
|
70
73
|
lines.push(`
|
|
71
|
-
/** Expected return
|
|
74
|
+
/** Expected return shape for inline-script health checks. */
|
|
72
75
|
interface HealthCheckScriptResult {
|
|
73
|
-
/** Whether the health check passed */
|
|
76
|
+
/** Whether the health check passed. */
|
|
74
77
|
success: boolean;
|
|
75
|
-
/** Optional status message */
|
|
78
|
+
/** Optional status message — surfaces in the run detail. */
|
|
76
79
|
message?: string;
|
|
77
|
-
/** Optional numeric value
|
|
80
|
+
/** Optional numeric value — feeds the value chart + anomaly detection. */
|
|
78
81
|
value?: number;
|
|
79
82
|
}
|
|
80
83
|
|
|
81
|
-
/**
|
|
84
|
+
/** Runtime context exposed as a global by the inline-script runner. */
|
|
82
85
|
declare const context: {
|
|
83
|
-
/**
|
|
86
|
+
/** Strongly-typed collector configuration. */
|
|
84
87
|
readonly config: ${configType};
|
|
85
88
|
};
|
|
86
89
|
`);
|
|
87
90
|
}
|
|
88
91
|
|
|
89
|
-
//
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
/** Log an info message */
|
|
94
|
-
log(...args: unknown[]): void;
|
|
95
|
-
/** Log a warning message */
|
|
96
|
-
warn(...args: unknown[]): void;
|
|
97
|
-
/** Log an error message */
|
|
98
|
-
error(...args: unknown[]): void;
|
|
99
|
-
/** Log an info message */
|
|
100
|
-
info(...args: unknown[]): void;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
/** Fetch API for making HTTP requests */
|
|
104
|
-
declare function fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
|
|
105
|
-
`);
|
|
106
|
-
|
|
92
|
+
// We deliberately don't redeclare `console`, `fetch`, the Node stdlib,
|
|
93
|
+
// or the Bun globals here — MonacoEditor mounts the bundled upstream
|
|
94
|
+
// `@types/node` + `bun-types` declarations into Monaco's virtual
|
|
95
|
+
// filesystem via `ensureMonacoStdlib`, so all of that is already in scope.
|
|
107
96
|
return lines.join("\n");
|
|
108
97
|
}
|
|
109
98
|
|
|
110
99
|
/**
|
|
111
100
|
* Convert a JSON Schema to a TypeScript type string.
|
|
112
101
|
* Handles objects, arrays, primitives, and enums.
|
|
102
|
+
*
|
|
103
|
+
* Exported for reuse by `scriptContext.ts`, which uses the same converter
|
|
104
|
+
* to build typed `context.config` / `context.event.payload` blocks for
|
|
105
|
+
* inline-script editors.
|
|
113
106
|
*/
|
|
114
|
-
function jsonSchemaToTypeScript(
|
|
107
|
+
export function jsonSchemaToTypeScript(
|
|
115
108
|
schema: JsonSchemaProperty,
|
|
116
109
|
indent: number = 0,
|
|
117
110
|
): string {
|