@powerhousedao/connect 1.1.2 → 2.5.0-test.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 (38) hide show
  1. package/dist/.env +2 -1
  2. package/dist/assets/{app-D1OgCILX.css → app-Djvyy0EQ.css} +145 -2
  3. package/dist/assets/{app-DJhQA-n0.js → app-DnlszXoG.js} +49870 -42678
  4. package/dist/assets/app-DnlszXoG.js.map +1 -0
  5. package/dist/assets/{app-loader-4GyeoNTc.css → app-loader-CDW9U8zV.css} +179 -7
  6. package/dist/assets/{app-loader-_ujGNJEV.js → app-loader-LF_aPRFS.js} +3441 -3977
  7. package/dist/assets/app-loader-LF_aPRFS.js.map +1 -0
  8. package/dist/assets/browser-Bl-r87ld.js +27234 -0
  9. package/dist/assets/browser-Bl-r87ld.js.map +1 -0
  10. package/dist/assets/{ccip-CCI6GbPl.js → ccip-5fOGBE-2.js} +4 -3
  11. package/dist/assets/ccip-5fOGBE-2.js.map +1 -0
  12. package/dist/assets/{content-9ycjllj5.js → content-ChtzAUHq.js} +1762 -1049
  13. package/dist/assets/content-ChtzAUHq.js.map +1 -0
  14. package/dist/assets/{index-3G4_JsnT.js → index-B8Ch0VYb.js} +4 -3
  15. package/dist/assets/index-B8Ch0VYb.js.map +1 -0
  16. package/dist/assets/{index-C2x6Y6L5.js → index-C9SvsNTs.js} +23 -171
  17. package/dist/assets/index-C9SvsNTs.js.map +1 -0
  18. package/dist/assets/index-ttu2Jrkl.js +208 -0
  19. package/dist/assets/index-ttu2Jrkl.js.map +1 -0
  20. package/dist/assets/{index-8c1XCqhj.js → index-wgNrNkzN.js} +466 -309
  21. package/dist/assets/index-wgNrNkzN.js.map +1 -0
  22. package/dist/assets/{main.DXf9Xuwr.js → main.B-rBx6n2.js} +2 -1
  23. package/dist/assets/main.B-rBx6n2.js.map +1 -0
  24. package/dist/assets/reactor-analytics-C42Sftjd.js +42 -0
  25. package/dist/assets/reactor-analytics-C42Sftjd.js.map +1 -0
  26. package/dist/assets/router-DocwpreM.js +1791 -0
  27. package/dist/assets/router-DocwpreM.js.map +1 -0
  28. package/dist/assets/{style-U7Kx3_hE.css → style-C0GVbPTL.css} +6 -3
  29. package/dist/external-packages.js +1 -0
  30. package/dist/external-packages.js.map +1 -0
  31. package/dist/hmr.js +1 -0
  32. package/dist/hmr.js.map +1 -0
  33. package/dist/index.html +2 -1
  34. package/dist/service-worker.js +1 -0
  35. package/dist/service-worker.js.map +1 -0
  36. package/dist/swEnv.js +1 -0
  37. package/dist/vite-envs.sh +10 -1
  38. package/package.json +21 -16
@@ -1,10 +1,10 @@
1
1
  var _a2, _b;
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { t as twMerge, ag as clsx, ah as get, ai as set, aj as appendErrors, ak as useFormContext, al as Primitive, am as cva, an as FormProvider, ao as Controller, ap as Slot, aq as useForm, ar as Root2, as as List, at as Trigger, au as Content, av as setModelName, aw as setModelId, ax as setModelDescription, ay as setModelExtension, az as setAuthorName, aA as setAuthorWebsite, aB as setStateSchema, aC as setInitialState, aD as addModule, aE as setModuleName, aF as deleteModule, aG as addOperation, aH as setOperationName, aI as setOperationSchema, aJ as setOperationDescription, aK as deleteOperation, aL as addOperationError, aM as deleteOperationError, aN as setOperationErrorName } from "./app-DJhQA-n0.js";
4
- import { b9 as inspect$1, ba as GraphQLError$1, bb as getNamedType, bc as invariant$2, bd as isInputObjectType, be as isScalarType, bf as isObjectType, bg as isInterfaceType, bh as isUnionType, bi as isEnumType, bj as print, bk as isPrintableAsBlockString, bl as Kind, bm as astFromValue$1, bn as DEFAULT_DEPRECATION_REASON, bo as isSpecifiedDirective, bp as isSpecifiedScalarType, bq as isIntrospectionType, br as z, bs as GraphQLScalarType, bt as specifiedRules$1, bu as GraphQLID, bv as GraphQLBoolean, bw as GraphQLString, bx as GraphQLFloat, by as GraphQLInt, bz as GraphQLDirective, bA as GraphQLObjectType, bB as GraphQLInterfaceType, bC as GraphQLUnionType, bD as GraphQLInputObjectType, bE as GraphQLEnumType, bF as isListType, bG as GraphQLList, bH as isNonNullType, bI as GraphQLNonNull, bJ as isNamedType, bK as getNullableType, bL as isLeafType, bM as GraphQLSchema, bN as buildSchema, bO as buildASTSchema, bP as parse, bQ as validate$2, Z as pascalCase, bR as visit, bS as extendSchema, $ as getDefaultExportFromCjs, bT as snakeCase, bU as constantCase, bV as isAbstractType, bW as BREAK, bX as SchemaMetaFieldDef, bY as TypeMetaFieldDef, bZ as TypeNameMetaFieldDef, b_ as isCompositeType, b$ as isOutputType, c0 as isInputType, c1 as assertAbstractType, c2 as doTypesOverlap, c3 as DirectiveLocation, c4 as NoUnusedFragmentsRule$1, c5 as ExecutableDefinitionsRule$1, c6 as validateSchema, c7 as sentenceCase, an as generateId } from "./app-loader-_ujGNJEV.js";
3
+ import { t as twMerge, aa as clsx, ab as get, ac as set, ad as appendErrors, ae as useFormContext, af as Primitive, ag as cva, ah as FormProvider, ai as Controller, aj as Slot, ak as useForm, al as Root2, am as List, an as Trigger, ao as Content, ap as setModelName, aq as setModelId, ar as setModelDescription, as as setModelExtension, at as setAuthorName, au as setAuthorWebsite, av as setStateSchema, aw as setInitialState, ax as addModule, ay as setModuleName, az as deleteModule, aA as addOperation, aB as setOperationName, aC as setOperationSchema, aD as setOperationDescription, aE as deleteOperation, aF as addOperationError, aG as deleteOperationError, aH as setOperationErrorName } from "./app-DnlszXoG.js";
4
+ import { aQ as inspect$1, aR as GraphQLError$1, aS as getNamedType, aT as invariant$2, aU as isInputObjectType, aV as isScalarType, aW as isObjectType, aX as isInterfaceType, aY as isUnionType, aZ as isEnumType, a_ as print, a$ as isPrintableAsBlockString, b0 as Kind, b1 as astFromValue$1, b2 as DEFAULT_DEPRECATION_REASON, b3 as isSpecifiedDirective, b4 as isSpecifiedScalarType, b5 as isIntrospectionType, a5 as objectType, b6 as GraphQLScalarType, b7 as numberType, a7 as stringType, b8 as lazyType, b9 as unionType, ba as booleanType, bb as nullType, bc as arrayType, a6 as recordType, bd as specifiedRules$1, be as GraphQLID, bf as GraphQLBoolean, bg as GraphQLString, bh as GraphQLFloat, bi as GraphQLInt, bj as GraphQLDirective, bk as GraphQLObjectType, bl as GraphQLInterfaceType, bm as GraphQLUnionType, bn as GraphQLInputObjectType, bo as GraphQLEnumType, bp as isListType, bq as GraphQLList, br as isNonNullType, bs as GraphQLNonNull, bt as isNamedType, bu as getNullableType, bv as isLeafType, bw as GraphQLSchema, bx as buildSchema, by as buildASTSchema, bz as parse, bA as validate$2, Z as pascalCase, bB as visit, a0 as getDefaultExportFromCjs, bC as snakeCase, bD as constantCase, bE as literalType, bF as isAbstractType, bG as BREAK, bH as SchemaMetaFieldDef, bI as TypeMetaFieldDef, bJ as TypeNameMetaFieldDef, bK as isCompositeType, bL as isOutputType, bM as isInputType, bN as assertAbstractType, bO as doTypesOverlap, bP as DirectiveLocation, bQ as NoUnusedFragmentsRule$1, bR as ExecutableDefinitionsRule$1, ah as process, bS as validateSchema, bT as sentenceCase, am as generateId } from "./app-loader-LF_aPRFS.js";
5
5
  import * as React from "react";
6
6
  import React__default, { useState, useEffect, createContext, useContext, forwardRef, useRef, useCallback, useImperativeHandle, useId, memo, useMemo } from "react";
