@graphitation/supermassive 2.5.0 → 3.0.0-alpha.1

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 (136) hide show
  1. package/.eslintcache +1 -1
  2. package/CHANGELOG.md +18 -2
  3. package/lib/benchmarks/index.js +2 -2
  4. package/lib/benchmarks/index.js.map +2 -2
  5. package/lib/benchmarks/index.mjs +2 -2
  6. package/lib/benchmarks/index.mjs.map +2 -2
  7. package/lib/benchmarks/swapi-schema/index.d.ts +4 -2
  8. package/lib/benchmarks/swapi-schema/index.d.ts.map +1 -1
  9. package/lib/benchmarks/swapi-schema/index.js +8 -2
  10. package/lib/benchmarks/swapi-schema/index.js.map +2 -2
  11. package/lib/benchmarks/swapi-schema/index.mjs +8 -2
  12. package/lib/benchmarks/swapi-schema/index.mjs.map +2 -2
  13. package/lib/benchmarks/swapi-schema/makeExecutableSchema.d.ts +7 -0
  14. package/lib/benchmarks/swapi-schema/makeExecutableSchema.d.ts.map +1 -0
  15. package/lib/benchmarks/swapi-schema/makeExecutableSchema.js +916 -0
  16. package/lib/benchmarks/swapi-schema/makeExecutableSchema.js.map +7 -0
  17. package/lib/benchmarks/swapi-schema/makeExecutableSchema.mjs +903 -0
  18. package/lib/benchmarks/swapi-schema/makeExecutableSchema.mjs.map +7 -0
  19. package/lib/benchmarks/swapi-schema/resolvers.d.ts.map +1 -1
  20. package/lib/benchmarks/swapi-schema/resolvers.js +53 -17
  21. package/lib/benchmarks/swapi-schema/resolvers.js.map +2 -2
  22. package/lib/benchmarks/swapi-schema/resolvers.mjs +54 -18
  23. package/lib/benchmarks/swapi-schema/resolvers.mjs.map +2 -2
  24. package/lib/collectFields.d.ts +28 -6
  25. package/lib/collectFields.d.ts.map +1 -1
  26. package/lib/collectFields.js +155 -28
  27. package/lib/collectFields.js.map +3 -3
  28. package/lib/collectFields.mjs +150 -29
  29. package/lib/collectFields.mjs.map +2 -2
  30. package/lib/definition.js +1 -1
  31. package/lib/definition.js.map +2 -2
  32. package/lib/definition.mjs +1 -1
  33. package/lib/definition.mjs.map +2 -2
  34. package/lib/directives.d.ts +2 -73
  35. package/lib/directives.d.ts.map +1 -1
  36. package/lib/directives.js +10 -123
  37. package/lib/directives.js.map +2 -2
  38. package/lib/directives.mjs +13 -122
  39. package/lib/directives.mjs.map +2 -2
  40. package/lib/executeWithoutSchema.d.ts +50 -13
  41. package/lib/executeWithoutSchema.d.ts.map +1 -1
  42. package/lib/executeWithoutSchema.js +1038 -184
  43. package/lib/executeWithoutSchema.js.map +3 -3
  44. package/lib/executeWithoutSchema.mjs +1049 -186
  45. package/lib/executeWithoutSchema.mjs.map +3 -3
  46. package/lib/extractImplicitTypesRuntime.js +2 -2
  47. package/lib/extractImplicitTypesRuntime.js.map +2 -2
  48. package/lib/extractImplicitTypesRuntime.mjs +2 -2
  49. package/lib/extractImplicitTypesRuntime.mjs.map +2 -2
  50. package/lib/hooks/types.d.ts +1 -1
  51. package/lib/hooks/types.d.ts.map +1 -1
  52. package/lib/index.d.ts +4 -3
  53. package/lib/index.d.ts.map +1 -1
  54. package/lib/index.js +4 -1
  55. package/lib/index.js.map +2 -2
  56. package/lib/index.mjs +4 -1
  57. package/lib/index.mjs.map +2 -2
  58. package/lib/jsutils/AccumulatorMap.d.ts +8 -0
  59. package/lib/jsutils/AccumulatorMap.d.ts.map +1 -0
  60. package/lib/jsutils/AccumulatorMap.js +36 -0
  61. package/lib/jsutils/AccumulatorMap.js.map +7 -0
  62. package/lib/jsutils/AccumulatorMap.mjs +17 -0
  63. package/lib/jsutils/AccumulatorMap.mjs.map +7 -0
  64. package/lib/jsutils/Maybe.d.ts +1 -1
  65. package/lib/jsutils/Maybe.d.ts.map +1 -1
  66. package/lib/jsutils/ObjMap.d.ts +2 -2
  67. package/lib/jsutils/ObjMap.d.ts.map +1 -1
  68. package/lib/jsutils/PromiseOrValue.d.ts +1 -1
  69. package/lib/jsutils/PromiseOrValue.d.ts.map +1 -1
  70. package/lib/jsutils/didYouMean.d.ts +1 -2
  71. package/lib/jsutils/didYouMean.d.ts.map +1 -1
  72. package/lib/jsutils/didYouMean.js.map +2 -2
  73. package/lib/jsutils/didYouMean.mjs.map +2 -2
  74. package/lib/jsutils/instanceOf.js.map +2 -2
  75. package/lib/jsutils/instanceOf.mjs.map +2 -2
  76. package/lib/subscribeWithSchema.d.ts +3 -2
  77. package/lib/subscribeWithSchema.d.ts.map +1 -1
  78. package/lib/subscribeWithSchema.js.map +2 -2
  79. package/lib/subscribeWithSchema.mjs.map +2 -2
  80. package/lib/subscribeWithoutSchema.d.ts +3 -35
  81. package/lib/subscribeWithoutSchema.d.ts.map +1 -1
  82. package/lib/subscribeWithoutSchema.js +1 -163
  83. package/lib/subscribeWithoutSchema.js.map +2 -2
  84. package/lib/subscribeWithoutSchema.mjs +2 -175
  85. package/lib/subscribeWithoutSchema.mjs.map +2 -2
  86. package/lib/supermassive-ast/TypedAST.d.ts +370 -0
  87. package/lib/supermassive-ast/TypedAST.d.ts.map +1 -0
  88. package/lib/supermassive-ast/TypedAST.js +29 -0
  89. package/lib/supermassive-ast/TypedAST.js.map +7 -0
  90. package/lib/supermassive-ast/TypedAST.mjs +10 -0
  91. package/lib/supermassive-ast/TypedAST.mjs.map +7 -0
  92. package/lib/supermassive-ast/addTypesToRequestDocument.d.ts +56 -0
  93. package/lib/supermassive-ast/addTypesToRequestDocument.d.ts.map +1 -0
  94. package/lib/supermassive-ast/addTypesToRequestDocument.js +473 -0
  95. package/lib/supermassive-ast/addTypesToRequestDocument.js.map +7 -0
  96. package/lib/supermassive-ast/addTypesToRequestDocument.mjs +463 -0
  97. package/lib/supermassive-ast/addTypesToRequestDocument.mjs.map +7 -0
  98. package/lib/supermassive-ast/annotateDocumentGraphQLTransform.d.ts +3 -0
  99. package/lib/supermassive-ast/annotateDocumentGraphQLTransform.d.ts.map +1 -0
  100. package/lib/supermassive-ast/annotateDocumentGraphQLTransform.js +34 -0
  101. package/lib/supermassive-ast/annotateDocumentGraphQLTransform.js.map +7 -0
  102. package/lib/supermassive-ast/annotateDocumentGraphQLTransform.mjs +17 -0
  103. package/lib/supermassive-ast/annotateDocumentGraphQLTransform.mjs.map +7 -0
  104. package/lib/supermassive-ast/directives.d.ts +36 -0
  105. package/lib/supermassive-ast/directives.d.ts.map +1 -0
  106. package/lib/supermassive-ast/directives.js +165 -0
  107. package/lib/supermassive-ast/directives.js.map +7 -0
  108. package/lib/supermassive-ast/directives.mjs +153 -0
  109. package/lib/supermassive-ast/directives.mjs.map +7 -0
  110. package/lib/supermassive-ast/index.d.ts +6 -0
  111. package/lib/supermassive-ast/index.d.ts.map +1 -0
  112. package/lib/supermassive-ast/index.js +37 -0
  113. package/lib/supermassive-ast/index.js.map +7 -0
  114. package/lib/supermassive-ast/index.mjs +27 -0
  115. package/lib/supermassive-ast/index.mjs.map +7 -0
  116. package/lib/types.d.ts +80 -24
  117. package/lib/types.d.ts.map +1 -1
  118. package/lib/types.js +14 -0
  119. package/lib/types.js.map +2 -2
  120. package/lib/types.mjs +11 -0
  121. package/lib/types.mjs.map +3 -3
  122. package/lib/utilities/mergeResolvers.d.ts +1 -1
  123. package/lib/utilities/mergeResolvers.d.ts.map +1 -1
  124. package/lib/utilities/mergeResolvers.js.map +2 -2
  125. package/lib/utilities/mergeResolvers.mjs.map +2 -2
  126. package/lib/utilities/typeNameFromAST.d.ts +1 -1
  127. package/lib/utilities/typeNameFromAST.d.ts.map +1 -1
  128. package/lib/utilities/typeNameFromAST.js.map +1 -1
  129. package/lib/utilities/typeNameFromAST.mjs.map +1 -1
  130. package/lib/values.d.ts +3 -4
  131. package/lib/values.d.ts.map +1 -1
  132. package/lib/values.js +10 -14
  133. package/lib/values.js.map +2 -2
  134. package/lib/values.mjs +10 -14
  135. package/lib/values.mjs.map +2 -2
  136. package/package.json +4 -9
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/definition.ts"],
4
- "sourcesContent": ["import { GraphQLFieldConfigArgumentMap, GraphQLArgument } from \"graphql\";\n\nimport { Resolver, UnionTypeResolver, InterfaceTypeResolver } from \"./types\";\nimport { toObjMap } from \"./jsutils/toObjMap\";\nimport { keyValMap } from \"./jsutils/keyValMap\";\n\nexport function defineArguments(\n config: GraphQLFieldConfigArgumentMap,\n): ReadonlyArray<GraphQLArgument> {\n return Object.entries(config).map(([argName, argConfig]) => ({\n name: argName,\n description: argConfig.description,\n type: argConfig.type,\n defaultValue: argConfig.defaultValue,\n deprecationReason: argConfig.deprecationReason,\n extensions: argConfig.extensions && toObjMap(argConfig.extensions),\n astNode: argConfig.astNode,\n }));\n}\n\nexport function argsToArgsConfig(\n args: ReadonlyArray<GraphQLArgument>,\n): GraphQLFieldConfigArgumentMap {\n return keyValMap(\n args,\n (arg) => arg.name,\n (arg) => ({\n description: arg.description,\n type: arg.type,\n defaultValue: arg.defaultValue,\n deprecationReason: arg.deprecationReason,\n extensions: arg.extensions,\n astNode: arg.astNode,\n }),\n );\n}\n\nexport function isInterfaceResolverType(\n resolver: Resolver<unknown, unknown>,\n): resolver is InterfaceTypeResolver {\n return \"__implementedBy\" in resolver && \"__resolveType\" in resolver;\n}\n\nexport function isUnionResolverType(\n resolver: Resolver<unknown, unknown>,\n): resolver is UnionTypeResolver {\n return \"__types\" in resolver && \"__resolveType\" in resolver;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAyB;AACzB,uBAA0B;AAEnB,SAAS,gBACd,QACgC;AAChC,SAAO,OAAO,QAAQ,MAAM,EAAE,IAAI,CAAC,CAAC,SAAS,SAAS,OAAO;AAAA,IAC3D,MAAM;AAAA,IACN,aAAa,UAAU;AAAA,IACvB,MAAM,UAAU;AAAA,IAChB,cAAc,UAAU;AAAA,IACxB,mBAAmB,UAAU;AAAA,IAC7B,YAAY,UAAU,kBAAc,0BAAS,UAAU,UAAU;AAAA,IACjE,SAAS,UAAU;AAAA,EACrB,EAAE;AACJ;AAEO,SAAS,iBACd,MAC+B;AAC/B,aAAO;AAAA,IACL;AAAA,IACA,CAAC,QAAQ,IAAI;AAAA,IACb,CAAC,SAAS;AAAA,MACR,aAAa,IAAI;AAAA,MACjB,MAAM,IAAI;AAAA,MACV,cAAc,IAAI;AAAA,MAClB,mBAAmB,IAAI;AAAA,MACvB,YAAY,IAAI;AAAA,MAChB,SAAS,IAAI;AAAA,IACf;AAAA,EACF;AACF;AAEO,SAAS,wBACd,UACmC;AACnC,SAAO,qBAAqB,YAAY,mBAAmB;AAC7D;AAEO,SAAS,oBACd,UAC+B;AAC/B,SAAO,aAAa,YAAY,mBAAmB;AACrD;",
4
+ "sourcesContent": ["import { GraphQLFieldConfigArgumentMap, GraphQLArgument } from \"graphql\";\n\nimport { Resolver, UnionTypeResolver, InterfaceTypeResolver } from \"./types\";\nimport { toObjMap } from \"./jsutils/toObjMap\";\nimport { keyValMap } from \"./jsutils/keyValMap\";\n\nexport function defineArguments(\n config: GraphQLFieldConfigArgumentMap,\n): ReadonlyArray<GraphQLArgument> {\n return Object.entries(config).map(([argName, argConfig]) => ({\n name: argName,\n description: argConfig.description,\n type: argConfig.type,\n defaultValue: argConfig.defaultValue,\n deprecationReason: argConfig.deprecationReason,\n extensions: argConfig.extensions ? toObjMap(argConfig.extensions) : {},\n astNode: argConfig.astNode,\n }));\n}\n\nexport function argsToArgsConfig(\n args: ReadonlyArray<GraphQLArgument>,\n): GraphQLFieldConfigArgumentMap {\n return keyValMap(\n args,\n (arg) => arg.name,\n (arg) => ({\n description: arg.description,\n type: arg.type,\n defaultValue: arg.defaultValue,\n deprecationReason: arg.deprecationReason,\n extensions: arg.extensions,\n astNode: arg.astNode,\n }),\n );\n}\n\nexport function isInterfaceResolverType(\n resolver: Resolver<unknown, unknown>,\n): resolver is InterfaceTypeResolver {\n return \"__implementedBy\" in resolver && \"__resolveType\" in resolver;\n}\n\nexport function isUnionResolverType(\n resolver: Resolver<unknown, unknown>,\n): resolver is UnionTypeResolver {\n return \"__types\" in resolver && \"__resolveType\" in resolver;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAyB;AACzB,uBAA0B;AAEnB,SAAS,gBACd,QACgC;AAChC,SAAO,OAAO,QAAQ,MAAM,EAAE,IAAI,CAAC,CAAC,SAAS,SAAS,OAAO;AAAA,IAC3D,MAAM;AAAA,IACN,aAAa,UAAU;AAAA,IACvB,MAAM,UAAU;AAAA,IAChB,cAAc,UAAU;AAAA,IACxB,mBAAmB,UAAU;AAAA,IAC7B,YAAY,UAAU,iBAAa,0BAAS,UAAU,UAAU,IAAI,CAAC;AAAA,IACrE,SAAS,UAAU;AAAA,EACrB,EAAE;AACJ;AAEO,SAAS,iBACd,MAC+B;AAC/B,aAAO;AAAA,IACL;AAAA,IACA,CAAC,QAAQ,IAAI;AAAA,IACb,CAAC,SAAS;AAAA,MACR,aAAa,IAAI;AAAA,MACjB,MAAM,IAAI;AAAA,MACV,cAAc,IAAI;AAAA,MAClB,mBAAmB,IAAI;AAAA,MACvB,YAAY,IAAI;AAAA,MAChB,SAAS,IAAI;AAAA,IACf;AAAA,EACF;AACF;AAEO,SAAS,wBACd,UACmC;AACnC,SAAO,qBAAqB,YAAY,mBAAmB;AAC7D;AAEO,SAAS,oBACd,UAC+B;AAC/B,SAAO,aAAa,YAAY,mBAAmB;AACrD;",
6
6
  "names": []
7
7
  }
@@ -8,7 +8,7 @@ function defineArguments(config) {
8
8
  type: argConfig.type,
9
9
  defaultValue: argConfig.defaultValue,
10
10
  deprecationReason: argConfig.deprecationReason,
11
- extensions: argConfig.extensions && toObjMap(argConfig.extensions),
11
+ extensions: argConfig.extensions ? toObjMap(argConfig.extensions) : {},
12
12
  astNode: argConfig.astNode
13
13
  }));
