@paris-ias/trees 1.8.56

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 (202) hide show
  1. package/LICENSE +679 -0
  2. package/dist/form/action.js +83 -0
  3. package/dist/form/affiliation.js +178 -0
  4. package/dist/form/apps.js +132 -0
  5. package/dist/form/disciplines.js +30 -0
  6. package/dist/form/events.js +836 -0
  7. package/dist/form/fellowships.js +1307 -0
  8. package/dist/form/files.js +30 -0
  9. package/dist/form/mailing.js +43 -0
  10. package/dist/form/news.js +252 -0
  11. package/dist/form/people.js +658 -0
  12. package/dist/form/projects.js +338 -0
  13. package/dist/form/publications.js +364 -0
  14. package/dist/form/tags.js +38 -0
  15. package/dist/form/users.js +576 -0
  16. package/dist/graphql/client/action/query.get.action.gql +22 -0
  17. package/dist/graphql/client/action/query.list.action.gql +32 -0
  18. package/dist/graphql/client/affiliation/query.get.affiliations.gql +37 -0
  19. package/dist/graphql/client/affiliation/query.list.affiliations.gql +43 -0
  20. package/dist/graphql/client/apps/query.get.apps.gql +33 -0
  21. package/dist/graphql/client/apps/query.list.apps.gql +43 -0
  22. package/dist/graphql/client/events/query.get.events.gql +119 -0
  23. package/dist/graphql/client/events/query.list.events.gql +40 -0
  24. package/dist/graphql/client/fellowships/query.get.fellowships.gql +163 -0
  25. package/dist/graphql/client/fellowships/query.list.fellowships.gql +49 -0
  26. package/dist/graphql/client/files/query.get.files.gql +24 -0
  27. package/dist/graphql/client/files/query.list.files.gql +37 -0
  28. package/dist/graphql/client/mailing/query.get.mailing.gql +24 -0
  29. package/dist/graphql/client/mailing/query.list.mailing.gql +23 -0
  30. package/dist/graphql/client/misc/apex.mutations.delete.gql +0 -0
  31. package/dist/graphql/client/misc/apex.mutations.upsert.gql +0 -0
  32. package/dist/graphql/client/misc/apex.queries.login.gql +0 -0
  33. package/dist/graphql/client/misc/query.get.disciplines.gql +17 -0
  34. package/dist/graphql/client/misc/query.get.tags.gql +13 -0
  35. package/dist/graphql/client/misc/query.list.disciplines.gql +23 -0
  36. package/dist/graphql/client/misc/query.list.tags.gql +23 -0
  37. package/dist/graphql/client/news/query.get.news.gql +128 -0
  38. package/dist/graphql/client/news/query.list.news.gql +35 -0
  39. package/dist/graphql/client/people/query.get.people.gql +173 -0
  40. package/dist/graphql/client/people/query.get.users.gql +0 -0
  41. package/dist/graphql/client/people/query.list.people.gql +55 -0
  42. package/dist/graphql/client/people/query.list.users.gql +31 -0
  43. package/dist/graphql/client/projects/query.get.projects.gql +166 -0
  44. package/dist/graphql/client/projects/query.list.projects.gql +33 -0
  45. package/dist/graphql/client/publications/query.get.publications.gql +169 -0
  46. package/dist/graphql/client/publications/query.list.publications.gql +35 -0
  47. package/dist/graphql/schemas/apex-resolvers-list.json +45 -0
  48. package/dist/graphql/schemas/schema.apex.graphql +946 -0
  49. package/dist/graphql/schemas/schema.website.graphql +794 -0
  50. package/dist/graphql/schemas/website-resolvers-list.json +22 -0
  51. package/dist/list/action.js +133 -0
  52. package/dist/list/affiliation.js +133 -0
  53. package/dist/list/apps.js +133 -0
  54. package/dist/list/disciplines.js +132 -0
  55. package/dist/list/events.js +186 -0
  56. package/dist/list/fellowships.js +149 -0
  57. package/dist/list/files.js +132 -0
  58. package/dist/list/mailing.js +132 -0
  59. package/dist/list/news.js +135 -0
  60. package/dist/list/people.js +176 -0
  61. package/dist/list/projects.js +135 -0
  62. package/dist/list/publications.js +152 -0
  63. package/dist/list/tags.js +133 -0
  64. package/dist/list/users.js +176 -0
  65. package/index.ts +63 -0
  66. package/lib/README.md +206 -0
  67. package/lib/buildClientGraphQL.ts +342 -0
  68. package/lib/buildDefaults.ts +0 -0
  69. package/lib/buildSchemas.ts +109 -0
  70. package/lib/generate.ts +505 -0
  71. package/lib/generateAll.ts +231 -0
  72. package/lib/utils.ts +24 -0
  73. package/package.json +34 -0
  74. package/readme.md +116 -0
  75. package/src/LICENSE +661 -0
  76. package/src/action/graphql/client/query.get.action.gql +22 -0
  77. package/src/action/graphql/client/query.list.action.gql +32 -0
  78. package/src/action/graphql/server/apex.types.action.graphql +15 -0
  79. package/src/action/models/action.ts +147 -0
  80. package/src/affiliation/graphql/client/query.get.affiliations.gql +37 -0
  81. package/src/affiliation/graphql/client/query.list.affiliations.gql +43 -0
  82. package/src/affiliation/graphql/server/shared.types.affiliations.graphql +20 -0
  83. package/src/affiliation/models/affiliation.ts +130 -0
  84. package/src/affiliation/models/member.ts +11 -0
  85. package/src/affiliation/models/partner.ts +9 -0
  86. package/src/apps/graphql/client/query.get.apps.gql +33 -0
  87. package/src/apps/graphql/client/query.list.apps.gql +43 -0
  88. package/src/apps/models/apps.ts +195 -0
  89. package/src/events/graphql/client/query.get.events.gql +119 -0
  90. package/src/events/graphql/client/query.list.events.gql +40 -0
  91. package/src/events/graphql/server/shared.inputs.events.graphql +24 -0
  92. package/src/events/models/eventSlot.ts +73 -0
  93. package/src/events/models/events.ts +569 -0
  94. package/src/fellowships/graphql/client/query.get.fellowships.gql +163 -0
  95. package/src/fellowships/graphql/client/query.list.fellowships.gql +49 -0
  96. package/src/fellowships/graphql/server/apex.inputs.fellowshipDetails.graphql +13 -0
  97. package/src/fellowships/graphql/server/shared.types.fellowshipDetails.graphql +13 -0
  98. package/src/fellowships/graphql/server/shared.types.fellowships.graphql +38 -0
  99. package/src/fellowships/models/fellowshipDetails.ts +145 -0
  100. package/src/fellowships/models/fellowships.ts +341 -0
  101. package/src/files/graphql/client/query.get.files.gql +24 -0
  102. package/src/files/graphql/client/query.list.files.gql +37 -0
  103. package/src/files/graphql/server/apex.inputs.files.graphql +7 -0
  104. package/src/files/graphql/server/apex.inputs.video.graphql +9 -0
  105. package/src/files/graphql/server/apex.types.files.graphql +4 -0
  106. package/src/files/graphql/server/shared.inputs.image.graphql +9 -0
  107. package/src/files/graphql/server/shared.types.files.graphql +15 -0
  108. package/src/files/graphql/server/shared.types.image.graphql +9 -0
  109. package/src/files/graphql/server/shared.types.video.graphql +9 -0
  110. package/src/files/models/files.ts +113 -0
  111. package/src/files/models/gallery.ts +11 -0
  112. package/src/files/models/image.ts +159 -0
  113. package/src/files/models/video.ts +166 -0
  114. package/src/form.ts +52 -0
  115. package/src/index.ts +98 -0
  116. package/src/list.ts +34 -0
  117. package/src/mailing/graphql/client/query.get.mailing.gql +24 -0
  118. package/src/mailing/graphql/client/query.list.mailing.gql +23 -0
  119. package/src/mailing/graphql/server/apex.types.mailing.graphql +13 -0
  120. package/src/mailing/models/mailing.ts +123 -0
  121. package/src/misc/graphql/client/apex.mutations.delete.gql +0 -0
  122. package/src/misc/graphql/client/apex.mutations.upsert.gql +0 -0
  123. package/src/misc/graphql/client/apex.queries.login.gql +0 -0
  124. package/src/misc/graphql/client/query.get.disciplines.gql +17 -0
  125. package/src/misc/graphql/client/query.get.tags.gql +13 -0
  126. package/src/misc/graphql/client/query.list.disciplines.gql +23 -0
  127. package/src/misc/graphql/client/query.list.tags.gql +23 -0
  128. package/src/misc/graphql/server/apex.inputs.misc.graphql +13 -0
  129. package/src/misc/graphql/server/apex.inputs.socials.graphql +12 -0
  130. package/src/misc/graphql/server/apex.mutations.graphql +23 -0
  131. package/src/misc/graphql/server/apex.queries.graphql +36 -0
  132. package/src/misc/graphql/server/apex.types.disciplines.graphql +4 -0
  133. package/src/misc/graphql/server/apex.types.tags.graphql +4 -0
  134. package/src/misc/graphql/server/shared.enums.graphql +112 -0
  135. package/src/misc/graphql/server/shared.inputs.misc.graphql +101 -0
  136. package/src/misc/graphql/server/shared.queries.graphql +35 -0
  137. package/src/misc/graphql/server/shared.types.disciplines.graphql +8 -0
  138. package/src/misc/graphql/server/shared.types.events.graphql +39 -0
  139. package/src/misc/graphql/server/shared.types.location.graphql +17 -0
  140. package/src/misc/graphql/server/shared.types.misc.graphql +120 -0
  141. package/src/misc/graphql/server/shared.types.related.graphql +10 -0
  142. package/src/misc/graphql/server/shared.types.relatedAffiliation.graphql +7 -0
  143. package/src/misc/graphql/server/shared.types.relatedEvent.graphql +7 -0
  144. package/src/misc/graphql/server/shared.types.relatedFellowships.graphql +7 -0
  145. package/src/misc/graphql/server/shared.types.relatedNews.graphql +7 -0
  146. package/src/misc/graphql/server/shared.types.relatedPeople.graphql +6 -0
  147. package/src/misc/graphql/server/shared.types.relatedProject.graphql +7 -0
  148. package/src/misc/graphql/server/shared.types.relatedPublications.graphql +6 -0
  149. package/src/misc/graphql/server/shared.types.socials.graphql +22 -0
  150. package/src/misc/graphql/server/shared.types.tags.graphql +11 -0
  151. package/src/misc/graphql/server/website.mutations.graphql +4 -0
  152. package/src/misc/models/disciplines.ts +116 -0
  153. package/src/misc/models/location.ts +136 -0
  154. package/src/misc/models/organizers.ts +13 -0
  155. package/src/misc/models/related.ts +123 -0
  156. package/src/misc/models/relatedEvents.ts +16 -0
  157. package/src/misc/models/relatedFellowships.ts +7 -0
  158. package/src/misc/models/relatedNews.ts +13 -0
  159. package/src/misc/models/relatedPeople.ts +8 -0
  160. package/src/misc/models/relatedProject.ts +14 -0
  161. package/src/misc/models/relatedPublications.ts +14 -0
  162. package/src/misc/models/socials.ts +133 -0
  163. package/src/misc/models/sponsor.ts +13 -0
  164. package/src/misc/models/tags.ts +116 -0
  165. package/src/misc/models/taxonomy.ts +1 -0
  166. package/src/model.ts +7 -0
  167. package/src/news/graphql/client/query.get.news.gql +128 -0
  168. package/src/news/graphql/client/query.list.news.gql +35 -0
  169. package/src/news/graphql/server/share.types.news.graphql +27 -0
  170. package/src/news/models/news.ts +257 -0
  171. package/src/people/graphql/client/query.get.people.gql +173 -0
  172. package/src/people/graphql/client/query.get.users.gql +0 -0
  173. package/src/people/graphql/client/query.list.people.gql +55 -0
  174. package/src/people/graphql/client/query.list.users.gql +31 -0
  175. package/src/people/graphql/server/apex.inputs.consent.graphql +9 -0
  176. package/src/people/graphql/server/apex.inputs.groups.graphql +8 -0
  177. package/src/people/graphql/server/apex.inputs.vintage.graphql +6 -0
  178. package/src/people/graphql/server/shared.types.consent.graphql +9 -0
  179. package/src/people/graphql/server/shared.types.groups.graphql +8 -0
  180. package/src/people/graphql/server/shared.types.people.graphql +29 -0
  181. package/src/people/graphql/server/shared.types.position.graphql +6 -0
  182. package/src/people/graphql/server/shared.types.users.graphql +17 -0
  183. package/src/people/graphql/server/shared.types.vintage.graphql +6 -0
  184. package/src/people/models/consent.ts +82 -0
  185. package/src/people/models/discussants.ts +9 -0
  186. package/src/people/models/experiences.ts +38 -0
  187. package/src/people/models/fellows.ts +12 -0
  188. package/src/people/models/groups.ts +58 -0
  189. package/src/people/models/people.ts +244 -0
  190. package/src/people/models/position.ts +62 -0
  191. package/src/people/models/speakers.ts +9 -0
  192. package/src/people/models/users.ts +252 -0
  193. package/src/people/models/vintage.ts +124 -0
  194. package/src/projects/graphql/client/query.get.projects.gql +166 -0
  195. package/src/projects/graphql/client/query.list.projects.gql +33 -0
  196. package/src/projects/graphql/server/shared.types.projects.graphql +29 -0
  197. package/src/projects/models/projects.ts +249 -0
  198. package/src/publications/graphql/client/query.get.publications.gql +169 -0
  199. package/src/publications/graphql/client/query.list.publications.gql +35 -0
  200. package/src/publications/graphql/server/shared.types.publications.graphql +34 -0
  201. package/src/publications/models/article.ts +262 -0
  202. package/src/publications/models/publications.ts +306 -0