7
- import "./main.DXf9Xuwr.js";
7
+ import "./main.B-rBx6n2.js";
8
8
  import "react-dom";
9
9
  const versionInfo = Object.freeze({
10
10
  major: 16,
@@ -296,9 +296,9 @@ function printDescription(def, indentation = "", firstInBlock = true) {
296
296
  }
297
297
  const type$g = "{ unit?: string, value?: number }";
298
298
  const typedef$f = "scalar Amount";
299
- const schema$g = z.object({
300
- unit: z.string().optional(),
301
- value: z.number().finite()
299
+ const schema$g = objectType({
300
+ unit: stringType().optional(),
301
+ value: numberType().finite()
302
302
  });
303
303
  const stringSchema$f = "z.object({ unit: z.string().optional(), value: z.number().finite() })";
304
304
  const amountValidation = (value) => {
@@ -351,9 +351,9 @@ const Amount = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
351
351
  }, Symbol.toStringTag, { value: "Module" }));
352
352
  const type$f = "{ unit: string, value: number }";
353
353
  const typedef$e = "scalar Amount_Crypto";
354
- const schema$f = z.object({
355
- unit: z.string(),
356
- value: z.number().finite()
354
+ const schema$f = objectType({
355
+ unit: stringType(),
356
+ value: numberType().finite()
357
357
  });
358
358
  const stringSchema$e = "z.object({ unit: z.string(), value: z.number().finite() })";
359
359
  const amountCryptoValidation = (value) => {
@@ -405,9 +405,9 @@ const AmountCrypto = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.define
405
405
  }, Symbol.toStringTag, { value: "Module" }));
406
406
  const type$e = "{ unit: string, value: number }";
407
407
  const typedef$d = "scalar Amount_Currency";
408
- const schema$e = z.object({
409
- unit: z.string(),
410
- value: z.number().finite()
408
+ const schema$e = objectType({
409
+ unit: stringType(),
410
+ value: numberType().finite()
411
411
  });
412
412
  const stringSchema$d = "z.object({ unit: z.string(), value: z.number().finite() })";
413
413
  const amountCurrencyValidation = (value) => {
@@ -459,9 +459,9 @@ const AmountCurrency = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defi
459
459
  }, Symbol.toStringTag, { value: "Module" }));
460
460
  const type$d = "{ unit: string, value: number }";
461
461
  const typedef$c = "scalar Amount_Fiat";
462
- const schema$d = z.object({
463
- unit: z.string(),
464
- value: z.number().finite()
462
+ const schema$d = objectType({
463
+ unit: stringType(),
464
+ value: numberType().finite()
465
465
  });
466
466
  const stringSchema$c = "z.object({ unit: z.string(), value: z.number().finite() })";
467
467
  const amountFiatValidation = (value) => {
@@ -513,7 +513,7 @@ const AmountFiat = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
513
513
  }, Symbol.toStringTag, { value: "Module" }));
514
514
  const type$c = "number";
515
515
  const typedef$b = "scalar Amount_Money";
516
- const schema$c = z.number();
516
+ const schema$c = numberType();
517
517
  const stringSchema$b = "z.number()";
518
518
  const amountMoneyValidation = (value) => {
519
519
  if (typeof value !== "number") {
@@ -554,7 +554,7 @@ const AmountMoney = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
554
554
  }, Symbol.toStringTag, { value: "Module" }));
555
555
  const type$b = "number";
556
556
  const typedef$a = "scalar Amount_Percentage";
557
- const schema$b = z.number();
557
+ const schema$b = numberType();
558
558
  const stringSchema$a = "z.number()";
559
559
  const amountPercentageValidation = (value) => {
560
560
  if (typeof value !== "number") {
@@ -593,7 +593,7 @@ const AmountPercentage = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
593
593
  }, Symbol.toStringTag, { value: "Module" }));
594
594
  const type$a = "number";
595
595
  const typedef$9 = "scalar Amount_Tokens";
596
- const schema$a = z.number();
596
+ const schema$a = numberType();
597
597
  const stringSchema$9 = "z.number()";
598
598
  const amountTokensValidation = (value) => {
599
599
  if (typeof value !== "number") {
@@ -632,7 +632,7 @@ const AmountTokens = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.define
632
632
  }, Symbol.toStringTag, { value: "Module" }));
633
633
  const type$9 = "string";
634
634
  const typedef$8 = "scalar Currency";
635
- const schema$9 = z.string();
635
+ const schema$9 = stringType();
636
636
  const stringSchema$8 = "z.string()";
637
637
  const currencyValidation = (value) => {
638
638
  if (typeof value !== "string") {
@@ -669,7 +669,7 @@ const Currency = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProp
669
669
  }, Symbol.toStringTag, { value: "Module" }));
670
670
  const type$8 = "string";
671
671
  const typedef$7 = "scalar Date";
672
- const schema$8 = z.string().datetime();
672
+ const schema$8 = stringType().datetime();
673
673
  const stringSchema$7 = "z.string().datetime()";
674
674
  const datetimeValidation$1 = (value) => {
675
675
  if (typeof value !== "string") {
@@ -693,7 +693,7 @@ const config$8 = {
693
693
  }
694
694
  };
695
695
  const scalar$7 = new GraphQLScalarType(config$8);
696
- const Date$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
696
+ const DateScalar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
697
697
  __proto__: null,
698
698
  config: config$8,
699
699
  scalar: scalar$7,
@@ -704,7 +704,7 @@ const Date$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
704
704
  }, Symbol.toStringTag, { value: "Module" }));
705
705
  const type$7 = "string";
706
706
  const typedef$6 = "scalar DateTime";
707
- const schema$7 = z.string().datetime();
707
+ const schema$7 = stringType().datetime();
708
708
  const stringSchema$6 = "z.string().datetime()";
709
709
  const datetimeValidation = (value) => {
710
710
  if (typeof value !== "string") {
@@ -739,7 +739,7 @@ const DateTime = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProp
739
739
  }, Symbol.toStringTag, { value: "Module" }));
740
740
  const type$6 = "string";
741
741
  const typedef$5 = "scalar EmailAddress";
742
- const schema$6 = z.string().email();
742
+ const schema$6 = stringType().email();
743
743
  const stringSchema$5 = "z.string().email()";
744
744
  const emailValidation = (value) => {
745
745
  if (typeof value !== "string") {
@@ -774,7 +774,7 @@ const EmailAddress = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.define
774
774
  }, Symbol.toStringTag, { value: "Module" }));
775
775
  const type$5 = "string";
776
776
  const typedef$4 = "scalar EthereumAddress";
777
- const schema$5 = z.string().regex(/^0x[a-fA-F0-9]{40}$/, {
777
+ const schema$5 = stringType().regex(/^0x[a-fA-F0-9]{40}$/, {
778
778
  message: "Invalid Ethereum address format"
779
779
  });
780
780
  const stringSchema$4 = "z.string().regex(/^0x[a-fA-F0-9]{40}$/, { message: 'Invalid Ethereum address format' })";
@@ -811,7 +811,7 @@ const EthereumAddress = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.def
811
811
  }, Symbol.toStringTag, { value: "Module" }));
812
812
  const type$4 = "string";
813
813
  const typedef$3 = "scalar OID";
814
- const schema$4 = z.string();
814
+ const schema$4 = stringType();
815
815
  const stringSchema$3 = "z.string()";
816
816
  const oIdValidation = (value) => {
817
817
  if (typeof value !== "string") {
@@ -848,7 +848,7 @@ const OID = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty(
848
848
  }, Symbol.toStringTag, { value: "Module" }));
849
849
  const type$3 = "string";
850
850
  const typedef$2 = "scalar OLabel";
851
- const schema$3 = z.string();
851
+ const schema$3 = stringType();
852
852
  const stringSchema$2 = "z.string()";
853
853
  const oLabelValidation = (value) => {
854
854
  if (typeof value !== "string") {
@@ -885,7 +885,7 @@ const OLabel = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
885
885
  }, Symbol.toStringTag, { value: "Module" }));
886
886
  const type$2 = "string";
887
887
  const typedef$1 = "scalar PHID";
888
- const schema$2 = z.string();
888
+ const schema$2 = stringType();
889
889
  const stringSchema$1 = "z.string()";
890
890
  const phidlValidation = (value) => {
891
891
  if (typeof value !== "string") {
@@ -922,7 +922,7 @@ const PHID = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty
922
922
  }, Symbol.toStringTag, { value: "Module" }));
923
923
  const type$1 = "string";
924
924
  const typedef = "scalar URL";
925
- const schema$1 = z.string().url();
925
+ const schema$1 = stringType().url();
926
926
  const stringSchema = "z.string().url()";
