@cedarjs/internal 5.0.7-next.338 → 5.0.7-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/dist/ast.d.ts +0 -1
  2. package/dist/ast.d.ts.map +1 -1
  3. package/dist/ast.js +0 -21
  4. package/dist/build/api.d.ts +0 -2
  5. package/dist/build/api.d.ts.map +1 -1
  6. package/dist/build/api.js +39 -198
  7. package/dist/build/esbuild-plugin-cedar-context-wrapping.d.ts +4 -0
  8. package/dist/build/esbuild-plugin-cedar-context-wrapping.d.ts.map +1 -0
  9. package/dist/build/{esbuild-plugin-handler-als-wrapping.js → esbuild-plugin-cedar-context-wrapping.js} +12 -12
  10. package/dist/cjs/ast.d.ts +26 -0
  11. package/dist/cjs/ast.d.ts.map +1 -0
  12. package/dist/cjs/ast.js +201 -0
  13. package/dist/cjs/build/api.d.ts +7 -0
  14. package/dist/cjs/build/api.d.ts.map +1 -0
  15. package/dist/cjs/build/api.js +251 -0
  16. package/dist/cjs/build/esbuild-plugin-cedar-context-wrapping.d.ts +4 -0
  17. package/dist/cjs/build/esbuild-plugin-cedar-context-wrapping.d.ts.map +1 -0
  18. package/dist/cjs/build/esbuild-plugin-cedar-context-wrapping.js +59 -0
  19. package/dist/cjs/cliLogger.d.ts +11 -0
  20. package/dist/cjs/cliLogger.d.ts.map +1 -0
  21. package/dist/cjs/cliLogger.js +36 -0
  22. package/dist/cjs/dev.d.ts +2 -0
  23. package/dist/cjs/dev.d.ts.map +1 -0
  24. package/dist/cjs/dev.js +41 -0
  25. package/dist/cjs/files.d.ts +56 -0
  26. package/dist/cjs/files.d.ts.map +1 -0
  27. package/dist/cjs/files.js +230 -0
  28. package/dist/cjs/generate/clientPreset.d.ts +17 -0
  29. package/dist/cjs/generate/clientPreset.d.ts.map +1 -0
  30. package/dist/cjs/generate/clientPreset.js +84 -0
  31. package/dist/cjs/generate/generate.d.ts +10 -0
  32. package/dist/cjs/generate/generate.d.ts.map +1 -0
  33. package/dist/cjs/generate/generate.js +97 -0
  34. package/dist/cjs/generate/gqlormSchema.d.ts +113 -0
  35. package/dist/cjs/generate/gqlormSchema.d.ts.map +1 -0
  36. package/dist/cjs/generate/gqlormSchema.js +1061 -0
  37. package/dist/cjs/generate/graphqlCodeGen.d.ts +16 -0
  38. package/dist/cjs/generate/graphqlCodeGen.d.ts.map +1 -0
  39. package/dist/cjs/generate/graphqlCodeGen.js +380 -0
  40. package/dist/cjs/generate/graphqlSchema.d.ts +8 -0
  41. package/dist/cjs/generate/graphqlSchema.d.ts.map +1 -0
  42. package/dist/cjs/generate/graphqlSchema.js +157 -0
  43. package/dist/cjs/generate/plugins/rw-typescript-resolvers/index.d.ts +7 -0
  44. package/dist/cjs/generate/plugins/rw-typescript-resolvers/index.d.ts.map +1 -0
  45. package/dist/cjs/generate/plugins/rw-typescript-resolvers/index.js +65 -0
  46. package/dist/cjs/generate/plugins/rw-typescript-resolvers/visitor.d.ts +10 -0
  47. package/dist/cjs/generate/plugins/rw-typescript-resolvers/visitor.d.ts.map +1 -0
  48. package/dist/cjs/generate/plugins/rw-typescript-resolvers/visitor.js +92 -0
  49. package/dist/cjs/generate/possibleTypes.d.ts +36 -0
  50. package/dist/cjs/generate/possibleTypes.d.ts.map +1 -0
  51. package/dist/cjs/generate/possibleTypes.js +106 -0
  52. package/dist/cjs/generate/templates/all-currentUser.d.ts.template +30 -0
  53. package/dist/cjs/generate/templates/all-gqlorm.d.ts.template +7 -0
  54. package/dist/cjs/generate/templates/api-globImports.d.ts.template +9 -0
  55. package/dist/cjs/generate/templates/api-globalContext.d.ts.template +7 -0
  56. package/dist/cjs/generate/templates/api-scenarios.d.ts.template +10 -0
  57. package/dist/cjs/generate/templates/api-test-globals.d.ts.template +5 -0
  58. package/dist/cjs/generate/templates/mirror-cell.d.ts.template +13 -0
  59. package/dist/cjs/generate/templates/mirror-directoryNamedModule.d.ts.template +5 -0
  60. package/dist/cjs/generate/templates/web-routerRoutes.d.ts.template +20 -0
  61. package/dist/cjs/generate/templates/web-routesPages.d.ts.template +13 -0
  62. package/dist/cjs/generate/templates/web-test-globals.d.ts.template +7 -0
  63. package/dist/cjs/generate/templates.d.ts +6 -0
  64. package/dist/cjs/generate/templates.d.ts.map +1 -0
  65. package/dist/cjs/generate/templates.js +68 -0
  66. package/dist/cjs/generate/trustedDocuments.d.ts +3 -0
  67. package/dist/cjs/generate/trustedDocuments.d.ts.map +1 -0
  68. package/dist/cjs/generate/trustedDocuments.js +95 -0
  69. package/dist/cjs/generate/typeDefinitions.d.ts +31 -0
  70. package/dist/cjs/generate/typeDefinitions.d.ts.map +1 -0
  71. package/dist/cjs/generate/typeDefinitions.js +372 -0
  72. package/dist/cjs/generate/types.d.ts +6 -0
  73. package/dist/cjs/generate/types.d.ts.map +1 -0
  74. package/dist/cjs/generate/types.js +16 -0
  75. package/dist/cjs/generate/watch.d.ts +3 -0
  76. package/dist/cjs/generate/watch.d.ts.map +1 -0
  77. package/dist/cjs/generate/watch.js +132 -0
  78. package/dist/cjs/gql.d.ts +14 -0
  79. package/dist/cjs/gql.d.ts.map +1 -0
  80. package/dist/cjs/gql.js +108 -0
  81. package/dist/cjs/index.d.ts +11 -0
  82. package/dist/cjs/index.d.ts.map +1 -0
  83. package/dist/cjs/index.js +49 -0
  84. package/dist/cjs/jsx.d.ts +16 -0
  85. package/dist/cjs/jsx.d.ts.map +1 -0
  86. package/dist/cjs/jsx.js +101 -0
  87. package/dist/cjs/jsxAttributeValue.d.ts +2 -0
  88. package/dist/cjs/jsxAttributeValue.d.ts.map +1 -0
  89. package/dist/cjs/jsxAttributeValue.js +129 -0
  90. package/dist/cjs/package.json +1 -0
  91. package/dist/cjs/project.d.ts +8 -0
  92. package/dist/cjs/project.d.ts.map +1 -0
  93. package/dist/cjs/project.js +82 -0
  94. package/dist/cjs/routes.d.ts +42 -0
  95. package/dist/cjs/routes.d.ts.map +1 -0
  96. package/dist/cjs/routes.js +111 -0
  97. package/dist/cjs/ts2js.d.ts +40 -0
  98. package/dist/cjs/ts2js.d.ts.map +1 -0
  99. package/dist/cjs/ts2js.js +159 -0
  100. package/dist/cjs/validateSchema.d.ts +14 -0
  101. package/dist/cjs/validateSchema.d.ts.map +1 -0
  102. package/dist/cjs/validateSchema.js +195 -0
  103. package/dist/generate/clientPreset.d.ts +7 -0
  104. package/dist/generate/clientPreset.d.ts.map +1 -1
  105. package/dist/generate/clientPreset.js +5 -12
  106. package/dist/generate/generate.d.ts.map +1 -1
  107. package/dist/generate/generate.js +0 -6
  108. package/dist/generate/graphqlCodeGen.d.ts.map +1 -1
  109. package/dist/generate/graphqlCodeGen.js +10 -36
  110. package/dist/generate/graphqlSchema.d.ts.map +1 -1
  111. package/dist/generate/templates.d.ts.map +1 -1
  112. package/dist/generate/templates.js +6 -1
  113. package/dist/generate/typeDefinitions.d.ts.map +1 -1
  114. package/dist/generate/typeDefinitions.js +1 -15
  115. package/dist/gql.d.ts +0 -20
  116. package/dist/gql.d.ts.map +1 -1
  117. package/dist/gql.js +0 -24
  118. package/dist/jsx.d.ts.map +1 -1
  119. package/dist/routes.d.ts.map +1 -1
  120. package/package.json +91 -55
  121. package/dist/build/api-graphql-transforms.d.ts +0 -34
  122. package/dist/build/api-graphql-transforms.d.ts.map +0 -1
  123. package/dist/build/api-graphql-transforms.js +0 -129
  124. package/dist/build/auto-import.d.ts +0 -10
  125. package/dist/build/auto-import.d.ts.map +0 -1
  126. package/dist/build/auto-import.js +0 -120
  127. package/dist/build/directory-named-import.d.ts +0 -2
  128. package/dist/build/directory-named-import.d.ts.map +0 -1
  129. package/dist/build/directory-named-import.js +0 -26
  130. package/dist/build/esbuild-plugin-api-graphql.d.ts +0 -6
  131. package/dist/build/esbuild-plugin-api-graphql.d.ts.map +0 -1
  132. package/dist/build/esbuild-plugin-api-graphql.js +0 -78
  133. package/dist/build/esbuild-plugin-cedar-otel-wrapping.d.ts +0 -13
  134. package/dist/build/esbuild-plugin-cedar-otel-wrapping.d.ts.map +0 -1
  135. package/dist/build/esbuild-plugin-cedar-otel-wrapping.js +0 -180
  136. package/dist/build/esbuild-plugin-handler-als-wrapping.d.ts +0 -4
  137. package/dist/build/esbuild-plugin-handler-als-wrapping.d.ts.map +0 -1
  138. package/dist/build/import-dir.d.ts +0 -22
  139. package/dist/build/import-dir.d.ts.map +0 -1
  140. package/dist/build/import-dir.js +0 -54
  141. package/dist/build/import-extensions.d.ts +0 -47
  142. package/dist/build/import-extensions.d.ts.map +0 -1
  143. package/dist/build/import-extensions.js +0 -59
  144. package/dist/build/job-path-injector.d.ts +0 -15
  145. package/dist/build/job-path-injector.d.ts.map +0 -1
  146. package/dist/build/job-path-injector.js +0 -69
  147. package/dist/build/src-alias.d.ts +0 -14
  148. package/dist/build/src-alias.d.ts.map +0 -1
  149. package/dist/build/src-alias.js +0 -17
  150. package/dist/build/tsconfig-paths.d.ts +0 -2
  151. package/dist/build/tsconfig-paths.d.ts.map +0 -1
  152. package/dist/build/tsconfig-paths.js +0 -72
  153. package/dist/generate/templates/mirror-cell-fragment.d.ts.template +0 -18
