@powerhousedao/powerhouse-vetra-packages 6.2.3-dev.23 → 6.2.3-dev.25

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 (88) hide show
  1. package/dist/browser/assets/{entry-4ObkElbc.js → entry-GDzXcBs1.js} +10 -6
  2. package/dist/browser/assets/{projection-entry-4FDMlGcp.js → projection-entry-BJpyPvov.js} +7 -13
  3. package/dist/browser/{documents-C-lAnv6o.js → documents-CRzouuNR.js} +45 -35
  4. package/dist/browser/{documents-C-lAnv6o.js.map → documents-CRzouuNR.js.map} +1 -1
  5. package/dist/browser/{editor-DNV-46lY.js → editor-CYdXmSpt.js} +2 -3
  6. package/dist/browser/{editor-DNV-46lY.js.map → editor-CYdXmSpt.js.map} +1 -1
  7. package/dist/browser/{editor-CQ4wUFK5.js → editor-Dk_HEgr2.js} +943 -66
  8. package/dist/browser/editor-Dk_HEgr2.js.map +1 -0
  9. package/dist/browser/editors/document-model-editor/module.js +1 -1
  10. package/dist/browser/editors/document-model-editor/module.js.map +1 -1
  11. package/dist/browser/editors/generic-drive-explorer/index.js +68 -57
  12. package/dist/browser/editors/generic-drive-explorer/index.js.map +1 -1
  13. package/dist/browser/editors/generic-drive-explorer/module.js +1 -1
  14. package/dist/browser/editors/generic-drive-explorer/module.js.map +1 -1
  15. package/dist/browser/{src-CVV6HzQZ-D-OQvEkh.js → folder-view-DjGlA0kT.js} +901 -1643
  16. package/dist/browser/folder-view-DjGlA0kT.js.map +1 -0
  17. package/dist/browser/{graphql-editor-DoXZvdNr.js → graphql-editor-C9Nc_cOY.js} +97 -85
  18. package/dist/browser/graphql-editor-C9Nc_cOY.js.map +1 -0
  19. package/dist/{node/hooks-Di3FASx-.mjs → browser/hooks-eQxBX7g4.js} +824 -444
  20. package/dist/browser/{hooks-Bh1JCohS.js.map → hooks-eQxBX7g4.js.map} +1 -1
  21. package/dist/browser/index.js +16 -14
  22. package/dist/browser/index.js.map +1 -1
  23. package/dist/browser/{json-editor-DBhkG5TF.js → json-editor-DfRD-pfk.js} +7 -7
  24. package/dist/browser/{json-editor-DBhkG5TF.js.map → json-editor-DfRD-pfk.js.map} +1 -1
  25. package/dist/browser/{parser-BBzK7bLd.js → parser-DtbeHA3H.js} +7 -6
  26. package/dist/browser/{parser-BBzK7bLd.js.map → parser-DtbeHA3H.js.map} +1 -1
  27. package/dist/browser/{chunk-BVTlhY3a.js → rolldown-runtime-DC62tzP2.js} +12 -3
  28. package/dist/browser/src-CrUksCLW-Co0PBoNN.js +5255 -0
  29. package/dist/browser/src-CrUksCLW-Co0PBoNN.js.map +1 -0
  30. package/dist/browser/{state-schemas-B47wHvDV.js → state-schemas-BSc_36Vd.js} +12 -10
  31. package/dist/browser/{state-schemas-B47wHvDV.js.map → state-schemas-BSc_36Vd.js.map} +1 -1
  32. package/dist/browser/{tslib.es6-CeIASJ2O.js → tslib.es6-Cno80yFJ.js} +1 -1
  33. package/dist/browser/{tslib.es6-CeIASJ2O.js.map → tslib.es6-Cno80yFJ.js.map} +1 -1
  34. package/dist/node/{documents-XAQfHX5Q.mjs → documents-D70S9PZL.mjs} +2 -2
  35. package/dist/node/documents-D70S9PZL.mjs.map +1 -0
  36. package/dist/node/{editor-Cp2TC5MJ.mjs → editor-BZZ0eN3p.mjs} +2 -3
  37. package/dist/node/{editor-Cp2TC5MJ.mjs.map → editor-BZZ0eN3p.mjs.map} +1 -1
  38. package/dist/node/{editor-BiiLqEe9.mjs → editor-CeSEXEgf.mjs} +866 -68
  39. package/dist/node/editor-CeSEXEgf.mjs.map +1 -0
  40. package/dist/node/editors/document-model-editor/module.mjs +1 -1
  41. package/dist/node/editors/document-model-editor/module.mjs.map +1 -1
  42. package/dist/node/editors/generic-drive-explorer/index.mjs +19 -13
  43. package/dist/node/editors/generic-drive-explorer/index.mjs.map +1 -1
  44. package/dist/node/editors/generic-drive-explorer/module.mjs +1 -1
  45. package/dist/node/editors/generic-drive-explorer/module.mjs.map +1 -1
  46. package/dist/node/{src-CVV6HzQZ-CvqjXbXk.mjs → folder-view-B2Jo-wsr.mjs} +891 -2311
  47. package/dist/node/{src-CVV6HzQZ-CvqjXbXk.mjs.map → folder-view-B2Jo-wsr.mjs.map} +1 -1
  48. package/dist/node/{graphql-BvV3tC1U.mjs → graphql-Dp4j7rmx.mjs} +50 -49
  49. package/dist/node/{graphql-BvV3tC1U.mjs.map → graphql-Dp4j7rmx.mjs.map} +1 -1
  50. package/dist/node/{graphql-editor-BhF6KN6y.mjs → graphql-editor-CBJXEY_C.mjs} +76 -61
  51. package/dist/node/graphql-editor-CBJXEY_C.mjs.map +1 -0
  52. package/dist/{browser/hooks-Bh1JCohS.js → node/hooks-C2b46djt.mjs} +824 -444
  53. package/dist/node/{hooks-Di3FASx-.mjs.map → hooks-C2b46djt.mjs.map} +1 -1
  54. package/dist/node/index.mjs +16 -15
  55. package/dist/node/index.mjs.map +1 -1
  56. package/dist/node/{json-editor-Cqc0zuz0.mjs → json-editor-DaqHARBD.mjs} +7 -7
  57. package/dist/node/{json-editor-Cqc0zuz0.mjs.map → json-editor-DaqHARBD.mjs.map} +1 -1
  58. package/dist/node/{schema-context-mHmP3Cl6.mjs → schema-context-CojjnSE6.mjs} +6 -5
  59. package/dist/node/schema-context-CojjnSE6.mjs.map +1 -0
  60. package/dist/node/src-CrUksCLW-BHpiSprT.mjs +5936 -0
  61. package/dist/node/src-CrUksCLW-BHpiSprT.mjs.map +1 -0
  62. package/dist/node/{state-schemas-DXG02fMh.mjs → state-schemas-CWuLjYFF.mjs} +13 -10
  63. package/dist/node/{state-schemas-DXG02fMh.mjs.map → state-schemas-CWuLjYFF.mjs.map} +1 -1
  64. package/dist/node/{tslib.es6-DdiHgz9e.mjs → tslib.es6-VORZjfk3.mjs} +45 -7
  65. package/dist/node/{tslib.es6-DdiHgz9e.mjs.map → tslib.es6-VORZjfk3.mjs.map} +1 -1
  66. package/package.json +11 -10
  67. package/dist/browser/button-sZQCXeCo.js +0 -803
  68. package/dist/browser/button-sZQCXeCo.js.map +0 -1
  69. package/dist/browser/dist-D3_ER0Dn.js +0 -2314
  70. package/dist/browser/dist-D3_ER0Dn.js.map +0 -1
  71. package/dist/browser/editor-CQ4wUFK5.js.map +0 -1
  72. package/dist/browser/folder-view-CzItU0hn.js +0 -957
  73. package/dist/browser/folder-view-CzItU0hn.js.map +0 -1
  74. package/dist/browser/graphql-editor-DoXZvdNr.js.map +0 -1
  75. package/dist/browser/schema-context-p2bhyog_.js +0 -69
  76. package/dist/browser/schema-context-p2bhyog_.js.map +0 -1
  77. package/dist/browser/src-CVV6HzQZ-D-OQvEkh.js.map +0 -1
  78. package/dist/node/button-5bnYEAVq.mjs +0 -785
  79. package/dist/node/button-5bnYEAVq.mjs.map +0 -1
  80. package/dist/node/chunk-17FXJ3dL.mjs +0 -31
  81. package/dist/node/dist-Bf_PIbO7.mjs +0 -2314
  82. package/dist/node/dist-Bf_PIbO7.mjs.map +0 -1
  83. package/dist/node/documents-XAQfHX5Q.mjs.map +0 -1
  84. package/dist/node/editor-BiiLqEe9.mjs.map +0 -1
  85. package/dist/node/folder-view-m_rH84Nz.mjs +0 -962
  86. package/dist/node/folder-view-m_rH84Nz.mjs.map +0 -1
  87. package/dist/node/graphql-editor-BhF6KN6y.mjs.map +0 -1
  88. package/dist/node/schema-context-mHmP3Cl6.mjs.map +0 -1
