@powerhousedao/connect 1.0.23-staging.0 → 1.0.23-staging.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{app-CSCydE8J.css → app-DFQhKB-Q.css} +3 -3
- package/dist/assets/{app-DcywiNjF.js → app-_0wz8A4r.js} +2488 -2339
- package/dist/assets/{app-loader-3ipafc56.css → app-loader-DczGHPG9.css} +3 -3
- package/dist/assets/{app-loader-DTsRstTc.js → app-loader-d7zgN9hh.js} +44 -55
- package/dist/assets/{ccip-CiJjLxOg.js → ccip-C6W2FbjW.js} +3 -3
- package/dist/assets/{content-BvS8uaAX.js → content-Bm5Tr4Hg.js} +19 -14
- package/dist/assets/{index-BmdZEeOF.js → index-BhxEM16y.js} +4 -4
- package/dist/assets/{index-Dw68KzY3.js → index-CXXvva-l.js} +390 -233
- package/dist/assets/{index-XBueRvDp.js → index-DamVoHkh.js} +3 -3
- package/dist/assets/{main.CgZm8DDG.js → main.Cq930vY3.js} +1 -1
- package/dist/assets/{style-0ej1afQi.css → style-BQHqCxXa.css} +1 -4
- package/dist/index.html +1 -1
- package/dist/vite-envs.sh +1 -1
- package/package.json +9 -10
|
@@ -1,14 +1,14 @@
|
|
|
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-
|
|
4
|
-
import { bb as inspect$1, bc as GraphQLError$1, bd as getNamedType, be as invariant$2, bf as isInputObjectType, bg as isScalarType, bh as isObjectType, bi as isInterfaceType, bj as isUnionType, bk as isEnumType, bl as print, bm as isPrintableAsBlockString, bn as Kind, bo as astFromValue$1, bp as DEFAULT_DEPRECATION_REASON, bq as isSpecifiedDirective, br as isSpecifiedScalarType, bs as isIntrospectionType, bt as z, bu as GraphQLScalarType, bv as specifiedRules$1, bw as GraphQLID, bx as GraphQLBoolean, by as GraphQLString, bz as GraphQLFloat, bA as GraphQLInt, bB as GraphQLDirective, bC as GraphQLObjectType, bD as GraphQLInterfaceType, bE as GraphQLUnionType, bF as GraphQLInputObjectType, bG as GraphQLEnumType, bH as isListType, bI as GraphQLList, bJ as isNonNullType, bK as GraphQLNonNull, bL as isNamedType, bM as getNullableType, bN as isLeafType, bO as GraphQLSchema, bP as buildSchema, bQ as buildASTSchema, bR as parse, bS as validate$2, Z as pascalCase, bT as visit,
|
|
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-_0wz8A4r.js";
|
|
4
|
+
import { bb as inspect$1, bc as GraphQLError$1, bd as getNamedType, be as invariant$2, bf as isInputObjectType, bg as isScalarType, bh as isObjectType, bi as isInterfaceType, bj as isUnionType, bk as isEnumType, bl as print, bm as isPrintableAsBlockString, bn as Kind, bo as astFromValue$1, bp as DEFAULT_DEPRECATION_REASON, bq as isSpecifiedDirective, br as isSpecifiedScalarType, bs as isIntrospectionType, bt as z, bu as GraphQLScalarType, bv as specifiedRules$1, bw as GraphQLID, bx as GraphQLBoolean, by as GraphQLString, bz as GraphQLFloat, bA as GraphQLInt, bB as GraphQLDirective, bC as GraphQLObjectType, bD as GraphQLInterfaceType, bE as GraphQLUnionType, bF as GraphQLInputObjectType, bG as GraphQLEnumType, bH as isListType, bI as GraphQLList, bJ as isNonNullType, bK as GraphQLNonNull, bL as isNamedType, bM as getNullableType, bN as isLeafType, bO as GraphQLSchema, bP as buildSchema, bQ as buildASTSchema, bR as parse, bS as validate$2, Z as pascalCase, bT as visit, $ as getDefaultExportFromCjs, bU as snakeCase, bV as constantCase, bW as isAbstractType, bX as BREAK, bY as SchemaMetaFieldDef, bZ as TypeMetaFieldDef, b_ as TypeNameMetaFieldDef, b$ as isCompositeType, c0 as isOutputType, c1 as isInputType, c2 as assertAbstractType, c3 as doTypesOverlap, c4 as DirectiveLocation, c5 as NoUnusedFragmentsRule$1, c6 as ExecutableDefinitionsRule$1, c7 as validateSchema, c8 as sentenceCase, an as hashKey } from "./app-loader-d7zgN9hh.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.
|
|
7
|
+
import "./main.Cq930vY3.js";
|
|
8
8
|
import "react-dom";
|
|
9
9
|
const versionInfo = Object.freeze({
|
|
10
10
|
major: 16,
|
|
11
|
-
minor:
|
|
11
|
+
minor: 11,
|
|
12
12
|
patch: 0,
|
|
13
13
|
preReleaseTag: null
|
|
14
14
|
});
|
|
@@ -693,7 +693,7 @@ const config$8 = {
|
|
|
693
693
|
}
|
|
694
694
|
};
|
|
695
695
|
const scalar$7 = new GraphQLScalarType(config$8);
|
|
696
|
-
const
|
|
696
|
+
const DateScalar = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
697
697
|
__proto__: null,
|
|
698
698
|
config: config$8,
|
|
699
699
|
scalar: scalar$7,
|
|
@@ -946,7 +946,7 @@ const config$1 = {
|
|
|
946
946
|
}
|
|
947
947
|
};
|
|
948
948
|
const scalar = new GraphQLScalarType(config$1);
|
|
949
|
-
const
|
|
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
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
OID
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
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 = z.lazy(() => z.union([
|
|
1034
|
+
z.string(),
|
|
1035
|
+
z.number(),
|
|
1036
|
+
z.boolean(),
|
|
1037
|
+
z.null(),
|
|
1038
|
+
z.array(SerializableSchema),
|
|
1039
|
+
z.record(z.string(), 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
|
|
1907
|
-
const
|
|
1908
|
-
const
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
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
|
|
1961
|
-
|
|
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
|
|
1965
|
-
|
|
1966
|
-
|
|
1922
|
+
const inputSdl = `input ${pascalCase(name2)}Input {
|
|
1923
|
+
"Add your inputs here"
|
|
1924
|
+
_placeholder: String
|
|
1925
|
+
}`;
|
|
1926
|
+
return inputSdl;
|
|
1967
1927
|
}
|
|
1968
|
-
function
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
}
|
|
1972
|
-
|
|
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
|
|
1995
|
-
const
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
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
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
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
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
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
|
-
|
|
1960
|
+
const minimalValue = makeMinimalValueForASTNode({
|
|
1961
|
+
fieldName,
|
|
1962
|
+
astNode,
|
|
1963
|
+
schemaDocumentNode,
|
|
1964
|
+
existingValueObject
|
|
1965
|
+
});
|
|
1966
|
+
newJson[astNode.name.value] = minimalValue;
|
|
2027
1967
|
}
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
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 (z.string().safeParse(existingFieldValue).success) {
|
|
2075
|
+
return existingFieldValue;
|
|
2076
|
+
}
|
|
2077
|
+
return isNonNull ? "placeholder-id" : null;
|
|
2036
2078
|
}
|
|
2037
|
-
|
|
2079
|
+
case BOOLEAN_GQL_PRIMITIVE_NAME: {
|
|
2080
|
+
if (z.boolean().safeParse(existingFieldValue).success) {
|
|
2081
|
+
return existingFieldValue;
|
|
2082
|
+
}
|
|
2083
|
+
return isNonNull ? false : null;
|
|
2084
|
+
}
|
|
2085
|
+
case INT_GQL_PRIMITIVE_NAME: {
|
|
2086
|
+
if (z.number().safeParse(existingFieldValue).success) {
|
|
2087
|
+
return existingFieldValue;
|
|
2088
|
+
}
|
|
2089
|
+
return isNonNull ? 0 : null;
|
|
2090
|
+
}
|
|
2091
|
+
case FLOAT_GQL_PRIMITIVE_NAME: {
|
|
2092
|
+
if (z.number().safeParse(existingFieldValue).success) {
|
|
2093
|
+
return existingFieldValue;
|
|
2094
|
+
}
|
|
2095
|
+
return isNonNull ? 0 : null;
|
|
2096
|
+
}
|
|
2097
|
+
case STRING_GQL_PRIMITIVE_NAME: {
|
|
2098
|
+
if (z.string().safeParse(existingFieldValue).success) {
|
|
2099
|
+
return existingFieldValue;
|
|
2100
|
+
}
|
|
2101
|
+
return isNonNull ? "" : null;
|
|
2102
|
+
}
|
|
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
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
const
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
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
|
-
|
|
2054
|
-
|
|
2185
|
+
}
|
|
2186
|
+
function getNamedTypeDefinitionNode(astNodeTypeNode, schemaDocumentNode) {
|
|
2187
|
+
if (!astNodeTypeNode) {
|
|
2188
|
+
return null;
|
|
2055
2189
|
}
|
|
2056
|
-
const
|
|
2057
|
-
|
|
2058
|
-
|
|
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
|
-
|
|
2064
|
-
|
|
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
|
-
|
|
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) {
|
|
@@ -15209,8 +15343,7 @@ function logException(state, exception, context) {
|
|
|
15209
15343
|
let handler = state.facet(exceptionSink);
|
|
15210
15344
|
if (handler.length)
|
|
15211
15345
|
handler[0](exception);
|
|
15212
|
-
else if (window.onerror)
|
|
15213
|
-
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)) ;
|
|
15214
15347
|
else if (context)
|
|
15215
15348
|
console.error(context + ":", exception);
|
|
15216
15349
|
else
|
|
@@ -19777,7 +19910,7 @@ class EditorView {
|
|
|
19777
19910
|
one change has been made in the current composition.
|
|
19778
19911
|
*/
|
|
19779
19912
|
get composing() {
|
|
19780
|
-
return this.inputState.composing > 0;
|
|
19913
|
+
return !!this.inputState && this.inputState.composing > 0;
|
|
19781
19914
|
}
|
|
19782
19915
|
/**
|
|
19783
19916
|
Indicates whether the user is currently in composing state. Note
|
|
@@ -19786,7 +19919,7 @@ class EditorView {
|
|
|
19786
19919
|
composition there.
|
|
19787
19920
|
*/
|
|
19788
19921
|
get compositionStarted() {
|
|
19789
|
-
return this.inputState.composing >= 0;
|
|
19922
|
+
return !!this.inputState && this.inputState.composing >= 0;
|
|
19790
19923
|
}
|
|
19791
19924
|
/**
|
|
19792
19925
|
The document or shadow root that the view lives in.
|
|
@@ -21382,7 +21515,7 @@ class MatchDecorator {
|
|
|
21382
21515
|
updateRange(view, deco, updateFrom, updateTo) {
|
|
21383
21516
|
for (let r2 of view.visibleRanges) {
|
|
21384
21517
|
let from = Math.max(r2.from, updateFrom), to = Math.min(r2.to, updateTo);
|
|
21385
|
-
if (to
|
|
21518
|
+
if (to >= from) {
|
|
21386
21519
|
let fromLine = view.state.doc.lineAt(from), toLine = fromLine.to < to ? view.state.doc.lineAt(to) : fromLine;
|
|
21387
21520
|
let start = Math.max(r2.from, fromLine.from), end = Math.min(r2.to, toLine.to);
|
|
21388
21521
|
if (this.boundary) {
|
|
@@ -37770,10 +37903,7 @@ function requireVisitor() {
|
|
|
37770
37903
|
}
|
|
37771
37904
|
}
|
|
37772
37905
|
} else {
|
|
37773
|
-
node =
|
|
37774
|
-
{},
|
|
37775
|
-
Object.getOwnPropertyDescriptors(node)
|
|
37776
|
-
);
|
|
37906
|
+
node = { ...node };
|
|
37777
37907
|
for (const [editKey, editValue] of edits) {
|
|
37778
37908
|
node[editKey] = editValue;
|
|
37779
37909
|
}
|
|
@@ -43893,7 +44023,7 @@ function requireCoerceInputValue() {
|
|
|
43893
44023
|
return [coerceInputValueImpl(inputValue, itemType, onError, path)];
|
|
43894
44024
|
}
|
|
43895
44025
|
if ((0, _definition.isInputObjectType)(type2)) {
|
|
43896
|
-
if (!(0, _isObjectLike.isObjectLike)(inputValue)) {
|
|
44026
|
+
if (!(0, _isObjectLike.isObjectLike)(inputValue) || Array.isArray(inputValue)) {
|
|
43897
44027
|
onError(
|
|
43898
44028
|
(0, _Path.pathToArray)(path),
|
|
43899
44029
|
inputValue,
|
|
@@ -45443,7 +45573,7 @@ function requireVariablesInAllowedPositionRule() {
|
|
|
45443
45573
|
},
|
|
45444
45574
|
leave(operation) {
|
|
45445
45575
|
const usages = context.getRecursiveVariableUsages(operation);
|
|
45446
|
-
for (const { node, type: type2, defaultValue } of usages) {
|
|
45576
|
+
for (const { node, type: type2, defaultValue, parentType } of usages) {
|
|
45447
45577
|
const varName = node.name.value;
|
|
45448
45578
|
const varDef = varDefMap[varName];
|
|
45449
45579
|
if (varDef && type2) {
|
|
@@ -45467,6 +45597,16 @@ function requireVariablesInAllowedPositionRule() {
|
|
|
45467
45597
|
)
|
|
45468
45598
|
);
|
|
45469
45599
|
}
|
|
45600
|
+
if ((0, _definition.isInputObjectType)(parentType) && parentType.isOneOf && (0, _definition.isNullableType)(varType)) {
|
|
45601
|
+
context.reportError(
|
|
45602
|
+
new _GraphQLError.GraphQLError(
|
|
45603
|
+
`Variable "$${varName}" is of type "${varType}" but must be non-nullable to be used for OneOf Input Object "${parentType}".`,
|
|
45604
|
+
{
|
|
45605
|
+
nodes: [varDef, node]
|
|
45606
|
+
}
|
|
45607
|
+
)
|
|
45608
|
+
);
|
|
45609
|
+
}
|
|
45470
45610
|
}
|
|
45471
45611
|
}
|
|
45472
45612
|
}
|
|
@@ -45720,7 +45860,8 @@ function requireValidationContext() {
|
|
|
45720
45860
|
newUsages.push({
|
|
45721
45861
|
node: variable,
|
|
45722
45862
|
type: typeInfo.getInputType(),
|
|
45723
|
-
defaultValue: typeInfo.getDefaultValue()
|
|
45863
|
+
defaultValue: typeInfo.getDefaultValue(),
|
|
45864
|
+
parentType: typeInfo.getParentInputType()
|
|
45724
45865
|
});
|
|
45725
45866
|
}
|
|
45726
45867
|
})
|
|
@@ -46051,21 +46192,17 @@ const GraphqlEditor = memo(function GraphqlEditor2(props) {
|
|
|
46051
46192
|
const view = viewRef.current;
|
|
46052
46193
|
if (!view)
|
|
46053
46194
|
return;
|
|
46054
|
-
|
|
46055
|
-
|
|
46056
|
-
|
|
46057
|
-
|
|
46058
|
-
|
|
46059
|
-
|
|
46060
|
-
|
|
46061
|
-
|
|
46062
|
-
|
|
46063
|
-
|
|
46064
|
-
|
|
46065
|
-
forceLinting(view);
|
|
46066
|
-
} catch (error) {
|
|
46067
|
-
console.debug("in schema update", error);
|
|
46068
|
-
}
|
|
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);
|
|
46069
46206
|
}
|
|
46070
46207
|
}, [sharedSchema, customLinter]);
|
|
46071
46208
|
useHandlerReconfiguration(viewRef.current, readonly, timeoutRef, updateDocumentInModel, {
|
|
@@ -46157,7 +46294,10 @@ function createNodeTypeAndNameDiagnostic(doc2, errorMessage) {
|
|
|
46157
46294
|
function ensureValidStateSchemaName(doc2, modelName, scope) {
|
|
46158
46295
|
if (!safeParseSdl(doc2))
|
|
46159
46296
|
return [];
|
|
46160
|
-
const
|
|
46297
|
+
const scopePascalCase = pascalCase(scope);
|
|
46298
|
+
const modelNamePascalCase = pascalCase(modelName);
|
|
46299
|
+
const scopeStateTypeNamePrefix = scopePascalCase === "Global" ? "" : scopePascalCase;
|
|
46300
|
+
const requiredTypeName = `${scopeStateTypeNamePrefix}${modelNamePascalCase}State`;
|
|
46161
46301
|
if (!ensureDocumentContainsNodeWithNameAndType(doc2, requiredTypeName, "OBJECT_TYPE_DEFINITION")) {
|
|
46162
46302
|
return [
|
|
46163
46303
|
createNodeTypeAndNameDiagnostic(doc2, `${sentenceCase(scope)} state schema must be named ${requiredTypeName}`)
|
|
@@ -46225,13 +46365,6 @@ const Button = forwardRef((props, ref) => {
|
|
|
46225
46365
|
const { className, ...rest } = props;
|
|
46226
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) });
|
|
46227
46367
|
});
|
|
46228
|
-
const Tabs = Root2;
|
|
46229
|
-
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 }));
|
|
46230
|
-
TabsList.displayName = List.displayName;
|
|
46231
|
-
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 }));
|
|
46232
|
-
TabsTrigger.displayName = Trigger.displayName;
|
|
46233
|
-
const TabsContent = React.forwardRef(({ className, ...props }, ref) => jsx(Content, { ref, className: cn("", className), ...props }));
|
|
46234
|
-
TabsContent.displayName = Content.displayName;
|
|
46235
46368
|
const jsonHighlighting = styleTags({
|
|
46236
46369
|
String: tags.string,
|
|
46237
46370
|
Number: tags.number,
|
|
@@ -46342,6 +46475,13 @@ const JSONEditor = memo(function JSONEditor2(props) {
|
|
|
46342
46475
|
useDocumentSync(viewRef.current, doc2);
|
|
46343
46476
|
return jsx("div", { ref: editorRef });
|
|
46344
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;
|
|
46345
46485
|
function StateEditor({ modelName, stateSchema, initialValue, setStateSchema: setStateSchema2, setInitialState: setInitialState2, scope }) {
|
|
46346
46486
|
const sharedSchemaSdl = useSchemaContext();
|
|
46347
46487
|
const [showStandardLib, setShowStandardLib] = useState(false);
|
|
@@ -46352,9 +46492,26 @@ function StateEditor({ modelName, stateSchema, initialValue, setStateSchema: set
|
|
|
46352
46492
|
const handleSchemaUpdate = useCallback((newDoc) => setStateSchema2(newDoc, scope), [setStateSchema2, scope]);
|
|
46353
46493
|
const handleInitialStateUpdate = useCallback((newDoc) => setInitialState2(newDoc, scope), [setInitialState2, scope]);
|
|
46354
46494
|
const handleSyncWithSchema = useCallback(() => {
|
|
46355
|
-
const
|
|
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
|
+
});
|
|
46356
46513
|
setInitialState2(updatedStateDoc, scope);
|
|
46357
|
-
}, [sharedSchemaSdl,
|
|
46514
|
+
}, [sharedSchemaSdl, initialValue, setInitialState2, scope]);
|
|
46358
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 })] })] });
|
|
46359
46516
|
}
|
|
46360
46517
|
function StateSchemas({ modelName, globalStateSchema, localStateSchema, globalStateInitialValue, localStateInitialValue, setStateSchema: setStateSchema2, setInitialState: setInitialState2 }) {
|