The category plus what the text says about the model and the access.
(category: EffectCategory, text: string, args: string | null, language: Language | null, receiverType: string | null)
| 341 | |
| 342 | /** The category plus what the text says about the model and the access. */ |
| 343 | function withShape(category: EffectCategory, text: string, args: string | null, language: Language | null, receiverType: string | null): Effect { |
| 344 | if (category !== 'database') return { category }; |
| 345 | const out: Effect = { category }; |
| 346 | const segments = text.replace(/\([^()]*\)/g, '').split(/[.:]+/).filter(Boolean); |
| 347 | const last = segments[segments.length - 1] ?? ''; |
| 348 | const model = modelOf(segments, args, receiverType); |
| 349 | if (model) out.model = model; |
| 350 | const op = last.replace(/[!?]$/, ''); |
| 351 | if (op === 'exec' && language === 'python') out.access = 'read'; |
| 352 | else if (WRITE_OPS.test(op)) out.access = 'write'; |
| 353 | else if (READ_OPS.test(op)) out.access = 'read'; |
| 354 | return out; |
| 355 | } |
| 356 | |
| 357 | const MODEL_SUFFIX = /(?:Repository|Repo|Dao|DAO|Model|Mapper|Store|Collection|Table|Service|Entity|Manager)$/; |
| 358 |
no test coverage detected