@eddeee888/gcg-typescript-resolver-files 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/README.md +64 -2
  2. package/package.json +5 -6
  3. package/src/generateResolverFiles/addExternalResolverImport.d.ts +1 -1
  4. package/src/generateResolverFiles/addExternalResolverImport.js +2 -1
  5. package/src/generateResolverFiles/addExternalResolverImport.js.map +1 -1
  6. package/src/generateResolverFiles/addResolverMainFile.d.ts +2 -2
  7. package/src/generateResolverFiles/addResolverMainFile.js +6 -2
  8. package/src/generateResolverFiles/addResolverMainFile.js.map +1 -1
  9. package/src/generateResolverFiles/handleGraphQLObjectType.js +2 -1
  10. package/src/generateResolverFiles/handleGraphQLObjectType.js.map +1 -1
  11. package/src/generateResolverFiles/handleGraphQLRootObjectTypeField.js +2 -1
  12. package/src/generateResolverFiles/handleGraphQLRootObjectTypeField.js.map +1 -1
  13. package/src/generateResolverFiles/handleGraphQLScalarType.js +2 -1
  14. package/src/generateResolverFiles/handleGraphQLScalarType.js.map +1 -1
  15. package/src/generateResolverFiles/handleGraphQLUninionType.js +3 -2
  16. package/src/generateResolverFiles/handleGraphQLUninionType.js.map +1 -1
  17. package/src/generateResolverFiles/types.d.ts +1 -0
  18. package/src/generateTypeDefsFiles/generateTypeDefsFiles.js +5 -1
  19. package/src/generateTypeDefsFiles/generateTypeDefsFiles.js.map +1 -1
  20. package/src/getGraphQLObjectTypeResolversToGenerate/getGraphQLObjectTypeResolversToGenerate.d.ts +2 -2
  21. package/src/getGraphQLObjectTypeResolversToGenerate/getGraphQLObjectTypeResolversToGenerate.js +2 -2
  22. package/src/getGraphQLObjectTypeResolversToGenerate/getGraphQLObjectTypeResolversToGenerate.js.map +1 -1
  23. package/src/parseGraphQLSchema/parseGraphQLSchema.d.ts +18 -8
  24. package/src/parseGraphQLSchema/parseGraphQLSchema.js +67 -15
  25. package/src/parseGraphQLSchema/parseGraphQLSchema.js.map +1 -1
  26. package/src/parseTypeMappers/collectTypeMappersFromSourceFile.d.ts +2 -1
  27. package/src/parseTypeMappers/collectTypeMappersFromSourceFile.js +7 -3
  28. package/src/parseTypeMappers/collectTypeMappersFromSourceFile.js.map +1 -1
  29. package/src/parseTypeMappers/parseTypeMappers.d.ts +2 -1
  30. package/src/parseTypeMappers/parseTypeMappers.js +2 -1
  31. package/src/parseTypeMappers/parseTypeMappers.js.map +1 -1
  32. package/src/preset.js +18 -6
  33. package/src/preset.js.map +1 -1
  34. package/src/utils/fmt.d.ts +7 -0
  35. package/src/utils/fmt.js +16 -0
  36. package/src/utils/fmt.js.map +1 -0
  37. package/src/utils/index.d.ts +1 -0
  38. package/src/utils/index.js +1 -0
  39. package/src/utils/index.js.map +1 -1
  40. package/src/utils/printImportLine.d.ts +2 -1
  41. package/src/utils/printImportLine.js +4 -2
  42. package/src/utils/printImportLine.js.map +1 -1
  43. package/src/validateAndMergeParsedConfigs/index.d.ts +1 -0
  44. package/src/validateAndMergeParsedConfigs/index.js +5 -0
  45. package/src/validateAndMergeParsedConfigs/index.js.map +1 -0
  46. package/src/validateAndMergeParsedConfigs/validateAndMergeParsedConfigs.d.ts +18 -0
  47. package/src/validateAndMergeParsedConfigs/validateAndMergeParsedConfigs.js +27 -0
  48. package/src/validateAndMergeParsedConfigs/validateAndMergeParsedConfigs.js.map +1 -0
  49. package/src/validatePresetConfig/validatePresetConfig.d.ts +18 -4
  50. package/src/validatePresetConfig/validatePresetConfig.js +30 -24
  51. package/src/validatePresetConfig/validatePresetConfig.js.map +1 -1
@@ -4,7 +4,7 @@ exports.collectTypeMappersFromSourceFile = void 0;
4
4
  const path = require("path");
5
5
  const ts_morph_1 = require("ts-morph");
6
6
  const utils_1 = require("../utils");
7
- const collectTypeMappersFromSourceFile = ({ typeMappersSourceFile, typeMappersSuffix, resolverTypesPath, shouldCollectPropertyMap, }, result) => {
7
+ const collectTypeMappersFromSourceFile = ({ typeMappersSourceFile, typeMappersSuffix, resolverTypesPath, shouldCollectPropertyMap, emitLegacyCommonJSImports, }, result) => {
8
8
  // Look for interfaces with exported keywords
9
9
  typeMappersSourceFile.getInterfaces().forEach((interfaceDeclaration) => {
10
10
  if (!interfaceDeclaration.hasExportKeyword()) {
@@ -17,6 +17,7 @@ const collectTypeMappersFromSourceFile = ({ typeMappersSourceFile, typeMappersSu
17
17
  typeMappersFilePath: typeMappersSourceFile.getFilePath(),
18
18
  resolverTypesPath,
19
19
  shouldCollectPropertyMap,
20
+ emitLegacyCommonJSImports,
20
21
  }, result);
21
22
  });
22
23
  // Look for exported types with exported keywords
@@ -32,6 +33,7 @@ const collectTypeMappersFromSourceFile = ({ typeMappersSourceFile, typeMappersSu
32
33
  typeMappersFilePath: typeMappersSourceFile.getFilePath(),
33
34
  resolverTypesPath,
34
35
  shouldCollectPropertyMap,
36
+ emitLegacyCommonJSImports,
35
37
  }, result);
36
38
  });
37
39
  // Look for named exports e.g.
@@ -52,12 +54,13 @@ const collectTypeMappersFromSourceFile = ({ typeMappersSourceFile, typeMappersSu
52
54
  typeMappersFilePath: typeMappersSourceFile.getFilePath(),
53
55
  resolverTypesPath,
54
56
  shouldCollectPropertyMap,
57
+ emitLegacyCommonJSImports,
55
58
  }, result);
56
59
  });
57
60
  });
58
61
  };
59
62
  exports.collectTypeMappersFromSourceFile = collectTypeMappersFromSourceFile;