@@ -0,0 +1,159 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var ts2js_exports = {};
30
+ __export(ts2js_exports, {
31
+ convertTsFilesToJs: () => convertTsFilesToJs,
32
+ convertTsProjectToJs: () => convertTsProjectToJs,
33
+ convertTsScriptsToJs: () => convertTsScriptsToJs,
34
+ getPrettierConfig: () => getPrettierConfig,
35
+ prettify: () => prettify,
36
+ transformTSToJS: () => transformTSToJS,
37
+ typeScriptSourceFiles: () => typeScriptSourceFiles
38
+ });
39
+ module.exports = __toCommonJS(ts2js_exports);
40
+ var import_node_fs = __toESM(require("node:fs"), 1);
41
+ var import_path = __toESM(require("path"), 1);
42
+ var import_core = require("@babel/core");
43
+ var import_fast_glob = __toESM(require("fast-glob"), 1);
44
+ var import_prettier = require("prettier");
45
+ var import_project_config = require("@cedarjs/project-config");
46
+ const convertTsProjectToJs = (cwd = (0, import_project_config.getPaths)().base) => {
47
+ const files = typeScriptSourceFiles(cwd);
48
+ convertTsFilesToJs(cwd, files);
49
+ };
50
+ const convertTsScriptsToJs = (cwd = (0, import_project_config.getPaths)().base) => {
51
+ const files = typeScriptSourceFiles(cwd, "scripts/*.{ts,tsx}");
52
+ convertTsFilesToJs(cwd, files);
53
+ };
54
+ const convertTsFilesToJs = async (cwd, files) => {
55
+ if (files.length === 0) {
56
+ console.log("No TypeScript files found to convert to JS in this project.");
57
+ }
58
+ for (const f of files) {
59
+ const code = await transformTSToJS(f);
60
+ if (code) {
61
+ import_node_fs.default.writeFileSync(
62
+ import_path.default.join(cwd, f.replace(".tsx", ".jsx").replace(".ts", ".js")),
63
+ code,
64
+ "utf8"
65
+ );
66
+ import_node_fs.default.unlinkSync(import_path.default.join(cwd, f));
67
+ }
68
+ }
69
+ if (import_node_fs.default.existsSync(import_path.default.join(cwd, "api/tsconfig.json"))) {
70
+ import_node_fs.default.renameSync(
71
+ import_path.default.join(cwd, "api/tsconfig.json"),
72
+ import_path.default.join(cwd, "api/jsconfig.json")
73
+ );
74
+ }
75
+ if (import_node_fs.default.existsSync(import_path.default.join(cwd, "web/tsconfig.json"))) {
76
+ import_node_fs.default.renameSync(
77
+ import_path.default.join(cwd, "web/tsconfig.json"),
78
+ import_path.default.join(cwd, "web/jsconfig.json")
79
+ );
80
+ }
81
+ if (import_node_fs.default.existsSync(import_path.default.join(cwd, "scripts/tsconfig.json"))) {
82
+ import_node_fs.default.renameSync(
83
+ import_path.default.join(cwd, "scripts/tsconfig.json"),
84
+ import_path.default.join(cwd, "scripts/jsconfig.json")
85
+ );
86
+ }
87
+ };
88
+ const typeScriptSourceFiles = (cwd, globPattern = "{api,web}/src/**/*.{ts,tsx}") => {
89
+ console.log(globPattern);
90
+ return import_fast_glob.default.sync(globPattern, {
91
+ cwd,
92
+ ignore: ["node_modules"]
93
+ });
94
+ };
95
+ const transformTSToJS = (file) => {
96
+ const tsCode = import_node_fs.default.readFileSync(file, "utf8");
97
+ const filename = import_path.default.basename(file);
98
+ const result = (0, import_core.transform)(tsCode, {
99
+ filename,
100
+ cwd: (0, import_project_config.getPaths)().base,
101
+ configFile: false,
102
+ plugins: [
103
+ [
104
+ "@babel/plugin-transform-typescript",
105
+ {
106
+ isTSX: true,
107
+ allExtensions: true
108
+ }
109
+ ]
110
+ ],
111
+ retainLines: true
112
+ });
113
+ if (!result?.code) {
114
+ return void 0;
115
+ }
116
+ return prettify(result.code, filename.replace(/\.ts$/, ".js"));
117
+ };
118
+ const getPrettierConfig = async () => {
119
+ try {
120
+ const { default: prettierConfig } = await import(`file://${import_path.default.join((0, import_project_config.getPaths)().base, "prettier.config.cjs")}`);
121
+ return prettierConfig;
122
+ } catch {
123
+ return void 0;
124
+ }
125
+ };
126
+ const prettierParser = (filename) => {
127
+ switch (import_path.default.extname(filename.replace(".template", ""))) {
128
+ case ".css":
129
+ return "css";
130
+ case ".js":
131
+ return "babel";
132
+ case ".ts":
133
+ case ".tsx":
134
+ return "babel-ts";
135
+ default:
136
+ return void 0;
137
+ }
138
+ };
139
+ const prettify = async (code, filename) => {
140
+ const parser = prettierParser(filename);
141
+ if (typeof parser === "undefined") {
142
+ return code;
143
+ }
144
+ const prettierConfig = await getPrettierConfig();
145
+ return (0, import_prettier.format)(code, {
146
+ ...prettierConfig,
147
+ parser
148
+ });
149
+ };
150
+ // Annotate the CommonJS export names for ESM import in node:
151
+ 0 && (module.exports = {
152
+ convertTsFilesToJs,
153
+ convertTsProjectToJs,
154
+ convertTsScriptsToJs,
155
+ getPrettierConfig,
156
+ prettify,
157
+ transformTSToJS,
158
+ typeScriptSourceFiles
159
+ });
@@ -0,0 +1,14 @@
1
+ import type { DocumentNode } from 'graphql';
2
+ export declare const DIRECTIVE_REQUIRED_ERROR_MESSAGE = "You must specify one of @requireAuth, @skipAuth or a custom directive";
3
+ export declare const DIRECTIVE_INVALID_ROLE_TYPES_ERROR_MESSAGE = "Please check that the requireAuth roles is a string or an array of strings.";
4
+ /**
5
+ * These are names that are commonly used in GraphQL schemas as scalars
6
+ * and would cause a conflict if used as a type name.
7
+ *
8
+ * Note: Query, Mutation, and Subscription are not included here because
9
+ * they are checked for separately.
10
+ */
11
+ export declare const RESERVED_TYPES: string[];
12
+ export declare function validateSchema(schemaDocumentNode: DocumentNode, typesToCheck?: string[]): void;
13
+ export declare const loadAndValidateSdls: () => Promise<void>;
14
+ //# sourceMappingURL=validateSchema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateSchema.d.ts","sourceRoot":"","sources":["../../src/validateSchema.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAA4B,MAAM,SAAS,CAAA;AAQrE,eAAO,MAAM,gCAAgC,0EAC4B,CAAA;AAEzE,eAAO,MAAM,0CAA0C,gFACwB,CAAA;AAE/E;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,UAS1B,CAAA;AAED,wBAAgB,cAAc,CAC5B,kBAAkB,EAAE,YAAY,EAChC,YAAY,GAAE,MAAM,EAA0B,QAwI/C;AAED,eAAO,MAAM,mBAAmB,qBAkC/B,CAAA"}
@@ -0,0 +1,195 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var validateSchema_exports = {};
20
+ __export(validateSchema_exports, {
21
+ DIRECTIVE_INVALID_ROLE_TYPES_ERROR_MESSAGE: () => DIRECTIVE_INVALID_ROLE_TYPES_ERROR_MESSAGE,
22
+ DIRECTIVE_REQUIRED_ERROR_MESSAGE: () => DIRECTIVE_REQUIRED_ERROR_MESSAGE,
23
+ RESERVED_TYPES: () => RESERVED_TYPES,
24
+ loadAndValidateSdls: () => loadAndValidateSdls,
25
+ validateSchema: () => validateSchema
26
+ });
27
+ module.exports = __toCommonJS(validateSchema_exports);
28
+ var import_code_file_loader = require("@graphql-tools/code-file-loader");
29
+ var import_load = require("@graphql-tools/load");
30
+ var import_merge = require("@graphql-tools/merge");
31
+ var import_graphql = require("graphql");
32
+ var import_graphql_server = require("@cedarjs/graphql-server");
33
+ var import_project_config = require("@cedarjs/project-config");
34
+ var import_project = require("./project.js");
35
+ const DIRECTIVE_REQUIRED_ERROR_MESSAGE = "You must specify one of @requireAuth, @skipAuth or a custom directive";
36
+ const DIRECTIVE_INVALID_ROLE_TYPES_ERROR_MESSAGE = "Please check that the requireAuth roles is a string or an array of strings.";
37
+ const RESERVED_TYPES = [
38
+ "Int",
39
+ "Float",
40
+ "Boolean",
41
+ "String",
42
+ "DateTime",
43
+ "ID",
44
+ "uid",
45
+ "as"
46
+ ];
47
+ function validateSchema(schemaDocumentNode, typesToCheck = ["Query", "Mutation"]) {
48
+ const validationOutput = [];
49
+ const reservedNameValidationOutput = [];
50
+ const directiveRoleValidationOutput = [];
51
+ if ((0, import_project.isServerFileSetup)() && (0, import_project.isRealtimeSetup)()) {
52
+ typesToCheck.push("Subscription");
53
+ }
54
+ (0, import_graphql.visit)(schemaDocumentNode, {
55
+ InterfaceTypeDefinition(typeNode) {
56
+ if (RESERVED_TYPES.includes(typeNode.name.value)) {
57
+ reservedNameValidationOutput.push({
58
+ objectType: "interface",
59
+ name: typeNode.name.value
60
+ });
61
+ }
62
+ },
63
+ InputObjectTypeDefinition(typeNode) {
64
+ if (RESERVED_TYPES.includes(typeNode.name.value)) {
65
+ reservedNameValidationOutput.push({
66
+ objectType: "input type",
67
+ name: typeNode.name.value
68
+ });
69
+ }
70
+ },
71
+ ObjectTypeDefinition(typeNode) {
72
+ if (RESERVED_TYPES.includes(typeNode.name.value)) {
73
+ reservedNameValidationOutput.push({
74
+ objectType: "type",
75
+ name: typeNode.name.value
76
+ });
77
+ }
78
+ if (typesToCheck.includes(typeNode.name.value)) {
79
+ for (const field of typeNode.fields || []) {
80
+ const fieldName = field.name.value;
81
+ const fieldTypeName = typeNode.name.value;
82
+ const isLegacyRedwoodQuery = fieldName === "redwood" && fieldTypeName === "Query";
83
+ const isCedarQuery = fieldName === "cedar" && fieldTypeName === "Query" || // TODO: Remove this when I remove the root schema
84
+ fieldName === "cedarjs" && fieldTypeName === "Query";
85
+ const isCurrentUserQuery = fieldName === "currentUser" && fieldTypeName === "Query";
86
+ if (!(isCedarQuery || isCurrentUserQuery || isLegacyRedwoodQuery)) {
87
+ const hasDirective = field.directives?.length;
88
+ if (!hasDirective) {
89
+ validationOutput.push(`${fieldName} ${fieldTypeName}`);
90
+ }
91
+ field.directives?.forEach((directive) => {
92
+ if (directive.name.value === "requireAuth") {
93
+ directive.arguments?.forEach((arg) => {
94
+ if (arg.name.value === "roles") {
95
+ if (arg.value.kind !== import_graphql.Kind.STRING && arg.value.kind !== import_graphql.Kind.LIST) {
96
+ directiveRoleValidationOutput.push({
97
+ fieldName,
98
+ invalid: arg.value.kind
99
+ });
100
+ }
101
+ if (arg.value.kind === import_graphql.Kind.LIST) {
102
+ const invalidValues = arg.value.values?.filter(
103
+ (val) => val.kind !== import_graphql.Kind.STRING
104
+ );
105
+ if (invalidValues.length > 0) {
106
+ invalidValues.forEach((invalid) => {
107
+ directiveRoleValidationOutput.push({
108
+ fieldName,
109
+ invalid: invalid.kind
110
+ });
111
+ });
112
+ }
113
+ }
114
+ }
115
+ });
116
+ }
117
+ });
118
+ }
119
+ }
120
+ }
121
+ }
122
+ });
123
+ if (validationOutput.length > 0) {
124
+ const fieldsWithoutDirectives = validationOutput.map(
125
+ (field) => `- ${field}`
126
+ );
127
+ throw new Error(
128
+ `${DIRECTIVE_REQUIRED_ERROR_MESSAGE} for
129
+ ${fieldsWithoutDirectives.join(
130
+ "\n"
131
+ )}
132
+ `
133
+ );
134
+ }
135
+ if (directiveRoleValidationOutput.length > 0) {
136
+ const fieldWithInvalidRoleValues = directiveRoleValidationOutput.map(
137
+ (field) => `- ${field.fieldName} has an invalid ${field.invalid}`
138
+ );
139
+ throw new RangeError(
140
+ `${DIRECTIVE_INVALID_ROLE_TYPES_ERROR_MESSAGE}
141
+
142
+ ${fieldWithInvalidRoleValues.join(
143
+ "\n"
144
+ )}
145
+
146
+ For example: @requireAuth(roles: "admin") or @requireAuth(roles: ["admin", "editor"])`
147
+ );
148
+ }
149
+ if (reservedNameValidationOutput.length > 0) {
150
+ const reservedNameMsg = reservedNameValidationOutput.map(
151
+ (output) => {
152
+ return `The ${output.objectType} named '${output.name}' is a reserved GraphQL name.
153
+ Please rename it to something more specific, like: Application${output.name}.
154
+ `;
155
+ }
156
+ );
157
+ throw new TypeError(reservedNameMsg.join("\n"));
158
+ }
159
+ }
160
+ const loadAndValidateSdls = async () => {
161
+ const projectTypeSrc = await (0, import_load.loadTypedefs)(
162
+ [
163
+ "graphql/**/*.sdl.{js,ts}",
164
+ "directives/**/*.{js,ts}",
165
+ "subscriptions/**/*.{js,ts}"
166
+ ],
167
+ {
168
+ loaders: [
169
+ new import_code_file_loader.CodeFileLoader({
170
+ noRequire: true,
171
+ pluckConfig: {
172
+ globalGqlIdentifierName: "gql"
173
+ }
174
+ })
175
+ ],
176
+ cwd: (0, import_project_config.getPaths)().api.src
177
+ }
178
+ );
179
+ const projectDocumentNodes = Object.values(projectTypeSrc).map(({ document }) => document).filter((documentNode) => {
180
+ return !!documentNode;
181
+ });
182
+ const mergedDocumentNode = (0, import_merge.mergeTypeDefs)([
183
+ import_graphql_server.rootSchema.schema,
184
+ projectDocumentNodes
185
+ ]);
186
+ validateSchema(mergedDocumentNode);
187
+ };
188
+ // Annotate the CommonJS export names for ESM import in node:
189
+ 0 && (module.exports = {
190
+ DIRECTIVE_INVALID_ROLE_TYPES_ERROR_MESSAGE,
191
+ DIRECTIVE_REQUIRED_ERROR_MESSAGE,
192
+ RESERVED_TYPES,
193
+ loadAndValidateSdls,
194
+ validateSchema
195
+ });
@@ -1,5 +1,12 @@
1
1
  export declare const shouldGenerateTrustedDocuments: () => boolean;
