@eide/foir-cli 0.1.35 → 0.1.36

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 (227) hide show
  1. package/dist/cli.js +7467 -42
  2. package/dist/config/types.d.ts +7 -6
  3. package/dist/config/types.js +6 -14
  4. package/dist/generated-CPsQ9jfu.d.ts +195 -0
  5. package/dist/lib/extension-helpers.d.ts +10 -7
  6. package/dist/lib/extension-helpers.js +15 -85
  7. package/dist/lib/hook-helpers.d.ts +9 -6
  8. package/dist/lib/hook-helpers.js +12 -105
  9. package/dist/lib/seed-helpers.d.ts +10 -8
  10. package/dist/lib/seed-helpers.js +18 -124
  11. package/package.json +9 -8
  12. package/dist/auth/credentials.d.ts +0 -31
  13. package/dist/auth/credentials.d.ts.map +0 -1
  14. package/dist/auth/credentials.js +0 -139
  15. package/dist/cli.d.ts +0 -3
  16. package/dist/cli.d.ts.map +0 -1
  17. package/dist/codegen/fetch-customer-profile-schema.d.ts +0 -12
  18. package/dist/codegen/fetch-customer-profile-schema.d.ts.map +0 -1
  19. package/dist/codegen/fetch-customer-profile-schema.js +0 -21
  20. package/dist/codegen/fetch-models.d.ts +0 -58
  21. package/dist/codegen/fetch-models.d.ts.map +0 -1
  22. package/dist/codegen/fetch-models.js +0 -96
  23. package/dist/codegen/field-mapping.d.ts +0 -34
  24. package/dist/codegen/field-mapping.d.ts.map +0 -1
  25. package/dist/codegen/field-mapping.js +0 -250
  26. package/dist/codegen/generators/config.d.ts +0 -5
  27. package/dist/codegen/generators/config.d.ts.map +0 -1
  28. package/dist/codegen/generators/config.js +0 -82
  29. package/dist/codegen/generators/customer-profile-documents.d.ts +0 -5
  30. package/dist/codegen/generators/customer-profile-documents.d.ts.map +0 -1
  31. package/dist/codegen/generators/customer-profile-documents.js +0 -42
  32. package/dist/codegen/generators/customer-profile-hooks.d.ts +0 -5
  33. package/dist/codegen/generators/customer-profile-hooks.d.ts.map +0 -1
  34. package/dist/codegen/generators/customer-profile-hooks.js +0 -78
  35. package/dist/codegen/generators/customer-profile-loaders.d.ts +0 -5
  36. package/dist/codegen/generators/customer-profile-loaders.d.ts.map +0 -1
  37. package/dist/codegen/generators/customer-profile-loaders.js +0 -67
  38. package/dist/codegen/generators/customer-profile-operations.d.ts +0 -5
  39. package/dist/codegen/generators/customer-profile-operations.d.ts.map +0 -1
  40. package/dist/codegen/generators/customer-profile-operations.js +0 -126
  41. package/dist/codegen/generators/customer-profile-types.d.ts +0 -6
  42. package/dist/codegen/generators/customer-profile-types.d.ts.map +0 -1
  43. package/dist/codegen/generators/customer-profile-types.js +0 -45
  44. package/dist/codegen/generators/documents.d.ts +0 -12
  45. package/dist/codegen/generators/documents.d.ts.map +0 -1
  46. package/dist/codegen/generators/documents.js +0 -178
  47. package/dist/codegen/generators/field-types.d.ts +0 -5
  48. package/dist/codegen/generators/field-types.d.ts.map +0 -1
  49. package/dist/codegen/generators/field-types.js +0 -346
  50. package/dist/codegen/generators/model-index.d.ts +0 -6
  51. package/dist/codegen/generators/model-index.d.ts.map +0 -1
  52. package/dist/codegen/generators/model-index.js +0 -26
  53. package/dist/codegen/generators/model-types.d.ts +0 -12
  54. package/dist/codegen/generators/model-types.d.ts.map +0 -1
  55. package/dist/codegen/generators/model-types.js +0 -177
  56. package/dist/codegen/generators/public-schema-content.d.ts +0 -14
  57. package/dist/codegen/generators/public-schema-content.d.ts.map +0 -1
  58. package/dist/codegen/generators/public-schema-content.js +0 -22
  59. package/dist/codegen/generators/react-hooks-index.d.ts +0 -6
  60. package/dist/codegen/generators/react-hooks-index.d.ts.map +0 -1
  61. package/dist/codegen/generators/react-hooks-index.js +0 -20
  62. package/dist/codegen/generators/react-hooks.d.ts +0 -7
  63. package/dist/codegen/generators/react-hooks.d.ts.map +0 -1
  64. package/dist/codegen/generators/react-hooks.js +0 -139
  65. package/dist/codegen/generators/remix-loaders-index.d.ts +0 -6
  66. package/dist/codegen/generators/remix-loaders-index.d.ts.map +0 -1
  67. package/dist/codegen/generators/remix-loaders-index.js +0 -20
  68. package/dist/codegen/generators/remix-loaders.d.ts +0 -7
  69. package/dist/codegen/generators/remix-loaders.d.ts.map +0 -1
  70. package/dist/codegen/generators/remix-loaders.js +0 -107
  71. package/dist/codegen/generators/static-documents.d.ts +0 -14
  72. package/dist/codegen/generators/static-documents.d.ts.map +0 -1
  73. package/dist/codegen/generators/static-documents.js +0 -771
  74. package/dist/codegen/generators/swift-customer-profile.d.ts +0 -9
  75. package/dist/codegen/generators/swift-customer-profile.d.ts.map +0 -1
  76. package/dist/codegen/generators/swift-customer-profile.js +0 -152
  77. package/dist/codegen/generators/swift-field-types.d.ts +0 -5
  78. package/dist/codegen/generators/swift-field-types.d.ts.map +0 -1
  79. package/dist/codegen/generators/swift-field-types.js +0 -151
  80. package/dist/codegen/generators/swift-model-keys.d.ts +0 -6
  81. package/dist/codegen/generators/swift-model-keys.d.ts.map +0 -1
  82. package/dist/codegen/generators/swift-model-keys.js +0 -25
  83. package/dist/codegen/generators/swift-types.d.ts +0 -13
  84. package/dist/codegen/generators/swift-types.d.ts.map +0 -1
  85. package/dist/codegen/generators/swift-types.js +0 -188
  86. package/dist/codegen/generators/typed-operations-common.d.ts +0 -6
  87. package/dist/codegen/generators/typed-operations-common.d.ts.map +0 -1
  88. package/dist/codegen/generators/typed-operations-common.js +0 -84
  89. package/dist/codegen/generators/typed-operations-index.d.ts +0 -6
  90. package/dist/codegen/generators/typed-operations-index.d.ts.map +0 -1
  91. package/dist/codegen/generators/typed-operations-index.js +0 -22
  92. package/dist/codegen/generators/typed-operations.d.ts +0 -11
  93. package/dist/codegen/generators/typed-operations.d.ts.map +0 -1
  94. package/dist/codegen/generators/typed-operations.js +0 -263
  95. package/dist/codegen/swift-field-mapping.d.ts +0 -30
  96. package/dist/codegen/swift-field-mapping.d.ts.map +0 -1
  97. package/dist/codegen/swift-field-mapping.js +0 -150
  98. package/dist/codegen/write-files.d.ts +0 -15
  99. package/dist/codegen/write-files.d.ts.map +0 -1
  100. package/dist/codegen/write-files.js +0 -36
  101. package/dist/commands/api-keys.d.ts +0 -4
  102. package/dist/commands/api-keys.d.ts.map +0 -1
  103. package/dist/commands/api-keys.js +0 -129
  104. package/dist/commands/auth-config.d.ts +0 -4
  105. package/dist/commands/auth-config.d.ts.map +0 -1
  106. package/dist/commands/auth-config.js +0 -38
  107. package/dist/commands/auth-providers.d.ts +0 -4
  108. package/dist/commands/auth-providers.d.ts.map +0 -1
  109. package/dist/commands/auth-providers.js +0 -207
  110. package/dist/commands/context.d.ts +0 -4
  111. package/dist/commands/context.d.ts.map +0 -1
  112. package/dist/commands/context.js +0 -91
  113. package/dist/commands/create-extension.d.ts +0 -4
  114. package/dist/commands/create-extension.d.ts.map +0 -1
  115. package/dist/commands/create-extension.js +0 -60
  116. package/dist/commands/customer-profiles.d.ts +0 -4
  117. package/dist/commands/customer-profiles.d.ts.map +0 -1
  118. package/dist/commands/customer-profiles.js +0 -99
  119. package/dist/commands/customers.d.ts +0 -4
  120. package/dist/commands/customers.d.ts.map +0 -1
  121. package/dist/commands/customers.js +0 -126
  122. package/dist/commands/embeddings.d.ts +0 -4
  123. package/dist/commands/embeddings.d.ts.map +0 -1
  124. package/dist/commands/embeddings.js +0 -145
  125. package/dist/commands/experiments.d.ts +0 -4
  126. package/dist/commands/experiments.d.ts.map +0 -1
  127. package/dist/commands/experiments.js +0 -196
  128. package/dist/commands/extensions.d.ts +0 -4
  129. package/dist/commands/extensions.d.ts.map +0 -1
  130. package/dist/commands/extensions.js +0 -210
  131. package/dist/commands/files.d.ts +0 -4
  132. package/dist/commands/files.d.ts.map +0 -1
  133. package/dist/commands/files.js +0 -143
  134. package/dist/commands/hooks.d.ts +0 -4
  135. package/dist/commands/hooks.d.ts.map +0 -1
  136. package/dist/commands/hooks.js +0 -228
  137. package/dist/commands/locales.d.ts +0 -4
  138. package/dist/commands/locales.d.ts.map +0 -1
  139. package/dist/commands/locales.js +0 -140
  140. package/dist/commands/login.d.ts +0 -4
  141. package/dist/commands/login.d.ts.map +0 -1
  142. package/dist/commands/login.js +0 -124
  143. package/dist/commands/logout.d.ts +0 -4
  144. package/dist/commands/logout.d.ts.map +0 -1
  145. package/dist/commands/logout.js +0 -16
  146. package/dist/commands/media.d.ts +0 -4
  147. package/dist/commands/media.d.ts.map +0 -1
  148. package/dist/commands/media.js +0 -44
  149. package/dist/commands/models.d.ts +0 -4
  150. package/dist/commands/models.d.ts.map +0 -1
  151. package/dist/commands/models.js +0 -153
  152. package/dist/commands/notes.d.ts +0 -4
  153. package/dist/commands/notes.d.ts.map +0 -1
  154. package/dist/commands/notes.js +0 -132
  155. package/dist/commands/notifications.d.ts +0 -4
  156. package/dist/commands/notifications.d.ts.map +0 -1
  157. package/dist/commands/notifications.js +0 -73
  158. package/dist/commands/operations.d.ts +0 -4
  159. package/dist/commands/operations.d.ts.map +0 -1
  160. package/dist/commands/operations.js +0 -341
  161. package/dist/commands/playground.d.ts +0 -4
  162. package/dist/commands/playground.d.ts.map +0 -1
  163. package/dist/commands/playground.js +0 -270
  164. package/dist/commands/pull.d.ts +0 -4
  165. package/dist/commands/pull.d.ts.map +0 -1
  166. package/dist/commands/pull.js +0 -300
  167. package/dist/commands/records.d.ts +0 -4
  168. package/dist/commands/records.d.ts.map +0 -1
  169. package/dist/commands/records.js +0 -314
  170. package/dist/commands/register-commands.d.ts +0 -7
  171. package/dist/commands/register-commands.d.ts.map +0 -1
  172. package/dist/commands/register-commands.js +0 -259
  173. package/dist/commands/schedules.d.ts +0 -4
  174. package/dist/commands/schedules.d.ts.map +0 -1
  175. package/dist/commands/schedules.js +0 -155
  176. package/dist/commands/search.d.ts +0 -4
  177. package/dist/commands/search.d.ts.map +0 -1
  178. package/dist/commands/search.js +0 -60
  179. package/dist/commands/segments.d.ts +0 -4
  180. package/dist/commands/segments.d.ts.map +0 -1
  181. package/dist/commands/segments.js +0 -155
  182. package/dist/commands/select-project.d.ts +0 -4
  183. package/dist/commands/select-project.d.ts.map +0 -1
  184. package/dist/commands/select-project.js +0 -144
  185. package/dist/commands/settings.d.ts +0 -4
  186. package/dist/commands/settings.d.ts.map +0 -1
  187. package/dist/commands/settings.js +0 -115
  188. package/dist/commands/variant-catalog.d.ts +0 -4
  189. package/dist/commands/variant-catalog.d.ts.map +0 -1
  190. package/dist/commands/variant-catalog.js +0 -118
  191. package/dist/commands/whoami.d.ts +0 -4
  192. package/dist/commands/whoami.d.ts.map +0 -1
  193. package/dist/commands/whoami.js +0 -51
  194. package/dist/config/pull-config.d.ts +0 -33
  195. package/dist/config/pull-config.d.ts.map +0 -1
  196. package/dist/config/pull-config.js +0 -119
  197. package/dist/config/types.d.ts.map +0 -1
  198. package/dist/graphql/generated.d.ts +0 -6074
  199. package/dist/graphql/generated.d.ts.map +0 -1
  200. package/dist/graphql/generated.js +0 -355
  201. package/dist/lib/client.d.ts +0 -18
  202. package/dist/lib/client.d.ts.map +0 -1
  203. package/dist/lib/client.js +0 -64
  204. package/dist/lib/config-loader.d.ts +0 -28
  205. package/dist/lib/config-loader.d.ts.map +0 -1
  206. package/dist/lib/config-loader.js +0 -49
  207. package/dist/lib/config.d.ts +0 -12
  208. package/dist/lib/config.d.ts.map +0 -1
  209. package/dist/lib/config.js +0 -8
  210. package/dist/lib/errors.d.ts +0 -6
  211. package/dist/lib/errors.d.ts.map +0 -1
  212. package/dist/lib/errors.js +0 -76
  213. package/dist/lib/extension-helpers.d.ts.map +0 -1
  214. package/dist/lib/hook-helpers.d.ts.map +0 -1
  215. package/dist/lib/input.d.ts +0 -38
  216. package/dist/lib/input.d.ts.map +0 -1
  217. package/dist/lib/input.js +0 -108
  218. package/dist/lib/output.d.ts +0 -31
  219. package/dist/lib/output.d.ts.map +0 -1
  220. package/dist/lib/output.js +0 -107
  221. package/dist/lib/seed-helpers.d.ts.map +0 -1
  222. package/dist/scaffold/package-manager.d.ts +0 -12
  223. package/dist/scaffold/package-manager.d.ts.map +0 -1
  224. package/dist/scaffold/package-manager.js +0 -51
  225. package/dist/scaffold/scaffold.d.ts +0 -4
  226. package/dist/scaffold/scaffold.d.ts.map +0 -1
  227. package/dist/scaffold/scaffold.js +0 -462
