@luvio/compiler 0.78.0 → 0.82.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/dist/codegen/adapter/adapter-network-cache-policy.js +5 -1
  2. package/dist/codegen/adapter/adapter-network-cache-policy.js.map +1 -1
  3. package/dist/codegen/adapter/adapter-param-type-check.js +2 -1
  4. package/dist/codegen/adapter/adapter-param-type-check.js.map +1 -1
  5. package/dist/codegen/adapter/index.d.ts +4 -0
  6. package/dist/codegen/adapter/index.js +5 -1
  7. package/dist/codegen/adapter/index.js.map +1 -1
  8. package/dist/codegen/adapter-tests/index.js +1 -1
  9. package/dist/codegen/adapter-tests/index.js.map +1 -1
  10. package/dist/codegen/graphql/enum/index.d.ts +2 -2
  11. package/dist/codegen/graphql/enum/index.js +6 -5
  12. package/dist/codegen/graphql/enum/index.js.map +1 -1
  13. package/dist/codegen/graphql/enum/interface.d.ts +4 -0
  14. package/dist/codegen/graphql/enum/interface.js +32 -0
  15. package/dist/codegen/graphql/enum/interface.js.map +1 -0
  16. package/dist/codegen/graphql/source-printer/graphql-adapter-source-printer.d.ts +7 -0
  17. package/dist/codegen/graphql/source-printer/graphql-adapter-source-printer.js +11 -0
  18. package/dist/codegen/graphql/source-printer/graphql-adapter-source-printer.js.map +1 -0
  19. package/dist/codegen/graphql/source-printer/graphql-resource-source-printer.d.ts +7 -0
  20. package/dist/codegen/graphql/source-printer/graphql-resource-source-printer.js +11 -0
  21. package/dist/codegen/graphql/source-printer/graphql-resource-source-printer.js.map +1 -0
  22. package/dist/codegen/graphql/source-printer/graphql-source-printer.d.ts +27 -0
  23. package/dist/codegen/graphql/source-printer/graphql-source-printer.js +50 -0
  24. package/dist/codegen/graphql/source-printer/graphql-source-printer.js.map +1 -0
  25. package/dist/codegen/graphql/source-printer/graphql-type-source-printer.d.ts +13 -0
  26. package/dist/codegen/graphql/source-printer/graphql-type-source-printer.js +65 -0
  27. package/dist/codegen/graphql/source-printer/graphql-type-source-printer.js.map +1 -0
  28. package/dist/codegen/graphql/source-printer/index.d.ts +5 -0
  29. package/dist/codegen/graphql/source-printer/index.js +12 -0
  30. package/dist/codegen/graphql/source-printer/index.js.map +1 -0
  31. package/dist/codegen/graphql/type/constants.d.ts +7 -0
  32. package/dist/codegen/graphql/type/constants.js +11 -0
  33. package/dist/codegen/graphql/type/constants.js.map +1 -0
  34. package/dist/codegen/graphql/type/index.d.ts +3 -2
  35. package/dist/codegen/graphql/type/index.js +30 -5
  36. package/dist/codegen/graphql/type/index.js.map +1 -1
  37. package/dist/codegen/graphql/type/ingest.d.ts +9 -0
  38. package/dist/codegen/graphql/type/ingest.js +131 -0
  39. package/dist/codegen/graphql/type/ingest.js.map +1 -0
  40. package/dist/codegen/graphql/type/interface.d.ts +3 -3
  41. package/dist/codegen/graphql/type/interface.js +2 -48
  42. package/dist/codegen/graphql/type/interface.js.map +1 -1
  43. package/dist/codegen/graphql/union/index.d.ts +2 -2
  44. package/dist/codegen/graphql/union/index.js +6 -5
  45. package/dist/codegen/graphql/union/index.js.map +1 -1
  46. package/dist/codegen/graphql/union/interface.d.ts +4 -0
  47. package/dist/codegen/graphql/union/interface.js +30 -0
  48. package/dist/codegen/graphql/union/interface.js.map +1 -0
  49. package/dist/codegen/graphql/utils/index.d.ts +1 -0
  50. package/dist/codegen/graphql/utils/index.js +8 -0
  51. package/dist/codegen/graphql/utils/index.js.map +1 -0
  52. package/dist/codegen/graphql/utils/types.d.ts +10 -0
  53. package/dist/codegen/graphql/utils/types.js +45 -0
  54. package/dist/codegen/graphql/utils/types.js.map +1 -0
  55. package/dist/codegen/resource/create-resource-request.js +2 -2
  56. package/dist/codegen/resource/create-resource-request.js.map +1 -1
  57. package/dist/codegen/rest/source-printer/rest-adapter-source-printer.d.ts +12 -0
  58. package/dist/codegen/rest/source-printer/rest-adapter-source-printer.js +60 -0
  59. package/dist/codegen/rest/source-printer/rest-adapter-source-printer.js.map +1 -0
  60. package/dist/codegen/rest/source-printer/rest-source-printer.d.ts +12 -0
  61. package/dist/codegen/rest/source-printer/rest-source-printer.js +78 -0
  62. package/dist/codegen/rest/source-printer/rest-source-printer.js.map +1 -0
  63. package/dist/codegen/source-writer/file-system-source-writer.d.ts +14 -0
  64. package/dist/codegen/source-writer/file-system-source-writer.js +31 -0
  65. package/dist/codegen/source-writer/file-system-source-writer.js.map +1 -0
  66. package/dist/compiler/raml-compiler.d.ts +15 -0
  67. package/dist/compiler/raml-compiler.js +34 -0
  68. package/dist/compiler/raml-compiler.js.map +1 -0
  69. package/dist/generate.d.ts +3 -5
  70. package/dist/generate.js +0 -134
  71. package/dist/generate.js.map +1 -1
  72. package/dist/interfaces/compiler.d.ts +4 -0
  73. package/dist/interfaces/compiler.js +3 -0
  74. package/dist/interfaces/compiler.js.map +1 -0
  75. package/dist/interfaces/index.d.ts +5 -0
  76. package/dist/interfaces/index.js +3 -0
  77. package/dist/interfaces/index.js.map +1 -0
  78. package/dist/interfaces/source-printers/graphql/graphql-adapter-printer.d.ts +6 -0
  79. package/dist/interfaces/source-printers/graphql/graphql-adapter-printer.js +3 -0
  80. package/dist/interfaces/source-printers/graphql/graphql-adapter-printer.js.map +1 -0
  81. package/dist/interfaces/source-printers/graphql/graphql-resource-printer.d.ts +6 -0
  82. package/dist/interfaces/source-printers/graphql/graphql-resource-printer.js +3 -0
  83. package/dist/interfaces/source-printers/graphql/graphql-resource-printer.js.map +1 -0
  84. package/dist/interfaces/source-printers/graphql/graphql-type-printer.d.ts +6 -0
  85. package/dist/interfaces/source-printers/graphql/graphql-type-printer.js +3 -0
  86. package/dist/interfaces/source-printers/graphql/graphql-type-printer.js.map +1 -0
  87. package/dist/interfaces/source-printers/index.d.ts +5 -0
  88. package/dist/interfaces/source-printers/index.js +3 -0
  89. package/dist/interfaces/source-printers/index.js.map +1 -0
  90. package/dist/interfaces/source-printers/rest/rest-adapter-printer.d.ts +5 -0
  91. package/dist/interfaces/source-printers/rest/rest-adapter-printer.js +3 -0
  92. package/dist/interfaces/source-printers/rest/rest-adapter-printer.js.map +1 -0
  93. package/dist/interfaces/source-printers/source-printer.d.ts +6 -0
  94. package/dist/interfaces/source-printers/source-printer.js +3 -0
  95. package/dist/interfaces/source-printers/source-printer.js.map +1 -0
  96. package/dist/interfaces/source-writer.d.ts +6 -0
  97. package/dist/interfaces/source-writer.js +3 -0
  98. package/dist/interfaces/source-writer.js.map +1 -0
  99. package/dist/main.d.ts +8 -3
  100. package/dist/main.js +16 -5
  101. package/dist/main.js.map +1 -1
  102. package/dist/parser/main.d.ts +8 -1
  103. package/dist/parser/main.js +186 -180
  104. package/dist/parser/main.js.map +1 -1
  105. package/dist/utils/files.d.ts +0 -8
  106. package/dist/utils/files.js +1 -16
  107. package/dist/utils/files.js.map +1 -1
  108. package/dist/utils/generation.js +5 -5
  109. package/dist/utils/generation.js.map +1 -1
  110. package/dist/utils/imports.js +4 -3
  111. package/dist/utils/imports.js.map +1 -1
  112. package/package.json +4 -4
  113. package/dist/codegen/graphql/index.d.ts +0 -13
  114. package/dist/codegen/graphql/index.js +0 -87
  115. package/dist/codegen/graphql/index.js.map +0 -1
  116. package/dist/parse.d.ts +0 -2
  117. package/dist/parse.js +0 -14
  118. package/dist/parse.js.map +0 -1
