@pattern-stack/frontend-patterns 0.2.0-alpha.1 → 0.2.0-alpha.12

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 (170) hide show
  1. package/dist/atoms/components/core/Badge/Badge.d.ts +1 -1
  2. package/dist/atoms/components/data/DataTable/ColumnFilterDropdown.d.ts +32 -0
  3. package/dist/atoms/components/data/DataTable/ColumnFilterDropdown.d.ts.map +1 -0
  4. package/dist/atoms/components/data/DataTable/ColumnVisibilityToggle.d.ts +32 -0
  5. package/dist/atoms/components/data/DataTable/ColumnVisibilityToggle.d.ts.map +1 -0
  6. package/dist/atoms/components/data/DataTable/DataTable.d.ts +5 -2
  7. package/dist/atoms/components/data/DataTable/DataTable.d.ts.map +1 -1
  8. package/dist/atoms/components/data/DataTable/DataTable.expansion.d.ts +91 -0
  9. package/dist/atoms/components/data/DataTable/DataTable.expansion.d.ts.map +1 -0
  10. package/dist/atoms/components/data/DataTable/DataTable.filters.d.ts +271 -0
  11. package/dist/atoms/components/data/DataTable/DataTable.filters.d.ts.map +1 -0
  12. package/dist/atoms/components/data/DataTable/DataTable.types.d.ts +155 -5
  13. package/dist/atoms/components/data/DataTable/DataTable.types.d.ts.map +1 -1
  14. package/dist/atoms/components/data/DataTable/ExpandButton.d.ts +37 -0
  15. package/dist/atoms/components/data/DataTable/ExpandButton.d.ts.map +1 -0
  16. package/dist/atoms/components/data/DataTable/FilterPill.d.ts +25 -0
  17. package/dist/atoms/components/data/DataTable/FilterPill.d.ts.map +1 -0
  18. package/dist/atoms/components/data/DataTable/QuickFilterBar.d.ts +35 -0
  19. package/dist/atoms/components/data/DataTable/QuickFilterBar.d.ts.map +1 -0
  20. package/dist/atoms/components/data/DataTable/filters/BooleanFilterEditor.d.ts +10 -0
  21. package/dist/atoms/components/data/DataTable/filters/BooleanFilterEditor.d.ts.map +1 -0
  22. package/dist/atoms/components/data/DataTable/filters/DateFilterEditor.d.ts +11 -0
  23. package/dist/atoms/components/data/DataTable/filters/DateFilterEditor.d.ts.map +1 -0
  24. package/dist/atoms/components/data/DataTable/filters/MultiSelectFilterEditor.d.ts +10 -0
  25. package/dist/atoms/components/data/DataTable/filters/MultiSelectFilterEditor.d.ts.map +1 -0
  26. package/dist/atoms/components/data/DataTable/filters/NumberFilterEditor.d.ts +10 -0
  27. package/dist/atoms/components/data/DataTable/filters/NumberFilterEditor.d.ts.map +1 -0
  28. package/dist/atoms/components/data/DataTable/filters/SelectFilterEditor.d.ts +10 -0
  29. package/dist/atoms/components/data/DataTable/filters/SelectFilterEditor.d.ts.map +1 -0
  30. package/dist/atoms/components/data/DataTable/filters/TextFilterEditor.d.ts +10 -0
  31. package/dist/atoms/components/data/DataTable/filters/TextFilterEditor.d.ts.map +1 -0
  32. package/dist/atoms/components/data/DataTable/filters/index.d.ts +14 -0
  33. package/dist/atoms/components/data/DataTable/filters/index.d.ts.map +1 -0
  34. package/dist/atoms/components/data/DataTable/index.d.ts +9 -0
  35. package/dist/atoms/components/data/DataTable/index.d.ts.map +1 -1
  36. package/dist/atoms/components/data/ProgressBar/ProgressBar.d.ts +1 -1
  37. package/dist/atoms/components/data/ProgressBar/ProgressBar.d.ts.map +1 -1
  38. package/dist/atoms/components/data/index.d.ts +3 -2
  39. package/dist/atoms/components/data/index.d.ts.map +1 -1
  40. package/dist/atoms/composed/ConnectionStatus/ConnectionStatus.d.ts +16 -0
  41. package/dist/atoms/composed/ConnectionStatus/ConnectionStatus.d.ts.map +1 -0
  42. package/dist/atoms/composed/ConnectionStatus/index.d.ts +3 -0
  43. package/dist/atoms/composed/ConnectionStatus/index.d.ts.map +1 -0
  44. package/dist/atoms/hooks/index.d.ts +9 -0
  45. package/dist/atoms/hooks/index.d.ts.map +1 -1
  46. package/dist/atoms/hooks/useAdaptiveTable.d.ts +49 -0
  47. package/dist/atoms/hooks/useAdaptiveTable.d.ts.map +1 -0
  48. package/dist/atoms/hooks/useApi.d.ts +1 -1
  49. package/dist/atoms/hooks/useApi.d.ts.map +1 -1
  50. package/dist/atoms/hooks/useColumnVisibility.d.ts +75 -0
  51. package/dist/atoms/hooks/useColumnVisibility.d.ts.map +1 -0
  52. package/dist/atoms/hooks/useEntityData.d.ts +36 -0
  53. package/dist/atoms/hooks/useEntityData.d.ts.map +1 -0
  54. package/dist/atoms/hooks/useEntityDetail.d.ts +43 -0
  55. package/dist/atoms/hooks/useEntityDetail.d.ts.map +1 -0
  56. package/dist/atoms/hooks/useExpandedRows.d.ts +66 -0
  57. package/dist/atoms/hooks/useExpandedRows.d.ts.map +1 -0
  58. package/dist/atoms/hooks/useFieldMetadata.d.ts +18 -0
  59. package/dist/atoms/hooks/useFieldMetadata.d.ts.map +1 -0
  60. package/dist/atoms/hooks/useOnlineStatus.d.ts +16 -0
  61. package/dist/atoms/hooks/useOnlineStatus.d.ts.map +1 -0
  62. package/dist/atoms/hooks/useResponsiveTable.d.ts +123 -0
  63. package/dist/atoms/hooks/useResponsiveTable.d.ts.map +1 -0
  64. package/dist/atoms/hooks/useTableFilters.d.ts +92 -0
  65. package/dist/atoms/hooks/useTableFilters.d.ts.map +1 -0
  66. package/dist/atoms/index.d.ts +1 -0
  67. package/dist/atoms/index.d.ts.map +1 -1
  68. package/dist/atoms/primitives/sheet.d.ts +23 -0
  69. package/dist/atoms/primitives/sheet.d.ts.map +1 -0
  70. package/dist/atoms/primitives/table.d.ts.map +1 -1
  71. package/dist/atoms/services/api/client.d.ts +12 -2
  72. package/dist/atoms/services/api/client.d.ts.map +1 -1
  73. package/dist/atoms/services/auth-service.d.ts +15 -0
  74. package/dist/atoms/services/auth-service.d.ts.map +1 -1
  75. package/dist/atoms/services/index.d.ts +2 -2
  76. package/dist/atoms/services/index.d.ts.map +1 -1
  77. package/dist/atoms/shared/config/table-config.d.ts +79 -0
  78. package/dist/atoms/shared/config/table-config.d.ts.map +1 -0
  79. package/dist/atoms/shared/index.d.ts +1 -0
  80. package/dist/atoms/shared/index.d.ts.map +1 -1
  81. package/dist/atoms/types/auth.d.ts +95 -2
  82. package/dist/atoms/types/auth.d.ts.map +1 -1
  83. package/dist/atoms/types/index.d.ts +1 -0
  84. package/dist/atoms/types/index.d.ts.map +1 -1
  85. package/dist/atoms/types/navigation.d.ts +1 -1
  86. package/dist/atoms/types/navigation.d.ts.map +1 -1
  87. package/dist/atoms/types/ui-config.d.ts +46 -11
  88. package/dist/atoms/types/ui-config.d.ts.map +1 -1
  89. package/dist/atoms/types/ui-metadata.d.ts +103 -0
  90. package/dist/atoms/types/ui-metadata.d.ts.map +1 -0
  91. package/dist/atoms/utils/entity-card-mapping.d.ts +105 -0
  92. package/dist/atoms/utils/entity-card-mapping.d.ts.map +1 -0
  93. package/dist/atoms/utils/field-detection.d.ts +2 -2
  94. package/dist/atoms/utils/field-detection.d.ts.map +1 -1
  95. package/dist/atoms/utils/icon-map.d.ts +48 -0
  96. package/dist/atoms/utils/icon-map.d.ts.map +1 -1
  97. package/dist/atoms/utils/index.d.ts +2 -0
  98. package/dist/atoms/utils/index.d.ts.map +1 -1
  99. package/dist/atoms/utils/ui-mapping.d.ts +9 -3
  100. package/dist/atoms/utils/ui-mapping.d.ts.map +1 -1
  101. package/dist/features/auth/components/ProtectedRoute.d.ts +3 -1
  102. package/dist/features/auth/components/ProtectedRoute.d.ts.map +1 -1
  103. package/dist/features/auth/hooks/useAuth.d.ts.map +1 -1
  104. package/dist/features/auth/providers/NoAuthProvider.d.ts +17 -0
  105. package/dist/features/auth/providers/NoAuthProvider.d.ts.map +1 -0
  106. package/dist/features/auth/providers/index.d.ts +1 -0
  107. package/dist/features/auth/providers/index.d.ts.map +1 -1
  108. package/dist/frontend-patterns.css +1 -4554
  109. package/dist/index.d.ts +12 -4
  110. package/dist/index.d.ts.map +1 -1
  111. package/dist/index.es.js +8816 -18278
  112. package/dist/index.es.js.map +1 -1
  113. package/dist/index.js +8813 -18274
  114. package/dist/index.js.map +1 -1
  115. package/dist/molecules/layout/AppHeader/AppHeader.d.ts +19 -3
  116. package/dist/molecules/layout/AppHeader/AppHeader.d.ts.map +1 -1
  117. package/dist/molecules/layout/AppHeader/index.d.ts +1 -1
  118. package/dist/molecules/layout/AppHeader/index.d.ts.map +1 -1
  119. package/dist/molecules/layout/AppLayout.d.ts +12 -1
  120. package/dist/molecules/layout/AppLayout.d.ts.map +1 -1
  121. package/dist/molecules/layout/BulkSelectionBar.d.ts +14 -2
  122. package/dist/molecules/layout/BulkSelectionBar.d.ts.map +1 -1
  123. package/dist/molecules/layout/FieldGrid/FieldGrid.d.ts +61 -0
  124. package/dist/molecules/layout/FieldGrid/FieldGrid.d.ts.map +1 -0
  125. package/dist/molecules/layout/FieldGrid/index.d.ts +2 -0
  126. package/dist/molecules/layout/FieldGrid/index.d.ts.map +1 -0
  127. package/dist/molecules/layout/ListToolbar/ListToolbar.d.ts +37 -0
  128. package/dist/molecules/layout/ListToolbar/ListToolbar.d.ts.map +1 -0
  129. package/dist/molecules/layout/ListToolbar/index.d.ts +2 -0
  130. package/dist/molecules/layout/ListToolbar/index.d.ts.map +1 -0
  131. package/dist/molecules/layout/PageTitle/PageTitle.d.ts +17 -0
  132. package/dist/molecules/layout/PageTitle/PageTitle.d.ts.map +1 -0
  133. package/dist/molecules/layout/PageTitle/index.d.ts +2 -0
  134. package/dist/molecules/layout/PageTitle/index.d.ts.map +1 -0
  135. package/dist/molecules/layout/index.d.ts +5 -2
  136. package/dist/molecules/layout/index.d.ts.map +1 -1
  137. package/dist/molecules/layout/navigation-context.d.ts.map +1 -1
  138. package/dist/sync/EntityStoreProvider.d.ts +35 -0
  139. package/dist/sync/EntityStoreProvider.d.ts.map +1 -0
  140. package/dist/sync/createEntityHooks.d.ts +29 -0
  141. package/dist/sync/createEntityHooks.d.ts.map +1 -0
  142. package/dist/sync/createStore.d.ts +65 -0
  143. package/dist/sync/createStore.d.ts.map +1 -0
  144. package/dist/sync/index.d.ts +6 -0
  145. package/dist/sync/index.d.ts.map +1 -0
  146. package/dist/sync/types.d.ts +383 -0
  147. package/dist/sync/types.d.ts.map +1 -0
  148. package/dist/templates/ListPageTemplate.d.ts +21 -0
  149. package/dist/templates/ListPageTemplate.d.ts.map +1 -0
  150. package/dist/templates/admin/AdminCRUDTemplate.d.ts.map +1 -1
  151. package/dist/templates/factory.d.ts +20 -0
  152. package/dist/templates/factory.d.ts.map +1 -1
  153. package/dist/templates/index.d.ts +1 -0
  154. package/dist/templates/index.d.ts.map +1 -1
  155. package/package.json +11 -7
  156. package/cli/commands/generate-hooks.ts +0 -325
  157. package/cli/commands/init.ts +0 -33
  158. package/cli/commands/scaffold.ts +0 -224
  159. package/cli/index.ts +0 -122
  160. package/cli/src/codegen/openapi/__tests__/naming-utils.test.js +0 -367
  161. package/cli/src/codegen/openapi/client-generator.js +0 -727
  162. package/cli/src/codegen/openapi/confidence-scorer.js +0 -93
  163. package/cli/src/codegen/openapi/hook-config.js +0 -48
  164. package/cli/src/codegen/openapi/hook-generator.js +0 -763
  165. package/cli/src/codegen/openapi/naming-constants.js +0 -98
  166. package/cli/src/codegen/openapi/naming-utils.js +0 -149
  167. package/cli/src/codegen/openapi/parser.js +0 -274
  168. package/cli/src/codegen/openapi/type-generator.js +0 -329
  169. package/dist/codegen/openapi/bulk-types.d.ts +0 -142
  170. package/dist/codegen/openapi/bulk-types.d.ts.map +0 -1