14
14
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/definition.ts"],
4
- "sourcesContent": ["import { GraphQLFieldConfigArgumentMap, GraphQLArgument } from \"graphql\";\n\nimport { Resolver, UnionTypeResolver, InterfaceTypeResolver } from \"./types\";\nimport { toObjMap } from \"./jsutils/toObjMap\";\nimport { keyValMap } from \"./jsutils/keyValMap\";\n\nexport function defineArguments(\n config: GraphQLFieldConfigArgumentMap,\n): ReadonlyArray<GraphQLArgument> {\n return Object.entries(config).map(([argName, argConfig]) => ({\n name: argName,\n description: argConfig.description,\n type: argConfig.type,\n defaultValue: argConfig.defaultValue,\n deprecationReason: argConfig.deprecationReason,\n extensions: argConfig.extensions && toObjMap(argConfig.extensions),\n astNode: argConfig.astNode,\n }));\n}\n\nexport function argsToArgsConfig(\n args: ReadonlyArray<GraphQLArgument>,\n): GraphQLFieldConfigArgumentMap {\n return keyValMap(\n args,\n (arg) => arg.name,\n (arg) => ({\n description: arg.description,\n type: arg.type,\n defaultValue: arg.defaultValue,\n deprecationReason: arg.deprecationReason,\n extensions: arg.extensions,\n astNode: arg.astNode,\n }),\n );\n}\n\nexport function isInterfaceResolverType(\n resolver: Resolver<unknown, unknown>,\n): resolver is InterfaceTypeResolver {\n return \"__implementedBy\" in resolver && \"__resolveType\" in resolver;\n}\n\nexport function isUnionResolverType(\n resolver: Resolver<unknown, unknown>,\n): resolver is UnionTypeResolver {\n return \"__types\" in resolver && \"__resolveType\" in resolver;\n}\n"],
5
- "mappings": ";AAGA,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAEnB,SAAS,gBACd,QACgC;AAChC,SAAO,OAAO,QAAQ,MAAM,EAAE,IAAI,CAAC,CAAC,SAAS,SAAS,OAAO;AAAA,IAC3D,MAAM;AAAA,IACN,aAAa,UAAU;AAAA,IACvB,MAAM,UAAU;AAAA,IAChB,cAAc,UAAU;AAAA,IACxB,mBAAmB,UAAU;AAAA,IAC7B,YAAY,UAAU,cAAc,SAAS,UAAU,UAAU;AAAA,IACjE,SAAS,UAAU;AAAA,EACrB,EAAE;AACJ;AAEO,SAAS,iBACd,MAC+B;AAC/B,SAAO;AAAA,IACL;AAAA,IACA,CAAC,QAAQ,IAAI;AAAA,IACb,CAAC,SAAS;AAAA,MACR,aAAa,IAAI;AAAA,MACjB,MAAM,IAAI;AAAA,MACV,cAAc,IAAI;AAAA,MAClB,mBAAmB,IAAI;AAAA,MACvB,YAAY,IAAI;AAAA,MAChB,SAAS,IAAI;AAAA,IACf;AAAA,EACF;AACF;AAEO,SAAS,wBACd,UACmC;AACnC,SAAO,qBAAqB,YAAY,mBAAmB;AAC7D;AAEO,SAAS,oBACd,UAC+B;AAC/B,SAAO,aAAa,YAAY,mBAAmB;AACrD;",
4
+ "sourcesContent": ["import { GraphQLFieldConfigArgumentMap, GraphQLArgument } from \"graphql\";\n\nimport { Resolver, UnionTypeResolver, InterfaceTypeResolver } from \"./types\";\nimport { toObjMap } from \"./jsutils/toObjMap\";\nimport { keyValMap } from \"./jsutils/keyValMap\";\n\nexport function defineArguments(\n config: GraphQLFieldConfigArgumentMap,\n): ReadonlyArray<GraphQLArgument> {\n return Object.entries(config).map(([argName, argConfig]) => ({\n name: argName,\n description: argConfig.description,\n type: argConfig.type,\n defaultValue: argConfig.defaultValue,\n deprecationReason: argConfig.deprecationReason,\n extensions: argConfig.extensions ? toObjMap(argConfig.extensions) : {},\n astNode: argConfig.astNode,\n }));\n}\n\nexport function argsToArgsConfig(\n args: ReadonlyArray<GraphQLArgument>,\n): GraphQLFieldConfigArgumentMap {\n return keyValMap(\n args,\n (arg) => arg.name,\n (arg) => ({\n description: arg.description,\n type: arg.type,\n defaultValue: arg.defaultValue,\n deprecationReason: arg.deprecationReason,\n extensions: arg.extensions,\n astNode: arg.astNode,\n }),\n );\n}\n\nexport function isInterfaceResolverType(\n resolver: Resolver<unknown, unknown>,\n): resolver is InterfaceTypeResolver {\n return \"__implementedBy\" in resolver && \"__resolveType\" in resolver;\n}\n\nexport function isUnionResolverType(\n resolver: Resolver<unknown, unknown>,\n): resolver is UnionTypeResolver {\n return \"__types\" in resolver && \"__resolveType\" in resolver;\n}\n"],
5
+ "mappings": ";AAGA,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAEnB,SAAS,gBACd,QACgC;AAChC,SAAO,OAAO,QAAQ,MAAM,EAAE,IAAI,CAAC,CAAC,SAAS,SAAS,OAAO;AAAA,IAC3D,MAAM;AAAA,IACN,aAAa,UAAU;AAAA,IACvB,MAAM,UAAU;AAAA,IAChB,cAAc,UAAU;AAAA,IACxB,mBAAmB,UAAU;AAAA,IAC7B,YAAY,UAAU,aAAa,SAAS,UAAU,UAAU,IAAI,CAAC;AAAA,IACrE,SAAS,UAAU;AAAA,EACrB,EAAE;AACJ;AAEO,SAAS,iBACd,MAC+B;AAC/B,SAAO;AAAA,IACL;AAAA,IACA,CAAC,QAAQ,IAAI;AAAA,IACb,CAAC,SAAS;AAAA,MACR,aAAa,IAAI;AAAA,MACjB,MAAM,IAAI;AAAA,MACV,cAAc,IAAI;AAAA,MAClB,mBAAmB,IAAI;AAAA,MACvB,YAAY,IAAI;AAAA,MAChB,SAAS,IAAI;AAAA,IACf;AAAA,EACF;AACF;AAEO,SAAS,wBACd,UACmC;AACnC,SAAO,qBAAqB,YAAY,mBAAmB;AAC7D;AAEO,SAAS,oBACd,UAC+B;AAC/B,SAAO,aAAa,YAAY,mBAAmB;AACrD;",
6
6
  "names": []