@@ -1,13 +0,0 @@
1
- import type { LuvioGraphQLSchema } from '@luvio/graphql-parser';
2
- import type { AdapterAnnotation } from '../../intermediate/adapter-annotation';
3
- import type { CompilerEnvironment } from '../../generate';
4
- declare type GraphQLGenerationResult = Record<string, string>;
5
- export interface GraphQLGenerateState {
6
- schema: LuvioGraphQLSchema;
7
- adapter?: AdapterAnnotation;
8
- outDirName: string;
9
- env: CompilerEnvironment;
10
- scalarToPrimitiveMap: Record<string, string>;
11
- }
12
- export declare function generate(state: GraphQLGenerateState): GraphQLGenerationResult;
13
- export {};
@@ -1,87 +0,0 @@
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.generate = void 0;
7
- const graphql_parser_1 = require("@luvio/graphql-parser");
8
- const imports_1 = require("../../utils/imports");
9
- const path_1 = __importDefault(require("path"));
10
- const type_1 = require("./type");
11
- const enum_1 = require("./enum");
12
- const union_1 = require("./union");
13
- function createImportContext(state, defName) {
14
- const { env, outDirName } = state;
15
- const { config: compilerConfig } = env;
16
- const graphqlRelPath = `${outDirName}/types/${defName}.ts`;
17
- const shapeAbsPath = path_1.default.resolve(compilerConfig.outputDir, graphqlRelPath);
18
- return {
19
- relPath: graphqlRelPath,
20
- importContext: (0, imports_1.createImportContext)({
21
- compiler: env,
22
- output: path_1.default.parse(shapeAbsPath),
23
- }),
24
- };
25
- }
26
- function generateUnion(defName, def, state) {
27
- const { relPath, importContext } = createImportContext(state, defName);
28
- return {
29
- [relPath]: (0, union_1.generate)(state, defName, def, importContext),
30
- };
31
- }
32
- function generateEnum(defName, def, state) {
33
- const { relPath, importContext } = createImportContext(state, defName);
34
- return {
35
- [relPath]: (0, enum_1.generate)(state, defName, def, importContext),
36
- };
37
- }
38
- function generateType(defName, def, state) {
39
- const { relPath, importContext } = createImportContext(state, defName);
40
- return {
41
- [relPath]: (0, type_1.generateType)(state, defName, def, importContext),
42
- };
43
- }
44
- function generate(state) {
45
- const { schema } = state;
46
- const results = {};
47
- const schemaTypes = Object.values(schema.schema.getTypeMap());
48
- // make a pass over the schema to identify any custom scalar types
49
- schemaTypes
50
- .filter((def) => {
51
- return (0, graphql_parser_1.isScalarType)(def) && def.astNode !== undefined;
52
- })
53
- .forEach((def) => {
54
- state.scalarToPrimitiveMap[def.name] = 'any';
55
- });
56
- schemaTypes.forEach((def) => {
57
- var _a;
58
- if (!('name' in def)) {
59
- return;
60
- }
61
- if (def.name === undefined) {
62
- return;
63
- }
64
- let childResult = {};
65
- const kind = (_a = def.astNode) === null || _a === void 0 ? void 0 : _a.kind;
66
- switch (kind) {
67
- case graphql_parser_1.Kind.OBJECT_TYPE_DEFINITION:
68
- case graphql_parser_1.Kind.INTERFACE_TYPE_DEFINITION:
69
- childResult = generateType(def.name, def.astNode, state);
70
- break;
71
- case graphql_parser_1.Kind.UNION_TYPE_DEFINITION:
72
- childResult = generateUnion(def.name, def.astNode, state);
73
- break;
74
- case graphql_parser_1.Kind.ENUM_TYPE_DEFINITION:
75
- childResult = generateEnum(def.name, def.astNode, state);
76
- break;
77
- default:
78
- break;
79
- }
80
- Object.keys(childResult).forEach((key) => {
81
- results[key] = (0, imports_1.resolveImports)(childResult[key]);
82
- });
83
- });
84
- return results;
85
- }
86
- exports.generate = generate;
87
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/codegen/graphql/index.ts"],"names":[],"mappings":";;;;;;AAOA,0DAA2D;AAG3D,iDAG6B;AAC7B,gDAAwB;AACxB,iCAA6D;AAC7D,iCAAsD;AACtD,mCAAwD;AAaxD,SAAS,mBAAmB,CACxB,KAA2B,EAC3B,OAAe;IAEf,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAClC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,GAAG,CAAC;IACvC,MAAM,cAAc,GAAG,GAAG,UAAU,UAAU,OAAO,KAAK,CAAC;IAC3D,MAAM,YAAY,GAAG,cAAI,CAAC,OAAO,CAAC,cAAc,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IAC5E,OAAO;QACH,OAAO,EAAE,cAAc;QACvB,aAAa,EAAE,IAAA,6BAAuB,EAAC;YACnC,QAAQ,EAAE,GAAG;YACb,MAAM,EAAE,cAAI,CAAC,KAAK,CAAC,YAAY,CAAC;SACnC,CAAC;KACL,CAAC;AACN,CAAC;AAED,SAAS,aAAa,CAAC,OAAe,EAAE,GAA4B,EAAE,KAA2B;IAC7F,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,mBAAmB,CAAC,KAAK,EAAE,OA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C,CAAC;IAEP,WAAW,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;;QACxB,IAAI,CAAC,CAAC,MAAM,IAAI,GAAG,CAAC,EAAE;YAClB,OAAO;SACV;QAED,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS,EAAE;YACxB,OAAO;SACV;QAED,IAAI,WAAW,GAA4B,EAAE,CAAC;QAE9C,MAAM,IAAI,GAAG,MAAA,GAAG,CAAC,OAAO,0CAAE,IAAI,CAAC;QAC/B,QAAQ,IAAI,EAAE;YACV,KAAK,qBAAI,CAAC,sBAAsB,CAAC;YACjC,KAAK,qBAAI,CAAC,yBAAyB;gBAC/B,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAQ,EAAE,KAAK,CAAC,CAAC;gBAC1D,MAAM;YAEV,KAAK,qBAAI,CAAC,qBAAqB;gBAC3B,WAAW,GAAG,aAAa,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAQ,EAAE,KAAK,CAAC,CAAC;gBAC3D,MAAM;YAEV,KAAK,qBAAI,CAAC,oBAAoB;gBAC1B,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAQ,EAAE,KAAK,CAAC,CAAC;gBAC1D,MAAM;YAEV;gBACI,MAAM;SACb;QAED,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YACrC,OAAO,CAAC,GAAG,CAAC,GAAG,IAAA,wBAAc,EAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC;AACnB,CAAC;AAnDD,4BAmDC"}
package/dist/parse.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import type { ParseResults } from './parser/main';
2
- export declare function parse(inputFile: string): Promise<ParseResults>;
package/dist/parse.js DELETED
@@ -1,14 +0,0 @@
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.parse = void 0;
7
- const path_1 = __importDefault(require("path"));
8
- const main_1 = require("./parser/main");
9
- function parse(inputFile) {
10
- const input = path_1.default.resolve(inputFile);
11
- return (0, main_1.parse)(input);
12
- }
13
- exports.parse = parse;
14
- //# sourceMappingURL=parse.js.map
package/dist/parse.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"parse.js","sourceRoot":"","sources":["../src/parse.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,wCAAyD;AAEzD,SAAgB,KAAK,CAAC,SAAiB;IACnC,MAAM,KAAK,GAAG,cAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACtC,OAAO,IAAA,YAAe,EAAC,KAAK,CAAC,CAAC;AAClC,CAAC;AAHD,sBAGC"}