2
2
  export declare const generateClientPreset: () => Promise<{
3
+ clientPresetFiles: string[];
4
+ trustedDocumentsStoreFile: never[];
5
+ errors: {
6
+ message: string;
7
+ error: unknown;
8
+ }[];
9
+ } | {
3
10
  clientPresetFiles: string[];
4
11
  trustedDocumentsStoreFile: string;
5
12
  errors: {
@@ -1 +1 @@
1
- {"version":3,"file":"clientPreset.d.ts","sourceRoot":"","sources":["../../src/generate/clientPreset.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,8BAA8B,QAAO,OAIjD,CAAA;AAED,eAAO,MAAM,oBAAoB;;;;iBAGN,MAAM;eAAS,OAAO;;EAiEhD,CAAA"}
1
+ {"version":3,"file":"clientPreset.d.ts","sourceRoot":"","sources":["../../src/generate/clientPreset.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,8BAA8B,QAAO,OAIjD,CAAA;AAED,eAAO,MAAM,oBAAoB;;;;iBAGN,MAAM;eAAS,OAAO;;;;;;iBAAtB,MAAM;eAAS,OAAO;;EAoDhD,CAAA"}
@@ -1,4 +1,3 @@
1
- import path from "node:path";
2
1
  import { generate } from "@graphql-codegen/cli";
3
2
  import { addTypenameSelectionDocumentTransform } from "@graphql-codegen/client-preset";
4
3
  import { getConfig, getPaths } from "@cedarjs/project-config";
@@ -14,17 +13,16 @@ const generateClientPreset = async () => {
14
13
  let clientPresetFiles = [];
15
14
  const errors = [];
16
15
  if (!shouldGenerateTrustedDocuments()) {
17
- return { clientPresetFiles, trustedDocumentsStoreFile: "", errors };
16
+ return { clientPresetFiles, trustedDocumentsStoreFile: [], errors };
18
17
  }
19
- const documentsGlob = "./web/src/**/!(*.d).{ts,tsx,js,jsx}";
18
+ const documentsGlob = `${getPaths().web.src}/**/!(*.d).{ts,tsx,js,jsx}`;
20
19
  const config = {
21
- cwd: getPaths().base,
22
20
  schema: getPaths().generated.schema,
23
21
  documents: documentsGlob,
24
22
  silent: true,
25
23
  // Plays nicely with cli task output
26
24
  generates: {
27
- ["./web/src/graphql/"]: {
25
+ [`${getPaths().web.src}/graphql/`]: {
28
26
  preset: "client",
29
27
  presetConfig: {
30
28
  persistedDocuments: true
@@ -37,12 +35,7 @@ const generateClientPreset = async () => {
37
35
  }
38
36
  };
39
37
  try {
40
- const generatedFiles = (await generate(config, true)).map(
41
- (f) => ({
42
- ...f,
43
- filename: path.resolve(getPaths().base, f.filename)
44
- })
45
- );
38
+ const generatedFiles = await generate(config, true);
46
39
  clientPresetFiles = generatedFiles.map((f) => f.filename);
47
40
  const trustedDocumentsStoreFile = await trustedDocumentsStore(generatedFiles);
48
41
  replaceGqlTagWithTrustedDocumentGraphql(generatedFiles);
@@ -58,7 +51,7 @@ const generateClientPreset = async () => {
58
51
  });
59
52
  return {
60
53
  clientPresetFiles,
61
- trustedDocumentsStoreFile: "",
54
+ trustedDocumentsStoreFile: [],
62
55
  errors
63
56
  };
64
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/generate/generate.ts"],"names":[],"mappings":";AAWA,eAAO,MAAM,QAAQ;;;;;;EAmDpB,CAAA;AAED,eAAO,MAAM,GAAG,qBAoCf,CAAA"}
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/generate/generate.ts"],"names":[],"mappings":";AAWA,eAAO,MAAM,QAAQ;;;;;;EA2CpB,CAAA;AAED,eAAO,MAAM,GAAG,qBAoCf,CAAA"}
@@ -11,16 +11,11 @@ const generate = async () => {
11
11
  const { schemaPath, errors: generateGraphQLSchemaErrors } = await generateGraphQLSchema();
12
12
  const { typeDefFiles, errors: generateTypeDefsErrors } = await generateTypeDefs();
13
13
  const clientPresetFiles = [];
14
- const clientPresetErrors = [];
15
14
  const { possibleTypesFiles, errors: generatePossibleTypesErrors } = await generatePossibleTypes();
16
15
  const { files: gqlormFiles, errors: gqlormErrors } = await generateGqlormArtifacts();
17
16
  if (config.graphql.trustedDocuments) {
18
17
  const preset = await generateClientPreset();
19
18
  clientPresetFiles.push(...preset.clientPresetFiles);
20
- if (preset.trustedDocumentsStoreFile) {
21
- clientPresetFiles.push(preset.trustedDocumentsStoreFile);
22
- }
23
- clientPresetErrors.push(...preset.errors);
24
19
  }
25
20
  let files = [];
26
21
  if (schemaPath !== "") {
@@ -39,7 +34,6 @@ const generate = async () => {
39
34
  ...generateGraphQLSchemaErrors,
40
35
  ...generateTypeDefsErrors,
41
36
  ...generatePossibleTypesErrors,
42
- ...clientPresetErrors,
43
37
  ...gqlormErrors
44
38
  ]
45
39
  };
@@ -1 +1 @@
1
- {"version":3,"file":"graphqlCodeGen.d.ts","sourceRoot":"","sources":["../../src/generate/graphqlCodeGen.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAmB9D,KAAK,aAAa,GAAG;IACnB,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,EAAE,CAAA;CAC9C,CAAA;AAED,eAAO,MAAM,yBAAyB,QAAa,OAAO,CAAC,aAAa,CAiFvE,CAAA;AAED,eAAO,MAAM,yBAAyB,QAAa,OAAO,CAAC,aAAa,CAwDvE,CAAA;AAmCD,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM;SACD,MAAM;GAQ5D;AA2OD,eAAO,MAAM,iBAAiB,4RAe7B,CAAA"}
1
+ {"version":3,"file":"graphqlCodeGen.d.ts","sourceRoot":"","sources":["../../src/generate/graphqlCodeGen.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAmB9D,KAAK,aAAa,GAAG;IACnB,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,EAAE,CAAA;CAC9C,CAAA;AAED,eAAO,MAAM,yBAAyB,QAAa,OAAO,CAAC,aAAa,CAiFvE,CAAA;AAED,eAAO,MAAM,yBAAyB,QAAa,OAAO,CAAC,aAAa,CAwDvE,CAAA;AAmCD,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM;SACD,MAAM;GAQ5D;AAmKD,eAAO,MAAM,iBAAiB,4RAe7B,CAAA"}
@@ -171,37 +171,15 @@ function getLoadDocumentsOptions(filename) {
171
171
  };
172
172
  return loadTypedefsConfig;
173
173
  }
174
- class PrismaModelsFormatError extends Error {
175
- }
176
- const MODEL_REEXPORT_RE = /^export type \* from '\.\/models\/(\w+)\.\w+'/gm;
177
- function readPrismaModelNames(clientPath) {
178
- const ext = path.extname(clientPath);
179
- const modelsPath = path.join(path.dirname(clientPath), `models${ext}`);
180
- const source = fs.readFileSync(modelsPath, "utf8");
181
- const modelNames = {};
182
- for (const match of source.matchAll(MODEL_REEXPORT_RE)) {
183
- modelNames[match[1]] = match[1];
184
- }
185
- if (Object.keys(modelNames).length === 0) {
186
- throw new PrismaModelsFormatError(
187
- `Could not read any Prisma model names from ${modelsPath}. Expected lines like \`export type * from './models/Post.ts'\`. This is most likely a change in what Prisma generates. Please open an issue at https://github.com/cedarjs/cedar/issues.`
188
- );
189
- }
190
- return modelNames;
191
- }
192
- async function readGeneratedPrismaModelNames() {
174
+ async function importGeneratedPrismaClient() {
193
175
  const cacheBuster = `?t=${Date.now()}`;
194
176
  const { clientPath, error } = await resolveGeneratedPrismaClient();
195
177
  if (!clientPath) {
196
178
  throw new Error(error);
197
179
  }
198
- if (/\.[mc]?ts$/.test(clientPath)) {
199
- return readPrismaModelNames(clientPath);
200
- }
201
180
  const fileUrl = pathToFileURL(clientPath).href + cacheBuster;
202
181
  const freshPrisma = await import(fileUrl);
203
- const modelName = getModelName(freshPrisma);
204
- return modelName ?? {};
182
+ return freshPrisma;
205
183
  }
206
184
  function isModelNameRecord(value) {
207
185
  if (typeof value !== "object" || value === null) {
@@ -228,27 +206,23 @@ function getModelName(mod) {
228
206
  }
229
207
  async function getPrismaClient() {
230
208
  try {
231
- const modelName = await readGeneratedPrismaModelNames();
232
- if (Object.keys(modelName).length > 0) {
209
+ const localPrisma = await importGeneratedPrismaClient();
210
+ const modelName = getModelName(localPrisma);
211
+ if (modelName) {
233
212
  return { ModelName: modelName };
234
213
  }
235
- } catch (e) {
236
- if (e instanceof PrismaModelsFormatError) {
237
- throw e;
238
- }
214
+ } catch {
239
215
  }
240
216
  const pm = getPackageManager();
241
217
  const pmExec = pm === "npm" ? "npx" : pm;
242
218
  execa.sync(pmExec, ["cedar", "prisma", "generate"]);
243
219
  try {
244
- const modelName = await readGeneratedPrismaModelNames();
245
- if (Object.keys(modelName).length > 0) {
220
+ const freshPrisma = await importGeneratedPrismaClient();
221
+ const modelName = getModelName(freshPrisma);
222
+ if (modelName) {
246
223
  return { ModelName: modelName };
247
224
  }
248
- } catch (e) {
249
- if (e instanceof PrismaModelsFormatError) {
250
- throw e;
251
- }
225
+ } catch {
252
226
  }
253
227
  return { ModelName: {} };
254
228
  }
@@ -1 +1 @@
1
- {"version":3,"file":"graphqlSchema.d.ts","sourceRoot":"","sources":["../../src/generate/graphqlSchema.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,qBAAqB;;;iBA2DP,MAAM;eAAS,OAAO;;EA2EhD,CAAA"}
1
+ {"version":3,"file":"graphqlSchema.d.ts","sourceRoot":"","sources":["../../src/generate/graphqlSchema.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,qBAAqB;;;iBA2DP,MAAM;eAAS,OAAO;;EA2EhD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/generate/templates.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,eAAO,MAAM,aAAa,GACxB,cAAc,MAAM,EACpB,aAAa,MAAM,EACnB,iBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,SAY7C,CAAA"}
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/generate/templates.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,eAAO,MAAM,aAAa,GACxB,cAAc,MAAM,EACpB,aAAa,MAAM,EACnB,iBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,SAY7C,CAAA"}
@@ -1,6 +1,11 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
- const ___dirname = import.meta.dirname;
3
+ const ___dirname = (
4
+ // __dirname will work for CJS, and import.meta.dirname will work for ESM
5
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
6
+ // @ts-ignore
7
+ typeof __dirname !== "undefined" ? __dirname : import.meta?.dirname
8
+ );
4
9
  const writeTemplate = (templatePath, destination, templateValues = {}) => {
5
10
  const templateString = fs.readFileSync(
6
11
  path.join(___dirname, templatePath),
@@ -1 +1 @@
1
- {"version":3,"file":"typeDefinitions.d.ts","sourceRoot":"","sources":["../../src/generate/typeDefinitions.ts"],"names":[],"mappings":"AA8CA;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;EA0B5B,CAAA;AAED,eAAO,MAAM,mCAAmC,gBAK/C,CAAA;AAED,eAAO,MAAM,kCAAkC,GAC7C,GAAG,MAAM,EACT,mDAAsB,aASvB,CAAA;AAED,eAAO,MAAM,kCAAkC,GAC7C,GAAG,MAAM,EACT,mDAAsB,WAoDvB,CAAA;AAED,eAAO,MAAM,mBAAmB,gBAG/B,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,GAAG,MAAM,EAAE,mDAAsB,aAQlE,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,GAAG,MAAM,EAAE,mDAAsB,WAiFnE,CAAA;AAiBD,eAAO,MAAM,2BAA2B,gBAmEvC,CAAA;AAED,eAAO,MAAM,0BAA0B,gBA8CtC,CAAA;AAED,eAAO,MAAM,0BAA0B,gBAEtC,CAAA;AAED,eAAO,MAAM,qBAAqB,gBAEjC,CAAA;AAED,eAAO,MAAM,wBAAwB,gBAEpC,CAAA;AAED,eAAO,MAAM,wBAAwB,gBAKpC,CAAA;AAED,eAAO,MAAM,0BAA0B,gBAEtC,CAAA;AAED,eAAO,MAAM,4BAA4B,gBAExC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,gCAAgC,gBAW5C,CAAA"}
1
+ {"version":3,"file":"typeDefinitions.d.ts","sourceRoot":"","sources":["../../src/generate/typeDefinitions.ts"],"names":[],"mappings":"AAyCA;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;EA0B5B,CAAA;AAED,eAAO,MAAM,mCAAmC,gBAK/C,CAAA;AAED,eAAO,MAAM,kCAAkC,GAC7C,GAAG,MAAM,EACT,mDAAsB,aASvB,CAAA;AAED,eAAO,MAAM,kCAAkC,GAC7C,GAAG,MAAM,EACT,mDAAsB,WAoDvB,CAAA;AAED,eAAO,MAAM,mBAAmB,gBAG/B,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,GAAG,MAAM,EAAE,mDAAsB,aAQlE,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,GAAG,MAAM,EAAE,mDAAsB,WA8DnE,CAAA;AAiBD,eAAO,MAAM,2BAA2B,gBAmEvC,CAAA;AAED,eAAO,MAAM,0BAA0B,gBA8CtC,CAAA;AAED,eAAO,MAAM,0BAA0B,gBAEtC,CAAA;AAED,eAAO,MAAM,qBAAqB,gBAEjC,CAAA;AAED,eAAO,MAAM,wBAAwB,gBAEpC,CAAA;AAED,eAAO,MAAM,wBAAwB,gBAKpC,CAAA;AAED,eAAO,MAAM,0BAA0B,gBAEtC,CAAA;AAED,eAAO,MAAM,4BAA4B,gBAExC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,gCAAgC,gBAW5C,CAAA"}
@@ -3,18 +3,13 @@ import path from "path";
3
3
  import { SourceMapGenerator } from "source-map";
4
4
  import { getPaths, processPagesDir } from "@cedarjs/project-config";
5
5
  import {
6
- getCellGqlFragment,
7
6
  getCellGqlQuery,
8
7
  fileToAst,
9
8
  getDefaultExportLocation,
10
9
  getNamedExports
11
10
  } from "../ast.js";
12
11
  import { findCells, findDirectoryNamedModules } from "../files.js";
13
- import {
14
- parseGqlFragmentName,
15
- parseGqlFragmentPropName,
16
- parseGqlQueryToAst
17
- } from "../gql.js";
12
+ import { parseGqlQueryToAst } from "../gql.js";
18
13
  import { getJsxElements } from "../jsx.js";
19
14
  import {
20
15
  generateTypeDefGraphQLApi,
@@ -120,9 +115,6 @@ const generateMirrorCell = (p, rwjsPaths = getPaths()) => {
120
115
  const { name } = path.parse(p);
121
116
  const fileContents = fileToAst(p);
122
117
  const cellQuery = getCellGqlQuery(fileContents);
123
- const cellFragment = cellQuery ? void 0 : getCellGqlFragment(fileContents);
124
- const cellFragmentName = cellFragment ? parseGqlFragmentName(cellFragment) : void 0;
125
- const cellFragmentPropName = cellFragment ? parseGqlFragmentPropName(cellFragment) : void 0;
126
118
  if (cellQuery) {
127
119
  const gqlDoc = parseGqlQueryToAst(cellQuery)[0];
128
120
  writeTemplate("templates/mirror-cell.d.ts.template", typeDefPath, {
@@ -130,12 +122,6 @@ const generateMirrorCell = (p, rwjsPaths = getPaths()) => {
130
122
  queryResultType: `${gqlDoc?.name}`,
131
123
  queryVariablesType: `${gqlDoc?.name}Variables`
132
124
  });
133
- } else if (cellFragmentName && cellFragmentPropName) {
134
- writeTemplate("templates/mirror-cell-fragment.d.ts.template", typeDefPath, {
135
- name,
136
- fragmentType: cellFragmentName,
137
- fragmentPropName: cellFragmentPropName
138
- });
139
125
  } else {
140
126
  writeTemplate("templates/mirror-cell.d.ts.template", typeDefPath, {
141
127
  name,
package/dist/gql.d.ts CHANGED
@@ -9,26 +9,6 @@ interface Field {
9
9
  }
10
10
  export declare const parseGqlQueryToAst: (gqlQuery: string) => Operation[];
11
11
  export declare const parseDocumentAST: (document: DocumentNode) => Operation[];
12
- /**
13
- * Returns the name of the first fragment definition in the given GraphQL
14
- * source, e.g. `AuthorCell_author` for
15
- * `fragment AuthorCell_author on User { fullName }`
16
- */
17
- export declare const parseGqlFragmentName: (gqlFragment: string) => string | undefined;
18
- /**
19
- * Derives a fragment Cell's data prop name from its fragment: the prop the
20
- * parent Cell passes the fragment data in with, and the prop `Success`
21
- * receives the data as.
22
- *
23
- * For a fragment named with an underscore, like `AuthorCell_author`, the part
24
- * after the last underscore is used (`author`). Otherwise the type the
25
- * fragment is defined on is used, camelCased (`on User` -> `user`).
26
- *
27
- * Keep this in sync with getFragmentPropName in
28
- * packages/web/src/components/cell/createFragmentCell.tsx, which is what the
29
- * fragment Cell runtime uses.
30
- */
31
- export declare const parseGqlFragmentPropName: (gqlFragment: string) => string | undefined;
32
12
  export declare const listQueryTypeFieldsInProject: () => Promise<string[]>;
33
13
  export {};
34
14
  //# sourceMappingURL=gql.d.ts.map
package/dist/gql.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"gql.d.ts","sourceRoot":"","sources":["../src/gql.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EAKZ,iBAAiB,EAClB,MAAM,SAAS,CAAA;AAMhB,UAAU,SAAS;IACjB,SAAS,EAAE,iBAAiB,CAAA;IAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;IACxB,MAAM,EAAE,CAAC,MAAM,GAAG,KAAK,CAAC,EAAE,CAAA;CAC3B;AAED,UAAU,KAAK;IACb,MAAM,EAAE,CAAC,MAAM,GAAG,KAAK,CAAC,EAAE,CAAA;CAC3B;AAED,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,gBAGlD,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,UAAU,YAAY,gBAoBtD,CAAA;AAyCD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,aAAa,MAAM,uBAEvD,CAAA;AAED;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,wBAAwB,GAAI,aAAa,MAAM,uBAiB3D,CAAA;AAED,eAAO,MAAM,4BAA4B,yBA8BxC,CAAA"}
1
+ {"version":3,"file":"gql.d.ts","sourceRoot":"","sources":["../src/gql.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,YAAY,EAIZ,iBAAiB,EAClB,MAAM,SAAS,CAAA;AAMhB,UAAU,SAAS;IACjB,SAAS,EAAE,iBAAiB,CAAA;IAC5B,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;IACxB,MAAM,EAAE,CAAC,MAAM,GAAG,KAAK,CAAC,EAAE,CAAA;CAC3B;AAED,UAAU,KAAK;IACb,MAAM,EAAE,CAAC,MAAM,GAAG,KAAK,CAAC,EAAE,CAAA;CAC3B;AAED,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,gBAGlD,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,UAAU,YAAY,gBAoBtD,CAAA;AAgCD,eAAO,MAAM,4BAA4B,yBA8BxC,CAAA"}