@eide/foir-cli 0.1.34 → 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 (221) hide show
  1. package/dist/cli.js +7469 -81
  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 -7
  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 -176
  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/pull.d.ts +0 -4
  162. package/dist/commands/pull.d.ts.map +0 -1
  163. package/dist/commands/pull.js +0 -300
  164. package/dist/commands/records.d.ts +0 -4
  165. package/dist/commands/records.d.ts.map +0 -1
  166. package/dist/commands/records.js +0 -314
  167. package/dist/commands/schedules.d.ts +0 -4
  168. package/dist/commands/schedules.d.ts.map +0 -1
  169. package/dist/commands/schedules.js +0 -155
  170. package/dist/commands/search.d.ts +0 -4
  171. package/dist/commands/search.d.ts.map +0 -1
  172. package/dist/commands/search.js +0 -60
  173. package/dist/commands/segments.d.ts +0 -4
  174. package/dist/commands/segments.d.ts.map +0 -1
  175. package/dist/commands/segments.js +0 -155
  176. package/dist/commands/select-project.d.ts +0 -4
  177. package/dist/commands/select-project.d.ts.map +0 -1
  178. package/dist/commands/select-project.js +0 -144
  179. package/dist/commands/settings.d.ts +0 -4
  180. package/dist/commands/settings.d.ts.map +0 -1
  181. package/dist/commands/settings.js +0 -115
  182. package/dist/commands/variant-catalog.d.ts +0 -4
  183. package/dist/commands/variant-catalog.d.ts.map +0 -1
  184. package/dist/commands/variant-catalog.js +0 -118
  185. package/dist/commands/whoami.d.ts +0 -4
  186. package/dist/commands/whoami.d.ts.map +0 -1
  187. package/dist/commands/whoami.js +0 -51
  188. package/dist/config/pull-config.d.ts +0 -33
  189. package/dist/config/pull-config.d.ts.map +0 -1
  190. package/dist/config/pull-config.js +0 -119
  191. package/dist/config/types.d.ts.map +0 -1
  192. package/dist/graphql/generated.d.ts +0 -8330
  193. package/dist/graphql/generated.d.ts.map +0 -1
  194. package/dist/graphql/generated.js +0 -135
  195. package/dist/lib/client.d.ts +0 -18
  196. package/dist/lib/client.d.ts.map +0 -1
  197. package/dist/lib/client.js +0 -64
  198. package/dist/lib/config-loader.d.ts +0 -28
  199. package/dist/lib/config-loader.d.ts.map +0 -1
  200. package/dist/lib/config-loader.js +0 -49
  201. package/dist/lib/config.d.ts +0 -12
  202. package/dist/lib/config.d.ts.map +0 -1
  203. package/dist/lib/config.js +0 -8
  204. package/dist/lib/errors.d.ts +0 -6
  205. package/dist/lib/errors.d.ts.map +0 -1
  206. package/dist/lib/errors.js +0 -76
  207. package/dist/lib/extension-helpers.d.ts.map +0 -1
  208. package/dist/lib/hook-helpers.d.ts.map +0 -1
  209. package/dist/lib/input.d.ts +0 -38
  210. package/dist/lib/input.d.ts.map +0 -1
  211. package/dist/lib/input.js +0 -108
  212. package/dist/lib/output.d.ts +0 -31
  213. package/dist/lib/output.d.ts.map +0 -1
  214. package/dist/lib/output.js +0 -107
  215. package/dist/lib/seed-helpers.d.ts.map +0 -1
  216. package/dist/scaffold/package-manager.d.ts +0 -12
  217. package/dist/scaffold/package-manager.d.ts.map +0 -1
  218. package/dist/scaffold/package-manager.js +0 -51
  219. package/dist/scaffold/scaffold.d.ts +0 -4
  220. package/dist/scaffold/scaffold.d.ts.map +0 -1
  221. package/dist/scaffold/scaffold.js +0 -462
