@graphitation/supermassive 0.8.5 → 1.1.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.
- package/.eslintcache +1 -0
- package/CHANGELOG.md +18 -2
- package/lib/bin/supermassive.d.ts.map +1 -1
- package/lib/bin/supermassive.js +48 -4
- package/lib/bin/supermassive.mjs +48 -4
- package/lib/codegen/context/expect.d.ts +1 -0
- package/lib/codegen/context/expect.d.ts.map +1 -0
- package/lib/codegen/context/expect.js +0 -0
- package/lib/codegen/context/expect.mjs +0 -0
- package/lib/codegen/context/import.d.ts +5 -0
- package/lib/codegen/context/import.d.ts.map +1 -0
- package/lib/codegen/context/import.js +55 -0
- package/lib/codegen/context/import.mjs +37 -0
- package/lib/codegen/context/index.d.ts +51 -0
- package/lib/codegen/context/index.d.ts.map +1 -0
- package/lib/codegen/context/index.js +234 -0
- package/lib/codegen/context/index.mjs +223 -0
- package/lib/codegen/context/model.d.ts +5 -0
- package/lib/codegen/context/model.d.ts.map +1 -0
- package/lib/codegen/context/model.js +53 -0
- package/lib/codegen/context/model.mjs +37 -0
- package/lib/codegen/context/utilities.d.ts +2 -0
- package/lib/codegen/context/utilities.d.ts.map +1 -0
- package/lib/codegen/context/utilities.js +26 -0
- package/lib/codegen/context/utilities.mjs +8 -0
- package/lib/codegen/index.d.ts +7 -0
- package/lib/codegen/index.d.ts.map +1 -0
- package/lib/codegen/index.js +41 -0
- package/lib/codegen/index.mjs +23 -0
- package/lib/codegen/models.d.ts +5 -0
- package/lib/codegen/models.d.ts.map +1 -0
- package/lib/codegen/models.js +157 -0
- package/lib/codegen/models.mjs +141 -0
- package/lib/codegen/resolvers.d.ts +5 -0
- package/lib/codegen/resolvers.d.ts.map +1 -0
- package/lib/codegen/resolvers.js +146 -0
- package/lib/codegen/resolvers.mjs +133 -0
- package/lib/codegen/typedVisitor.d.ts +57 -0
- package/lib/codegen/typedVisitor.d.ts.map +1 -0
- package/lib/codegen/typedVisitor.js +26 -0
- package/lib/codegen/typedVisitor.mjs +8 -0
- package/lib/codegen/types.d.ts +18 -0
- package/lib/codegen/types.d.ts.map +1 -0
- package/lib/codegen/types.js +15 -0
- package/lib/codegen/types.mjs +0 -0
- package/lib/codegen/utilities.d.ts +39 -0
- package/lib/codegen/utilities.d.ts.map +1 -0
- package/lib/codegen/utilities.js +166 -0
- package/lib/codegen/utilities.mjs +148 -0
- package/lib/{extractImplicitTypesToTypescript.d.ts → extractors/extractImplicitTypesToTypescript.d.ts} +0 -0
- package/lib/extractors/extractImplicitTypesToTypescript.d.ts.map +1 -0
- package/lib/{extractImplicitTypesToTypescript.js → extractors/extractImplicitTypesToTypescript.js} +0 -0
- package/lib/{extractImplicitTypesToTypescript.mjs → extractors/extractImplicitTypesToTypescript.mjs} +1 -1
- package/lib/extractors/index.d.ts +2 -0
- package/lib/extractors/index.d.ts.map +1 -0
- package/lib/extractors/index.js +23 -0
- package/lib/extractors/index.mjs +5 -0
- package/lib/index.d.ts +3 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.mjs +2 -2
- package/lib/utilities/blankGraphQLTag.d.ts +2 -0
- package/lib/utilities/blankGraphQLTag.d.ts.map +1 -0
- package/lib/utilities/blankGraphQLTag.js +25 -0
- package/lib/utilities/blankGraphQLTag.mjs +7 -0
- package/package.json +13 -8
- package/lib/extractImplicitTypesToTypescript.d.ts.map +0 -1
package/.eslintcache
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"/mnt/vss/_work/1/s/packages/supermassive/src/__tests__/execute.test.ts":"1","/mnt/vss/_work/1/s/packages/supermassive/src/__tests__/extractImplicitTypes.test.ts":"2","/mnt/vss/_work/1/s/packages/supermassive/src/__tests__/subscribe.test.ts":"3","/mnt/vss/_work/1/s/packages/supermassive/src/ast/TypedAST.ts":"4","/mnt/vss/_work/1/s/packages/supermassive/src/ast/__tests__/addTypesToRequestDocument.test.ts":"5","/mnt/vss/_work/1/s/packages/supermassive/src/ast/addTypesToRequestDocument.ts":"6","/mnt/vss/_work/1/s/packages/supermassive/src/benchmarks/index.ts":"7","/mnt/vss/_work/1/s/packages/supermassive/src/benchmarks/nice-benchmark.ts":"8","/mnt/vss/_work/1/s/packages/supermassive/src/benchmarks/swapi-schema/index.ts":"9","/mnt/vss/_work/1/s/packages/supermassive/src/benchmarks/swapi-schema/models.ts":"10","/mnt/vss/_work/1/s/packages/supermassive/src/benchmarks/swapi-schema/resolvers.ts":"11","/mnt/vss/_work/1/s/packages/supermassive/src/bin/__tests__/typeDefsToImplicitResolvers.test.ts":"12","/mnt/vss/_work/1/s/packages/supermassive/src/bin/supermassive.ts":"13","/mnt/vss/_work/1/s/packages/supermassive/src/codegen/__tests__/index.test.ts":"14","/mnt/vss/_work/1/s/packages/supermassive/src/codegen/context/__tests__/import.test.ts":"15","/mnt/vss/_work/1/s/packages/supermassive/src/codegen/context/expect.ts":"16","/mnt/vss/_work/1/s/packages/supermassive/src/codegen/context/import.ts":"17","/mnt/vss/_work/1/s/packages/supermassive/src/codegen/context/index.ts":"18","/mnt/vss/_work/1/s/packages/supermassive/src/codegen/context/model.ts":"19","/mnt/vss/_work/1/s/packages/supermassive/src/codegen/context/utilities.ts":"20","/mnt/vss/_work/1/s/packages/supermassive/src/codegen/index.ts":"21","/mnt/vss/_work/1/s/packages/supermassive/src/codegen/models.ts":"22","/mnt/vss/_work/1/s/packages/supermassive/src/codegen/resolvers.ts":"23","/mnt/vss/_work/1/s/packages/supermassive/src/codegen/typedVisitor.ts":"24","/mnt/vss/_work/1/s/packages/supermassive/src/codegen/types.ts":"25","/mnt/vss/_work/1/s/packages/supermassive/src/codegen/utilities.ts":"26","/mnt/vss/_work/1/s/packages/supermassive/src/collectFields.ts":"27","/mnt/vss/_work/1/s/packages/supermassive/src/compiledQuery.ts":"28","/mnt/vss/_work/1/s/packages/supermassive/src/definition.ts":"29","/mnt/vss/_work/1/s/packages/supermassive/src/directives.ts":"30","/mnt/vss/_work/1/s/packages/supermassive/src/executeWithSchema.ts":"31","/mnt/vss/_work/1/s/packages/supermassive/src/executeWithoutSchema.ts":"32","/mnt/vss/_work/1/s/packages/supermassive/src/extractImplicitTypesRuntime.ts":"33","/mnt/vss/_work/1/s/packages/supermassive/src/extractors/extractImplicitTypesToTypescript.ts":"34","/mnt/vss/_work/1/s/packages/supermassive/src/extractors/index.ts":"35","/mnt/vss/_work/1/s/packages/supermassive/src/index.ts":"36","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/Maybe.ts":"37","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/ObjMap.ts":"38","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/Path.ts":"39","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/PromiseOrValue.ts":"40","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/devAssert.ts":"41","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/didYouMean.ts":"42","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/identityFunc.ts":"43","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/inspect.ts":"44","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/instanceOf.ts":"45","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/invariant.ts":"46","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/isAsyncIterable.ts":"47","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/isIterableObject.ts":"48","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/isObjectLike.ts":"49","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/isPromise.ts":"50","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/keyMap.ts":"51","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/keyValMap.ts":"52","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/mapValue.ts":"53","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/memoize3.ts":"54","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/naturalCompare.ts":"55","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/printPathArray.ts":"56","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/promiseForObject.ts":"57","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/promiseReduce.ts":"58","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/suggestionList.ts":"59","/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/toObjMap.ts":"60","/mnt/vss/_work/1/s/packages/supermassive/src/subscribeWithSchema.ts":"61","/mnt/vss/_work/1/s/packages/supermassive/src/subscribeWithoutSchema.ts":"62","/mnt/vss/_work/1/s/packages/supermassive/src/transforms/annotateDocumentGraphQLTransform.ts":"63","/mnt/vss/_work/1/s/packages/supermassive/src/transforms/transformerTestUtils.ts":"64","/mnt/vss/_work/1/s/packages/supermassive/src/types.ts":"65","/mnt/vss/_work/1/s/packages/supermassive/src/utilities/blankGraphQLTag.ts":"66","/mnt/vss/_work/1/s/packages/supermassive/src/utilities/mapAsyncIterator.ts":"67","/mnt/vss/_work/1/s/packages/supermassive/src/utilities/mergeResolvers.ts":"68","/mnt/vss/_work/1/s/packages/supermassive/src/utilities/typeNameFromAST.ts":"69","/mnt/vss/_work/1/s/packages/supermassive/src/values.ts":"70"},{"size":6041,"mtime":1664527807405,"results":"71","hashOfConfig":"72"},{"size":1603,"mtime":1664527807405,"results":"73","hashOfConfig":"72"},{"size":6845,"mtime":1664527807405,"results":"74","hashOfConfig":"72"},{"size":14345,"mtime":1664527807405,"results":"75","hashOfConfig":"72"},{"size":5297,"mtime":1664527807405,"results":"76","hashOfConfig":"72"},{"size":2189,"mtime":1664527807405,"results":"77","hashOfConfig":"72"},{"size":3662,"mtime":1664527807405,"results":"78","hashOfConfig":"72"},{"size":712,"mtime":1664527807405,"results":"79","hashOfConfig":"72"},{"size":382,"mtime":1664527807405,"results":"80","hashOfConfig":"72"},{"size":128,"mtime":1664527807405,"results":"81","hashOfConfig":"72"},{"size":10233,"mtime":1664527807405,"results":"82","hashOfConfig":"72"},{"size":848,"mtime":1664527807405,"results":"83","hashOfConfig":"72"},{"size":4391,"mtime":1664527807405,"results":"84","hashOfConfig":"72"},{"size":30189,"mtime":1664527807405,"results":"85","hashOfConfig":"72"},{"size":4728,"mtime":1664527807405,"results":"86","hashOfConfig":"72"},{"size":1448,"mtime":1664527807405,"results":"87","hashOfConfig":"72"},{"size":1563,"mtime":1664527807405,"results":"88","hashOfConfig":"72"},{"size":10419,"mtime":1664527807405,"results":"89","hashOfConfig":"72"},{"size":1974,"mtime":1664527807405,"results":"90","hashOfConfig":"72"},{"size":629,"mtime":1664527807405,"results":"91","hashOfConfig":"72"},{"size":748,"mtime":1664527807405,"results":"92","hashOfConfig":"72"},{"size":7825,"mtime":1664527807405,"results":"93","hashOfConfig":"72"},{"size":8027,"mtime":1664527807405,"results":"94","hashOfConfig":"72"},{"size":2908,"mtime":1664527807405,"results":"95","hashOfConfig":"72"},{"size":380,"mtime":1664527807405,"results":"96","hashOfConfig":"72"},{"size":7596,"mtime":1664527807405,"results":"97","hashOfConfig":"72"},{"size":5387,"mtime":1664527807405,"results":"98","hashOfConfig":"72"},{"size":3431,"mtime":1664527807405,"results":"99","hashOfConfig":"72"},{"size":1649,"mtime":1664527807405,"results":"100","hashOfConfig":"72"},{"size":6589,"mtime":1664527807405,"results":"101","hashOfConfig":"72"},{"size":1230,"mtime":1664527807405,"results":"102","hashOfConfig":"72"},{"size":28220,"mtime":1664527807409,"results":"103","hashOfConfig":"72"},{"size":4918,"mtime":1664527807409,"results":"104","hashOfConfig":"72"},{"size":14787,"mtime":1664527807409,"results":"105","hashOfConfig":"72"},{"size":87,"mtime":1664527807409,"results":"106","hashOfConfig":"72"},{"size":1881,"mtime":1664527807409,"results":"107","hashOfConfig":"72"},{"size":134,"mtime":1664527807409,"results":"108","hashOfConfig":"72"},{"size":277,"mtime":1664527807409,"results":"109","hashOfConfig":"72"},{"size":711,"mtime":1664527807409,"results":"110","hashOfConfig":"72"},{"size":48,"mtime":1664527807409,"results":"111","hashOfConfig":"72"},{"size":269,"mtime":1664527807409,"results":"112","hashOfConfig":"72"},{"size":1038,"mtime":1664527807409,"results":"113","hashOfConfig":"72"},{"size":108,"mtime":1664527807409,"results":"114","hashOfConfig":"72"},{"size":2797,"mtime":1664527807409,"results":"115","hashOfConfig":"72"},{"size":2294,"mtime":1664527807409,"results":"116","hashOfConfig":"72"},{"size":357,"mtime":1664527807409,"results":"117","hashOfConfig":"72"},{"size":325,"mtime":1664527807409,"results":"118","hashOfConfig":"72"},{"size":778,"mtime":1664527807409,"results":"119","hashOfConfig":"72"},{"size":278,"mtime":1664527807409,"results":"120","hashOfConfig":"72"},{"size":227,"mtime":1664527807409,"results":"121","hashOfConfig":"72"},{"size":921,"mtime":1664527807409,"results":"122","hashOfConfig":"72"},{"size":764,"mtime":1664527807409,"results":"123","hashOfConfig":"72"},{"size":441,"mtime":1664527807409,"results":"124","hashOfConfig":"72"},{"size":821,"mtime":1664527807409,"results":"125","hashOfConfig":"72"},{"size":1314,"mtime":1664527807409,"results":"126","hashOfConfig":"72"},{"size":253,"mtime":1664527807409,"results":"127","hashOfConfig":"72"},{"size":650,"mtime":1664527807409,"results":"128","hashOfConfig":"72"},{"size":803,"mtime":1664527807409,"results":"129","hashOfConfig":"72"},{"size":3938,"mtime":1664527807409,"results":"130","hashOfConfig":"72"},{"size":503,"mtime":1664527807409,"results":"131","hashOfConfig":"72"},{"size":1280,"mtime":1664527807409,"results":"132","hashOfConfig":"72"},{"size":9122,"mtime":1664527807409,"results":"133","hashOfConfig":"72"},{"size":495,"mtime":1664527807409,"results":"134","hashOfConfig":"72"},{"size":6652,"mtime":1664527807409,"results":"135","hashOfConfig":"72"},{"size":4576,"mtime":1664527807409,"results":"136","hashOfConfig":"72"},{"size":104,"mtime":1664527807409,"results":"137","hashOfConfig":"72"},{"size":1815,"mtime":1664527807409,"results":"138","hashOfConfig":"72"},{"size":735,"mtime":1664527807409,"results":"139","hashOfConfig":"72"},{"size":308,"mtime":1664527807409,"results":"140","hashOfConfig":"72"},{"size":9318,"mtime":1664527807409,"results":"141","hashOfConfig":"72"},{"filePath":"142","messages":"143","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"r3n4ti",{"filePath":"144","messages":"145","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"146","messages":"147","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"148","messages":"149","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"150","messages":"151","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"152","messages":"153","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"154","messages":"155","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"156","messages":"157","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"158","messages":"159","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"160","messages":"161","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"162","messages":"163","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"164","messages":"165","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"166","messages":"167","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"168","messages":"169","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"170","messages":"171","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"172","messages":"173","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"174","messages":"175","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"176","messages":"177","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"178","messages":"179","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"180","messages":"181","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"182","messages":"183","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"184","messages":"185","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"186","messages":"187","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"188","messages":"189","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"190","messages":"191","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"192","messages":"193","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"194","messages":"195","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"196","messages":"197","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"198","messages":"199","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"200","messages":"201","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"202","messages":"203","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"204","messages":"205","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"206","messages":"207","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"208","messages":"209","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"210","messages":"211","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"212","messages":"213","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"214","messages":"215","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"216","messages":"217","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"218","messages":"219","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"220","messages":"221","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"222","messages":"223","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"224","messages":"225","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"226","messages":"227","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"228","messages":"229","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"230","messages":"231","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"232","messages":"233","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"234","messages":"235","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"236","messages":"237","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"238","messages":"239","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"240","messages":"241","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"242","messages":"243","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"244","messages":"245","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"246","messages":"247","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"248","messages":"249","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"250","messages":"251","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"252","messages":"253","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"254","messages":"255","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"256","messages":"257","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"258","messages":"259","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"260","messages":"261","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"262","messages":"263","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"264","messages":"265","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"266","messages":"267","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"268","messages":"269","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"270","messages":"271","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"272","messages":"273","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"274","messages":"275","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"276","messages":"277","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"278","messages":"279","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},{"filePath":"280","messages":"281","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"/mnt/vss/_work/1/s/packages/supermassive/src/__tests__/execute.test.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/__tests__/extractImplicitTypes.test.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/__tests__/subscribe.test.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/ast/TypedAST.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/ast/__tests__/addTypesToRequestDocument.test.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/ast/addTypesToRequestDocument.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/benchmarks/index.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/benchmarks/nice-benchmark.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/benchmarks/swapi-schema/index.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/benchmarks/swapi-schema/models.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/benchmarks/swapi-schema/resolvers.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/bin/__tests__/typeDefsToImplicitResolvers.test.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/bin/supermassive.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/codegen/__tests__/index.test.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/codegen/context/__tests__/import.test.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/codegen/context/expect.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/codegen/context/import.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/codegen/context/index.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/codegen/context/model.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/codegen/context/utilities.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/codegen/index.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/codegen/models.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/codegen/resolvers.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/codegen/typedVisitor.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/codegen/types.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/codegen/utilities.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/collectFields.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/compiledQuery.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/definition.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/directives.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/executeWithSchema.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/executeWithoutSchema.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/extractImplicitTypesRuntime.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/extractors/extractImplicitTypesToTypescript.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/extractors/index.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/index.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/Maybe.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/ObjMap.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/Path.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/PromiseOrValue.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/devAssert.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/didYouMean.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/identityFunc.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/inspect.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/instanceOf.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/invariant.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/isAsyncIterable.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/isIterableObject.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/isObjectLike.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/isPromise.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/keyMap.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/keyValMap.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/mapValue.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/memoize3.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/naturalCompare.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/printPathArray.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/promiseForObject.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/promiseReduce.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/suggestionList.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/jsutils/toObjMap.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/subscribeWithSchema.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/subscribeWithoutSchema.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/transforms/annotateDocumentGraphQLTransform.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/transforms/transformerTestUtils.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/types.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/utilities/blankGraphQLTag.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/utilities/mapAsyncIterator.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/utilities/mergeResolvers.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/utilities/typeNameFromAST.ts",[],"/mnt/vss/_work/1/s/packages/supermassive/src/values.ts",[]]
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
# Change Log - @graphitation/supermassive
|
|
2
2
|
|
|
3
|
-
This log was last generated on Fri,
|
|
3
|
+
This log was last generated on Fri, 30 Sep 2022 08:56:05 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 1.1.0
|
|
8
|
+
|
|
9
|
+
Fri, 30 Sep 2022 08:56:05 GMT
|
|
10
|
+
|
|
11
|
+
### Minor changes
|
|
12
|
+
|
|
13
|
+
- Version bump (jakubvejr@microsoft.com)
|
|
14
|
+
|
|
15
|
+
## 1.0.0
|
|
16
|
+
|
|
17
|
+
Wed, 20 Jul 2022 16:31:59 GMT
|
|
18
|
+
|
|
19
|
+
### Major changes
|
|
20
|
+
|
|
21
|
+
- extractImplicitTypesToTypescript exported separately from supermassive (jakubvejr@microsoft.com)
|
|
22
|
+
|
|
7
23
|
## 0.8.5
|
|
8
24
|
|
|
9
|
-
Fri, 24 Jun 2022 11:59:
|
|
25
|
+
Fri, 24 Jun 2022 11:59:47 GMT
|
|
10
26
|
|
|
11
27
|
### Patches
|
|
12
28
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"supermassive.d.ts","sourceRoot":"","sources":["../../src/bin/supermassive.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"supermassive.d.ts","sourceRoot":"","sources":["../../src/bin/supermassive.ts"],"names":[],"mappings":"AAIA,OAAO,EAAW,OAAO,EAAE,MAAM,WAAW,CAAC;AAc7C,wBAAgB,YAAY,IAAI,OAAO,CAoCtC"}
|
package/lib/bin/supermassive.js
CHANGED
|
@@ -45,16 +45,60 @@ __export(supermassive_exports, {
|
|
|
45
45
|
module.exports = __toCommonJS(supermassive_exports);
|
|
46
46
|
var import_path = __toESM(require("path"));
|
|
47
47
|
var import_promises = __toESM(require("fs/promises"));
|
|
48
|
+
var import_fs = __toESM(require("fs"));
|
|
48
49
|
var import_typescript = __toESM(require("typescript"));
|
|
49
50
|
var import_commander = require("commander");
|
|
50
|
-
var import_extractImplicitTypesToTypescript = require("../extractImplicitTypesToTypescript");
|
|
51
|
+
var import_extractImplicitTypesToTypescript = require("../extractors/extractImplicitTypesToTypescript");
|
|
51
52
|
var import_graphql = require("graphql");
|
|
53
|
+
var import_codegen = require("../codegen");
|
|
54
|
+
var glob = __toESM(require("fast-glob"));
|
|
55
|
+
const PREPEND_TO_INTERFACES = `// @ts-nocheck \r
|
|
56
|
+
/* eslint-disable */ \r
|
|
57
|
+
// This file was automatically generated (by @graphitaiton/supermassive) and should not be edited.\r
|
|
58
|
+
`;
|
|
52
59
|
function supermassive() {
|
|
53
|
-
const
|
|
54
|
-
|
|
60
|
+
const extractSchemaCommand = new import_commander.Command();
|
|
61
|
+
extractSchemaCommand.name("extract-schema").argument("<files...>").description("extract implicit resolvers to a ts file from graphql typedefs").action((files) => __async(this, null, function* () {
|
|
55
62
|
yield typeDefsToImplicitResolversImpl(files);
|
|
56
63
|
}));
|
|
57
|
-
|
|
64
|
+
const generateInterfacesCommand = new import_commander.Command();
|
|
65
|
+
generateInterfacesCommand.name("generate-interfaces").argument("<inputs...>").option("-o, --output-dir [outputDir]", "output directory relative to file, default generated").option("-ci, --context-import [contextImport]", "from where to import context").option("-cn, --context-name [contextName]", "Context name").description("generate interfaces and models").action((inputs, options) => __async(this, null, function* () {
|
|
66
|
+
yield generateInterfaces(getFiles(inputs), options);
|
|
67
|
+
}));
|
|
68
|
+
return import_commander.program.name("supermassive").addCommand(extractSchemaCommand).addCommand(generateInterfacesCommand);
|
|
69
|
+
}
|
|
70
|
+
function getFiles(inputs) {
|
|
71
|
+
return inputs.map((input) => {
|
|
72
|
+
if (import_fs.default.existsSync(input)) {
|
|
73
|
+
return input;
|
|
74
|
+
} else {
|
|
75
|
+
return glob.sync([input]);
|
|
76
|
+
}
|
|
77
|
+
}).flat().filter(Boolean);
|
|
78
|
+
}
|
|
79
|
+
function generateInterfaces(files, options) {
|
|
80
|
+
return __async(this, null, function* () {
|
|
81
|
+
for (const file of files) {
|
|
82
|
+
let fullPath;
|
|
83
|
+
if (import_path.default.isAbsolute(file)) {
|
|
84
|
+
fullPath = file;
|
|
85
|
+
} else {
|
|
86
|
+
fullPath = import_path.default.join(process.cwd(), file);
|
|
87
|
+
}
|
|
88
|
+
const stat = yield import_promises.default.stat(fullPath);
|
|
89
|
+
if (!stat.isFile) {
|
|
90
|
+
throw new Error(`Invalid file ${file}`);
|
|
91
|
+
}
|
|
92
|
+
const content = yield import_promises.default.readFile(fullPath, { encoding: "utf-8" });
|
|
93
|
+
const document = (0, import_graphql.parse)(content);
|
|
94
|
+
let result = (0, import_codegen.generateTS)(document, options.contextImport, options.contextName);
|
|
95
|
+
const tsDir = import_path.default.join(import_path.default.dirname(fullPath), options.outputDir ? options.outputDir : "__generated__");
|
|
96
|
+
yield import_promises.default.mkdir(tsDir, { recursive: true });
|
|
97
|
+
const printer = import_typescript.default.createPrinter();
|
|
98
|
+
yield import_promises.default.writeFile(import_path.default.join(tsDir, "models.interface.ts"), PREPEND_TO_INTERFACES + printer.printNode(import_typescript.default.EmitHint.SourceFile, result.models, result.models), { encoding: "utf-8" });
|
|
99
|
+
yield import_promises.default.writeFile(import_path.default.join(tsDir, "resolvers.interface.ts"), PREPEND_TO_INTERFACES + printer.printNode(import_typescript.default.EmitHint.SourceFile, result.resolvers, result.resolvers), { encoding: "utf-8" });
|
|
100
|
+
}
|
|
101
|
+
});
|
|
58
102
|
}
|
|
59
103
|
function typeDefsToImplicitResolversImpl(files) {
|
|
60
104
|
return __async(this, null, function* () {
|
package/lib/bin/supermassive.mjs
CHANGED
|
@@ -22,16 +22,60 @@ var __async = (__this, __arguments, generator) => {
|
|
|
22
22
|
// src/bin/supermassive.ts
|
|
23
23
|
import path from "path";
|
|
24
24
|
import fs from "fs/promises";
|
|
25
|
+
import fsSync from "fs";
|
|
25
26
|
import ts from "typescript";
|
|
26
27
|
import { program, Command } from "commander";
|
|
27
|
-
import { extractImplicitTypesToTypescript } from "../extractImplicitTypesToTypescript.mjs";
|
|
28
|
+
import { extractImplicitTypesToTypescript } from "../extractors/extractImplicitTypesToTypescript.mjs";
|
|
28
29
|
import { parse } from "graphql";
|
|
30
|
+
import { generateTS } from "../codegen.mjs";
|
|
31
|
+
import * as glob from "fast-glob";
|
|
32
|
+
var PREPEND_TO_INTERFACES = `// @ts-nocheck \r
|
|
33
|
+
/* eslint-disable */ \r
|
|
34
|
+
// This file was automatically generated (by @graphitaiton/supermassive) and should not be edited.\r
|
|
35
|
+
`;
|
|
29
36
|
function supermassive() {
|
|
30
|
-
const
|
|
31
|
-
|
|
37
|
+
const extractSchemaCommand = new Command();
|
|
38
|
+
extractSchemaCommand.name("extract-schema").argument("<files...>").description("extract implicit resolvers to a ts file from graphql typedefs").action((files) => __async(this, null, function* () {
|
|
32
39
|
yield typeDefsToImplicitResolversImpl(files);
|
|
33
40
|
}));
|
|
34
|
-
|
|
41
|
+
const generateInterfacesCommand = new Command();
|
|
42
|
+
generateInterfacesCommand.name("generate-interfaces").argument("<inputs...>").option("-o, --output-dir [outputDir]", "output directory relative to file, default generated").option("-ci, --context-import [contextImport]", "from where to import context").option("-cn, --context-name [contextName]", "Context name").description("generate interfaces and models").action((inputs, options) => __async(this, null, function* () {
|
|
43
|
+
yield generateInterfaces(getFiles(inputs), options);
|
|
44
|
+
}));
|
|
45
|
+
return program.name("supermassive").addCommand(extractSchemaCommand).addCommand(generateInterfacesCommand);
|
|
46
|
+
}
|
|
47
|
+
function getFiles(inputs) {
|
|
48
|
+
return inputs.map((input) => {
|
|
49
|
+
if (fsSync.existsSync(input)) {
|
|
50
|
+
return input;
|
|
51
|
+
} else {
|
|
52
|
+
return glob.sync([input]);
|
|
53
|
+
}
|
|
54
|
+
}).flat().filter(Boolean);
|
|
55
|
+
}
|
|
56
|
+
function generateInterfaces(files, options) {
|
|
57
|
+
return __async(this, null, function* () {
|
|
58
|
+
for (const file of files) {
|
|
59
|
+
let fullPath;
|
|
60
|
+
if (path.isAbsolute(file)) {
|
|
61
|
+
fullPath = file;
|
|
62
|
+
} else {
|
|
63
|
+
fullPath = path.join(process.cwd(), file);
|
|
64
|
+
}
|
|
65
|
+
const stat = yield fs.stat(fullPath);
|
|
66
|
+
if (!stat.isFile) {
|
|
67
|
+
throw new Error(`Invalid file ${file}`);
|
|
68
|
+
}
|
|
69
|
+
const content = yield fs.readFile(fullPath, { encoding: "utf-8" });
|
|
70
|
+
const document = parse(content);
|
|
71
|
+
let result = generateTS(document, options.contextImport, options.contextName);
|
|
72
|
+
const tsDir = path.join(path.dirname(fullPath), options.outputDir ? options.outputDir : "__generated__");
|
|
73
|
+
yield fs.mkdir(tsDir, { recursive: true });
|
|
74
|
+
const printer = ts.createPrinter();
|
|
75
|
+
yield fs.writeFile(path.join(tsDir, "models.interface.ts"), PREPEND_TO_INTERFACES + printer.printNode(ts.EmitHint.SourceFile, result.models, result.models), { encoding: "utf-8" });
|
|
76
|
+
yield fs.writeFile(path.join(tsDir, "resolvers.interface.ts"), PREPEND_TO_INTERFACES + printer.printNode(ts.EmitHint.SourceFile, result.resolvers, result.resolvers), { encoding: "utf-8" });
|
|
77
|
+
}
|
|
78
|
+
});
|
|
35
79
|
}
|
|
36
80
|
function typeDefsToImplicitResolversImpl(files) {
|
|
37
81
|
return __async(this, null, function* () {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=expect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"expect.d.ts","sourceRoot":"","sources":["../../../src/codegen/context/expect.ts"],"names":[],"mappings":""}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { DirectiveNode } from "graphql";
|
|
2
|
+
import { DefinitionImport } from "../types";
|
|
3
|
+
export declare const IMPORT_DIRECTIVE_NAME = "import";
|
|
4
|
+
export declare function processImportDirective(node: DirectiveNode): DefinitionImport;
|
|
5
|
+
//# sourceMappingURL=import.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"import.d.ts","sourceRoot":"","sources":["../../../src/codegen/context/import.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8B,aAAa,EAAE,MAAM,SAAS,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAG5C,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAE9C,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,aAAa,GAAG,gBAAgB,CAoC5E"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var import_exports = {};
|
|
19
|
+
__export(import_exports, {
|
|
20
|
+
IMPORT_DIRECTIVE_NAME: () => IMPORT_DIRECTIVE_NAME,
|
|
21
|
+
processImportDirective: () => processImportDirective
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(import_exports);
|
|
24
|
+
var import_graphql = require("graphql");
|
|
25
|
+
var import_utilities = require("../utilities");
|
|
26
|
+
const IMPORT_DIRECTIVE_NAME = "import";
|
|
27
|
+
function processImportDirective(node) {
|
|
28
|
+
const from = getArgumentValue(node.arguments, "from");
|
|
29
|
+
const defs = getArgumentValue(node.arguments, "defs");
|
|
30
|
+
if ((from == null ? void 0 : from.kind) !== "StringValue") {
|
|
31
|
+
throw new import_graphql.GraphQLError(`Directive @import requires "from" argument to exist and be a path to a GraphQL file.`, [from != null ? from : node]);
|
|
32
|
+
}
|
|
33
|
+
if ((defs == null ? void 0 : defs.kind) !== "ListValue") {
|
|
34
|
+
throw new import_graphql.GraphQLError(`Directive @import requires "defs" argument to exist and be a list of strings.`, [defs != null ? defs : node]);
|
|
35
|
+
}
|
|
36
|
+
const definitionNames = [];
|
|
37
|
+
defs.values.forEach((valueNode) => {
|
|
38
|
+
if (valueNode.kind !== "StringValue") {
|
|
39
|
+
throw new import_graphql.GraphQLError(`Directive @import requires "defs" argument to exist and be a list of strings (got ${valueNode.kind}).`, [valueNode]);
|
|
40
|
+
}
|
|
41
|
+
definitionNames.push(valueNode.value);
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
from: from.value,
|
|
45
|
+
defs: definitionNames.map((typeName) => ({
|
|
46
|
+
typeName
|
|
47
|
+
})),
|
|
48
|
+
importName: (0, import_utilities.createVariableNameFromImport)(from.value),
|
|
49
|
+
directive: node
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const getArgumentValue = (args = [], name) => {
|
|
53
|
+
var _a;
|
|
54
|
+
return (_a = args.find((arg) => arg.name.value === name)) == null ? void 0 : _a.value;
|
|
55
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// src/codegen/context/import.ts
|
|
2
|
+
import { GraphQLError } from "graphql";
|
|
3
|
+
import { createVariableNameFromImport } from "../utilities.mjs";
|
|
4
|
+
var IMPORT_DIRECTIVE_NAME = "import";
|
|
5
|
+
function processImportDirective(node) {
|
|
6
|
+
const from = getArgumentValue(node.arguments, "from");
|
|
7
|
+
const defs = getArgumentValue(node.arguments, "defs");
|
|
8
|
+
if ((from == null ? void 0 : from.kind) !== "StringValue") {
|
|
9
|
+
throw new GraphQLError(`Directive @import requires "from" argument to exist and be a path to a GraphQL file.`, [from != null ? from : node]);
|
|
10
|
+
}
|
|
11
|
+
if ((defs == null ? void 0 : defs.kind) !== "ListValue") {
|
|
12
|
+
throw new GraphQLError(`Directive @import requires "defs" argument to exist and be a list of strings.`, [defs != null ? defs : node]);
|
|
13
|
+
}
|
|
14
|
+
const definitionNames = [];
|
|
15
|
+
defs.values.forEach((valueNode) => {
|
|
16
|
+
if (valueNode.kind !== "StringValue") {
|
|
17
|
+
throw new GraphQLError(`Directive @import requires "defs" argument to exist and be a list of strings (got ${valueNode.kind}).`, [valueNode]);
|
|
18
|
+
}
|
|
19
|
+
definitionNames.push(valueNode.value);
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
from: from.value,
|
|
23
|
+
defs: definitionNames.map((typeName) => ({
|
|
24
|
+
typeName
|
|
25
|
+
})),
|
|
26
|
+
importName: createVariableNameFromImport(from.value),
|
|
27
|
+
directive: node
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
var getArgumentValue = (args = [], name) => {
|
|
31
|
+
var _a;
|
|
32
|
+
return (_a = args.find((arg) => arg.name.value === name)) == null ? void 0 : _a.value;
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
IMPORT_DIRECTIVE_NAME,
|
|
36
|
+
processImportDirective
|
|
37
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { DocumentNode, ASTNode } from "graphql";
|
|
2
|
+
import ts from "typescript";
|
|
3
|
+
import { DefinitionImport, DefinitionModel } from "../types";
|
|
4
|
+
export declare type TsCodegenContextOptions = {
|
|
5
|
+
moduleRoot: string;
|
|
6
|
+
moduleModelsPath: string;
|
|
7
|
+
moduleResolversPath: string;
|
|
8
|
+
baseModel: {
|
|
9
|
+
name: string;
|
|
10
|
+
from: string | null;
|
|
11
|
+
};
|
|
12
|
+
context: {
|
|
13
|
+
name?: string;
|
|
14
|
+
from: string | null;
|
|
15
|
+
};
|
|
16
|
+
resolveInfo: {
|
|
17
|
+
name: string;
|
|
18
|
+
from: string | null;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export declare const BUILT_IN_SCALARS: Record<string, string>;
|
|
22
|
+
export declare class TsCodegenContext {
|
|
23
|
+
private options;
|
|
24
|
+
private imports;
|
|
25
|
+
private typeNameToImports;
|
|
26
|
+
private typeNameToModels;
|
|
27
|
+
private allModelNames;
|
|
28
|
+
private scalars;
|
|
29
|
+
constructor(options: TsCodegenContextOptions);
|
|
30
|
+
addImport(imp: DefinitionImport, node: ASTNode): void;
|
|
31
|
+
addModel(model: DefinitionModel, node: ASTNode): void;
|
|
32
|
+
getAllImportDeclarations(): ts.ImportDeclaration[];
|
|
33
|
+
getAllModelImportDeclarations(): ts.ImportDeclaration[];
|
|
34
|
+
addScalar(scalarName: string | null): void;
|
|
35
|
+
getAllResolverImportDeclarations(): ts.ImportDeclaration[];
|
|
36
|
+
getBaseModelType(): TypeLocation;
|
|
37
|
+
getContextType(): TypeLocation;
|
|
38
|
+
getResolveInfoType(): TypeLocation;
|
|
39
|
+
getDefaultTypes(): (ts.InterfaceDeclaration | ts.TypeAliasDeclaration)[];
|
|
40
|
+
getModelType(typeName: string, putModelSuffix: boolean, saveModels?: boolean, useScalars?: boolean): TypeLocation;
|
|
41
|
+
getDefinedModelType(typeName: string): TypeLocation | null;
|
|
42
|
+
}
|
|
43
|
+
export declare function extractContext(options: Partial<TsCodegenContextOptions>, document: DocumentNode): TsCodegenContext;
|
|
44
|
+
export declare class TypeLocation {
|
|
45
|
+
private from;
|
|
46
|
+
private name;
|
|
47
|
+
constructor(from: string | null, name: string);
|
|
48
|
+
toTypeReference(): ts.TypeReferenceNode;
|
|
49
|
+
toExpression(): ts.Expression;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/codegen/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EAKZ,OAAO,EACR,MAAM,SAAS,CAAC;AACjB,OAAO,EAIN,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAM7D,oBAAY,uBAAuB,GAAG;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE;QACT,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;KACrB,CAAC;IACF,OAAO,EAAE;QACP,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;KACrB,CAAC;IACF,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;KACrB,CAAC;CACH,CAAC;AAIF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAMnD,CAAC;AAsBF,qBAAa,gBAAgB;IAUf,OAAO,CAAC,OAAO;IAT3B,OAAO,CAAC,OAAO,CAAqB;IACpC,OAAO,CAAC,iBAAiB,CAGvB;IACF,OAAO,CAAC,gBAAgB,CAA+B;IACvD,OAAO,CAAC,aAAa,CAAc;IACnC,OAAO,CAAC,OAAO,CAAsB;gBAEjB,OAAO,EAAE,uBAAuB;IAQpD,SAAS,CAAC,GAAG,EAAE,gBAAgB,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI;IAyBrD,QAAQ,CAAC,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI;IAiBrD,wBAAwB,IAAI,EAAE,CAAC,iBAAiB,EAAE;IASlD,6BAA6B,IAAI,EAAE,CAAC,iBAAiB,EAAE;IAmBvD,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAenC,gCAAgC,IAAI,EAAE,CAAC,iBAAiB,EAAE;IAmC1D,gBAAgB,IAAI,YAAY;IAIhC,cAAc,IAAI,YAAY;IAQ9B,kBAAkB,IAAI,YAAY;IAIlC,eAAe;IA6Df,YAAY,CACV,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,OAAO,EACvB,UAAU,UAAQ,EAClB,UAAU,UAAQ,GACjB,YAAY;IAwBf,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI;CAU3D;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,CAAC,uBAAuB,CAAC,EACzC,QAAQ,EAAE,YAAY,GACrB,gBAAgB,CAoBlB;AAED,qBAAa,YAAY;IACX,OAAO,CAAC,IAAI;IAAiB,OAAO,CAAC,IAAI;gBAAjC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAU,IAAI,EAAE,MAAM;IAE7D,eAAe,IAAI,EAAE,CAAC,iBAAiB;IAavC,YAAY,IAAI,EAAE,CAAC,UAAU;CAU9B"}
|