927
927
  const urlValidation = (value) => {
928
928
  if (typeof value !== "string") {
@@ -946,7 +946,7 @@ const config$1 = {
946
946
  }
947
947
  };
948
948
  const scalar = new GraphQLScalarType(config$1);
949
- const URL$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
949
+ const URLScalar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
950
950
  __proto__: null,
951
951
  config: config$1,
952
952
  scalar,
@@ -955,24 +955,23 @@ const URL$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
955
955
  type: type$1,
956
956
  typedef
957
957
  }, Symbol.toStringTag, { value: "Module" }));
958
- const resolvers = {
959
- // export resolvers -- DO NOT REMOVE OR EDIT THIS COMMENT
960
- AmountTokens: scalar$9,
961
- EthereumAddress: scalar$4,
962
- AmountPercentage: scalar$a,
963
- EmailAddress: scalar$5,
964
- Date: scalar$7,
965
- DateTime: scalar$6,
966
- URL: scalar,
967
- AmountMoney: scalar$b,
968
- OLabel: scalar$2,
969
- Currency: scalar$8,
970
- PHID: scalar$1,
971
- OID: scalar$3,
972
- AmountFiat: scalar$c,
973
- AmountCurrency: scalar$d,
974
- AmountCrypto: scalar$e,
975
- Amount: scalar$f
958
+ const customScalars = {
959
+ Amount,
960
+ AmountCrypto,
961
+ AmountCurrency,
962
+ AmountFiat,
963
+ AmountMoney,
964
+ AmountPercentage,
965
+ AmountTokens,
966
+ Currency,
967
+ DateScalar,
968
+ DateTime,
969
+ EmailAddress,
970
+ EthereumAddress,
971
+ OID,
972
+ OLabel,
973
+ PHID,
974
+ URLScalar
976
975
  };
977
976
  const typeDefs = [
978
977
  // export typedefs -- DO NOT REMOVE OR EDIT THIS COMMENT
@@ -993,7 +992,7 @@ const typeDefs = [
993
992
  typedef$e,
994
993
  typedef$f
995
994
  ];
996
- const generatorTypeDefs = {
995
+ ({
997
996
  // export generator typedefs -- DO NOT REMOVE OR EDIT THIS COMMENT
998
997
  [config$a.name]: type$a,
999
998
  [config$5.name]: type$5,
@@ -1011,8 +1010,8 @@ const generatorTypeDefs = {
1011
1010
  [config$e.name]: type$e,
1012
1011
  [config$f.name]: type$f,
1013
1012
  [config$g.name]: type$g
1014
- };
1015
- const validationSchema = {
1013
+ });
1014
+ ({
1016
1015
  // export validation schema -- DO NOT REMOVE OR EDIT THIS COMMENT
1017
1016
  [config$a.name]: stringSchema$9,
1018
1017
  [config$5.name]: stringSchema$4,
@@ -1030,30 +1029,19 @@ const validationSchema = {
1030
1029
  [config$e.name]: stringSchema$d,
1031
1030
  [config$f.name]: stringSchema$e,
1032
1031
  [config$g.name]: stringSchema$f
1033
- };
1034
- const customScalars = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1035
- __proto__: null,
1036
- Amount,
1037
- AmountCrypto,
1038
- AmountCurrency,
1039
- AmountFiat,
1040
- AmountMoney,
1041
- AmountPercentage,
1042
- AmountTokens,
1043
- Currency,
1044
- DateScalar: Date$1,
1045
- DateTime,
1046
- EmailAddress,
1047
- EthereumAddress,
1048
- OID,
1049
- OLabel,
1050
- PHID,
1051
- URLScalar: URL$1,
1052
- generatorTypeDefs,
1053
- resolvers,
1054
- typeDefs,
1055
- validationSchema
1056
- }, Symbol.toStringTag, { value: "Module" }));
1032
+ });
1033
+ const SerializableSchema = lazyType(() => unionType([
1034
+ stringType(),
1035
+ numberType(),
1036
+ booleanType(),
1037
+ nullType(),
1038
+ arrayType(SerializableSchema),
1039
+ recordType(stringType(), SerializableSchema)
1040
+ ]));
1041
+ function getPHCustomScalarByTypeName(name2) {
1042
+ const scalar2 = Object.values(customScalars).find((scalar3) => scalar3.config.name === name2) ?? null;
1043
+ return scalar2;
1044
+ }
1057
1045
  function cn(...inputs) {
1058
1046
  return twMerge(clsx(inputs));
1059
1047
  }
@@ -1076,6 +1064,18 @@ function Divider({ className, size = "sm", margin = "md" }) {
1076
1064
  const marginClass = getMargin();
1077
1065
  return jsx("div", { className: cn("bg-gray-200", sizeClass, marginClass, className) });
1078
1066
  }
1067
+ const STRING_GQL_PRIMITIVE_NAME = "String";
1068
+ const BOOLEAN_GQL_PRIMITIVE_NAME = "Boolean";
1069
+ const INT_GQL_PRIMITIVE_NAME = "Int";
1070
+ const FLOAT_GQL_PRIMITIVE_NAME = "Float";
1071
+ const ID_GQL_PRIMITIVE_NAME = "ID";
1072
+ const gqlPrimitiveNodeNamesList = [
1073
+ STRING_GQL_PRIMITIVE_NAME,
1074
+ BOOLEAN_GQL_PRIMITIVE_NAME,
1075
+ INT_GQL_PRIMITIVE_NAME,
1076
+ FLOAT_GQL_PRIMITIVE_NAME,
1077
+ ID_GQL_PRIMITIVE_NAME
1078
+ ];
1079
1079
  const asArray$2 = (fns) => Array.isArray(fns) ? fns : fns ? [fns] : [];
1080
1080
  function createDefaultRules() {
1081
1081
  let ignored = ["NoUnusedFragmentsRule", "NoUnusedVariablesRule", "KnownDirectivesRule"];
@@ -1903,168 +1903,302 @@ function SchemaContextProvider(props) {
1903
1903
  function useSchemaContext() {
1904
1904
  return useContext(SchemaContext);
1905
1905
  }
1906
- function makeStateObject(modelName, scope) {
1907
- const name2 = makeStateObjectName(modelName, scope);
1908
- const inputNode = {
1909
- kind: Kind.OBJECT_TYPE_DEFINITION,
1910
- name: {
1911
- kind: Kind.NAME,
1912
- value: name2
1913
- },
1914
- fields: [
1915
- {
1916
- description: {
1917
- kind: Kind.STRING,
1918
- value: `Add your ${scope} state fields here`,
1919
- block: false
1920
- },
1921
- kind: Kind.FIELD_DEFINITION,
1922
- name: { kind: Kind.NAME, value: "_placeholder" },
1923
- type: {
1924
- kind: Kind.NAMED_TYPE,
1925
- name: { kind: Kind.NAME, value: "String" }
1926
- }
1927
- }
1928
- ]
1929
- };
1930
- return print(inputNode);
1931
- }
1932
- function makeEmptyInputObject(name2) {
1933
- const inputNode = {
1934
- kind: Kind.INPUT_OBJECT_TYPE_DEFINITION,
1935
- name: {
1936
- kind: Kind.NAME,
1937
- value: name2
1938
- },
1939
- fields: [
1940
- {
1941
- description: {
1942
- kind: Kind.STRING,
1943
- value: "Add your inputs here",
1944
- block: false
1945
- },
1946
- kind: Kind.INPUT_VALUE_DEFINITION,
1947
- name: { kind: Kind.NAME, value: "_placeholder" },
1948
- type: {
1949
- kind: Kind.NAMED_TYPE,
1950
- name: { kind: Kind.NAME, value: "String" }
1951
- }
1952
- }
1953
- ]
1954
- };
1955
- return print(inputNode);
1956
- }
1957
- function makeOperationInputName(operationName) {
1958
- return `${pascalCase(operationName)}Input`;
1906
+ function makeStateSchemaNameForScope(modelName, scope) {
1907
+ const modelNamePascalCase = pascalCase(modelName);
1908
+ const scopePascalCase = pascalCase(scope);
1909
+ const scopeStateTypeNamePrefix = scopePascalCase === "Global" ? "" : scopePascalCase;
1910
+ const name2 = `${scopeStateTypeNamePrefix}${modelNamePascalCase}State`;
1911
+ return name2;
1959
1912
  }
1960
- function makeStateObjectName(modelName, scope) {
1961
- return `${pascalCase(modelName)}${scope === "local" ? "Local" : ""}State`;
1913
+ function makeInitialSchemaDoc(modelName, scope) {
1914
+ const name2 = makeStateSchemaNameForScope(modelName, scope);
1915
+ const stateSchemaSdl = `type ${name2} {
1916
+ "Add your ${scope} state fields here"
1917
+ _placeholder: String
1918
+ }`;
1919
+ return stateSchemaSdl;
1962
1920
  }
1963
1921
  function makeOperationInitialDoc(name2) {
1964
- const inputName = makeOperationInputName(name2);
1965
- const inputObject = makeEmptyInputObject(inputName);
1966
- return inputObject;
1922
+ const inputSdl = `input ${pascalCase(name2)}Input {
1923
+ "Add your inputs here"
1924
+ _placeholder: String
1925
+ }`;
1926
+ return inputSdl;
1967
1927
  }
1968
- function makeInitialSchemaDoc(modelName, scope) {
1969
- const stateObject = makeStateObject(modelName, scope);
1970
- return stateObject;
1971
- }
1972
- function isValidScalarValue(typeName2, value) {
1973
- if (typeName2 in customScalars) {
1974
- const scalar2 = customScalars[typeName2];
1975
- if (scalar2 instanceof GraphQLScalarType) {
1976
- return scalar2.parseValue(value) !== void 0;
1977
- }
1978
- }
1979
- switch (typeName2) {
1980
- case "Int":
1981
- return Number.isInteger(value);
1982
- case "Float":
1983
- return typeof value === "number";
1984
- case "Boolean":
1985
- return typeof value === "boolean";
1986
- case "DateTime":
1987
- return typeof value === "string" && !isNaN(Date.parse(value));
1988
- case "ID":
1989
- case "String":
1990
- default:
1991
- return typeof value === "string";
1928
+ function safeParseJsonRecord(json2) {
1929
+ try {
1930
+ return JSON.parse(json2);
1931
+ } catch (error) {
1932
+ return null;
1992
1933
  }
1993
1934
  }
1994
- function getMinimalValue(type2, schema2, existingValue) {
1995
- const nullableType = getNullableType(type2);
1996
- if (isScalarType(nullableType)) {
1997
- const typeName2 = nullableType.name;
1998
- if (existingValue !== void 0 && isValidScalarValue(typeName2, existingValue)) {
1999
- return existingValue;
2000
- }
2001
- switch (typeName2) {
2002
- case "Int":
2003
- case "Float":
2004
- return 0;
2005
- case "Boolean":
2006
- return false;
2007
- case "DateTime":
2008
- return (/* @__PURE__ */ new Date()).toISOString();
2009
- case "ID":
2010
- case "String":
2011
- default:
2012
- return "";
2013
- }
1935
+ function makeMinimalObjectForStateType(args) {
1936
+ const { sharedSchemaDocumentNode, stateTypeDefinitionNode, existingValue } = args;
1937
+ const existingValueObject = safeParseJsonRecord(existingValue);
1938
+ if (!existingValueObject) {
1939
+ return existingValue;
2014
1940
  }
2015
- if (isEnumType(nullableType)) {
2016
- const enumValues = nullableType.getValues().map((v) => v.value);
2017
- if (existingValue !== void 0 && enumValues.includes(existingValue)) {
2018
- return existingValue;
2019
- }
2020
- return enumValues[0] || null;
1941
+ const stateTypeDefinitionFields = stateTypeDefinitionNode.fields;
1942
+ if (!(stateTypeDefinitionFields == null ? void 0 : stateTypeDefinitionFields.length)) {
1943
+ return existingValue;
2021
1944
  }
2022
- if (isListType(nullableType)) {
2023
- if (existingValue !== void 0 && Array.isArray(existingValue)) {
2024
- return existingValue;
1945
+ const minimalObject = makeMinimalValuesForObjectFields({
1946
+ schemaDocumentNode: sharedSchemaDocumentNode,
1947
+ fieldDefinitionNodes: stateTypeDefinitionFields,
1948
+ existingValueObject
1949
+ });
1950
+ return JSON.stringify(minimalObject, null, 2);
1951
+ }
1952
+ function makeMinimalValuesForObjectFields(args) {
1953
+ const { schemaDocumentNode, existingValueObject, fieldDefinitionNodes } = args;
1954
+ const newJson = {};
1955
+ for (const astNode of fieldDefinitionNodes) {
1956
+ const fieldName = getASTNodeName(astNode);
1957
+ if (!fieldName) {
1958
+ continue;
2025
1959
  }
2026
- return [];
1960
+ const minimalValue = makeMinimalValueForASTNode({
1961
+ fieldName,
1962
+ astNode,
1963
+ schemaDocumentNode,
1964
+ existingValueObject
1965
+ });
1966
+ newJson[astNode.name.value] = minimalValue;
2027
1967
  }
2028
- if (isObjectType(nullableType)) {
2029
- const result = {};
2030
- const fields = nullableType.getFields();
2031
- const _existingValue = existingValue;
2032
- for (const fieldName in fields) {
2033
- const field = fields[fieldName];
2034
- const existingFieldValue = _existingValue ? _existingValue[fieldName] : void 0;
2035
- result[fieldName] = getMinimalValue(field.type, schema2, existingFieldValue);
1968
+ return newJson;
1969
+ }
1970
+ function makeMinimalValueForASTNode(args) {
1971
+ const { fieldName, astNode, schemaDocumentNode, existingValueObject } = args;
1972
+ const existingFieldValue = existingValueObject == null ? void 0 : existingValueObject[fieldName];
1973
+ let node = astNode;
1974
+ if (isFieldDefinitionNode(astNode)) {
1975
+ node = getASTNodeTypeNode(node);
1976
+ }
1977
+ const isNonNull = isNonNullNode(node);
1978
+ if (isNonNull) {
1979
+ node = getASTNodeTypeNode(node);
1980
+ }
1981
+ if (isListTypeNode(node)) {
1982
+ return makeMinimalValueForGqlListNode(node, existingFieldValue, isNonNull);
1983
+ }
1984
+ if (isGqlPrimitiveNode(node)) {
1985
+ return makeMinimalValueForGQLPrimitiveNode(node, existingFieldValue, isNonNull);
1986
+ }
1987
+ const namedTypeDefinitionNode = getNamedTypeDefinitionNode(node, schemaDocumentNode);
1988
+ if (isEnumTypeDefinitionNode(namedTypeDefinitionNode)) {
1989
+ return makeMinimalValueForGqlEnum(namedTypeDefinitionNode, existingFieldValue, isNonNull);
1990
+ }
1991
+ if (isScalarTypeDefinitionNode(namedTypeDefinitionNode)) {
1992
+ return makeMinimalValueForGqlScalar(namedTypeDefinitionNode, existingFieldValue, isNonNull);
1993
+ }
1994
+ if (isUnionTypeDefinitionNode(namedTypeDefinitionNode)) {
1995
+ return makeMinimalValueForGqlUnion(namedTypeDefinitionNode, existingFieldValue, schemaDocumentNode, existingValueObject, isNonNull);
1996
+ }
1997
+ if (isObjectTypeDefinitionNode(namedTypeDefinitionNode)) {
1998
+ return makeMinimalValueForGqlObject(namedTypeDefinitionNode, schemaDocumentNode, existingValueObject, existingFieldValue, isNonNull);
1999
+ }
2000
+ return existingFieldValue;
2001
+ }
2002
+ function isFieldDefinitionNode(astNodeTypeNode) {
2003
+ if (!astNodeTypeNode)
2004
+ return false;
2005
+ return astNodeTypeNode.kind === Kind.FIELD_DEFINITION;
2006
+ }
2007
+ function isNonNullNode(astNode) {
2008
+ if (!astNode)
2009
+ return false;
2010
+ return astNode.kind === Kind.NON_NULL_TYPE;
2011
+ }
2012
+ function isGqlPrimitiveNode(astNodeTypeNode) {
2013
+ if (!astNodeTypeNode)
2014
+ return false;
2015
+ const name2 = getASTNodeName(astNodeTypeNode);
2016
+ return gqlPrimitiveNodeNamesList.includes(name2);
2017
+ }
2018
+ function isListTypeNode(astNodeTypeNode) {
2019
+ if (!astNodeTypeNode)
2020
+ return false;
2021
+ return astNodeTypeNode.kind === Kind.LIST_TYPE;
2022
+ }
2023
+ function isEnumTypeDefinitionNode(definitionNode) {
2024
+ if (!definitionNode)
2025
+ return false;
2026
+ return definitionNode.kind === Kind.ENUM_TYPE_DEFINITION;
2027
+ }
2028
+ function isScalarTypeDefinitionNode(definitionNode) {
2029
+ if (!definitionNode)
2030
+ return false;
2031
+ return definitionNode.kind === Kind.SCALAR_TYPE_DEFINITION;
2032
+ }
2033
+ function isUnionTypeDefinitionNode(definitionNode) {
2034
+ if (!definitionNode)
2035
+ return false;
2036
+ return definitionNode.kind === Kind.UNION_TYPE_DEFINITION;
2037
+ }
2038
+ function isObjectTypeDefinitionNode(definitionNode) {
2039
+ if (!definitionNode)
2040
+ return false;
2041
+ return definitionNode.kind === Kind.OBJECT_TYPE_DEFINITION;
2042
+ }
2043
+ function getASTNodeName(astNode) {
2044
+ if (!astNode) {
2045
+ return null;
2046
+ }
2047
+ if (!("name" in astNode)) {
2048
+ return null;
2049
+ }
2050
+ if (!astNode.name) {
2051
+ return null;
2052
+ }
2053
+ if (!("value" in astNode.name)) {
2054
+ return null;
2055
+ }
2056
+ return astNode.name.value;
2057
+ }
2058
+ function getASTNodeTypeNode(astNode) {
2059
+ if (!astNode) {
2060
+ return null;
2061
+ }
2062
+ if (!("type" in astNode)) {
2063
+ return null;
2064
+ }
2065
+ return astNode.type;
2066
+ }
2067
+ function makeMinimalValueForGQLPrimitiveNode(primitiveTypeNode, existingFieldValue, isNonNull) {
2068
+ const name2 = getASTNodeName(primitiveTypeNode);
2069
+ if (!name2) {
2070
+ return null;
2071
+ }
2072
+ switch (name2) {
2073
+ case ID_GQL_PRIMITIVE_NAME: {
2074
+ if (stringType().safeParse(existingFieldValue).success) {
2075
+ return existingFieldValue;
2076
+ }
2077
+ return isNonNull ? "placeholder-id" : null;
2078
+ }
2079
+ case BOOLEAN_GQL_PRIMITIVE_NAME: {
2080
+ if (booleanType().safeParse(existingFieldValue).success) {
2081
+ return existingFieldValue;
2082
+ }
2083
+ return isNonNull ? false : null;
2084
+ }
2085
+ case INT_GQL_PRIMITIVE_NAME: {
2086
+ if (numberType().safeParse(existingFieldValue).success) {
2087
+ return existingFieldValue;
2088
+ }
2089
+ return isNonNull ? 0 : null;
2090
+ }
2091
+ case FLOAT_GQL_PRIMITIVE_NAME: {
2092
+ if (numberType().safeParse(existingFieldValue).success) {
2093
+ return existingFieldValue;
2094
+ }
2095
+ return isNonNull ? 0 : null;
2096
+ }
2097
+ case STRING_GQL_PRIMITIVE_NAME: {
2098
+ if (stringType().safeParse(existingFieldValue).success) {
2099
+ return existingFieldValue;
2100
+ }
2101
+ return isNonNull ? "" : null;
2036
2102
  }
2037
- return result;
2103
+ }
2104
+ return isNonNull ? existingFieldValue : null;
2105
+ }
2106
+ function makeMinimalValueForGqlEnum(namedTypeDefinitionNode, existingFieldValue, isNonNull) {
2107
+ var _a3;
2108
+ const enumValues = ((_a3 = namedTypeDefinitionNode.values) == null ? void 0 : _a3.map((value) => value.name.value)) ?? [];
2109
+ if (typeof existingFieldValue === "string" && enumValues.includes(existingFieldValue)) {
2110
+ return existingFieldValue;
2111
+ }
2112
+ if (isNonNull) {
2113
+ return enumValues[0];
2038
2114
  }
2039
2115
  return null;
2040
2116
  }
2041
- function makeMinimalObjectFromSDL(schemaSdl, sdl, existingValue) {
2042
- const parsedSchema = safeParseSdl(schemaSdl);
2043
- const typeAST = safeParseSdl(sdl);
2044
- if (!parsedSchema || !typeAST)
2045
- return "";
2046
- const schema2 = buildASTSchema(parsedSchema);
2047
- const typeNames = [];
2048
- typeAST.definitions.forEach((def) => {
2049
- if (def.kind === Kind.OBJECT_TYPE_DEFINITION || def.kind === Kind.OBJECT_TYPE_EXTENSION) {
2050
- typeNames.push(def.name.value);
2051
- }
2117
+ function makeMinimalValueForGqlScalar(scalarTypeDefinitionNode, existingFieldValue, isNonNull) {
2118
+ var _a3;
2119
+ if (!isNonNull && !existingFieldValue) {
2120
+ return null;
2121
+ }
2122
+ const name2 = getASTNodeName(scalarTypeDefinitionNode);
2123
+ if (!name2) {
2124
+ console.error("No name for scalar type definition node", scalarTypeDefinitionNode);
2125
+ return null;
2126
+ }
2127
+ const scalar2 = getPHCustomScalarByTypeName(name2);
2128
+ if (!scalar2) {
2129
+ return null;
2130
+ }
2131
+ const existingValueIsValid = scalar2.schema.safeParse(existingFieldValue);
2132
+ if (existingValueIsValid.success) {
2133
+ return existingFieldValue;
2134
+ }
2135
+ if (!isNonNull) {
2136
+ return null;
2137
+ }
2138
+ const minimalValue = (_a3 = scalar2.getDefaultValue) == null ? void 0 : _a3.call(scalar2);
2139
+ if (minimalValue) {
2140
+ return minimalValue;
2141
+ }
2142
+ return existingFieldValue;
2143
+ }
2144
+ function makeMinimalValueForGqlUnion(namedTypeDefinitionNode, existingFieldValue, schemaDocumentNode, existingValueObject, isNonNull) {
2145
+ var _a3;
2146
+ if (!isNonNull && !existingFieldValue) {
2147
+ return null;
2148
+ }
2149
+ const types2 = namedTypeDefinitionNode.types;
2150
+ if (!(types2 == null ? void 0 : types2.length)) {
2151
+ return null;
2152
+ }
2153
+ const firstNamedTypeDefinitionNode = (_a3 = namedTypeDefinitionNode.types) == null ? void 0 : _a3.at(0);
2154
+ if (!firstNamedTypeDefinitionNode) {
2155
+ return null;
2156
+ }
2157
+ const firstNamedTypeObjectDefinitionNode = getNamedTypeDefinitionNode(firstNamedTypeDefinitionNode, schemaDocumentNode);
2158
+ if (!isObjectTypeDefinitionNode(firstNamedTypeObjectDefinitionNode)) {
2159
+ return null;
2160
+ }
2161
+ return makeMinimalValueForGqlObject(firstNamedTypeObjectDefinitionNode, schemaDocumentNode, existingValueObject, existingFieldValue, isNonNull);
2162
+ }
2163
+ function makeMinimalValueForGqlListNode(listTypeNode, existingFieldValue, isNonNull) {
2164
+ if (!isNonNull && !Array.isArray(existingFieldValue)) {
2165
+ return null;
2166
+ }
2167
+ if (isNonNull && !Array.isArray(existingFieldValue)) {
2168
+ return [];
2169
+ }
2170
+ return existingFieldValue;
2171
+ }
2172
+ function makeMinimalValueForGqlObject(objectTypeDefinitionNode, schemaDocumentNode, existingValueObject, existingFieldValue, isNonNull) {
2173
+ if (!isNonNull && !existingFieldValue) {
2174
+ return null;
2175
+ }
2176
+ const fields = objectTypeDefinitionNode.fields;
2177
+ if (!(fields == null ? void 0 : fields.length)) {
2178
+ return {};
2179
+ }
2180
+ return makeMinimalValuesForObjectFields({
2181
+ schemaDocumentNode,
2182
+ existingValueObject,
2183
+ fieldDefinitionNodes: fields
2052
2184
  });
2053
- if (typeNames.length === 0) {
2054
- throw new Error("No object type definition found in SDL.");
2185
+ }
2186
+ function getNamedTypeDefinitionNode(astNodeTypeNode, schemaDocumentNode) {
2187
+ if (!astNodeTypeNode) {
2188
+ return null;
2055
2189
  }
2056
- const typeName2 = typeNames[0];
2057
- let type2 = schema2.getType(typeName2);
2058
- let effectiveSchema = schema2;
2059
- if (!type2 || !isObjectType(type2)) {
2060
- effectiveSchema = extendSchema(schema2, typeAST);
2061
- type2 = effectiveSchema.getType(typeName2);
2190
+ const name2 = getASTNodeName(astNodeTypeNode);
2191
+ if (!name2) {
2192
+ return null;
2062
2193
  }
2063
- if (!type2 || !isObjectType(type2)) {
2064
- throw new Error(`Type "${typeName2}" is not a valid ObjectType.`);
2194
+ const definitionNode = schemaDocumentNode.definitions.find((def) => {
2195
+ var _a3;
2196
+ return "kind" in def && "name" in def && ((_a3 = def.name) == null ? void 0 : _a3.value) === name2;
2197
+ });
2198
+ if (!definitionNode) {
2199
+ return null;
2065
2200
  }
2066
- const minimalObject = getMinimalValue(type2, effectiveSchema, existingValue);
2067
- return JSON.stringify(minimalObject, null, 2);
2201
+ return definitionNode;
2068
2202
  }
2069
2203
  function removeWhitespace(str) {
2070
2204
  return str.replace(/\s+|\\n|\\t/g, "").toLowerCase();
@@ -2080,7 +2214,7 @@ function renameSchemaType(sdl, oldName, newName, scope) {
2080
2214
  const newTypeName = `${pascalCase(newName)}${typeSuffix}`;
2081
2215
  const ast2 = safeParseSdl(sdl);
2082
2216
  if (!ast2)
2083
- return "";
2217
+ return sdl;
2084
2218
  const updatedAst = visit(ast2, {
2085
2219
  ObjectTypeDefinition: (node) => {
2086
2220
  if (node.name.value === oldTypeName) {
@@ -2119,69 +2253,76 @@ function handleModelNameChange(params) {
2119
2253
  }
2120
2254
  updateModelSchemaNames(params);
2121
2255
  }
2122
- const s = (e, s2, o2) => {
2123
- if (e && "reportValidity" in e) {
2124
- const r2 = get(o2, s2);
2125
- e.setCustomValidity(r2 && r2.message || ""), e.reportValidity();
2126
- }
2127
- }, o = (t2, e) => {
2128
- for (const o2 in e.fields) {
2129
- const r2 = e.fields[o2];
2130
- r2 && r2.ref && "reportValidity" in r2.ref ? s(r2.ref, o2, t2) : r2.refs && r2.refs.forEach((e2) => s(e2, o2, t2));
2131
- }
2132
- }, r = (s2, r2) => {
2133
- r2.shouldUseNativeValidation && o(s2, r2);
2134
- const f = {};
2135
- for (const o2 in s2) {
2136
- const n2 = get(r2.fields, o2), a = Object.assign(s2[o2] || {}, { ref: n2 && n2.ref });
2137
- if (i$1(r2.names || Object.keys(s2), o2)) {
2138
- const s3 = Object.assign({}, get(f, o2));
2139
- set(s3, "root", a), set(f, o2, s3);
2140
- } else set(f, o2, a);
2141
- }
2142
- return f;
2143
- }, i$1 = (t2, e) => t2.some((t3) => t3.startsWith(e + "."));
2144
- var n = function(r2, e) {
2256
+ const r = (t2, r2, o2) => {
2257
+ if (t2 && "reportValidity" in t2) {
2258
+ const s2 = get(o2, r2);
2259
+ t2.setCustomValidity(s2 && s2.message || ""), t2.reportValidity();
2260
+ }
2261
+ }, o = (e, t2) => {
2262
+ for (const o2 in t2.fields) {
2263
+ const s2 = t2.fields[o2];
2264
+ s2 && s2.ref && "reportValidity" in s2.ref ? r(s2.ref, o2, e) : s2 && s2.refs && s2.refs.forEach((t3) => r(t3, o2, e));
2265
+ }
2266
+ }, s$1 = (r2, s2) => {
2267
+ s2.shouldUseNativeValidation && o(r2, s2);
2268
+ const n2 = {};
2269
+ for (const o2 in r2) {
2270
+ const f = get(s2.fields, o2), c = Object.assign(r2[o2] || {}, { ref: f && f.ref });
2271
+ if (i$1(s2.names || Object.keys(r2), o2)) {
2272
+ const r3 = Object.assign({}, get(n2, o2));
2273
+ set(r3, "root", c), set(n2, o2, r3);
2274
+ } else set(n2, o2, c);
2275
+ }
2276
+ return n2;
2277
+ }, i$1 = (e, t2) => {
2278
+ const r2 = n$1(t2);
2279
+ return e.some((e2) => n$1(e2).match(`^${r2}\\.\\d+`));
2280
+ };
2281
+ function n$1(e) {
2282
+ return e.replace(/\]|\[/g, "");
2283
+ }
2284
+ function n(r2, e) {
2145
2285
  for (var n2 = {}; r2.length; ) {
2146
- var t2 = r2[0], s2 = t2.code, i = t2.message, a = t2.path.join(".");
2147
- if (!n2[a]) if ("unionErrors" in t2) {
2148
- var u = t2.unionErrors[0].errors[0];
2286
+ var s2 = r2[0], t2 = s2.code, i = s2.message, a = s2.path.join(".");
2287
+ if (!n2[a]) if ("unionErrors" in s2) {
2288
+ var u = s2.unionErrors[0].errors[0];
2149
2289
  n2[a] = { message: u.message, type: u.code };
2150
- } else n2[a] = { message: i, type: s2 };
2151
- if ("unionErrors" in t2 && t2.unionErrors.forEach(function(e2) {
2290
+ } else n2[a] = { message: i, type: t2 };
2291
+ if ("unionErrors" in s2 && s2.unionErrors.forEach(function(e2) {
2152
2292
  return e2.errors.forEach(function(e3) {
2153
2293
  return r2.push(e3);
2154
2294
  });
2155
2295
  }), e) {
2156
- var c = n2[a].types, f = c && c[t2.code];
2157
- n2[a] = appendErrors(a, e, n2, s2, f ? [].concat(f, t2.message) : t2.message);
2296
+ var c = n2[a].types, f = c && c[s2.code];
2297
+ n2[a] = appendErrors(a, e, n2, t2, f ? [].concat(f, s2.message) : s2.message);
2158
2298
  }
2159
2299
  r2.shift();
2160
2300
  }
2161
2301
  return n2;
2162
- }, t$2 = function(o$1, t2, s2) {
2163
- return void 0 === s2 && (s2 = {}), function(i, a, u) {
2302
+ }
2303
+ function s(o$1, s2, t2) {
2304
+ return void 0 === t2 && (t2 = {}), function(i, a, u) {
2164
2305
  try {
2165
2306
  return Promise.resolve(function(e, n2) {
2166
2307
  try {
2167
- var a2 = Promise.resolve(o$1["sync" === s2.mode ? "parse" : "parseAsync"](i, t2)).then(function(e2) {
2168
- return u.shouldUseNativeValidation && o({}, u), { errors: {}, values: s2.raw ? i : e2 };
2308
+ var a2 = Promise.resolve(o$1["sync" === t2.mode ? "parse" : "parseAsync"](i, s2)).then(function(e2) {
2309
+ return u.shouldUseNativeValidation && o({}, u), { errors: {}, values: t2.raw ? Object.assign({}, i) : e2 };
2169
2310
  });
2170
2311
  } catch (r2) {
2171
2312
  return n2(r2);
2172
2313
  }
2173
2314
  return a2 && a2.then ? a2.then(void 0, n2) : a2;
2174
- }(0, function(r$1) {
2175
- if (function(r2) {
2176
- return Array.isArray(null == r2 ? void 0 : r2.errors);
2177
- }(r$1)) return { values: {}, errors: r(n(r$1.errors, !u.shouldUseNativeValidation && "all" === u.criteriaMode), u) };
2178
- throw r$1;
2315
+ }(0, function(r2) {
2316
+ if (function(r3) {
2317
+ return Array.isArray(null == r3 ? void 0 : r3.errors);
2318
+ }(r2)) return { values: {}, errors: s$1(n(r2.errors, !u.shouldUseNativeValidation && "all" === u.criteriaMode), u) };
2319
+ throw r2;
2179
2320
  }));
2180
2321
  } catch (r2) {
2181
2322
  return Promise.reject(r2);
2182
2323
  }
2183
2324
  };
2184
- };
2325
+ }
2185
2326
  var validator$1 = { exports: {} };
2186
2327
  var toDate = { exports: {} };
2187
2328
  var assertString = { exports: {} };
@@ -9007,20 +9148,20 @@ var validatorExports = /* @__PURE__ */ requireValidator();
9007
9148
  const validator = /* @__PURE__ */ getDefaultExportFromCjs(validatorExports);
9008
9149
  function createNameSchema(options = {}) {
9009
9150
  const { required = false, allowEmpty = false, unique = [] } = options;
9010
- const baseSchema = allowEmpty ? z.string() : z.string().min(1);
9151
+ const baseSchema = allowEmpty ? stringType() : stringType().min(1);
9011
9152
  const uniqueRefinement = baseSchema.refine((value) => {
9012
9153
  if (!value && allowEmpty)
9013
9154
  return true;
9014
9155
  return !unique.map((n2) => n2.toLowerCase()).includes(value.replace(/^\s+|\s+$/g, "_").toLowerCase());
9015
9156
  }, { message: "Item with this name already exists" });
9016
9157
  if (!required) {
9017
- return unique.length > 0 ? z.string().optional().refine((value) => {
9158
+ return unique.length > 0 ? stringType().optional().refine((value) => {
9018
9159
  if (value === void 0)
9019
9160
  return true;
9020
9161
  if (!value && allowEmpty)
9021
9162
  return true;
9022
9163
  return !unique.map((n2) => n2.toLowerCase()).includes(value.replace(/^\s+|\s+$/g, "_").toLowerCase());
9023
- }, { message: "Item with this name already exists" }) : z.string().optional();
9164
+ }, { message: "Item with this name already exists" }) : stringType().optional();
9024
9165
  }
9025
9166
  return unique.length > 0 ? uniqueRefinement : baseSchema;
9026
9167
  }
@@ -9040,9 +9181,9 @@ function toLowercaseSnakeCase(value, options = {}) {
9040
9181
  function toConstantCase(value, options = {}) {
9041
9182
  return createConstantCaseSchema(options).parse(constantCase(value));
9042
9183
  }
9043
- z.object({
9184
+ objectType({
9044
9185
  name: createNameSchema({ allowEmpty: true }),
9045
- website: z.union([z.string().url(), z.literal("")]).optional().default("")
9186
+ website: unionType([stringType().url(), literalType("")]).optional().default("")
9046
9187
  }).default({
9047
9188
  name: "",
9048
9189
  website: ""
@@ -9155,11 +9296,11 @@ const TextField = forwardRef(({ name: name2, value, onSubmit, label, placeholder
9155
9296
  textareaRef.current.focus();
9156
9297
  }
9157
9298
  }, [focusOnMount]);
9158
- const fieldSchema = z.object({
9299
+ const fieldSchema = objectType({
9159
9300
  [name2]: createNameSchema({ required, allowEmpty, unique })
9160
9301
  });
9161
9302
  const form = useForm({
9162
- resolver: t$2(fieldSchema),
9303
+ resolver: s(fieldSchema),
9163
9304
  defaultValues: {
9164
9305
  [name2]: value ?? ""
9165
9306
  }
@@ -9218,13 +9359,13 @@ const TextField = forwardRef(({ name: name2, value, onSubmit, label, placeholder
9218
9359
  }, onKeyDown: onEnterKeyDown, rows, className }) }), jsx(FormMessage, {})] }) }) });
9219
9360
  });
9220
9361
  TextField.displayName = "TextField";
9221
- z.object({
9222
- name: z.string(),
9223
- documentType: z.string(),
9224
- extension: z.string(),
9225
- description: z.string(),
9226
- authorName: z.string(),
9227
- authorWebsite: z.string()
9362
+ objectType({
9363
+ name: stringType(),
9364
+ documentType: stringType(),
9365
+ extension: stringType(),
9366
+ description: stringType(),
9367
+ authorName: stringType(),
9368
+ authorWebsite: stringType()
9228
9369
  });
9229
9370
  function ModelMetadata(props) {
9230
9371
  return jsxs("div", { children: [jsx(ModelNameForm, { ...props }), jsx("div", { className: "flex h-full flex-col gap-4", children: jsxs("div", { className: "grid flex-1 grid-cols-3 items-start gap-4", children: [jsxs("div", { className: "col-span-2 flex h-full flex-col gap-4", children: [jsx("div", { className: "shrink-0", children: jsx(DocumentTypeForm, { ...props }) }), jsx("div", { className: "min-h-0 flex-1", children: jsx(DescriptionForm, { ...props }) })] }), jsxs("div", { className: "col-span-1 flex flex-col gap-4", children: [jsx(AuthorNameForm, { ...props }), jsx(AuthorWebsiteForm, { ...props }), jsx(ModelExtensionForm, { ...props })] })] }) })] });
@@ -15202,8 +15343,7 @@ function logException(state, exception, context) {
15202
15343
  let handler = state.facet(exceptionSink);
15203
15344
  if (handler.length)
15204
15345
  handler[0](exception);
15205
- else if (window.onerror)
15206
- window.onerror(String(exception), context, void 0, void 0, exception);
15346
+ else if (window.onerror && window.onerror(String(exception), context, void 0, void 0, exception)) ;
15207
15347
  else if (context)
15208
15348
  console.error(context + ":", exception);
15209
15349
  else
@@ -21375,7 +21515,7 @@ class MatchDecorator {
21375
21515
  updateRange(view, deco, updateFrom, updateTo) {
21376
21516
  for (let r2 of view.visibleRanges) {
21377
21517
  let from = Math.max(r2.from, updateFrom), to = Math.min(r2.to, updateTo);
21378
- if (to > from) {
21518
+ if (to >= from) {
21379
21519
  let fromLine = view.state.doc.lineAt(from), toLine = fromLine.to < to ? view.state.doc.lineAt(to) : fromLine;
21380
21520
  let start = Math.max(r2.from, fromLine.from), end = Math.min(r2.to, toLine.to);
21381
21521
  if (this.boundary) {
@@ -25755,8 +25895,8 @@ function getTypeInfo(schema2, tokenState) {
25755
25895
  inputType = nullableType instanceof GraphQLList ? nullableType.ofType : null;
25756
25896
  break;
25757
25897
  case RuleKinds.OBJECT_VALUE:
25758
- const objectType = getNamedType(inputType);
25759
- objectFieldDefs = objectType instanceof GraphQLInputObjectType ? objectType.getFields() : null;
25898
+ const objectType2 = getNamedType(inputType);
25899
+ objectFieldDefs = objectType2 instanceof GraphQLInputObjectType ? objectType2.getFields() : null;
25760
25900
  break;
25761
25901
  case RuleKinds.OBJECT_FIELD:
25762
25902
  const objectField = state.name && objectFieldDefs ? objectFieldDefs[state.name] : null;
@@ -36786,14 +36926,14 @@ const replaceNext = /* @__PURE__ */ searchCommand((view, { query }) => {
36786
36926
  next = query.nextMatch(state, next.from, next.to);
36787
36927
  effects.push(EditorView.announce.of(state.phrase("replaced match on line $", state.doc.lineAt(from).number) + "."));
36788
36928
  }
36929
+ let changeSet = view.state.changes(changes);
36789
36930
  if (next) {
36790
- let off = changes.length == 0 || changes[0].from >= match.to ? 0 : match.to - match.from - replacement.length;
36791
- selection = EditorSelection.single(next.from - off, next.to - off);
36931
+ selection = EditorSelection.single(next.from, next.to).map(changeSet);
36792
36932
  effects.push(announceMatch(view, next));
36793
36933
  effects.push(state.facet(searchConfigFacet).scrollToMatch(selection.main, view));
36794
36934
  }
36795
36935
  view.dispatch({
36796
- changes,
36936
+ changes: changeSet,
36797
36937
  selection,
36798
36938
  effects,
36799
36939
  userEvent: "input.replace"
@@ -41854,11 +41994,11 @@ function requireTypeInfo() {
41854
41994
  break;
41855
41995
  }
41856
41996
  case _kinds.Kind.OBJECT_FIELD: {
41857
- const objectType = (0, _definition.getNamedType)(this.getInputType());
41997
+ const objectType2 = (0, _definition.getNamedType)(this.getInputType());
41858
41998
  let inputFieldType;
41859
41999
  let inputField;
41860
- if ((0, _definition.isInputObjectType)(objectType)) {
41861
- inputField = objectType.getFields()[node.name.value];
42000
+ if ((0, _definition.isInputObjectType)(objectType2)) {
42001
+ inputField = objectType2.getFields()[node.name.value];
41862
42002
  if (inputField) {
41863
42003
  inputFieldType = inputField.type;
41864
42004
  }
@@ -46052,21 +46192,17 @@ const GraphqlEditor = memo(function GraphqlEditor2(props) {
46052
46192
  const view = viewRef.current;
46053
46193
  if (!view)
46054
46194
  return;
46055
- const existingSchema = getSchema(view.state);
46056
- const existingSchemaString = existingSchema ? printSchema(existingSchema) : null;
46057
- if (!existingSchema || existingSchemaString !== sharedSchema) {
46058
- try {
46059
- const newSchema = buildSchema(sharedSchema);
46060
- view.dispatch({
46061
- effects: [
46062
- graphqlCompartment.current.reconfigure(graphql(newSchema)),
46063
- linterCompartment.current.reconfigure(makeLinter(newSchema, customLinter))
46064
- ]
46065
- });
46066
- forceLinting(view);
46067
- } catch (error) {
46068
- console.debug("in schema update", error);
46069
- }
46195
+ try {
46196
+ const newSchema = buildSchema(sharedSchema);
46197
+ view.dispatch({
46198
+ effects: [
46199
+ graphqlCompartment.current.reconfigure(graphql(newSchema)),
46200
+ linterCompartment.current.reconfigure(makeLinter(newSchema, customLinter))
46201
+ ]
46202
+ });
46203
+ forceLinting(view);
46204
+ } catch (error) {
46205
+ console.debug("in schema update", error);
46070
46206
  }
46071
46207
  }, [sharedSchema, customLinter]);
46072
46208
  useHandlerReconfiguration(viewRef.current, readonly, timeoutRef, updateDocumentInModel, {
@@ -46158,7 +46294,10 @@ function createNodeTypeAndNameDiagnostic(doc2, errorMessage) {
46158
46294
  function ensureValidStateSchemaName(doc2, modelName, scope) {
46159
46295
  if (!safeParseSdl(doc2))
46160
46296
  return [];
46161
- const requiredTypeName = `${pascalCase(modelName)}${scope === "local" ? "Local" : ""}State`;
46297
+ const scopePascalCase = pascalCase(scope);
46298
+ const modelNamePascalCase = pascalCase(modelName);
46299
+ const scopeStateTypeNamePrefix = scopePascalCase === "Global" ? "" : scopePascalCase;
46300
+ const requiredTypeName = `${scopeStateTypeNamePrefix}${modelNamePascalCase}State`;
46162
46301
  if (!ensureDocumentContainsNodeWithNameAndType(doc2, requiredTypeName, "OBJECT_TYPE_DEFINITION")) {
46163
46302
  return [
46164
46303
  createNodeTypeAndNameDiagnostic(doc2, `${sentenceCase(scope)} state schema must be named ${requiredTypeName}`)
@@ -46226,13 +46365,6 @@ const Button = forwardRef((props, ref) => {
46226
46365
  const { className, ...rest } = props;
46227
46366
  return jsx("button", { ref, ...rest, className: cn("h-10 whitespace-nowrap rounded-md border border-gray-200 bg-gray-50 px-4 py-2 text-sm font-medium text-gray-800 transition-colors hover:bg-gray-100 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", className) });
46228
46367
  });
46229
- const Tabs = Root2;
46230
- const TabsList = React.forwardRef(({ className, ...props }, ref) => jsx(List, { ref, className: cn("flex items-center justify-center rounded-xl bg-slate-50 p-1 shadow-[inset_0px_0px_2px_rgba(255,255,255,0.50)]", className), ...props }));
46231
- TabsList.displayName = List.displayName;
46232
- const TabsTrigger = React.forwardRef(({ className, ...props }, ref) => jsx(Trigger, { ref, className: cn("flex w-full items-center justify-center whitespace-nowrap rounded-lg p-1 text-sm text-gray-500 transition-all disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-gray-50 data-[state=active]:text-gray-800 data-[state=active]:shadow-[0px_16px_16px_-4px_rgba(0,0,0,0.10)]", className), ...props }));
46233
- TabsTrigger.displayName = Trigger.displayName;
46234
- const TabsContent = React.forwardRef(({ className, ...props }, ref) => jsx(Content, { ref, className: cn("", className), ...props }));
46235
- TabsContent.displayName = Content.displayName;
46236
46368
  const jsonHighlighting = styleTags({
46237
46369
  String: tags.string,
46238
46370
  Number: tags.number,
@@ -46343,6 +46475,13 @@ const JSONEditor = memo(function JSONEditor2(props) {
46343
46475
  useDocumentSync(viewRef.current, doc2);
46344
46476
  return jsx("div", { ref: editorRef });
46345
46477
  });
46478
+ const Tabs = Root2;
46479
+ const TabsList = React.forwardRef(({ className, ...props }, ref) => jsx(List, { ref, className: cn("flex items-center justify-center rounded-xl bg-slate-50 p-1 shadow-[inset_0px_0px_2px_rgba(255,255,255,0.50)]", className), ...props }));
46480
+ TabsList.displayName = List.displayName;
46481
+ const TabsTrigger = React.forwardRef(({ className, ...props }, ref) => jsx(Trigger, { ref, className: cn("flex w-full items-center justify-center whitespace-nowrap rounded-lg p-1 text-sm text-gray-500 transition-all disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-gray-50 data-[state=active]:text-gray-800 data-[state=active]:shadow-[0px_16px_16px_-4px_rgba(0,0,0,0.10)]", className), ...props }));
46482
+ TabsTrigger.displayName = Trigger.displayName;
46483
+ const TabsContent = React.forwardRef(({ className, ...props }, ref) => jsx(Content, { ref, className: cn("", className), ...props }));
46484
+ TabsContent.displayName = Content.displayName;
46346
46485
  function StateEditor({ modelName, stateSchema, initialValue, setStateSchema: setStateSchema2, setInitialState: setInitialState2, scope }) {
46347
46486
  const sharedSchemaSdl = useSchemaContext();
46348
46487
  const [showStandardLib, setShowStandardLib] = useState(false);
@@ -46353,9 +46492,26 @@ function StateEditor({ modelName, stateSchema, initialValue, setStateSchema: set
46353
46492
  const handleSchemaUpdate = useCallback((newDoc) => setStateSchema2(newDoc, scope), [setStateSchema2, scope]);
46354
46493
  const handleInitialStateUpdate = useCallback((newDoc) => setInitialState2(newDoc, scope), [setInitialState2, scope]);
46355
46494
  const handleSyncWithSchema = useCallback(() => {
46356
- const updatedStateDoc = makeMinimalObjectFromSDL(sharedSchemaSdl, stateSchema, initialValue ? JSON.parse(initialValue) : {});
46495
+ const existingValue = initialValue || "{}";
46496
+ const sharedSchemaDocumentNode = safeParseSdl(sharedSchemaSdl);
46497
+ if (!sharedSchemaDocumentNode)
46498
+ return;
46499
+ const stateEditorDocumentNode = safeParseSdl(stateSchema);
46500
+ if (!stateEditorDocumentNode)
46501
+ return;
46502
+ const stateTypeName = makeStateSchemaNameForScope(modelName, scope);
46503
+ if (!stateTypeName)
46504
+ return;
46505
+ const stateTypeDefinitionNode = stateEditorDocumentNode.definitions.find((def) => def.kind === Kind.OBJECT_TYPE_DEFINITION && def.name.value === stateTypeName);
46506
+ if (!stateTypeDefinitionNode || stateTypeDefinitionNode.kind !== Kind.OBJECT_TYPE_DEFINITION)
46507
+ return;
46508
+ const updatedStateDoc = makeMinimalObjectForStateType({
46509
+ sharedSchemaDocumentNode,
46510
+ stateTypeDefinitionNode,
46511
+ existingValue
46512
+ });
46357
46513
  setInitialState2(updatedStateDoc, scope);
46358
- }, [sharedSchemaSdl, stateSchema, initialValue, setInitialState2, scope]);
46514
+ }, [sharedSchemaSdl, initialValue, setInitialState2, scope]);
46359
46515
  return jsxs("div", { className: "grid grid-cols-2 gap-4", children: [jsxs("div", { children: [jsxs("h3", { className: "mb-2 text-lg capitalize", children: [scope, " state schema"] }), jsxs(Button, { onClick: handleToggleStandardLib, className: "mb-2 flex w-fit items-center gap-2", children: [showStandardLib ? "Hide" : "Show", " standard library", jsx("svg", { className: cn("inline-block transition-transform", showStandardLib ? "rotate-180" : "rotate-0"), xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: jsx("path", { d: "M11.9883 6.01172C11.4363 6.01172 10.9883 6.45972 10.9883 7.01172V13.0117H6.98828L11.9883 18.0117L16.9883 13.0117H12.9883V7.01172C12.9883 6.45972 12.5403 6.01172 11.9883 6.01172Z", fill: "black" }) })] }), showStandardLib && jsx(GraphqlEditor, { doc: typeDefsDoc, readonly: true }), jsx(GraphqlEditor, { doc: stateSchema, updateDocumentInModel: handleSchemaUpdate, customLinter })] }), jsxs("div", { children: [jsxs("div", { className: "flex flex-col items-end", children: [jsxs("h3", { className: "mb-2 text-right text-lg capitalize", children: [scope, " state initial value"] }), jsxs(Button, { onClick: handleSyncWithSchema, className: "mb-2 flex w-fit items-center gap-2", children: ["Sync with schema", " ", jsx("svg", { className: "inline-block", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: jsx("path", { d: "M8.00521 1.99219C6.63588 1.99219 5.32788 2.45152 4.27588 3.28419C3.98721 3.51219 3.94321 3.93285 4.17188 4.22151C4.40054 4.51018 4.82055 4.55418 5.10921 4.32552C5.92721 3.67819 6.93921 3.32552 8.00521 3.32552C10.5825 3.32552 12.6719 5.41485 12.6719 7.99218H11.3385L13.3385 10.6588L15.3385 7.99218H14.0052C14.0052 4.67818 11.3192 1.99219 8.00521 1.99219ZM2.67188 5.32552L0.671875 7.99218H2.00521C2.00521 11.3062 4.69121 13.9922 8.00521 13.9922C9.37521 13.9922 10.6825 13.5335 11.7345 12.7002C12.0232 12.4722 12.0672 12.0515 11.8385 11.7628C11.6099 11.4742 11.1899 11.4302 10.9012 11.6588C10.0825 12.3068 9.07188 12.6588 8.00521 12.6588C5.42788 12.6588 3.33854 10.5695 3.33854 7.99218H4.67188L2.67188 5.32552Z", fill: "#343839" }) })] })] }), jsx(JSONEditor, { doc: initialValue, updateDocumentInModel: handleInitialStateUpdate })] })] });
46360
46516
  }
46361
46517
  function StateSchemas({ modelName, globalStateSchema, localStateSchema, globalStateInitialValue, localStateInitialValue, setStateSchema: setStateSchema2, setInitialState: setInitialState2 }) {
@@ -46546,3 +46702,4 @@ export {
46546
46702
  DocumentModelEditor,
46547
46703
  documentModelEditorModule
46548
46704
  };
46705
+ //# sourceMappingURL=index-wgNrNkzN.js.map