magector 2.3.0 → 2.4.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.
@@ -1,326 +0,0 @@
1
- /**
2
- * Test queries with expected results for accuracy validation
3
- */
4
-
5
- export const TEST_QUERIES = [
6
- // Controller queries
7
- {
8
- id: 'ctrl-1',
9
- query: 'controller execute action',
10
- type: 'semantic',
11
- expectedTypes: ['Controller'],
12
- expectedPatterns: ['controller'],
13
- minResults: 1,
14
- category: 'controller'
15
- },
16
- {
17
- id: 'ctrl-2',
18
- query: 'Index controller',
19
- type: 'exact',
20
- expectedClasses: ['Index'],
21
- expectedTypes: ['Controller'],
22
- category: 'controller'
23
- },
24
-
25
- // Model queries
26
- {
27
- id: 'model-1',
28
- query: 'model beforeSave afterLoad',
29
- type: 'semantic',
30
- expectedTypes: ['Model'],
31
- expectedPatterns: ['model'],
32
- category: 'model'
33
- },
34
- {
35
- id: 'model-2',
36
- query: 'AbstractModel extends',
37
- type: 'semantic',
38
- expectedInContent: ['extends AbstractModel'],
39
- category: 'model'
40
- },
41
-
42
- // Repository queries
43
- {
44
- id: 'repo-1',
45
- query: 'repository getById save delete',
46
- type: 'semantic',
47
- expectedTypes: ['Repository'],
48
- expectedPatterns: ['repository'],
49
- category: 'repository'
50
- },
51
- {
52
- id: 'repo-2',
53
- query: 'ItemRepository',
54
- type: 'exact',
55
- expectedClasses: ['ItemRepository'],
56
- category: 'repository'
57
- },
58
- {
59
- id: 'repo-3',
60
- query: 'getList SearchCriteria',
61
- type: 'semantic',
62
- expectedInContent: ['getList', 'SearchCriteria'],
63
- category: 'repository'
64
- },
65
-
66
- // Plugin queries
67
- {
68
- id: 'plugin-1',
69
- query: 'plugin interceptor before after around',
70
- type: 'semantic',
71
- expectedTypes: ['Plugin'],
72
- expectedPatterns: ['plugin'],
73
- category: 'plugin'
74
- },
75
- {
76
- id: 'plugin-2',
77
- query: 'beforeGetPrice plugin',
78
- type: 'semantic',
79
- expectedInContent: ['beforeGetPrice', 'before'],
80
- category: 'plugin'
81
- },
82
- {
83
- id: 'plugin-3',
84
- query: 'around method interceptor',
85
- type: 'semantic',
86
- expectedInContent: ['around', 'proceed'],
87
- category: 'plugin'
88
- },
89
-
90
- // Observer queries
91
- {
92
- id: 'obs-1',
93
- query: 'observer execute event',
94
- type: 'semantic',
95
- expectedTypes: ['Observer'],
96
- expectedPatterns: ['observer'],
97
- category: 'observer'
98
- },
99
- {
100
- id: 'obs-2',
101
- query: 'catalog_product_save_after observer',
102
- type: 'semantic',
103
- expectedInContent: ['catalog_product_save_after'],
104
- category: 'observer'
105
- },
106
- {
107
- id: 'obs-3',
108
- query: 'ObserverInterface implement',
109
- type: 'semantic',
110
- expectedInContent: ['ObserverInterface'],
111
- category: 'observer'
112
- },
113
-
114
- // Block queries
115
- {
116
- id: 'block-1',
117
- query: 'block template phtml',
118
- type: 'semantic',
119
- expectedTypes: ['Block'],
120
- expectedPatterns: ['block'],
121
- category: 'block'
122
- },
123
- {
124
- id: 'block-2',
125
- query: '_toHtml _prepareLayout',
126
- type: 'semantic',
127
- expectedInContent: ['_toHtml', '_prepareLayout'],
128
- category: 'block'
129
- },
130
-
131
- // DI.xml queries
132
- {
133
- id: 'di-1',
134
- query: 'preference interface implementation',
135
- type: 'semantic',
136
- expectedFileTypes: ['xml'],
137
- expectedInContent: ['preference'],
138
- category: 'di'
139
- },
140
- {
141
- id: 'di-2',
142
- query: 'plugin configuration di.xml',
143
- type: 'semantic',
144
- expectedFileTypes: ['xml'],
145
- expectedInContent: ['plugin'],
146
- category: 'di'
147
- },
148
- {
149
- id: 'di-3',
150
- query: 'virtualType argument',
151
- type: 'semantic',
152
- expectedInContent: ['virtualType'],
153
- category: 'di'
154
- },
155
-
156
- // Events.xml queries
157
- {
158
- id: 'event-1',
159
- query: 'event observer configuration',
160
- type: 'semantic',
161
- expectedFileTypes: ['xml'],
162
- expectedInContent: ['event', 'observer'],
163
- category: 'events'
164
- },
165
- {
166
- id: 'event-2',
167
- query: 'catalog_product_save_after event config',
168
- type: 'exact',
169
- expectedInContent: ['catalog_product_save_after'],
170
- category: 'events'
171
- },
172
-
173
- // Web API queries
174
- {
175
- id: 'api-1',
176
- query: 'REST API endpoint route',
177
- type: 'semantic',
178
- expectedFileTypes: ['xml'],
179
- expectedInContent: ['route', 'service'],
180
- category: 'webapi'
181
- },
182
- {
183
- id: 'api-2',
184
- query: 'GET /V1/items',
185
- type: 'semantic',
186
- expectedInContent: ['GET', '/V1/'],
187
- category: 'webapi'
188
- },
189
-
190
- // GraphQL queries
191
- {
192
- id: 'gql-1',
193
- query: 'GraphQL resolver',
194
- type: 'semantic',
195
- expectedTypes: ['GraphQlResolver'],
196
- expectedPatterns: ['graphql_resolver'],
197
- category: 'graphql'
198
- },
199
- {
200
- id: 'gql-2',
201
- query: 'type Query mutation',
202
- type: 'semantic',
203
- expectedFileTypes: ['graphql'],
204
- expectedInContent: ['type', 'Query'],
205
- category: 'graphql'
206
- },
207
- {
208
- id: 'gql-3',
209
- query: 'ResolverInterface resolve Field',
210
- type: 'semantic',
211
- expectedInContent: ['ResolverInterface', 'resolve'],
212
- category: 'graphql'
213
- },
214
-
215
- // Cron queries
216
- {
217
- id: 'cron-1',
218
- query: 'cron job schedule execute',
219
- type: 'semantic',
220
- expectedTypes: ['Cron'],
221
- category: 'cron'
222
- },
223
- {
224
- id: 'cron-2',
225
- query: 'crontab.xml job instance',
226
- type: 'semantic',
227
- expectedFileTypes: ['xml'],
228
- expectedInContent: ['job', 'instance'],
229
- category: 'cron'
230
- },
231
-
232
- // Cross-cutting queries
233
- {
234
- id: 'cross-1',
235
- query: 'dependency injection constructor',
236
- type: 'semantic',
237
- expectedInContent: ['__construct'],
238
- minResults: 3,
239
- category: 'di_pattern'
240
- },
241
- {
242
- id: 'cross-2',
243
- query: 'LoggerInterface logging',
244
- type: 'semantic',
245
- expectedInContent: ['LoggerInterface', 'logger'],
246
- category: 'logging'
247
- },
248
- {
249
- id: 'cross-3',
250
- query: 'exception handling try catch',
251
- type: 'semantic',
252
- expectedInContent: ['Exception', 'throw'],
253
- category: 'error_handling'
254
- },
255
-
256
- // Module-specific queries
257
- {
258
- id: 'mod-1',
259
- query: 'Acme_Catalog module',
260
- type: 'module',
261
- expectedModule: 'Acme_Catalog',
262
- minResults: 3,
263
- category: 'module'
264
- },
265
-
266
- // Method-specific queries
267
- {
268
- id: 'method-1',
269
- query: 'function getById',
270
- type: 'method',
271
- expectedMethods: ['getById'],
272
- category: 'method'
273
- },
274
- {
275
- id: 'method-2',
276
- query: 'save method repository',
277
- type: 'method',
278
- expectedMethods: ['save'],
279
- category: 'method'
280
- }
281
- ];
282
-
283
- export const QUERY_CATEGORIES = {
284
- controller: { weight: 1.0, description: 'Controller action detection' },
285
- model: { weight: 1.0, description: 'Model and lifecycle hooks' },
286
- repository: { weight: 1.2, description: 'Repository pattern detection' },
287
- plugin: { weight: 1.3, description: 'Plugin/interceptor detection' },
288
- observer: { weight: 1.2, description: 'Observer pattern detection' },
289
- block: { weight: 1.0, description: 'Block class detection' },
290
- di: { weight: 1.2, description: 'DI configuration detection' },
291
- events: { weight: 1.1, description: 'Event configuration detection' },
292
- webapi: { weight: 1.2, description: 'Web API route detection' },
293
- graphql: { weight: 1.3, description: 'GraphQL schema/resolver detection' },
294
- cron: { weight: 1.0, description: 'Cron job detection' },
295
- di_pattern: { weight: 0.8, description: 'DI pattern recognition' },
296
- logging: { weight: 0.7, description: 'Logging pattern recognition' },
297
- error_handling: { weight: 0.7, description: 'Error handling patterns' },
298
- module: { weight: 1.0, description: 'Module filtering' },
299
- method: { weight: 1.0, description: 'Method search' }
300
- };
301
-
302
- /**
303
- * Generate edge case queries for stress testing
304
- */
305
- export function generateEdgeCaseQueries() {
306
- return [
307
- // Very short queries
308
- { id: 'edge-1', query: 'save', type: 'short', category: 'edge_short', minResults: 1, expectedMethods: ['save'] },
309
- { id: 'edge-2', query: 'get', type: 'short', category: 'edge_short', minResults: 1 },
310
-
311
- // Very long queries
312
- { id: 'edge-3', query: 'public function execute action controller', type: 'long', category: 'edge_long', minResults: 1, expectedPatterns: ['controller'] },
313
-
314
- // Technical jargon
315
- { id: 'edge-4', query: 'CRUD operations repository interface', type: 'jargon', category: 'edge_jargon', minResults: 1, expectedTypes: ['Repository'] },
316
-
317
- // Magento-specific terms - lower expectations
318
- { id: 'edge-5', query: 'service contract API', type: 'magento_specific', category: 'edge_magento', minResults: 1 },
319
-
320
- // Negative queries (should return few/no results)
321
- { id: 'edge-6', query: 'wordpress drupal laravel', type: 'negative', category: 'edge_negative', maxResults: 2 },
322
-
323
- // Mixed case
324
- { id: 'edge-7', query: 'REPOSITORY getbyid SAVE', type: 'case', category: 'edge_case', minResults: 1, expectedTypes: ['Repository'] }
325
- ];
326
- }