@eide/uniformgen 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/README.md +356 -0
  2. package/dist/auth/credentials.d.ts +58 -0
  3. package/dist/auth/credentials.d.ts.map +1 -0
  4. package/dist/auth/credentials.js +107 -0
  5. package/dist/cli.d.ts +3 -0
  6. package/dist/cli.d.ts.map +1 -0
  7. package/dist/cli.js +563 -0
  8. package/dist/commands/init.d.ts +11 -0
  9. package/dist/commands/init.d.ts.map +1 -0
  10. package/dist/commands/init.js +113 -0
  11. package/dist/commands/login.d.ts +9 -0
  12. package/dist/commands/login.d.ts.map +1 -0
  13. package/dist/commands/login.js +158 -0
  14. package/dist/commands/logout.d.ts +5 -0
  15. package/dist/commands/logout.d.ts.map +1 -0
  16. package/dist/commands/logout.js +13 -0
  17. package/dist/commands/push.d.ts +13 -0
  18. package/dist/commands/push.d.ts.map +1 -0
  19. package/dist/commands/push.js +328 -0
  20. package/dist/commands/scaffold.d.ts +19 -0
  21. package/dist/commands/scaffold.d.ts.map +1 -0
  22. package/dist/commands/scaffold.js +366 -0
  23. package/dist/commands/seed.d.ts +20 -0
  24. package/dist/commands/seed.d.ts.map +1 -0
  25. package/dist/commands/seed.js +380 -0
  26. package/dist/commands/select-project.d.ts +10 -0
  27. package/dist/commands/select-project.d.ts.map +1 -0
  28. package/dist/commands/select-project.js +277 -0
  29. package/dist/commands/setup.d.ts +5 -0
  30. package/dist/commands/setup.d.ts.map +1 -0
  31. package/dist/commands/setup.js +51 -0
  32. package/dist/commands/sync.d.ts +13 -0
  33. package/dist/commands/sync.d.ts.map +1 -0
  34. package/dist/commands/sync.js +318 -0
  35. package/dist/commands/whoami.d.ts +5 -0
  36. package/dist/commands/whoami.d.ts.map +1 -0
  37. package/dist/commands/whoami.js +31 -0
  38. package/dist/config/load-config.d.ts +6 -0
  39. package/dist/config/load-config.d.ts.map +1 -0
  40. package/dist/config/load-config.js +103 -0
  41. package/dist/config/settings.d.ts +20 -0
  42. package/dist/config/settings.d.ts.map +1 -0
  43. package/dist/config/settings.js +64 -0
  44. package/dist/config/types.d.ts +152 -0
  45. package/dist/config/types.d.ts.map +1 -0
  46. package/dist/config/types.js +94 -0
  47. package/dist/fetcher/fetch-schemas.d.ts +140 -0
  48. package/dist/fetcher/fetch-schemas.d.ts.map +1 -0
  49. package/dist/fetcher/fetch-schemas.js +223 -0
  50. package/dist/fetcher/fetch-workflows.d.ts +53 -0
  51. package/dist/fetcher/fetch-workflows.d.ts.map +1 -0
  52. package/dist/fetcher/fetch-workflows.js +164 -0
  53. package/dist/generated/hooks/customer-detail.d.ts +74 -0
  54. package/dist/generated/hooks/customer-detail.d.ts.map +1 -0
  55. package/dist/generated/hooks/customer-detail.js +113 -0
  56. package/dist/generated/hooks/design-system.d.ts +74 -0
  57. package/dist/generated/hooks/design-system.d.ts.map +1 -0
  58. package/dist/generated/hooks/design-system.js +109 -0
  59. package/dist/generated/hooks/index.d.ts +16 -0
  60. package/dist/generated/hooks/index.d.ts.map +1 -0
  61. package/dist/generated/hooks/index.js +14 -0
  62. package/dist/generated/hooks/shopify-collection.d.ts +74 -0
  63. package/dist/generated/hooks/shopify-collection.d.ts.map +1 -0
  64. package/dist/generated/hooks/shopify-collection.js +113 -0
  65. package/dist/generated/hooks/shopify-market.d.ts +74 -0
  66. package/dist/generated/hooks/shopify-market.d.ts.map +1 -0
  67. package/dist/generated/hooks/shopify-market.js +109 -0
  68. package/dist/generated/hooks/shopify-product.d.ts +74 -0
  69. package/dist/generated/hooks/shopify-product.d.ts.map +1 -0
  70. package/dist/generated/hooks/shopify-product.js +113 -0
  71. package/dist/generated/hooks/shopify-variant.d.ts +74 -0
  72. package/dist/generated/hooks/shopify-variant.d.ts.map +1 -0
  73. package/dist/generated/hooks/shopify-variant.js +113 -0
  74. package/dist/generated/hooks/template.d.ts +74 -0
  75. package/dist/generated/hooks/template.d.ts.map +1 -0
  76. package/dist/generated/hooks/template.js +107 -0
  77. package/dist/generated/types/config.d.ts +88 -0
  78. package/dist/generated/types/config.d.ts.map +1 -0
  79. package/dist/generated/types/config.js +14 -0
  80. package/dist/generated/types/data-models/index.d.ts +7 -0
  81. package/dist/generated/types/data-models/index.d.ts.map +1 -0
  82. package/dist/generated/types/data-models/index.js +6 -0
  83. package/dist/generated/types/data-models/test.d.ts +29 -0
  84. package/dist/generated/types/data-models/test.d.ts.map +1 -0
  85. package/dist/generated/types/data-models/test.js +1 -0
  86. package/dist/generated/types/data-models/watch.d.ts +26 -0
  87. package/dist/generated/types/data-models/watch.d.ts.map +1 -0
  88. package/dist/generated/types/data-models/watch.js +1 -0
  89. package/dist/generated/types/field-types.d.ts +255 -0
  90. package/dist/generated/types/field-types.d.ts.map +1 -0
  91. package/dist/generated/types/field-types.js +35 -0
  92. package/dist/generated/types/hooks.d.ts +106 -0
  93. package/dist/generated/types/hooks.d.ts.map +1 -0
  94. package/dist/generated/types/hooks.js +9 -0
  95. package/dist/generated/types/index.d.ts +10 -0
  96. package/dist/generated/types/index.d.ts.map +1 -0
  97. package/dist/generated/types/index.js +9 -0
  98. package/dist/generated/types/models/button-variant.d.ts +16 -0
  99. package/dist/generated/types/models/button-variant.d.ts.map +1 -0
  100. package/dist/generated/types/models/button-variant.js +1 -0
  101. package/dist/generated/types/models/color-palette.d.ts +27 -0
  102. package/dist/generated/types/models/color-palette.d.ts.map +1 -0
  103. package/dist/generated/types/models/color-palette.js +1 -0
  104. package/dist/generated/types/models/color-with-scale.d.ts +15 -0
  105. package/dist/generated/types/models/color-with-scale.d.ts.map +1 -0
  106. package/dist/generated/types/models/color-with-scale.js +1 -0
  107. package/dist/generated/types/models/context.d.ts +53 -0
  108. package/dist/generated/types/models/context.d.ts.map +1 -0
  109. package/dist/generated/types/models/context.js +51 -0
  110. package/dist/generated/types/models/customer-detail.d.ts +32 -0
  111. package/dist/generated/types/models/customer-detail.d.ts.map +1 -0
  112. package/dist/generated/types/models/customer-detail.js +26 -0
  113. package/dist/generated/types/models/design-system-badges.d.ts +16 -0
  114. package/dist/generated/types/models/design-system-badges.d.ts.map +1 -0
  115. package/dist/generated/types/models/design-system-badges.js +1 -0
  116. package/dist/generated/types/models/design-system-buttons.d.ts +17 -0
  117. package/dist/generated/types/models/design-system-buttons.d.ts.map +1 -0
  118. package/dist/generated/types/models/design-system-buttons.js +1 -0
  119. package/dist/generated/types/models/design-system-cards.d.ts +16 -0
  120. package/dist/generated/types/models/design-system-cards.d.ts.map +1 -0
  121. package/dist/generated/types/models/design-system-cards.js +1 -0
  122. package/dist/generated/types/models/design-system-colors.d.ts +12 -0
  123. package/dist/generated/types/models/design-system-colors.d.ts.map +1 -0
  124. package/dist/generated/types/models/design-system-colors.js +1 -0
  125. package/dist/generated/types/models/design-system-dark-mode.d.ts +13 -0
  126. package/dist/generated/types/models/design-system-dark-mode.d.ts.map +1 -0
  127. package/dist/generated/types/models/design-system-dark-mode.js +1 -0
  128. package/dist/generated/types/models/design-system-focus-ring.d.ts +14 -0
  129. package/dist/generated/types/models/design-system-focus-ring.d.ts.map +1 -0
  130. package/dist/generated/types/models/design-system-focus-ring.js +1 -0
  131. package/dist/generated/types/models/design-system-grid.d.ts +18 -0
  132. package/dist/generated/types/models/design-system-grid.d.ts.map +1 -0
  133. package/dist/generated/types/models/design-system-grid.js +1 -0
  134. package/dist/generated/types/models/design-system-inputs.d.ts +26 -0
  135. package/dist/generated/types/models/design-system-inputs.d.ts.map +1 -0
  136. package/dist/generated/types/models/design-system-inputs.js +1 -0
  137. package/dist/generated/types/models/design-system-links.d.ts +16 -0
  138. package/dist/generated/types/models/design-system-links.d.ts.map +1 -0
  139. package/dist/generated/types/models/design-system-links.js +1 -0
  140. package/dist/generated/types/models/design-system-shadows.d.ts +20 -0
  141. package/dist/generated/types/models/design-system-shadows.d.ts.map +1 -0
  142. package/dist/generated/types/models/design-system-shadows.js +1 -0
  143. package/dist/generated/types/models/design-system-spacing.d.ts +13 -0
  144. package/dist/generated/types/models/design-system-spacing.d.ts.map +1 -0
  145. package/dist/generated/types/models/design-system-spacing.js +1 -0
  146. package/dist/generated/types/models/design-system-transitions.d.ts +15 -0
  147. package/dist/generated/types/models/design-system-transitions.d.ts.map +1 -0
  148. package/dist/generated/types/models/design-system-transitions.js +1 -0
  149. package/dist/generated/types/models/design-system-typography.d.ts +21 -0
  150. package/dist/generated/types/models/design-system-typography.d.ts.map +1 -0
  151. package/dist/generated/types/models/design-system-typography.js +1 -0
  152. package/dist/generated/types/models/design-system.d.ts +138 -0
  153. package/dist/generated/types/models/design-system.d.ts.map +1 -0
  154. package/dist/generated/types/models/design-system.js +64 -0
  155. package/dist/generated/types/models/experiment.d.ts +57 -0
  156. package/dist/generated/types/models/experiment.d.ts.map +1 -0
  157. package/dist/generated/types/models/experiment.js +55 -0
  158. package/dist/generated/types/models/font-file.d.ts +16 -0
  159. package/dist/generated/types/models/font-file.d.ts.map +1 -0
  160. package/dist/generated/types/models/font-file.js +1 -0
  161. package/dist/generated/types/models/index.d.ts +38 -0
  162. package/dist/generated/types/models/index.d.ts.map +1 -0
  163. package/dist/generated/types/models/index.js +12 -0
  164. package/dist/generated/types/models/integration.d.ts +32 -0
  165. package/dist/generated/types/models/integration.d.ts.map +1 -0
  166. package/dist/generated/types/models/integration.js +26 -0
  167. package/dist/generated/types/models/route-tree.d.ts +43 -0
  168. package/dist/generated/types/models/route-tree.d.ts.map +1 -0
  169. package/dist/generated/types/models/route-tree.js +39 -0
  170. package/dist/generated/types/models/segment.d.ts +57 -0
  171. package/dist/generated/types/models/segment.d.ts.map +1 -0
  172. package/dist/generated/types/models/segment.js +55 -0
  173. package/dist/generated/types/models/shopify-collection.d.ts +32 -0
  174. package/dist/generated/types/models/shopify-collection.d.ts.map +1 -0
  175. package/dist/generated/types/models/shopify-collection.js +26 -0
  176. package/dist/generated/types/models/shopify-market.d.ts +32 -0
  177. package/dist/generated/types/models/shopify-market.d.ts.map +1 -0
  178. package/dist/generated/types/models/shopify-market.js +26 -0
  179. package/dist/generated/types/models/shopify-product.d.ts +32 -0
  180. package/dist/generated/types/models/shopify-product.d.ts.map +1 -0
  181. package/dist/generated/types/models/shopify-product.js +26 -0
  182. package/dist/generated/types/models/shopify-variant.d.ts +32 -0
  183. package/dist/generated/types/models/shopify-variant.d.ts.map +1 -0
  184. package/dist/generated/types/models/shopify-variant.js +26 -0
  185. package/dist/generated/types/models/template.d.ts +53 -0
  186. package/dist/generated/types/models/template.d.ts.map +1 -0
  187. package/dist/generated/types/models/template.js +40 -0
  188. package/dist/generated/types/models/typography-variant.d.ts +15 -0
  189. package/dist/generated/types/models/typography-variant.d.ts.map +1 -0
  190. package/dist/generated/types/models/typography-variant.js +1 -0
  191. package/dist/generated/types/scalars.d.ts +56 -0
  192. package/dist/generated/types/scalars.d.ts.map +1 -0
  193. package/dist/generated/types/scalars.js +6 -0
  194. package/dist/generators/admin/index.d.ts +32 -0
  195. package/dist/generators/admin/index.d.ts.map +1 -0
  196. package/dist/generators/admin/index.js +219 -0
  197. package/dist/generators/admin/mutations.d.ts +23 -0
  198. package/dist/generators/admin/mutations.d.ts.map +1 -0
  199. package/dist/generators/admin/mutations.js +424 -0
  200. package/dist/generators/admin/queries.d.ts +20 -0
  201. package/dist/generators/admin/queries.d.ts.map +1 -0
  202. package/dist/generators/admin/queries.js +476 -0
  203. package/dist/generators/admin/types.d.ts +28 -0
  204. package/dist/generators/admin/types.d.ts.map +1 -0
  205. package/dist/generators/admin/types.js +254 -0
  206. package/dist/generators/cms/index.d.ts +29 -0
  207. package/dist/generators/cms/index.d.ts.map +1 -0
  208. package/dist/generators/cms/index.js +126 -0
  209. package/dist/generators/cms/route.d.ts +27 -0
  210. package/dist/generators/cms/route.d.ts.map +1 -0
  211. package/dist/generators/cms/route.js +409 -0
  212. package/dist/generators/cms/types.d.ts +15 -0
  213. package/dist/generators/cms/types.d.ts.map +1 -0
  214. package/dist/generators/cms/types.js +137 -0
  215. package/dist/generators/contexts/index.d.ts +25 -0
  216. package/dist/generators/contexts/index.d.ts.map +1 -0
  217. package/dist/generators/contexts/index.js +591 -0
  218. package/dist/generators/documents/data-models.d.ts +6 -0
  219. package/dist/generators/documents/data-models.d.ts.map +1 -0
  220. package/dist/generators/documents/data-models.js +61 -0
  221. package/dist/generators/documents/entity-models.d.ts +7 -0
  222. package/dist/generators/documents/entity-models.d.ts.map +1 -0
  223. package/dist/generators/documents/entity-models.js +87 -0
  224. package/dist/generators/documents/workflows.d.ts +11 -0
  225. package/dist/generators/documents/workflows.d.ts.map +1 -0
  226. package/dist/generators/documents/workflows.js +101 -0
  227. package/dist/generators/filters/index.d.ts +16 -0
  228. package/dist/generators/filters/index.d.ts.map +1 -0
  229. package/dist/generators/filters/index.js +384 -0
  230. package/dist/generators/hooks/agnostic.d.ts +16 -0
  231. package/dist/generators/hooks/agnostic.d.ts.map +1 -0
  232. package/dist/generators/hooks/agnostic.js +248 -0
  233. package/dist/generators/hooks/index.d.ts +9 -0
  234. package/dist/generators/hooks/index.d.ts.map +1 -0
  235. package/dist/generators/hooks/index.js +8 -0
  236. package/dist/generators/hooks/react.d.ts +16 -0
  237. package/dist/generators/hooks/react.d.ts.map +1 -0
  238. package/dist/generators/hooks/react.js +394 -0
  239. package/dist/generators/hooks/remix.d.ts +16 -0
  240. package/dist/generators/hooks/remix.d.ts.map +1 -0
  241. package/dist/generators/hooks/remix.js +349 -0
  242. package/dist/generators/hooks/workflows.d.ts +23 -0
  243. package/dist/generators/hooks/workflows.d.ts.map +1 -0
  244. package/dist/generators/hooks/workflows.js +312 -0
  245. package/dist/generators/resolve/index.d.ts +13 -0
  246. package/dist/generators/resolve/index.d.ts.map +1 -0
  247. package/dist/generators/resolve/index.js +13 -0
  248. package/dist/generators/resolve/platform.d.ts +29 -0
  249. package/dist/generators/resolve/platform.d.ts.map +1 -0
  250. package/dist/generators/resolve/platform.js +479 -0
  251. package/dist/generators/types/config.d.ts +7 -0
  252. package/dist/generators/types/config.d.ts.map +1 -0
  253. package/dist/generators/types/config.js +113 -0
  254. package/dist/generators/types/data-models.d.ts +10 -0
  255. package/dist/generators/types/data-models.d.ts.map +1 -0
  256. package/dist/generators/types/data-models.js +100 -0
  257. package/dist/generators/types/entity-models.d.ts +13 -0
  258. package/dist/generators/types/entity-models.d.ts.map +1 -0
  259. package/dist/generators/types/entity-models.js +241 -0
  260. package/dist/generators/types/field-types.d.ts +9 -0
  261. package/dist/generators/types/field-types.d.ts.map +1 -0
  262. package/dist/generators/types/field-types.js +651 -0
  263. package/dist/generators/types/hooks.d.ts +7 -0
  264. package/dist/generators/types/hooks.d.ts.map +1 -0
  265. package/dist/generators/types/hooks.js +132 -0
  266. package/dist/generators/types/scalars.d.ts +6 -0
  267. package/dist/generators/types/scalars.d.ts.map +1 -0
  268. package/dist/generators/types/scalars.js +68 -0
  269. package/dist/generators/types/user-details.d.ts +6 -0
  270. package/dist/generators/types/user-details.d.ts.map +1 -0
  271. package/dist/generators/types/user-details.js +60 -0
  272. package/dist/generators/types/workflows.d.ts +15 -0
  273. package/dist/generators/types/workflows.d.ts.map +1 -0
  274. package/dist/generators/types/workflows.js +163 -0
  275. package/dist/graphql/generated/gql.d.ts +47 -0
  276. package/dist/graphql/generated/gql.d.ts.map +1 -0
  277. package/dist/graphql/generated/gql.js +10 -0
  278. package/dist/graphql/generated/graphql.d.ts +8455 -0
  279. package/dist/graphql/generated/graphql.d.ts.map +1 -0
  280. package/dist/graphql/generated/graphql.js +573 -0
  281. package/dist/graphql/generated/index.d.ts +2 -0
  282. package/dist/graphql/generated/index.d.ts.map +1 -0
  283. package/dist/graphql/generated/index.js +1 -0
  284. package/dist/index.d.ts +13 -0
  285. package/dist/index.d.ts.map +1 -0
  286. package/dist/index.js +9 -0
  287. package/dist/schema/define-entity-model.d.ts +122 -0
  288. package/dist/schema/define-entity-model.d.ts.map +1 -0
  289. package/dist/schema/define-entity-model.js +59 -0
  290. package/dist/schema/schema-loader.d.ts +10 -0
  291. package/dist/schema/schema-loader.d.ts.map +1 -0
  292. package/dist/schema/schema-loader.js +91 -0
  293. package/dist/utils/field-mapping.d.ts +83 -0
  294. package/dist/utils/field-mapping.d.ts.map +1 -0
  295. package/dist/utils/field-mapping.js +334 -0
  296. package/dist/writer/write-files.d.ts +12 -0
  297. package/dist/writer/write-files.d.ts.map +1 -0
  298. package/dist/writer/write-files.js +35 -0
  299. package/package.json +70 -0