@@ -1,329 +0,0 @@
1
- /**
2
- * TypeScript Type Generator
3
- *
4
- * Creates TypeScript interfaces and types from parsed OpenAPI schemas
5
- * with proper naming conventions and structure.
6
- *
7
- * Part of FRO-10: TypeScript Type Generator
8
- */
9
- export class TypeScriptGenerator {
10
- options;
11
- generatedTypes = new Set();
12
- refMap = new Map();
13
- constructor(options = {}) {
14
- this.options = {
15
- prefix: options.prefix || '',
16
- suffix: options.suffix || '',
17
- enumStyle: options.enumStyle || 'union',
18
- nullableStyle: options.nullableStyle || 'undefined',
19
- includeJSDoc: options.includeJSDoc !== false,
20
- includeExamples: options.includeExamples !== false
21
- };
22
- }
23
- generate(parsedAPI) {
24
- // Reset state
25
- this.generatedTypes.clear();
26
- this.refMap.clear();
27
- // Build reference map first
28
- this.buildRefMap(parsedAPI);
29
- return {
30
- schemas: this.generateSchemas(parsedAPI.schemas),
31
- endpoints: this.generateEndpointTypes(parsedAPI.endpoints),
32
- parameters: this.generateParameterTypes(parsedAPI.endpoints),
33
- responses: this.generateResponseTypes(parsedAPI.endpoints),
34
- index: this.generateIndexFile()
35
- };
36
- }
37
- buildRefMap(parsedAPI) {
38
- // Build map of ref -> TypeScript type name
39
- parsedAPI.schemas.forEach(schema => {
40
- if (schema.ref) {
41
- const typeName = this.extractTypeNameFromRef(schema.ref);
42
- this.refMap.set(schema.ref, typeName);
43
- }
44
- });
45
- }
46
- generateSchemas(schemas) {
47
- const types = [];
48
- // Add file header
49
- types.push(this.generateFileHeader('Schema Types'));
50
- for (const schema of schemas) {
51
- if (!schema.ref)
52
- continue;
53
- const typeName = this.refMap.get(schema.ref);
54
- if (!typeName || this.generatedTypes.has(typeName))
55
- continue;
56
- const typeDefinition = this.generateSchemaType(schema, typeName);
57
- types.push(typeDefinition);
58
- this.generatedTypes.add(typeName);
59
- }
60
- return types.join('\n\n');
61
- }
62
- generateSchemaType(schema, typeName) {
63
- const lines = [];
64
- // Add JSDoc comment
65
- if (this.options.includeJSDoc && schema.description) {
66
- lines.push(`/**`);
67
- lines.push(` * ${schema.description}`);
68
- if (this.options.includeExamples && schema.example) {
69
- lines.push(` * @example ${JSON.stringify(schema.example)}`);
70
- }
71
- lines.push(` */`);
72
- }
73
- // Generate the type
74
- const typeContent = this.generateTypeContent(schema);
75
- lines.push(`export interface ${typeName} ${typeContent}`);
76
- return lines.join('\n');
77
- }
78
- generateTypeContent(schema) {
79
- switch (schema.type) {
80
- case 'object':
81
- return this.generateObjectType(schema);
82
- case 'array':
83
- return `${this.generateTypeContent(schema.items)}[]`;
84
- case 'string':
85
- if (schema.enum) {
86
- return this.generateEnumType(schema.enum);
87
- }
88
- return this.addNullable('string', schema.nullable);
89
- case 'number':
90
- case 'integer':
91
- return this.addNullable('number', schema.nullable);
92
- case 'boolean':
93
- return this.addNullable('boolean', schema.nullable);
94
- case 'null':
95
- return 'null';
96
- case 'any':
97
- if (schema.ref) {
98
- const refType = this.refMap.get(schema.ref);
99
- return refType || 'unknown';
100
- }
101
- return 'unknown';
102
- default:
103
- return 'unknown';
104
- }
105
- }
106
- generateObjectType(schema) {
107
- if (!schema.properties) {
108
- return '{ [key: string]: unknown }';
109
- }
110
- const properties = [];
111
- for (const [propName, propSchema] of Object.entries(schema.properties)) {
112
- const isRequired = schema.required?.includes(propName) || false;
113
- const isOptional = !isRequired ? '?' : '';
114
- const propType = this.generateTypeContent(propSchema);
115
- // Add JSDoc for property if available
116
- let propDoc = '';
117
- if (this.options.includeJSDoc && propSchema.description) {
118
- propDoc = ` /** ${propSchema.description} */\n `;
119
- }
120
- properties.push(`${propDoc}${propName}${isOptional}: ${propType}`);
121
- }
122
- return `{\n ${properties.join('\n ')}\n}`;
123
- }
124
- generateEnumType(enumValues) {
125
- if (this.options.enumStyle === 'enum') {
126
- // Generate enum declaration (would need to be handled separately)
127
- return enumValues.map(val => `'${val}'`).join(' | ');
128
- }
129
- else {
130
- return enumValues.map(val => `'${val}'`).join(' | ');
131
- }
132
- }
133
- addNullable(type, nullable) {
134
- if (!nullable)
135
- return type;
136
- switch (this.options.nullableStyle) {
137
- case 'null':
138
- return `${type} | null`;
139
- case 'both':
140
- return `${type} | null | undefined`;
141
- case 'undefined':
142
- default:
143
- return `${type} | undefined`;
144
- }
145
- }
146
- generateEndpointTypes(endpoints) {
147
- const types = [];
148
- types.push(this.generateFileHeader('Endpoint Types'));
149
- // Group endpoints by operation ID or path+method
150
- const endpointTypes = new Set();
151
- for (const endpoint of endpoints) {
152
- const operationName = this.getOperationName(endpoint);
153
- if (endpointTypes.has(operationName))
154
- continue;
155
- endpointTypes.add(operationName);
156
- // Generate request type
157
- const requestType = this.generateRequestType(endpoint, operationName);
158
- if (requestType) {
159
- types.push(requestType);
160
- }
161
- // Generate response type
162
- const responseType = this.generateResponseType(endpoint, operationName);
163
- if (responseType) {
164
- types.push(responseType);
165
- }
166
- }
167
- return types.join('\n\n');
168
- }
169
- generateRequestType(endpoint, operationName) {
170
- const hasParams = endpoint.parameters.length > 0;
171
- const hasBody = endpoint.requestBody !== undefined;
172
- if (!hasParams && !hasBody)
173
- return null;
174
- const lines = [];
175
- if (this.options.includeJSDoc) {
176
- lines.push(`/**`);
177
- lines.push(` * Request type for ${endpoint.method.toUpperCase()} ${endpoint.path}`);
178
- if (endpoint.summary) {
179
- lines.push(` * ${endpoint.summary}`);
180
- }
181
- lines.push(` */`);
182
- }
183
- const properties = [];
184
- // Add parameters
185
- if (hasParams) {
186
- const paramsByType = this.groupParametersByType(endpoint.parameters);
187
- for (const [paramType, params] of Object.entries(paramsByType)) {
188
- if (params.length === 0)
189
- continue;
190
- const paramProps = params.map(param => {
191
- const optional = param.required ? '' : '?';
192
- const type = this.generateTypeContent(param.schema);
193
- return ` ${param.name}${optional}: ${type}`;
194
- });
195
- properties.push(` ${paramType}: {\n${paramProps.join('\n')}\n }`);
196
- }
197
- }
198
- // Add request body
199
- if (hasBody && endpoint.requestBody) {
200
- const bodyType = this.generateRequestBodyType(endpoint.requestBody);
201
- const optional = endpoint.requestBody.required ? '' : '?';
202
- properties.push(` body${optional}: ${bodyType}`);
203
- }
204
- const typeName = `${this.formatTypeName(operationName)}Request`;
205
- lines.push(`export interface ${typeName} {`);
206
- lines.push(properties.join('\n'));
207
- lines.push(`}`);
208
- return lines.join('\n');
209
- }
210
- generateResponseType(endpoint, operationName) {
211
- if (endpoint.responses.length === 0)
212
- return null;
213
- const lines = [];
214
- if (this.options.includeJSDoc) {
215
- lines.push(`/**`);
216
- lines.push(` * Response type for ${endpoint.method.toUpperCase()} ${endpoint.path}`);
217
- if (endpoint.summary) {
218
- lines.push(` * ${endpoint.summary}`);
219
- }
220
- lines.push(` */`);
221
- }
222
- // Generate union type for all possible responses
223
- const responseTypes = [];
224
- for (const response of endpoint.responses) {
225
- if (response.content) {
226
- for (const [mediaType, content] of Object.entries(response.content)) {
227
- if (mediaType.includes('json')) {
228
- const type = this.generateTypeContent(content.schema);
229
- responseTypes.push(`{ status: ${response.statusCode}; data: ${type} }`);
230
- }
231
- }
232
- }
233
- else {
234
- responseTypes.push(`{ status: ${response.statusCode}; data: void }`);
235
- }
236
- }
237
- const typeName = `${this.formatTypeName(operationName)}Response`;
238
- const unionType = responseTypes.length > 1 ? responseTypes.join(' | ') : responseTypes[0] || 'void';
239
- lines.push(`export type ${typeName} = ${unionType}`);
240
- return lines.join('\n');
241
- }
242
- generateRequestBodyType(requestBody) {
243
- // Find JSON content type
244
- const jsonContent = requestBody.content['application/json'] ||
245
- requestBody.content['application/vnd.api+json'] ||
246
- Object.values(requestBody.content)[0];
247
- if (!jsonContent)
248
- return 'unknown';
249
- return this.generateTypeContent(jsonContent.schema);
250
- }
251
- generateParameterTypes(_endpoints) {
252
- const types = [];
253
- types.push(this.generateFileHeader('Parameter Types'));
254
- // This could be expanded to generate specific parameter types
255
- // For now, we'll keep it simple
256
- return types.join('\n\n');
257
- }
258
- generateResponseTypes(_endpoints) {
259
- const types = [];
260
- types.push(this.generateFileHeader('Response Types'));
261
- // Additional response type utilities could go here
262
- return types.join('\n\n');
263
- }
264
- generateIndexFile() {
265
- const lines = [];
266
- lines.push(this.generateFileHeader('Generated API Types'));
267
- lines.push('');
268
- lines.push('// Schema exports');
269
- lines.push('export * from \'./schemas\'');
270
- lines.push('');
271
- lines.push('// Endpoint exports');
272
- lines.push('export * from \'./endpoints\'');
273
- lines.push('');
274
- lines.push('// Parameter exports');
275
- lines.push('export * from \'./parameters\'');
276
- lines.push('');
277
- lines.push('// Response exports');
278
- lines.push('export * from \'./responses\'');
279
- return lines.join('\n');
280
- }
281
- generateFileHeader(title) {
282
- return `/**
283
- * ${title}
284
- *
285
- * Auto-generated from OpenAPI specification
286
- * Do not edit manually - regenerate using the OpenAPI type generator
287
- */`;
288
- }
289
- getOperationName(endpoint) {
290
- if (endpoint.operationId) {
291
- return endpoint.operationId;
292
- }
293
- // Generate from path and method
294
- const pathParts = endpoint.path
295
- .split('/')
296
- .filter(part => part && !part.startsWith('{'))
297
- .map(part => this.capitalize(part));
298
- return `${endpoint.method}${pathParts.join('')}`;
299
- }
300
- formatTypeName(name) {
301
- const formatted = this.capitalize(name);
302
- return `${this.options.prefix}${formatted}${this.options.suffix}`;
303
- }
304
- extractTypeNameFromRef(ref) {
305
- const parts = ref.split('/');
306
- const name = parts[parts.length - 1];
307
- return this.formatTypeName(name);
308
- }
309
- groupParametersByType(parameters) {
310
- const grouped = {
311
- path: [],
312
- query: [],
313
- header: [],
314
- cookie: []
315
- };
316
- for (const param of parameters) {
317
- grouped[param.in].push(param);
318
- }
319
- return grouped;
320
- }
321
- capitalize(str) {
322
- return str.charAt(0).toUpperCase() + str.slice(1);
323
- }
324
- }
325
- // Factory function for easy usage
326
- export function generateTypes(parsedAPI, options) {
327
- const generator = new TypeScriptGenerator(options);
328
- return generator.generate(parsedAPI);
329
- }
@@ -1,142 +0,0 @@
1
- /**
2
- * Bulk Operations Types
3
- *
4
- * Standard types for bulk operations in generated hooks
5
- * Part of FRO-35: Bulk Operations Hook Generation
6
- */
7
- /**
8
- * Standard bulk operation request format
9
- */
10
- export interface BulkOperationRequest<T = unknown> {
11
- /** Array of IDs to operate on */
12
- ids: Array<string | number>;
13
- /** Optional additional data for the operation */
14
- data?: T;
15
- /** Optional operation-specific options */
16
- options?: BulkOperationOptions;
17
- }
18
- /**
19
- * Options for bulk operations
20
- */
21
- export interface BulkOperationOptions {
22
- /** Continue processing if some items fail */
23
- continueOnError?: boolean;
24
- /** Batch size for processing */
25
- batchSize?: number;
26
- /** Progress callback */
27
- onProgress?: (progress: BulkOperationProgress) => void;
28
- }
29
- /**
30
- * Progress tracking for bulk operations
31
- */
32
- export interface BulkOperationProgress {
33
- /** Total number of items to process */
34
- total: number;
35
- /** Number of items processed so far */
36
- processed: number;
37
- /** Number of successful operations */
38
- succeeded: number;
39
- /** Number of failed operations */
40
- failed: number;
41
- /** Percentage complete (0-100) */
42
- percentage: number;
43
- /** Current status */
44
- status: "pending" | "processing" | "completed" | "failed";
45
- }
46
- /**
47
- * Standard bulk operation response format
48
- */
49
- export interface BulkOperationResponse<T = unknown> {
50
- /** Overall operation success */
51
- success: boolean;
52
- /** Results for successful operations */
53
- succeeded: BulkOperationResult<T>[];
54
- /** Results for failed operations */
55
- failed: BulkOperationError[];
56
- /** Summary statistics */
57
- summary: BulkOperationSummary;
58
- }
59
- /**
60
- * Individual result for a successful bulk operation
61
- */
62
- export interface BulkOperationResult<T = unknown> {
63
- /** ID of the processed item */
64
- id: string | number;
65
- /** Result data */
66
- data?: T;
67
- /** Operation-specific message */
68
- message?: string;
69
- }
70
- /**
71
- * Individual error for a failed bulk operation
72
- */
73
- export interface BulkOperationError {
74
- /** ID of the failed item */
75
- id: string | number;
76
- /** Error code */
77
- code?: string;
78
- /** Error message */
79
- message: string;
80
- /** Detailed error information */
81
- details?: unknown;
82
- /** Whether this error is retryable */
83
- retryable?: boolean;
84
- }
85
- /**
86
- * Summary statistics for bulk operations
87
- */
88
- export interface BulkOperationSummary {
89
- /** Total items requested */
90
- total: number;
91
- /** Successfully processed items */
92
- succeeded: number;
93
- /** Failed items */
94
- failed: number;
95
- /** Processing duration in ms */
96
- duration?: number;
97
- /** Operation timestamp */
98
- timestamp: string;
99
- }
100
- /**
101
- * Retry configuration for bulk operations
102
- */
103
- export interface BulkRetryConfig {
104
- /** Maximum number of retry attempts */
105
- maxAttempts?: number;
106
- /** Initial delay between retries (ms) */
107
- initialDelay?: number;
108
- /** Maximum delay between retries (ms) */
109
- maxDelay?: number;
110
- /** Backoff multiplier */
111
- backoffMultiplier?: number;
112
- /** Which errors should trigger a retry */
113
- retryOn?: (error: BulkOperationError) => boolean;
114
- }
115
- /**
116
- * Hook options specific to bulk operations
117
- */
118
- export interface BulkMutationOptions<TData = unknown, TVariables = unknown> {
119
- /** Retry configuration */
120
- retry?: BulkRetryConfig;
121
- /** Progress tracking */
122
- onProgress?: (progress: BulkOperationProgress) => void;
123
- /** Callback for partial success */
124
- onPartialSuccess?: (response: BulkOperationResponse<TData>) => void;
125
- /** Transform function for request */
126
- transformRequest?: (request: BulkOperationRequest<TVariables>) => unknown;
127
- /** Transform function for response */
128
- transformResponse?: (response: unknown) => BulkOperationResponse<TData>;
129
- }
130
- /**
131
- * Type guard to check if an endpoint handles bulk operations
132
- */
133
- export declare function isBulkOperation(path: string, _method: string, requestBody?: unknown): boolean;
134
- /**
135
- * Detect bulk operation type from endpoint
136
- */
137
- export declare function detectBulkOperationType(path: string, method: string): "create" | "update" | "delete" | "mixed" | null;
138
- /**
139
- * Generate a descriptive bulk operation name
140
- */
141
- export declare function generateBulkOperationName(resource: string, operationType: string): string;
142
- //# sourceMappingURL=bulk-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bulk-types.d.ts","sourceRoot":"","sources":["../../../src/codegen/openapi/bulk-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,oBAAoB,CAAC,CAAC,GAAG,OAAO;IAC/C,iCAAiC;IACjC,GAAG,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC5B,iDAAiD;IACjD,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,0CAA0C;IAC1C,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,6CAA6C;IAC7C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gCAAgC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB;IACxB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACxD;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACv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