7
7
  }
@@ -1,79 +1,8 @@
1
- import { GraphQLArgument, DirectiveLocationEnum, GraphQLFieldConfigArgumentMap } from "graphql";
2
- import type { Maybe } from "./jsutils/Maybe";
3
- import type { DirectiveDefinitionNode } from "@graphitation/supermassive-ast";
1
+ import { GraphQLDirective } from "graphql";
2
+ export { specifiedDirectives, isSpecifiedDirective, GraphQLIncludeDirective, GraphQLSkipDirective, GraphQLDeprecatedDirective, GraphQLSpecifiedByDirective, GraphQLDeferDirective, GraphQLStreamDirective, } from "./supermassive-ast";
4
3
  /**
5
4
  * Test if the given value is a GraphQL directive.
6
5
  */
7
6
  export declare function isDirective(directive: unknown): directive is GraphQLDirective;
8
7
  export declare function assertDirective(directive: unknown): GraphQLDirective;
9
- /**
10
- * Custom extensions
11
- *
12
- * @remarks
13
- * Use a unique identifier name for your extension, for example the name of
14
- * your library or project. Do not use a shortened identifier as this increases
15
- * the risk of conflicts. We recommend you add at most one extension field,
16
- * an object which can contain all the values you need.
17
- */
18
- export interface GraphQLDirectiveExtensions {
19
- [attributeName: string]: unknown;
20
- }
21
- /**
22
- * Directives are used by the GraphQL runtime as a way of modifying execution
23
- * behavior. Type system creators will usually not create these directly.
24
- */
25
- export declare class GraphQLDirective {
26
- name: string;
27
- description: Maybe<string>;
28
- locations: ReadonlyArray<DirectiveLocationEnum>;
29
- args: ReadonlyArray<GraphQLArgument>;
30
- isRepeatable: boolean;
31
- extensions: Maybe<Readonly<GraphQLDirectiveExtensions>>;
32
- astNode: Maybe<DirectiveDefinitionNode>;
33
- constructor(config: Readonly<GraphQLDirectiveConfig>);
34
- toConfig(): GraphQLDirectiveNormalizedConfig;
35
- toString(): string;
36
- toJSON(): string;
37
- get [Symbol.toStringTag](): string;
38
- }
39
- export interface GraphQLDirectiveConfig {
40
- name: string;
41
- description?: Maybe<string>;
42
- locations: ReadonlyArray<DirectiveLocationEnum>;
43
- args?: Maybe<GraphQLFieldConfigArgumentMap>;
44
- isRepeatable?: Maybe<boolean>;
45
- extensions?: Maybe<Readonly<GraphQLDirectiveExtensions>>;
46
- astNode?: Maybe<DirectiveDefinitionNode>;
47
- }
48
- interface GraphQLDirectiveNormalizedConfig extends GraphQLDirectiveConfig {
49
- args: GraphQLFieldConfigArgumentMap;
50
- isRepeatable: boolean;
51
- extensions: Maybe<Readonly<GraphQLDirectiveExtensions>>;
52
- }
53
- /**
54
- * Used to conditionally include fields or fragments.
55
- */
56
- export declare const GraphQLIncludeDirective: GraphQLDirective;
57
- /**
58
- * Used to conditionally skip (exclude) fields or fragments.
59
- */
60
- export declare const GraphQLSkipDirective: GraphQLDirective;
61
- /**
62
- * Constant string used for default reason for a deprecation.
63
- */
64
- export declare const DEFAULT_DEPRECATION_REASON = "No longer supported";
65
- /**
66
- * Used to declare element of a GraphQL schema as deprecated.
67
- */
68
- export declare const GraphQLDeprecatedDirective: GraphQLDirective;
69
- /**
70
- * Used to provide a URL for specifying the behaviour of custom scalar definitions.
71
- */
72
- export declare const GraphQLSpecifiedByDirective: GraphQLDirective;
73
- /**
74
- * The full list of specified directives.
75
- */
76
- export declare const specifiedDirectives: ReadonlyArray<GraphQLDirective>;
77
- export declare function isSpecifiedDirective(directive: GraphQLDirective): boolean;
78
- export {};
79
8
  //# sourceMappingURL=directives.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"directives.d.ts","sourceRoot":"","sources":["../src/directives.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,eAAe,EAEf,qBAAqB,EAErB,6BAA6B,EAC9B,MAAM,SAAS,CAAC;AAMjB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE7C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAI9E;;GAEG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,OAAO,GAAG,SAAS,IAAI,gBAAgB,CAE7E;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,OAAO,GAAG,gBAAgB,CAOpE;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,0BAA0B;IACzC,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC;CAClC;AAED;;;GAGG;AACH,qBAAa,gBAAgB;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,SAAS,EAAE,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAChD,IAAI,EAAE,aAAa,CAAC,eAAe,CAAC,CAAC;IACrC,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,0BAA0B,CAAC,CAAC,CAAC;IACxD,OAAO,EAA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,CAEzE"}