@@ -0,0 +1,312 @@
1
+ /**
2
+ * Workflow Hooks Generator
3
+ *
4
+ * Generates typed React hooks for workflow execution using Apollo Client.
5
+ */
6
+ /**
7
+ * Convert string to PascalCase
8
+ */
9
+ function toPascalCase(str) {
10
+ return str
11
+ .split(/[-_]/)
12
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
13
+ .join('');
14
+ }
15
+ /**
16
+ * Convert string to camelCase
17
+ */
18
+ function toCamelCase(str) {
19
+ const pascal = toPascalCase(str);
20
+ return pascal.charAt(0).toLowerCase() + pascal.slice(1);
21
+ }
22
+ /**
23
+ * Generate React hooks for a single workflow
24
+ */
25
+ export function generateWorkflowReactHooks(workflow) {
26
+ const typeName = toPascalCase(workflow.key);
27
+ const camelName = toCamelCase(workflow.key);
28
+ const lines = [];
29
+ // File header
30
+ lines.push('/**');
31
+ lines.push(` * ${workflow.name} - React Hooks`);
32
+ if (workflow.description) {
33
+ lines.push(` * ${workflow.description}`);
34
+ }
35
+ lines.push(' *');
36
+ lines.push(' * @generated by UniformGen - DO NOT EDIT MANUALLY');
37
+ lines.push(' */');
38
+ lines.push('');
39
+ // Imports
40
+ lines.push("import { useMutation, useQuery, type MutationHookOptions, type QueryHookOptions } from '@apollo/client';");
41
+ lines.push("import {");
42
+ lines.push(" PublicExecuteWorkflowDocument,");
43
+ lines.push(" PublicWorkflowExecutionDocument,");
44
+ lines.push("} from '../documents/workflows.js';");
45
+ lines.push(`import type { ${typeName}Input, ${typeName}Output } from '../types/workflows/${workflow.key}.js';`);
46
+ lines.push('');
47
+ // Execution result type
48
+ lines.push('/** Execution result type */');
49
+ lines.push(`export interface ${typeName}ExecutionResult {`);
50
+ lines.push(' success: boolean;');
51
+ lines.push(' executionId?: string;');
52
+ lines.push(' queued?: boolean;');
53
+ lines.push(` result?: ${typeName}Output;`);
54
+ lines.push(' error?: { code: string; message: string };');
55
+ lines.push('}');
56
+ lines.push('');
57
+ // Execution status type
58
+ lines.push('/** Execution status type */');
59
+ lines.push(`export interface ${typeName}ExecutionStatus {`);
60
+ lines.push(' id: string;');
61
+ lines.push(' workflowKey: string;');
62
+ lines.push(" status: 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED' | 'CANCELLED';");
63
+ lines.push(` result?: ${typeName}Output;`);
64
+ lines.push(' error?: { code: string; message: string };');
65
+ lines.push(' createdAt: string;');
66
+ lines.push(' completedAt?: string;');
67
+ lines.push('}');
68
+ lines.push('');
69
+ // useExecute hook
70
+ lines.push('/**');
71
+ lines.push(` * Execute the ${workflow.name} workflow`);
72
+ lines.push(' *');
73
+ lines.push(' * @example');
74
+ lines.push(` * const [execute, { loading, error }] = use${typeName}();`);
75
+ lines.push(' * ');
76
+ lines.push(' * const handleExecute = async () => {');
77
+ lines.push(` * const result = await execute({ /* input */ });`);
78
+ lines.push(' * if (result.queued) {');
79
+ lines.push(' * // Track execution via executionId');
80
+ lines.push(' * } else {');
81
+ lines.push(' * // Use result.result directly');
82
+ lines.push(' * }');
83
+ lines.push(' * };');
84
+ lines.push(' */');
85
+ lines.push(`export function use${typeName}(options?: MutationHookOptions) {`);
86
+ lines.push(' const [mutate, result] = useMutation(PublicExecuteWorkflowDocument, options);');
87
+ lines.push('');
88
+ lines.push(` const ${camelName} = async (input: ${typeName}Input): Promise<${typeName}ExecutionResult> => {`);
89
+ lines.push(' const response = await mutate({');
90
+ lines.push(' variables: {');
91
+ lines.push(' input: {');
92
+ lines.push(` workflowKey: '${workflow.key}',`);
93
+ lines.push(' input,');
94
+ lines.push(' },');
95
+ lines.push(' },');
96
+ lines.push(' });');
97
+ lines.push('');
98
+ lines.push(' const data = response.data?.publicExecuteWorkflow;');
99
+ lines.push(' return {');
100
+ lines.push(' success: data?.success ?? false,');
101
+ lines.push(' executionId: data?.executionId ?? undefined,');
102
+ lines.push(' queued: data?.queued ?? undefined,');
103
+ lines.push(` result: data?.result as ${typeName}Output | undefined,`);
104
+ lines.push(' error: data?.error ?? undefined,');
105
+ lines.push(' };');
106
+ lines.push(' };');
107
+ lines.push('');
108
+ lines.push(` return [${camelName}, result] as const;`);
109
+ lines.push('}');
110
+ lines.push('');
111
+ // useExecution hook
112
+ lines.push('/**');
113
+ lines.push(` * Get ${workflow.name} execution status`);
114
+ lines.push(' *');
115
+ lines.push(' * Use this to poll for async workflow completion.');
116
+ lines.push(' *');
117
+ lines.push(' * @example');
118
+ lines.push(` * const { execution, loading } = use${typeName}Execution(executionId, {`);
119
+ lines.push(' * pollInterval: 1000, // Poll every second');
120
+ lines.push(' * skip: !executionId,');
121
+ lines.push(' * });');
122
+ lines.push(' * ');
123
+ lines.push(" * if (execution?.status === 'COMPLETED') {");
124
+ lines.push(' * // Use execution.result');
125
+ lines.push(' * }');
126
+ lines.push(' */');
127
+ lines.push(`export function use${typeName}Execution(`);
128
+ lines.push(' executionId: string | undefined,');
129
+ lines.push(' options?: Omit<QueryHookOptions, "variables">');
130
+ lines.push(') {');
131
+ lines.push(' const result = useQuery(PublicWorkflowExecutionDocument, {');
132
+ lines.push(' ...options,');
133
+ lines.push(' variables: { id: executionId! },');
134
+ lines.push(' skip: !executionId || options?.skip,');
135
+ lines.push(' });');
136
+ lines.push('');
137
+ lines.push(` const execution: ${typeName}ExecutionStatus | undefined = result.data?.publicWorkflowExecution`);
138
+ lines.push(' ? {');
139
+ lines.push(' ...result.data.publicWorkflowExecution,');
140
+ lines.push(` result: result.data.publicWorkflowExecution.result as ${typeName}Output | undefined,`);
141
+ lines.push(' }');
142
+ lines.push(' : undefined;');
143
+ lines.push('');
144
+ lines.push(' return {');
145
+ lines.push(' ...result,');
146
+ lines.push(' execution,');
147
+ lines.push(' };');
148
+ lines.push('}');
149
+ return lines.join('\n') + '\n';
150
+ }
151
+ /**
152
+ * Generate Remix server functions for a single workflow
153
+ */
154
+ export function generateWorkflowRemixHooks(workflow) {
155
+ // For Remix, we generate server-side functions that can be used in loaders/actions
156
+ // The generated code is similar but uses graphql-request instead of Apollo
157
+ const typeName = toPascalCase(workflow.key);
158
+ const camelName = toCamelCase(workflow.key);
159
+ const lines = [];
160
+ // File header
161
+ lines.push('/**');
162
+ lines.push(` * ${workflow.name} - Remix Server Functions`);
163
+ if (workflow.description) {
164
+ lines.push(` * ${workflow.description}`);
165
+ }
166
+ lines.push(' *');
167
+ lines.push(' * @generated by UniformGen - DO NOT EDIT MANUALLY');
168
+ lines.push(' */');
169
+ lines.push('');
170
+ // Imports
171
+ lines.push("import type { GraphQLClient } from 'graphql-request';");
172
+ lines.push("import {");
173
+ lines.push(" PublicExecuteWorkflowDocument,");
174
+ lines.push(" PublicWorkflowExecutionDocument,");
175
+ lines.push("} from '../documents/workflows.js';");
176
+ lines.push(`import type { ${typeName}Input, ${typeName}Output } from '../types/workflows/${workflow.key}.js';`);
177
+ lines.push('');
178
+ // Execution result type
179
+ lines.push('/** Execution result type */');
180
+ lines.push(`export interface ${typeName}ExecutionResult {`);
181
+ lines.push(' success: boolean;');
182
+ lines.push(' executionId?: string;');
183
+ lines.push(' queued?: boolean;');
184
+ lines.push(` result?: ${typeName}Output;`);
185
+ lines.push(' error?: { code: string; message: string };');
186
+ lines.push('}');
187
+ lines.push('');
188
+ // Execution status type
189
+ lines.push('/** Execution status type */');
190
+ lines.push(`export interface ${typeName}ExecutionStatus {`);
191
+ lines.push(' id: string;');
192
+ lines.push(' workflowKey: string;');
193
+ lines.push(" status: 'PENDING' | 'RUNNING' | 'COMPLETED' | 'FAILED' | 'CANCELLED';");
194
+ lines.push(` result?: ${typeName}Output;`);
195
+ lines.push(' error?: { code: string; message: string };');
196
+ lines.push(' createdAt: string;');
197
+ lines.push(' completedAt?: string;');
198
+ lines.push('}');
199
+ lines.push('');
200
+ // Execute function
201
+ lines.push('/**');
202
+ lines.push(` * Execute the ${workflow.name} workflow`);
203
+ lines.push(' *');
204
+ lines.push(' * @example');
205
+ lines.push(' * // In a Remix action');
206
+ lines.push(' * export async function action({ request }) {');
207
+ lines.push(' * const client = new GraphQLClient(API_URL, {');
208
+ lines.push(" * headers: { 'x-api-key': API_KEY }");
209
+ lines.push(' * });');
210
+ lines.push(' *');
211
+ lines.push(' * const formData = await request.formData();');
212
+ lines.push(` * const result = await ${camelName}({ /* input */ }, client);`);
213
+ lines.push(' * return json(result);');
214
+ lines.push(' * }');
215
+ lines.push(' */');
216
+ lines.push(`export async function ${camelName}(`);
217
+ lines.push(` input: ${typeName}Input,`);
218
+ lines.push(' client: GraphQLClient');
219
+ lines.push(`): Promise<${typeName}ExecutionResult> {`);
220
+ lines.push(' const response = await client.request(PublicExecuteWorkflowDocument, {');
221
+ lines.push(' input: {');
222
+ lines.push(` workflowKey: '${workflow.key}',`);
223
+ lines.push(' input,');
224
+ lines.push(' },');
225
+ lines.push(' });');
226
+ lines.push('');
227
+ lines.push(' const data = (response as any).publicExecuteWorkflow;');
228
+ lines.push(' return {');
229
+ lines.push(' success: data?.success ?? false,');
230
+ lines.push(' executionId: data?.executionId ?? undefined,');
231
+ lines.push(' queued: data?.queued ?? undefined,');
232
+ lines.push(` result: data?.result as ${typeName}Output | undefined,`);
233
+ lines.push(' error: data?.error ?? undefined,');
234
+ lines.push(' };');
235
+ lines.push('}');
236
+ lines.push('');
237
+ // Get execution function
238
+ lines.push('/**');
239
+ lines.push(` * Get ${workflow.name} execution status`);
240
+ lines.push(' *');
241
+ lines.push(' * @example');
242
+ lines.push(' * // In a Remix loader');
243
+ lines.push(' * export async function loader({ params }) {');
244
+ lines.push(' * const client = new GraphQLClient(API_URL, {');
245
+ lines.push(" * headers: { 'x-api-key': API_KEY }");
246
+ lines.push(' * });');
247
+ lines.push(' *');
248
+ lines.push(` * const status = await get${typeName}Execution(params.executionId, client);`);
249
+ lines.push(' * return json(status);');
250
+ lines.push(' * }');
251
+ lines.push(' */');
252
+ lines.push(`export async function get${typeName}Execution(`);
253
+ lines.push(' executionId: string,');
254
+ lines.push(' client: GraphQLClient');
255
+ lines.push(`): Promise<${typeName}ExecutionStatus | null> {`);
256
+ lines.push(' const response = await client.request(PublicWorkflowExecutionDocument, {');
257
+ lines.push(' id: executionId,');
258
+ lines.push(' });');
259
+ lines.push('');
260
+ lines.push(' const data = (response as any).publicWorkflowExecution;');
261
+ lines.push(' if (!data) return null;');
262
+ lines.push('');
263
+ lines.push(' return {');
264
+ lines.push(' ...data,');
265
+ lines.push(` result: data.result as ${typeName}Output | undefined,`);
266
+ lines.push(' };');
267
+ lines.push('}');
268
+ return lines.join('\n') + '\n';
269
+ }
270
+ /**
271
+ * Generate index file for workflow React hooks
272
+ */
273
+ export function generateWorkflowReactHooksIndex(workflows) {
274
+ const lines = [];
275
+ lines.push('/**');
276
+ lines.push(' * Workflow React Hooks');
277
+ lines.push(' * @generated by UniformGen - DO NOT EDIT MANUALLY');
278
+ lines.push(' */');
279
+ lines.push('');
280
+ for (const workflow of workflows) {
281
+ const typeName = toPascalCase(workflow.key);
282
+ lines.push(`export {`);
283
+ lines.push(` use${typeName},`);
284
+ lines.push(` use${typeName}Execution,`);
285
+ lines.push(` type ${typeName}ExecutionResult,`);
286
+ lines.push(` type ${typeName}ExecutionStatus,`);
287
+ lines.push(`} from './${workflow.key}.js';`);
288
+ }
289
+ return lines.join('\n') + '\n';
290
+ }
291
+ /**
292
+ * Generate index file for workflow Remix functions
293
+ */
294
+ export function generateWorkflowRemixHooksIndex(workflows) {
295
+ const lines = [];
296
+ lines.push('/**');
297
+ lines.push(' * Workflow Remix Server Functions');
298
+ lines.push(' * @generated by UniformGen - DO NOT EDIT MANUALLY');
299
+ lines.push(' */');
300
+ lines.push('');
301
+ for (const workflow of workflows) {
302
+ const typeName = toPascalCase(workflow.key);
303
+ const camelName = toCamelCase(workflow.key);
304
+ lines.push(`export {`);
305
+ lines.push(` ${camelName},`);
306
+ lines.push(` get${typeName}Execution,`);
307
+ lines.push(` type ${typeName}ExecutionResult,`);
308
+ lines.push(` type ${typeName}ExecutionStatus,`);
309
+ lines.push(`} from './${workflow.key}.js';`);
310
+ }
311
+ return lines.join('\n') + '\n';
312
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Resolve Query Generators
3
+ *
4
+ * Generates typed hooks/functions for frontend entity resolution.
5
+ *
6
+ * Phase 13 structure:
7
+ * - Platform resolution: useResolve{Model} - Returns content WITHOUT CMS features
8
+ * - CMS resolution: useResolveRoute - Returns full template/zone/layout data (see cms/route.ts)
9
+ *
10
+ * @generated by UniformGen
11
+ */
12
+ export { generatePlatformResolveReact, generatePlatformResolveRemix, generatePlatformResolveIndexReact, generatePlatformResolveIndexRemix, } from './platform.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/generators/resolve/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EACL,4BAA4B,EAC5B,4BAA4B,EAC5B,iCAAiC,EACjC,iCAAiC,GAClC,MAAM,eAAe,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Resolve Query Generators
3
+ *
4
+ * Generates typed hooks/functions for frontend entity resolution.
5
+ *
6
+ * Phase 13 structure:
7
+ * - Platform resolution: useResolve{Model} - Returns content WITHOUT CMS features
8
+ * - CMS resolution: useResolveRoute - Returns full template/zone/layout data (see cms/route.ts)
9
+ *
10
+ * @generated by UniformGen
11
+ */
12
+ // Export platform generators
13
+ export { generatePlatformResolveReact, generatePlatformResolveRemix, generatePlatformResolveIndexReact, generatePlatformResolveIndexRemix, } from './platform.js';
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Platform Resolution Generator
3
+ *
4
+ * Generates typed hooks/functions for platform-level entity resolution:
5
+ * - useResolve{Model} - Resolve by natural key with variant selection
6
+ * - Returns resolved content WITHOUT CMS features (no templates/zones/layouts)
7
+ *
8
+ * Use CMS generators (cms/route.ts) for template/zone resolution.
9
+ *
10
+ * @generated by UniformGen
11
+ */
12
+ import type { EntityModel } from '../../fetcher/fetch-schemas.js';
13
+ /**
14
+ * Generate React platform resolve hook for a model
15
+ */
16
+ export declare function generatePlatformResolveReact(model: EntityModel, _allModels: EntityModel[]): string;
17
+ /**
18
+ * Generate Remix/Hydrogen platform resolve function for a model
19
+ */
20
+ export declare function generatePlatformResolveRemix(model: EntityModel, _allModels: EntityModel[]): string;
21
+ /**
22
+ * Generate index file for platform resolve hooks (React)
23
+ */
24
+ export declare function generatePlatformResolveIndexReact(models: EntityModel[]): string;
25
+ /**
26
+ * Generate index file for platform resolve functions (Remix)
27
+ */
28
+ export declare function generatePlatformResolveIndexRemix(models: EntityModel[]): string;
29
+ //# sourceMappingURL=platform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../../src/generators/resolve/platform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAuB,MAAM,gCAAgC,CAAC;AA6FvF;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,WAAW,EAClB,UAAU,EAAE,WAAW,EAAE,GACxB,MAAM,CAyMR;AAED;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,WAAW,EAClB,UAAU,EAAE,WAAW,EAAE,GACxB,MAAM,CAwIR;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAoC/E;AAED;;GAEG;AACH,wBAAgB,iCAAiC,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,MAAM,CAyC/E"}