@omnifyjp/ts 6.7.5 → 6.7.6
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.
- package/dist/php/orphan-cleanup.js +23 -0
- package/package.json +1 -1
|
@@ -119,6 +119,25 @@ export function pruneOrphanServiceFiles(configDir, config, generated) {
|
|
|
119
119
|
// The recursive walk skips the `OmnifyBase` subfolder (already covered
|
|
120
120
|
// by the base cleanup above) so we don't double-process or warn on
|
|
121
121
|
// base files masquerading as editable.
|
|
122
|
+
// Membership in `expectedAbs` is the WRONG test for an editable service, and
|
|
123
|
+
// was the whole defect: an editable service is sinh-1-lần, so once it exists
|
|
124
|
+
// this pass deliberately skips it and it is never in the generated set. Every
|
|
125
|
+
// editable service that had ever been created therefore reported itself
|
|
126
|
+
// orphan on every run — 28 of them here, each with a live `kind: object`
|
|
127
|
+
// schema that omnify was regenerating a base for in the very same pass, and
|
|
128
|
+
// each advertised as "safe to delete by hand" while holding the app's
|
|
129
|
+
// business logic.
|
|
130
|
+
//
|
|
131
|
+
// What actually marks a schema ineligible is the absence of its BASE: bases
|
|
132
|
+
// are regenerated wholesale every pass, so `<Name>ServiceBase.php` is in the
|
|
133
|
+
// generated set exactly while the schema still opts into service codegen.
|
|
134
|
+
const expectedBaseNames = new Set();
|
|
135
|
+
for (const abs of expectedAbs) {
|
|
136
|
+
const name = basename(abs);
|
|
137
|
+
if (name.endsWith('ServiceBase.php')) {
|
|
138
|
+
expectedBaseNames.add(name);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
122
141
|
const editableRoot = resolve(configDir, config.services.path);
|
|
123
142
|
walkServiceFiles(editableRoot, (path) => {
|
|
124
143
|
const name = basename(path);
|
|
@@ -128,6 +147,10 @@ export function pruneOrphanServiceFiles(configDir, config, generated) {
|
|
|
128
147
|
return;
|
|
129
148
|
if (expectedAbs.has(path))
|
|
130
149
|
return;
|
|
150
|
+
// `AbsenceService.php` → `AbsenceServiceBase.php`
|
|
151
|
+
const baseName = `${name.slice(0, -'Service.php'.length)}ServiceBase.php`;
|
|
152
|
+
if (expectedBaseNames.has(baseName))
|
|
153
|
+
return;
|
|
131
154
|
const head = readEditableServiceHead(path);
|
|
132
155
|
if (head === null || !looksLikeOmnifyEditableService(head))
|
|
133
156
|
return;
|