60
- const addTypeMapperDetailsIfValid = ({ declarationNode, identifierNode, typeMappersSuffix, typeMappersFilePath, resolverTypesPath, shouldCollectPropertyMap, }, result) => {
63
+ const addTypeMapperDetailsIfValid = ({ declarationNode, identifierNode, typeMappersSuffix, typeMappersFilePath, resolverTypesPath, shouldCollectPropertyMap, emitLegacyCommonJSImports, }, result) => {
61
64
  const identifierName = identifierNode.getText();
62
65
  if (!identifierName.endsWith(typeMappersSuffix)) {
63
66
  return;
@@ -79,7 +82,8 @@ const addTypeMapperDetailsIfValid = ({ declarationNode, identifierNode, typeMapp
79
82
  .join(path.posix.sep);
80
83
  const parsedRelativePathFromResolverTypesToSourceFile = path.parse(relativePath);
81
84
  const relativeImportPathFromResolverTypesToSourceFile = (0, utils_1.normalizeRelativePath)(path.posix.join(parsedRelativePathFromResolverTypesToSourceFile.dir, parsedRelativePathFromResolverTypesToSourceFile.name));
82
- const configImportPath = `${relativeImportPathFromResolverTypesToSourceFile}#${identifierName}`;
85
+ const fileExtension = emitLegacyCommonJSImports ? '' : '.js';
86
+ const configImportPath = `${relativeImportPathFromResolverTypesToSourceFile}${fileExtension}#${identifierName}`;
83
87
  if (result[schemaType]) {
84
88
  throw new Error(`GraphQL type "${schemaType}" has duplicated "${identifierName}" mappers:\n - ${configImportPath}\n - ${result[schemaType].configImportPath}`);
85
89
  }
@@ -1 +1 @@
1
- {"version":3,"file":"collectTypeMappersFromSourceFile.js","sourceRoot":"","sources":["../../../../../packages/typescript-resolver-files/src/parseTypeMappers/collectTypeMappersFromSourceFile.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,uCAOkB;AAClB,oCAAqE;AAG9D,MAAM,gCAAgC,GAAG,CAC9C,EACE,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,GAMzB,EACD,MAAsB,EAChB,EAAE;IACR,6CAA6C;IAC7C,qBAAqB,CAAC,aAAa,EAAE,CAAC,OAAO,CAAC,CAAC,oBAAoB,EAAE,EAAE;QACrE,IAAI,CAAC,oBAAoB,CAAC,gBAAgB,EAAE,EAAE;YAC5C,OAAO;SACR;QAED,2BAA2B,CACzB;YACE,eAAe,EAAE,oBAAoB;YACrC,cAAc,EAAE,oBAAoB,CAAC,WAAW,EAAE;YAClD,iBAAiB;YACjB,mBAAmB,EAAE,qBAAqB,CAAC,WAAW,EAAE;YACxD,iBAAiB;YACjB,wBAAwB;SACzB,EACD,MAAM,CACP,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,iDAAiD;IACjD,qBAAqB,CAAC,cAAc,EAAE,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EA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A0B,EACpB,EAAE;IACR,IAAI,CAAC,eAAe,EAAE;QACpB,OAAO,cAAc,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,CAAC;KAC/C;IAED,uBAAuB;IACvB,IAAI,eAAe,CAAC,MAAM,CAAC,qBAAU,CAAC,oBAAoB,CAAC,EAAE;QAC3D,OAAO,eAAe,CAAC;KACxB;IAED,uBAAuB;IACvB,MAAM,QAAQ,GAAG,eAAe,CAAC,kBAAkB,EAAE,CAAC;IACtD,MAAM,IAAI,GAAG,eAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,4EAA4E;QACtH,CAAC,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC;QACxC,CAAC,CAAC,eAAe,CAAC;IACpB,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
1
+ {"version":3,"file":"collectTypeMappersFromSourceFile.js","sourceRoot":"","sources":["../../../../../packages/typescript-resolver-files/src/parseTypeMappers/collectTypeMappersFromSourceFile.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,uCAOkB;AAClB,oCAAqE;AAG9D,MAAM,gCAAgC,GAAG,CAC9C,EACE,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,yBAAyB,GAO1B,EACD,MAAsB,EAChB,EAAE;IACR,6CAA6C;IAC7C,qBAAqB,CAAC,aAAa,EAAE,CAAC,OAAO,CAAC,CAAC,oBAAoB,EAAE,EAAE;QACrE,IAAI,CAAC,oBAAoB,CAAC,gBAAgB,EAAE,EAAE;YAC5C,OAAO;SACR;QAED,2BAA2B,CACzB;YACE,eAAe,EAAE,oBAAoB;YACrC,cAAc,EAAE,oBAAoB,CAAC,WAAW,EAAE;YAClD,iBAAiB;YACjB,mBAAmB,EAAE,qBAAqB,CAAC,WAAW,EAAE;YACxD,iBAAiB;YACjB,wBAAwB;YACxB,yBAAyB;SAC1B,EACD,MAAM,CACP,CAAC;IACJ,CAAC,CAAC,CAAC;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GAAG,IAAA,0BAAkB,EAAC,uBAAuB,CAAC,CAAC;KACrE;IAED,MAAM,CAAC,UAAU,CAAC,GAAG;QACnB,UAAU;QACV,cAAc,EAAE,cAAc;QAC9B,qBAAqB;QACrB,gBAAgB;KACjB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,0BAA0B,GAAG,CACjC,eAAmE,EACnE,cAA0B,EACpB,EAAE;IACR,IAAI,CAAC,eAAe,EAAE;QACpB,OAAO,cAAc,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC,CAAC;KAC/C;IAED,uBAAuB;IACvB,IAAI,eAAe,CAAC,MAAM,CAAC,qBAAU,CAAC,oBAAoB,CAAC,EAAE;QAC3D,OAAO,eAAe,CAAC;KACxB;IAED,uBAAuB;IACvB,MAAM,QAAQ,GAAG,eAAe,CAAC,kBAAkB,EAAE,CAAC;IACtD,MAAM,IAAI,GAAG,eAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,4EAA4E;QACtH,CAAC,CAAC,cAAc,CAAC,kBAAkB,EAAE,CAAC,CAAC,CAAC;QACxC,CAAC,CAAC,eAAe,CAAC;IACpB,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
@@ -8,6 +8,7 @@ export interface ParseTypeMappersParams {
8
8
  typeMappersSuffix: string;
9
9
  tsMorphProject: Project;
10
10
  shouldCollectPropertyMap: boolean;
11
+ emitLegacyCommonJSImports: boolean;
11
12
  }
12
13
  export interface TypeMapperDetails {
13
14
  schemaType: string;
@@ -16,4 +17,4 @@ export interface TypeMapperDetails {
16
17
  configImportPath: string;
17
18
  }
18
19
  export type TypeMappersMap = Record<string, TypeMapperDetails>;
19
- export declare const parseTypeMappers: ({ sourceMap, resolverTypesPath, typeMappersFileExtension, typeMappersSuffix, tsMorphProject, shouldCollectPropertyMap, }: ParseTypeMappersParams) => TypeMappersMap;
20
+ export declare const parseTypeMappers: ({ sourceMap, resolverTypesPath, typeMappersFileExtension, typeMappersSuffix, tsMorphProject, shouldCollectPropertyMap, emitLegacyCommonJSImports, }: ParseTypeMappersParams) => TypeMappersMap;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseTypeMappers = void 0;
4
4
  const path = require("path");
5
5
  const collectTypeMappersFromSourceFile_1 = require("./collectTypeMappersFromSourceFile");
6
- const parseTypeMappers = ({ sourceMap, resolverTypesPath, typeMappersFileExtension, typeMappersSuffix, tsMorphProject, shouldCollectPropertyMap, }) => {
6
+ const parseTypeMappers = ({ sourceMap, resolverTypesPath, typeMappersFileExtension, typeMappersSuffix, tsMorphProject, shouldCollectPropertyMap, emitLegacyCommonJSImports, }) => {
7
7
  const result = Object.entries(sourceMap).reduce((res, [_, { sourcePath }]) => {
8
8
  const typeMapperFilePath = path.posix.join(sourcePath.dir, `${sourcePath.name}${typeMappersFileExtension}`);
9
9
  const typeMappersSourceFile = tsMorphProject.addSourceFileAtPathIfExists(typeMapperFilePath);
@@ -15,6 +15,7 @@ const parseTypeMappers = ({ sourceMap, resolverTypesPath, typeMappersFileExtensi
15
15
  typeMappersSuffix,
16
16
  resolverTypesPath,
17
17
  shouldCollectPropertyMap,
18
+ emitLegacyCommonJSImports,
18
19
  }, res);
19
20
  return res;
20
21
  }, {});
@@ -1 +1 @@
1
- {"version":3,"file":"parseTypeMappers.js","sourceRoot":"","sources":["../../../../../packages/typescript-resolver-files/src/parseTypeMappers/parseTypeMappers.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAI7B,yFAAsF;AAoB/E,MAAM,gBAAgB,GAAG,CAAC,EAC/B,SAAS,EACT,iBAAiB,EACjB,wBAAwB,EACxB,iBAAiB,EACjB,cAAc,EACd,wBAAwB,GACD,EAAkB,EAAE;IAC3C,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAC7C,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE;QAC3B,MAAM,kBAAkB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CACxC,UAAU,CAAC,GAAG,EACd,GAAG,UAAU,CAAC,IAAI,GAAG,wBAAwB,EAAE,CAChD,CAAC;QAEF,MAAM,qBAAqB,GACzB,cAAc,CAAC,2BAA2B,CAAC,kBAAkB,CAAC,CAAC;QAEjE,IAAI,CAAC,qBAAqB,EAAE;YAC1B,OAAO,GAAG,CAAC;SACZ;QAED,IAAA,mEAAgC,EAC9B;YACE,qBAAqB;YACrB,iBAAiB;YACjB,iBAAiB;YACjB,wBAAwB;SACzB,EACD,GAAG,CACJ,CAAC;QAEF,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAAE,CACH,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AArCW,QAAA,gBAAgB,oBAqC3B"}
1
+ {"version":3,"file":"parseTypeMappers.js","sourceRoot":"","sources":["../../../../../packages/typescript-resolver-files/src/parseTypeMappers/parseTypeMappers.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAI7B,yFAAsF;AAqB/E,MAAM,gBAAgB,GAAG,CAAC,EAC/B,SAAS,EACT,iBAAiB,EACjB,wBAAwB,EACxB,iBAAiB,EACjB,cAAc,EACd,wBAAwB,EACxB,yBAAyB,GACF,EAAkB,EAAE;IAC3C,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,MAAM,CAC7C,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,EAAE;QAC3B,MAAM,kBAAkB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CACxC,UAAU,CAAC,GAAG,EACd,GAAG,UAAU,CAAC,IAAI,GAAG,wBAAwB,EAAE,CAChD,CAAC;QAEF,MAAM,qBAAqB,GACzB,cAAc,CAAC,2BAA2B,CAAC,kBAAkB,CAAC,CAAC;QAEjE,IAAI,CAAC,qBAAqB,EAAE;YAC1B,OAAO,GAAG,CAAC;SACZ;QAED,IAAA,mEAAgC,EAC9B;YACE,qBAAqB;YACrB,iBAAiB;YACjB,iBAAiB;YACjB,wBAAwB;YACxB,yBAAyB;SAC1B,EACD,GAAG,CACJ,CAAC;QAEF,OAAO,GAAG,CAAC;IACb,CAAC,EACD,EAAE,CACH,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAvCW,QAAA,gBAAgB,oBAuC3B"}
package/src/preset.js CHANGED
@@ -16,6 +16,7 @@ const getGraphQLObjectTypeResolversToGenerate_1 = require("./getGraphQLObjectTyp
16
16
  const addVirtualTypesFileToTsMorphProject_1 = require("./addVirtualTypesFileToTsMorphProject");
17
17
  const parseTypeMappers_1 = require("./parseTypeMappers");
18
18
  const validatePresetConfig_1 = require("./validatePresetConfig");
19
+ const validateAndMergeParsedConfigs_1 = require("./validateAndMergeParsedConfigs");
19
20
  exports.presetName = '@eddeee888/gcg-typescript-resolver-files';
20
21
  exports.preset = {
21
22
  buildGeneratesSection: ({ schema, schemaAst, presetConfig: rawPresetConfig, baseOutputDir, profiler = (0, plugin_helpers_1.createNoopProfiler)(), }) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
@@ -26,7 +27,7 @@ exports.preset = {
26
27
  if (!Array.isArray(sources) || sources.length === 0) {
27
28
  throw new Error('Empty Sources. Make sure schema files are parsed correctly.');
28
29
  }
29
- const { resolverTypesPath: relativeResolverTypesPathFromBaseOutputDir, resolverRelativeTargetDir, mappersFileExtension: typeMappersFileExtension, mappersSuffix: typeMappersSuffix, resolverMainFile, resolverMainFileMode, typeDefsFilePath, typeDefsFileMode, mode, whitelistedModules, blacklistedModules, externalResolvers, typesPluginsConfig, tsMorphProjectOptions, fixObjectTypeResolvers, } = (0, validatePresetConfig_1.validatePresetConfig)(rawPresetConfig);
30
+ const { resolverTypesPath: relativeResolverTypesPathFromBaseOutputDir, resolverRelativeTargetDir, mappersFileExtension: typeMappersFileExtension, mappersSuffix: typeMappersSuffix, resolverMainFile, resolverMainFileMode, typeDefsFilePath, typeDefsFileMode, scalarsModule, scalarsOverrides, mode, whitelistedModules, blacklistedModules, externalResolvers, typesPluginsConfig, tsMorphProjectOptions, fixObjectTypeResolvers, emitLegacyCommonJSImports, } = (0, validatePresetConfig_1.validatePresetConfig)(rawPresetConfig);
30
31
  const resolverTypesPath = path.posix.join(baseOutputDir, relativeResolverTypesPathFromBaseOutputDir);
31
32
  const { sourceMap } = (0, parseSources_1.parseSources)(sources);
32
33
  const tsMorphProject = yield profiler.run(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () { return new ts_morph_1.Project(tsMorphProjectOptions); }), createProfilerRunName('Initialising ts-morph project'));
@@ -38,18 +39,28 @@ exports.preset = {
38
39
  typeMappersSuffix,
39
40
  tsMorphProject,
40
41
  shouldCollectPropertyMap: fixObjectTypeResolvers !== 'disabled',
42
+ emitLegacyCommonJSImports,
41
43
  });
42
44
  }), createProfilerRunName('parseTypeMappers'));
43
45
  const generatesSection = [];
44
- // typescript and typescript-resolvers plugins config
45
- const { userDefinedSchemaTypeMap, pluginsConfig: { defaultScalarTypesMap, defaultScalarExternalResolvers, defaultTypeMappers, }, } = (0, parseGraphQLSchema_1.parseGraphQLSchema)({
46
+ const parsedGraphQLSchemaMeta = yield (0, parseGraphQLSchema_1.parseGraphQLSchema)({
46
47
  schemaAst,
47
48
  sourceMap,
49
+ scalarsModule,
50
+ scalarsOverrides,
48
51
  typeMappersMap,
49
52
  whitelistedModules,
50
53
  blacklistedModules,
51
54
  });
52
- const resolverTypesConfig = Object.assign(Object.assign({ enumsAsTypes: true, nonOptionalTypename: true }, typesPluginsConfig), { scalars: Object.assign(Object.assign({}, defaultScalarTypesMap), typesPluginsConfig.scalars), mappers: Object.assign(Object.assign({}, defaultTypeMappers), typesPluginsConfig.mappers) });
55
+ const mergedConfig = (0, validateAndMergeParsedConfigs_1.validateAndMergeParsedConfigs)({
56
+ externalResolvers,
57
+ parsedGraphQLSchemaMeta,
58
+ });
59
+ // typescript and typescript-resolvers plugins config
60
+ const resolverTypesConfig = Object.assign(Object.assign({ enumsAsTypes: true, emitLegacyCommonJSImports, optionalResolveType: true, resolversNonOptionalTypename: {
61
+ unionMember: true,
62
+ interfaceImplementingType: true,
63
+ } }, typesPluginsConfig), { scalars: Object.assign({}, mergedConfig.scalarTypes), mappers: Object.assign(Object.assign({}, mergedConfig.typeMappers), typesPluginsConfig.mappers) });
53
64
  // typesSourceFile is the virtual `types.generated.ts`
54
65
  // This is useful when we need to do static analysis as most types come from this file
55
66
  // e.g. comparing mappers field type vs schema object field type
@@ -62,7 +73,7 @@ exports.preset = {
62
73
  const graphQLObjectTypeResolversToGenerate = yield profiler.run(() => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
63
74
  return (0, getGraphQLObjectTypeResolversToGenerate_1.getGraphQLObjectTypeResolversToGenerate)({
64
75
  typesSourceFile,
65
- userDefinedSchemaTypeMap,
76
+ userDefinedSchemaObjectTypeMap: mergedConfig.userDefinedSchemaTypeMap.object,
66
77
  typeMappersMap,
67
78
  });
68
79
  }), createProfilerRunName('graphQLObjectTypeResolversToGenerate'));
@@ -126,7 +137,8 @@ exports.preset = {
126
137
  mode,
127
138
  whitelistedModules,
128
139
  blacklistedModules,
129
- externalResolvers: Object.assign(Object.assign({}, defaultScalarExternalResolvers), externalResolvers),
140
+ externalResolvers: Object.assign({}, mergedConfig.externalResolvers),
141
+ emitLegacyCommonJSImports,
130
142
  },
131
143
  result,
132
144
  });
package/src/preset.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"preset.js","sourceRoot":"","sources":["../../../../packages/typescript-resolver-files/src/preset.ts"],"names":[],"mappings":";;;;AAAA,6BAA6B;AAC7B,kDAAkD;AAClD,gEAAgE;AAChE,mFAAmF;AACnF,oEAGyC;AACzC,uCAAmC;AACnC,iDAA8C;AAC9C,6DAA0D;AAC1D,mEAGiC;AACjC,mEAAgE;AAChE,uGAAoG;AACpG,+FAA4F;AAC5F,yDAAsD;AACtD,iEAA+E;AAElE,QAAA,UAAU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MAAM,EAAE;oBACN,MAAM,EAAE,SAAS;oBACjB,SAAS;oBACT,aAAa;oBACb,iBAAiB;oBACjB,yBAAyB;oBACzB,gBAAgB;oBAChB,oBAAoB;oBACpB,oCAAoC;oBACpC,OAAO,EAAE;wBACP,OAAO,EAAE,cAAc;wBACvB,eAAe;qBAChB;oBACD,sBAAsB;oBACtB,IAAI;oBACJ,kBAAkB;oBAClB,kBAAkB;oBAClB,iBAAiB,kCACZ,8BAA8B,GAC9B,iBAAiB,CACrB;iBACF;gBACD,MAAM;aACP,CAAC,CAAA;UAAA,EACJ,qBAAqB,CAAC,uBAAuB,CAAC,CAC/C,CAAC;QACF,MAAM,4BAA4B,GAChC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YAC7D,QAAQ;YACR,SAAS,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE;YAC7B,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,OAAO,EAAE,EAAE,CAAC;YAC/B,MAAM,EAAE,EAAE;YACV,MAAM;YACN,SAAS,EAAE,EAAE;SACd,CAAC,CAAC,CAAC;QAEN,OAAO,CAAC,GAAG,4BAA4B,EAAE,GAAG,gBAAgB,CAAC,CAAC;IAChE,CAAC,CAAA;CACF,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,SAAiB,EAAU,EAAE,CAC1D,IAAI,kBAAU,MAAM,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"preset.js","sourceRoot":"","sources":["../../../../packages/typescript-resolver-files/src/preset.ts"],"names":[],"mappings":";;;;AAAA,6BAA6B;AAC7B,kDAAkD;AAClD,gEAAgE;AAChE,mFAAmF;AACnF,oEAGyC;AACzC,uCAAmC;AACnC,iDAA8C;AAC9C,6DAA0D;AAC1D,mEAGiC;AACjC,mEAAgE;AAChE,uGAAoG;AACpG,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B,EAAU,EAAE,CAC1D,IAAI,kBAAU,MAAM,SAAS,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Shared message formatter
3
+ */
4
+ export declare const fmt: {
5
+ error: (input: string, type: 'Validation') => string;
6
+ warn: (input: string) => string;
7
+ };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fmt = void 0;
4
+ const preset_1 = require("../preset");
5
+ /**
6
+ * Shared message formatter
7
+ */
8
+ exports.fmt = {
9
+ error: (input, type) => {
10
+ return `[${preset_1.presetName}] ERROR: ${type} - ${input}`;
11
+ },
12
+ warn: (input) => {
13
+ return `[${preset_1.presetName}] WARN: ${input}`;
14
+ },
15
+ };
16
+ //# sourceMappingURL=fmt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fmt.js","sourceRoot":"","sources":["../../../../../packages/typescript-resolver-files/src/utils/fmt.ts"],"names":[],"mappings":";;;AAAA,sCAAuC;AAEvC;;GAEG;AACU,QAAA,GAAG,GAAG;IACjB,KAAK,EAAE,CAAC,KAAa,EAAE,IAAkB,EAAU,EAAE;QACnD,OAAO,IAAI,mBAAU,YAAY,IAAI,MAAM,KAAK,EAAE,CAAC;IACrD,CAAC;IACD,IAAI,EAAE,CAAC,KAAa,EAAU,EAAE;QAC9B,OAAO,IAAI,mBAAU,WAAW,KAAK,EAAE,CAAC;IAC1C,CAAC;CACF,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export * from './cwd';
2
+ export * from './fmt';
2
3
  export * from './parseLocationForWhitelistedModule';
3
4
  export * from './isNativeNamedType';
4
5
  export * from './isRootObjectType';
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./cwd"), exports);
5
+ tslib_1.__exportStar(require("./fmt"), exports);
5
6
  tslib_1.__exportStar(require("./parseLocationForWhitelistedModule"), exports);
6
7
  tslib_1.__exportStar(require("./isNativeNamedType"), exports);
7
8
  tslib_1.__exportStar(require("./isRootObjectType"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/typescript-resolver-files/src/utils/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB;AACtB,8EAAoD;AACpD,8DAAoC;AACpC,6DAAmC;AACnC,gEAAsC;AACtC,4DAAkC;AAClC,+DAAqC;AACrC,kEAAwC;AACxC,+DAAqC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/typescript-resolver-files/src/utils/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB;AACtB,gDAAsB;AACtB,8EAAoD;AACpD,8DAAoC;AACpC,6DAAmC;AACnC,gEAAsC;AACtC,4DAAkC;AAClC,+DAAqC;AACrC,kEAAwC;AACxC,+DAAqC"}
@@ -6,5 +6,6 @@ export interface ImportLineMeta {
6
6
  identifierName: string;
7
7
  })[];
8
8
  defaultImport?: string;
9
+ emitLegacyCommonJSImports: boolean;
9
10
  }
10
- export declare function printImportLine({ isTypeImport, module, namedImports, defaultImport, }: ImportLineMeta): string;
11
+ export declare function printImportLine({ isTypeImport, module, namedImports, defaultImport, emitLegacyCommonJSImports, }: ImportLineMeta): string;
@@ -1,14 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.printImportLine = void 0;
4
- function printImportLine({ isTypeImport, module, namedImports, defaultImport, }) {
4
+ function printImportLine({ isTypeImport, module, namedImports, defaultImport, emitLegacyCommonJSImports, }) {
5
5
  const typeImportKeyword = isTypeImport ? 'type' : '';
6
6
  const hasDefaultImport = Boolean(defaultImport);
7
7
  const hasNamedImports = namedImports.length > 0;
8
8
  const namedImportsString = hasNamedImports
9
9
  ? `{ ${namedImports.map(printNamedImportSpecifier).join(',')} }`
10
10
  : '';
11
- return `import ${typeImportKeyword} ${defaultImport || ''} ${hasDefaultImport && hasNamedImports ? ',' : ''} ${namedImportsString} from '${normalizeModuleExtensionForImport(module)}';`;
11
+ const isFile = module.startsWith('.');
12
+ const fileExt = emitLegacyCommonJSImports || !isFile ? '' : '.js';
13
+ return `import ${typeImportKeyword} ${defaultImport || ''} ${hasDefaultImport && hasNamedImports ? ',' : ''} ${namedImportsString} from '${normalizeModuleExtensionForImport(module)}${fileExt}';`;
12
14
  }
13
15
  exports.printImportLine = printImportLine;
14
16
  const normalizeModuleExtensionForImport = (module) => {
@@ -1 +1 @@
1
- {"version":3,"file":"printImportLine.js","sourceRoot":"","sources":["../../../../../packages/typescript-resolver-files/src/utils/printImportLine.ts"],"names":[],"mappings":";;;AAOA,SAAgB,eAAe,CAAC,EAC9B,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,aAAa,GACE;IACf,MAAM,iBAAiB,GAAG,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrD,MAAM,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAChD,MAAM,eAAe,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;IAChD,MAAM,kBAAkB,GAAG,eAAe;QACxC,CAAC,CAAC,KAAK,YAAY,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI;QAChE,CAAC,CAAC,EAAE,CAAC;IAEP,OAAO,UAAU,iBAAiB,IAAI,aAAa,IAAI,EAAE,IACvD,gBAAgB,IAAI,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAC9C,IAAI,kBAAkB,UAAU,iCAAiC,CAAC,MAAM,CAAC,IAAI,CAAC;AAChF,CAAC;AAhBD,0CAgBC;AAED,MAAM,iCAAiC,GAAG,CAAC,MAAc,EAAU,EAAE;IACnE,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QAC1B,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACjD;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAAG,CAChC,WAAmD,EAC3C,EAAE;IACV,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;QACnC,OAAO,WAAW,CAAC;KACpB;IAED,IAAI,WAAW,CAAC,YAAY,KAAK,WAAW,CAAC,cAAc,EAAE;QAC3D,OAAO,WAAW,CAAC,cAAc,CAAC;KACnC;IAED,OAAO,GAAG,WAAW,CAAC,YAAY,OAAO,WAAW,CAAC,cAAc,EAAE,CAAC;AACxE,CAAC,CAAC"}
1
+ {"version":3,"file":"printImportLine.js","sourceRoot":"","sources":["../../../../../packages/typescript-resolver-files/src/utils/printImportLine.ts"],"names":[],"mappings":";;;AAQA,SAAgB,eAAe,CAAC,EAC9B,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,aAAa,EACb,yBAAyB,GACV;IACf,MAAM,iBAAiB,GAAG,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IACrD,MAAM,gBAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAChD,MAAM,eAAe,GAAG,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC;IAChD,MAAM,kBAAkB,GAAG,eAAe;QACxC,CAAC,CAAC,KAAK,YAAY,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI;QAChE,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,OAAO,GAAG,yBAAyB,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IAElE,OAAO,UAAU,iBAAiB,IAAI,aAAa,IAAI,EAAE,IACvD,gBAAgB,IAAI,eAAe,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAC9C,IAAI,kBAAkB,UAAU,iCAAiC,CAC/D,MAAM,CACP,GAAG,OAAO,IAAI,CAAC;AAClB,CAAC;AArBD,0CAqBC;AAED,MAAM,iCAAiC,GAAG,CAAC,MAAc,EAAU,EAAE;IACnE,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QAC1B,OAAO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACjD;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAAG,CAChC,WAAmD,EAC3C,EAAE;IACV,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;QACnC,OAAO,WAAW,CAAC;KACpB;IAED,IAAI,WAAW,CAAC,YAAY,KAAK,WAAW,CAAC,cAAc,EAAE;QAC3D,OAAO,WAAW,CAAC,cAAc,CAAC;KACnC;IAED,OAAO,GAAG,WAAW,CAAC,YAAY,OAAO,WAAW,CAAC,cAAc,EAAE,CAAC;AACxE,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './validateAndMergeParsedConfigs';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./validateAndMergeParsedConfigs"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/typescript-resolver-files/src/validateAndMergeParsedConfigs/index.ts"],"names":[],"mappings":";;;AAAA,0EAAgD"}
@@ -0,0 +1,18 @@
1
+ import type { ParsedGraphQLSchemaMeta } from '../parseGraphQLSchema';
2
+ import type { ParsedPresetConfig, ScalarsOverridesType } from '../validatePresetConfig';
3
+ interface MergedConfig {
4
+ userDefinedSchemaTypeMap: ParsedGraphQLSchemaMeta['userDefinedSchemaTypeMap'];
5
+ externalResolvers: ParsedPresetConfig['externalResolvers'];
6
+ scalarTypes: Record<string, ScalarsOverridesType>;
7
+ typeMappers: Record<string, string>;
8
+ }
9
+ /**
10
+ * validateAndMergeParsedConfigs is used to make sure all parsed configs do not incorrectly override each other.
11
+ * Use this to ensure there's only one way of doing something. e.g.
12
+ * - scalarsOverrides must be used over externalResolvers to override scalars
13
+ */
14
+ export declare const validateAndMergeParsedConfigs: ({ externalResolvers, parsedGraphQLSchemaMeta: { userDefinedSchemaTypeMap, pluginsConfig: { defaultScalarExternalResolvers, defaultScalarTypesMap, defaultTypeMappers, }, }, }: {
15
+ externalResolvers: ParsedPresetConfig['externalResolvers'];
16
+ parsedGraphQLSchemaMeta: ParsedGraphQLSchemaMeta;
17
+ }) => MergedConfig;
18
+ export {};
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateAndMergeParsedConfigs = void 0;
4
+ const utils_1 = require("../utils");
5
+ const nativeScalarTypes = {
6
+ ID: { input: 'string', output: 'string | number' },
7
+ };
8
+ /**
9
+ * validateAndMergeParsedConfigs is used to make sure all parsed configs do not incorrectly override each other.
10
+ * Use this to ensure there's only one way of doing something. e.g.
11
+ * - scalarsOverrides must be used over externalResolvers to override scalars
12
+ */
13
+ const validateAndMergeParsedConfigs = ({ externalResolvers, parsedGraphQLSchemaMeta: { userDefinedSchemaTypeMap, pluginsConfig: { defaultScalarExternalResolvers, defaultScalarTypesMap, defaultTypeMappers, }, }, }) => {
14
+ Object.keys(externalResolvers).forEach((schemaType) => {
15
+ if (userDefinedSchemaTypeMap.scalar[schemaType]) {
16
+ throw new Error(utils_1.fmt.error(`Scalar "${schemaType}" found in presetConfig.externalResolvers. Use presetConfig.scalarsOverrides to override scalar implementation and type. Remove "${schemaType}" from presetConfig.externalResolvers.`, 'Validation'));
17
+ }
18
+ });
19
+ return {
20
+ userDefinedSchemaTypeMap,
21
+ externalResolvers: Object.assign(Object.assign({}, defaultScalarExternalResolvers), externalResolvers),
22
+ scalarTypes: Object.assign(Object.assign({}, nativeScalarTypes), defaultScalarTypesMap),
23
+ typeMappers: defaultTypeMappers,
24
+ };
25
+ };
26
+ exports.validateAndMergeParsedConfigs = validateAndMergeParsedConfigs;
27
+ //# sourceMappingURL=validateAndMergeParsedConfigs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateAndMergeParsedConfigs.js","sourceRoot":"","sources":["../../../../../packages/typescript-resolver-files/src/validateAndMergeParsedConfigs/validateAndMergeParsedConfigs.ts"],"names":[],"mappings":";;;AAKA,oCAA+B;AAE/B,MAAM,iBAAiB,GAAyC;IAC9D,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE;CACnD,CAAC;AASF;;;;GAIG;AACI,MAAM,6BAA6B,GAAG,CAAC,EAC5C,iBAAiB,EACjB,uBAAuB,EAAE,EACvB,wBAAwB,EACxB,aAAa,EAAE,EACb,8BAA8B,EAC9B,qBAAqB,EACrB,kBAAkB,GACnB,GACF,GAIF,EAAgB,EAAE;IACjB,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE;QACpD,IAAI,wBAAwB,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE;YAC/C,MAAM,IAAI,KAAK,CACb,WAAG,CAAC,KAAK,CACP,WAAW,UAAU,oIAAoI,UAAU,wCAAwC,EAC3M,YAAY,CACb,CACF,CAAC;SACH;IACH,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,wBAAwB;QACxB,iBAAiB,kCACZ,8BAA8B,GAC9B,iBAAiB,CACrB;QACD,WAAW,kCACN,iBAAiB,GACjB,qBAAqB,CACzB;QACD,WAAW,EAAE,kBAAkB;KAChC,CAAC;AACJ,CAAC,CAAC;AArCW,QAAA,6BAA6B,iCAqCxC"}
@@ -1,13 +1,15 @@
1
1
  import * as typeScriptPlugin from '@graphql-codegen/typescript';
2
2
  import * as typeScriptResolversPlugin from '@graphql-codegen/typescript-resolvers';
3
3
  import type { ProjectOptions } from 'ts-morph';
4
- type ParsedTypesPluginsConfig = Omit<typeScriptPlugin.TypeScriptPluginConfig, 'scalars'> & Omit<typeScriptResolversPlugin.TypeScriptResolversPluginConfig, 'scalars'> & {
5
- scalars: Record<string, string>;
6
- };
4
+ type ParsedTypesPluginsConfig = Omit<typeScriptPlugin.TypeScriptPluginConfig & typeScriptResolversPlugin.TypeScriptResolversPluginConfig, 'scalars'>;
7
5
  type ConfigMode = 'merged' | 'modules';
8
6
  type ResolverMainFileMode = 'merged' | 'modules';
9
7
  export type TypeDefsFileMode = 'merged' | 'mergedWhitelisted' | 'modules';
10
8
  type FixObjectTypeResolvers = 'smart' | 'disabled';
9
+ export type ScalarsOverridesType = string | {
10
+ input: string;
11
+ output: string;
12
+ };
11
13
  export interface ParsedPresetConfig {
12
14
  resolverTypesPath: string;
13
15
  resolverRelativeTargetDir: string;
@@ -17,6 +19,11 @@ export interface ParsedPresetConfig {
17
19
  typeDefsFileMode: TypeDefsFileMode;
18
20
  mappersFileExtension: string;
19
21
  mappersSuffix: string;
22
+ scalarsModule: string | false;
23
+ scalarsOverrides: Record<string, {
24
+ resolver?: string;
25
+ type?: ScalarsOverridesType;
26
+ }>;
20
27
  mode: ConfigMode;
21
28
  whitelistedModules: string[];
22
29
  blacklistedModules: string[];
@@ -24,6 +31,7 @@ export interface ParsedPresetConfig {
24
31
  typesPluginsConfig: ParsedTypesPluginsConfig;
25
32
  tsMorphProjectOptions: ProjectOptions;
26
33
  fixObjectTypeResolvers: FixObjectTypeResolvers;
34
+ emitLegacyCommonJSImports: boolean;
27
35
  }
28
36
  export interface RawPresetConfig {
29
37
  resolverTypesPath?: string;
@@ -34,6 +42,11 @@ export interface RawPresetConfig {
34
42
  typeDefsFileMode?: string;
35
43
  mappersFileExtension?: string;
36
44
  mappersSuffix?: string;
45
+ scalarsModule?: string | boolean;
46
+ scalarsOverrides?: Record<string, {
47
+ resolver?: string;
48
+ type?: ScalarsOverridesType;
49
+ }>;
37
50
  mode?: string;
38
51
  whitelistedModules?: string[];
39
52
  blacklistedModules?: string[];
@@ -41,6 +54,7 @@ export interface RawPresetConfig {
41
54
  typesPluginsConfig?: typeScriptPlugin.TypeScriptPluginConfig & typeScriptResolversPlugin.TypeScriptResolversPluginConfig;
42
55
  tsConfigFilePath?: string;
43
56
  fixObjectTypeResolvers?: string;
57
+ emitLegacyCommonJSImports?: boolean;
44
58
  }
45
59
  export interface TypedPresetConfig extends RawPresetConfig {
46
60
  mode?: ConfigMode;
@@ -48,5 +62,5 @@ export interface TypedPresetConfig extends RawPresetConfig {
48
62
  typeDefsFileMode?: TypeDefsFileMode;
49
63
  fixObjectTypeResolvers?: FixObjectTypeResolvers;
50
64
  }
51
- export declare const validatePresetConfig: ({ resolverTypesPath, resolverRelativeTargetDir, resolverMainFile, resolverMainFileMode, typeDefsFilePath, typeDefsFileMode: inputTypeDefsFileMode, mappersFileExtension, mappersSuffix, mode, whitelistedModules, blacklistedModules, externalResolvers, typesPluginsConfig, tsConfigFilePath, fixObjectTypeResolvers, }: RawPresetConfig) => ParsedPresetConfig;
65
+ export declare const validatePresetConfig: ({ resolverTypesPath, resolverRelativeTargetDir, resolverMainFile, resolverMainFileMode, typeDefsFilePath, typeDefsFileMode: inputTypeDefsFileMode, mappersFileExtension, mappersSuffix, scalarsModule, scalarsOverrides, mode, whitelistedModules, blacklistedModules, externalResolvers, typesPluginsConfig, tsConfigFilePath, fixObjectTypeResolvers, emitLegacyCommonJSImports, }: RawPresetConfig) => ParsedPresetConfig;
52
66
  export {};
@@ -1,67 +1,76 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.validatePresetConfig = void 0;
4
+ const tslib_1 = require("tslib");
4
5
  const path = require("path");
5
6
  const fs = require("fs");
6
- const preset_1 = require("../preset");
7
7
  const utils_1 = require("../utils");
8
8
  const defaultResolverRelativeTargetDirMap = {
9
9
  modules: 'resolvers',
10
10
  merged: '',
11
11
  };
12
12
  const defaultTypeDefsFilePath = './typeDefs.generated.ts';
13
- const validatePresetConfig = ({ resolverTypesPath = './types.generated.ts', resolverRelativeTargetDir, resolverMainFile = 'resolvers.generated.ts', resolverMainFileMode = 'merged', typeDefsFilePath = defaultTypeDefsFilePath, typeDefsFileMode: inputTypeDefsFileMode = 'merged', mappersFileExtension = '.mappers.ts', mappersSuffix = 'Mapper', mode = 'modules', whitelistedModules, blacklistedModules, externalResolvers = {}, typesPluginsConfig = {}, tsConfigFilePath = './tsconfig.json', fixObjectTypeResolvers = 'smart', }) => {
13
+ const defaultScalarsModule = 'graphql-scalars';
14
+ const validatePresetConfig = ({ resolverTypesPath = './types.generated.ts', resolverRelativeTargetDir, resolverMainFile = 'resolvers.generated.ts', resolverMainFileMode = 'merged', typeDefsFilePath = defaultTypeDefsFilePath, typeDefsFileMode: inputTypeDefsFileMode = 'merged', mappersFileExtension = '.mappers.ts', mappersSuffix = 'Mapper', scalarsModule = 'graphql-scalars', scalarsOverrides = {}, mode = 'modules', whitelistedModules, blacklistedModules, externalResolvers = {}, typesPluginsConfig = {}, tsConfigFilePath = './tsconfig.json', fixObjectTypeResolvers = 'smart', emitLegacyCommonJSImports = true, }) => {
14
15
  if (mode !== 'merged' && mode !== 'modules') {
15
- throw new Error(printError('presetConfig.mode must be "merged" or "modules" (default is "modules")', 'Validation'));
16
+ throw new Error(utils_1.fmt.error('presetConfig.mode must be "merged" or "modules" (default is "modules")', 'Validation'));
16
17
  }
17
18
  if (fixObjectTypeResolvers !== 'smart' &&
18
19
  fixObjectTypeResolvers !== 'disabled') {
19
- throw new Error(printError('presetConfig.fixObjectTypeResolvers must be "smart" or "disabled" (default is "smart")', 'Validation'));
20
+ throw new Error(utils_1.fmt.error('presetConfig.fixObjectTypeResolvers must be "smart" or "disabled" (default is "smart")', 'Validation'));
20
21
  }
21
22
  if (resolverMainFileMode !== 'merged' && resolverMainFileMode !== 'modules') {
22
- throw new Error(printError('presetConfig.resolverMainFileMode must be "merged" or "modules" (default is "merged")', 'Validation'));
23
+ throw new Error(utils_1.fmt.error('presetConfig.resolverMainFileMode must be "merged" or "modules" (default is "merged")', 'Validation'));
23
24
  }
24
25
  let typeDefsFileMode = inputTypeDefsFileMode;
25
26
  if (mode === 'merged') {
26
27
  // If mode is `merged`, `typeDefsFileMode` is also `merged` because there's no whitelisted or modules concepts
27
28
  typeDefsFileMode = 'merged';
28
- console.warn(printWarning(`presetConfig.typeDefsFileMode has automatically been set to "merged" because presetConfig.mode is "merged"`));
29
+ console.warn(utils_1.fmt.warn(`presetConfig.typeDefsFileMode has automatically been set to "merged" because presetConfig.mode is "merged"`));
29
30
  }
30
31
  if (typeDefsFileMode !== 'merged' &&
31
32
  typeDefsFileMode !== 'modules' &&
32
33
  typeDefsFileMode !== 'mergedWhitelisted') {
33
- throw new Error(printError('presetConfig.typeDefsFileMode must be "merged", "mergedWhitelisted" or "modules" (default is "merged")', 'Validation'));
34
+ throw new Error(utils_1.fmt.error('presetConfig.typeDefsFileMode must be "merged", "mergedWhitelisted" or "modules" (default is "merged")', 'Validation'));
34
35
  }
35
36
  if (!resolverTypesPath) {
36
- throw new Error(printError('presetConfig.resolverTypesPath is required', 'Validation'));
37
+ throw new Error(utils_1.fmt.error('presetConfig.resolverTypesPath is required', 'Validation'));
37
38
  }
38
39
  const finalResolverRelativeTargetDir = resolverRelativeTargetDir === undefined
39
40
  ? defaultResolverRelativeTargetDirMap[mode]
40
41
  : resolverRelativeTargetDir;
41
42
  if (path.extname(resolverMainFile) === '') {
42
- throw new Error(printError('presetConfig.mainFile must be a valid file name', 'Validation'));
43
+ throw new Error(utils_1.fmt.error('presetConfig.mainFile must be a valid file name', 'Validation'));
43
44
  }
44
45
  if (whitelistedModules) {
45
46
  if (!Array.isArray(whitelistedModules)) {
46
- throw new Error(printError('presetConfig.whitelistedModules must be an array if provided', 'Validation'));
47
+ throw new Error(utils_1.fmt.error('presetConfig.whitelistedModules must be an array if provided', 'Validation'));
47
48
  }
48
49
  if (mode !== 'modules') {
49
- throw new Error(printError('presetConfig.whitelistedModules can only be used with presetConfig.mode == "modules"', 'Validation'));
50
+ throw new Error(utils_1.fmt.error('presetConfig.whitelistedModules can only be used with presetConfig.mode == "modules"', 'Validation'));
50
51
  }
51
52
  }
52
53
  if (blacklistedModules) {
53
54
  if (!Array.isArray(blacklistedModules)) {
54
- throw new Error(printError('presetConfig.blacklistedModules must be an array if provided', 'Validation'));
55
+ throw new Error(utils_1.fmt.error('presetConfig.blacklistedModules must be an array if provided', 'Validation'));
55
56
  }
56
57
  if (mode !== 'modules') {
57
- throw new Error(printError('presetConfig.blacklistedModules can only be used with presetConfig.mode == "modules"', 'Validation'));
58
+ throw new Error(utils_1.fmt.error('presetConfig.blacklistedModules can only be used with presetConfig.mode == "modules"', 'Validation'));
58
59
  }
59
60
  }
61
+ if (emitLegacyCommonJSImports === false &&
62
+ typesPluginsConfig.emitLegacyCommonJSImports !== null) {
63
+ console.warn(utils_1.fmt.warn(`emitLegacyCommonJSImports is set to false and typesPluginsConfig's emitLegacyCommonJSImports is set as well - usually this is unwanted behaviour. The root config's emitLegacyCommonJSImports sets typesPluinsConfig's emitLegacyCommonJSImports as well.`));
64
+ }
60
65
  const validatedTypesPluginsConfig = validateTypesPluginsConfig(typesPluginsConfig);
61
66
  let finalTypeDefsFilePath = typeDefsFilePath;
62
67
  if (finalTypeDefsFilePath === true) {
63
68
  finalTypeDefsFilePath = defaultTypeDefsFilePath;
64
69
  }
70
+ let finalScalarsModule = scalarsModule;
71
+ if (finalScalarsModule === true) {
72
+ finalScalarsModule = defaultScalarsModule;
73
+ }
65
74
  const tsMorphProjectOptions = {
66
75
  skipAddingFilesFromTsConfig: true, // avoid long startup time by NOT loading files included by tsconfig.json. We only use this virtually anyways so we don't need all the files
67
76
  };
@@ -71,7 +80,7 @@ const validatePresetConfig = ({ resolverTypesPath = './types.generated.ts', reso
71
80
  tsMorphProjectOptions.tsConfigFilePath = absoluteTsConfigFilePath;
72
81
  }
73
82
  else {
74
- console.warn(printWarning(`Unable to find TypeScript config at ${absoluteTsConfigFilePath}. Use presetConfig.tsConfigFilePath to set a custom value. Otherwise, type analysis may not work correctly.`));
83
+ console.warn(utils_1.fmt.warn(`Unable to find TypeScript config at ${absoluteTsConfigFilePath}. Use presetConfig.tsConfigFilePath to set a custom value. Otherwise, type analysis may not work correctly.`));
75
84
  }
76
85
  }
77
86
  return {
@@ -84,26 +93,23 @@ const validatePresetConfig = ({ resolverTypesPath = './types.generated.ts', reso
84
93
  mode,
85
94
  mappersFileExtension,
86
95
  mappersSuffix,
96
+ scalarsModule: finalScalarsModule,
97
+ scalarsOverrides,
87
98
  whitelistedModules: whitelistedModules || [],
88
99
  blacklistedModules: blacklistedModules || [],
89
100
  externalResolvers,
90
101
  typesPluginsConfig: validatedTypesPluginsConfig,
91
102
  tsMorphProjectOptions,
92
103
  fixObjectTypeResolvers,
104
+ emitLegacyCommonJSImports,
93
105
  };
94
106
  };
95
107
  exports.validatePresetConfig = validatePresetConfig;
96
108
  const validateTypesPluginsConfig = (config) => {
97
- const scalarsOption = config.scalars || {};
98
- if (typeof scalarsOption === 'string') {
99
- throw new Error(printError('presetConfig.typesPluginsConfig.scalars of type "string" is not supported', 'Validation'));
109
+ const { scalars } = config, rest = tslib_1.__rest(config, ["scalars"]);
110
+ if (scalars) {
111
+ throw new Error(utils_1.fmt.error('presetConfig.typesPluginsConfig.scalars is not supported. Use presetConfig.scalarsOverrides instead.', 'Validation'));
100
112
  }
101
- return Object.assign(Object.assign({}, config), { scalars: scalarsOption });
102
- };
103
- const printError = (input, type) => {
104
- return `[${preset_1.presetName}] ERROR: ${type} - ${input}`;
105
- };
106
- const printWarning = (input) => {
107
- return `[${preset_1.presetName}] WARN: ${input}`;
113
+ return Object.assign({}, rest);
108
114
  };
109
115
  //# sourceMappingURL=validatePresetConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validatePresetConfig.js","sourceRoot":"","sources":["../../../../../packages/typescript-resolver-files/src/validatePresetConfig/validatePresetConfig.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,yBAAyB;AAIzB,sCAAuC;AACvC,oCAA+B;AAE/B,MAAM,mCAAmC,GAGrC;IACF,OAAO,EAAE,WAAW;IACpB,MAAM,EAAE,EAAE;CACX,CAAC;AACF,MAAM,uBAAuB,GAAG,yBAAyB,CAAC;AA0DnD,MAAM,oBAAoB,GAAG,CAAC,EACnC,iBAAiB,GAAG,sBAAsB,EAC1C,yBAAyB,EACzB,gBAAgB,GAAG,wBAAwB,EAC3C,oBAAoB,GAAG,QAAQ,EAC/B,gBAAgB,GAAG,uBAAuB,EAC1C,gBAAgB,EAAE,qBAAqB,GAAG,QAAQ,EAClD,oBAAoB,GAAG,aAAa,EACpC,aAAa,GAAG,QAAQ,EACxB,IAAI,GAAG,SAAS,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,GAAG,EAAE,EACtB,kBAAkB,GAAG,EAAE,EACvB,gBAAgB,GAAG,iBAAiB,EACpC,sBAAsB,GAAG,OAAO,GAChB,EAAsB,EAAE;IACxC,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,SAAS,EAAE;QAC3C,MAAM,IAAI,KAAK,CACb,UAAU,CACR,wEAAwE,EACxE,YAAY,CACb,CACF,CAAC;KACH;IAED,IACE,sBAAsB,KAAK,OAAO;QAClC,sBAAsB,KAAK,UAAU,EACrC;QACA,MAAM,IAAI,KAAK,CACb,UAAU,CACR,wFAAwF,EACxF,YAAY,CACb,CACF,CAAC;KACH;IAED,IAAI,oBAAoB,KAAK,QAAQ,IAAI,oBAAoB,KAAK,SAAS,EAAE;QAC3E,MAAM,IAAI,KAAK,CACb,UAAU,CACR,uFAAuF,EACvF,YAAY,CACb,CACF,CAAC;KACH;IAED,IAAI,gBAAgB,GAAG,qBAAqB,CAAC;IAC7C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AAU,CACR,2EAA2E,EAC3E,YAAY,CACb,CACF,CAAC;KACH;IACD,uCACK,MAAM,KACT,OAAO,EAAE,aAAa,IACtB;AACJ,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,KAAa,EAAE,IAAkB,EAAU,EAAE;IAC/D,OAAO,IAAI,mBAAU,YAAY,IAAI,MAAM,KAAK,EAAE,CAAC;AACrD,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,KAAa,EAAU,EAAE;IAC7C,OAAO,IAAI,mBAAU,WAAW,KAAK,EAAE,CAAC;AAC1C,CAAC,CAAC"}
1
+ {"version":3,"file":"validatePresetConfig.js","sourceRoot":"","sources":["../../../../../packages/typescript-resolver-files/src/validatePresetConfig/validatePresetConfig.ts"],"names":[],"mappings":";;;;AAAA,6BAA6B;AAC7B,yBAAyB;AAIzB,oCAAoC;AAEpC,MAAM,mCAAmC,GAGrC;IACF,OAAO,EAAE,WAAW;IACpB,MAAM,EAAE,EAAE;CACX,CAAC;AACF,MAAM,uBAAuB,GAAG,yBAAyB,CAAC;AAC1D,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AAsExC,MAAM,oBAAoB,GAAG,CAAC,EACnC,iBAAiB,GAAG,sBAAsB,EAC1C,yBAAyB,EACzB,gBAAgB,GAAG,wBAAwB,EAC3C,oBAAoB,GAAG,QAAQ,EAC/B,gBAAgB,GAAG,uBAAuB,EAC1C,gBAAgB,EAAE,qBAAqB,GAAG,QAAQ,EAClD,oBAAoB,GAAG,aAAa,EACpC,aAAa,GAAG,QAAQ,EACxB,aAAa,GAAG,iBAAiB,EACjC,gBAAgB,GAAG,EAAE,EACrB,IAAI,GAAG,SAAS,EAChB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,GAAG,EAAE,EACtB,kBAAkB,GAAG,EAAE,EACvB,gBAAgB,GAAG,iBAAiB,EACpC,sBAAsB,GAAG,OAAO,EAChC,yBAAyB,GAAG,IAAI,GAChB,EAAsB,EAAE;IACxC,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