@appaflytech/zeyrek-ai-mcp 0.0.79 → 0.0.81
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/knowledge/platform/localApp.js +61 -0
- package/dist/knowledge/platform/mobileOffline.js +32 -8
- package/dist/resources/guides/mobile-local.md +22 -0
- package/dist/resources/guides/mobile-publish.md +2 -1
- package/dist/resources/guides/page.md +1 -1
- package/dist/tools/applications.js +3 -0
- package/dist/tools/localAppGuard.js +54 -17
- package/package.json +1 -1
|
@@ -109,6 +109,67 @@ export function localServiceFindings(stepLabel, definition) {
|
|
|
109
109
|
}
|
|
110
110
|
return findings;
|
|
111
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Platformun dosya tablosu (backend `Defaults.FileEntityId`). Karma uygulamada ortaktır: cihaz kapsamındadır ama tek başına
|
|
114
|
+
* bir servisi cihaz tarafına çekmez — dosya alanını birleştiren sunucu servisi sunucuda kalır (plans/karma-veri-yeri
|
|
115
|
+
* sözleşme §2, b-02 bulgusu; backend `LocalAppReadinessModel` aynı kuralı uygular).
|
|
116
|
+
*/
|
|
117
|
+
export const FILE_ENTITY_ID = '0191dbf2-39c4-76f5-8c56-46e2b74564da';
|
|
118
|
+
/**
|
|
119
|
+
* Servisin dokunduğu tablolar: kendi tablosu (`sourceParameters.entityId`) + bütün birleştirme hedefleri (`joins`, iç içe).
|
|
120
|
+
* Alan / süzgeç / sıralamadaki ilişki yolu yalnız bir birleştirme üstünden kurulur, ayrıca sayılmaz. Backend
|
|
121
|
+
* `MicroserviceRuntimeCacheDto.TouchedEntityIds` ile aynı küme (sözleşme §2).
|
|
122
|
+
*/
|
|
123
|
+
export function serviceTouchedEntities(definition) {
|
|
124
|
+
if (String(definition.source ?? '').toLowerCase() !== 'table')
|
|
125
|
+
return [];
|
|
126
|
+
const parameters = isRecord(definition.sourceParameters) ? definition.sourceParameters : {};
|
|
127
|
+
const touched = typeof parameters.entityId === 'string' ? [parameters.entityId] : [];
|
|
128
|
+
const pending = asRecords(parameters.joins);
|
|
129
|
+
while (pending.length > 0) {
|
|
130
|
+
const join = pending.shift();
|
|
131
|
+
if (typeof join.entityId === 'string')
|
|
132
|
+
touched.push(join.entityId);
|
|
133
|
+
pending.push(...asRecords(join.joins));
|
|
134
|
+
}
|
|
135
|
+
return [...new Set(touched.map(id => id.toLowerCase()))];
|
|
136
|
+
}
|
|
137
|
+
/** Karma uygulamada servisin yeri: hepsi cihaz kapsamındaysa `device`, hiçbiri (dosya tablosu hariç) değilse `server`. */
|
|
138
|
+
export function hybridServiceSide(definition, deviceEntities) {
|
|
139
|
+
const touched = serviceTouchedEntities(definition);
|
|
140
|
+
const device = new Set([...deviceEntities.map(id => id.toLowerCase()), FILE_ENTITY_ID]);
|
|
141
|
+
if (touched.length === 0 || !touched.some(id => id !== FILE_ENTITY_ID && device.has(id)))
|
|
142
|
+
return 'server';
|
|
143
|
+
return touched.every(id => device.has(id)) ? 'device' : 'mixed';
|
|
144
|
+
}
|
|
145
|
+
/** MOB-057: karma uygulamada cihaz tablosunu sunucu tablosuyla birleştiren servis tek yerde koşamaz. */
|
|
146
|
+
export function localMixedServiceFindings(stepLabel, definition, deviceEntities) {
|
|
147
|
+
if (hybridServiceSide(definition, deviceEntities) !== 'mixed')
|
|
148
|
+
return [];
|
|
149
|
+
const device = new Set([...deviceEntities.map(id => id.toLowerCase()), FILE_ENTITY_ID]);
|
|
150
|
+
const server = serviceTouchedEntities(definition).filter(id => !device.has(id));
|
|
151
|
+
return [{
|
|
152
|
+
ruleId: 'MOB-057',
|
|
153
|
+
severity: 'block',
|
|
154
|
+
message: `local_mixed_service: '${stepLabel}' adımının servisi '${String(definition.slug ?? definition.id ?? '?')}' bir cihaz tablosunu sunucu tablosuyla (${server.join(', ')}) birleştiriyor — karma uygulamada (properties.mobile.dataLocation: 'hybrid') servis ya cihazda ya sunucuda koşar, ikisinde birden koşamaz; derleme ön kontrolü de durur. Servisi ikiye bölün (biri cihaz tablolarında, biri sunucu tablolarında) ve sonuçları akışta birleştirin, ya da tabloları aynı tarafa alın (deviceEntities).`,
|
|
155
|
+
guide: GUIDE
|
|
156
|
+
}];
|
|
157
|
+
}
|
|
158
|
+
/** MOB-058: karma uygulamada sunucu tablosunun cihaz tablosunu gösteren ilişki alanı — sunucu o satırları hiç görmez. */
|
|
159
|
+
export function localCrossRelationFindings(entityLabel, applications, after, deviceEntities) {
|
|
160
|
+
const device = new Set(deviceEntities.map(id => id.toLowerCase()));
|
|
161
|
+
const crossing = asRecords(isRecord(after) ? after.fields : undefined)
|
|
162
|
+
.filter(field => typeof field.relationId === 'string' && device.has(field.relationId.toLowerCase()))
|
|
163
|
+
.map(fieldName);
|
|
164
|
+
if (crossing.length === 0)
|
|
165
|
+
return [];
|
|
166
|
+
return [{
|
|
167
|
+
ruleId: 'MOB-058',
|
|
168
|
+
severity: 'block',
|
|
169
|
+
message: `local_cross_relation: '${entityLabel}' sunucu tablosu karma uygulamada (${applications.join(', ')}) cihaz tablosunu gösteren alan taşıyor (${crossing.join(', ')}) — cihazdaki satırlar sunucuya hiç gitmez, bu alan sunucuda çözülemeyen id saklar; derleme ön kontrolü de durur. Alanı kaldırın ya da iki tabloyu aynı tarafta tutun: cihaz tablosu sunucu tablosunu gösterebilir, tersi olmaz.`,
|
|
170
|
+
guide: GUIDE
|
|
171
|
+
}];
|
|
172
|
+
}
|
|
112
173
|
/** Akışın sunucu isteyen adımları (MOB-052) ve bağlı `queued` dalı (MOB-053, uyarı). Servis tanımı gerekmez. */
|
|
113
174
|
export function localStepFindings(steps, errorSteps) {
|
|
114
175
|
const all = [...asRecords(steps), ...asRecords(errorSteps)];
|
|
@@ -43,17 +43,41 @@ export function mobileOfflineProblems(properties) {
|
|
|
43
43
|
}
|
|
44
44
|
return problems;
|
|
45
45
|
}
|
|
46
|
-
export const MOBILE_DATA_LOCATIONS = ['server', 'device'];
|
|
47
|
-
|
|
46
|
+
export const MOBILE_DATA_LOCATIONS = ['server', 'device', 'hybrid'];
|
|
47
|
+
const ENTITY_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
48
|
+
const mobileOf = (properties) => {
|
|
48
49
|
const mobile = properties?.mobile;
|
|
49
|
-
|
|
50
|
+
return mobile && typeof mobile === 'object' ? mobile : undefined;
|
|
51
|
+
};
|
|
52
|
+
/** Karma uygulamanın cihaz tabloları: yalnız `hybrid`'de okunur; GUID olmayan öğe atılır, id küçülür, tekrar bir kez. */
|
|
53
|
+
export function readMobileDeviceEntities(properties) {
|
|
54
|
+
const mobile = mobileOf(properties);
|
|
55
|
+
if (mobile?.dataLocation !== 'hybrid' || !Array.isArray(mobile.deviceEntities))
|
|
56
|
+
return [];
|
|
57
|
+
return [...new Set(mobile.deviceEntities.filter((id) => typeof id === 'string' && ENTITY_ID.test(id)).map(id => id.toLowerCase()))];
|
|
58
|
+
}
|
|
59
|
+
export function readMobileDataLocation(properties) {
|
|
60
|
+
const value = mobileOf(properties)?.dataLocation;
|
|
61
|
+
if (value === 'hybrid')
|
|
62
|
+
return readMobileDeviceEntities(properties).length > 0 ? 'hybrid' : 'server';
|
|
50
63
|
return value === 'device' ? 'device' : 'server';
|
|
51
64
|
}
|
|
52
|
-
/** MOB-049: okuyucunun sessizce `server`'a düşürdüğü yazılmış değer. Yazım yine platforma gider. */
|
|
65
|
+
/** MOB-049: okuyucunun sessizce `server`'a düşürdüğü ya da kısalttığı yazılmış değer. Yazım yine platforma gider. */
|
|
53
66
|
export function mobileDataLocationProblems(properties) {
|
|
54
|
-
const mobile = properties
|
|
55
|
-
const value = mobile
|
|
56
|
-
if (value === undefined || value === null
|
|
67
|
+
const mobile = mobileOf(properties);
|
|
68
|
+
const value = mobile?.dataLocation;
|
|
69
|
+
if (value === undefined || value === null)
|
|
70
|
+
return [];
|
|
71
|
+
if (!MOBILE_DATA_LOCATIONS.includes(value)) {
|
|
72
|
+
return [`properties.mobile.dataLocation ${JSON.stringify(value)} kümede değil (${MOBILE_DATA_LOCATIONS.join(' | ')}) — cihaz okumaz, uygulama 'server' (veri sunucuda) kalır. Yerel uygulama için tam 'device', karma uygulama için 'hybrid' + deviceEntities yazın`];
|
|
73
|
+
}
|
|
74
|
+
if (value !== 'hybrid')
|
|
57
75
|
return [];
|
|
58
|
-
|
|
76
|
+
const raw = Array.isArray(mobile?.deviceEntities) ? mobile.deviceEntities : [];
|
|
77
|
+
const kept = readMobileDeviceEntities(properties);
|
|
78
|
+
if (kept.length === 0) {
|
|
79
|
+
return [`properties.mobile.dataLocation 'hybrid' geçerli bir deviceEntities listesi olmadan yazıldı (gelen: ${JSON.stringify(mobile?.deviceEntities)}) — karma uygulama en az bir entity id ister; okuyucu 'server'a düşürür, bütün tablolar sunucuda kalır`];
|
|
80
|
+
}
|
|
81
|
+
const dropped = raw.filter(id => !(typeof id === 'string' && ENTITY_ID.test(id)));
|
|
82
|
+
return dropped.length > 0 ? [`properties.mobile.deviceEntities içinde entity id olmayan öğe var (${dropped.map(id => JSON.stringify(id)).join(', ')}) — yok sayılır; yalnız 8-4-4-4-12 biçimli GUID okunur`] : [];
|
|
59
83
|
}
|
|
@@ -105,3 +105,25 @@ Tam gövde: `ngapps://examples/flow-local-backup`.
|
|
|
105
105
|
Studio önizlemesi yerel uygulamada bellek içi veritabanıyla koşar: önizlemede yazılan kayıt sunucu tablosuna gitmez,
|
|
106
106
|
`row_list` boş döner. "Cihazda dene" uygulama başına ayrı bir cihaz veritabanı kullanır ve "verileri sıfırla" ile
|
|
107
107
|
temizlenir.
|
|
108
|
+
|
|
109
|
+
## Karma uygulama
|
|
110
|
+
|
|
111
|
+
**Karma uygulama**, bazı tabloları cihazda, ötekileri sunucuda tutan mobil uygulamadır (kök ADR 0039): saha formu
|
|
112
|
+
cihazda, ürün kataloğu sunucuda gibi. Her tablonun tek yeri vardır; aynı tablo iki yerde durmaz, eşitleme yoktur.
|
|
113
|
+
|
|
114
|
+
- **Açma:** `properties.mobile.dataLocation: 'hybrid'` + `deviceEntities: ['<entity id>', …]` (8-4-4-4-12 GUID).
|
|
115
|
+
Geçerli id'si olmayan `hybrid` `'server'` okunur ve MOB-049 uyarısı alır. Listeye yalnız ana tablolar yazılır; dil,
|
|
116
|
+
çoktan çoğa ara ve değer tabloları ile dosya tablosu sahibini izler.
|
|
117
|
+
- **Servisin yeri tablodan çıkar:** kendi tablosu (`sourceParameters.entityId`) + birleştirme hedefleri (`joins`).
|
|
118
|
+
Hepsi cihazdaysa servis cihazda koşar ve bu rehberin yerel kuralları (MOB-051/052/053) ona uygulanır; hiçbiri
|
|
119
|
+
cihazda değilse sunucuda koşar, sunucu servisinin önbelleği ve yazma kuyruğu geçerlidir (`platform_guide('page')`
|
|
120
|
+
§Kural 1g-4). İkisine birden dokunan servis durur: **MOB-057** `local_mixed_service` — servisi ikiye bölüp sonucu
|
|
121
|
+
akışta birleştirin.
|
|
122
|
+
- **İlişki yönü:** cihaz tablosu sunucu tablosunu gösterebilir (yalnız id saklanır; görünen adı ayrı bir sunucu
|
|
123
|
+
servisiyle okuyun, cihaz servisi o tabloyu birleştiremez). Sunucu tablosu cihaz tablosunu gösteremez: **MOB-058**
|
|
124
|
+
`local_cross_relation`.
|
|
125
|
+
- **Kabuk sunucu kabuğudur:** giriş, push, satın alma, sosyal giriş ve middleware'li sayfa açıktır; `local-backup` /
|
|
126
|
+
`local-restore` yalnız cihaz tablolarını taşır. K4 (MOB-054) yalnız cihaz tablolarına uygulanır.
|
|
127
|
+
- **Durum (2026-11-12):** tasarım, gateway denetimi, paket ve derleme ön kontrolü hazır. Kabukların karma kipi
|
|
128
|
+
(`hybridApp`, kabuk 0.18.0) ve Studio'daki tablo seçicisi henüz yok (plans/karma-veri-yeri f-01…f-03): karma
|
|
129
|
+
uygulama bugün derlenemez, çalışan kabuk onu sunucu uygulaması gibi açar.
|
|
@@ -216,7 +216,8 @@ ve her yeteneği `mobile_store_get`'in `shell` alanı söyler (`shell.capabiliti
|
|
|
216
216
|
| `deviceInstallationId` | 0.14.0 | `platform_guide('workflow')` §Push adımı | `Device.installationId` `undefined`: kurulum kimliğine push hedeflenemez |
|
|
217
217
|
| `signIn` | 0.15.0 | §Giriş | manifeste `signIn` bloğu yazılmaz, `sign-in-with` `unsupported` döner; ön kontrol P-34 `warn sign_in_shell_outdated` |
|
|
218
218
|
| `devicePlatform` | 0.17.0 | `platform_guide('expressions')` §2 | `Device.platform` `undefined`: platforma göre gizleme çalışmaz; ifade `=== 'android'` biçiminde yazıldıysa varsayılan görünüm kalır |
|
|
219
|
-
| `localApp` | 0.
|
|
219
|
+
| `localApp` | 0.18.0 | `platform_guide('mobile-local')` | derlenmez (`manifest_invalid`) |
|
|
220
|
+
| `hybridApp` | 0.18.0 | `platform_guide('mobile-local')` | derlenmez (`manifest_invalid`) |
|
|
220
221
|
|
|
221
222
|
Lokal yığının derleme varsayılanı daha eski olabilir; telefondaki sürümü tahmin etmeyin, `shell.version`'dan okuyun.
|
|
222
223
|
|
|
@@ -1513,7 +1513,7 @@ Web uygulamasında alan yoktur.
|
|
|
1513
1513
|
|
|
1514
1514
|
Mobil uygulama ağ yokken iki şeyi cihazdaki kopyadan açar. Hangisinin açık olduğu uygulamanın ayarıdır:
|
|
1515
1515
|
`application_update` `properties.mobile.offline` (`properties.mobile.tabs`'in yanındaki anahtar). Gövde REPLACE'tir:
|
|
1516
|
-
`application_get`'teki `properties`'in TAMAMI aynen gönderilir, yalnız `offline` eklenir — eksik anahtar silinir. Studio'da
|
|
1516
|
+
`application_get`'teki `properties`'in TAMAMI aynen gönderilir, yalnız `offline` eklenir — eksik anahtar silinir. Studio'da uygulama Ayarlar panelinin "Çevrimdışı" bölümü (Ayarlar › Çevrimdışı, Güncelle ile kaydeder) aynı alanı yazar; Nav Bar panelinde yalnız kipin özeti ve "Ayarlar'da değiştir" bağlantısı kalır.
|
|
1517
1517
|
|
|
1518
1518
|
| Alan | Değer | Varsayılan | Ne saklanır |
|
|
1519
1519
|
|---|---|---|---|
|
|
@@ -79,6 +79,9 @@ export function mobileDataLocationWarnings(properties) {
|
|
|
79
79
|
}
|
|
80
80
|
/** `device` yazan mobil uygulama çağrısının yanıt notu: yerel uygulamanın kapsamı bir kez, yazım anında söylenir. */
|
|
81
81
|
function localAppNote(isMobile, properties) {
|
|
82
|
+
if (isMobile && readMobileDataLocation(properties) === 'hybrid') {
|
|
83
|
+
return { localAppNote: "Karma uygulama (dataLocation: 'hybrid', kök ADR 0039): deviceEntities'teki tablolar ve yan tabloları yalnız cihazda, öteki her tablo sunucuda. Servisin yeri kendi tablosu + birleştirmelerinden çıkar: hepsi cihazdaysa cihazda koşar ve yerel kurallar (MOB-051/052) ona uygulanır, iki tarafa birden dokunan servis durur (MOB-057), sunucu tablosundan cihaz tablosuna ilişki durur (MOB-058). Kabuk sunucu kabuğudur: giriş, push, satın alma açık. Tablonun yerini değiştirmek kayıtlarını taşımaz. Tarif: platform_guide('mobile-local')." };
|
|
84
|
+
}
|
|
82
85
|
if (!isMobile || readMobileDataLocation(properties) !== 'device')
|
|
83
86
|
return {};
|
|
84
87
|
return { localAppNote: "Yerel uygulama (dataLocation: 'device'): veri yalnız cihazda, yalnız table kaynaklı servis cihazda koşar; query/workflow/view servisi, header ya da user/token okuyan parametre, middleware, satın alma, sosyal giriş ve satır otomasyonu yazımda durur (MOB-050…052), yerel uygulamanın entity'sinde alan silinmez, tipi değişmez (MOB-054). Sunucudaki kayıtlar cihaza taşınmaz. Tarif: platform_guide('mobile-local')." };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { applyPolicyMode, enforcePolicy } from '../knowledge/policy.js';
|
|
2
|
-
import { readMobileDataLocation } from '../knowledge/platform/mobileOffline.js';
|
|
2
|
+
import { readMobileDataLocation, readMobileDeviceEntities } from '../knowledge/platform/mobileOffline.js';
|
|
3
3
|
import { resolveProfile } from '../knowledge/platform/resolve.js';
|
|
4
|
-
import { localAutomationFindings, localMiddlewareFindings, localSchemaChangeFindings, localServiceFindings, localStepFindings, serverAppLocalStepFindings, unscaledNumberFindings } from '../knowledge/platform/localApp.js';
|
|
4
|
+
import { hybridServiceSide, localAutomationFindings, localCrossRelationFindings, localMiddlewareFindings, localMixedServiceFindings, localSchemaChangeFindings, localServiceFindings, localStepFindings, serverAppLocalStepFindings, unscaledNumberFindings } from '../knowledge/platform/localApp.js';
|
|
5
5
|
import { RefResolver, isGuid } from '../platform/refs.js';
|
|
6
6
|
/**
|
|
7
|
-
* Yerel uygulama kapısı (kök ADR 0038, MOB-050…
|
|
7
|
+
* Yerel ve karma uygulama kapısı (kök ADR 0038, 0039; MOB-050…058): kuralların platform okuması. Kural kümesi saf ve
|
|
8
8
|
* `knowledge/platform/localApp.ts`'tedir. Okunamayan uygulama, servis ya da entity bulgu üretmez — bilmediğimizi ret diye
|
|
9
9
|
* söylemeyiz; derleme ön kontrolü (backend b-02) aynı bağı yine durdurur. Engelleyen bulgu yazımdan ÖNCE
|
|
10
10
|
* `applyPolicyMode` + `enforcePolicy` ile uygulanır (FLOW-045 kalıbı): `policyOverride` ve `POLICY=warn` uyarıya indirir.
|
|
@@ -15,14 +15,38 @@ export function enforceLocal(config, findings, policyOverride) {
|
|
|
15
15
|
export function isLocalApplication(resolved) {
|
|
16
16
|
return resolved.known && resolved.profile.platform === 'mobile' && readMobileDataLocation(resolved.application?.properties) === 'device';
|
|
17
17
|
}
|
|
18
|
-
/**
|
|
18
|
+
/** Karma mobil uygulamanın cihaz tabloları (kök ADR 0039); karma değilse `undefined`. */
|
|
19
|
+
export function hybridDeviceEntities(resolved) {
|
|
20
|
+
if (!resolved.known || resolved.profile.platform !== 'mobile' || readMobileDataLocation(resolved.application?.properties) !== 'hybrid')
|
|
21
|
+
return undefined;
|
|
22
|
+
return readMobileDeviceEntities(resolved.application?.properties);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Akış yazımı: sunucu isteyen adım, tablo dışı / sunucu parametreli / rollü servis bağı, `queued` dalı; sunucu verili mobil
|
|
26
|
+
* uygulamada yedek adımı (MOB-056). Karma uygulamada (kök ADR 0039) kabuk sunucu kabuğudur: adım düzeyi sunucu yetenekleri
|
|
27
|
+
* serbesttir, yerel kurallar yalnız cihazda koşan servise uygulanır, iki tarafa dokunan servis MOB-057'dir.
|
|
28
|
+
*/
|
|
19
29
|
export async function localFlowFindings(platform, applicationId, steps, errorSteps, readService) {
|
|
20
30
|
const resolved = await resolveProfile(platform, applicationId);
|
|
31
|
+
const deviceEntities = hybridDeviceEntities(resolved);
|
|
32
|
+
const serviceSteps = [...(Array.isArray(steps) ? steps : []), ...(Array.isArray(errorSteps) ? errorSteps : [])]
|
|
33
|
+
.filter((step) => Boolean(step) && typeof step === 'object' && String(step.type ?? '') === 'microservice');
|
|
34
|
+
if (deviceEntities) {
|
|
35
|
+
const findings = [];
|
|
36
|
+
for (const step of serviceSteps) {
|
|
37
|
+
const microserviceId = step.args?.microserviceId;
|
|
38
|
+
const definition = typeof microserviceId === 'string' ? await readService(microserviceId) : undefined;
|
|
39
|
+
const side = definition ? hybridServiceSide(definition, deviceEntities) : 'server';
|
|
40
|
+
if (definition && side === 'mixed')
|
|
41
|
+
findings.push(...localMixedServiceFindings(String(step.stepId ?? step.name ?? '?'), definition, deviceEntities));
|
|
42
|
+
if (definition && side === 'device')
|
|
43
|
+
findings.push(...localServiceFindings(String(step.stepId ?? step.name ?? '?'), definition), ...localStepFindings([step], []).filter(finding => finding.ruleId === 'MOB-053'));
|
|
44
|
+
}
|
|
45
|
+
return findings;
|
|
46
|
+
}
|
|
21
47
|
if (!isLocalApplication(resolved))
|
|
22
48
|
return resolved.known && resolved.profile.platform === 'mobile' ? serverAppLocalStepFindings(steps, errorSteps) : [];
|
|
23
49
|
const findings = localStepFindings(steps, errorSteps);
|
|
24
|
-
const serviceSteps = [...(Array.isArray(steps) ? steps : []), ...(Array.isArray(errorSteps) ? errorSteps : [])]
|
|
25
|
-
.filter((step) => Boolean(step) && typeof step === 'object' && String(step.type ?? '') === 'microservice');
|
|
26
50
|
for (const step of serviceSteps) {
|
|
27
51
|
const microserviceId = step.args?.microserviceId;
|
|
28
52
|
const definition = typeof microserviceId === 'string' ? await readService(microserviceId) : undefined;
|
|
@@ -39,20 +63,27 @@ export async function localPageFindings(platform, applicationId, where, middlewa
|
|
|
39
63
|
return [];
|
|
40
64
|
return localMiddlewareFindings(where, middlewareIds);
|
|
41
65
|
}
|
|
42
|
-
/**
|
|
43
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Entity'nin bağlı olduğu yerel ve karma uygulamalar (`applications: [{ applicationId }]` okuma şekli). Karma uygulamada
|
|
68
|
+
* `deviceEntities` taşınır: entity listedeyse o uygulamanın cihaz tablosudur (K4 kilidi, otomasyon), değilse sunucu
|
|
69
|
+
* tablosudur (MOB-058 sınırı).
|
|
70
|
+
*/
|
|
71
|
+
async function localBindingsOf(platform, entity) {
|
|
44
72
|
const bindings = Array.isArray(entity?.applications) ? entity.applications : [];
|
|
45
73
|
const ids = bindings
|
|
46
74
|
.map(binding => typeof binding === 'string' ? binding : binding?.applicationId)
|
|
47
75
|
.filter((id) => typeof id === 'string');
|
|
48
|
-
const
|
|
76
|
+
const local = [];
|
|
49
77
|
for (const id of ids) {
|
|
50
78
|
const resolved = await resolveProfile(platform, id);
|
|
51
|
-
|
|
52
|
-
|
|
79
|
+
const deviceEntities = hybridDeviceEntities(resolved);
|
|
80
|
+
if (isLocalApplication(resolved) || deviceEntities)
|
|
81
|
+
local.push({ name: resolved.application?.slug ?? id, deviceEntities });
|
|
53
82
|
}
|
|
54
|
-
return
|
|
83
|
+
return local;
|
|
55
84
|
}
|
|
85
|
+
/** Entity'yi cihazda tutan uygulamaların adları: yerel uygulamalar + entity'yi listesinde taşıyan karma uygulamalar. */
|
|
86
|
+
const deviceOwners = (bindings, entityId) => bindings.filter(binding => !binding.deviceEntities || binding.deviceEntities.includes(entityId)).map(binding => binding.name);
|
|
56
87
|
/** Kayıtlı entity tanımı; okunamazsa `undefined`. */
|
|
57
88
|
export async function readEntity(platform, project, environment, datasourceId, id) {
|
|
58
89
|
try {
|
|
@@ -68,14 +99,20 @@ export async function readEntity(platform, project, environment, datasourceId, i
|
|
|
68
99
|
export async function localEntityFindings(platform, before, after) {
|
|
69
100
|
if (!before)
|
|
70
101
|
return [];
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
102
|
+
const bindings = await localBindingsOf(platform, before);
|
|
103
|
+
const entityId = String(before.id ?? '').toLowerCase();
|
|
104
|
+
const applications = deviceOwners(bindings, entityId);
|
|
74
105
|
const label = String(before.slug ?? before.name ?? before.id ?? '?');
|
|
75
|
-
|
|
106
|
+
const crossing = bindings
|
|
107
|
+
.filter(binding => binding.deviceEntities && !binding.deviceEntities.includes(entityId))
|
|
108
|
+
.flatMap(binding => localCrossRelationFindings(label, [binding.name], after, binding.deviceEntities));
|
|
109
|
+
return [
|
|
110
|
+
...(applications.length === 0 ? [] : [...localSchemaChangeFindings(label, applications, before, after), ...unscaledNumberFindings(label, before, after)]),
|
|
111
|
+
...crossing
|
|
112
|
+
];
|
|
76
113
|
}
|
|
77
114
|
/** Otomasyon yazımı: yerel uygulamanın entity'sine satır otomasyonu (MOB-052). */
|
|
78
115
|
export async function localAutomationGuard(platform, entity) {
|
|
79
|
-
const applications = await
|
|
116
|
+
const applications = deviceOwners(await localBindingsOf(platform, entity), String(entity?.id ?? '').toLowerCase());
|
|
80
117
|
return applications.length === 0 ? [] : localAutomationFindings(String(entity?.slug ?? entity?.name ?? entity?.id ?? '?'), applications);
|
|
81
118
|
}
|
package/package.json
CHANGED