@powerduck/schema-designer 0.1.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 (102) hide show
  1. package/README.md +217 -0
  2. package/dist/InlineSchemaEditor-BssSx3SI.d.ts +6 -0
  3. package/dist/InlineSchemaEditor-Bua-lDhE.d.cts +6 -0
  4. package/dist/chunk-2XUQB6BQ.js +1896 -0
  5. package/dist/chunk-4H3LXOL4.cjs +1900 -0
  6. package/dist/chunk-7LG4MVMD.cjs +2 -0
  7. package/dist/chunk-BXFABOMJ.js +1475 -0
  8. package/dist/chunk-FTALJIVZ.js +1 -0
  9. package/dist/chunk-GTZH37JS.cjs +1120 -0
  10. package/dist/chunk-GWHDTTQK.js +1437 -0
  11. package/dist/chunk-GXXD6ITE.cjs +1477 -0
  12. package/dist/chunk-HI5FBHCO.js +1057 -0
  13. package/dist/chunk-KX3LFFOV.js +88 -0
  14. package/dist/chunk-MADPN2PJ.js +185 -0
  15. package/dist/chunk-NOUORNCI.cjs +1452 -0
  16. package/dist/chunk-O6PTRJQ5.js +1195 -0
  17. package/dist/chunk-OBHJC3I2.cjs +2 -0
  18. package/dist/chunk-OOSNM45O.cjs +264 -0
  19. package/dist/chunk-P5B3HSPY.js +244 -0
  20. package/dist/chunk-PBE36BVA.js +1 -0
  21. package/dist/chunk-PVEYKCM6.js +1 -0
  22. package/dist/chunk-QZADGAP3.cjs +1218 -0
  23. package/dist/chunk-S7GNTGEE.js +1 -0
  24. package/dist/chunk-SMBDRWV2.cjs +2 -0
  25. package/dist/chunk-THYDOHOP.cjs +2 -0
  26. package/dist/chunk-WRHWOMZQ.cjs +190 -0
  27. package/dist/chunk-YNKP5JJA.cjs +32 -0
  28. package/dist/chunk-YWDKCX6N.cjs +91 -0
  29. package/dist/chunk-ZHNYNFGL.js +28 -0
  30. package/dist/compat/inline.cjs +137 -0
  31. package/dist/compat/inline.css +275 -0
  32. package/dist/compat/inline.d.cts +6 -0
  33. package/dist/compat/inline.d.ts +6 -0
  34. package/dist/compat/inline.js +4 -0
  35. package/dist/compat/parameters.cjs +90 -0
  36. package/dist/compat/parameters.css +997 -0
  37. package/dist/compat/parameters.d.cts +70 -0
  38. package/dist/compat/parameters.d.ts +70 -0
  39. package/dist/compat/parameters.js +9 -0
  40. package/dist/compat/tree.cjs +142 -0
  41. package/dist/compat/tree.css +1069 -0
  42. package/dist/compat/tree.d.cts +4 -0
  43. package/dist/compat/tree.d.ts +4 -0
  44. package/dist/compat/tree.js +5 -0
  45. package/dist/compat/variable-editor.cjs +82 -0
  46. package/dist/compat/variable-editor.d.cts +68 -0
  47. package/dist/compat/variable-editor.d.ts +68 -0
  48. package/dist/compat/variable-editor.js +1 -0
  49. package/dist/core/index.cjs +197 -0
  50. package/dist/core/index.d.cts +21 -0
  51. package/dist/core/index.d.ts +21 -0
  52. package/dist/core/index.js +4 -0
  53. package/dist/index.cjs +35 -0
  54. package/dist/index.css +1791 -0
  55. package/dist/index.d.cts +9 -0
  56. package/dist/index.d.ts +9 -0
  57. package/dist/index.js +10 -0
  58. package/dist/parameterValue-2pL9n-3q.d.ts +8 -0
  59. package/dist/parameterValue-Cky9Lnd3.d.cts +8 -0
  60. package/dist/react/index.cjs +35 -0
  61. package/dist/react/index.css +1791 -0
  62. package/dist/react/index.d.cts +9 -0
  63. package/dist/react/index.d.ts +9 -0
  64. package/dist/react/index.js +10 -0
  65. package/dist/react/inlineSchemaEditor/index.cjs +97 -0
  66. package/dist/react/inlineSchemaEditor/index.css +275 -0
  67. package/dist/react/inlineSchemaEditor/index.d.cts +6 -0
  68. package/dist/react/inlineSchemaEditor/index.d.ts +6 -0
  69. package/dist/react/inlineSchemaEditor/index.js +4 -0
  70. package/dist/react/parametersTable/index.cjs +22 -0
  71. package/dist/react/parametersTable/index.css +997 -0
  72. package/dist/react/parametersTable/index.d.cts +7 -0
  73. package/dist/react/parametersTable/index.d.ts +7 -0
  74. package/dist/react/parametersTable/index.js +9 -0
  75. package/dist/react/parametersTable/libs/generateValue.cjs +558 -0
  76. package/dist/react/parametersTable/libs/generateValue.d.cts +17 -0
  77. package/dist/react/parametersTable/libs/generateValue.d.ts +17 -0
  78. package/dist/react/parametersTable/libs/generateValue.js +551 -0
  79. package/dist/react/schemaTreeEditor/index.cjs +18 -0
  80. package/dist/react/schemaTreeEditor/index.css +1069 -0
  81. package/dist/react/schemaTreeEditor/index.d.cts +7 -0
  82. package/dist/react/schemaTreeEditor/index.d.ts +7 -0
  83. package/dist/react/schemaTreeEditor/index.js +5 -0
  84. package/dist/react/variableTextEditor/index.cjs +11 -0
  85. package/dist/react/variableTextEditor/index.css +306 -0
  86. package/dist/react/variableTextEditor/index.d.cts +6 -0
  87. package/dist/react/variableTextEditor/index.d.ts +6 -0
  88. package/dist/react/variableTextEditor/index.js +2 -0
  89. package/dist/schema-CKAPsYeW.d.cts +41 -0
  90. package/dist/schema-o7OJRaJ8.d.ts +41 -0
  91. package/dist/styles.css +1791 -0
  92. package/dist/tree-D06Xa6_N.d.ts +95 -0
  93. package/dist/tree-Dq1Rk-CF.d.cts +95 -0
  94. package/dist/types-B27Dw9do.d.cts +163 -0
  95. package/dist/types-B27Dw9do.d.ts +163 -0
  96. package/dist/types-Bk9rzr6l.d.cts +48 -0
  97. package/dist/types-D2jEaM9Z.d.cts +145 -0
  98. package/dist/types-D2jEaM9Z.d.ts +145 -0
  99. package/dist/types-xAihO_KW.d.ts +48 -0
  100. package/dist/variableTextEditor.types-ClzvARvK.d.cts +49 -0
  101. package/dist/variableTextEditor.types-ClzvARvK.d.ts +49 -0
  102. package/package.json +130 -0
