@luvio/compiler 0.79.0 → 0.81.0-238.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/dist/codegen/adapter/adapter-network-cache-policy.js +5 -1
- package/dist/codegen/adapter/adapter-network-cache-policy.js.map +1 -1
- package/dist/codegen/adapter/adapter-param-type-check.js +2 -1
- package/dist/codegen/adapter/adapter-param-type-check.js.map +1 -1
- package/dist/codegen/adapter/index.d.ts +8 -2
- package/dist/codegen/adapter/index.js +18 -14
- package/dist/codegen/adapter/index.js.map +1 -1
- package/dist/codegen/adapter-tests/index.d.ts +3 -2
- package/dist/codegen/adapter-tests/index.js +3 -7
- package/dist/codegen/adapter-tests/index.js.map +1 -1
- package/dist/codegen/graphql/enum/index.d.ts +2 -2
- package/dist/codegen/graphql/enum/index.js +6 -5
- package/dist/codegen/graphql/enum/index.js.map +1 -1
- package/dist/codegen/graphql/enum/interface.d.ts +4 -0
- package/dist/codegen/graphql/enum/interface.js +32 -0
- package/dist/codegen/graphql/enum/interface.js.map +1 -0
- package/dist/codegen/graphql/graphql-dsl.d.ts +19 -0
- package/dist/codegen/graphql/graphql-dsl.js +29 -0
- package/dist/codegen/graphql/graphql-dsl.js.map +1 -0
- package/dist/codegen/graphql/source-printer/graphql-adapter-source-printer.d.ts +8 -0
- package/dist/codegen/graphql/source-printer/graphql-adapter-source-printer.js +11 -0
- package/dist/codegen/graphql/source-printer/graphql-adapter-source-printer.js.map +1 -0
- package/dist/codegen/graphql/source-printer/graphql-resource-source-printer.d.ts +8 -0
- package/dist/codegen/graphql/source-printer/graphql-resource-source-printer.js +11 -0
- package/dist/codegen/graphql/source-printer/graphql-resource-source-printer.js.map +1 -0
- package/dist/codegen/graphql/source-printer/graphql-source-printer.d.ts +19 -0
- package/dist/codegen/graphql/source-printer/graphql-source-printer.js +44 -0
- package/dist/codegen/graphql/source-printer/graphql-source-printer.js.map +1 -0
- package/dist/codegen/graphql/source-printer/graphql-type-source-printer.d.ts +16 -0
- package/dist/codegen/graphql/source-printer/graphql-type-source-printer.js +60 -0
- package/dist/codegen/graphql/source-printer/graphql-type-source-printer.js.map +1 -0
- package/dist/codegen/graphql/source-printer/index.d.ts +5 -0
- package/dist/codegen/graphql/source-printer/index.js +12 -0
- package/dist/codegen/graphql/source-printer/index.js.map +1 -0
- package/dist/codegen/graphql/type/constants.d.ts +7 -0
- package/dist/codegen/graphql/type/constants.js +11 -0
- package/dist/codegen/graphql/type/constants.js.map +1 -0
- package/dist/codegen/graphql/type/index.d.ts +4 -2
- package/dist/codegen/graphql/type/index.js +31 -6
- package/dist/codegen/graphql/type/index.js.map +1 -1
- package/dist/codegen/graphql/type/ingest.d.ts +9 -0
- package/dist/codegen/graphql/type/ingest.js +131 -0
- package/dist/codegen/graphql/type/ingest.js.map +1 -0
- package/dist/codegen/graphql/type/interface.d.ts +3 -3
- package/dist/codegen/graphql/type/interface.js +2 -48
- package/dist/codegen/graphql/type/interface.js.map +1 -1
- package/dist/codegen/graphql/union/index.d.ts +2 -2
- package/dist/codegen/graphql/union/index.js +6 -5
- package/dist/codegen/graphql/union/index.js.map +1 -1
- package/dist/codegen/graphql/union/interface.d.ts +4 -0
- package/dist/codegen/graphql/union/interface.js +30 -0
- package/dist/codegen/graphql/union/interface.js.map +1 -0
- package/dist/codegen/graphql/utils/index.d.ts +1 -0
- package/dist/codegen/graphql/utils/index.js +8 -0
- package/dist/codegen/graphql/utils/index.js.map +1 -0
- package/dist/codegen/graphql/utils/types.d.ts +10 -0
- package/dist/codegen/graphql/utils/types.js +45 -0
- package/dist/codegen/graphql/utils/types.js.map +1 -0
- package/dist/codegen/resource/create-resource-request.d.ts +3 -2
- package/dist/codegen/resource/create-resource-request.js +4 -5
- package/dist/codegen/resource/create-resource-request.js.map +1 -1
- package/dist/codegen/resource/index.d.ts +4 -2
- package/dist/codegen/resource/index.js +3 -3
- package/dist/codegen/resource/index.js.map +1 -1
- package/dist/codegen/rest/source-printer/rest-adapter-source-printer.d.ts +15 -0
- package/dist/codegen/rest/source-printer/rest-adapter-source-printer.js +56 -0
- package/dist/codegen/rest/source-printer/rest-adapter-source-printer.js.map +1 -0
- package/dist/codegen/rest/source-printer/rest-source-printer.d.ts +15 -0
- package/dist/codegen/rest/source-printer/rest-source-printer.js +72 -0
- package/dist/codegen/rest/source-printer/rest-source-printer.js.map +1 -0
- package/dist/codegen/shape/shape-select-paginated.js +7 -7
- package/dist/codegen/shape/shape-select-paginated.js.map +1 -1
- package/dist/codegen/source-writer/file-system-source-writer.d.ts +14 -0
- package/dist/codegen/source-writer/file-system-source-writer.js +31 -0
- package/dist/codegen/source-writer/file-system-source-writer.js.map +1 -0
- package/dist/compiler/raml-compiler.d.ts +14 -0
- package/dist/compiler/raml-compiler.js +41 -0
- package/dist/compiler/raml-compiler.js.map +1 -0
- package/dist/generate.d.ts +6 -4
- package/dist/generate.js +6 -55
- package/dist/generate.js.map +1 -1
- package/dist/interfaces/compiler.d.ts +4 -0
- package/dist/interfaces/compiler.js +3 -0
- package/dist/interfaces/compiler.js.map +1 -0
- package/dist/interfaces/index.d.ts +5 -0
- package/dist/interfaces/index.js +3 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/source-printers/graphql/graphql-adapter-printer.d.ts +7 -0
- package/dist/interfaces/source-printers/graphql/graphql-adapter-printer.js +3 -0
- package/dist/interfaces/source-printers/graphql/graphql-adapter-printer.js.map +1 -0
- package/dist/interfaces/source-printers/graphql/graphql-resource-printer.d.ts +7 -0
- package/dist/interfaces/source-printers/graphql/graphql-resource-printer.js +3 -0
- package/dist/interfaces/source-printers/graphql/graphql-resource-printer.js.map +1 -0
- package/dist/interfaces/source-printers/graphql/graphql-type-printer.d.ts +9 -0
- package/dist/interfaces/source-printers/graphql/graphql-type-printer.js +3 -0
- package/dist/interfaces/source-printers/graphql/graphql-type-printer.js.map +1 -0
- package/dist/interfaces/source-printers/index.d.ts +5 -0
- package/dist/interfaces/source-printers/index.js +3 -0
- package/dist/interfaces/source-printers/index.js.map +1 -0
- package/dist/interfaces/source-printers/rest/rest-adapter-printer.d.ts +5 -0
- package/dist/interfaces/source-printers/rest/rest-adapter-printer.js +3 -0
- package/dist/interfaces/source-printers/rest/rest-adapter-printer.js.map +1 -0
- package/dist/interfaces/source-printers/source-printer.d.ts +6 -0
- package/dist/interfaces/source-printers/source-printer.js +3 -0
- package/dist/interfaces/source-printers/source-printer.js.map +1 -0
- package/dist/interfaces/source-writer.d.ts +5 -0
- package/dist/interfaces/source-writer.js +3 -0
- package/dist/interfaces/source-writer.js.map +1 -0
- package/dist/intermediate/graphql.d.ts +2 -2
- package/dist/main.d.ts +8 -4
- package/dist/main.js +16 -5
- package/dist/main.js.map +1 -1
- package/dist/parser/main.d.ts +8 -1
- package/dist/parser/main.js +186 -180
- package/dist/parser/main.js.map +1 -1
- package/dist/parser/resource.js +7 -7
- package/dist/parser/resource.js.map +1 -1
- package/dist/plugin.d.ts +4 -2
- package/dist/utils/files.d.ts +0 -8
- package/dist/utils/files.js +1 -16
- package/dist/utils/files.js.map +1 -1
- package/dist/utils/generation.d.ts +4 -2
- package/dist/utils/generation.js +8 -14
- package/dist/utils/generation.js.map +1 -1
- package/dist/utils/imports.d.ts +4 -2
- package/dist/utils/imports.js +27 -30
- package/dist/utils/imports.js.map +1 -1
- package/package.json +6 -5
- package/dist/codegen/graphql/index.d.ts +0 -13
- package/dist/codegen/graphql/index.js +0 -87
- package/dist/codegen/graphql/index.js.map +0 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.GraphQLTypeSourcePrinter = exports.GRAPHQL_OBJECT_TYPENAME = exports.GRAPHQL_OUTPUT_DIRECTORY = void 0;
|
|
7
|
+
const imports_1 = require("../../../utils/imports");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const graphql_parser_1 = require("@luvio/graphql-parser");
|
|
10
|
+
const type_1 = require("../type");
|
|
11
|
+
const union_1 = require("../union");
|
|
12
|
+
const enum_1 = require("../enum");
|
|
13
|
+
exports.GRAPHQL_OUTPUT_DIRECTORY = 'graphql';
|
|
14
|
+
exports.GRAPHQL_OBJECT_TYPENAME = 'typeName';
|
|
15
|
+
const GRAPHQL_TYPES_DIRECTORY = 'types';
|
|
16
|
+
class GraphQLTypeSourcePrinter {
|
|
17
|
+
generate(graphqlDsl, compilerBaseOutputDir, metadata) {
|
|
18
|
+
const typeKeys = Object.keys(graphqlDsl.schema.getTypeMap());
|
|
19
|
+
const modules = {};
|
|
20
|
+
const { relPath } = this.createGraphQLTypeImportContext(compilerBaseOutputDir, 'type-util');
|
|
21
|
+
const typeUtil = (0, type_1.generateTypeUtil)();
|
|
22
|
+
modules[relPath] = typeUtil;
|
|
23
|
+
typeKeys.forEach((typeKey) => {
|
|
24
|
+
const typeDefinition = graphqlDsl.schema.getType(typeKey);
|
|
25
|
+
if (typeDefinition !== undefined &&
|
|
26
|
+
typeDefinition !== null &&
|
|
27
|
+
typeDefinition.astNode !== undefined &&
|
|
28
|
+
typeDefinition.astNode !== null) {
|
|
29
|
+
const kind = typeDefinition.astNode.kind;
|
|
30
|
+
const { relPath, importContext } = this.createGraphQLTypeImportContext(compilerBaseOutputDir, typeDefinition.name);
|
|
31
|
+
switch (kind) {
|
|
32
|
+
case graphql_parser_1.Kind.OBJECT_TYPE_DEFINITION:
|
|
33
|
+
case graphql_parser_1.Kind.INTERFACE_TYPE_DEFINITION:
|
|
34
|
+
modules[relPath] = (0, type_1.generateType)(graphqlDsl, typeDefinition.name, typeDefinition.astNode, importContext, metadata);
|
|
35
|
+
break;
|
|
36
|
+
case graphql_parser_1.Kind.UNION_TYPE_DEFINITION:
|
|
37
|
+
modules[relPath] = (0, union_1.generate)(typeDefinition.name, typeDefinition.astNode, importContext, metadata);
|
|
38
|
+
break;
|
|
39
|
+
case graphql_parser_1.Kind.ENUM_TYPE_DEFINITION:
|
|
40
|
+
modules[relPath] = (0, enum_1.generate)(typeDefinition.name, typeDefinition.astNode, importContext, metadata);
|
|
41
|
+
break;
|
|
42
|
+
default:
|
|
43
|
+
// not supported
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return modules;
|
|
49
|
+
}
|
|
50
|
+
createGraphQLTypeImportContext(compilerBaseOutputDir, defName) {
|
|
51
|
+
const graphqlRelPath = path_1.default.join(exports.GRAPHQL_OUTPUT_DIRECTORY, GRAPHQL_TYPES_DIRECTORY, `${defName}.ts`);
|
|
52
|
+
const shapeAbsPath = path_1.default.parse(path_1.default.resolve(path_1.default.format(compilerBaseOutputDir), graphqlRelPath));
|
|
53
|
+
return {
|
|
54
|
+
relPath: graphqlRelPath,
|
|
55
|
+
importContext: (0, imports_1.createImportContext)(shapeAbsPath, compilerBaseOutputDir),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.GraphQLTypeSourcePrinter = GraphQLTypeSourcePrinter;
|
|
60
|
+
//# sourceMappingURL=graphql-type-source-printer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-type-source-printer.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/source-printer/graphql-type-source-printer.ts"],"names":[],"mappings":";;;;;;AAEA,oDAA6D;AAC7D,gDAAwB;AACxB,0DAA6C;AAE7C,kCAAyD;AACzD,oCAAyD;AACzD,kCAAuD;AAG1C,QAAA,wBAAwB,GAAG,SAAS,CAAC;AACrC,QAAA,uBAAuB,GAAG,UAAU,CAAC;AAClD,MAAM,uBAAuB,GAAG,OAAO,CAAC;AAIxC,MAAa,wBAAwB;IACjC,QAAQ,CACJ,UAA2B,EAC3B,qBAAsC,EACtC,QAAgC;QAEhC,MAAM,QAAQ,GAAG,MAAM,CAAC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AC1B,OAAO,CAAC,OAAO,CAAC,GAAG,IAAA,eAAgB,EAC/B,cAAc,CAAC,IAAI,EACnB,cAAc,CAAC,OAAO,EACtB,aAAa,EACb,QAAQ,CACX,CAAC;wBACF,MAAM;oBAEV;wBACI,gBAAgB;wBAChB,MAAM;iBACb;aACJ;QACL,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,8BAA8B,CAC1B,qBAAsC,EACtC,OAAe;QAEf,MAAM,cAAc,GAAG,cAAI,CAAC,IAAI,CAC5B,gCAAwB,EACxB,uBAAuB,EACvB,GAAG,OAAO,KAAK,CAClB,CAAC;QACF,MAAM,YAAY,GAAG,cAAI,CAAC,KAAK,CAC3B,cAAI,CAAC,OAAO,CAAC,cAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAAE,cAAc,CAAC,CACnE,CAAC;QACF,OAAO;YACH,OAAO,EAAE,cAAc;YACvB,aAAa,EAAE,IAAA,6BAAmB,EAAC,YAAY,EAAE,qBAAqB,CAAC;SAC1E,CAAC;IACN,CAAC;CACJ;AAnFD,4DAmFC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { GraphQLAdapterSourcePrinter } from './graphql-adapter-source-printer';
|
|
2
|
+
import { GraphQLResourceSourcePrinter } from './graphql-resource-source-printer';
|
|
3
|
+
import { GraphQLSourcePrinter } from './graphql-source-printer';
|
|
4
|
+
import { GraphQLTypeSourcePrinter } from './graphql-type-source-printer';
|
|
5
|
+
export { GraphQLSourcePrinter, GraphQLTypeSourcePrinter, GraphQLResourceSourcePrinter, GraphQLAdapterSourcePrinter, };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GraphQLAdapterSourcePrinter = exports.GraphQLResourceSourcePrinter = exports.GraphQLTypeSourcePrinter = exports.GraphQLSourcePrinter = void 0;
|
|
4
|
+
const graphql_adapter_source_printer_1 = require("./graphql-adapter-source-printer");
|
|
5
|
+
Object.defineProperty(exports, "GraphQLAdapterSourcePrinter", { enumerable: true, get: function () { return graphql_adapter_source_printer_1.GraphQLAdapterSourcePrinter; } });
|
|
6
|
+
const graphql_resource_source_printer_1 = require("./graphql-resource-source-printer");
|
|
7
|
+
Object.defineProperty(exports, "GraphQLResourceSourcePrinter", { enumerable: true, get: function () { return graphql_resource_source_printer_1.GraphQLResourceSourcePrinter; } });
|
|
8
|
+
const graphql_source_printer_1 = require("./graphql-source-printer");
|
|
9
|
+
Object.defineProperty(exports, "GraphQLSourcePrinter", { enumerable: true, get: function () { return graphql_source_printer_1.GraphQLSourcePrinter; } });
|
|
10
|
+
const graphql_type_source_printer_1 = require("./graphql-type-source-printer");
|
|
11
|
+
Object.defineProperty(exports, "GraphQLTypeSourcePrinter", { enumerable: true, get: function () { return graphql_type_source_printer_1.GraphQLTypeSourcePrinter; } });
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/source-printer/index.ts"],"names":[],"mappings":";;;AAAA,qFAA+E;AAQ3E,4GARK,4DAA2B,OAQL;AAP/B,uFAAiF;AAM7E,6GANK,8DAA4B,OAML;AALhC,qEAAgE;AAG5D,qGAHK,6CAAoB,OAGL;AAFxB,+EAAyE;AAGrE,yGAHK,sDAAwB,OAGL"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const GRAPHQL_VARIABLES_IDENTIFIER = "GraphQLVariables";
|
|
2
|
+
export declare const GRAPHQL_STATE_INTERFACE_IDENTIFIER = "GraphQLState";
|
|
3
|
+
export declare const TIMESTAMP_IDENTIFIER = "timestamp";
|
|
4
|
+
export declare const CREATE_LINK_IDENTIFIER = "createLink";
|
|
5
|
+
export declare const TYPE_UTIL_IDENTIFIER = "type-util";
|
|
6
|
+
export declare const TYPE_INGEST_IDENTIFIER = "ingest";
|
|
7
|
+
export declare const KEY_BUILDER_IDENTIFIER = "keyBuilder";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.KEY_BUILDER_IDENTIFIER = exports.TYPE_INGEST_IDENTIFIER = exports.TYPE_UTIL_IDENTIFIER = exports.CREATE_LINK_IDENTIFIER = exports.TIMESTAMP_IDENTIFIER = exports.GRAPHQL_STATE_INTERFACE_IDENTIFIER = exports.GRAPHQL_VARIABLES_IDENTIFIER = void 0;
|
|
4
|
+
exports.GRAPHQL_VARIABLES_IDENTIFIER = 'GraphQLVariables';
|
|
5
|
+
exports.GRAPHQL_STATE_INTERFACE_IDENTIFIER = 'GraphQLState';
|
|
6
|
+
exports.TIMESTAMP_IDENTIFIER = 'timestamp';
|
|
7
|
+
exports.CREATE_LINK_IDENTIFIER = 'createLink';
|
|
8
|
+
exports.TYPE_UTIL_IDENTIFIER = 'type-util';
|
|
9
|
+
exports.TYPE_INGEST_IDENTIFIER = 'ingest';
|
|
10
|
+
exports.KEY_BUILDER_IDENTIFIER = 'keyBuilder';
|
|
11
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/type/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,4BAA4B,GAAG,kBAAkB,CAAC;AAClD,QAAA,kCAAkC,GAAG,cAAc,CAAC;AACpD,QAAA,oBAAoB,GAAG,WAAW,CAAC;AACnC,QAAA,sBAAsB,GAAG,YAAY,CAAC;AACtC,QAAA,oBAAoB,GAAG,WAAW,CAAC;AACnC,QAAA,sBAAsB,GAAG,QAAQ,CAAC;AAClC,QAAA,sBAAsB,GAAG,YAAY,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ImportContext } from '../../../utils/imports';
|
|
2
2
|
import type { InterfaceTypeDefinitionNode, ObjectTypeDefinitionNode } from '@luvio/graphql-parser';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
3
|
+
import type { LuvioGraphQLDSL } from '../graphql-dsl';
|
|
4
|
+
import type { GraphQLCodegenMetadata } from '../source-printer/graphql-source-printer';
|
|
5
|
+
export declare function generateTypeUtil(): string;
|
|
6
|
+
export declare function generateType(graphqlDsl: LuvioGraphQLDSL, typeName: string, def: ObjectTypeDefinitionNode | InterfaceTypeDefinitionNode, importContext: ImportContext, metadata: GraphQLCodegenMetadata): string;
|
|
@@ -3,16 +3,41 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.generateType = void 0;
|
|
6
|
+
exports.generateType = exports.generateTypeUtil = void 0;
|
|
7
7
|
const deindent_1 = __importDefault(require("../../../utils/deindent"));
|
|
8
8
|
const key_1 = require("./key");
|
|
9
9
|
const interface_1 = require("./interface");
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const ingest_1 = require("./ingest");
|
|
11
|
+
const imports_1 = require("../../../utils/imports");
|
|
12
|
+
const constants_1 = require("../../adapter/constants");
|
|
13
|
+
const constants_2 = require("../../shared/constants");
|
|
14
|
+
const constants_3 = require("./constants");
|
|
15
|
+
function generateTypeUtil() {
|
|
16
|
+
return (0, imports_1.resolveImports)((0, deindent_1.default) `
|
|
17
|
+
export type ${constants_3.GRAPHQL_VARIABLES_IDENTIFIER} = Record<string, any>;
|
|
18
|
+
export interface ${constants_3.GRAPHQL_STATE_INTERFACE_IDENTIFIER}<D = unknown> {
|
|
19
|
+
data: D,
|
|
20
|
+
variables: ${constants_3.GRAPHQL_VARIABLES_IDENTIFIER},
|
|
21
|
+
path: ${constants_1.ADAPTER_INGEST_PATH_INTERFACE_IDENTIFIER}
|
|
22
|
+
${constants_2.LUVIO_IDENTIFIER}: ${constants_2.LUVIO_IMPORT},
|
|
23
|
+
${constants_2.LUVIO_STORE_IDENTIFIER}: ${constants_2.LUVIO_STORE_IMPORT},
|
|
24
|
+
${constants_3.TIMESTAMP_IDENTIFIER}: number
|
|
25
|
+
};
|
|
26
|
+
export function ${constants_3.CREATE_LINK_IDENTIFIER}(ref: string) {
|
|
27
|
+
return {
|
|
28
|
+
__ref: ref,
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`);
|
|
32
|
+
}
|
|
33
|
+
exports.generateTypeUtil = generateTypeUtil;
|
|
34
|
+
function generateType(graphqlDsl, typeName, def, importContext, metadata) {
|
|
35
|
+
return (0, imports_1.resolveImports)((0, deindent_1.default) `
|
|
12
36
|
export const name = '${typeName}';
|
|
13
|
-
${(0, interface_1.generateInterface)(
|
|
14
|
-
${(0, key_1.generateKey)(def, importContext,
|
|
15
|
-
|
|
37
|
+
${(0, interface_1.generateInterface)(typeName, def, importContext, metadata)}
|
|
38
|
+
${(0, key_1.generateKey)(def, importContext, graphqlDsl.schemaName)}
|
|
39
|
+
${(0, ingest_1.generateIngest)(graphqlDsl, def, importContext)}
|
|
40
|
+
`);
|
|
16
41
|
}
|
|
17
42
|
exports.generateType = generateType;
|
|
18
43
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/type/index.ts"],"names":[],"mappings":";;;;;;AAAA,uEAA+C;AAC/C,+BAAoC;AACpC,2CAAgD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/type/index.ts"],"names":[],"mappings":";;;;;;AAAA,uEAA+C;AAC/C,+BAAoC;AACpC,2CAAgD;AAChD,qCAA0C;AAC1C,oDAAwD;AAKxD,uDAAmF;AAEnF,sDAKgC;AAChC,2CAKqB;AAErB,SAAgB,gBAAgB;IAC5B,OAAO,IAAA,wBAAc,EAAC,IAAA,kBAAQ,EAAA;sBACZ,wCAA4B;2BACvB,8CAAkC;;yBAEpC,wCAA4B;oBACjC,oDAAwC;cAC9C,4BAAgB,KAAK,wBAAY;cACjC,kCAAsB,KAAK,8BAAkB;cAC7C,gCAAoB;;0BAER,kCAAsB;;;;;KAK3C,CAAC,CAAC;AACP,CAAC;AAjBD,4CAiBC;AAED,SAAgB,YAAY,CACxB,UAA2B,EAC3B,QAAgB,EAChB,GAA2D,EAC3D,aAA4B,EAC5B,QAAgC;IAEhC,OAAO,IAAA,wBAAc,EAAC,IAAA,kBAAQ,EAAA;+BACH,QAAQ;UAC7B,IAAA,6BAAiB,EAAC,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE,QAAQ,CAAC;UACzD,IAAA,iBAAW,EAAC,GAAG,EAAE,aAAa,EAAE,UAAU,CAAC,UAAU,CAAC;UACtD,IAAA,uBAAc,EAAC,UAAU,EAAE,GAAG,EAAE,aAAa,CAAC;KACnD,CAAC,CAAC;AACP,CAAC;AAbD,oCAaC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FieldDefinitionNode, InterfaceTypeDefinitionNode, ListTypeNode, NamedTypeNode, ObjectTypeDefinitionNode, TypeNode } from '@luvio/graphql-parser';
|
|
2
|
+
import type { ImportContext } from '../../../utils/imports';
|
|
3
|
+
import type { NormalizableTypes } from '../utils';
|
|
4
|
+
import type { LuvioGraphQLDSL } from '../graphql-dsl';
|
|
5
|
+
export declare function ingestNamedType(field: FieldDefinitionNode, typeNode: NamedTypeNode, importContext: ImportContext, normalizableTypeMap: NormalizableTypes): string;
|
|
6
|
+
export declare function ingestListType(field: FieldDefinitionNode, typeNode: ListTypeNode, importContext: ImportContext, normalizableTypeMap: NormalizableTypes): string;
|
|
7
|
+
export declare function ingestType(field: FieldDefinitionNode, typeNode: TypeNode, importContext: ImportContext, normalizableTypeMap: NormalizableTypes): string;
|
|
8
|
+
export declare function generateIngestFromDef(graphqlDsl: LuvioGraphQLDSL, def: ObjectTypeDefinitionNode | InterfaceTypeDefinitionNode, importContext: ImportContext, normalizableTypeMap: NormalizableTypes): string;
|
|
9
|
+
export declare function generateIngest(graphqlDsl: LuvioGraphQLDSL, def: ObjectTypeDefinitionNode | InterfaceTypeDefinitionNode, importContext: ImportContext): string;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateIngest = exports.generateIngestFromDef = exports.ingestType = exports.ingestListType = exports.ingestNamedType = void 0;
|
|
7
|
+
const deindent_1 = __importDefault(require("../../../utils/deindent"));
|
|
8
|
+
const constants_1 = require("../../shared/constants");
|
|
9
|
+
const utils_1 = require("../utils");
|
|
10
|
+
const constants_2 = require("./constants");
|
|
11
|
+
function ingestNamedType(field, typeNode, importContext, normalizableTypeMap) {
|
|
12
|
+
const typeName = (0, utils_1.resolveTypeName)(typeNode);
|
|
13
|
+
const { importGraphQLArtifact } = importContext;
|
|
14
|
+
// check for ingestable types - non-scalars
|
|
15
|
+
if (normalizableTypeMap[typeName] === undefined) {
|
|
16
|
+
return '';
|
|
17
|
+
}
|
|
18
|
+
const typeNameIngestImport = importGraphQLArtifact(typeName, constants_2.TYPE_INGEST_IDENTIFIER);
|
|
19
|
+
return (0, deindent_1.default) `
|
|
20
|
+
if (data.${field.name.value} !== undefined && data.${field.name.value} !== null) {
|
|
21
|
+
data.${field.name.value} = ${typeNameIngestImport}({
|
|
22
|
+
...state,
|
|
23
|
+
path: {
|
|
24
|
+
parent: null,
|
|
25
|
+
propertyName: '${field.name.value}',
|
|
26
|
+
fullPath: key + '__${field.name.value}'
|
|
27
|
+
},
|
|
28
|
+
data: data.${field.name.value},
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
`;
|
|
32
|
+
}
|
|
33
|
+
exports.ingestNamedType = ingestNamedType;
|
|
34
|
+
function ingestListType(field, typeNode, importContext, normalizableTypeMap) {
|
|
35
|
+
const { importGraphQLArtifact } = importContext;
|
|
36
|
+
const fieldName = field.name.value;
|
|
37
|
+
const typeName = (0, utils_1.resolveTypeName)(typeNode);
|
|
38
|
+
const fullPathIdentifier = `fullPath__${fieldName}`;
|
|
39
|
+
const typeDefinition = normalizableTypeMap[typeName];
|
|
40
|
+
const dataIdentifier = `data.${fieldName}`;
|
|
41
|
+
const collectionIdentifier = `${fieldName}__items`;
|
|
42
|
+
// Non-normalizable types
|
|
43
|
+
if (typeDefinition === undefined) {
|
|
44
|
+
return (0, deindent_1.default) `
|
|
45
|
+
if (${dataIdentifier} !== undefined && ${dataIdentifier} !== null) {
|
|
46
|
+
const ${fullPathIdentifier} = key + '__${fieldName}';
|
|
47
|
+
store.publish(${fullPathIdentifier}, ${dataIdentifier})
|
|
48
|
+
${dataIdentifier} = {
|
|
49
|
+
__ref: ${fullPathIdentifier}
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
`;
|
|
53
|
+
}
|
|
54
|
+
const typeNameIngestImport = importGraphQLArtifact(typeName, constants_2.TYPE_INGEST_IDENTIFIER);
|
|
55
|
+
return (0, deindent_1.default) `
|
|
56
|
+
if(${dataIdentifier} !== undefined && ${dataIdentifier} !== null) {
|
|
57
|
+
const ${collectionIdentifier}: ${constants_1.LUVIO_STORE_LINK_IMPORT}[] = [];
|
|
58
|
+
const ${fullPathIdentifier} = key + '__${fieldName}';
|
|
59
|
+
for(let i = 0, len = ${dataIdentifier}.length; i < len; i++) {
|
|
60
|
+
const item = ${dataIdentifier}[i];
|
|
61
|
+
// add TTL Info
|
|
62
|
+
${collectionIdentifier}[i] = ${typeNameIngestImport}({
|
|
63
|
+
...state,
|
|
64
|
+
path: {
|
|
65
|
+
parent: null,
|
|
66
|
+
propertyName: i,
|
|
67
|
+
fullPath: ${fullPathIdentifier} + i
|
|
68
|
+
},
|
|
69
|
+
data: item,
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
${constants_1.LUVIO_STORE_IDENTIFIER}.publish(${fullPathIdentifier}, ${collectionIdentifier})
|
|
73
|
+
${dataIdentifier} = {
|
|
74
|
+
__ref: ${fullPathIdentifier}
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
`;
|
|
78
|
+
}
|
|
79
|
+
exports.ingestListType = ingestListType;
|
|
80
|
+
function ingestType(field, typeNode, importContext, normalizableTypeMap) {
|
|
81
|
+
if (field === undefined) {
|
|
82
|
+
return '';
|
|
83
|
+
}
|
|
84
|
+
switch (typeNode.kind) {
|
|
85
|
+
case 'NamedType':
|
|
86
|
+
return ingestNamedType(field, typeNode, importContext, normalizableTypeMap);
|
|
87
|
+
case 'ListType':
|
|
88
|
+
return ingestListType(field, typeNode, importContext, normalizableTypeMap);
|
|
89
|
+
default:
|
|
90
|
+
return ingestType(field, typeNode.type, importContext, normalizableTypeMap);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.ingestType = ingestType;
|
|
94
|
+
function generateIngestFromDef(graphqlDsl, def, importContext, normalizableTypeMap) {
|
|
95
|
+
const { schema } = graphqlDsl;
|
|
96
|
+
const type = schema.getType(def.name.value);
|
|
97
|
+
const fieldMap = type.getFields();
|
|
98
|
+
const fieldList = Object.keys(fieldMap);
|
|
99
|
+
const statements = fieldList.map((fieldName) => {
|
|
100
|
+
var _a, _b;
|
|
101
|
+
const field = fieldMap[fieldName];
|
|
102
|
+
if (((_a = field.astNode) === null || _a === void 0 ? void 0 : _a.type) === undefined) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
return ingestType(field.astNode, (_b = field.astNode) === null || _b === void 0 ? void 0 : _b.type, importContext, normalizableTypeMap);
|
|
106
|
+
});
|
|
107
|
+
return statements.filter((statement) => statement !== '').join('\n');
|
|
108
|
+
}
|
|
109
|
+
exports.generateIngestFromDef = generateIngestFromDef;
|
|
110
|
+
function generateIngest(graphqlDsl, def, importContext) {
|
|
111
|
+
const { schema } = graphqlDsl;
|
|
112
|
+
const { importGraphQLArtifact } = importContext;
|
|
113
|
+
const normalizableTypeMap = (0, utils_1.getNormalizableTypeMap)(schema);
|
|
114
|
+
const createLink = importGraphQLArtifact(constants_2.TYPE_UTIL_IDENTIFIER, constants_2.CREATE_LINK_IDENTIFIER);
|
|
115
|
+
const graphQLStateInterface = importGraphQLArtifact(constants_2.TYPE_UTIL_IDENTIFIER, constants_2.GRAPHQL_STATE_INTERFACE_IDENTIFIER);
|
|
116
|
+
return (0, deindent_1.default) `
|
|
117
|
+
export function ingest<D>(state: ${graphQLStateInterface}<D>) {
|
|
118
|
+
const { path, ${constants_1.LUVIO_STORE_IDENTIFIER} } = state;
|
|
119
|
+
const data: any = state.data;
|
|
120
|
+
const key = ${constants_2.KEY_BUILDER_IDENTIFIER}(path, data as any);
|
|
121
|
+
// normalize
|
|
122
|
+
${generateIngestFromDef(graphqlDsl, def, importContext, normalizableTypeMap)};
|
|
123
|
+
|
|
124
|
+
// publish
|
|
125
|
+
${constants_1.LUVIO_STORE_IDENTIFIER}.publish(key, data);
|
|
126
|
+
return ${createLink}(key);
|
|
127
|
+
}
|
|
128
|
+
`;
|
|
129
|
+
}
|
|
130
|
+
exports.generateIngest = generateIngest;
|
|
131
|
+
//# sourceMappingURL=ingest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ingest.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/type/ingest.ts"],"names":[],"mappings":";;;;;;AASA,uEAA+C;AAE/C,sDAAyF;AAEzF,oCAAmE;AACnE,2CAMqB;AAGrB,SAAgB,eAAe,CAC3B,KAA0B,EAC1B,QAAuB,EACvB,aAA4B,EAC5B,mBAAsC;IAEtC,MAAM,QAAQ,GAAG,IAAA,uBAAe,EAAC,QAAQ,CAAC,CAAC;IAC3C,MAAM,EAAE,qBAAqB,EAAE,GAAG,aAAa,CAAC;IAChD,2CAA2C;IAC3C,IAAI,mBAAmB,CAAC,QAAQ,CAAC,KAAK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AC,SAAS,CAAC,CAAC;QAElC,IAAI,CAAA,MAAA,KAAK,CAAC,OAAO,0CAAE,IAAI,MAAK,SAAS,EAAE;YACnC,OAAO;SACV;QACD,OAAO,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,MAAA,KAAK,CAAC,OAAO,0CAAE,IAAI,EAAE,aAAa,EAAE,mBAAmB,CAAC,CAAC;IAC9F,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACzE,CAAC;AAtBD,sDAsBC;AAED,SAAgB,cAAc,CAC1B,UAA2B,EAC3B,GAA2D,EAC3D,aAA4B;IAE5B,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IAC9B,MAAM,EAAE,qBAAqB,EAAE,GAAG,aAAa,CAAC;IAChD,MAAM,mBAAmB,GAAG,IAAA,8BAAsB,EAAC,MAAM,CAAC,CAAC;IAC3D,MAAM,UAAU,GAAG,qBAAqB,CAAC,gCAAoB,EAAE,kCAAsB,CAAC,CAAC;IACvF,MAAM,qBAAqB,GAAG,qBAAqB,CAC/C,gCAAoB,EACpB,8CAAkC,CACrC,CAAC;IAEF,OAAO,IAAA,kBAAQ,EAAA;2CACwB,qBAAqB;4BACpC,kCAAsB;;0BAExB,kCAAsB;;cAElC,qBAAqB,CAAC,UAAU,EAAE,GAAG,EAAE,aAAa,EAAE,mBAAmB,CAAC;;;cAG1E,kCAAsB;qBACf,UAAU;;KAE1B,CAAC;AACN,CAAC;AA3BD,wCA2BC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { InterfaceTypeDefinitionNode, ObjectTypeDefinitionNode, TypeNode } from '@luvio/graphql-parser';
|
|
2
|
+
import type { GraphQLCodegenMetadata } from '../source-printer/graphql-source-printer';
|
|
3
3
|
import type { ImportContext } from '../../../utils/imports';
|
|
4
4
|
export declare const TYPE_INTERFACE_IDENTIFIER = "Interface";
|
|
5
5
|
export declare const MINIMUM_INTERFACE_IDENTIFIER: string;
|
|
@@ -8,4 +8,4 @@ export declare function generateTypeReference(type: TypeNode, importContext: Imp
|
|
|
8
8
|
required: boolean;
|
|
9
9
|
array: boolean;
|
|
10
10
|
}): string;
|
|
11
|
-
export declare function generateInterface(
|
|
11
|
+
export declare function generateInterface(name: string, def: ObjectTypeDefinitionNode | InterfaceTypeDefinitionNode, importContext: ImportContext, metadata: GraphQLCodegenMetadata): string;
|
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.generateInterface = exports.generateTypeReference = exports.PARTIAL_INTERFACE_IDENTIFIER = exports.MINIMUM_INTERFACE_IDENTIFIER = exports.TYPE_INTERFACE_IDENTIFIER = void 0;
|
|
7
|
-
const graphql_parser_1 = require("@luvio/graphql-parser");
|
|
8
7
|
const deindent_1 = __importDefault(require("../../../utils/deindent"));
|
|
9
8
|
const key_1 = require("./key");
|
|
10
9
|
exports.TYPE_INTERFACE_IDENTIFIER = 'Interface';
|
|
@@ -88,53 +87,8 @@ function generateObjectTypeDefinitionNode(name, def, importContext, scalarToPrim
|
|
|
88
87
|
export type ${exports.PARTIAL_INTERFACE_IDENTIFIER} = ${partialDef};
|
|
89
88
|
`;
|
|
90
89
|
}
|
|
91
|
-
function
|
|
92
|
-
|
|
93
|
-
if (values === undefined) {
|
|
94
|
-
return (0, deindent_1.default) `
|
|
95
|
-
enum ${exports.TYPE_INTERFACE_IDENTIFIER} {}
|
|
96
|
-
`;
|
|
97
|
-
}
|
|
98
|
-
const rendered = values.map((value) => {
|
|
99
|
-
const { value: enumName } = value.name;
|
|
100
|
-
return (0, deindent_1.default) `
|
|
101
|
-
${enumName} = '${enumName}'
|
|
102
|
-
`;
|
|
103
|
-
});
|
|
104
|
-
return (0, deindent_1.default) `
|
|
105
|
-
export enum ${exports.TYPE_INTERFACE_IDENTIFIER} {
|
|
106
|
-
${rendered.join(',\n')}
|
|
107
|
-
}
|
|
108
|
-
`;
|
|
109
|
-
}
|
|
110
|
-
function generateUnionDefinitionNode(name, def, importContext, scalarToPrimitiveMap) {
|
|
111
|
-
const { types } = def;
|
|
112
|
-
if (types === undefined) {
|
|
113
|
-
return (0, deindent_1.default) `
|
|
114
|
-
export type ${exports.TYPE_INTERFACE_IDENTIFIER} = never;
|
|
115
|
-
`;
|
|
116
|
-
}
|
|
117
|
-
const unions = types.map((type) => {
|
|
118
|
-
return generateTypeReference(type, importContext, scalarToPrimitiveMap, {
|
|
119
|
-
required: true,
|
|
120
|
-
array: false,
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
return (0, deindent_1.default) `
|
|
124
|
-
export type ${exports.TYPE_INTERFACE_IDENTIFIER} = ${unions.join(' | ')}
|
|
125
|
-
`;
|
|
126
|
-
}
|
|
127
|
-
function generateInterface(state, name, def, importContext) {
|
|
128
|
-
switch (def.kind) {
|
|
129
|
-
case graphql_parser_1.Kind.OBJECT_TYPE_DEFINITION:
|
|
130
|
-
case graphql_parser_1.Kind.INTERFACE_TYPE_DEFINITION:
|
|
131
|
-
return generateObjectTypeDefinitionNode(name, def, importContext, state.scalarToPrimitiveMap);
|
|
132
|
-
case graphql_parser_1.Kind.UNION_TYPE_DEFINITION:
|
|
133
|
-
return generateUnionDefinitionNode(name, def, importContext, state.scalarToPrimitiveMap);
|
|
134
|
-
case graphql_parser_1.Kind.ENUM_TYPE_DEFINITION:
|
|
135
|
-
return generateEnumDefinitionNode(name, def);
|
|
136
|
-
}
|
|
137
|
-
return '';
|
|
90
|
+
function generateInterface(name, def, importContext, metadata) {
|
|
91
|
+
return generateObjectTypeDefinitionNode(name, def, importContext, metadata.scalarToPrimitiveMap);
|
|
138
92
|
}
|
|
139
93
|
exports.generateInterface = generateInterface;
|
|
140
94
|
//# sourceMappingURL=interface.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/type/interface.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/type/interface.ts"],"names":[],"mappings":";;;;;;AAQA,uEAA+C;AAE/C,+BAAmC;AAEtB,QAAA,yBAAyB,GAAG,WAAW,CAAC;AACxC,QAAA,4BAA4B,GAAG,UAAU,iCAAyB,EAAE,CAAC;AACrE,QAAA,4BAA4B,GAAG,UAAU,iCAAyB,EAAE,CAAC;AAElF,SAAS,0BAA0B,CAC/B,IAAmB,EACnB,aAA4B,EAC5B,oBAA4C;IAE5C,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC;IAEtC,IAAI,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,SAAS,EAAE;QACrD,OAAO,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KAChD;IAED,OAAO,aAAa,CAAC,qBAAqB,CAAC,QAAQ,EAAE,iCAAyB,CAAC,CAAC;AACpF,CAAC;AAED,SAAgB,qBAAqB,CACjC,IAAc,EACd,aAA4B,EAC5B,oBAA4C,EAC5C,KAA4C;IAE5C,QAAQ,IAAI,CAAC,IAAI,EAAE;QACf,KAAK,UAAU;YACX,OAAO,GAAG,qBAAqB,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,EAAE,oBAAoB,EAAE;gBAC5E,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,KAAK,EAAE,IAAI;aACd,CAAC,EAAE,CAAC;QACT,KAAK,aAAa;YACd,OAAO,qBAAqB,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,EAAE,oBAAoB,EAAE;gBACzE,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,KAAK,C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Q,EAAA;cACT,IAAI,CAAC,KAAK,KAAK,qBAAqB,CAAC,IAAI,EAAE,aAAa,EAAE,oBAAoB,EAAE;YAClF,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,KAAK;SACf,CAAC;SACD,CAAC;IACN,CAAC,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,IAAA,gBAAU,EAAC,GAAG,CAAC,CAAC;IAC/B,MAAM,OAAO,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAC;IAEjD,MAAM,UAAU,GACZ,OAAO,KAAK,EAAE;QACV,CAAC,CAAC,WAAW,iCAAyB,GAAG;QACzC,CAAC,CAAC,WAAW,iCAAyB,OAAO,oCAA4B,EAAE,CAAC;IAEpF,OAAO,IAAA,kBAAQ,EAAA;2BACQ,iCAAyB;cACtC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC;;;UAG1B,OAAO;;sBAEK,oCAA4B,MAAM,UAAU;KAC7D,CAAC;AACN,CAAC;AAED,SAAgB,iBAAiB,CAC7B,IAAY,EACZ,GAA2D,EAC3D,aAA4B,EAC5B,QAAgC;IAEhC,OAAO,gCAAgC,CACnC,IAAI,EACJ,GAA+B,EAC/B,aAAa,EACb,QAAQ,CAAC,oBAAoB,CAChC,CAAC;AACN,CAAC;AAZD,8CAYC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { UnionTypeDefinitionNode } from '@luvio/graphql-parser';
|
|
2
|
-
import type { GraphQLGenerateState } from '..';
|
|
3
2
|
import type { ImportContext } from '../../../utils/imports';
|
|
4
|
-
|
|
3
|
+
import type { GraphQLCodegenMetadata } from '../source-printer/graphql-source-printer';
|
|
4
|
+
export declare function generate(name: string, def: UnionTypeDefinitionNode, importContext: ImportContext, metadata: GraphQLCodegenMetadata): string;
|
|
@@ -5,11 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.generate = void 0;
|
|
7
7
|
const deindent_1 = __importDefault(require("../../../utils/deindent"));
|
|
8
|
-
const interface_1 = require("
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
const interface_1 = require("./interface");
|
|
9
|
+
const imports_1 = require("../../../utils/imports");
|
|
10
|
+
function generate(name, def, importContext, metadata) {
|
|
11
|
+
return (0, imports_1.resolveImports)((0, deindent_1.default) `
|
|
12
|
+
${(0, interface_1.generateInterface)(name, def, importContext, metadata)}
|
|
13
|
+
`);
|
|
13
14
|
}
|
|
14
15
|
exports.generate = generate;
|
|
15
16
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/union/index.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/union/index.ts"],"names":[],"mappings":";;;;;;AACA,uEAA+C;AAE/C,2CAAgD;AAChD,oDAAwD;AAGxD,SAAgB,QAAQ,CACpB,IAAY,EACZ,GAA4B,EAC5B,aAA4B,EAC5B,QAAgC;IAEhC,OAAO,IAAA,wBAAc,EAAC,IAAA,kBAAQ,EAAA;UACxB,IAAA,6BAAiB,EAAC,IAAI,EAAE,GAAG,EAAE,aAAa,EAAE,QAAQ,CAAC;KAC1D,CAAC,CAAC;AACP,CAAC;AATD,4BASC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { UnionTypeDefinitionNode } from '@luvio/graphql-parser';
|
|
2
|
+
import type { ImportContext } from '../../../utils/imports';
|
|
3
|
+
import type { GraphQLCodegenMetadata } from '../source-printer/graphql-source-printer';
|
|
4
|
+
export declare function generateInterface(name: string, def: UnionTypeDefinitionNode, importContext: ImportContext, metadata: GraphQLCodegenMetadata): string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.generateInterface = void 0;
|
|
7
|
+
const deindent_1 = __importDefault(require("../../../utils/deindent"));
|
|
8
|
+
const interface_1 = require("../type/interface");
|
|
9
|
+
function generateInterface(name, def, importContext, metadata) {
|
|
10
|
+
return generateUnionDefinitionNode(name, def, importContext, metadata.scalarToPrimitiveMap);
|
|
11
|
+
}
|
|
12
|
+
exports.generateInterface = generateInterface;
|
|
13
|
+
function generateUnionDefinitionNode(name, def, importContext, scalarToPrimitiveMap) {
|
|
14
|
+
const { types } = def;
|
|
15
|
+
if (types === undefined) {
|
|
16
|
+
return (0, deindent_1.default) `
|
|
17
|
+
export type ${interface_1.TYPE_INTERFACE_IDENTIFIER} = never;
|
|
18
|
+
`;
|
|
19
|
+
}
|
|
20
|
+
const unions = types.map((type) => {
|
|
21
|
+
return (0, interface_1.generateTypeReference)(type, importContext, scalarToPrimitiveMap, {
|
|
22
|
+
required: true,
|
|
23
|
+
array: false,
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
return (0, deindent_1.default) `
|
|
27
|
+
export type ${interface_1.TYPE_INTERFACE_IDENTIFIER} = ${unions.join(' | ')}
|
|
28
|
+
`;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/union/interface.ts"],"names":[],"mappings":";;;;;;AACA,uEAA+C;AAG/C,iDAAqF;AAErF,SAAgB,iBAAiB,CAC7B,IAAY,EACZ,GAA4B,EAC5B,aAA4B,EAC5B,QAAgC;IAEhC,OAAO,2BAA2B,CAAC,IAAI,EAAE,GAAG,EAAE,aAAa,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAAC;AAChG,CAAC;AAPD,8CAOC;AAED,SAAS,2BAA2B,CAChC,IAAY,EACZ,GAA4B,EAC5B,aAA4B,EAC5B,oBAA4C;IAE5C,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC;IAEtB,IAAI,KAAK,KAAK,SAAS,EAAE;QACrB,OAAO,IAAA,kBAAQ,EAAA;0BACG,qCAAyB;SAC1C,CAAC;KACL;IAED,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAC9B,OAAO,IAAA,iCAAqB,EAAC,IAAI,EAAE,aAAa,EAAE,oBAAoB,EAAE;YACpE,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,KAAK;SACf,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,OAAO,IAAA,kBAAQ,EAAA;sBACG,qCAAyB,MAAM,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;KAClE,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { resolveTypeName, resolveFieldTypeName, getNormalizableTypeMap, NormalizableTypes, } from './types';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNormalizableTypeMap = exports.resolveFieldTypeName = exports.resolveTypeName = void 0;
|
|
4
|
+
var types_1 = require("./types");
|
|
5
|
+
Object.defineProperty(exports, "resolveTypeName", { enumerable: true, get: function () { return types_1.resolveTypeName; } });
|
|
6
|
+
Object.defineProperty(exports, "resolveFieldTypeName", { enumerable: true, get: function () { return types_1.resolveFieldTypeName; } });
|
|
7
|
+
Object.defineProperty(exports, "getNormalizableTypeMap", { enumerable: true, get: function () { return types_1.getNormalizableTypeMap; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/utils/index.ts"],"names":[],"mappings":";;;AAAA,iCAKiB;AAJb,wGAAA,eAAe,OAAA;AACf,6GAAA,oBAAoB,OAAA;AACpB,+GAAA,sBAAsB,OAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { GraphQLSchema, GraphQLInterfaceType, GraphQLObjectType, TypeNode } from '@luvio/graphql-parser';
|
|
2
|
+
export declare type NormalizableTypes = Record<string, GraphQLInterfaceType | GraphQLObjectType<any, any>>;
|
|
3
|
+
export declare function resolveTypeName(typeNode: TypeNode): string;
|
|
4
|
+
export declare function resolveFieldTypeName(schema: GraphQLSchema, field: any): string | null;
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param schema : GraphQLSchema
|
|
8
|
+
* @returns : NormalizableTypes Map
|
|
9
|
+
*/
|
|
10
|
+
export declare function getNormalizableTypeMap(schema: GraphQLSchema): NormalizableTypes;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNormalizableTypeMap = exports.resolveFieldTypeName = exports.resolveTypeName = void 0;
|
|
4
|
+
function resolveTypeName(typeNode) {
|
|
5
|
+
switch (typeNode.kind) {
|
|
6
|
+
case 'NamedType':
|
|
7
|
+
return typeNode.name.value;
|
|
8
|
+
default:
|
|
9
|
+
return resolveTypeName(typeNode.type);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.resolveTypeName = resolveTypeName;
|
|
13
|
+
function resolveFieldTypeName(schema, field) {
|
|
14
|
+
const typeName = resolveTypeName(field.astNode.type);
|
|
15
|
+
const type = schema.getType(typeName);
|
|
16
|
+
if (type === null || type === undefined) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return type.name;
|
|
20
|
+
}
|
|
21
|
+
exports.resolveFieldTypeName = resolveFieldTypeName;
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param schema : GraphQLSchema
|
|
25
|
+
* @returns : NormalizableTypes Map
|
|
26
|
+
*/
|
|
27
|
+
function getNormalizableTypeMap(schema) {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
const typeMap = schema.getTypeMap();
|
|
30
|
+
const typeNames = Object.keys(typeMap);
|
|
31
|
+
const normalizableTypeMap = {};
|
|
32
|
+
for (const typeName of typeNames) {
|
|
33
|
+
const type = typeMap[typeName];
|
|
34
|
+
if (((_a = type.astNode) === null || _a === void 0 ? void 0 : _a.kind) === 'InterfaceTypeDefinition' ||
|
|
35
|
+
((_b = type.astNode) === null || _b === void 0 ? void 0 : _b.kind) === 'ObjectTypeDefinition') {
|
|
36
|
+
// Even though we are filtering the types based on kind
|
|
37
|
+
// TS still thinks we might be assigning other types like Scalar which aren't permitted
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
normalizableTypeMap[typeName] = type;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return normalizableTypeMap;
|
|
43
|
+
}
|
|
44
|
+
exports.getNormalizableTypeMap = getNormalizableTypeMap;
|
|
45
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/codegen/graphql/utils/types.ts"],"names":[],"mappings":";;;AASA,SAAgB,eAAe,CAAC,QAAkB;IAC9C,QAAQ,QAAQ,CAAC,IAAI,EAAE;QACnB,KAAK,WAAW;YACZ,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;QAC/B;YACI,OAAO,eAAe,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;KAC7C;AACL,CAAC;AAPD,0CAOC;AAED,SAAgB,oBAAoB,CAAC,MAAqB,EAAE,KAAU;IAClE,MAAM,QAAQ,GAAG,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAErD,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEtC,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,SAAS,EAAE;QACrC,OAAO,IAAI,CAAC;KACf;IAED,OAAO,IAAI,CAAC,IAAI,CAAC;AACrB,CAAC;AAVD,oDAUC;AAED;;;;GAIG;AACH,SAAgB,sBAAsB,CAAC,MAAqB;;IACxD,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IACpC,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvC,MAAM,mBAAmB,GAAsB,EAAE,CAAC;IAElD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE;QAC9B,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;QAE/B,IACI,CAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,MAAK,yBAAyB;YAChD,CAAA,MAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,MAAK,sBAAsB,EAC/C;YACE,uDAAuD;YACvD,uFAAuF;YACvF,aAAa;YACb,mBAAmB,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;SACxC;KACJ;IAED,OAAO,mBAAmB,CAAC;AAC/B,CAAC;AApBD,wDAoBC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import path from 'path';
|
|
2
3
|
import type { Resource } from '../../intermediate/resource';
|
|
3
4
|
import type { ImportContext } from '../../utils/imports';
|
|
4
5
|
export declare const CREATE_RESOURCE_REQUEST_IDENTIFIER = "createResourceRequest";
|
|
5
|
-
export declare function generateCreateResourceRequest(importContext: ImportContext, resource: Resource,
|
|
6
|
+
export declare function generateCreateResourceRequest(importContext: ImportContext, resource: Resource, compilerBaseOutputDir: path.ParsedPath, relPath: string): string;
|