@@ -1,139 +0,0 @@
1
- /**
2
- * Generates per-model React Apollo hooks.
3
- * Each hook file imports from ../operations/{key}.js and wraps useQuery/useMutation.
4
- */
5
- import { toPascalCase, toUpperSnakeCase } from '../field-mapping.js';
6
- export function generateReactHooks(model) {
7
- const typeName = toPascalCase(model.key);
8
- const upperSnake = toUpperSnakeCase(model.key);
9
- const pluralName = model.pluralName
10
- ? toPascalCase(model.pluralName.replace(/\s+/g, ''))
11
- : `${typeName}s`;
12
- const pluralUpperSnake = model.pluralName
13
- ? toUpperSnakeCase(model.pluralName.replace(/\s+/g, ''))
14
- : `${upperSnake}S`;
15
- const lines = [];
16
- // Imports
17
- lines.push(`/**
18
- * React Apollo hooks for ${model.name ?? model.key}
19
- *
20
- * @generated by foir — DO NOT EDIT MANUALLY
21
- */
22
-
23
- import { useQuery, useMutation } from '@apollo/client';
24
- import type { QueryHookOptions, MutationHookOptions } from '@apollo/client';
25
- import { gql } from '@apollo/client';
26
- import {
27
- GET_${upperSnake},
28
- GET_${upperSnake}_BY_KEY,
29
- LIST_${pluralUpperSnake},
30
- CREATE_${upperSnake},
31
- UPDATE_${upperSnake},
32
- DELETE_${upperSnake},
33
- PUBLISH_${upperSnake}_VERSION,
34
- UNPUBLISH_${upperSnake},
35
- } from '../operations/${model.key}.js';
36
- import type {
37
- ${typeName}Record,
38
- Get${typeName}Variables,
39
- Get${typeName}Result,
40
- Get${typeName}ByKeyVariables,
41
- Get${typeName}ByKeyResult,
42
- List${pluralName}Variables,
43
- List${pluralName}Result,
44
- Create${typeName}Variables,
45
- Create${typeName}Result,
46
- Update${typeName}Variables,
47
- Update${typeName}Result,
48
- Delete${typeName}Variables,
49
- Delete${typeName}Result,
50
- } from '../operations/${model.key}.js';
51
- `);
52
- // Re-export types for convenience
53
- lines.push(`export type { ${typeName}Record };`);
54
- lines.push('');
55
- // useGet{Model}
56
- lines.push(`export function useGet${typeName}(
57
- id: string | null | undefined,
58
- options?: Omit<QueryHookOptions<Get${typeName}Result, Get${typeName}Variables>, 'variables' | 'skip'>
59
- ) {
60
- return useQuery<Get${typeName}Result, Get${typeName}Variables>(
61
- gql\`\${GET_${upperSnake}}\`,
62
- { ...options, variables: { id: id! }, skip: !id }
63
- );
64
- }`);
65
- lines.push('');
66
- // useGet{Model}ByKey
67
- lines.push(`export function useGet${typeName}ByKey(
68
- naturalKey: string | null | undefined,
69
- options?: Omit<QueryHookOptions<Get${typeName}ByKeyResult, Get${typeName}ByKeyVariables>, 'variables' | 'skip'>
70
- ) {
71
- return useQuery<Get${typeName}ByKeyResult, Get${typeName}ByKeyVariables>(
72
- gql\`\${GET_${upperSnake}_BY_KEY}\`,
73
- { ...options, variables: { naturalKey: naturalKey! }, skip: !naturalKey }
74
- );
75
- }`);
76
- lines.push('');
77
- // useList{Models}
78
- lines.push(`export function useList${pluralName}(
79
- variables?: List${pluralName}Variables,
80
- options?: Omit<QueryHookOptions<List${pluralName}Result, List${pluralName}Variables>, 'variables'>
81
- ) {
82
- return useQuery<List${pluralName}Result, List${pluralName}Variables>(
83
- gql\`\${LIST_${pluralUpperSnake}}\`,
84
- { ...options, variables }
85
- );
86
- }`);
87
- lines.push('');
88
- // useCreate{Model}
89
- lines.push(`export function useCreate${typeName}(
90
- options?: MutationHookOptions<Create${typeName}Result, Create${typeName}Variables>
91
- ) {
92
- return useMutation<Create${typeName}Result, Create${typeName}Variables>(
93
- gql\`\${CREATE_${upperSnake}}\`,
94
- options
95
- );
96
- }`);
97
- lines.push('');
98
- // useUpdate{Model}
99
- lines.push(`export function useUpdate${typeName}(
100
- options?: MutationHookOptions<Update${typeName}Result, Update${typeName}Variables>
101
- ) {
102
- return useMutation<Update${typeName}Result, Update${typeName}Variables>(
103
- gql\`\${UPDATE_${upperSnake}}\`,
104
- options
105
- );
106
- }`);
107
- lines.push('');
108
- // useDelete{Model}
109
- lines.push(`export function useDelete${typeName}(
110
- options?: MutationHookOptions<Delete${typeName}Result, Delete${typeName}Variables>
111
- ) {
112
- return useMutation<Delete${typeName}Result, Delete${typeName}Variables>(
113
- gql\`\${DELETE_${upperSnake}}\`,
114
- options
115
- );
116
- }`);
117
- lines.push('');
118
- // usePublish{Model}Version
119
- lines.push(`export function usePublish${typeName}Version(
120
- options?: MutationHookOptions<{ publishVersion: boolean }, { versionId: string }>
121
- ) {
122
- return useMutation<{ publishVersion: boolean }, { versionId: string }>(
123
- gql\`\${PUBLISH_${upperSnake}_VERSION}\`,
124
- options
125
- );
126
- }`);
127
- lines.push('');
128
- // useUnpublish{Model}
129
- lines.push(`export function useUnpublish${typeName}(
130
- options?: MutationHookOptions<{ unpublishRecord: boolean }, { id: string }>
131
- ) {
132
- return useMutation<{ unpublishRecord: boolean }, { id: string }>(
133
- gql\`\${UNPUBLISH_${upperSnake}}\`,
134
- options
135
- );
136
- }`);
137
- lines.push('');
138
- return lines.join('\n');
139
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * Generates the loaders/index.ts barrel re-export file.
3
- */
4
- import type { CodegenModel } from '../fetch-models.js';
5
- export declare function generateRemixLoadersIndex(models: CodegenModel[], hasCustomerProfile: boolean): string;
6
- //# sourceMappingURL=remix-loaders-index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"remix-loaders-index.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/remix-loaders-index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,YAAY,EAAE,EACtB,kBAAkB,EAAE,OAAO,GAC1B,MAAM,CAoBR"}
@@ -1,20 +0,0 @@
1
- /**
2
- * Generates the loaders/index.ts barrel re-export file.
3
- */
4
- export function generateRemixLoadersIndex(models, hasCustomerProfile) {
5
- const lines = [];
6
- lines.push(`/**
7
- * Remix / server-side loader functions for all models.
8
- *
9
- * @generated by foir — DO NOT EDIT MANUALLY
10
- */
11
- `);
12
- for (const model of models) {
13
- lines.push(`export * from './${model.key}.js';`);
14
- }
15
- if (hasCustomerProfile) {
16
- lines.push(`export * from './customer-profile.js';`);
17
- }
18
- lines.push('');
19
- return lines.join('\n');
20
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * Generates per-model Remix loader functions.
3
- * Each function is a typed async wrapper over a generic GraphQL client.
4
- */
5
- import type { CodegenModel } from '../fetch-models.js';
6
- export declare function generateRemixLoaders(model: CodegenModel): string;
7
- //# sourceMappingURL=remix-loaders.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"remix-loaders.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/remix-loaders.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGvD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM,CAsGhE"}
@@ -1,107 +0,0 @@
1
- /**
2
- * Generates per-model Remix loader functions.
3
- * Each function is a typed async wrapper over a generic GraphQL client.
4
- */
5
- import { toPascalCase, toUpperSnakeCase } from '../field-mapping.js';
6
- export function generateRemixLoaders(model) {
7
- const typeName = toPascalCase(model.key);
8
- const upperSnake = toUpperSnakeCase(model.key);
9
- const pluralName = model.pluralName
10
- ? toPascalCase(model.pluralName.replace(/\s+/g, ''))
11
- : `${typeName}s`;
12
- const pluralUpperSnake = model.pluralName
13
- ? toUpperSnakeCase(model.pluralName.replace(/\s+/g, ''))
14
- : `${upperSnake}S`;
15
- return `/**
16
- * Remix / server-side loader functions for ${model.name ?? model.key}
17
- *
18
- * @generated by foir — DO NOT EDIT MANUALLY
19
- */
20
-
21
- import {
22
- GET_${upperSnake},
23
- GET_${upperSnake}_BY_KEY,
24
- LIST_${pluralUpperSnake},
25
- CREATE_${upperSnake},
26
- UPDATE_${upperSnake},
27
- DELETE_${upperSnake},
28
- PUBLISH_${upperSnake}_VERSION,
29
- UNPUBLISH_${upperSnake},
30
- } from '../operations/${model.key}.js';
31
- import type {
32
- Get${typeName}Variables,
33
- Get${typeName}Result,
34
- Get${typeName}ByKeyVariables,
35
- Get${typeName}ByKeyResult,
36
- List${pluralName}Variables,
37
- List${pluralName}Result,
38
- Create${typeName}Variables,
39
- Create${typeName}Result,
40
- Update${typeName}Variables,
41
- Update${typeName}Result,
42
- Delete${typeName}Variables,
43
- Delete${typeName}Result,
44
- } from '../operations/${model.key}.js';
45
-
46
- /** A minimal GraphQL client interface (works with graphql-request, urql, or custom). */
47
- export interface GraphQLClient {
48
- request<T>(query: string, variables?: Record<string, unknown>): Promise<T>;
49
- }
50
-
51
- export async function get${typeName}(
52
- client: GraphQLClient,
53
- variables: Get${typeName}Variables
54
- ): Promise<Get${typeName}Result> {
55
- return client.request<Get${typeName}Result>(GET_${upperSnake}, variables as Record<string, unknown>);
56
- }
57
-
58
- export async function get${typeName}ByKey(
59
- client: GraphQLClient,
60
- variables: Get${typeName}ByKeyVariables
61
- ): Promise<Get${typeName}ByKeyResult> {
62
- return client.request<Get${typeName}ByKeyResult>(GET_${upperSnake}_BY_KEY, variables as Record<string, unknown>);
63
- }
64
-
65
- export async function list${pluralName}(
66
- client: GraphQLClient,
67
- variables?: List${pluralName}Variables
68
- ): Promise<List${pluralName}Result> {
69
- return client.request<List${pluralName}Result>(LIST_${pluralUpperSnake}, variables as Record<string, unknown>);
70
- }
71
-
72
- export async function create${typeName}(
73
- client: GraphQLClient,
74
- variables: Create${typeName}Variables
75
- ): Promise<Create${typeName}Result> {
76
- return client.request<Create${typeName}Result>(CREATE_${upperSnake}, variables as Record<string, unknown>);
77
- }
78
-
79
- export async function update${typeName}(
80
- client: GraphQLClient,
81
- variables: Update${typeName}Variables
82
- ): Promise<Update${typeName}Result> {
83
- return client.request<Update${typeName}Result>(UPDATE_${upperSnake}, variables as Record<string, unknown>);
84
- }
85
-
86
- export async function delete${typeName}(
87
- client: GraphQLClient,
88
- variables: Delete${typeName}Variables
89
- ): Promise<Delete${typeName}Result> {
90
- return client.request<Delete${typeName}Result>(DELETE_${upperSnake}, variables as Record<string, unknown>);
91
- }
92
-
93
- export async function publish${typeName}Version(
94
- client: GraphQLClient,
95
- versionId: string
96
- ): Promise<{ publishVersion: boolean }> {
97
- return client.request<{ publishVersion: boolean }>(PUBLISH_${upperSnake}_VERSION, { versionId });
98
- }
99
-
100
- export async function unpublish${typeName}(
101
- client: GraphQLClient,
102
- id: string
103
- ): Promise<{ unpublishRecord: boolean }> {
104
- return client.request<{ unpublishRecord: boolean }>(UNPUBLISH_${upperSnake}, { id });
105
- }
106
- `;
107
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * Generates static .graphql files for non-model API domains.
3
- * These cover ~80% of the public API that has no model-specific typing.
4
- */
5
- import type { DomainConfig } from '../../config/types.js';
6
- export interface StaticDocumentFile {
7
- filename: string;
8
- content: string;
9
- }
10
- /**
11
- * Generate static domain .graphql files based on enabled domains.
12
- */
13
- export declare function generateStaticDocuments(domains: Required<DomainConfig>): StaticDocumentFile[];
14
- //# sourceMappingURL=static-documents.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"static-documents.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/static-documents.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAquB1D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,QAAQ,CAAC,YAAY,CAAC,GAC9B,kBAAkB,EAAE,CAqCtB"}