@conduit-client/generator-ts 3.17.1 → 3.17.3

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/v1/index.js CHANGED
@@ -3027,7 +3027,7 @@ class ImperativeAdapterBindingGenerator {
3027
3027
  const requiresTypeRegistry = this.commandModel.cacheStrategy.type === "normalized" || this.commandModel.invalidationConfigs.length > 0;
3028
3028
  const typeRegistry = requiresTypeRegistry ? "typeRegistry," : "";
3029
3029
  return code`const ${this.localCommandConstructorName} = services.instrumentCommand(${this.classBuilderImport}(${servicesName}.${this.commandModel.serviceDependencies.baseClass.localName}), '${this.commandModel.className}');
3030
- const ${this.binding.identifier}=${this.invoker}<Parameters<typeof ${this.binding.identifier}>,${this.responseTypeCode}>(
3030
+ const ${this.binding.identifier}=${this.invoker}<Parameters<BindingsExports["${this.binding.identifier}"]>,${this.responseTypeCode}>(
3031
3031
  ({params,assertIsValid})=>{
3032
3032
  const config=params[0];
3033
3033
  const options=params[1];
@@ -3286,7 +3286,7 @@ class GraphQLImperativeAdapterBindingGenerator {
3286
3286
  }
3287
3287
  buildInvocation(servicesName = "services") {
3288
3288
  return code`const ${this.localCommandConstructorName} = services.instrumentCommand(${this.classBuilderImport}(${servicesName}.${this.commandModel.serviceDependencies.baseClass.localName}), '${this.commandModel.className}');
3289
- const ${this.binding.identifier}=${this.invoker}<Parameters<typeof ${this.binding.identifier}>>(
3289
+ const ${this.binding.identifier}=${this.invoker}<Parameters<BindingsExports["${this.binding.identifier}"]>>(
3290
3290
  ({params,assertIsValid})=>{
3291
3291
  const config=params[0];
3292
3292
  const options=params[1];
@@ -3412,7 +3412,7 @@ class GraphQLMutationAdapterBindingGenerator {
3412
3412
  }
3413
3413
  buildInvocation(servicesName = "services") {
3414
3414
  return code`const ${this.localCommandConstructorName} = services.instrumentCommand(${this.classBuilderImport}(${servicesName}.${this.commandModel.serviceDependencies.baseClass.localName}), '${this.commandModel.className}');
3415
- const ${this.binding.identifier}=${this.invoker}<Parameters<typeof ${this.binding.identifier}>>(
3415
+ const ${this.binding.identifier}=${this.invoker}<Parameters<BindingsExports["${this.binding.identifier}"]>>(
3416
3416
  ({params,assertIsValid})=>{
3417
3417
  const config=params[0];
3418
3418
  const options=params[1];
@@ -3798,6 +3798,8 @@ class BindingsGenerator {
3798
3798
  const wrapperFilename = "artifacts/bindings.ts";
3799
3799
  const wrapperFile = this.services.file.build(wrapperFilename);
3800
3800
  wrapperFile.template = this.wrapperTemplate;
3801
+ const CUSTOM_TYPE_REGISTRY_PARAM = "customTypeRegistry";
3802
+ const CUSTOM_GRAPHQL_TYPE_REGISTRY_PARAM = "customGraphqlTypeRegistry";
3801
3803
  let typeRegistryRef;
3802
3804
  let graphqlTypeRegistryRef;
3803
3805
  if (this.hasRESTNormalization) {
@@ -3805,11 +3807,11 @@ class BindingsGenerator {
3805
3807
  typeRegistryRef = typeRegistryGenerator.build();
3806
3808
  coreFile.pushTo(
3807
3809
  this.initGeneratedBindingsExtraParamsSymbol,
3808
- code`, typeRegistry?: ${typeRegistryRef}`
3810
+ code`, ${CUSTOM_TYPE_REGISTRY_PARAM}?: ${typeRegistryRef}`
3809
3811
  );
3810
3812
  coreFile.pushTo(
3811
3813
  this.typeRegistryInstantiationSymbol,
3812
- code`typeRegistry ??= new ${typeRegistryRef}(services);`
3814
+ code`const typeRegistry = ${CUSTOM_TYPE_REGISTRY_PARAM} ?? new ${typeRegistryRef}(services);`
3813
3815
  );
3814
3816
  const { declarations, definitions } = this.buildTypeInvalidation(
3815
3817
  typeRegistryGenerator.invalidatableTypes
@@ -3822,7 +3824,7 @@ class BindingsGenerator {
3822
3824
  graphqlTypeRegistryRef = graphqlTypeRegistryGenerator.build();
3823
3825
  coreFile.pushTo(
3824
3826
  this.initGeneratedBindingsExtraParamsSymbol,
3825
- code`, graphqlTypeRegistry?: ${graphqlTypeRegistryRef}`
3827
+ code`, ${CUSTOM_GRAPHQL_TYPE_REGISTRY_PARAM}?: ${graphqlTypeRegistryRef}`
3826
3828
  );
3827
3829
  const firstGraphQLCommand = this.commandModels.find(
3828
3830
  (model) => model.operationType === "graphql"
@@ -3843,7 +3845,7 @@ class BindingsGenerator {
3843
3845
  }) : void 0;
3844
3846
  coreFile.pushTo(
3845
3847
  this.rootTypesInstantiationSymbol,
3846
- code`graphqlTypeRegistry ??= new ${graphqlTypeRegistryRef}(services);
3848
+ code`const graphqlTypeRegistry = ${CUSTOM_GRAPHQL_TYPE_REGISTRY_PARAM} ?? new ${graphqlTypeRegistryRef}(services);
3847
3849
  const ${QUERY_TYPE_VARIABLE_NAME} = graphqlTypeRegistry.${queryType.propertyName};`
3848
3850
  );
3849
3851
  if (mutationType) {