@@ -1,17 +1,97 @@
1
- import { c as Kind, t as parse } from "./parser-BBzK7bLd.js";
2
- import { mt as print } from "./documents-C-lAnv6o.js";
3
- import { _ as pascalCase, a as compareStringsWithoutWhitespace, c as isEmptyOperationSchema, f as makeOperationInitialDoc, g as constantCase, l as makeEmptyOperationSchema, m as renameSchemaType, n as ensureValidOperationSchemaInputName, o as handleModelNameChange, s as initializeModelSchema, t as Button, u as makeInitialSchemaDoc, v as snakeCase } from "./button-sZQCXeCo.js";
4
- import { a as Slot, i as Primitive, t as Modal } from "./src-CVV6HzQZ-D-OQvEkh.js";
5
- import { h as twMerge } from "./dist-D3_ER0Dn.js";
6
- import { t as SchemaContextProvider } from "./schema-context-p2bhyog_.js";
1
+ import { n as __exportAll } from "./rolldown-runtime-DC62tzP2.js";
2
+ import { c as Kind, p as GraphQLError, t as parse } from "./parser-DtbeHA3H.js";
3
+ import { a as printSchema, gt as visit, mt as print, n as initialSchemaStr, o as buildASTSchema, r as typeDefsDoc, t as hiddenQueryTypeDefDoc, y as getVariableValues } from "./documents-CRzouuNR.js";
4
+ import { a as Slot, h as twMerge, i as Primitive, t as Modal } from "./src-CrUksCLW-Co0PBoNN.js";
7
5
  import { addModule, addOperation, addOperationError, deleteModule, deleteOperation, deleteOperationError, generateId, releaseNewVersion, setAuthorName, setAuthorWebsite, setInitialState, setModelDescription, setModelExtension, setModelId, setModelName, setModuleName, setOperationDescription, setOperationErrorName, setOperationName, setOperationSchema, setStateSchema } from "@powerhousedao/shared/document-model";
8
6
  import { z } from "zod";
9
7
  import * as React$1 from "react";
10
- import React, { Suspense, forwardRef, lazy, useCallback, useEffect, useId, useImperativeHandle, useRef, useState } from "react";
8
+ import React, { Suspense, createContext, forwardRef, lazy, useCallback, useContext, useEffect, useId, useImperativeHandle, useMemo, useRef, useState } from "react";
11
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
10
  import { ConnectSelect, DocumentToolbar, ModalButton } from "@powerhousedao/design-system/connect";
