@checkstack/backend-api 0.3.2 → 0.4.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 CHANGED
@@ -1,5 +1,40 @@
1
1
  # @checkstack/backend-api
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 83557c7: ## Multi-Type Editor Schema Support
8
+
9
+ - Added `editorTypes` support to zod-config for multi-type editor fields
10
+ - Extended schema-utils to handle editor type annotations
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [83557c7]
15
+ - @checkstack/common@0.4.0
16
+ - @checkstack/queue-api@0.1.2
17
+ - @checkstack/signal-common@0.1.2
18
+
19
+ ## 0.3.3
20
+
21
+ ### Patch Changes
22
+
23
+ - d94121b: Add group-to-role mapping for SAML and LDAP authentication
24
+
25
+ **Features:**
26
+
27
+ - SAML and LDAP users can now be automatically assigned Checkstack roles based on their directory group memberships
28
+ - Configure group mappings in the authentication strategy settings with dynamic role dropdowns
29
+ - Managed role sync: roles configured in mappings are fully synchronized (added when user gains group, removed when user leaves group)
30
+ - Unmanaged roles (manually assigned, not in any mapping) are preserved during sync
31
+ - Optional default role for all users from a directory
32
+
33
+ **Bug Fix:**
34
+
35
+ - Fixed `x-options-resolver` not working for fields inside arrays with `.default([])` in DynamicForm schemas
36
+ - @checkstack/queue-api@0.1.1
37
+
3
38
  ## 0.3.2
4
39
 
5
40
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@checkstack/backend-api",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "type": "module",
5
5
  "main": "./src/index.ts",
6
6
  "scripts": {
@@ -9,7 +9,7 @@ import { getConfigMeta } from "./zod-config";
9
9
  */
10
10
  function addSchemaMetadata(
11
11
  zodSchema: z.ZodTypeAny,
12
- jsonSchema: Record<string, unknown>
12
+ jsonSchema: Record<string, unknown>,
13
13
  ): void {
14
14
  // Handle arrays - recurse into items
15
15
  if (zodSchema instanceof z.ZodArray) {
@@ -28,6 +28,20 @@ function addSchemaMetadata(
28
28
  return;
29
29
  }
30
30
 
31
+ // Handle default - unwrap and recurse
32
+ if (zodSchema instanceof z.ZodDefault) {
33
+ const innerSchema = zodSchema.def.innerType as z.ZodTypeAny;
34
+ addSchemaMetadata(innerSchema, jsonSchema);
35
+ return;
36
+ }
37
+
38
+ // Handle nullable - unwrap and recurse
39
+ if (zodSchema instanceof z.ZodNullable) {
40
+ const innerSchema = zodSchema.unwrap() as z.ZodTypeAny;
41
+ addSchemaMetadata(innerSchema, jsonSchema);
42
+ return;
43
+ }
44
+
31
45
  // Type guard to check if this is an object schema
32
46
  if (!("shape" in zodSchema)) return;
33
47
 
@@ -50,6 +64,9 @@ function addSchemaMetadata(
50
64
  if (meta["x-secret"]) jsonField["x-secret"] = true;
51
65
  if (meta["x-color"]) jsonField["x-color"] = true;
52
66
  if (meta["x-hidden"]) jsonField["x-hidden"] = true;
67
+ if (meta["x-editor-types"]) {
68
+ jsonField["x-editor-types"] = meta["x-editor-types"];
69
+ }
53
70
  if (meta["x-options-resolver"]) {
54
71
  jsonField["x-options-resolver"] = meta["x-options-resolver"];
55
72
  if (meta["x-depends-on"])
package/src/zod-config.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { z } from "zod";
2
2
 
3
- // ============================================================================
4
- // CONFIG REGISTRY - Typed metadata for configuration schemas
5
- // ============================================================================
3
+ import type { EditorType } from "@checkstack/common";
4
+
5
+ // Re-export for local consumers
6
+ export type { EditorType } from "@checkstack/common";
6
7
 
7
8
  /**
8
9
  * Metadata type for configuration schemas.
@@ -21,6 +22,15 @@ export interface ConfigMeta {
21
22
  "x-depends-on"?: string[];
22
23
  /** If true, renders a searchable/filterable dropdown */
23
24
  "x-searchable"?: boolean;
25
+ /**
26
+ * Available editor types for this field. Renders a dropdown to select editor mode.
27
+ * When templateProperties are provided to DynamicForm, autocomplete works in all types.
28
+ * - "none": Field is disabled/empty
29
+ * - "raw": Multi-line textarea
30
+ * - "json": CodeEditor with JSON syntax highlighting
31
+ * - "formdata": Key/value pair editor (URL-encoded)
32
+ */
33
+ "x-editor-types"?: EditorType[];
24
34
  }
25
35
 
26
36
  /**
@@ -90,7 +100,7 @@ export function isHiddenSchema(schema: z.ZodTypeAny): boolean {
90
100
  * Get options resolver metadata for a schema.
91
101
  */
92
102
  export function getOptionsResolverMetadata(
93
- schema: z.ZodTypeAny
103
+ schema: z.ZodTypeAny,
94
104
  ):
95
105
  | { resolver: string; dependsOn?: string[]; searchable?: boolean }
96
106
  | undefined {