@@ -0,0 +1,95 @@
1
+ import { J as JSONSchema, F as FlatNode, b as JSONSchemaType, f as SchemaErrorHandler, e as SchemaEditorErrorScope } from './types-D2jEaM9Z.js';
2
+
3
+ /** Rejects keys that could reach Object.prototype. */
4
+ declare function isUnsafeKey(key: string): boolean;
5
+ declare function samePath(a: readonly string[], b: readonly string[]): boolean;
6
+ declare function isPlainObject(value: unknown): value is Record<string, unknown>;
7
+ /** Runs fn, converts any throw into a reported error plus a fallback value. */
8
+ declare function safeRun<T>(scope: SchemaEditorErrorScope, fn: () => T, fallback: T, onError?: SchemaErrorHandler, path?: string[]): T;
9
+ /**
10
+ * Structural clone that tolerates cyclic graphs.
11
+ * An already visited node is reused, so the cycle is preserved
12
+ * instead of blowing the stack.
13
+ */
14
+ declare function cloneSchema<T>(value: T, seen?: WeakMap<object, unknown>, depth?: number): T;
15
+ /**
16
+ * Writes `value` at `path`, sharing structure with `root` for untouched
17
+ * branches so row level memoization keeps working.
18
+ */
19
+ declare function setIn<T extends object>(root: T, path: string[], value: unknown): T;
20
+ declare function getIn(root: unknown, path: string[]): unknown;
21
+ /** Deletes the key at `path`, returning the same reference when nothing changed. */
22
+ declare function deleteIn<T extends object>(root: T, path: string[]): T;
23
+ /** Merges a partial patch into the schema object at `path`. */
24
+ declare function patchSchema<T extends object>(root: T, path: string[], patch: Record<string, unknown>): T;
25
+ /** Moves `fromKey` to `toIndex` inside an object, preserving insertion order. */
26
+ declare function reorderKeys<T extends Record<string, unknown>>(source: T, fromKey: string, toIndex: number): T;
27
+ /** Renames a key in place, keeping its original position. */
28
+ declare function renameKey<T extends Record<string, unknown>>(source: T, fromKey: string, toKey: string): T;
29
+ /** Inserts `key` right after `afterKey`, or at the end when not found. */
30
+ declare function insertKeyAfter<T extends Record<string, unknown>>(source: T, afterKey: string | null, key: string, value: unknown): T;
31
+ /** Produces `name`, `name2`, `name3`... until it is free. */
32
+ declare function uniqueKey(source: Record<string, unknown> | undefined, base: string): string;
33
+ declare const KEY_PATTERN: RegExp;
34
+ declare function isValidKey(key: string): boolean;
35
+ declare function setRequired<T extends object>(root: T, ownerPath: string[], key: string, required: boolean): T;
36
+ declare function renameRequired<T extends object>(root: T, ownerPath: string[], fromKey: string, toKey: string): T;
37
+ declare function removeRequired<T extends object>(root: T, ownerPath: string[], key: string): T;
38
+ /**
39
+ * Resolves a local JSON Pointer `$ref`. Follows ref chains up to a hop budget
40
+ * and returns null for malformed pointers instead of throwing.
41
+ */
42
+ declare function resolveRef(ref: string, root: JSONSchema | undefined, onError?: SchemaErrorHandler): {
43
+ schema: JSONSchema | boolean;
44
+ name: string;
45
+ } | null;
46
+ interface ExternalSchemaCheck {
47
+ schema: JSONSchema;
48
+ /** The host mutated the same object reference in place. */
49
+ mutated: boolean;
50
+ }
51
+ /**
52
+ * Validates the schema coming from the host and detects in place mutation.
53
+ * `previousSignature` must be stored by the caller between renders.
54
+ */
55
+ declare function verifyExternalSchema(next: unknown, previous: JSONSchema | undefined, previousSignature: string, onError?: SchemaErrorHandler): ExternalSchemaCheck & {
56
+ signature: string;
57
+ };
58
+ declare function schemaTypeOf(schema: JSONSchema | undefined): JSONSchemaType;
59
+ declare function typeLabel(schema: JSONSchema | undefined): string;
60
+ declare function isExpandable(schema: JSONSchema | undefined): boolean;
61
+ declare function defaultSchemaFor(type: JSONSchemaType): JSONSchema;
62
+ /**
63
+ * Changes the schema type without discarding metadata, extensions, or unknown
64
+ * keywords. Only keywords that are structurally incompatible with the target
65
+ * type are removed.
66
+ */
67
+ declare function changeSchemaType(schema: JSONSchema, nextType: JSONSchemaType): JSONSchema;
68
+ interface FlattenOptions {
69
+ expandAll?: boolean;
70
+ root: JSONSchema;
71
+ document?: JSONSchema;
72
+ expanded: Set<string>;
73
+ maxRows: number;
74
+ onError?: SchemaErrorHandler;
75
+ }
76
+ interface FlattenResult {
77
+ nodes: FlatNode[];
78
+ overflow: boolean;
79
+ }
80
+ /** Walks only the expanded branches, bounded by `maxRows`. Never throws. */
81
+ declare function flattenSchema(options: FlattenOptions): FlattenResult;
82
+ /** Drops expansion keys under a removed path. */
83
+ declare function pruneExpanded(expanded: Set<string>, removedPath: string[]): Set<string>;
84
+ /** Rewrites expansion keys after a rename so open branches stay open. */
85
+ declare function remapExpanded(expanded: Set<string>, fromPath: string[], toPath: string[]): Set<string>;
86
+ /**
87
+ * The object that owns a property's `required` array.
88
+ * Returns null when the node is not a member of a `properties` map,
89
+ * for example array `items` or `patternProperties` entries.
90
+ */
91
+ declare function requiredOwnerPath(parentPath: string[]): string[] | null;
92
+ declare function stripUndefined(source: Record<string, unknown>): Record<string, unknown>;
93
+ declare function pointerId(path: readonly string[]): string;
94
+
95
+ export { stripUndefined as A, typeLabel as B, uniqueKey as C, verifyExternalSchema as D, type ExternalSchemaCheck as E, type FlattenResult as F, KEY_PATTERN as K, cloneSchema as a, deleteIn as b, changeSchemaType as c, defaultSchemaFor as d, isExpandable as e, flattenSchema as f, getIn as g, isPlainObject as h, insertKeyAfter as i, isUnsafeKey as j, isValidKey as k, pointerId as l, pruneExpanded as m, removeRequired as n, renameKey as o, patchSchema as p, renameRequired as q, remapExpanded as r, reorderKeys as s, requiredOwnerPath as t, resolveRef as u, safeRun as v, samePath as w, schemaTypeOf as x, setIn as y, setRequired as z };
@@ -0,0 +1,95 @@
1
+ import { J as JSONSchema, F as FlatNode, b as JSONSchemaType, f as SchemaErrorHandler, e as SchemaEditorErrorScope } from './types-D2jEaM9Z.cjs';
2
+
3
+ /** Rejects keys that could reach Object.prototype. */
4
+ declare function isUnsafeKey(key: string): boolean;
5
+ declare function samePath(a: readonly string[], b: readonly string[]): boolean;
6
+ declare function isPlainObject(value: unknown): value is Record<string, unknown>;
7
+ /** Runs fn, converts any throw into a reported error plus a fallback value. */
8
+ declare function safeRun<T>(scope: SchemaEditorErrorScope, fn: () => T, fallback: T, onError?: SchemaErrorHandler, path?: string[]): T;
9
+ /**
10
+ * Structural clone that tolerates cyclic graphs.
11
+ * An already visited node is reused, so the cycle is preserved
12
+ * instead of blowing the stack.
13
+ */
14
+ declare function cloneSchema<T>(value: T, seen?: WeakMap<object, unknown>, depth?: number): T;
15
+ /**
16
+ * Writes `value` at `path`, sharing structure with `root` for untouched
17
+ * branches so row level memoization keeps working.
18
+ */
19
+ declare function setIn<T extends object>(root: T, path: string[], value: unknown): T;
20
+ declare function getIn(root: unknown, path: string[]): unknown;
21
+ /** Deletes the key at `path`, returning the same reference when nothing changed. */
22
+ declare function deleteIn<T extends object>(root: T, path: string[]): T;
23
+ /** Merges a partial patch into the schema object at `path`. */
24
+ declare function patchSchema<T extends object>(root: T, path: string[], patch: Record<string, unknown>): T;
25
+ /** Moves `fromKey` to `toIndex` inside an object, preserving insertion order. */
26
+ declare function reorderKeys<T extends Record<string, unknown>>(source: T, fromKey: string, toIndex: number): T;
27
+ /** Renames a key in place, keeping its original position. */
28
+ declare function renameKey<T extends Record<string, unknown>>(source: T, fromKey: string, toKey: string): T;
29
+ /** Inserts `key` right after `afterKey`, or at the end when not found. */
30
+ declare function insertKeyAfter<T extends Record<string, unknown>>(source: T, afterKey: string | null, key: string, value: unknown): T;
31
+ /** Produces `name`, `name2`, `name3`... until it is free. */
32
+ declare function uniqueKey(source: Record<string, unknown> | undefined, base: string): string;
33
+ declare const KEY_PATTERN: RegExp;
34
+ declare function isValidKey(key: string): boolean;
35
+ declare function setRequired<T extends object>(root: T, ownerPath: string[], key: string, required: boolean): T;
36
+ declare function renameRequired<T extends object>(root: T, ownerPath: string[], fromKey: string, toKey: string): T;
37
+ declare function removeRequired<T extends object>(root: T, ownerPath: string[], key: string): T;
38
+ /**
39
+ * Resolves a local JSON Pointer `$ref`. Follows ref chains up to a hop budget
40
+ * and returns null for malformed pointers instead of throwing.
41
+ */
42
+ declare function resolveRef(ref: string, root: JSONSchema | undefined, onError?: SchemaErrorHandler): {
43
+ schema: JSONSchema | boolean;
44
+ name: string;
45
+ } | null;
46
+ interface ExternalSchemaCheck {
47
+ schema: JSONSchema;
48
+ /** The host mutated the same object reference in place. */
49
+ mutated: boolean;
50
+ }
51
+ /**
52
+ * Validates the schema coming from the host and detects in place mutation.
53
+ * `previousSignature` must be stored by the caller between renders.
54
+ */
55
+ declare function verifyExternalSchema(next: unknown, previous: JSONSchema | undefined, previousSignature: string, onError?: SchemaErrorHandler): ExternalSchemaCheck & {
56
+ signature: string;
57
+ };
58
+ declare function schemaTypeOf(schema: JSONSchema | undefined): JSONSchemaType;
59
+ declare function typeLabel(schema: JSONSchema | undefined): string;
60
+ declare function isExpandable(schema: JSONSchema | undefined): boolean;
61
+ declare function defaultSchemaFor(type: JSONSchemaType): JSONSchema;
62
+ /**
63
+ * Changes the schema type without discarding metadata, extensions, or unknown
64
+ * keywords. Only keywords that are structurally incompatible with the target
65
+ * type are removed.
66
+ */
67
+ declare function changeSchemaType(schema: JSONSchema, nextType: JSONSchemaType): JSONSchema;
68
+ interface FlattenOptions {
69
+ expandAll?: boolean;
70
+ root: JSONSchema;
71
+ document?: JSONSchema;
72
+ expanded: Set<string>;
73
+ maxRows: number;
74
+ onError?: SchemaErrorHandler;
75
+ }
76
+ interface FlattenResult {
77
+ nodes: FlatNode[];
78
+ overflow: boolean;
79
+ }
80
+ /** Walks only the expanded branches, bounded by `maxRows`. Never throws. */
81
+ declare function flattenSchema(options: FlattenOptions): FlattenResult;
82
+ /** Drops expansion keys under a removed path. */
83
+ declare function pruneExpanded(expanded: Set<string>, removedPath: string[]): Set<string>;
84
+ /** Rewrites expansion keys after a rename so open branches stay open. */
85
+ declare function remapExpanded(expanded: Set<string>, fromPath: string[], toPath: string[]): Set<string>;
86
+ /**
87
+ * The object that owns a property's `required` array.
88
+ * Returns null when the node is not a member of a `properties` map,
89
+ * for example array `items` or `patternProperties` entries.
90
+ */
91
+ declare function requiredOwnerPath(parentPath: string[]): string[] | null;
92
+ declare function stripUndefined(source: Record<string, unknown>): Record<string, unknown>;
93
+ declare function pointerId(path: readonly string[]): string;
94
+
95
+ export { stripUndefined as A, typeLabel as B, uniqueKey as C, verifyExternalSchema as D, type ExternalSchemaCheck as E, type FlattenResult as F, KEY_PATTERN as K, cloneSchema as a, deleteIn as b, changeSchemaType as c, defaultSchemaFor as d, isExpandable as e, flattenSchema as f, getIn as g, isPlainObject as h, insertKeyAfter as i, isUnsafeKey as j, isValidKey as k, pointerId as l, pruneExpanded as m, removeRequired as n, renameKey as o, patchSchema as p, renameRequired as q, remapExpanded as r, reorderKeys as s, requiredOwnerPath as t, resolveRef as u, safeRun as v, samePath as w, schemaTypeOf as x, setIn as y, setRequired as z };
@@ -0,0 +1,163 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ type OpenApiReference = {
4
+ $ref: string;
5
+ };
6
+ interface SplitterResizeSession {
7
+ leftId: ColumnId;
8
+ rightId: ColumnId;
9
+ /**
10
+ * Pointer identity prevents another pointer from accidentally
11
+ * modifying the active resize session.
12
+ */
13
+ pointerId: number;
14
+ /**
15
+ * Pointer position at resize start.
16
+ */
17
+ startClientX: number;
18
+ /**
19
+ * Actual DOM widths captured at pointerdown.
20
+ */
21
+ startLeftWidth: number;
22
+ startRightWidth: number;
23
+ leftMinWidth: number;
24
+ leftMaxWidth: number;
25
+ rightMinWidth: number;
26
+ rightMaxWidth: number;
27
+ }
28
+ interface ApplyAdjacentSplitterResizeOptions {
29
+ session: SplitterResizeSession;
30
+ clientX: number;
31
+ widths: Record<ColumnId, number>;
32
+ }
33
+ type OpenApiExampleObject = {
34
+ summary?: string;
35
+ description?: string;
36
+ value?: unknown;
37
+ externalValue?: string;
38
+ serializedValue?: string;
39
+ dataValue?: unknown;
40
+ };
41
+ type OpenApiSchema = {
42
+ $ref?: string;
43
+ type?: string | string[];
44
+ format?: string;
45
+ title?: string;
46
+ description?: string;
47
+ default?: unknown;
48
+ example?: unknown;
49
+ examples?: unknown[];
50
+ enum?: unknown[];
51
+ const?: unknown;
52
+ nullable?: boolean;
53
+ minimum?: number;
54
+ maximum?: number;
55
+ exclusiveMinimum?: number | boolean;
56
+ exclusiveMaximum?: number | boolean;
57
+ multipleOf?: number;
58
+ minLength?: number;
59
+ maxLength?: number;
60
+ pattern?: string;
61
+ minItems?: number;
62
+ maxItems?: number;
63
+ uniqueItems?: boolean;
64
+ minProperties?: number;
65
+ maxProperties?: number;
66
+ items?: OpenApiSchema | OpenApiReference | boolean;
67
+ properties?: Record<string, OpenApiSchema | OpenApiReference | boolean>;
68
+ required?: string[];
69
+ oneOf?: Array<OpenApiSchema | OpenApiReference | boolean>;
70
+ anyOf?: Array<OpenApiSchema | OpenApiReference | boolean>;
71
+ allOf?: Array<OpenApiSchema | OpenApiReference | boolean>;
72
+ [key: string]: unknown;
73
+ };
74
+ type OpenApiMediaType = {
75
+ schema?: OpenApiSchema | OpenApiReference | boolean;
76
+ example?: unknown;
77
+ examples?: Record<string, OpenApiExampleObject | OpenApiReference>;
78
+ };
79
+ type OpenApiParameter = {
80
+ name: string;
81
+ in: "query" | "querystring" | "header" | "path" | "cookie";
82
+ description?: string;
83
+ required?: boolean;
84
+ deprecated?: boolean;
85
+ allowEmptyValue?: boolean;
86
+ style?: string;
87
+ explode?: boolean;
88
+ allowReserved?: boolean;
89
+ schema?: OpenApiSchema | OpenApiReference | boolean;
90
+ content?: Record<string, OpenApiMediaType | OpenApiReference>;
91
+ example?: unknown;
92
+ examples?: Record<string, OpenApiExampleObject | OpenApiReference>;
93
+ [key: string]: unknown;
94
+ };
95
+ type ParameterRow = {
96
+ id: string;
97
+ parameter: OpenApiParameter;
98
+ generatedValue?: unknown;
99
+ };
100
+ type ColumnId = "name" | "value" | "required" | "type" | "description";
101
+ type ColumnDefinition = {
102
+ id: ColumnId;
103
+ label: string;
104
+ /**
105
+ * Initial width.
106
+ */
107
+ defaultWidth: number;
108
+ /**
109
+ * Minimum allowed width.
110
+ */
111
+ minWidth: number;
112
+ /**
113
+ * Maximum allowed width.
114
+ *
115
+ * When minWidth === maxWidth the column is fixed.
116
+ */
117
+ maxWidth?: number;
118
+ visible?: boolean;
119
+ };
120
+ type ParameterValueSource = "example" | "examples" | "schema-example" | "schema-default" | "generated" | "external-example" | "missing";
121
+ type ResolvedParameterValue = {
122
+ value: unknown;
123
+ source: ParameterValueSource;
124
+ exampleName?: string;
125
+ externalValue?: string;
126
+ };
127
+ type ParameterTableGeneratorContext = {
128
+ parameter: OpenApiParameter;
129
+ schema?: OpenApiSchema;
130
+ rowIndex: number;
131
+ signal?: AbortSignal;
132
+ document?: Record<string, unknown>;
133
+ };
134
+ type ParameterTableProps = {
135
+ parameters: OpenApiParameter[];
136
+ mode?: "design" | "request";
137
+ document?: Record<string, unknown>;
138
+ readOnly?: boolean;
139
+ values?: ParameterValues;
140
+ onValuesChange?: (values: ParameterValues) => void;
141
+ onError?: (error: unknown) => void;
142
+ onChange?: (parameters: OpenApiParameter[]) => void;
143
+ onSelectionChange?: (selectedIds: string[]) => void;
144
+ onRowReorder?: (parameters: OpenApiParameter[]) => void;
145
+ generateValue?: (context: ParameterTableGeneratorContext) => unknown;
146
+ faker?: {
147
+ generate: (context: ParameterTableGeneratorContext) => unknown;
148
+ };
149
+ emptyState?: ReactNode;
150
+ showRequired?: boolean;
151
+ showType?: boolean;
152
+ showDescription?: boolean;
153
+ stickyHeader?: boolean;
154
+ height?: number | string;
155
+ className?: string;
156
+ };
157
+ type ParameterInput = {
158
+ value: unknown;
159
+ enabled: boolean;
160
+ };
161
+ type ParameterValues = Readonly<Record<string, ParameterInput>>;
162
+
163
+ export type { ApplyAdjacentSplitterResizeOptions as A, ColumnDefinition as C, OpenApiParameter as O, ParameterInput as P, ResolvedParameterValue as R, SplitterResizeSession as S, ParameterTableProps as a, ParameterValues as b, OpenApiReference as c, OpenApiSchema as d, ParameterTableGeneratorContext as e, ParameterRow as f, ColumnId as g, OpenApiExampleObject as h, OpenApiMediaType as i, ParameterValueSource as j };
@@ -0,0 +1,163 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ type OpenApiReference = {
4
+ $ref: string;
5
+ };
6
+ interface SplitterResizeSession {
7
+ leftId: ColumnId;
8
+ rightId: ColumnId;
9
+ /**
10
+ * Pointer identity prevents another pointer from accidentally
11
+ * modifying the active resize session.
12
+ */
13
+ pointerId: number;
14
+ /**
15
+ * Pointer position at resize start.
16
+ */
17
+ startClientX: number;
18
+ /**
19
+ * Actual DOM widths captured at pointerdown.
20
+ */
21
+ startLeftWidth: number;
22
+ startRightWidth: number;
23
+ leftMinWidth: number;
24
+ leftMaxWidth: number;
25
+ rightMinWidth: number;
26
+ rightMaxWidth: number;
27
+ }
28
+ interface ApplyAdjacentSplitterResizeOptions {
29
+ session: SplitterResizeSession;
30
+ clientX: number;
31
+ widths: Record<ColumnId, number>;
32
+ }
33
+ type OpenApiExampleObject = {
34
+ summary?: string;
35
+ description?: string;
36
+ value?: unknown;
37
+ externalValue?: string;
38
+ serializedValue?: string;
39
+ dataValue?: unknown;
40
+ };
41
+ type OpenApiSchema = {
42
+ $ref?: string;
43
+ type?: string | string[];
44
+ format?: string;
45
+ title?: string;
46
+ description?: string;
47
+ default?: unknown;
48
+ example?: unknown;
49
+ examples?: unknown[];
50
+ enum?: unknown[];
51
+ const?: unknown;
52
+ nullable?: boolean;
53
+ minimum?: number;
54
+ maximum?: number;
55
+ exclusiveMinimum?: number | boolean;
56
+ exclusiveMaximum?: number | boolean;
57
+ multipleOf?: number;
58
+ minLength?: number;
59
+ maxLength?: number;
60
+ pattern?: string;
61
+ minItems?: number;
62
+ maxItems?: number;
63
+ uniqueItems?: boolean;
64
+ minProperties?: number;
65
+ maxProperties?: number;
66
+ items?: OpenApiSchema | OpenApiReference | boolean;
67
+ properties?: Record<string, OpenApiSchema | OpenApiReference | boolean>;
68
+ required?: string[];
69
+ oneOf?: Array<OpenApiSchema | OpenApiReference | boolean>;
70
+ anyOf?: Array<OpenApiSchema | OpenApiReference | boolean>;
71
+ allOf?: Array<OpenApiSchema | OpenApiReference | boolean>;
72
+ [key: string]: unknown;
73
+ };
74
+ type OpenApiMediaType = {
75
+ schema?: OpenApiSchema | OpenApiReference | boolean;
76
+ example?: unknown;
77
+ examples?: Record<string, OpenApiExampleObject | OpenApiReference>;
78
+ };
79
+ type OpenApiParameter = {
80
+ name: string;
81
+ in: "query" | "querystring" | "header" | "path" | "cookie";
82
+ description?: string;
83
+ required?: boolean;
84
+ deprecated?: boolean;
85
+ allowEmptyValue?: boolean;
86
+ style?: string;
87
+ explode?: boolean;
88
+ allowReserved?: boolean;
89
+ schema?: OpenApiSchema | OpenApiReference | boolean;
90
+ content?: Record<string, OpenApiMediaType | OpenApiReference>;
91
+ example?: unknown;
92
+ examples?: Record<string, OpenApiExampleObject | OpenApiReference>;
93
+ [key: string]: unknown;
94
+ };
95
+ type ParameterRow = {
96
+ id: string;
97
+ parameter: OpenApiParameter;
98
+ generatedValue?: unknown;
99
+ };
100
+ type ColumnId = "name" | "value" | "required" | "type" | "description";
101
+ type ColumnDefinition = {
102
+ id: ColumnId;
103
+ label: string;
104
+ /**
105
+ * Initial width.
106
+ */
107
+ defaultWidth: number;
108
+ /**
109
+ * Minimum allowed width.
110
+ */
111
+ minWidth: number;
112
+ /**
113
+ * Maximum allowed width.
114
+ *
115
+ * When minWidth === maxWidth the column is fixed.
116
+ */
117
+ maxWidth?: number;
118
+ visible?: boolean;
119
+ };
120
+ type ParameterValueSource = "example" | "examples" | "schema-example" | "schema-default" | "generated" | "external-example" | "missing";
121
+ type ResolvedParameterValue = {
122
+ value: unknown;
123
+ source: ParameterValueSource;
124
+ exampleName?: string;
125
+ externalValue?: string;
126
+ };
127
+ type ParameterTableGeneratorContext = {
128
+ parameter: OpenApiParameter;
129
+ schema?: OpenApiSchema;
130
+ rowIndex: number;
131
+ signal?: AbortSignal;
132
+ document?: Record<string, unknown>;
133
+ };
134
+ type ParameterTableProps = {
135
+ parameters: OpenApiParameter[];
136
+ mode?: "design" | "request";
137
+ document?: Record<string, unknown>;
138
+ readOnly?: boolean;
139
+ values?: ParameterValues;
140
+ onValuesChange?: (values: ParameterValues) => void;
141
+ onError?: (error: unknown) => void;
142
+ onChange?: (parameters: OpenApiParameter[]) => void;
143
+ onSelectionChange?: (selectedIds: string[]) => void;
144
+ onRowReorder?: (parameters: OpenApiParameter[]) => void;
145
+ generateValue?: (context: ParameterTableGeneratorContext) => unknown;
146
+ faker?: {
147
+ generate: (context: ParameterTableGeneratorContext) => unknown;
148
+ };
149
+ emptyState?: ReactNode;
150
+ showRequired?: boolean;
151
+ showType?: boolean;
152
+ showDescription?: boolean;
153
+ stickyHeader?: boolean;
154
+ height?: number | string;
155
+ className?: string;
156
+ };
157
+ type ParameterInput = {
158
+ value: unknown;
159
+ enabled: boolean;
160
+ };
161
+ type ParameterValues = Readonly<Record<string, ParameterInput>>;
162
+
163
+ export type { ApplyAdjacentSplitterResizeOptions as A, ColumnDefinition as C, OpenApiParameter as O, ParameterInput as P, ResolvedParameterValue as R, SplitterResizeSession as S, ParameterTableProps as a, ParameterValues as b, OpenApiReference as c, OpenApiSchema as d, ParameterTableGeneratorContext as e, ParameterRow as f, ColumnId as g, OpenApiExampleObject as h, OpenApiMediaType as i, ParameterValueSource as j };
@@ -0,0 +1,48 @@
1
+ import { i as SchemaValue } from './types-D2jEaM9Z.cjs';
2
+
3
+ type InlineSchemaType = "string" | "number" | "integer" | "boolean" | "array" | "object" | "null" | "any";
4
+ type SchemaFormatOptions = readonly string[];
5
+ type SchemaRecord = Record<string, unknown>;
6
+ interface OpenApiSchema extends SchemaRecord {
7
+ }
8
+ type CompositionKey = "allOf" | "anyOf" | "oneOf";
9
+ interface InlineSchemaEditorProps {
10
+ schema?: SchemaValue;
11
+ value?: SchemaValue;
12
+ onChange?: (value: SchemaValue) => void;
13
+ schemaType?: InlineSchemaType;
14
+ schemaName?: string;
15
+ fullSchema?: OpenApiSchema;
16
+ required?: boolean;
17
+ disabled?: boolean;
18
+ showAdvanced?: boolean;
19
+ showComposition?: boolean;
20
+ showLiveJson?: boolean;
21
+ formatOptions?: SchemaFormatOptions;
22
+ path?: string[];
23
+ nested?: boolean;
24
+ onTypeChange?: (type: InlineSchemaType) => void;
25
+ onRequiredChange?: (required: boolean) => void;
26
+ update?: (patch: Partial<OpenApiSchema>) => void;
27
+ onExampleChange?: (value: unknown) => void;
28
+ onDefaultChange?: (value: unknown) => void;
29
+ onNameChange?: (name: string) => void;
30
+ }
31
+ interface SchemaPropertyItem {
32
+ name: string;
33
+ schema: OpenApiSchema;
34
+ required: boolean;
35
+ }
36
+ interface SchemaBuilderNode {
37
+ id: string;
38
+ name?: string;
39
+ schema: OpenApiSchema;
40
+ required?: boolean;
41
+ depth: number;
42
+ }
43
+ interface SchemaEditorState {
44
+ schema: OpenApiSchema;
45
+ type: InlineSchemaType;
46
+ }
47
+
48
+ export type { CompositionKey as C, InlineSchemaEditorProps as I, OpenApiSchema as O, SchemaFormatOptions as S, InlineSchemaType as a, SchemaPropertyItem as b, SchemaBuilderNode as c, SchemaEditorState as d, SchemaRecord as e };