13
11
  import { usePHToast, useSelectedDocumentOfType, useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
12
+ import { getPHCustomScalarByTypeName } from "@powerhousedao/document-engineering/graphql";
14
13
  import * as n from "zod/v4/core";
14
+ //#region ../../node_modules/.pnpm/graphql@16.12.0/node_modules/graphql/utilities/getOperationAST.mjs
15
+ /**
16
+ * Returns an operation AST given a document AST and optionally an operation
17
+ * name. If a name is not provided, an operation is only returned if only one is
18
+ * provided in the document.
19
+ */
20
+ function getOperationAST(documentAST, operationName) {
21
+ let operation = null;
22
+ for (const definition of documentAST.definitions) if (definition.kind === Kind.OPERATION_DEFINITION) {
23
+ var _definition$name;
24
+ if (operationName == null) {
25
+ if (operation) return null;
26
+ operation = definition;
27
+ } else if (((_definition$name = definition.name) === null || _definition$name === void 0 ? void 0 : _definition$name.value) === operationName) return definition;
28
+ }
29
+ return operation;
30
+ }
31
+ //#endregion
32
+ //#region editors/document-model-editor/context/schema-context.tsx
33
+ const hiddenQueryTypeDefinitions = safeParseSdl(hiddenQueryTypeDefDoc)?.definitions ?? [];
34
+ const standardLibCustomScalarDefinitions = safeParseSdl(typeDefsDoc)?.definitions ?? [];
35
+ const alwaysIncludedDefinitions = [...hiddenQueryTypeDefinitions, ...standardLibCustomScalarDefinitions];
36
+ function makeSharedSchemaSdl(globalStateSchemaSdl, localStateSchemaSdl, operationSchemasSdl) {
37
+ const definitions = [...alwaysIncludedDefinitions];
38
+ for (const sdl of [
39
+ globalStateSchemaSdl,
40
+ localStateSchemaSdl,
41
+ operationSchemasSdl
42
+ ]) {
43
+ if (!sdl) continue;
44
+ const ast = safeParseSdl(sdl);
45
+ if (!ast) continue;
46
+ definitions.push(...ast.definitions);
47
+ }
48
+ const documentNode = {
49
+ kind: Kind.DOCUMENT,
50
+ definitions
51
+ };
52
+ return printSchema(buildASTSchema(documentNode));
53
+ }
54
+ function safeParseSdl(sdl) {
55
+ try {
56
+ if (!sdl) return null;
57
+ return parse(sdl);
58
+ } catch (_error) {
59
+ return null;
60
+ }
61
+ }
62
+ const SchemaContext = createContext({
63
+ sharedSchema: initialSchemaStr,
64
+ error: void 0
65
+ });
66
+ function parseSharedSchemaSdl(globalStateSchemaSdl, localStateSchemaSdl, operationSchemasSdl) {
67
+ try {
68
+ return {
69
+ sharedSchema: makeSharedSchemaSdl(globalStateSchemaSdl, localStateSchemaSdl, operationSchemasSdl),
70
+ error: void 0
71
+ };
72
+ } catch (error) {
73
+ return {
74
+ sharedSchema: initialSchemaStr,
75
+ error: error instanceof Error ? error : new Error(typeof error === "string" ? error : JSON.stringify(error), { cause: error })
76
+ };
77
+ }
78
+ }
79
+ function SchemaContextProvider(props) {
80
+ const { children, globalStateSchemaSdl, localStateSchemaSdl, operationSchemasSdl } = props;
81
+ const sharedSchemaSdl = useMemo(() => parseSharedSchemaSdl(globalStateSchemaSdl, localStateSchemaSdl, operationSchemasSdl), [
82
+ globalStateSchemaSdl,
83
+ localStateSchemaSdl,
84
+ operationSchemasSdl
85
+ ]);
86
+ return /* @__PURE__ */ jsx(SchemaContext.Provider, {
87
+ value: sharedSchemaSdl,
88
+ children
89
+ });
90
+ }
91
+ function useSchemaContext() {
92
+ return useContext(SchemaContext);
93
+ }
94
+ //#endregion
15
95
  //#region ../../node_modules/.pnpm/clsx@2.0.0/node_modules/clsx/dist/clsx.mjs
16
96
  function r$1(e) {
17
97
  var t, f, n = "";
@@ -46,7 +126,7 @@ const cva = (base, config) => {
46
126
  acc[key] = value;
47
127
  return acc;
48
128
  }, {});
49
- return cx(base, getVariantClassNames, config === null || config === void 0 ? void 0 : (ref = config.compoundVariants) === null || ref === void 0 ? void 0 : ref.reduce((acc, param1) => {
129
+ const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (ref = config.compoundVariants) === null || ref === void 0 ? void 0 : ref.reduce((acc, param1) => {
50
130
  let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param1;
51
131
  return Object.entries(compoundVariantOptions).every((param) => {
52
132
  let [key, value] = param;
@@ -62,7 +142,8 @@ const cva = (base, config) => {
62
142
  cvClass,
63
143
  cvClassName
64
144
  ] : acc;
65
- }, []), props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
145
+ }, []);
146
+ return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
66
147
  };
67
148
  };
68
149
  //#endregion
@@ -743,9 +824,10 @@ function getDirtyFields(data, formValues, dirtyFieldsFromValues) {
743
824
  if (!dirtyFieldsFromValues) dirtyFieldsFromValues = markFieldsDirty(formValues);
744
825
  for (const key in data) {
745
826
  const value = data[key];
746
- if (isTraversable(value)) if (isUndefined(formValues) || isPrimitive(dirtyFieldsFromValues[key])) dirtyFieldsFromValues[key] = markFieldsDirty(value, Array.isArray(value) ? [] : {});
747
- else getDirtyFields(value, isNullOrUndefined(formValues) ? {} : formValues[key], dirtyFieldsFromValues[key]);
748
- else {
827
+ if (isTraversable(value)) {
828
+ if (isUndefined(formValues) || isPrimitive(dirtyFieldsFromValues[key])) dirtyFieldsFromValues[key] = markFieldsDirty(value, Array.isArray(value) ? [] : {});
829
+ else getDirtyFields(value, isNullOrUndefined(formValues) ? {} : formValues[key], dirtyFieldsFromValues[key]);
830
+ } else {
749
831
  const formValue = formValues[key];
750
832
  dirtyFieldsFromValues[key] = !deepEqual(value, formValue);
751
833
  }
@@ -1265,12 +1347,15 @@ function createFormControl(props = {}) {
1265
1347
  !fieldReference.disabled && set(_formValues, name, getFieldValueAs(value, fieldReference));
1266
1348
  fieldValue = isHTMLElement(fieldReference.ref) && isNullOrUndefined(value) ? "" : value;
1267
1349
  if (isMultipleSelect(fieldReference.ref)) [...fieldReference.ref.options].forEach((optionRef) => optionRef.selected = fieldValue.includes(optionRef.value));
1268
- else if (fieldReference.refs) if (isCheckBoxInput(fieldReference.ref)) fieldReference.refs.forEach((checkboxRef) => {
1269
- if (!checkboxRef.defaultChecked || !checkboxRef.disabled) if (Array.isArray(fieldValue)) checkboxRef.checked = !!fieldValue.find((data) => data === checkboxRef.value);
1270
- else checkboxRef.checked = fieldValue === checkboxRef.value || !!fieldValue;
1271
- });
1272
- else fieldReference.refs.forEach((radioRef) => radioRef.checked = radioRef.value === fieldValue);
1273
- else if (isFileInput(fieldReference.ref)) fieldReference.ref.value = "";
1350
+ else if (fieldReference.refs) {
1351
+ if (isCheckBoxInput(fieldReference.ref)) fieldReference.refs.forEach((checkboxRef) => {
1352
+ if (!checkboxRef.defaultChecked || !checkboxRef.disabled) {
1353
+ if (Array.isArray(fieldValue)) checkboxRef.checked = !!fieldValue.find((data) => data === checkboxRef.value);
1354
+ else checkboxRef.checked = fieldValue === checkboxRef.value || !!fieldValue;
1355
+ }
1356
+ });
1357
+ else fieldReference.refs.forEach((radioRef) => radioRef.checked = radioRef.value === fieldValue);
1358
+ } else if (isFileInput(fieldReference.ref)) fieldReference.ref.value = "";
1274
1359
  else {
1275
1360
  fieldReference.ref.value = fieldValue;
1276
1361
  if (!fieldReference.ref.type) _subjects.state.next({
@@ -1408,7 +1493,7 @@ function createFormControl(props = {}) {
1408
1493
  const field = get(_fields, fieldName);
1409
1494
  return await executeBuiltInValidation(field && field._f ? { [fieldName]: field } : field);
1410
1495
  }))).every(Boolean);
1411
- !(!validationResult && !_formState.isValid) && _setValid();
1496
+ (validationResult || _formState.isValid) && _setValid();
1412
1497
  } else validationResult = isValid = await executeBuiltInValidation(_fields);
1413
1498
  _subjects.state.next({
1414
1499
  ...!isString(name) || (_proxyFormState.isValid || _proxySubscribeFormState.isValid) && isValid !== _formState.isValid ? {} : { name },
@@ -1648,7 +1733,7 @@ function createFormControl(props = {}) {
1648
1733
  if (!keepStateOptions.keepDefaultValues) _defaultValues = updatedValues;
1649
1734
  if (!keepStateOptions.keepValues) {
1650
1735
  if (keepStateOptions.keepDirtyValues) {
1651
- const fieldsToCheck = new Set([..._names.mount, ...Object.keys(getDirtyFields(_defaultValues, _formValues))]);
1736
+ const fieldsToCheck = /* @__PURE__ */ new Set([..._names.mount, ...Object.keys(getDirtyFields(_defaultValues, _formValues))]);
1652
1737
  for (const fieldName of Array.from(fieldsToCheck)) {
1653
1738
  const isDirty = get(_formState.dirtyFields, fieldName);
1654
1739
  const existingValue = get(_formValues, fieldName);
@@ -1855,18 +1940,20 @@ function useForm(props = {}) {
1855
1940
  isReady: false,
1856
1941
  defaultValues: isFunction(props.defaultValues) ? void 0 : props.defaultValues
1857
1942
  });
1858
- if (!_formControl.current) if (props.formControl) {
1859
- _formControl.current = {
1860
- ...props.formControl,
1861
- formState
1862
- };
1863
- if (props.defaultValues && !isFunction(props.defaultValues)) props.formControl.reset(props.defaultValues, props.resetOptions);
1864
- } else {
1865
- const { formControl, ...rest } = createFormControl(props);
1866
- _formControl.current = {
1867
- ...rest,
1868
- formState
1869
- };
1943
+ if (!_formControl.current) {
1944
+ if (props.formControl) {
1945
+ _formControl.current = {
1946
+ ...props.formControl,
1947
+ formState
1948
+ };
1949
+ if (props.defaultValues && !isFunction(props.defaultValues)) props.formControl.reset(props.defaultValues, props.resetOptions);
1950
+ } else {
1951
+ const { formControl, ...rest } = createFormControl(props);
1952
+ _formControl.current = {
1953
+ ...rest,
1954
+ formState
1955
+ };
1956
+ }
1870
1957
  }
1871
1958
  const control = _formControl.current.control;
1872
1959
  control._options = props;
@@ -1934,6 +2021,782 @@ function useForm(props = {}) {
1934
2021
  return _formControl.current;
1935
2022
  }
1936
2023
  //#endregion
2024
+ //#region ../../node_modules/.pnpm/change-case@5.4.4/node_modules/change-case/dist/index.js
2025
+ const SPLIT_LOWER_UPPER_RE = /([\p{Ll}\d])(\p{Lu})/gu;
2026
+ const SPLIT_UPPER_UPPER_RE = /(\p{Lu})([\p{Lu}][\p{Ll}])/gu;
2027
+ const SPLIT_SEPARATE_NUMBER_RE = /(\d)\p{Ll}|(\p{L})\d/u;
2028
+ const DEFAULT_STRIP_REGEXP = /[^\p{L}\d]+/giu;
2029
+ const SPLIT_REPLACE_VALUE = "$1\0$2";
2030
+ const DEFAULT_PREFIX_SUFFIX_CHARACTERS = "";
2031
+ /**
2032
+ * Split any cased input strings into an array of words.
2033
+ */
2034
+ function split(value) {
2035
+ let result = value.trim();
2036
+ result = result.replace(SPLIT_LOWER_UPPER_RE, SPLIT_REPLACE_VALUE).replace(SPLIT_UPPER_UPPER_RE, SPLIT_REPLACE_VALUE);
2037
+ result = result.replace(DEFAULT_STRIP_REGEXP, "\0");
2038
+ let start = 0;
2039
+ let end = result.length;
2040
+ while (result.charAt(start) === "\0") start++;
2041
+ if (start === end) return [];
2042
+ while (result.charAt(end - 1) === "\0") end--;
2043
+ return result.slice(start, end).split(/\0/g);
2044
+ }
2045
+ /**
2046
+ * Split the input string into an array of words, separating numbers.
2047
+ */
2048
+ function splitSeparateNumbers(value) {
2049
+ const words = split(value);
2050
+ for (let i = 0; i < words.length; i++) {
2051
+ const word = words[i];
2052
+ const match = SPLIT_SEPARATE_NUMBER_RE.exec(word);
2053
+ if (match) {
2054
+ const offset = match.index + (match[1] ?? match[2]).length;
2055
+ words.splice(i, 1, word.slice(0, offset), word.slice(offset));
2056
+ }
2057
+ }
2058
+ return words;
2059
+ }
2060
+ /**
2061
+ * Convert a string to space separated lower case (`foo bar`).
2062
+ */
2063
+ function noCase(input, options) {
2064
+ const [prefix, words, suffix] = splitPrefixSuffix(input, options);
2065
+ return prefix + words.map(lowerFactory(options?.locale)).join(options?.delimiter ?? " ") + suffix;
2066
+ }
2067
+ /**
2068
+ * Convert a string to pascal case (`FooBar`).
2069
+ */
2070
+ function pascalCase(input, options) {
2071
+ const [prefix, words, suffix] = splitPrefixSuffix(input, options);
2072
+ const lower = lowerFactory(options?.locale);
2073
+ const upper = upperFactory(options?.locale);
2074
+ const transform = options?.mergeAmbiguousCharacters ? capitalCaseTransformFactory(lower, upper) : pascalCaseTransformFactory(lower, upper);
2075
+ return prefix + words.map(transform).join(options?.delimiter ?? "") + suffix;
2076
+ }
2077
+ /**
2078
+ * Convert a string to constant case (`FOO_BAR`).
2079
+ */
2080
+ function constantCase(input, options) {
2081
+ const [prefix, words, suffix] = splitPrefixSuffix(input, options);
2082
+ return prefix + words.map(upperFactory(options?.locale)).join(options?.delimiter ?? "_") + suffix;
2083
+ }
2084
+ /**
2085
+ * Convert a string to path case (`Foo bar`).
2086
+ */
2087
+ function sentenceCase(input, options) {
2088
+ const [prefix, words, suffix] = splitPrefixSuffix(input, options);
2089
+ const lower = lowerFactory(options?.locale);
2090
+ const transform = capitalCaseTransformFactory(lower, upperFactory(options?.locale));
2091
+ return prefix + words.map((word, index) => {
2092
+ if (index === 0) return transform(word);
2093
+ return lower(word);
2094
+ }).join(options?.delimiter ?? " ") + suffix;
2095
+ }
2096
+ /**
2097
+ * Convert a string to snake case (`foo_bar`).
2098
+ */
2099
+ function snakeCase(input, options) {
2100
+ return noCase(input, {
2101
+ delimiter: "_",
2102
+ ...options
2103
+ });
2104
+ }
2105
+ function lowerFactory(locale) {
2106
+ return locale === false ? (input) => input.toLowerCase() : (input) => input.toLocaleLowerCase(locale);
2107
+ }
2108
+ function upperFactory(locale) {
2109
+ return locale === false ? (input) => input.toUpperCase() : (input) => input.toLocaleUpperCase(locale);
2110
+ }
2111
+ function capitalCaseTransformFactory(lower, upper) {
2112
+ return (word) => `${upper(word[0])}${lower(word.slice(1))}`;
2113
+ }
2114
+ function pascalCaseTransformFactory(lower, upper) {
2115
+ return (word, index) => {
2116
+ const char0 = word[0];
2117
+ return (index > 0 && char0 >= "0" && char0 <= "9" ? "_" + char0 : upper(char0)) + lower(word.slice(1));
2118
+ };
2119
+ }
2120
+ function splitPrefixSuffix(input, options = {}) {
2121
+ const splitFn = options.split ?? (options.separateNumbers ? splitSeparateNumbers : split);
2122
+ const prefixCharacters = options.prefixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
2123
+ const suffixCharacters = options.suffixCharacters ?? DEFAULT_PREFIX_SUFFIX_CHARACTERS;
2124
+ let prefixIndex = 0;
2125
+ let suffixIndex = input.length;
2126
+ while (prefixIndex < input.length) {
2127
+ const char = input.charAt(prefixIndex);
2128
+ if (!prefixCharacters.includes(char)) break;
2129
+ prefixIndex++;
2130
+ }
2131
+ while (suffixIndex > prefixIndex) {
2132
+ const index = suffixIndex - 1;
2133
+ const char = input.charAt(index);
2134
+ if (!suffixCharacters.includes(char)) break;
2135
+ suffixIndex = index;
2136
+ }
2137
+ return [
2138
+ input.slice(0, prefixIndex),
2139
+ splitFn(input.slice(prefixIndex, suffixIndex)),
2140
+ input.slice(suffixIndex)
2141
+ ];
2142
+ }
2143
+ //#endregion
2144
+ //#region editors/document-model-editor/constants/graphql-kinds.ts
2145
+ const STRING_GQL_PRIMITIVE_NAME = "String";
2146
+ const BOOLEAN_GQL_PRIMITIVE_NAME = "Boolean";
2147
+ const FLOAT_GQL_PRIMITIVE_NAME = "Float";
2148
+ const gqlPrimitiveNodeNamesList = [
2149
+ STRING_GQL_PRIMITIVE_NAME,
2150
+ BOOLEAN_GQL_PRIMITIVE_NAME,
2151
+ "Int",
2152
+ FLOAT_GQL_PRIMITIVE_NAME,
2153
+ "ID"
2154
+ ];
2155
+ //#endregion
2156
+ //#region editors/document-model-editor/utils/helpers.ts
2157
+ function makeStateSchemaNameForScope(modelName, scope) {
2158
+ const modelNamePascalCase = pascalCase(modelName);
2159
+ const scopePascalCase = pascalCase(scope);
2160
+ return scopePascalCase === "Global" ? `${modelNamePascalCase}State` : `${modelNamePascalCase}${scopePascalCase}State`;
2161
+ }
2162
+ function makeInitialSchemaDoc(modelName, scope) {
2163
+ return `type ${makeStateSchemaNameForScope(modelName, scope)} {
2164
+ "Add your ${scope} state fields here"
2165
+ _placeholder: String
2166
+ }`;
2167
+ }
2168
+ function makeOperationInitialDoc(name) {
2169
+ return `input ${pascalCase(name)}Input {
2170
+ "Add your inputs here"
2171
+ _placeholder: String
2172
+ }`;
2173
+ }
2174
+ function makeEmptyOperationSchema(operationName) {
2175
+ return `input ${pascalCase(operationName)}Input {\n _empty: Boolean\n}`;
2176
+ }
2177
+ function isEmptyOperationSchema(schema) {
2178
+ if (!schema) return false;
2179
+ return /_empty:\s*Boolean/.test(schema) && !schema.replace(/_empty:\s*Boolean/, "").match(/\w+:\s*\w+/);
2180
+ }
2181
+ function safeParseJsonRecord(json) {
2182
+ try {
2183
+ return JSON.parse(json);
2184
+ } catch (_error) {
2185
+ return null;
2186
+ }
2187
+ }
2188
+ function makeMinimalObjectForStateType(args) {
2189
+ const { sharedSchemaDocumentNode, stateTypeDefinitionNode, existingValue } = args;
2190
+ const existingValueObject = safeParseJsonRecord(existingValue);
2191
+ if (!existingValueObject) return existingValue;
2192
+ const stateTypeDefinitionFields = stateTypeDefinitionNode.fields;
2193
+ if (!stateTypeDefinitionFields?.length) return existingValue;
2194
+ const minimalObject = makeMinimalValuesForObjectFields({
2195
+ schemaDocumentNode: sharedSchemaDocumentNode,
2196
+ fieldDefinitionNodes: stateTypeDefinitionFields,
2197
+ existingValueObject,
2198
+ visitedTypes: /* @__PURE__ */ new Set([stateTypeDefinitionNode.name.value])
2199
+ });
2200
+ return JSON.stringify(minimalObject, null, 2);
2201
+ }
2202
+ function makeMinimalValuesForObjectFields(args) {
2203
+ const { schemaDocumentNode, existingValueObject, fieldDefinitionNodes, visitedTypes } = args;
2204
+ const newJson = {};
2205
+ for (const astNode of fieldDefinitionNodes) {
2206
+ const fieldName = getASTNodeName(astNode);
2207
+ if (!fieldName) continue;
2208
+ const minimalValue = makeMinimalValueForASTNode({
2209
+ fieldName,
2210
+ astNode,
2211
+ schemaDocumentNode,
2212
+ existingValueObject,
2213
+ visitedTypes
2214
+ });
2215
+ newJson[astNode.name.value] = minimalValue;
2216
+ }
2217
+ return newJson;
2218
+ }
2219
+ function makeMinimalValueForASTNode(args) {
2220
+ const { fieldName, astNode, schemaDocumentNode, existingValueObject, visitedTypes } = args;
2221
+ const existingFieldValue = existingValueObject?.[fieldName];
2222
+ let node = astNode;
2223
+ if (isFieldDefinitionNode(astNode)) node = getASTNodeTypeNode(node);
2224
+ const isNonNull = isNonNullNode(node);
2225
+ if (isNonNull) node = getASTNodeTypeNode(node);
2226
+ if (isListTypeNode(node)) return makeMinimalValueForGqlListNode(node, existingFieldValue, isNonNull, schemaDocumentNode, visitedTypes);
2227
+ if (isGqlPrimitiveNode(node)) return makeMinimalValueForGQLPrimitiveNode(node, existingFieldValue, isNonNull);
2228
+ const namedTypeDefinitionNode = getNamedTypeDefinitionNode(node, schemaDocumentNode);
2229
+ if (isEnumTypeDefinitionNode(namedTypeDefinitionNode)) return makeMinimalValueForGqlEnum(namedTypeDefinitionNode, existingFieldValue, isNonNull);
2230
+ if (isScalarTypeDefinitionNode(namedTypeDefinitionNode)) return makeMinimalValueForGqlScalar(namedTypeDefinitionNode, existingFieldValue, isNonNull);
2231
+ if (isUnionTypeDefinitionNode(namedTypeDefinitionNode)) return makeMinimalValueForGqlUnion(namedTypeDefinitionNode, existingFieldValue, schemaDocumentNode, existingValueObject, isNonNull, visitedTypes);
2232
+ if (isObjectTypeDefinitionNode(namedTypeDefinitionNode)) return makeMinimalValueForGqlObject(namedTypeDefinitionNode, schemaDocumentNode, existingValueObject, existingFieldValue, isNonNull, visitedTypes);
2233
+ return existingFieldValue;
2234
+ }
2235
+ function isFieldDefinitionNode(astNodeTypeNode) {
2236
+ if (!astNodeTypeNode) return false;
2237
+ return astNodeTypeNode.kind === Kind.FIELD_DEFINITION;
2238
+ }
2239
+ function isNonNullNode(astNode) {
2240
+ if (!astNode) return false;
2241
+ return astNode.kind === Kind.NON_NULL_TYPE;
2242
+ }
2243
+ function isGqlPrimitiveNode(astNodeTypeNode) {
2244
+ if (!astNodeTypeNode) return false;
2245
+ const name = getASTNodeName(astNodeTypeNode);
2246
+ return gqlPrimitiveNodeNamesList.includes(name);
2247
+ }
2248
+ function isListTypeNode(astNodeTypeNode) {
2249
+ if (!astNodeTypeNode) return false;
2250
+ return astNodeTypeNode.kind === Kind.LIST_TYPE;
2251
+ }
2252
+ function isEnumTypeDefinitionNode(definitionNode) {
2253
+ if (!definitionNode) return false;
2254
+ return definitionNode.kind === Kind.ENUM_TYPE_DEFINITION;
2255
+ }
2256
+ function isScalarTypeDefinitionNode(definitionNode) {
2257
+ if (!definitionNode) return false;
2258
+ return definitionNode.kind === Kind.SCALAR_TYPE_DEFINITION;
2259
+ }
2260
+ function isUnionTypeDefinitionNode(definitionNode) {
2261
+ if (!definitionNode) return false;
2262
+ return definitionNode.kind === Kind.UNION_TYPE_DEFINITION;
2263
+ }
2264
+ function isObjectTypeDefinitionNode(definitionNode) {
2265
+ if (!definitionNode) return false;
2266
+ return definitionNode.kind === Kind.OBJECT_TYPE_DEFINITION;
2267
+ }
2268
+ function getASTNodeName(astNode) {
2269
+ if (!astNode) return null;
2270
+ if (!("name" in astNode)) return null;
2271
+ if (!astNode.name) return null;
2272
+ if (!("value" in astNode.name)) return null;
2273
+ return astNode.name.value;
2274
+ }
2275
+ function getASTNodeTypeNode(astNode) {
2276
+ if (!astNode) return null;
2277
+ if (!("type" in astNode)) return null;
2278
+ return astNode.type;
2279
+ }
2280
+ function makeMinimalValueForGQLPrimitiveNode(primitiveTypeNode, existingFieldValue, isNonNull) {
2281
+ const name = getASTNodeName(primitiveTypeNode);
2282
+ if (!name) return null;
2283
+ switch (name) {
2284
+ case "ID":
2285
+ if (z.string().safeParse(existingFieldValue).success) return existingFieldValue;
2286
+ return isNonNull ? "placeholder-id" : null;
2287
+ case BOOLEAN_GQL_PRIMITIVE_NAME:
2288
+ if (z.boolean().safeParse(existingFieldValue).success) return existingFieldValue;
2289
+ return isNonNull ? false : null;
2290
+ case "Int":
2291
+ if (z.number().safeParse(existingFieldValue).success) return existingFieldValue;
2292
+ return isNonNull ? 0 : null;
2293
+ case FLOAT_GQL_PRIMITIVE_NAME:
2294
+ if (z.number().safeParse(existingFieldValue).success) return existingFieldValue;
2295
+ return isNonNull ? 0 : null;
2296
+ case STRING_GQL_PRIMITIVE_NAME:
2297
+ if (z.string().safeParse(existingFieldValue).success) return existingFieldValue;
2298
+ return isNonNull ? "" : null;
2299
+ }
2300
+ return isNonNull ? existingFieldValue : null;
2301
+ }
2302
+ function makeMinimalValueForGqlEnum(namedTypeDefinitionNode, existingFieldValue, isNonNull) {
2303
+ const enumValues = namedTypeDefinitionNode.values?.map((value) => value.name.value) ?? [];
2304
+ if (typeof existingFieldValue === "string" && enumValues.includes(existingFieldValue)) return existingFieldValue;
2305
+ if (isNonNull) return enumValues[0];
2306
+ return null;
2307
+ }
2308
+ function makeMinimalValueForGqlScalar(scalarTypeDefinitionNode, existingFieldValue, isNonNull) {
2309
+ if (!isNonNull && !existingFieldValue) return null;
2310
+ const name = getASTNodeName(scalarTypeDefinitionNode);
2311
+ if (!name) {
2312
+ console.error("No name for scalar type definition node", scalarTypeDefinitionNode);
2313
+ return null;
2314
+ }
2315
+ const scalar = getPHCustomScalarByTypeName(name);
2316
+ if (!scalar) return null;
2317
+ if (scalar.schema.safeParse(existingFieldValue).success) return existingFieldValue;
2318
+ if (!isNonNull) return null;
2319
+ const minimalValue = scalar.getDefaultValue?.();
2320
+ if (minimalValue) return minimalValue;
2321
+ return existingFieldValue;
2322
+ }
2323
+ function makeMinimalValueForGqlUnion(namedTypeDefinitionNode, existingFieldValue, schemaDocumentNode, existingValueObject, isNonNull, visitedTypes) {
2324
+ if (!isNonNull && !existingFieldValue) return null;
2325
+ if (!namedTypeDefinitionNode.types?.length) return null;
2326
+ const firstNamedTypeDefinitionNode = namedTypeDefinitionNode.types?.at(0);
2327
+ if (!firstNamedTypeDefinitionNode) return null;
2328
+ const firstNamedTypeObjectDefinitionNode = getNamedTypeDefinitionNode(firstNamedTypeDefinitionNode, schemaDocumentNode);
2329
+ if (!isObjectTypeDefinitionNode(firstNamedTypeObjectDefinitionNode)) return null;
2330
+ return makeMinimalValueForGqlObject(firstNamedTypeObjectDefinitionNode, schemaDocumentNode, existingValueObject, existingFieldValue, isNonNull, visitedTypes);
2331
+ }
2332
+ function makeMinimalValueForGqlListNode(listTypeNode, existingFieldValue, isNonNull, schemaDocumentNode, visitedTypes) {
2333
+ if (!isNonNull && !Array.isArray(existingFieldValue)) return null;
2334
+ if (isNonNull && !Array.isArray(existingFieldValue)) return [];
2335
+ return existingFieldValue.map((item, index) => makeMinimalValueForASTNode({
2336
+ fieldName: String(index),
2337
+ astNode: listTypeNode.type,
2338
+ schemaDocumentNode,
2339
+ existingValueObject: { [index]: item },
2340
+ visitedTypes
2341
+ }));
2342
+ }
2343
+ function makeMinimalValueForGqlObject(objectTypeDefinitionNode, schemaDocumentNode, _existingValueObject, existingFieldValue, isNonNull, visitedTypes) {
2344
+ const typeName = objectTypeDefinitionNode.name.value;
2345
+ if (visitedTypes?.has(typeName)) return null;
2346
+ if (!isNonNull && !existingFieldValue) return null;
2347
+ const fields = objectTypeDefinitionNode.fields;
2348
+ if (!fields?.length) return {};
2349
+ const newVisitedTypes = new Set(visitedTypes);
2350
+ newVisitedTypes.add(typeName);
2351
+ return makeMinimalValuesForObjectFields({
2352
+ schemaDocumentNode,
2353
+ existingValueObject: existingFieldValue && typeof existingFieldValue === "object" && !Array.isArray(existingFieldValue) ? existingFieldValue : null,
2354
+ fieldDefinitionNodes: fields,
2355
+ visitedTypes: newVisitedTypes
2356
+ });
2357
+ }
2358
+ function getNamedTypeDefinitionNode(astNodeTypeNode, schemaDocumentNode) {
2359
+ if (!astNodeTypeNode) return null;
2360
+ const name = getASTNodeName(astNodeTypeNode);
2361
+ if (!name) return null;
2362
+ const definitionNode = schemaDocumentNode.definitions.find((def) => "kind" in def && "name" in def && def.name?.value === name);
2363
+ if (!definitionNode) return null;
2364
+ return definitionNode;
2365
+ }
2366
+ function removeWhitespace(str) {
2367
+ return str.replace(/\s+|\\n|\\t/g, "").toLowerCase();
2368
+ }
2369
+ function compareStringsWithoutWhitespace(str1, str2) {
2370
+ if (str1 === null || str2 === null || str1 === void 0 || str2 === void 0) return false;
2371
+ return removeWhitespace(str1) === removeWhitespace(str2);
2372
+ }
2373
+ function renameSchemaType(sdl, oldName, newName, scope) {
2374
+ const typeSuffix = scope === "global" ? "State" : "LocalState";
2375
+ const oldTypeName = `${pascalCase(oldName)}${typeSuffix}`;
2376
+ const newTypeName = `${pascalCase(newName)}${typeSuffix}`;
2377
+ const ast = safeParseSdl(sdl);
2378
+ if (!ast) return sdl;
2379
+ const updatedAst = visit(ast, { ObjectTypeDefinition: (node) => {
2380
+ if (node.name.value === oldTypeName) return {
2381
+ ...node,
2382
+ name: {
2383
+ ...node.name,
2384
+ value: newTypeName
2385
+ }
2386
+ };
2387
+ } });
2388
+ return print(updatedAst);
2389
+ }
2390
+ function initializeModelSchema(modelName) {
2391
+ return makeInitialSchemaDoc(modelName, "global");
2392
+ }
2393
+ function updateModelSchemaNames(params) {
2394
+ const { oldName, newName, globalStateSchema, localStateSchema, setStateSchema } = params;
2395
+ setStateSchema(renameSchemaType(globalStateSchema, oldName, newName, "global"), "global");
2396
+ if (localStateSchema) setStateSchema(renameSchemaType(localStateSchema, oldName, newName, "local"), "local");
2397
+ }
2398
+ function handleModelNameChange(params) {
2399
+ const { newName, globalStateSchema, setStateSchema } = params;
2400
+ if (!!!globalStateSchema) {
2401
+ setStateSchema(initializeModelSchema(newName), "global");
2402
+ return;
2403
+ }
2404
+ updateModelSchemaNames(params);
2405
+ }
2406
+ function validateStateObject(sharedSchemaDocumentNode, stateTypeDefinitionNode, stateValue) {
2407
+ let stateObjectJson;
2408
+ try {
2409
+ stateObjectJson = JSON.parse(stateValue);
2410
+ } catch (error) {
2411
+ return [new Error("Invalid JSON object", { cause: error })];
2412
+ }
2413
+ const typeDefByName = indexTypeDefinitions(sharedSchemaDocumentNode);
2414
+ const stateTypeName = stateTypeDefinitionNode.name.value;
2415
+ if (!typeDefByName.has(stateTypeName)) return [/* @__PURE__ */ new Error(`State type "${stateTypeName}" was not found in sharedSchemaDocumentNode`)];
2416
+ const inputSuffix = "Input";
2417
+ const generatedInputDefs = generateInputTypesForObjectTree(stateTypeName, typeDefByName, inputSuffix);
2418
+ const augmentedDoc = {
2419
+ ...sharedSchemaDocumentNode,
2420
+ definitions: [...sharedSchemaDocumentNode.definitions, ...generatedInputDefs]
2421
+ };
2422
+ let schema;
2423
+ try {
2424
+ schema = buildASTSchema(augmentedDoc, { assumeValidSDL: false });
2425
+ } catch (e) {
2426
+ return [new Error("Failed to build schema from SDL", { cause: e })];
2427
+ }
2428
+ const inputTypeName = `${stateTypeName}${inputSuffix}`;
2429
+ const op = getOperationAST(parse(`query($v: ${inputTypeName}!) { __typename }`));
2430
+ if (!op) return [/* @__PURE__ */ new Error("Failed to create validation operation AST")];
2431
+ const { errors } = getVariableValues(schema, op.variableDefinitions ?? [], { v: stateObjectJson });
2432
+ const recursiveTypeErrors = detectRecursiveTypes(stateTypeDefinitionNode, typeDefByName);
2433
+ const recursiveFieldNames = new Set(recursiveTypeErrors.map((e) => e.field));
2434
+ const validationErrors = errors ? graphQLErrorsToStateValidationErrors(errors).filter((e) => {
2435
+ if (e instanceof StateValidationError && e.kind === "NON_NULL") {
2436
+ const rootField = e.path[0];
2437
+ if (typeof rootField === "string" && recursiveFieldNames.has(rootField)) return false;
2438
+ }
2439
+ return true;
2440
+ }) : [];
2441
+ validationErrors.unshift(...recursiveTypeErrors);
2442
+ const missingOptionalErrors = detectMissingOptionalFields(sharedSchemaDocumentNode, stateTypeDefinitionNode, stateObjectJson);
2443
+ validationErrors.push(...missingOptionalErrors);
2444
+ return validationErrors;
2445
+ }
2446
+ /**
2447
+ * Indexes object/input/enum/scalar/interface/union type definition nodes by name.
2448
+ * Note: only AST definitions that have a "name" field are indexed.
2449
+ */
2450
+ function indexTypeDefinitions(doc) {
2451
+ const map = /* @__PURE__ */ new Map();
2452
+ for (const def of doc.definitions) if (def.kind === Kind.OBJECT_TYPE_DEFINITION || def.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION || def.kind === Kind.ENUM_TYPE_DEFINITION || def.kind === Kind.SCALAR_TYPE_DEFINITION || def.kind === Kind.INTERFACE_TYPE_DEFINITION || def.kind === Kind.UNION_TYPE_DEFINITION || def.kind === Kind.OBJECT_TYPE_EXTENSION || def.kind === Kind.INPUT_OBJECT_TYPE_EXTENSION || def.kind === Kind.ENUM_TYPE_EXTENSION || def.kind === Kind.INTERFACE_TYPE_EXTENSION || def.kind === Kind.UNION_TYPE_EXTENSION) {
2453
+ const name = def.name.value;
2454
+ if (!map.has(name)) map.set(name, def);
2455
+ }
2456
+ return map;
2457
+ }
2458
+ /**
2459
+ * Generates InputObjectTypeDefinitionNode(s) for a root object type and any nested
2460
+ * object types reachable via fields, converting object references to their *Input equivalents*.
2461
+ */
2462
+ function generateInputTypesForObjectTree(rootObjectTypeName, typeDefByName, inputSuffix) {
2463
+ const generated = /* @__PURE__ */ new Map();
2464
+ const visiting = /* @__PURE__ */ new Set();
2465
+ const ensureInputForObject = (objectTypeName) => {
2466
+ const inputName = `${objectTypeName}${inputSuffix}`;
2467
+ if (generated.has(inputName)) return;
2468
+ if (visiting.has(objectTypeName)) return;
2469
+ visiting.add(objectTypeName);
2470
+ const def = typeDefByName.get(objectTypeName);
2471
+ if (!def) throw new GraphQLError(`Unknown referenced type "${objectTypeName}"`);
2472
+ if (def.kind !== Kind.OBJECT_TYPE_DEFINITION && def.kind !== Kind.OBJECT_TYPE_EXTENSION) throw new GraphQLError(`Type "${objectTypeName}" is not an object type; cannot generate input from kind "${def.kind}"`);
2473
+ const objDef = def;
2474
+ const inputFields = objDef.fields?.map((f) => {
2475
+ return {
2476
+ kind: Kind.INPUT_VALUE_DEFINITION,
2477
+ name: f.name,
2478
+ description: f.description,
2479
+ directives: [],
2480
+ type: convertOutputTypeNodeToInputTypeNode(f.type, typeDefByName, inputSuffix, ensureInputForObject),
2481
+ defaultValue: void 0
2482
+ };
2483
+ }) ?? [];
2484
+ const inputDef = {
2485
+ kind: Kind.INPUT_OBJECT_TYPE_DEFINITION,
2486
+ name: {
2487
+ kind: Kind.NAME,
2488
+ value: inputName
2489
+ },
2490
+ description: objDef.description,
2491
+ directives: [],
2492
+ fields: inputFields
2493
+ };
2494
+ generated.set(inputName, inputDef);
2495
+ visiting.delete(objectTypeName);
2496
+ };
2497
+ ensureInputForObject(rootObjectTypeName);
2498
+ return Array.from(generated.values());
2499
+ }
2500
+ function convertOutputTypeNodeToInputTypeNode(typeNode, typeDefByName, inputSuffix, ensureInputForObject) {
2501
+ switch (typeNode.kind) {
2502
+ case Kind.NON_NULL_TYPE: return {
2503
+ kind: Kind.NON_NULL_TYPE,
2504
+ type: convertOutputTypeNodeToInputTypeNode(typeNode.type, typeDefByName, inputSuffix, ensureInputForObject)
2505
+ };
2506
+ case Kind.LIST_TYPE: return {
2507
+ kind: Kind.LIST_TYPE,
2508
+ type: convertOutputTypeNodeToInputTypeNode(typeNode.type, typeDefByName, inputSuffix, ensureInputForObject)
2509
+ };
2510
+ case Kind.NAMED_TYPE: {
2511
+ const named = typeNode;
2512
+ const name = named.name.value;
2513
+ const def = typeDefByName.get(name);
2514
+ if (def?.kind === Kind.OBJECT_TYPE_DEFINITION || def?.kind === Kind.OBJECT_TYPE_EXTENSION) {
2515
+ ensureInputForObject(name);
2516
+ return {
2517
+ kind: Kind.NAMED_TYPE,
2518
+ name: {
2519
+ kind: Kind.NAME,
2520
+ value: `${name}${inputSuffix}`
2521
+ }
2522
+ };
2523
+ }
2524
+ if (!def || def.kind === Kind.SCALAR_TYPE_DEFINITION || def.kind === Kind.ENUM_TYPE_DEFINITION || def.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION || def.kind === Kind.INPUT_OBJECT_TYPE_EXTENSION) return named;
2525
+ if (def.kind === Kind.INTERFACE_TYPE_DEFINITION || def.kind === Kind.UNION_TYPE_DEFINITION) throw new GraphQLError(`Type "${name}" (${def.kind}) cannot be used in an input type`);
2526
+ throw new GraphQLError(`Unsupported named type "${name}" of kind "${def.kind}"`);
2527
+ }
2528
+ default: throw new GraphQLError(`Unsupported TypeNode kind: ${JSON.stringify(typeNode)}`);
2529
+ }
2530
+ }
2531
+ var StateValidationError = class extends Error {
2532
+ payload;
2533
+ originalMessage;
2534
+ constructor(payload, originalMessage) {
2535
+ super(payload.kind);
2536
+ this.name = "StateValidationError";
2537
+ this.payload = payload;
2538
+ this.originalMessage = originalMessage;
2539
+ Object.setPrototypeOf(this, new.target.prototype);
2540
+ }
2541
+ get kind() {
2542
+ return this.payload.kind;
2543
+ }
2544
+ get path() {
2545
+ return this.payload.path;
2546
+ }
2547
+ get field() {
2548
+ return this.payload.field;
2549
+ }
2550
+ };
2551
+ function extractInputPath(message) {
2552
+ const match = message.match(/at\s+"([^"]+)"/);
2553
+ if (!match) return [];
2554
+ const parts = match[1].split(".").filter(Boolean);
2555
+ return (parts[0] === "v" ? parts.slice(1) : parts).map((p) => /^\d+$/.test(p) ? Number(p) : p);
2556
+ }
2557
+ const RE_MISSING_REQUIRED_FIELD = /Field "([^"]+)" of required type "([^"]+)" was not provided\./;
2558
+ const RE_UNKNOWN_FIELD = /Field "([^"]+)" is not defined by type "([^"]+)"\.(?: Did you mean "([^"]+)"\?)?/;
2559
+ function extractMissingRequiredField(message) {
2560
+ const m = message.match(RE_MISSING_REQUIRED_FIELD);
2561
+ if (!m) return null;
2562
+ return {
2563
+ field: m[1],
2564
+ expectedType: m[2]
2565
+ };
2566
+ }
2567
+ function extractUnknownField(message) {
2568
+ const m = message.match(RE_UNKNOWN_FIELD);
2569
+ if (!m) return null;
2570
+ return {
2571
+ field: m[1],
2572
+ typeName: m[2],
2573
+ didYouMean: m[3]
2574
+ };
2575
+ }
2576
+ function lastFieldFromPath(path) {
2577
+ for (let i = path.length - 1; i >= 0; i--) if (typeof path[i] === "string") return path[i];
2578
+ }
2579
+ function extractExpectedType(message) {
2580
+ let m = message.match(/Expected non-nullable type "([^"]+)"/);
2581
+ if (m?.[1]) return m[1];
2582
+ m = message.match(/Expected type "([^"]+)"/);
2583
+ if (m?.[1]) return m[1];
2584
+ m = message.match(/;\s*([_A-Za-z][_0-9A-Za-z]*)\s+cannot represent/i);
2585
+ if (m?.[1]) return m[1];
2586
+ }
2587
+ function graphQLErrorsToStateValidationErrors(errors) {
2588
+ const out = [];
2589
+ for (const e of errors) {
2590
+ const originalMessage = e.message;
2591
+ const missing = extractMissingRequiredField(originalMessage);
2592
+ if (missing) {
2593
+ out.push(new StateValidationError({
2594
+ kind: "MISSING",
2595
+ path: [missing.field],
2596
+ field: missing.field,
2597
+ expectedType: missing.expectedType
2598
+ }, originalMessage));
2599
+ continue;
2600
+ }
2601
+ const unknown = extractUnknownField(originalMessage);
2602
+ if (unknown) {
2603
+ out.push(new StateValidationError({
2604
+ kind: "UNKNOWN_FIELD",
2605
+ path: [unknown.field],
2606
+ field: unknown.field,
2607
+ didYouMean: unknown.didYouMean
2608
+ }, originalMessage));
2609
+ continue;
2610
+ }
2611
+ const path = extractInputPath(originalMessage);
2612
+ const field = lastFieldFromPath(path) ?? "value";
2613
+ const expectedType = extractExpectedType(originalMessage);
2614
+ if (originalMessage.includes("Expected non-nullable type") && originalMessage.includes("not to be null")) {
2615
+ out.push(new StateValidationError({
2616
+ kind: "NON_NULL",
2617
+ path,
2618
+ field,
2619
+ expectedType
2620
+ }, originalMessage));
2621
+ continue;
2622
+ }
2623
+ if (originalMessage.includes("cannot represent") || originalMessage.includes("Expected type")) {
2624
+ out.push(new StateValidationError({
2625
+ kind: "TYPE",
2626
+ path,
2627
+ field,
2628
+ expectedType,
2629
+ details: originalMessage
2630
+ }, originalMessage));
2631
+ continue;
2632
+ }
2633
+ out.push(new StateValidationError({
2634
+ kind: "TYPE",
2635
+ path,
2636
+ field,
2637
+ details: originalMessage
2638
+ }, originalMessage));
2639
+ }
2640
+ return out;
2641
+ }
2642
+ /**
2643
+ * Finds all fields defined in the schema that are missing from the state object.
2644
+ * Returns information about each missing field including whether it's required.
2645
+ */
2646
+ function findMissingFields(sharedSchemaDocumentNode, rootTypeNode, value, basePath = []) {
2647
+ let stateObjectJson;
2648
+ try {
2649
+ stateObjectJson = typeof value === "string" ? JSON.parse(value) : value;
2650
+ } catch {
2651
+ return [];
2652
+ }
2653
+ const typeByName = indexObjectTypes(sharedSchemaDocumentNode);
2654
+ const missingFields = [];
2655
+ for (const field of rootTypeNode.fields ?? []) {
2656
+ const fieldName = field.name.value;
2657
+ const fieldPath = [...basePath, fieldName];
2658
+ const isRequired = field.type.kind === Kind.NON_NULL_TYPE;
2659
+ const underlyingType = isRequired ? field.type.type : field.type;
2660
+ if (!(fieldName in stateObjectJson)) {
2661
+ missingFields.push({
2662
+ fieldName,
2663
+ path: fieldPath,
2664
+ isRequired,
2665
+ type: underlyingType
2666
+ });
2667
+ continue;
2668
+ }
2669
+ const namedType = unwrapNamedType(field.type);
2670
+ const childType = namedType ? typeByName.get(namedType) : void 0;
2671
+ if (childType && typeof stateObjectJson[fieldName] === "object" && stateObjectJson[fieldName] !== null && !Array.isArray(stateObjectJson[fieldName])) {
2672
+ const nestedMissing = findMissingFields(sharedSchemaDocumentNode, childType, stateObjectJson[fieldName], fieldPath);
2673
+ missingFields.push(...nestedMissing);
2674
+ }
2675
+ }
2676
+ return missingFields;
2677
+ }
2678
+ /**
2679
+ * Detects optional fields defined in the schema that are missing from the state object.
2680
+ * Returns StateValidationError[] for each missing optional field.
2681
+ */
2682
+ function detectMissingOptionalFields(sharedSchemaDocumentNode, rootTypeNode, value) {
2683
+ return findMissingFields(sharedSchemaDocumentNode, rootTypeNode, value).filter((field) => !field.isRequired).map((field) => new StateValidationError({
2684
+ kind: "MISSING_OPTIONAL",
2685
+ path: field.path,
2686
+ field: field.fieldName,
2687
+ expectedType: typeNodeToString(field.type)
2688
+ }));
2689
+ }
2690
+ /**
2691
+ * Detects fields that have recursive types (types that reference themselves directly or indirectly).
2692
+ * Returns a RECURSIVE_TYPE error for each field that contains a recursive type.
2693
+ */
2694
+ function detectRecursiveTypes(stateTypeDefinitionNode, typeDefByName) {
2695
+ const errors = [];
2696
+ for (const field of stateTypeDefinitionNode.fields ?? []) {
2697
+ const fieldName = field.name.value;
2698
+ const namedTypeName = getNamedTypeName(field.type);
2699
+ if (!namedTypeName) continue;
2700
+ if (isRecursiveType(namedTypeName, typeDefByName, /* @__PURE__ */ new Set())) errors.push(new StateValidationError({
2701
+ kind: "RECURSIVE_TYPE",
2702
+ path: [fieldName],
2703
+ field: fieldName,
2704
+ typeName: namedTypeName
2705
+ }));
2706
+ }
2707
+ return errors;
2708
+ }
2709
+ /**
2710
+ * Gets the named type name from a TypeNode, unwrapping NonNull and List types.
2711
+ */
2712
+ function getNamedTypeName(typeNode) {
2713
+ if (typeNode.kind === Kind.NAMED_TYPE) return typeNode.name.value;
2714
+ if (typeNode.kind === Kind.NON_NULL_TYPE || typeNode.kind === Kind.LIST_TYPE) return getNamedTypeName(typeNode.type);
2715
+ return null;
2716
+ }
2717
+ /**
2718
+ * Checks if a type is recursive (references itself directly or indirectly through required fields).
2719
+ */
2720
+ function isRecursiveType(typeName, typeDefByName, visitedTypes) {
2721
+ if (visitedTypes.has(typeName)) return true;
2722
+ const typeDef = typeDefByName.get(typeName);
2723
+ if (!typeDef || typeDef.kind !== Kind.OBJECT_TYPE_DEFINITION) return false;
2724
+ visitedTypes.add(typeName);
2725
+ for (const field of typeDef.fields ?? []) {
2726
+ if (field.type.kind !== Kind.NON_NULL_TYPE) continue;
2727
+ const innerType = field.type.type;
2728
+ let fieldTypeName = null;
2729
+ if (innerType.kind === Kind.NAMED_TYPE) fieldTypeName = innerType.name.value;
2730
+ else if (innerType.kind === Kind.LIST_TYPE) fieldTypeName = getNamedTypeName(innerType);
2731
+ if (fieldTypeName && isRecursiveType(fieldTypeName, typeDefByName, visitedTypes)) return true;
2732
+ }
2733
+ visitedTypes.delete(typeName);
2734
+ return false;
2735
+ }
2736
+ /**
2737
+ * Converts a TypeNode to its string representation (e.g., "String", "Int!", "[String]!")
2738
+ */
2739
+ function typeNodeToString(typeNode) {
2740
+ switch (typeNode.kind) {
2741
+ case Kind.NAMED_TYPE: return typeNode.name.value;
2742
+ case Kind.NON_NULL_TYPE: return `${typeNodeToString(typeNode.type)}!`;
2743
+ case Kind.LIST_TYPE: return `[${typeNodeToString(typeNode.type)}]`;
2744
+ }
2745
+ }
2746
+ function indexObjectTypes(doc) {
2747
+ const map = /* @__PURE__ */ new Map();
2748
+ for (const def of doc.definitions) if (def.kind === Kind.OBJECT_TYPE_DEFINITION) map.set(def.name.value, def);
2749
+ return map;
2750
+ }
2751
+ function unwrapNamedType(typeNode) {
2752
+ if (typeNode.kind === Kind.NAMED_TYPE) return typeNode.name.value;
2753
+ if (typeNode.kind === Kind.NON_NULL_TYPE) return unwrapNamedType(typeNode.type);
2754
+ if (typeNode.kind === Kind.LIST_TYPE) return unwrapNamedType(typeNode.type);
2755
+ }
2756
+ //#endregion
2757
+ //#region editors/document-model-editor/utils/linting.ts
2758
+ function ensureDocumentContainsNodeWithNameAndType(doc, nodeName, nodeType) {
2759
+ const parsedDoc = safeParseSdl(doc);
2760
+ if (!parsedDoc) return true;
2761
+ return parsedDoc.definitions.some((def) => {
2762
+ return def.kind === Kind[nodeType] && "name" in def && def.name?.value === nodeName;
2763
+ });
2764
+ }
2765
+ function createNodeTypeAndNameDiagnostic(doc, errorMessage) {
2766
+ const parsedDoc = safeParseSdl(doc);
2767
+ if (!parsedDoc) return void 0;
2768
+ const firstNode = parsedDoc.definitions[0];
2769
+ const nameNode = "name" in firstNode ? firstNode.name : null;
2770
+ return {
2771
+ from: nameNode?.loc?.start ?? firstNode.loc?.start ?? 0,
2772
+ to: nameNode?.loc?.end ?? firstNode.loc?.end ?? 0,
2773
+ severity: "error",
2774
+ message: errorMessage
2775
+ };
2776
+ }
2777
+ function ensureValidStateSchemaName(doc, modelName, scope) {
2778
+ if (!safeParseSdl(doc)) return [];
2779
+ const requiredTypeName = makeStateSchemaNameForScope(modelName, scope);
2780
+ if (!ensureDocumentContainsNodeWithNameAndType(doc, requiredTypeName, "OBJECT_TYPE_DEFINITION")) return [createNodeTypeAndNameDiagnostic(doc, `${sentenceCase(scope)} state schema must be named ${requiredTypeName}`)].filter((d) => d !== void 0);
2781
+ return [];
2782
+ }
2783
+ function ensureValidOperationSchemaInputName(doc, operationName) {
2784
+ if (!doc || !safeParseSdl(doc)) return [];
2785
+ const requiredTypeName = `${pascalCase(operationName)}Input`;
2786
+ if (!ensureDocumentContainsNodeWithNameAndType(doc, requiredTypeName, "INPUT_OBJECT_TYPE_DEFINITION")) return [createNodeTypeAndNameDiagnostic(doc, `Operation schema must contain an input type named ${requiredTypeName}`)].filter((d) => d !== void 0);
2787
+ return [];
2788
+ }
2789
+ //#endregion
2790
+ //#region editors/document-model-editor/components/button.tsx
2791
+ const Button = forwardRef((props, ref) => {
2792
+ const { className, ...rest } = props;
2793
+ return /* @__PURE__ */ jsx("button", {
2794
+ ref,
2795
+ ...rest,
2796
+ className: twMerge("h-10 rounded-md border border-border bg-background px-4 py-2 text-sm font-medium whitespace-nowrap text-foreground transition-colors hover:hover-effect focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:disabled-effect", className)
2797
+ });
2798
+ });
2799
+ //#endregion
1937
2800
  //#region editors/document-model-editor/components/divider.tsx
1938
2801
  function Divider({ className, size = "sm", margin = "md" }) {
1939
2802
  function getSize() {
@@ -1946,7 +2809,9 @@ function Divider({ className, size = "sm", margin = "md" }) {
1946
2809
  if (margin === "md") return "my-6";
1947
2810
  return "my-8";
1948
2811
  }
1949
- return /* @__PURE__ */ jsx("div", { className: twMerge("bg-secondary", getSize(), getMargin(), className) });
2812
+ const sizeClass = getSize();
2813
+ const marginClass = getMargin();
2814
+ return /* @__PURE__ */ jsx("div", { className: twMerge("bg-secondary", sizeClass, marginClass, className) });
1950
2815
  }
1951
2816
  //#endregion
1952
2817
  //#region ../../node_modules/.pnpm/@hookform+resolvers@5.2.2_react-hook-form@7.71.2_react@19.2.6_/node_modules/@hookform/resolvers/dist/resolvers.mjs
@@ -1955,12 +2820,14 @@ const r = (t, r, o) => {
1955
2820
  const s = get(o, r);
1956
2821
  t.setCustomValidity(s && s.message || ""), t.reportValidity();
1957
2822
  }
1958
- }, o = (e, t) => {
2823
+ };
2824
+ const o = (e, t) => {
1959
2825
  for (const o in t.fields) {
1960
2826
  const s = t.fields[o];
1961
2827
  s && s.ref && "reportValidity" in s.ref ? r(s.ref, o, e) : s && s.refs && s.refs.forEach((t) => r(t, o, e));
1962
2828
  }
1963
- }, s$1 = (r, s) => {
2829
+ };
2830
+ const s$1 = (r, s) => {
1964
2831
  s.shouldUseNativeValidation && o(r, s);
1965
2832
  const n = {};
1966
2833
  for (const o in r) {
@@ -1971,7 +2838,8 @@ const r = (t, r, o) => {
1971
2838
  } else set(n, o, c);
1972
2839
  }
1973
2840
  return n;
1974
- }, i$1 = (e, t) => {
2841
+ };
2842
+ const i$1 = (e, t) => {
1975
2843
  const r = n$1(t);
1976
2844
  return e.some((e) => n$1(e).match(`^${r}\\.\\d+`));
1977
2845
  };
@@ -2402,32 +3270,38 @@ function ModelMetadata(props) {
2402
3270
  }
2403
3271
  function ModelNameForm(props) {
2404
3272
  const { name, globalStateSchema, localStateSchema, setModelName, setStateSchema } = props;
3273
+ const onSubmit = useCallback((newName) => {
3274
+ if (name === newName) return;
3275
+ setModelName(newName);
3276
+ if (!!!globalStateSchema) {
3277
+ const initialSchemaDoc = makeInitialSchemaDoc(newName, "global");
3278
+ setStateSchema(initialSchemaDoc, "global");
3279
+ return;
3280
+ }
3281
+ const newSchema = renameSchemaType(globalStateSchema, name, newName, "global");
3282
+ setStateSchema(newSchema, "global");
3283
+ if (localStateSchema) {
3284
+ const newLocalStateSchema = renameSchemaType(localStateSchema, name, newName, "local");
3285
+ setStateSchema(newLocalStateSchema, "local");
3286
+ }
3287
+ handleModelNameChange({
3288
+ oldName: name,
3289
+ newName,
3290
+ globalStateSchema,
3291
+ localStateSchema,
3292
+ setStateSchema
3293
+ });
3294
+ }, [
3295
+ name,
3296
+ globalStateSchema,
3297
+ localStateSchema,
3298
+ setStateSchema,
3299
+ setModelName
3300
+ ]);
2405
3301
  return /* @__PURE__ */ jsx(TextField, {
2406
3302
  name: "name",
2407
3303
  value: name,
2408
- onSubmit: useCallback((newName) => {
2409
- if (name === newName) return;
2410
- setModelName(newName);
2411
- if (!!!globalStateSchema) {
2412
- setStateSchema(makeInitialSchemaDoc(newName, "global"), "global");
2413
- return;
2414
- }
2415
- setStateSchema(renameSchemaType(globalStateSchema, name, newName, "global"), "global");
2416
- if (localStateSchema) setStateSchema(renameSchemaType(localStateSchema, name, newName, "local"), "local");
2417
- handleModelNameChange({
2418
- oldName: name,
2419
- newName,
2420
- globalStateSchema,
2421
- localStateSchema,
2422
- setStateSchema
2423
- });
2424
- }, [
2425
- name,
2426
- globalStateSchema,
2427
- localStateSchema,
2428
- setStateSchema,
2429
- setModelName
2430
- ]),
3304
+ onSubmit,
2431
3305
  placeholder: "Model name",
2432
3306
  className: "border-none pl-0 text-xl font-bold text-foreground",
2433
3307
  required: true,
@@ -2628,7 +3502,7 @@ function OperationErrors({ operation, addOperationError, deleteOperationError, s
2628
3502
  }
2629
3503
  //#endregion
2630
3504
  //#region editors/document-model-editor/components/operation.tsx
2631
- const GraphqlEditor = lazy(() => import("./graphql-editor-DoXZvdNr.js"));
3505
+ const GraphqlEditor = lazy(() => import("./graphql-editor-C9Nc_cOY.js"));
2632
3506
  function Operation(props) {
2633
3507
  const { operation, module, allOperationNames, lastCreatedOperationId, onAddOperationAndInitialSchema, updateOperationName, deleteOperation, updateOperationSchema, setOperationDescription, addOperationError, deleteOperationError, setOperationErrorName, toggleNoInputRequired } = props;
2634
3508
  const noInputRequired = isEmptyOperationSchema(operation.schema);
@@ -3364,7 +4238,8 @@ function useVersionAdvisory(args) {
3364
4238
  }
3365
4239
  //#endregion
3366
4240
  //#region editors/document-model-editor/editor.tsx
3367
- const StateSchemas = lazy(() => import("./state-schemas-B47wHvDV.js"));
4241
+ var editor_exports = /* @__PURE__ */ __exportAll({ default: () => Editor });
4242
+ const StateSchemas = lazy(() => import("./state-schemas-BSc_36Vd.js"));
3368
4243
  const noopSetStateSchema = () => void 0;
3369
4244
  const noopSetInitialState = () => void 0;
3370
4245
  function Editor() {
@@ -3388,10 +4263,11 @@ function Editor() {
3388
4263
  useEffect(() => {
3389
4264
  if (!shouldSetInitialName.current || !documentNodeName) return;
3390
4265
  const initialSchemaDoc = initializeModelSchema(documentNodeName);
3391
- dispatch([setModelName({ name: documentNodeName }), setStateSchema({
4266
+ const actions = [setModelName({ name: documentNodeName }), setStateSchema({
3392
4267
  schema: initialSchemaDoc,
3393
4268
  scope: "global"
3394
- })]);
4269
+ })];
4270
+ dispatch(actions);
3395
4271
  shouldSetInitialName.current = false;
3396
4272
  }, [documentNodeName, dispatch]);
3397
4273
  const { guardedDispatch, prompt, releaseFirst, keepEditing, cancelAdvisory, markVersionInDevelopment } = useVersionAdvisory({
@@ -3542,11 +4418,12 @@ function Editor() {
3542
4418
  return;
3543
4419
  }
3544
4420
  const id = generateId();
4421
+ const errorCode = pascalCase(errorName);
3545
4422
  guardedDispatch(addOperationError({
3546
4423
  id,
3547
4424
  operationId,
3548
4425
  errorName,
3549
- errorCode: pascalCase(errorName)
4426
+ errorCode
3550
4427
  }));
3551
4428
  resolve(id);
3552
4429
  } catch (error) {
@@ -3674,6 +4551,6 @@ function Editor() {
3674
4551
  });
3675
4552
  }
3676
4553
  //#endregion
3677
- export { Editor as default };
4554
+ export { makeInitialSchemaDoc as a, validateStateObject as c, Editor as default, StateValidationError as i, safeParseSdl as l, Button as n, makeMinimalObjectForStateType as o, ensureValidStateSchemaName as r, makeStateSchemaNameForScope as s, editor_exports as t, useSchemaContext as u };
3678
4555
 
3679
- //# sourceMappingURL=editor-CQ4wUFK5.js.map
4556
+ //# sourceMappingURL=editor-Dk_HEgr2.js.map