@@ -1,250 +0,0 @@
1
- /**
2
- * Maps EIDE field types to TypeScript types.
3
- * Ported from uniformgen with updates for the unified data layer.
4
- */
5
- export const PRIMITIVE_FIELD_TYPES = new Set([
6
- 'text',
7
- 'richtext',
8
- 'number',
9
- 'boolean',
10
- 'email',
11
- 'phone',
12
- 'url',
13
- 'date',
14
- 'image',
15
- 'video',
16
- 'file',
17
- 'currency',
18
- 'select',
19
- 'multiselect',
20
- 'json',
21
- 'list',
22
- 'reference',
23
- 'link',
24
- 'flexible',
25
- 'model',
26
- ]);
27
- export function isPrimitiveFieldType(type) {
28
- return PRIMITIVE_FIELD_TYPES.has(type);
29
- }
30
- export const FIELD_TYPE_MAPPING = {
31
- text: { outputType: 'string', inputType: 'string' },
32
- richtext: {
33
- outputType: 'RichtextValue',
34
- inputType: 'RichtextValue',
35
- needsImport: 'field-types',
36
- },
37
- number: { outputType: 'number', inputType: 'number' },
38
- boolean: { outputType: 'boolean', inputType: 'boolean' },
39
- email: { outputType: 'string', inputType: 'string' },
40
- phone: { outputType: 'string', inputType: 'string' },
41
- url: { outputType: 'string', inputType: 'string' },
42
- date: { outputType: 'Date', inputType: 'string' },
43
- image: {
44
- outputType: 'ImageValue',
45
- inputType: 'string',
46
- needsImport: 'field-types',
47
- },
48
- video: {
49
- outputType: 'VideoValue',
50
- inputType: 'string',
51
- needsImport: 'field-types',
52
- },
53
- file: {
54
- outputType: 'FileValue',
55
- inputType: 'string',
56
- needsImport: 'field-types',
57
- },
58
- currency: {
59
- outputType: 'CurrencyValue',
60
- inputType: 'CurrencyValue',
61
- needsImport: 'field-types',
62
- },
63
- select: { outputType: 'string', inputType: 'string' },
64
- multiselect: { outputType: 'string[]', inputType: 'string[]' },
65
- json: { outputType: 'unknown', inputType: 'unknown' },
66
- list: { outputType: 'unknown[]', inputType: 'unknown[]' },
67
- flexible: {
68
- outputType: 'FlexibleFieldItem[]',
69
- inputType: 'FlexibleFieldItem[]',
70
- needsImport: 'field-types',
71
- },
72
- reference: {
73
- outputType: 'ReferenceValue',
74
- inputType: 'ReferenceValue',
75
- needsImport: 'field-types',
76
- },
77
- link: {
78
- outputType: 'LinkValue',
79
- inputType: 'LinkValue',
80
- needsImport: 'field-types',
81
- },
82
- model: { outputType: 'string', inputType: 'string' },
83
- };
84
- export function getFieldType(field, mode = 'output') {
85
- if (!field?.type)
86
- return 'unknown';
87
- const mapping = FIELD_TYPE_MAPPING[field.type];
88
- if (!mapping) {
89
- if (isPrimitiveFieldType(field.type))
90
- return 'unknown';
91
- return toPascalCase(field.type);
92
- }
93
- let tsType = mode === 'output' ? mapping.outputType : mapping.inputType;
94
- if (field.type === 'select' && field.options?.options) {
95
- const options = field.options.options;
96
- if (options.length > 0) {
97
- tsType = options.map((o) => `'${o.value}'`).join(' | ');
98
- }
99
- }
100
- if (field.type === 'multiselect' && field.options?.options) {
101
- const options = field.options.options;
102
- if (options.length > 0) {
103
- tsType = `(${options.map((o) => `'${o.value}'`).join(' | ')})[]`;
104
- }
105
- }
106
- if (field.type === 'list' && field.options?.itemType) {
107
- const itemType = field.options.itemType;
108
- const itemMapping = FIELD_TYPE_MAPPING[itemType];
109
- if (itemMapping) {
110
- tsType = `${mode === 'output' ? itemMapping.outputType : itemMapping.inputType}[]`;
111
- }
112
- else if (!isPrimitiveFieldType(itemType)) {
113
- tsType = `${toPascalCase(itemType)}[]`;
114
- }
115
- }
116
- return tsType;
117
- }
118
- export function getRequiredImports(fields) {
119
- const imports = new Set();
120
- for (const field of fields) {
121
- const mapping = FIELD_TYPE_MAPPING[field.type];
122
- if (mapping?.needsImport)
123
- imports.add(mapping.needsImport);
124
- if (field.type === 'list' && field.options?.itemType) {
125
- const itemMapping = FIELD_TYPE_MAPPING[field.options.itemType];
126
- if (itemMapping?.needsImport)
127
- imports.add(itemMapping.needsImport);
128
- }
129
- }
130
- return imports;
131
- }
132
- /**
133
- * Extract model keys referenced by reference-type fields via `referenceTypes`.
134
- * Used to generate parameterized `ReferenceValue<Partial<ModelData>>` types.
135
- */
136
- export function getReferenceTypeModelRefs(fields) {
137
- const refs = new Set();
138
- for (const field of fields) {
139
- if (field.type === 'reference' && field.options?.referenceTypes) {
140
- for (const rt of field.options.referenceTypes) {
141
- refs.add(rt);
142
- }
143
- }
144
- }
145
- return refs;
146
- }
147
- export function getInlineSchemaReferences(fields) {
148
- const refs = new Set();
149
- for (const field of fields) {
150
- if (!isPrimitiveFieldType(field.type) && !FIELD_TYPE_MAPPING[field.type]) {
151
- refs.add(field.type);
152
- }
153
- if (field.type === 'list' && field.options?.itemType) {
154
- const itemType = field.options.itemType;
155
- if (!isPrimitiveFieldType(itemType) && !FIELD_TYPE_MAPPING[itemType]) {
156
- refs.add(itemType);
157
- }
158
- }
159
- }
160
- return refs;
161
- }
162
- export function toCamelCase(str) {
163
- if (!str)
164
- return 'unknown';
165
- return str.replace(/[-_]([a-z])/g, (_, letter) => letter.toUpperCase());
166
- }
167
- export function toPascalCase(str) {
168
- if (!str)
169
- return 'Unknown';
170
- const camel = toCamelCase(str);
171
- return camel.charAt(0).toUpperCase() + camel.slice(1);
172
- }
173
- export function toUpperSnakeCase(str) {
174
- if (!str)
175
- return 'UNKNOWN';
176
- return str
177
- .replace(/([a-z])([A-Z])/g, '$1_$2')
178
- .replace(/[-\s]+/g, '_')
179
- .toUpperCase();
180
- }
181
- export function sanitizeFieldName(key) {
182
- if (!key)
183
- return 'unknown';
184
- const camel = toCamelCase(key);
185
- if (/^[0-9]/.test(camel))
186
- return `_${camel}`;
187
- return camel;
188
- }
189
- export function generateFieldDef(field) {
190
- const parts = [];
191
- parts.push(`key: '${field.key ?? 'unknown'}'`);
192
- parts.push(`type: '${field.type ?? 'text'}'`);
193
- parts.push(`label: '${(field.label ?? field.key ?? 'Unknown').replace(/'/g, "\\'")}'`);
194
- if (field.required)
195
- parts.push('required: true');
196
- if (field.helpText)
197
- parts.push(`helpText: '${field.helpText.replace(/'/g, "\\'")}'`);
198
- if (field.type === 'text' && field.options) {
199
- if (field.options.maxLength)
200
- parts.push(`maxLength: ${field.options.maxLength}`);
201
- if (field.options.minLength)
202
- parts.push(`minLength: ${field.options.minLength}`);
203
- }
204
- if (field.type === 'number' && field.options) {
205
- if (field.options.min !== undefined)
206
- parts.push(`min: ${field.options.min}`);
207
- if (field.options.max !== undefined)
208
- parts.push(`max: ${field.options.max}`);
209
- if (field.options.step !== undefined)
210
- parts.push(`step: ${field.options.step}`);
211
- }
212
- if ((field.type === 'select' || field.type === 'multiselect') &&
213
- field.options?.options) {
214
- const options = field.options.options;
215
- const optionsStr = options
216
- .filter((o) => o.value !== undefined)
217
- .map((o) => {
218
- const label = (o.label ?? o.value ?? '').replace(/'/g, "\\'");
219
- const value = (o.value ?? '').replace(/'/g, "\\'");
220
- return `{ label: '${label}', value: '${value}' }`;
221
- })
222
- .join(', ');
223
- parts.push(`options: [${optionsStr}]`);
224
- }
225
- if (field.type === 'reference' && field.options?.referenceTypes) {
226
- const refTypes = field.options.referenceTypes;
227
- parts.push(`referenceTypes: [${refTypes.map((t) => `'${t}'`).join(', ')}]`);
228
- if (field.options.multiple)
229
- parts.push('multiple: true');
230
- }
231
- if (field.type === 'list' && field.options?.itemType) {
232
- parts.push(`itemType: '${field.options.itemType}'`);
233
- if (field.options.minItems !== undefined)
234
- parts.push(`minItems: ${field.options.minItems}`);
235
- if (field.options.maxItems !== undefined)
236
- parts.push(`maxItems: ${field.options.maxItems}`);
237
- }
238
- if ((field.type === 'image' ||
239
- field.type === 'video' ||
240
- field.type === 'file') &&
241
- field.options) {
242
- if (field.options.allowedTypes) {
243
- const types = field.options.allowedTypes;
244
- parts.push(`allowedTypes: [${types.map((t) => `'${t}'`).join(', ')}]`);
245
- }
246
- if (field.options.maxSize)
247
- parts.push(`maxSize: ${field.options.maxSize}`);
248
- }
249
- return `{ ${parts.join(', ')} }`;
250
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * Generates the static config.ts file with ModelConfig type and defineModel() helper.
3
- */
4
- export declare function generateConfigFile(): string;
5
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,wBAAgB,kBAAkB,IAAI,MAAM,CA8E3C"}
@@ -1,82 +0,0 @@
1
- /**
2
- * Generates the static config.ts file with ModelConfig type and defineModel() helper.
3
- */
4
- export function generateConfigFile() {
5
- return `/**
6
- * Model Configuration Type
7
- *
8
- * Strongly-typed model definitions for the unified data layer.
9
- *
10
- * @generated by foir — DO NOT EDIT MANUALLY
11
- */
12
-
13
- import type { FieldDef, JsonValue } from './field-types.js';
14
-
15
- /**
16
- * Model configuration
17
- *
18
- * Defines the complete configuration for a model including
19
- * its schema, capabilities, and lifecycle hooks.
20
- *
21
- * @example
22
- * export const blogPostConfig = {
23
- * key: 'blog-post',
24
- * name: 'Blog Post',
25
- * records: true,
26
- * inline: false,
27
- * publicApi: true,
28
- * versioning: true,
29
- * publishing: true,
30
- * variants: false,
31
- * customerScoped: false,
32
- * fieldDefs: [
33
- * { key: 'title', type: 'text', label: 'Title', required: true },
34
- * { key: 'content', type: 'richtext', label: 'Content' },
35
- * ],
36
- * } as const satisfies ModelConfig;
37
- */
38
- export interface ModelConfig {
39
- /** Unique identifier (kebab-case) */
40
- key: string;
41
- /** Display name */
42
- name: string;
43
- /** Description */
44
- description?: string;
45
-
46
- // Capability flags (from model config)
47
- /** Can create standalone records */
48
- records: boolean;
49
- /** Available as inline field type in other models */
50
- inline: boolean;
51
- /** Exposed via public GraphQL API */
52
- publicApi: boolean;
53
- /** Version history enabled */
54
- versioning: boolean;
55
- /** Publishing workflow enabled */
56
- publishing: boolean;
57
- /** Market/device/locale variants enabled */
58
- variants: boolean;
59
- /** Customer-level record isolation */
60
- customerScoped: boolean;
61
-
62
- /** Embedding configuration */
63
- embeddings?: {
64
- enabled: boolean;
65
- fields: Array<{ fieldPath: string; weight?: number }>;
66
- };
67
-
68
- /** Lifecycle hooks configuration */
69
- hooks?: Record<string, JsonValue>;
70
-
71
- /** Field definitions */
72
- fieldDefs: readonly FieldDef[];
73
- }
74
-
75
- /**
76
- * Helper to create a type-safe model config
77
- */
78
- export function defineModel<T extends ModelConfig>(config: T): T {
79
- return config;
80
- }
81
- `;
82
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * Generates a customer-profile.graphql file with query + mutation operations.
3
- */
4
- export declare function generateCustomerProfileDocuments(): string;
5
- //# sourceMappingURL=customer-profile-documents.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customer-profile-documents.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/customer-profile-documents.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,wBAAgB,gCAAgC,IAAI,MAAM,CAsCzD"}
@@ -1,42 +0,0 @@
1
- /**
2
- * Generates a customer-profile.graphql file with query + mutation operations.
3
- */
4
- export function generateCustomerProfileDocuments() {
5
- return `# Generated GraphQL operations for Customer Profiles
6
- # @generated by foir — DO NOT EDIT MANUALLY
7
-
8
- fragment CustomerProfileFields on CustomerProfile {
9
- id
10
- customerId
11
- data
12
- createdAt
13
- updatedAt
14
- }
15
-
16
- query GetMyProfile {
17
- myProfile {
18
- ...CustomerProfileFields
19
- resolved
20
- }
21
- }
22
-
23
- query GetCustomerProfile($customerId: ID!) {
24
- customerProfile(customerId: $customerId) {
25
- ...CustomerProfileFields
26
- resolved
27
- }
28
- }
29
-
30
- mutation SetMyProfile($data: JSON!) {
31
- setMyProfile(data: $data) {
32
- ...CustomerProfileFields
33
- }
34
- }
35
-
36
- mutation UpdateCustomerProfile($customerId: ID, $data: JSON!) {
37
- updateCustomerProfile(customerId: $customerId, input: { data: $data }) {
38
- ...CustomerProfileFields
39
- }
40
- }
41
- `;
42
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * Generates React Apollo hooks for customer profiles.
3
- */
4
- export declare function generateCustomerProfileHooks(): string;
5
- //# sourceMappingURL=customer-profile-hooks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customer-profile-hooks.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/customer-profile-hooks.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,wBAAgB,4BAA4B,IAAI,MAAM,CA0ErD"}
@@ -1,78 +0,0 @@
1
- /**
2
- * Generates React Apollo hooks for customer profiles.
3
- */
4
- export function generateCustomerProfileHooks() {
5
- return `/**
6
- * React Apollo hooks for Customer Profiles
7
- *
8
- * @generated by foir — DO NOT EDIT MANUALLY
9
- */
10
-
11
- import { useQuery, useMutation } from '@apollo/client';
12
- import type { QueryHookOptions, MutationHookOptions } from '@apollo/client';
13
- import { gql } from '@apollo/client';
14
- import {
15
- GET_MY_PROFILE,
16
- GET_CUSTOMER_PROFILE,
17
- SET_MY_PROFILE,
18
- UPDATE_CUSTOMER_PROFILE,
19
- DELETE_MY_PROFILE,
20
- } from '../operations/customer-profile.js';
21
- import type {
22
- GetMyProfileResult,
23
- GetCustomerProfileVariables,
24
- GetCustomerProfileResult,
25
- SetMyProfileVariables,
26
- SetMyProfileResult,
27
- UpdateCustomerProfileVariables,
28
- UpdateCustomerProfileResult,
29
- DeleteMyProfileResult,
30
- } from '../operations/customer-profile.js';
31
-
32
- export function useMyProfile(
33
- options?: QueryHookOptions<GetMyProfileResult>
34
- ) {
35
- return useQuery<GetMyProfileResult>(
36
- gql\`\${GET_MY_PROFILE}\`,
37
- options
38
- );
39
- }
40
-
41
- export function useCustomerProfile(
42
- customerId: string | null | undefined,
43
- options?: Omit<QueryHookOptions<GetCustomerProfileResult, GetCustomerProfileVariables>, 'variables' | 'skip'>
44
- ) {
45
- return useQuery<GetCustomerProfileResult, GetCustomerProfileVariables>(
46
- gql\`\${GET_CUSTOMER_PROFILE}\`,
47
- { ...options, variables: { customerId: customerId! }, skip: !customerId }
48
- );
49
- }
50
-
51
- export function useSetMyProfile(
52
- options?: MutationHookOptions<SetMyProfileResult, SetMyProfileVariables>
53
- ) {
54
- return useMutation<SetMyProfileResult, SetMyProfileVariables>(
55
- gql\`\${SET_MY_PROFILE}\`,
56
- options
57
- );
58
- }
59
-
60
- export function useUpdateCustomerProfile(
61
- options?: MutationHookOptions<UpdateCustomerProfileResult, UpdateCustomerProfileVariables>
62
- ) {
63
- return useMutation<UpdateCustomerProfileResult, UpdateCustomerProfileVariables>(
64
- gql\`\${UPDATE_CUSTOMER_PROFILE}\`,
65
- options
66
- );
67
- }
68
-
69
- export function useDeleteMyProfile(
70
- options?: MutationHookOptions<DeleteMyProfileResult>
71
- ) {
72
- return useMutation<DeleteMyProfileResult>(
73
- gql\`\${DELETE_MY_PROFILE}\`,
74
- options
75
- );
76
- }
77
- `;
78
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * Generates Remix/server-side loader functions for customer profiles.
3
- */
4
- export declare function generateCustomerProfileLoaders(): string;
5
- //# sourceMappingURL=customer-profile-loaders.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customer-profile-loaders.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/customer-profile-loaders.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,wBAAgB,8BAA8B,IAAI,MAAM,CA+DvD"}
@@ -1,67 +0,0 @@
1
- /**
2
- * Generates Remix/server-side loader functions for customer profiles.
3
- */
4
- export function generateCustomerProfileLoaders() {
5
- return `/**
6
- * Remix / server-side loader functions for Customer Profiles
7
- *
8
- * @generated by foir — DO NOT EDIT MANUALLY
9
- */
10
-
11
- import {
12
- GET_MY_PROFILE,
13
- GET_CUSTOMER_PROFILE,
14
- SET_MY_PROFILE,
15
- UPDATE_CUSTOMER_PROFILE,
16
- DELETE_MY_PROFILE,
17
- } from '../operations/customer-profile.js';
18
- import type {
19
- GetMyProfileResult,
20
- GetCustomerProfileVariables,
21
- GetCustomerProfileResult,
22
- SetMyProfileVariables,
23
- SetMyProfileResult,
24
- UpdateCustomerProfileVariables,
25
- UpdateCustomerProfileResult,
26
- DeleteMyProfileResult,
27
- } from '../operations/customer-profile.js';
28
-
29
- /** A minimal GraphQL client interface (works with graphql-request, urql, or custom). */
30
- export interface GraphQLClient {
31
- request<T>(query: string, variables?: Record<string, unknown>): Promise<T>;
32
- }
33
-
34
- export async function getMyProfile(
35
- client: GraphQLClient
36
- ): Promise<GetMyProfileResult> {
37
- return client.request<GetMyProfileResult>(GET_MY_PROFILE);
38
- }
39
-
40
- export async function getCustomerProfile(
41
- client: GraphQLClient,
42
- variables: GetCustomerProfileVariables
43
- ): Promise<GetCustomerProfileResult> {
44
- return client.request<GetCustomerProfileResult>(GET_CUSTOMER_PROFILE, variables as Record<string, unknown>);
45
- }
46
-
47
- export async function setMyProfile(
48
- client: GraphQLClient,
49
- variables: SetMyProfileVariables
50
- ): Promise<SetMyProfileResult> {
51
- return client.request<SetMyProfileResult>(SET_MY_PROFILE, variables as Record<string, unknown>);
52
- }
53
-
54
- export async function updateCustomerProfile(
55
- client: GraphQLClient,
56
- variables: UpdateCustomerProfileVariables
57
- ): Promise<UpdateCustomerProfileResult> {
58
- return client.request<UpdateCustomerProfileResult>(UPDATE_CUSTOMER_PROFILE, variables as Record<string, unknown>);
59
- }
60
-
61
- export async function deleteMyProfile(
62
- client: GraphQLClient
63
- ): Promise<DeleteMyProfileResult> {
64
- return client.request<DeleteMyProfileResult>(DELETE_MY_PROFILE);
65
- }
66
- `;
67
- }
@@ -1,5 +0,0 @@
1
- /**
2
- * Generates typed operations for customer profiles.
3
- */
4
- export declare function generateCustomerProfileOperations(typesRelPath: string): string;
5
- //# sourceMappingURL=customer-profile-operations.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"customer-profile-operations.d.ts","sourceRoot":"","sources":["../../../src/codegen/generators/customer-profile-operations.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,wBAAgB,iCAAiC,CAC/C,YAAY,EAAE,MAAM,GACnB,MAAM,CA0HR"}