@@ -0,0 +1,342 @@
1
+ import fs from "fs"
2
+ import path from "path"
3
+ import { fileURLToPath } from "url"
4
+
5
+ // Declare process global for environments without @types/node
6
+ declare const process: any
7
+
8
+ const __filename = fileURLToPath(import.meta.url)
9
+ const __dirname = path.dirname(__filename)
10
+
11
+ /**
12
+ * Configuration for the GraphQL client file builder
13
+ */
14
+ interface BuildConfig {
15
+ /** Source directory containing type folders */
16
+ srcDir: string
17
+ /** Destination directory for built GraphQL files */
18
+ distDir: string
19
+ /** File extensions to copy */
20
+ extensions: string[]
21
+ /** Whether to create TypeScript declaration files */
22
+ generateDeclarations: boolean
23
+ /** Whether to generate TypeScript index files */
24
+ generateIndexFiles: boolean
25
+ }
26
+
27
+ /**
28
+ * Information about a discovered GraphQL file
29
+ */
30
+ interface GraphQLFile {
31
+ /** Full path to the source file */
32
+ sourcePath: string
33
+ /** Relative path from the type's client directory */
34
+ relativePath: string
35
+ /** Type/category name (e.g., 'publications', 'people') */
36
+ typeName: string
37
+ /** File name without extension */
38
+ fileName: string
39
+ /** File extension */
40
+ extension: string
41
+ }
42
+
43
+ /**
44
+ * Default configuration for the build process
45
+ */
46
+ const defaultConfig: BuildConfig = {
47
+ srcDir: path.resolve(__dirname, "../src"),
48
+ distDir: path.resolve(__dirname, "../dist/graphql/client"),
49
+ extensions: [".gql", ".graphql"],
50
+ generateDeclarations: false, // Disabled since pinia plugin imports .gql files directly
51
+ generateIndexFiles: false, // Disabled since pinia plugin imports .gql files directly
52
+ }
53
+
54
+ /**
55
+ * Ensures a directory exists, creating it recursively if needed
56
+ */
57
+ function ensureDir(dir: string): void {
58
+ if (!fs.existsSync(dir)) {
59
+ fs.mkdirSync(dir, { recursive: true })
60
+ }
61
+ }
62
+
63
+ /**
64
+ * Discovers all GraphQL client files in the source directory
65
+ */
66
+ function discoverGraphQLFiles(
67
+ srcDir: string,
68
+ extensions: string[]
69
+ ): GraphQLFile[] {
70
+ const files: GraphQLFile[] = []
71
+
72
+ try {
73
+ const typeDirectories = fs
74
+ .readdirSync(srcDir, { withFileTypes: true })
75
+ .filter((dirent: any) => dirent.isDirectory())
76
+ .map((dirent: any) => dirent.name)
77
+
78
+ for (const typeName of typeDirectories) {
79
+ const clientDir = path.join(srcDir, typeName, "graphql", "client")
80
+
81
+ if (!fs.existsSync(clientDir)) {
82
+ console.log(
83
+ `āš ļø No client GraphQL directory found for type: ${typeName}`
84
+ )
85
+ continue
86
+ }
87
+
88
+ const clientFiles = fs
89
+ .readdirSync(clientDir, { withFileTypes: true })
90
+ .filter((dirent: any) => dirent.isFile())
91
+ .filter((dirent: any) =>
92
+ extensions.some((ext) => dirent.name.endsWith(ext))
93
+ )
94
+
95
+ for (const file of clientFiles) {
96
+ const sourcePath = path.join(clientDir, file.name)
97
+ const extension = path.extname(file.name)
98
+ const fileName = path.basename(file.name, extension)
99
+
100
+ files.push({
101
+ sourcePath,
102
+ relativePath: file.name,
103
+ typeName,
104
+ fileName,
105
+ extension,
106
+ })
107
+ }
108
+ }
109
+ } catch (error) {
110
+ console.error(`āŒ Error discovering GraphQL files:`, error)
111
+ throw error
112
+ }
113
+
114
+ return files
115
+ }
116
+
117
+ /**
118
+ * Copies a GraphQL file to the destination directory
119
+ */
120
+ function copyGraphQLFile(file: GraphQLFile, destDir: string): void {
121
+ const typeDestDir = path.join(destDir, file.typeName)
122
+ ensureDir(typeDestDir)
123
+
124
+ const destPath = path.join(typeDestDir, file.relativePath)
125
+
126
+ try {
127
+ fs.copyFileSync(file.sourcePath, destPath)
128
+ console.log(`āœ… Copied: ${file.typeName}/${file.relativePath}`)
129
+ } catch (error) {
130
+ console.error(`āŒ Failed to copy ${file.sourcePath}:`, error)
131
+ throw error
132
+ }
133
+ }
134
+
135
+ /**
136
+ * Generates TypeScript declaration file for a GraphQL file
137
+ */
138
+ function generateDeclarationFile(file: GraphQLFile, destDir: string): void {
139
+ const typeDestDir = path.join(destDir, file.typeName)
140
+ ensureDir(typeDestDir)
141
+
142
+ const declarationPath = path.join(typeDestDir, `${file.fileName}.d.ts`)
143
+
144
+ // Read the GraphQL content to extract operation names
145
+ const content = fs.readFileSync(file.sourcePath, "utf-8")
146
+ const operationMatches =
147
+ content.match(/(query|mutation|subscription)\s+(\w+)/g) || []
148
+
149
+ let declarationContent = `/**
150
+ * TypeScript declarations for ${file.relativePath}
151
+ * Generated automatically - do not edit manually
152
+ */
153
+
154
+ declare const graphqlDocument: string
155
+ export default graphqlDocument
156
+
157
+ `
158
+
159
+ // Add operation name exports if found
160
+ if (operationMatches.length > 0) {
161
+ declarationContent += `// Operation names found in this document:\n`
162
+ operationMatches.forEach((match: string) => {
163
+ const matchResult = match.match(/(query|mutation|subscription)\s+(\w+)/)
164
+ if (matchResult) {
165
+ const [, operationType, operationName] = matchResult
166
+ if (operationName) {
167
+ declarationContent += `// - ${operationType}: ${operationName}\n`
168
+ }
169
+ }
170
+ })
171
+ }
172
+
173
+ try {
174
+ fs.writeFileSync(declarationPath, declarationContent)
175
+ console.log(
176
+ `šŸ“ Generated declaration: ${file.typeName}/${file.fileName}.d.ts`
177
+ )
178
+ } catch (error) {
179
+ console.error(
180
+ `āŒ Failed to generate declaration for ${file.sourcePath}:`,
181
+ error
182
+ )
183
+ throw error
184
+ }
185
+ }
186
+
187
+ /**
188
+ * Generates an index file for each type directory
189
+ */
190
+ function generateTypeIndex(
191
+ typeName: string,
192
+ files: GraphQLFile[],
193
+ destDir: string
194
+ ): void {
195
+ const typeDestDir = path.join(destDir, typeName)
196
+ const indexPath = path.join(typeDestDir, "index.ts")
197
+
198
+ let indexContent = `/**
199
+ * GraphQL client operations for ${typeName}
200
+ * Generated automatically - do not edit manually
201
+ */
202
+
203
+ `
204
+
205
+ // Group files by operation type
206
+ const queries = files.filter((f) => f.fileName.includes("query"))
207
+ const mutations = files.filter((f) => f.fileName.includes("mutation"))
208
+ const subscriptions = files.filter((f) => f.fileName.includes("subscription"))
209
+
210
+ const addExports = (fileList: GraphQLFile[], sectionName: string) => {
211
+ if (fileList.length > 0) {
212
+ indexContent += `// ${sectionName}\n`
213
+ fileList.forEach((file) => {
214
+ const exportName = file.fileName
215
+ .replace(/^(query|mutation|subscription)\./, "")
216
+ .replace(/\./g, "_")
217
+ .toUpperCase()
218
+ indexContent += `export { default as ${exportName} } from "./${file.fileName}.gql"\n`
219
+ })
220
+ indexContent += "\n"
221
+ }
222
+ }
223
+
224
+ addExports(queries, "Queries")
225
+ addExports(mutations, "Mutations")
226
+ addExports(subscriptions, "Subscriptions")
227
+
228
+ try {
229
+ fs.writeFileSync(indexPath, indexContent)
230
+ console.log(`šŸ“¦ Generated index: ${typeName}/index.ts`)
231
+ } catch (error) {
232
+ console.error(`āŒ Failed to generate index for ${typeName}:`, error)
233
+ throw error
234
+ }
235
+ }
236
+
237
+ /**
238
+ * Generates a main index file for all types
239
+ */
240
+ function generateMainIndex(typeNames: string[], destDir: string): void {
241
+ const indexPath = path.join(destDir, "index.ts")
242
+
243
+ let indexContent = `/**
244
+ * GraphQL client operations - Main index
245
+ * Generated automatically - do not edit manually
246
+ */
247
+
248
+ `
249
+
250
+ typeNames.forEach((typeName) => {
251
+ indexContent += `export * as ${typeName} from "./${typeName}"\n`
252
+ })
253
+
254
+ try {
255
+ fs.writeFileSync(indexPath, indexContent)
256
+ console.log(`šŸ“¦ Generated main index: index.ts`)
257
+ } catch (error) {
258
+ console.error(`āŒ Failed to generate main index:`, error)
259
+ throw error
260
+ }
261
+ }
262
+
263
+ /**
264
+ * Main build function
265
+ */
266
+ export function buildClientGraphQL(config: Partial<BuildConfig> = {}): void {
267
+ const finalConfig = { ...defaultConfig, ...config }
268
+
269
+ console.log("šŸš€ Starting GraphQL client build process...")
270
+ console.log(`šŸ“‚ Source directory: ${finalConfig.srcDir}`)
271
+ console.log(`šŸ“¦ Destination directory: ${finalConfig.distDir}`)
272
+ console.log(`šŸ” Extensions: ${finalConfig.extensions.join(", ")}`)
273
+
274
+ // Ensure destination directory exists
275
+ ensureDir(finalConfig.distDir)
276
+
277
+ // Discover all GraphQL files
278
+ console.log("\nšŸ” Discovering GraphQL files...")
279
+ const graphqlFiles = discoverGraphQLFiles(
280
+ finalConfig.srcDir,
281
+ finalConfig.extensions
282
+ )
283
+
284
+ if (graphqlFiles.length === 0) {
285
+ console.log("āš ļø No GraphQL files found!")
286
+ return
287
+ }
288
+
289
+ console.log(
290
+ `šŸ“Š Found ${graphqlFiles.length} GraphQL files across ${
291
+ new Set(graphqlFiles.map((f) => f.typeName)).size
292
+ } types`
293
+ )
294
+
295
+ // Copy files and generate declarations
296
+ console.log("\nšŸ“‹ Copying files...")
297
+ const typeNames = new Set<string>()
298
+
299
+ for (const file of graphqlFiles) {
300
+ typeNames.add(file.typeName)
301
+ copyGraphQLFile(file, finalConfig.distDir)
302
+
303
+ if (finalConfig.generateDeclarations) {
304
+ generateDeclarationFile(file, finalConfig.distDir)
305
+ }
306
+ }
307
+
308
+ // Generate index files for each type (only if enabled)
309
+ if (finalConfig.generateIndexFiles) {
310
+ console.log("\nšŸ“ Generating index files...")
311
+ for (const typeName of typeNames) {
312
+ const typeFiles = graphqlFiles.filter((f) => f.typeName === typeName)
313
+ generateTypeIndex(typeName, typeFiles, finalConfig.distDir)
314
+ }
315
+
316
+ // Generate main index file
317
+ generateMainIndex(Array.from(typeNames), finalConfig.distDir)
318
+ } else {
319
+ console.log("\nā­ļø Skipping index file generation (disabled in config)")
320
+ }
321
+
322
+ console.log("\n✨ GraphQL client build completed successfully!")
323
+ console.log(`šŸ“Š Summary:`)
324
+ console.log(` • ${graphqlFiles.length} GraphQL files processed`)
325
+ console.log(` • ${typeNames.size} type categories`)
326
+ console.log(` • Files organized in: ${finalConfig.distDir}`)
327
+ }
328
+
329
+ // Execute if run directly
330
+ if (
331
+ typeof process !== "undefined" &&
332
+ import.meta.url === `file://${process.argv[1]}`
333
+ ) {
334
+ try {
335
+ buildClientGraphQL()
336
+ } catch (error) {
337
+ console.error("šŸ’„ Build failed:", error)
338
+ if (typeof process !== "undefined") {
339
+ process.exit(1)
340
+ }
341
+ }
342
+ }
File without changes
@@ -0,0 +1,109 @@
1
+ import { loadFilesSync } from "@graphql-tools/load-files"
2
+ import { mergeTypeDefs } from "@graphql-tools/merge"
3
+ import {
4
+ print,
5
+ visit,
6
+ type DocumentNode,
7
+ type ObjectTypeDefinitionNode,
8
+ } from "graphql"
9
+ import fs from "fs"
10
+ import path from "path"
11
+ import { fileURLToPath } from "url"
12
+
13
+ function ensureDir(dir: string): void {
14
+ if (!fs.existsSync(dir)) {
15
+ fs.mkdirSync(dir, { recursive: true })
16
+ }
17
+ }
18
+
19
+ function loadGraphQLFiles(baseDir: string, patterns: string[]): string[] {
20
+ const files: string[] = []
21
+ const directories = fs.readdirSync(baseDir, { withFileTypes: true })
22
+
23
+ directories.forEach((dirent) => {
24
+ const fullPath = path.join(baseDir, dirent.name)
25
+
26
+ if (dirent.isDirectory()) {
27
+ files.push(...loadGraphQLFiles(fullPath, patterns))
28
+ } else if (patterns.some((pattern) => dirent.name.startsWith(pattern))) {
29
+ files.push(fullPath)
30
+ }
31
+ })
32
+
33
+ return files
34
+ }
35
+
36
+ const __filename = fileURLToPath(import.meta.url)
37
+ const __dirname = path.dirname(__filename)
38
+
39
+ const OUTPUT_DIR = path.join(__dirname, "../dist/graphql/schemas/")
40
+ ensureDir(OUTPUT_DIR)
41
+
42
+ const APEX_SCHEMA_PATH = path.join(OUTPUT_DIR, "schema.apex.graphql")
43
+ const WEBSITE_SCHEMA_PATH = path.join(OUTPUT_DIR, "schema.website.graphql")
44
+
45
+ const baseDir = path.join(__dirname, "../src")
46
+
47
+ const sharedPatterns: string[] = [
48
+ "shared.enums",
49
+ "shared.inputs",
50
+ "shared.queries",
51
+ "shared.types",
52
+ ]
53
+ const apexPatterns: string[] = [
54
+ "apex.inputs",
55
+ "apex.queries",
56
+ "apex.types",
57
+ "apex.mutations",
58
+ ]
59
+ const websitePatterns: string[] = ["website.mutations"]
60
+
61
+ const sharedFiles = loadGraphQLFiles(baseDir, sharedPatterns)
62
+ const apexFiles = loadGraphQLFiles(baseDir, apexPatterns)
63
+ const websiteFiles = loadGraphQLFiles(baseDir, websitePatterns)
64
+
65
+ const apexSchema: DocumentNode = mergeTypeDefs(
66
+ loadFilesSync([...apexFiles, ...sharedFiles])
67
+ ) as DocumentNode
68
+ const websiteSchema: DocumentNode = mergeTypeDefs(
69
+ loadFilesSync([...websiteFiles, ...sharedFiles])
70
+ ) as DocumentNode
71
+
72
+ fs.writeFileSync(APEX_SCHEMA_PATH, print(apexSchema), "utf8")
73
+ fs.writeFileSync(WEBSITE_SCHEMA_PATH, print(websiteSchema), "utf8")
74
+
75
+ function extractResolvers(appId: string, schema: DocumentNode): string {
76
+ const queries: string[] = []
77
+ const mutations: string[] = []
78
+
79
+ visit(schema, {
80
+ ObjectTypeDefinition(node: ObjectTypeDefinitionNode) {
81
+ if (node.name?.value === "Query" && node.fields?.length) {
82
+ for (const f of node.fields) {
83
+ queries.push(`queries/${f.name.value}`)
84
+ }
85
+ }
86
+ if (node.name?.value === "Mutation" && node.fields?.length) {
87
+ for (const f of node.fields) {
88
+ mutations.push(`mutations/${f.name.value}`)
89
+ }
90
+ }
91
+ },
92
+ })
93
+
94
+ const ops = Array.from(new Set([...queries, ...mutations])).sort()
95
+ const outFile = path.join(OUTPUT_DIR, `${appId}-resolvers-list.json`)
96
+ fs.writeFileSync(outFile, JSON.stringify(ops, null, 2), "utf8")
97
+ return outFile
98
+ }
99
+
100
+ const apexResolversFile = extractResolvers("apex", apexSchema)
101
+ const websiteResolversFile = extractResolvers("website", websiteSchema)
102
+
103
+ console.log("āœ… Schemas generated successfully:")
104
+ console.log(` - Website schema : ${WEBSITE_SCHEMA_PATH}`)
105
+ console.log(` - Apex schema : ${APEX_SCHEMA_PATH}`)
106
+
107
+ console.log("āœ… Resolvers list generated:")
108
+ console.log(` - Website resolvers : ${websiteResolversFile}`)
109
+ console.log(` - Apex resolvers : ${apexResolversFile}`)