1
+ {"version":3,"file":"directives.d.ts","sourceRoot":"","sources":["../src/directives.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAI3C,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,0BAA0B,EAC1B,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAE5B;;GAEG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,OAAO,GAAG,SAAS,IAAI,gBAAgB,CAE7E;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,OAAO,GAAG,gBAAgB,CAOpE"}
package/lib/directives.js CHANGED
@@ -18,27 +18,24 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var directives_exports = {};
20
20
  __export(directives_exports, {
21
- DEFAULT_DEPRECATION_REASON: () => DEFAULT_DEPRECATION_REASON,
22
- GraphQLDeprecatedDirective: () => GraphQLDeprecatedDirective,
23
- GraphQLDirective: () => GraphQLDirective,
24
- GraphQLIncludeDirective: () => GraphQLIncludeDirective,
25
- GraphQLSkipDirective: () => GraphQLSkipDirective,
26
- GraphQLSpecifiedByDirective: () => GraphQLSpecifiedByDirective,
21
+ GraphQLDeferDirective: () => import_supermassive_ast.GraphQLDeferDirective,
22
+ GraphQLDeprecatedDirective: () => import_supermassive_ast.GraphQLDeprecatedDirective,
23
+ GraphQLIncludeDirective: () => import_supermassive_ast.GraphQLIncludeDirective,
24
+ GraphQLSkipDirective: () => import_supermassive_ast.GraphQLSkipDirective,
25
+ GraphQLSpecifiedByDirective: () => import_supermassive_ast.GraphQLSpecifiedByDirective,
26
+ GraphQLStreamDirective: () => import_supermassive_ast.GraphQLStreamDirective,
27
27
  assertDirective: () => assertDirective,
28
28
  isDirective: () => isDirective,
29
- isSpecifiedDirective: () => isSpecifiedDirective,
30
- specifiedDirectives: () => specifiedDirectives
29
+ isSpecifiedDirective: () => import_supermassive_ast.isSpecifiedDirective,
30
+ specifiedDirectives: () => import_supermassive_ast.specifiedDirectives
31
31
  });
32
32
  module.exports = __toCommonJS(directives_exports);
33
33
  var import_graphql = require("graphql");
34
34
  var import_inspect = require("./jsutils/inspect");
35
- var import_toObjMap = require("./jsutils/toObjMap");
36
- var import_devAssert = require("./jsutils/devAssert");
37
35
  var import_instanceOf = require("./jsutils/instanceOf");
38
- var import_isObjectLike = require("./jsutils/isObjectLike");
39
- var import_definition = require("./definition");
36
+ var import_supermassive_ast = require("./supermassive-ast");
40
37
  function isDirective(directive) {
41
- return (0, import_instanceOf.instanceOf)(directive, GraphQLDirective);
38
+ return (0, import_instanceOf.instanceOf)(directive, import_graphql.GraphQLDirective);
42
39
  }
43
40
  function assertDirective(directive) {
44
41
  if (!isDirective(directive)) {
@@ -48,113 +45,3 @@ function assertDirective(directive) {
48
45
  }
49
46
  return directive;
50
47
  }
51
- class GraphQLDirective {
52
- constructor(config) {
53
- var _a, _b;
54
- this.name = config.name;
55
- this.description = config.description;
56
- this.locations = config.locations;
57
- this.isRepeatable = (_a = config.isRepeatable) != null ? _a : false;
58
- this.extensions = config.extensions && (0, import_toObjMap.toObjMap)(config.extensions);
59
- this.astNode = config.astNode;
60
- (0, import_devAssert.devAssert)(config.name, "Directive must be named.");
61
- (0, import_devAssert.devAssert)(
62
- Array.isArray(config.locations),
63
- `@${config.name} locations must be an Array.`
64
- );
65
- const args = (_b = config.args) != null ? _b : {};
66
- (0, import_devAssert.devAssert)(
67
- (0, import_isObjectLike.isObjectLike)(args) && !Array.isArray(args),
68
- `@${config.name} args must be an object with argument names as keys.`
69
- );
70
- this.args = (0, import_definition.defineArguments)(args);
71
- }
72
- toConfig() {
73
- return {
74
- name: this.name,
75
- description: this.description,
76
- locations: this.locations,
77
- args: (0, import_definition.argsToArgsConfig)(this.args),
78
- isRepeatable: this.isRepeatable,
79
- extensions: this.extensions,
80
- astNode: this.astNode
81
- };
82
- }
83
- toString() {
84
- return "@" + this.name;
85
- }
86
- toJSON() {
87
- return this.toString();
88
- }
89
- get [Symbol.toStringTag]() {
90
- return "GraphQLDirective";
91
- }
92
- }
93
- const GraphQLIncludeDirective = new GraphQLDirective({
94
- name: "include",
95
- description: "Directs the executor to include this field or fragment only when the `if` argument is true.",
96
- locations: [
97
- import_graphql.DirectiveLocation.FIELD,
98
- import_graphql.DirectiveLocation.FRAGMENT_SPREAD,
99
- import_graphql.DirectiveLocation.INLINE_FRAGMENT
100
- ],
101
- args: {
102
- if: {
103
- type: new import_graphql.GraphQLNonNull(import_graphql.GraphQLBoolean),
104
- description: "Included when true."
105
- }
106
- }
107
- });
108
- const GraphQLSkipDirective = new GraphQLDirective({
109
- name: "skip",
110
- description: "Directs the executor to skip this field or fragment when the `if` argument is true.",
111
- locations: [
112
- import_graphql.DirectiveLocation.FIELD,
113
- import_graphql.DirectiveLocation.FRAGMENT_SPREAD,
114
- import_graphql.DirectiveLocation.INLINE_FRAGMENT
115
- ],
116
- args: {
117
- if: {
118
- type: new import_graphql.GraphQLNonNull(import_graphql.GraphQLBoolean),
119
- description: "Skipped when true."
120
- }
121
- }
122
- });
123
- const DEFAULT_DEPRECATION_REASON = "No longer supported";
124
- const GraphQLDeprecatedDirective = new GraphQLDirective({
125
- name: "deprecated",
126
- description: "Marks an element of a GraphQL schema as no longer supported.",
127
- locations: [
128
- import_graphql.DirectiveLocation.FIELD_DEFINITION,
129
- import_graphql.DirectiveLocation.ARGUMENT_DEFINITION,
130
- import_graphql.DirectiveLocation.INPUT_FIELD_DEFINITION,
131
- import_graphql.DirectiveLocation.ENUM_VALUE
132
- ],
133
- args: {
134
- reason: {
135
- type: import_graphql.GraphQLString,
136
- description: "Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",
137
- defaultValue: DEFAULT_DEPRECATION_REASON
138
- }
139
- }
140
- });
141
- const GraphQLSpecifiedByDirective = new GraphQLDirective({
142
- name: "specifiedBy",
143
- description: "Exposes a URL that specifies the behaviour of this scalar.",
144
- locations: [import_graphql.DirectiveLocation.SCALAR],
145
- args: {
146
- url: {
147
- type: new import_graphql.GraphQLNonNull(import_graphql.GraphQLString),
148
- description: "The URL that specifies the behaviour of this scalar."
149
- }
150
- }
151
- });
152
- const specifiedDirectives = Object.freeze([
153
- GraphQLIncludeDirective,
154
- GraphQLSkipDirective,
155
- GraphQLDeprecatedDirective,
156
- GraphQLSpecifiedByDirective
157
- ]);
158
- function isSpecifiedDirective(directive) {
159
- return specifiedDirectives.some(({ name }) => name === directive.name);
160
- }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/directives.ts"],
4
- "sourcesContent": ["import {\n GraphQLString,\n GraphQLBoolean,\n GraphQLArgument,\n GraphQLNonNull,\n DirectiveLocationEnum,\n DirectiveLocation,\n GraphQLFieldConfigArgumentMap,\n} from \"graphql\";\nimport { inspect } from \"./jsutils/inspect\";\nimport { toObjMap } from \"./jsutils/toObjMap\";\nimport { devAssert } from \"./jsutils/devAssert\";\nimport { instanceOf } from \"./jsutils/instanceOf\";\nimport { isObjectLike } from \"./jsutils/isObjectLike\";\nimport type { Maybe } from \"./jsutils/Maybe\";\n\nimport type { DirectiveDefinitionNode } from \"@graphitation/supermassive-ast\";\n\nimport { defineArguments, argsToArgsConfig } from \"./definition\";\n\n/**\n * Test if the given value is a GraphQL directive.\n */\nexport function isDirective(directive: unknown): directive is GraphQLDirective {\n return instanceOf(directive, GraphQLDirective);\n}\n\nexport function assertDirective(directive: unknown): GraphQLDirective {\n if (!isDirective(directive)) {\n throw new Error(\n `Expected ${inspect(directive)} to be a GraphQL directive.`,\n );\n }\n return directive;\n}\n\n/**\n * Custom extensions\n *\n * @remarks\n * Use a unique identifier name for your extension, for example the name of\n * your library or project. Do not use a shortened identifier as this increases\n * the risk of conflicts. We recommend you add at most one extension field,\n * an object which can contain all the values you need.\n */\nexport interface GraphQLDirectiveExtensions {\n [attributeName: string]: unknown;\n}\n\n/**\n * Directives are used by the GraphQL runtime as a way of modifying execution\n * behavior. Type system creators will usually not create these directly.\n */\nexport class GraphQLDirective {\n name: string;\n description: Maybe<string>;\n locations: ReadonlyArray<DirectiveLocationEnum>;\n args: ReadonlyArray<GraphQLArgument>;\n isRepeatable: boolean;\n extensions: Maybe<Readonly<GraphQLDirectiveExtensions>>;\n astNode: Maybe<DirectiveDefinitionNode>;\n\n constructor(config: Readonly<GraphQLDirectiveConfig>) {\n this.name = config.name;\n this.description = config.description;\n this.locations = config.locations;\n this.isRepeatable = config.isRepeatable ?? false;\n this.extensions = config.extensions && toObjMap(config.extensions);\n this.astNode = config.astNode;\n\n devAssert(config.name, \"Directive must be named.\");\n devAssert(\n Array.isArray(config.locations),\n `@${config.name} locations must be an Array.`,\n );\n\n const args = config.args ?? {};\n devAssert(\n isObjectLike(args) && !Array.isArray(args),\n `@${config.name} args must be an object with argument names as keys.`,\n );\n\n this.args = defineArguments(args);\n }\n\n toConfig(): GraphQLDirectiveNormalizedConfig {\n return {\n name: this.name,\n description: this.description,\n locations: this.locations,\n args: argsToArgsConfig(this.args),\n isRepeatable: this.isRepeatable,\n extensions: this.extensions,\n astNode: this.astNode,\n };\n }\n\n toString(): string {\n return \"@\" + this.name;\n }\n\n toJSON(): string {\n return this.toString();\n }\n\n get [Symbol.toStringTag]() {\n return \"GraphQLDirective\";\n }\n}\n\nexport interface GraphQLDirectiveConfig {\n name: string;\n description?: Maybe<string>;\n locations: ReadonlyArray<DirectiveLocationEnum>;\n args?: Maybe<GraphQLFieldConfigArgumentMap>;\n isRepeatable?: Maybe<boolean>;\n extensions?: Maybe<Readonly<GraphQLDirectiveExtensions>>;\n astNode?: Maybe<DirectiveDefinitionNode>;\n}\n\ninterface GraphQLDirectiveNormalizedConfig extends GraphQLDirectiveConfig {\n args: GraphQLFieldConfigArgumentMap;\n isRepeatable: boolean;\n extensions: Maybe<Readonly<GraphQLDirectiveExtensions>>;\n}\n\n/**\n * Used to conditionally include fields or fragments.\n */\nexport const GraphQLIncludeDirective: GraphQLDirective = new GraphQLDirective({\n name: \"include\",\n description:\n \"Directs the executor to include this field or fragment only when the `if` argument is true.\",\n locations: [\n DirectiveLocation.FIELD,\n DirectiveLocation.FRAGMENT_SPREAD,\n DirectiveLocation.INLINE_FRAGMENT,\n ],\n args: {\n if: {\n type: new GraphQLNonNull(GraphQLBoolean),\n description: \"Included when true.\",\n },\n },\n});\n\n/**\n * Used to conditionally skip (exclude) fields or fragments.\n */\nexport const GraphQLSkipDirective: GraphQLDirective = new GraphQLDirective({\n name: \"skip\",\n description:\n \"Directs the executor to skip this field or fragment when the `if` argument is true.\",\n locations: [\n DirectiveLocation.FIELD,\n DirectiveLocation.FRAGMENT_SPREAD,\n DirectiveLocation.INLINE_FRAGMENT,\n ],\n args: {\n if: {\n type: new GraphQLNonNull(GraphQLBoolean),\n description: \"Skipped when true.\",\n },\n },\n});\n\n/**\n * Constant string used for default reason for a deprecation.\n */\nexport const DEFAULT_DEPRECATION_REASON = \"No longer supported\";\n\n/**\n * Used to declare element of a GraphQL schema as deprecated.\n */\nexport const GraphQLDeprecatedDirective: GraphQLDirective =\n new GraphQLDirective({\n name: \"deprecated\",\n description: \"Marks an element of a GraphQL schema as no longer supported.\",\n locations: [\n DirectiveLocation.FIELD_DEFINITION,\n DirectiveLocation.ARGUMENT_DEFINITION,\n DirectiveLocation.INPUT_FIELD_DEFINITION,\n DirectiveLocation.ENUM_VALUE,\n ],\n args: {\n reason: {\n type: GraphQLString,\n description:\n \"Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).\",\n defaultValue: DEFAULT_DEPRECATION_REASON,\n },\n },\n });\n\n/**\n * Used to provide a URL for specifying the behaviour of custom scalar definitions.\n */\nexport const GraphQLSpecifiedByDirective: GraphQLDirective =\n new GraphQLDirective({\n name: \"specifiedBy\",\n description: \"Exposes a URL that specifies the behaviour of this scalar.\",\n locations: [DirectiveLocation.SCALAR],\n args: {\n url: {\n type: new GraphQLNonNull(GraphQLString),\n description: \"The URL that specifies the behaviour of this scalar.\",\n },\n },\n });\n\n/**\n * The full list of specified directives.\n */\nexport const specifiedDirectives: ReadonlyArray<GraphQLDirective> =\n Object.freeze([\n GraphQLIncludeDirective,\n GraphQLSkipDirective,\n GraphQLDeprecatedDirective,\n GraphQLSpecifiedByDirective,\n ]);\n\nexport function isSpecifiedDirective(directive: GraphQLDirective): boolean {\n return specifiedDirectives.some(({ name }) => name === directive.name);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAQO;AACP,qBAAwB;AACxB,sBAAyB;AACzB,uBAA0B;AAC1B,wBAA2B;AAC3B,0BAA6B;AAK7B,wBAAkD;AAK3C,SAAS,YAAY,WAAmD;AAC7E,aAAO,8BAAW,WAAW,gBAAgB;AAC/C;AAEO,SAAS,gBAAgB,WAAsC;AACpE,MAAI,CAAC,YAAY,SAAS,GAAG;AAC3B,UAAM,IAAI;AAAA,MACR,gBAAY,wBAAQ,SAAS;AAAA,IAC/B;AAAA,EACF;AACA,SAAO;AACT;AAmBO,MAAM,iBAAiB;AAAA,EAS5B,YAAY,QAA0C;AA9DxD;AA+DI,SAAK,OAAO,OAAO;AACnB,SAAK,cAAc,OAAO;AAC1B,SAAK,YAAY,OAAO;AACxB,SAAK,gBAAe,YAAO,iBAAP,YAAuB;AAC3C,SAAK,aAAa,OAAO,kBAAc,0BAAS,OAAO,UAAU;AACjE,SAAK,UAAU,OAAO;AAEtB,oCAAU,OAAO,MAAM,0BAA0B;AACjD;AAAA,MACE,MAAM,QAAQ,OAAO,SAAS;AAAA,MAC9B,IAAI,OAAO;AAAA,IACb;AAEA,UAAM,QAAO,YAAO,SAAP,YAAe,C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ACT,iCAAkB;AAAA,IAClB,iCAAkB;AAAA,IAClB,iCAAkB;AAAA,IAClB,iCAAkB;AAAA,EACpB;AAAA,EACA,MAAM;AAAA,IACJ,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,aACE;AAAA,MACF,cAAc;AAAA,IAChB;AAAA,EACF;AACF,CAAC;AAKI,MAAM,8BACX,IAAI,iBAAiB;AAAA,EACnB,MAAM;AAAA,EACN,aAAa;AAAA,EACb,WAAW,CAAC,iCAAkB,MAAM;AAAA,EACpC,MAAM;AAAA,IACJ,KAAK;AAAA,MACH,MAAM,IAAI,8BAAe,4BAAa;AAAA,MACtC,aAAa;AAAA,IACf;AAAA,EACF;AACF,CAAC;AAKI,MAAM,sBACX,OAAO,OAAO;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEI,SAAS,qBAAqB,WAAsC;AACzE,SAAO,oBAAoB,KAAK,CAAC,EAAE,KAAK,MAAM,SAAS,UAAU,IAAI;AACvE;",
4
+ "sourcesContent": ["import { GraphQLDirective } from \"graphql\";\nimport { inspect } from \"./jsutils/inspect\";\nimport { instanceOf } from \"./jsutils/instanceOf\";\n\nexport {\n specifiedDirectives,\n isSpecifiedDirective,\n GraphQLIncludeDirective,\n GraphQLSkipDirective,\n GraphQLDeprecatedDirective,\n GraphQLSpecifiedByDirective,\n GraphQLDeferDirective,\n GraphQLStreamDirective,\n} from \"./supermassive-ast\";\n\n/**\n * Test if the given value is a GraphQL directive.\n */\nexport function isDirective(directive: unknown): directive is GraphQLDirective {\n return instanceOf(directive, GraphQLDirective);\n}\n\nexport function assertDirective(directive: unknown): GraphQLDirective {\n if (!isDirective(directive)) {\n throw new Error(\n `Expected ${inspect(directive)} to be a GraphQL directive.`,\n );\n }\n return directive;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAiC;AACjC,qBAAwB;AACxB,wBAA2B;AAE3B,8BASO;AAKA,SAAS,YAAY,WAAmD;AAC7E,aAAO,8BAAW,WAAW,+BAAgB;AAC/C;AAEO,SAAS,gBAAgB,WAAsC;AACpE,MAAI,CAAC,YAAY,SAAS,GAAG;AAC3B,UAAM,IAAI;AAAA,MACR,gBAAY,wBAAQ,SAAS;AAAA,IAC/B;AAAA,EACF;AACA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -1,16 +1,17 @@
1
1
  // src/directives.ts
2
- import {
3
- GraphQLString,
4
- GraphQLBoolean,
5
- GraphQLNonNull,
6
- DirectiveLocation
7
- } from "graphql";
2
+ import { GraphQLDirective } from "graphql";
8
3
  import { inspect } from "./jsutils/inspect.mjs";
9
- import { toObjMap } from "./jsutils/toObjMap.mjs";
10
- import { devAssert } from "./jsutils/devAssert.mjs";
11
4
  import { instanceOf } from "./jsutils/instanceOf.mjs";
12
- import { isObjectLike } from "./jsutils/isObjectLike.mjs";
13
- import { defineArguments, argsToArgsConfig } from "./definition.mjs";
5
+ import {
6
+ specifiedDirectives,
7
+ isSpecifiedDirective,
8
+ GraphQLIncludeDirective,
9
+ GraphQLSkipDirective,
10
+ GraphQLDeprecatedDirective,
11
+ GraphQLSpecifiedByDirective,
12
+ GraphQLDeferDirective,
13
+ GraphQLStreamDirective
14
+ } from "./supermassive-ast/index.mjs";
14
15
  function isDirective(directive) {
15
16
  return instanceOf(directive, GraphQLDirective);
16
17
  }
@@ -22,123 +23,13 @@ function assertDirective(directive) {
22
23
  }
23
24
  return directive;
24
25
  }
25
- var GraphQLDirective = class {
26
- constructor(config) {
27
- var _a, _b;
28
- this.name = config.name;
29
- this.description = config.description;
30
- this.locations = config.locations;
31
- this.isRepeatable = (_a = config.isRepeatable) != null ? _a : false;
32
- this.extensions = config.extensions && toObjMap(config.extensions);
33
- this.astNode = config.astNode;
34
- devAssert(config.name, "Directive must be named.");
35
- devAssert(
36
- Array.isArray(config.locations),
37
- `@${config.name} locations must be an Array.`
38
- );
39
- const args = (_b = config.args) != null ? _b : {};
40
- devAssert(
41
- isObjectLike(args) && !Array.isArray(args),
42
- `@${config.name} args must be an object with argument names as keys.`
43
- );
44
- this.args = defineArguments(args);
45
- }
46
- toConfig() {
47
- return {
48
- name: this.name,
49
- description: this.description,
50
- locations: this.locations,
51
- args: argsToArgsConfig(this.args),
52
- isRepeatable: this.isRepeatable,
53
- extensions: this.extensions,
54
- astNode: this.astNode
55
- };
56
- }
57
- toString() {
58
- return "@" + this.name;
59
- }
60
- toJSON() {
61
- return this.toString();
62
- }
63
- get [Symbol.toStringTag]() {
64
- return "GraphQLDirective";
65
- }
66
- };
67
- var GraphQLIncludeDirective = new GraphQLDirective({
68
- name: "include",
69
- description: "Directs the executor to include this field or fragment only when the `if` argument is true.",
70
- locations: [
71
- DirectiveLocation.FIELD,
72
- DirectiveLocation.FRAGMENT_SPREAD,
73
- DirectiveLocation.INLINE_FRAGMENT
74
- ],
75
- args: {
76
- if: {
77
- type: new GraphQLNonNull(GraphQLBoolean),
78
- description: "Included when true."
79
- }
80
- }
81
- });
82
- var GraphQLSkipDirective = new GraphQLDirective({
83
- name: "skip",
84
- description: "Directs the executor to skip this field or fragment when the `if` argument is true.",
85
- locations: [
86
- DirectiveLocation.FIELD,
87
- DirectiveLocation.FRAGMENT_SPREAD,
88
- DirectiveLocation.INLINE_FRAGMENT
89
- ],
90
- args: {
91
- if: {
92
- type: new GraphQLNonNull(GraphQLBoolean),
93
- description: "Skipped when true."
94
- }
95
- }
96
- });
97
- var DEFAULT_DEPRECATION_REASON = "No longer supported";
98
- var GraphQLDeprecatedDirective = new GraphQLDirective({
99
- name: "deprecated",
100
- description: "Marks an element of a GraphQL schema as no longer supported.",
101
- locations: [
102
- DirectiveLocation.FIELD_DEFINITION,
103
- DirectiveLocation.ARGUMENT_DEFINITION,
104
- DirectiveLocation.INPUT_FIELD_DEFINITION,
105
- DirectiveLocation.ENUM_VALUE
106
- ],
107
- args: {
108
- reason: {
109
- type: GraphQLString,
110
- description: "Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).",
111
- defaultValue: DEFAULT_DEPRECATION_REASON
112
- }
113
- }
114
- });
115
- var GraphQLSpecifiedByDirective = new GraphQLDirective({
116
- name: "specifiedBy",
117
- description: "Exposes a URL that specifies the behaviour of this scalar.",
118
- locations: [DirectiveLocation.SCALAR],
119
- args: {
120
- url: {
121
- type: new GraphQLNonNull(GraphQLString),
122
- description: "The URL that specifies the behaviour of this scalar."
123
- }
124
- }
125
- });
126
- var specifiedDirectives = Object.freeze([
127
- GraphQLIncludeDirective,
128
- GraphQLSkipDirective,
129
- GraphQLDeprecatedDirective,
130
- GraphQLSpecifiedByDirective
131
- ]);
132
- function isSpecifiedDirective(directive) {
133
- return specifiedDirectives.some(({ name }) => name === directive.name);
134
- }
135
26
  export {
136
- DEFAULT_DEPRECATION_REASON,
27
+ GraphQLDeferDirective,
137
28
  GraphQLDeprecatedDirective,
138
- GraphQLDirective,
139
29
  GraphQLIncludeDirective,
140
30
  GraphQLSkipDirective,
141
31
  GraphQLSpecifiedByDirective,
32
+ GraphQLStreamDirective,
142
33
  assertDirective,
143
34
  isDirective,
144
35
  isSpecifiedDirective,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/directives.ts"],
4
- "sourcesContent": ["import {\n GraphQLString,\n GraphQLBoolean,\n GraphQLArgument,\n GraphQLNonNull,\n DirectiveLocationEnum,\n DirectiveLocation,\n GraphQLFieldConfigArgumentMap,\n} from \"graphql\";\nimport { inspect } from \"./jsutils/inspect\";\nimport { toObjMap } from \"./jsutils/toObjMap\";\nimport { devAssert } from \"./jsutils/devAssert\";\nimport { instanceOf } from \"./jsutils/instanceOf\";\nimport { isObjectLike } from \"./jsutils/isObjectLike\";\nimport type { Maybe } from \"./jsutils/Maybe\";\n\nimport type { DirectiveDefinitionNode } from \"@graphitation/supermassive-ast\";\n\nimport { defineArguments, argsToArgsConfig } from \"./definition\";\n\n/**\n * Test if the given value is a GraphQL directive.\n */\nexport function isDirective(directive: unknown): directive is GraphQLDirective {\n return instanceOf(directive, GraphQLDirective);\n}\n\nexport function assertDirective(directive: unknown): GraphQLDirective {\n if (!isDirective(directive)) {\n throw new Error(\n `Expected ${inspect(directive)} to be a GraphQL directive.`,\n );\n }\n return directive;\n}\n\n/**\n * Custom extensions\n *\n * @remarks\n * Use a unique identifier name for your extension, for example the name of\n * your library or project. Do not use a shortened identifier as this increases\n * the risk of conflicts. We recommend you add at most one extension field,\n * an object which can contain all the values you need.\n */\nexport interface GraphQLDirectiveExtensions {\n [attributeName: string]: unknown;\n}\n\n/**\n * Directives are used by the GraphQL runtime as a way of modifying execution\n * behavior. Type system creators will usually not create these directly.\n */\nexport class GraphQLDirective {\n name: string;\n description: Maybe<string>;\n locations: ReadonlyArray<DirectiveLocationEnum>;\n args: ReadonlyArray<GraphQLArgument>;\n isRepeatable: boolean;\n extensions: Maybe<Readonly<GraphQLDirectiveExtensions>>;\n astNode: Maybe<DirectiveDefinitionNode>;\n\n constructor(config: Readonly<GraphQLDirectiveConfig>) {\n this.name = config.name;\n this.description = config.description;\n this.locations = config.locations;\n this.isRepeatable = config.isRepeatable ?? false;\n this.extensions = config.extensions && toObjMap(config.extensions);\n this.astNode = config.astNode;\n\n devAssert(config.name, \"Directive must be named.\");\n devAssert(\n Array.isArray(config.locations),\n `@${config.name} locations must be an Array.`,\n );\n\n const args = config.args ?? {};\n devAssert(\n isObjectLike(args) && !Array.isArray(args),\n `@${config.name} args must be an object with argument names as keys.`,\n );\n\n this.args = defineArguments(args);\n }\n\n toConfig(): GraphQLDirectiveNormalizedConfig {\n return {\n name: this.name,\n description: this.description,\n locations: this.locations,\n args: argsToArgsConfig(this.args),\n isRepeatable: this.isRepeatable,\n extensions: this.extensions,\n astNode: this.astNode,\n };\n }\n\n toString(): string {\n return \"@\" + this.name;\n }\n\n toJSON(): string {\n return this.toString();\n }\n\n get [Symbol.toStringTag]() {\n return \"GraphQLDirective\";\n }\n}\n\nexport interface GraphQLDirectiveConfig {\n name: string;\n description?: Maybe<string>;\n locations: ReadonlyArray<DirectiveLocationEnum>;\n args?: Maybe<GraphQLFieldConfigArgumentMap>;\n isRepeatable?: Maybe<boolean>;\n extensions?: Maybe<Readonly<GraphQLDirectiveExtensions>>;\n astNode?: Maybe<DirectiveDefinitionNode>;\n}\n\ninterface GraphQLDirectiveNormalizedConfig extends GraphQLDirectiveConfig {\n args: GraphQLFieldConfigArgumentMap;\n isRepeatable: boolean;\n extensions: Maybe<Readonly<GraphQLDirectiveExtensions>>;\n}\n\n/**\n * Used to conditionally include fields or fragments.\n */\nexport const GraphQLIncludeDirective: GraphQLDirective = new GraphQLDirective({\n name: \"include\",\n description:\n \"Directs the executor to include this field or fragment only when the `if` argument is true.\",\n locations: [\n DirectiveLocation.FIELD,\n DirectiveLocation.FRAGMENT_SPREAD,\n DirectiveLocation.INLINE_FRAGMENT,\n ],\n args: {\n if: {\n type: new GraphQLNonNull(GraphQLBoolean),\n description: \"Included when true.\",\n },\n },\n});\n\n/**\n * Used to conditionally skip (exclude) fields or fragments.\n */\nexport const GraphQLSkipDirective: GraphQLDirective = new GraphQLDirective({\n name: \"skip\",\n description:\n \"Directs the executor to skip this field or fragment when the `if` argument is true.\",\n locations: [\n DirectiveLocation.FIELD,\n DirectiveLocation.FRAGMENT_SPREAD,\n DirectiveLocation.INLINE_FRAGMENT,\n ],\n args: {\n if: {\n type: new GraphQLNonNull(GraphQLBoolean),\n description: \"Skipped when true.\",\n },\n },\n});\n\n/**\n * Constant string used for default reason for a deprecation.\n */\nexport const DEFAULT_DEPRECATION_REASON = \"No longer supported\";\n\n/**\n * Used to declare element of a GraphQL schema as deprecated.\n */\nexport const GraphQLDeprecatedDirective: GraphQLDirective =\n new GraphQLDirective({\n name: \"deprecated\",\n description: \"Marks an element of a GraphQL schema as no longer supported.\",\n locations: [\n DirectiveLocation.FIELD_DEFINITION,\n DirectiveLocation.ARGUMENT_DEFINITION,\n DirectiveLocation.INPUT_FIELD_DEFINITION,\n DirectiveLocation.ENUM_VALUE,\n ],\n args: {\n reason: {\n type: GraphQLString,\n description:\n \"Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).\",\n defaultValue: DEFAULT_DEPRECATION_REASON,\n },\n },\n });\n\n/**\n * Used to provide a URL for specifying the behaviour of custom scalar definitions.\n */\nexport const GraphQLSpecifiedByDirective: GraphQLDirective =\n new GraphQLDirective({\n name: \"specifiedBy\",\n description: \"Exposes a URL that specifies the behaviour of this scalar.\",\n locations: [DirectiveLocation.SCALAR],\n args: {\n url: {\n type: new GraphQLNonNull(GraphQLString),\n description: \"The URL that specifies the behaviour of this scalar.\",\n },\n },\n });\n\n/**\n * The full list of specified directives.\n */\nexport const specifiedDirectives: ReadonlyArray<GraphQLDirective> =\n Object.freeze([\n GraphQLIncludeDirective,\n GraphQLSkipDirective,\n GraphQLDeprecatedDirective,\n GraphQLSpecifiedByDirective,\n ]);\n\nexport function isSpecifiedDirective(directive: GraphQLDirective): boolean {\n return specifiedDirectives.some(({ name }) => name === directive.name);\n}\n"],
5
- "mappings": ";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EAEA;AAAA,EAEA;AAAA,OAEK;AACP,SAAS,eAAe;AACxB,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAK7B,SAAS,iBAAiB,wBAAwB;AAK3C,SAAS,YAAY,WAAmD;AAC7E,SAAO,WAAW,WAAW,gBAAgB;AAC/C;AAEO,SAAS,gBAAgB,WAAsC;AACpE,MAAI,CAAC,YAAY,SAAS,GAAG;AAC3B,UAAM,IAAI;AAAA,MACR,YAAY,QAAQ,SAAS;AAAA,IAC/B;AAAA,EACF;AACA,SAAO;AACT;AAmBO,IAAM,mBAAN,MAAuB;AAAA,E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B;AAAA,EACzE,MAAM;AAAA,EACN,aACE;AAAA,EACF,WAAW;AAAA,IACT,kBAAkB;AAAA,IAClB,kBAAkB;AAAA,IAClB,kBAAkB;AAAA,EACpB;AAAA,EACA,MAAM;AAAA,IACJ,IAAI;AAAA,MACF,MAAM,IAAI,eAAe,cAAc;AAAA,MACvC,aAAa;AAAA,IACf;AAAA,EACF;AACF,CAAC;AAKM,IAAM,6BAA6B;AAKnC,IAAM,6BACX,IAAI,iBAAiB;AAAA,EACnB,MAAM;AAAA,EACN,aAAa;AAAA,EACb,WAAW;AAAA,IACT,kBAAkB;AAAA,IAClB,kBAAkB;AAAA,IAClB,kBAAkB;AAAA,IAClB,kBAAkB;AAAA,EACpB;AAAA,EACA,MAAM;AAAA,IACJ,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,aACE;AAAA,MACF,cAAc;AAAA,IAChB;AAAA,EACF;AACF,CAAC;AAKI,IAAM,8BACX,IAAI,iBAAiB;AAAA,EACnB,MAAM;AAAA,EACN,aAAa;AAAA,EACb,WAAW,CAAC,kBAAkB,MAAM;AAAA,EACpC,MAAM;AAAA,IACJ,KAAK;AAAA,MACH,MAAM,IAAI,eAAe,aAAa;AAAA,MACtC,aAAa;AAAA,IACf;AAAA,EACF;AACF,CAAC;AAKI,IAAM,sBACX,OAAO,OAAO;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEI,SAAS,qBAAqB,WAAsC;AACzE,SAAO,oBAAoB,KAAK,CAAC,EAAE,KAAK,MAAM,SAAS,UAAU,IAAI;AACvE;",
4
+ "sourcesContent": ["import { GraphQLDirective } from \"graphql\";\nimport { inspect } from \"./jsutils/inspect\";\nimport { instanceOf } from \"./jsutils/instanceOf\";\n\nexport {\n specifiedDirectives,\n isSpecifiedDirective,\n GraphQLIncludeDirective,\n GraphQLSkipDirective,\n GraphQLDeprecatedDirective,\n GraphQLSpecifiedByDirective,\n GraphQLDeferDirective,\n GraphQLStreamDirective,\n} from \"./supermassive-ast\";\n\n/**\n * Test if the given value is a GraphQL directive.\n */\nexport function isDirective(directive: unknown): directive is GraphQLDirective {\n return instanceOf(directive, GraphQLDirective);\n}\n\nexport function assertDirective(directive: unknown): GraphQLDirective {\n if (!isDirective(directive)) {\n throw new Error(\n `Expected ${inspect(directive)} to be a GraphQL directive.`,\n );\n }\n return directive;\n}\n"],
5
+ "mappings": ";AAAA,SAAS,wBAAwB;AACjC,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAE3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAKA,SAAS,YAAY,WAAmD;AAC7E,SAAO,WAAW,WAAW,gBAAgB;AAC/C;AAEO,SAAS,gBAAgB,WAAsC;AACpE,MAAI,CAAC,YAAY,SAAS,GAAG;AAC3B,UAAM,IAAI;AAAA,MACR,YAAY,QAAQ,SAAS;AAAA,IAC/B;AAAA,EACF;AACA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
@@ -1,5 +1,6 @@
1
1
  import { GraphQLError } from "graphql";
2
- import { DocumentNode, FieldNode, FragmentDefinitionNode, OperationDefinitionNode, OperationTypeDefinitionNode, TypeNode } from "@graphitation/supermassive-ast";
2
+ import { DocumentNode, FragmentDefinitionNode, OperationDefinitionNode, OperationTypeDefinitionNode, TypeNode } from "./supermassive-ast";
3
+ import { FieldGroup } from "./collectFields";
3
4
  import type { Maybe } from "./jsutils/Maybe";
4
5
  import type { ObjMap } from "./jsutils/ObjMap";
5
6
  import type { Path } from "./jsutils/Path";
@@ -36,14 +37,17 @@ export interface ExecutionContext {
36
37
  fragments: ObjMap<FragmentDefinitionNode>;
37
38
  rootValue: unknown;
38
39
  contextValue: unknown;
40
+ buildContextValue?: (contextValue?: unknown) => unknown;
39
41
  operation: OperationDefinitionNode;
40
42
  variableValues: {
41
43
  [variable: string]: unknown;
42
44
  };
43
45
  fieldResolver: FunctionFieldResolver<unknown, unknown>;
44
46
  typeResolver: TypeResolver<unknown, unknown>;
47
+ subscribeFieldResolver: FunctionFieldResolver<unknown, unknown>;
45
48
  errors: Array<GraphQLError>;
46
49
  fieldExecutionHooks?: ExecutionHooks;
50
+ subsequentPayloads: Set<IncrementalDataRecord>;
47
51
  }
48
52
  /**
49
53
  * Implements the "Executing requests" section of the GraphQL specification.
@@ -65,21 +69,10 @@ export declare function executeWithoutSchema(args: ExecutionWithoutSchemaArgs):
65
69
  export declare function assertValidExecutionArguments(document: DocumentNode, rawVariableValues: Maybe<{
66
70
  [variable: string]: unknown;
67
71
  }>): void;
68
- /**
69
- * Constructs a ExecutionContext object from the arguments passed to
70
- * execute, which we will pass throughout the other execution methods.
71
- *
72
- * Throws a GraphQLError if a valid execution context cannot be created.
73
- *
74
- * @internal
75
- */
76
- export declare function buildExecutionContext(resolvers: Resolvers, document: DocumentNode, rootValue: unknown, contextValue: unknown, rawVariableValues: Maybe<{
77
- [variable: string]: unknown;
78
- }>, operationName: Maybe<string>, fieldResolver: Maybe<FunctionFieldResolver<unknown, unknown>>, typeResolver?: Maybe<TypeResolver<unknown, unknown>>, fieldExecutionHooks?: ExecutionHooks): Array<GraphQLError> | ExecutionContext;
79
72
  /**
80
73
  * @internal
81
74
  */
82
- export declare function buildResolveInfo(exeContext: ExecutionContext, fieldName: string, fieldNodes: Array<FieldNode>, parentTypeName: string, returnTypeName: string, returnTypeNode: TypeNode, path: Path): ResolveInfo;
75
+ export declare function buildResolveInfo(exeContext: ExecutionContext, fieldName: string, fieldGroup: FieldGroup, parentTypeName: string, returnTypeName: string, returnTypeNode: TypeNode, path: Path): ResolveInfo;
83
76
  /**
84
77
  * If a resolveType function is not given, then a default resolve behavior is
85
78
  * used which attempts two strategies:
@@ -99,4 +92,48 @@ export declare const defaultTypeResolver: TypeResolver<unknown, unknown>;
99
92
  */
100
93
  export declare const defaultFieldResolver: FunctionFieldResolver<unknown, unknown>;
101
94
  export declare function getOperationRootTypeName(operation: OperationDefinitionNode | OperationTypeDefinitionNode): string;
95
+ export type IncrementalDataRecord = DeferredFragmentRecord | StreamItemsRecord;
96
+ declare class DeferredFragmentRecord {
97
+ type: "defer";
98
+ errors: Array<GraphQLError>;
99
+ label: string | undefined;
100
+ path: Array<string | number>;
101
+ promise: Promise<void>;
102
+ data: ObjMap<unknown> | null;
103
+ parentContext: IncrementalDataRecord | undefined;
104
+ isCompleted: boolean;
105
+ _exeContext: ExecutionContext;
106
+ _resolve?: (arg: PromiseOrValue<ObjMap<unknown> | null>) => void;
107
+ constructor(opts: {
108
+ label: string | undefined;
109
+ path: Path | undefined;
110
+ parentContext: IncrementalDataRecord | undefined;
111
+ exeContext: ExecutionContext;
112
+ });
113
+ addData(data: PromiseOrValue<ObjMap<unknown> | null>): void;
114
+ }
115
+ declare class StreamItemsRecord {
116
+ type: "stream";
117
+ errors: Array<GraphQLError>;
118
+ label: string | undefined;
119
+ path: Array<string | number>;
120
+ items: Array<unknown> | null;
121
+ promise: Promise<void>;
122
+ parentContext: IncrementalDataRecord | undefined;
123
+ asyncIterator: AsyncIterator<unknown> | undefined;
124
+ isCompletedAsyncIterator?: boolean;
125
+ isCompleted: boolean;
126
+ _exeContext: ExecutionContext;
127
+ _resolve?: (arg: PromiseOrValue<Array<unknown> | null>) => void;
128
+ constructor(opts: {
129
+ label: string | undefined;
130
+ path: Path | undefined;
131
+ asyncIterator?: AsyncIterator<unknown>;
132
+ parentContext: IncrementalDataRecord | undefined;
133
+ exeContext: ExecutionContext;
134
+ });
135
+ addItems(items: PromiseOrValue<Array<unknown> | null>): void;
136
+ setIsCompletedAsyncIterator(): void;
137
+ }
138
+ export {};
102
139
  //# sourceMappingURL=executeWithoutSchema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"executeWithoutSchema.d.ts","sourceRoot":"","sources":["../src/executeWithoutSchema.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,YAAY,EAOb,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,YAAY,EACZ,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