@appaflytech/zeyrek-ai-mcp 0.0.63 → 0.0.65
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/access.js +29 -0
- package/dist/knowledge/componentCatalog.js +1 -1
- package/dist/knowledge/componentEvents.js +5 -2
- package/dist/knowledge/previewLimits.js +72 -0
- package/dist/knowledge/rules.js +256 -4
- package/dist/knowledge/storeImport.js +22 -0
- package/dist/platform/bodyFile.js +22 -87
- package/dist/platform/capture/actions.js +43 -1
- package/dist/platform/capture/capture.js +84 -13
- package/dist/platform/localFiles.js +197 -0
- package/dist/platform/responses.js +2 -2
- package/dist/platform/storeArt/deck.js +22 -15
- package/dist/platform/storeArt/gallery.js +11 -4
- package/dist/resources/examples/workflow-push-own-profile.json +100 -0
- package/dist/resources/guides/deployment.md +32 -0
- package/dist/resources/guides/entity.md +2 -0
- package/dist/resources/guides/expressions.md +4 -2
- package/dist/resources/guides/microservice.md +7 -3
- package/dist/resources/guides/mobile-publish.md +25 -5
- package/dist/resources/guides/mobile-steps.md +19 -1
- package/dist/resources/guides/mobile.md +6 -6
- package/dist/resources/guides/translation.md +6 -0
- package/dist/resources/guides/workflow.md +23 -5
- package/dist/resources/schema-fingerprint.json +3 -3
- package/dist/tools/applications.js +1 -1
- package/dist/tools/bpmGovernance.js +22 -19
- package/dist/tools/bpmReporting.js +6 -3
- package/dist/tools/case.js +10 -14
- package/dist/tools/common.js +1 -1
- package/dist/tools/decisions.js +10 -14
- package/dist/tools/deployments.js +160 -18
- package/dist/tools/externalComponents.js +28 -27
- package/dist/tools/files.js +15 -14
- package/dist/tools/mobileStore.js +22 -13
- package/dist/tools/mobileStoreImport.js +22 -12
- package/dist/tools/pages.js +32 -11
- package/dist/tools/queries.js +15 -2
- package/dist/tools/rows.js +70 -33
- package/dist/tools/translations.js +16 -18
- package/dist/tools/workflows.js +13 -6
- package/package.json +1 -1
package/dist/tools/rows.js
CHANGED
|
@@ -13,8 +13,8 @@ import { PlatformApiError } from '../platform/errors.js';
|
|
|
13
13
|
import { secretKeyPattern } from '../platform/secrets.js';
|
|
14
14
|
import { csvRows } from '../platform/csv.js';
|
|
15
15
|
import { rowFilterSchema } from '../knowledge/rowFilter.js';
|
|
16
|
-
import {
|
|
17
|
-
import { extname
|
|
16
|
+
import { readLocalFile, resolveLocalOutput, writeLocalOutput } from '../platform/localFiles.js';
|
|
17
|
+
import { extname } from 'node:path';
|
|
18
18
|
import { jsonArray } from '../platform/jsonArray.js';
|
|
19
19
|
import { z } from 'zod';
|
|
20
20
|
const rowValues = z.record(z.unknown()).describe("Alan SLUG'ı → değer sözlüğü; anahtarlar entity_get çıktısındaki field SLUG'larıdır (name değil — name kullanmak 'Please enter a valid value' hatası verir)");
|
|
@@ -53,7 +53,7 @@ const bulkBatchSize = 1000;
|
|
|
53
53
|
const maxPathBytes = 50 * 1024 * 1024;
|
|
54
54
|
const maxPathRows = 100_000;
|
|
55
55
|
const pathParam = z.string().min(1).optional()
|
|
56
|
-
.describe("
|
|
56
|
+
.describe("Yerel `.json` (satır dizisi) ya da `.csv` dosyası, gateway'in çalışma dizininin ya da .env MCP_INPUT_DIR'in altında (göreli yol MCP_INPUT_DIR'e göre çözülür); 'row'/'rows' ile birlikte verilmez. Satırlar ajan bağlamından HİÇ geçmez: gateway dosyayı okur, 1000'lik partilere böler ve ardışık toplu çağrı yapar; yanıt { written, batches, ids (platform döndürdüyse ilk 10), truncated } — tam id listesi için row_list. CSV ayracı ilk satırdan bulunur (`;` sayısı `,` sayısını geçerse `;`), değerler string gider ve tipe backend çevirir. 50 MB / 100.000 satır üstü reddedilir — o boyut import_analyze zinciridir.");
|
|
57
57
|
const relationsByNameParam = z.boolean().optional()
|
|
58
58
|
.describe("İlişki alanlarına id yerine GÖRÜNEN AD yazmayı açar: 'departman: \"Satış\"' hedef tablonun display ya da benzersiz alanında aranır ve id'ye çevrilir. Yalnız toplu yolda (rows / path) çalışır. Eşleşmeyen değer 422 döndürür ve hangi satırın hangi alanı olduğunu söyler — sessizce boş bırakmaz.");
|
|
59
59
|
/**
|
|
@@ -72,23 +72,20 @@ function collectIds(payload, into) {
|
|
|
72
72
|
if (Array.isArray(data))
|
|
73
73
|
into.push(...data);
|
|
74
74
|
}
|
|
75
|
-
async function readRowsFromPath(tool, path) {
|
|
76
|
-
const
|
|
77
|
-
const extension = extname(absolute).toLowerCase();
|
|
75
|
+
async function readRowsFromPath(tool, path, config) {
|
|
76
|
+
const extension = extname(path).toLowerCase();
|
|
78
77
|
if (extension !== '.json' && extension !== '.csv') {
|
|
79
|
-
throw new PlatformApiError(`${tool}: \`path\` yalnız .json ya da .csv okur — verilen: ${
|
|
78
|
+
throw new PlatformApiError(`${tool}: \`path\` yalnız .json ya da .csv okur — verilen: ${path}`);
|
|
80
79
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
const text = await readFile(absolute, 'utf8');
|
|
80
|
+
// g-12 (DD-23): izinli köklerden okunur (localFiles), göreli yol MCP_INPUT_DIR'e göre; sınır okunurken denetlenir.
|
|
81
|
+
const read = await readLocalFile(tool, path, {
|
|
82
|
+
label: 'dosya',
|
|
83
|
+
extensions: ['.json', '.csv'],
|
|
84
|
+
maxBytes: maxPathBytes,
|
|
85
|
+
tooLarge: (_real, size) => `${maxPathBytes} bayt sınırını aşıyor (${size} B). Bu boyut satır yazma yolu değil içe aktarma zinciridir — import_analyze → import_plan → import_run.`
|
|
86
|
+
}, config);
|
|
87
|
+
const absolute = read.real;
|
|
88
|
+
const text = read.buffer.toString('utf8');
|
|
92
89
|
let rows;
|
|
93
90
|
if (extension === '.csv') {
|
|
94
91
|
rows = csvRows(text);
|
|
@@ -161,6 +158,34 @@ async function writeInBatches(platform, method, project, environment, headers, e
|
|
|
161
158
|
* Üç kaynaktan tam olarak biri: gövdedeki tek satır, gövdedeki dizi ya da dosya. İkisi birden
|
|
162
159
|
* verilirse hangisinin yazılacağı belirsizdir ve sessizce birini seçmek yanlış veri yazar.
|
|
163
160
|
*/
|
|
161
|
+
/**
|
|
162
|
+
* g-11 (derdini-dok DD-22): row_get/row_delete üst düzey `id` alır, row_update kimliği satırın içinde istiyordu. PK slug'ı
|
|
163
|
+
* `id` olmak zorunda değildir (`UpdateRowCommand.cs:48` `entityDto.PrimaryKey()`); row_create'in dil yolundaki PK okumasıyla
|
|
164
|
+
* aynı kalıp. Satırda farklı bir PK değeri varsa hangisinin geçerli olduğu belirsizdir, çağrı gitmez.
|
|
165
|
+
*/
|
|
166
|
+
async function mapIdToPrimaryKey(resolver, entityId, id, row) {
|
|
167
|
+
const entity = await resolver.entity(entityId);
|
|
168
|
+
const primaryKey = (await resolver.entityFields(entity)).find(field => field.primaryKey);
|
|
169
|
+
if (!primaryKey)
|
|
170
|
+
throw new Error("row_update: tablonun birincil anahtarı okunamadı, 'id' eşlenemedi — PK alanını 'row' içine yazın.");
|
|
171
|
+
const current = row[primaryKey.slug];
|
|
172
|
+
// İnceleme 2026-11-05: GUID PK harf büyüklüğünden bağımsızdır (backend küçük harf döner, ajan büyük harfle yazabilir);
|
|
173
|
+
// yalnız iki taraf da GUID biçimindeyse büyüklük yok sayılır — slug/kod PK'de 'A' ile 'a' farklı satırdır.
|
|
174
|
+
const guidShaped = (value) => /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(String(value));
|
|
175
|
+
const same = String(current) === String(id) || (guidShaped(current) && guidShaped(id) && String(current).toLowerCase() === String(id).toLowerCase());
|
|
176
|
+
if (current !== undefined && current !== null && !same) {
|
|
177
|
+
throw new Error(`row_update: 'id' (${String(id)}) ile 'row' içindeki birincil anahtar '${primaryKey.slug}' (${String(current)}) çelişiyor — hangisinin güncelleneceği belirsiz, birini verin.`);
|
|
178
|
+
}
|
|
179
|
+
return { row: { ...row, [primaryKey.slug]: current ?? id }, slug: primaryKey.slug };
|
|
180
|
+
}
|
|
181
|
+
/** g-11 (DD-21): `meta.pageIndex + 1 < meta.totalPage` ise sonraki sayfanın indeksi yanıtın üstüne yazılır. */
|
|
182
|
+
function withNextPageIndex(payload) {
|
|
183
|
+
if (!payload || typeof payload !== 'object' || Array.isArray(payload))
|
|
184
|
+
return payload;
|
|
185
|
+
const meta = payload.meta;
|
|
186
|
+
const next = typeof meta?.pageIndex === 'number' && typeof meta.totalPage === 'number' && meta.pageIndex + 1 < meta.totalPage ? meta.pageIndex + 1 : undefined;
|
|
187
|
+
return next === undefined ? payload : { ...payload, nextPageIndex: next };
|
|
188
|
+
}
|
|
164
189
|
function assertOneSource(tool, row, rows, path) {
|
|
165
190
|
const given = [row, rows, path].filter(value => value !== undefined).length;
|
|
166
191
|
if (given === 1)
|
|
@@ -245,7 +270,8 @@ export function registerRowTools(server, platform) {
|
|
|
245
270
|
filters: rowFiltersParam,
|
|
246
271
|
language: languageParam,
|
|
247
272
|
includeTranslations: includeTranslationsParam,
|
|
248
|
-
...pagingParams
|
|
273
|
+
...pagingParams,
|
|
274
|
+
pageLength: pagingParams.pageLength.describe("Sayfa boyu, en çok 200 (gateway sınırı); platform varsayılanı 10. Devamı pageIndex ile okunur: yanıtın meta.totalPage/totalData'sı toplamı, nextPageIndex sonraki sayfanın indeksini verir (son sayfada yoktur). Tablonun tamamı için row_export.")
|
|
249
275
|
},
|
|
250
276
|
annotations: readOnly
|
|
251
277
|
}, handle(config, async ({ project, environment, entityId, language, ...body }) => {
|
|
@@ -259,7 +285,7 @@ export function registerRowTools(server, platform) {
|
|
|
259
285
|
// PROT-001 / PROT-002: korumalı alanda metin araması ve sıralama platformda 400'dür; entity
|
|
260
286
|
// yalnız riskli bir işleç ya da sıralama varsa okunur.
|
|
261
287
|
const protectionFindings = enforcePolicy(applyPolicyMode(config, await protectedFilterFindings(platform, resolver, entityId, body)), false);
|
|
262
|
-
const payload = await platform.tenant('POST', project, `/entities/${resolvedEntityId}/row/list`, { environment, body, headers });
|
|
288
|
+
const payload = withNextPageIndex(await platform.tenant('POST', project, `/entities/${resolvedEntityId}/row/list`, { environment, body, headers }));
|
|
263
289
|
const wanted = body.selectedFields ?? [];
|
|
264
290
|
const rows = payload && typeof payload === 'object' && !Array.isArray(payload) ? payload.data : undefined;
|
|
265
291
|
if (!wanted.length || !Array.isArray(rows))
|
|
@@ -315,7 +341,7 @@ export function registerRowTools(server, platform) {
|
|
|
315
341
|
const notes = [];
|
|
316
342
|
const headers = languageHeader(language, notes);
|
|
317
343
|
const wantedLocalizations = localizations && Object.keys(localizations).length > 0 ? localizations : undefined;
|
|
318
|
-
const fileRows = path ? await readRowsFromPath('row_create', path) : undefined;
|
|
344
|
+
const fileRows = path ? await readRowsFromPath('row_create', path, config) : undefined;
|
|
319
345
|
const bulkRows = rows ?? fileRows;
|
|
320
346
|
const inputFindings = enforcePolicy(evaluatePolicy(config, policyRules, 'row', { entityId, ...(bulkRows ? { rows: bulkRows } : { row }) }, { operation: 'create' }), false);
|
|
321
347
|
const resolver = new RefResolver(platform, project, environment);
|
|
@@ -361,11 +387,13 @@ export function registerRowTools(server, platform) {
|
|
|
361
387
|
}));
|
|
362
388
|
server.registerTool('row_update', {
|
|
363
389
|
title: 'Satır güncelle',
|
|
364
|
-
description: "Tek satır için 'row', çoklu güncelleme için 'rows' verin;
|
|
390
|
+
description: "Tek satır için 'row', çoklu güncelleme için 'rows' verin. Tek satırın kimliği üst düzey 'id' ile verilebilir (row_get/row_delete gibi): gateway değeri tablonun birincil anahtar slug'ına yazar — PK slug'ı 'id' olmayabilir — ve yanıtta idMappedTo ile söyler; 'row' içinde farklı bir PK değeri varsa çağrı gitmez. 'id' yoksa PK alanı 'row'un içinde olmalıdır; toplu güncellemede her satır kendi PK'sını taşır. 'rows' TEK TRANSACTION'da yazılır: bir satır düşerse HİÇBİRİ yazılmaz ve hata hangi satır indeksinin düştüğünü söyler. Automation'lar satır BAŞINA tetiklenir — sync (isQueue:true) automation'lar aynı transaction'da satır satır koşar. Tek çağrıda en çok 1000 satır. Aynı sınır row_create'te olduğu gibi geçerlidir: var olan satırlardan HESAPLANAN toplu güncelleme (durum/toplam/damga backfill'i) kayıtlı bir 'UPDATE … FROM' sorgusuna aittir — platform_guide('entity') §'Toplu ve türetilmiş satır'. Çeviri güncellemek için 'localizations: { tr: {…}, en: {…} }' verin — ana satır hiç değişmese de yalnız çeviriler yazılabilir. TOPLU güncellemede aynı nesne satırın KENDİ içine konur ('rows: [{ id: 1, localizations: { tr: {…} } }]'); 'row' içindeki düz çok dilli slug İSTEK DİLİNE yazılır.",
|
|
365
391
|
inputSchema: {
|
|
366
392
|
project: projectParam,
|
|
367
393
|
environment: environmentParam,
|
|
368
394
|
entityId: entityRef,
|
|
395
|
+
id: z.union([z.string().min(1), z.number()]).optional()
|
|
396
|
+
.describe("Tek satırın birincil anahtar değeri (yalnız 'row' ile). Gateway tablonun PK slug'ına yazar; yanıt idMappedTo taşır."),
|
|
369
397
|
row: rowValues.optional(),
|
|
370
398
|
rows: z.array(z.record(z.unknown())).optional(),
|
|
371
399
|
path: pathParam,
|
|
@@ -376,20 +404,25 @@ export function registerRowTools(server, platform) {
|
|
|
376
404
|
.describe("Satır olayının DIŞINDAN automation'a geçirilecek değerler. Tetiklenen automation bunları ifadelerinde `rowContext.<anahtar>` ile okur — zaman damgası, göç kaynağı, toplu iş kimliği gibi. Tarihsel (geçmiş tarihli) veri üretmenin yolu budur: automation `UtcNow()` yerine `rowContext.occurredAt`'i yazabilir. Verilmezse automation bağlamı değişmez.")
|
|
377
405
|
},
|
|
378
406
|
annotations: updates
|
|
379
|
-
}, handle(config, async ({ project, environment, entityId, row, rows, path, relationsByName, localizations, rowContext, language }) => {
|
|
380
|
-
|
|
381
|
-
|
|
407
|
+
}, handle(config, async ({ project, environment, entityId, id, row: givenRow, rows, path, relationsByName, localizations, rowContext, language }) => {
|
|
408
|
+
if (id !== undefined && (givenRow === undefined || rows !== undefined || path !== undefined)) {
|
|
409
|
+
throw new Error("row_update: 'id' yalnız 'row' ile verilir — toplu güncellemede ('rows' / 'path') her satır kendi birincil anahtarını taşır.");
|
|
410
|
+
}
|
|
411
|
+
assertOneSource('row_update', givenRow, rows, path);
|
|
412
|
+
if (localizations && !givenRow)
|
|
382
413
|
throw new Error("Üst düzey 'localizations' yalnız 'row' ile verilir: toplu uçta hangi satıra ait olduğu belirsizdir. Toplu güncellemede dil değerlerini satırın kendi içine koyun — rows: [{ id, localizations: { tr: {…} } }].");
|
|
383
|
-
if (relationsByName &&
|
|
414
|
+
if (relationsByName && givenRow)
|
|
384
415
|
throw new Error("'relationsByName' yalnız toplu yolda ('rows' ya da 'path') çalışır: tek satır ucu ad → id çözümlemesi yapmaz, ilişki alanına id yazın.");
|
|
385
416
|
const notes = [];
|
|
386
|
-
const fileRows = path ? await readRowsFromPath('row_update', path) : undefined;
|
|
417
|
+
const fileRows = path ? await readRowsFromPath('row_update', path, config) : undefined;
|
|
387
418
|
const bulkRows = rows ?? fileRows;
|
|
388
|
-
const inputFindings = enforcePolicy(evaluatePolicy(config, policyRules, 'row', { entityId, ...(bulkRows ? { rows: bulkRows } : { row }) }, { operation: 'update' }), false);
|
|
419
|
+
const inputFindings = enforcePolicy(evaluatePolicy(config, policyRules, 'row', { entityId, ...(bulkRows ? { rows: bulkRows } : { row: givenRow }) }, { operation: 'update' }), false);
|
|
389
420
|
const headers = languageHeader(language, notes);
|
|
390
421
|
const resolver = new RefResolver(platform, project, environment);
|
|
391
422
|
const resolvedEntityId = await resolveEntityId(resolver, entityId);
|
|
392
423
|
const shapeFindings = [...inputFindings, ...resolvedSystemEntityFindings(config, entityId, resolvedEntityId, 'update')];
|
|
424
|
+
const idMapping = id === undefined || givenRow === undefined ? undefined : await mapIdToPrimaryKey(resolver, entityId, id, givenRow);
|
|
425
|
+
const row = idMapping?.row ?? givenRow;
|
|
393
426
|
if (bulkRows) {
|
|
394
427
|
const bulkDrift = unmappedMembers('UpdateBulkRowCommand', { rows: bulkRows, ...(rowContext ? { rowContext } : {}), ...(relationsByName ? { relationsByName } : {}) });
|
|
395
428
|
const outcome = await writeInBatches(platform, 'PUT', project, environment, headers, resolvedEntityId, bulkRows, rowContext, relationsByName);
|
|
@@ -399,7 +432,9 @@ export function registerRowTools(server, platform) {
|
|
|
399
432
|
}
|
|
400
433
|
const body = { row, ...(localizations ? { localizations } : {}), ...(rowContext ? { rowContext } : {}) };
|
|
401
434
|
const drift = unmappedMembers('UpdateRowCommand', body);
|
|
402
|
-
|
|
435
|
+
const payload = await platform.tenant('PUT', project, `/entities/${resolvedEntityId}/row`, { environment, headers, body });
|
|
436
|
+
const mapped = idMapping && payload && typeof payload === 'object' && !Array.isArray(payload) ? { ...payload, idMappedTo: idMapping.slug } : payload;
|
|
437
|
+
return attachFindings(withUnmappedMembers(withNormalization(withResolved(mapped, resolver.resolved), notes), drift), shapeFindings);
|
|
403
438
|
}));
|
|
404
439
|
server.registerTool('row_reassign', {
|
|
405
440
|
title: 'Satırların sahibini değiştir',
|
|
@@ -449,7 +484,7 @@ export function registerRowTools(server, platform) {
|
|
|
449
484
|
template: z.boolean().optional().describe("Tablonun alanlarından iki örnek satırlı şablon; ipuçları veri alanının dışında (xlsx başlık yorumu + `_zeyrek`, json `meta`, csv'de yok); değiştirilmeden geri yüklenebilir. PK, identity, sistem ve artan kod sütunu yoktur; değerler sentetiktir, ilişki sütunu boş ve `manual`dır. scope/columns/selectedFields/relations/languages/files/reimportable yok sayılır."),
|
|
450
485
|
locale: z.enum(['tr-TR', 'en-US']).optional().describe("Yalnız template ile: csv ayracı, ondalık ve tarih profilini ve inline örneğin yerel ayarını seçer (tr-TR `;` · `1,5` · `dd.MM.yyyy`; en-US `,` · `1.5` · `M/d/yyyy`). Verilmezse projenin varsayılan dili seçer. Dışa aktarmada (template yok) yok sayılır."),
|
|
451
486
|
inline: z.boolean().optional().describe(`Yalnız template: true ile: şablonun şekli yanıta 'sample { entity, locale, keyField, columns: [{ slug, header, type, required, options?, relationEntity?, matchField?, manual? }], data }' olarak da konur — data iki sentetik satırdır (JSON biçimi: ondalık nokta, tarih yyyy-MM-dd). Örnek ${templateInlineMaxChars} karakteri aşarsa data atlanır, columns kalır. template olmadan istek gitmeden reddedilir.`),
|
|
452
|
-
download: z.string().min(1).optional().describe("Ayrıca
|
|
487
|
+
download: z.string().min(1).optional().describe("Ayrıca bu yerel yola kaydeder; Sürücü'deki kopya yine oluşur. Yol gateway'in çalışma dizininin ya da .env MCP_INPUT_DIR'in altında olmalı (göreli yol MCP_INPUT_DIR'e göre çözülür).")
|
|
453
488
|
},
|
|
454
489
|
annotations: writes
|
|
455
490
|
}, handle(config, async ({ project, environment, entityId, format, scope, columns, selectedFields, relations, languages, files, reimportable, template, locale, inline, download }) => {
|
|
@@ -465,6 +500,8 @@ export function registerRowTools(server, platform) {
|
|
|
465
500
|
const operatorError = filterOperatorError('row_export', scope?.filters);
|
|
466
501
|
if (operatorError)
|
|
467
502
|
throw new PlatformApiError(operatorError, 400);
|
|
503
|
+
// g-12 (DD-23): indirme yolu izinli kökte mi, dışa aktarma ve Sürücü yüklemesinden ÖNCE denetlenir (localFiles).
|
|
504
|
+
const downloadPath = download === undefined ? undefined : await resolveLocalOutput('row_export', 'download', download, config);
|
|
468
505
|
const resolvedFormat = format ?? 'xlsx';
|
|
469
506
|
const notes = [];
|
|
470
507
|
const resolver = new RefResolver(platform, project, environment);
|
|
@@ -544,9 +581,9 @@ export function registerRowTools(server, platform) {
|
|
|
544
581
|
folderId
|
|
545
582
|
});
|
|
546
583
|
const fileId = uploaded?.data?.id;
|
|
547
|
-
if (
|
|
548
|
-
await
|
|
549
|
-
notes.push(`Dosya ayrıca ${
|
|
584
|
+
if (downloadPath) {
|
|
585
|
+
await writeLocalOutput(downloadPath, payload.bytes);
|
|
586
|
+
notes.push(`Dosya ayrıca ${downloadPath} yoluna yazıldı.`);
|
|
550
587
|
}
|
|
551
588
|
if (reimportable) {
|
|
552
589
|
notes.push("Dosya id sütunu ve _zeyrek meta sayfası taşıyor: düzenledikten sonra file_upload → import_analyze → import_plan { mode: 'upsert', keyField: 'id' } ile geri yükleyin.");
|
|
@@ -5,7 +5,7 @@ import { z } from 'zod';
|
|
|
5
5
|
import { evaluatePolicy, enforcePolicy, attachFindings } from '../knowledge/policy.js';
|
|
6
6
|
import { readProjectLanguages, translationLanguageFindings } from '../knowledge/languages.js';
|
|
7
7
|
import { policyRules } from '../knowledge/rules.js';
|
|
8
|
-
import {
|
|
8
|
+
import { localBase, readLocalFile, resolveLocalOutput, writeLocalOutput } from '../platform/localFiles.js';
|
|
9
9
|
import { basename, extname, resolve } from 'node:path';
|
|
10
10
|
const isoLanguageCode = z.string().regex(/^[a-z]{2}$/, 'ISO 639-1 iki harfli küçük dil kodu (tr, en, de …); tr-TR gibi bölge ekli kod reddedilir');
|
|
11
11
|
const translationKeyInput = z.object({
|
|
@@ -26,20 +26,17 @@ const xlsxContentType = 'application/vnd.openxmlformats-officedocument.spreadshe
|
|
|
26
26
|
* (`ImportTranslationsCommand`) dili kendisi projeye eklediği için TR-002 ön okuması yapılmaz.
|
|
27
27
|
*/
|
|
28
28
|
async function importTranslationFile(platform, { project, environment, applicationId, file, targetLanguage, dryRun }) {
|
|
29
|
-
const absolute = resolve(file);
|
|
29
|
+
const absolute = resolve(localBase(platform.config).path, file);
|
|
30
30
|
if (extname(absolute).toLowerCase() !== '.xlsx') {
|
|
31
31
|
throw new PlatformApiError(`translation_update: file bir .xlsx dosyası olmalı (${absolute}). Çeviri dosyası yalnız Excel biçiminde içe aktarılır; biçimi translation_export'un ürettiği dosyadır.`);
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
if (bytes.byteLength > translationFileMaxBytes) {
|
|
41
|
-
throw new PlatformApiError(`translation_update: dosya ${bytes.byteLength} B, platformun 10 MB çeviri dosyası sınırının üstünde. Dosyada resim ya da ek sayfa varsa kaldırın; yalnız Key / kaynak / hedef sütunları gerekir.`);
|
|
42
|
-
}
|
|
33
|
+
// g-12 (DD-23): dosya izinli köklerden okunur (localFiles); uzantı bağın hedefinde de denetlenir.
|
|
34
|
+
const bytes = (await readLocalFile('translation_update', file, {
|
|
35
|
+
label: 'file',
|
|
36
|
+
extensions: ['.xlsx'],
|
|
37
|
+
maxBytes: translationFileMaxBytes,
|
|
38
|
+
tooLarge: (_real, size) => `${size} B, platformun 10 MB çeviri dosyası sınırının üstünde. Dosyada resim ya da ek sayfa varsa kaldırın; yalnız Key / kaynak / hedef sütunları gerekir.`
|
|
39
|
+
}, platform.config)).buffer;
|
|
43
40
|
const response = await platform.tenant('POST', project, `/translations/${applicationId}/import`, {
|
|
44
41
|
environment,
|
|
45
42
|
multipart: [
|
|
@@ -110,17 +107,18 @@ export function registerTranslationTools(server, platform) {
|
|
|
110
107
|
targetLanguage: isoLanguageCode.describe("Çevirmenin dolduracağı hedef dil (C sütunu); başlığa 'Target Language (ES)' biçiminde yalnız çevirmen için yazılır — içe aktarma başlığı okumaz, dili translation_update'in targetLanguage'ı belirler"),
|
|
111
108
|
sourceLanguage: isoLanguageCode.optional().describe('Çevirmene referans olacak kaynak dil (B sütunu); verilmezse projenin varsayılan dili'),
|
|
112
109
|
missingOnly: z.boolean().optional().describe("true: yalnız hedef dilde değeri olmayan ya da boş key'ler yazılır"),
|
|
113
|
-
outPath: z.string().min(1).describe("Dosyanın yazılacağı yerel yol, .xlsx ile biter (zorunlu).
|
|
110
|
+
outPath: z.string().min(1).describe("Dosyanın yazılacağı yerel yol, .xlsx ile biter (zorunlu). Gateway'in çalışma dizininin ya da .env MCP_INPUT_DIR'in altında olmalı (göreli yol MCP_INPUT_DIR'e göre çözülür); var olan dosya ezilir")
|
|
114
111
|
},
|
|
115
112
|
annotations: writes
|
|
116
113
|
}, handle(config, async ({ project, environment, applicationId, targetLanguage, sourceLanguage, missingOnly, outPath }) => {
|
|
117
114
|
if (sourceLanguage === targetLanguage) {
|
|
118
115
|
throw new PlatformApiError(`translation_export: kaynak ve hedef dil aynı ('${targetLanguage}'). sourceLanguage'ı başka bir dil yapın ya da vermeyip projenin varsayılan diline bırakın.`);
|
|
119
116
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
throw new PlatformApiError(`translation_export: outPath .xlsx ile bitmeli (${absolute}); çeviri dosyası yalnız Excel biçiminde üretilir.`);
|
|
117
|
+
if (extname(outPath).toLowerCase() !== '.xlsx') {
|
|
118
|
+
throw new PlatformApiError(`translation_export: outPath .xlsx ile bitmeli (${resolve(localBase(config).path, outPath)}); çeviri dosyası yalnız Excel biçiminde üretilir.`);
|
|
123
119
|
}
|
|
120
|
+
// g-12 (DD-23): hedef izinli kökte mi, dışa aktarmadan ÖNCE denetlenir (localFiles).
|
|
121
|
+
const absolute = await resolveLocalOutput('translation_export', 'outPath', outPath, config);
|
|
124
122
|
const response = await platform.tenantWithHeaders('GET', project, `/translations/${applicationId}/export`, {
|
|
125
123
|
environment,
|
|
126
124
|
expectBinary: true,
|
|
@@ -128,7 +126,7 @@ export function registerTranslationTools(server, platform) {
|
|
|
128
126
|
});
|
|
129
127
|
const payload = response.body;
|
|
130
128
|
try {
|
|
131
|
-
await
|
|
129
|
+
await writeLocalOutput(absolute, payload.bytes);
|
|
132
130
|
}
|
|
133
131
|
catch (error) {
|
|
134
132
|
throw new PlatformApiError(`translation_export: dosya yazılamadı — ${absolute} (${error instanceof Error ? error.message : String(error)}). Klasör var olmalı; yol gateway sürecinin çalıştığı makineye göre çözülür.`);
|
|
@@ -163,7 +161,7 @@ export function registerTranslationTools(server, platform) {
|
|
|
163
161
|
applicationId: guid,
|
|
164
162
|
keys: z.array(translationKeyInput).optional().describe('Eklenecek/güncellenecek anahtarlar'),
|
|
165
163
|
deletedKeys: z.array(z.string().min(1)).optional().describe('Silinecek anahtar adları'),
|
|
166
|
-
file: z.string().min(1).optional().describe("Çevirmenin doldurduğu yerel .xlsx yolu (en çok 10 MB): A Key, B kaynak dil (okunmaz), C hedef dil; başlık satırı okunmaz, dil targetLanguage'tan gelir. Gateway dosyayı okuyup içe aktarma ucuna gönderir, Sürücü'ye yüklemez. keys/deletedKeys ile birlikte verilmez"),
|
|
164
|
+
file: z.string().min(1).optional().describe("Çevirmenin doldurduğu yerel .xlsx yolu (en çok 10 MB; gateway'in çalışma dizininin ya da .env MCP_INPUT_DIR'in altında, göreli yol MCP_INPUT_DIR'e göre): A Key, B kaynak dil (okunmaz), C hedef dil; başlık satırı okunmaz, dil targetLanguage'tan gelir. Gateway dosyayı okuyup içe aktarma ucuna gönderir, Sürücü'ye yüklemez. keys/deletedKeys ile birlikte verilmez"),
|
|
167
165
|
targetLanguage: isoLanguageCode.optional().describe("Yalnız file ile ve file verilince ZORUNLU: C sütununun yazılacağı dil (ISO 639-1, 'de'). Dosyanın başlığı dili belirlemez; projede yoksa dil projeye BÜTÜN ortamlarda eklenir (TR-004)"),
|
|
168
166
|
dryRun: z.boolean().optional().describe('Yalnız file ile: yazmadan created/updated/unchanged/skippedEmpty/unknownKeys sayımını ve dilin projeye eklenip eklenmeyeceğini döner')
|
|
169
167
|
},
|
package/dist/tools/workflows.js
CHANGED
|
@@ -4,9 +4,9 @@ import { evaluatePolicy, enforcePolicy, attachFindings } from '../knowledge/poli
|
|
|
4
4
|
import { workflowOutline, resolvePart, resolvePatchOperations } from '../knowledge/outlines.js';
|
|
5
5
|
import { patchResult, baseVersionOf } from '../platform/patch.js';
|
|
6
6
|
import { writeDiff, withWriteDiff } from '../platform/writeDiff.js';
|
|
7
|
-
import { policyRules, microfunctionStepFindings, workflowStepFindings, undefinedInputFieldFindings, pushReachable } from '../knowledge/rules.js';
|
|
7
|
+
import { policyRules, microfunctionStepFindings, workflowStepFindings, undefinedInputFieldFindings, responseDtoFieldFindings, pushReachable } from '../knowledge/rules.js';
|
|
8
8
|
import { PolicyBlockError } from '../knowledge/policy.js';
|
|
9
|
-
import { identityMiddlewareFindings } from '../knowledge/access.js';
|
|
9
|
+
import { identityMiddlewareFindings, simpleProjectPushUserFindings } from '../knowledge/access.js';
|
|
10
10
|
import { languageHeader } from '../knowledge/languageCodes.js';
|
|
11
11
|
import { handle } from '../platform/responses.js';
|
|
12
12
|
import { existingMatch, ifExistsParam, listAll, platformRename, withOutcome, withRename } from '../platform/ifExists.js';
|
|
@@ -153,7 +153,9 @@ export function registerWorkflowTools(server, platform) {
|
|
|
153
153
|
...await microfunctionStepFindings(platform, project, environment, definition, definition.type, policyOverride),
|
|
154
154
|
...await workflowStepFindings(platform, project, environment, applicationId, definition, definition.type, policyOverride),
|
|
155
155
|
...await undefinedInputFieldFindings(platform, project, environment, definition, definition.type, policyOverride),
|
|
156
|
-
...await
|
|
156
|
+
...await responseDtoFieldFindings(platform, project, environment, definition, definition.type, policyOverride),
|
|
157
|
+
...await identityMiddlewareFindings(platform, project, environment, definition, definition.type, policyOverride),
|
|
158
|
+
...await simpleProjectPushUserFindings(platform, project, environment, definition, policyOverride)
|
|
157
159
|
];
|
|
158
160
|
const bodyFindings = (operation) => evaluatePolicy(config, policyRules, 'workflow', definition, { operation, workflowKind: definition.type }, policyOverride);
|
|
159
161
|
const createFindings = enforcePolicy([...bodyFindings('create'), ...stepFindings]);
|
|
@@ -195,7 +197,9 @@ export function registerWorkflowTools(server, platform) {
|
|
|
195
197
|
...await microfunctionStepFindings(platform, project, environment, definition, definition.type, policyOverride),
|
|
196
198
|
...await workflowStepFindings(platform, project, environment, applicationId, definition, definition.type, policyOverride),
|
|
197
199
|
...await undefinedInputFieldFindings(platform, project, environment, definition, definition.type, policyOverride),
|
|
198
|
-
...await
|
|
200
|
+
...await responseDtoFieldFindings(platform, project, environment, definition, definition.type, policyOverride),
|
|
201
|
+
...await identityMiddlewareFindings(platform, project, environment, definition, definition.type, policyOverride),
|
|
202
|
+
...await simpleProjectPushUserFindings(platform, project, environment, definition, policyOverride)
|
|
199
203
|
]);
|
|
200
204
|
const drift = unmappedMembers('UpdateWorkflowCommand', definition);
|
|
201
205
|
const payload = await platform.tenant('PUT', project, `/workflows/${applicationId}/${id}`, { environment, body: definition });
|
|
@@ -218,7 +222,9 @@ export function registerWorkflowTools(server, platform) {
|
|
|
218
222
|
...await microfunctionStepFindings(platform, project, environment, patched, patched.type, policyOverride),
|
|
219
223
|
...await workflowStepFindings(platform, project, environment, applicationId, patched, patched.type, policyOverride),
|
|
220
224
|
...await undefinedInputFieldFindings(platform, project, environment, patched, patched.type, policyOverride),
|
|
221
|
-
...await
|
|
225
|
+
...await responseDtoFieldFindings(platform, project, environment, patched, patched.type, policyOverride),
|
|
226
|
+
...await identityMiddlewareFindings(platform, project, environment, patched, patched.type, policyOverride),
|
|
227
|
+
...await simpleProjectPushUserFindings(platform, project, environment, patched, policyOverride)
|
|
222
228
|
]);
|
|
223
229
|
const drift = introducedUnmappedMembers('UpdateWorkflowCommand', (current?.data ?? current), patched);
|
|
224
230
|
// Gövde değil FARK gönderilir: gateway normalizasyonları da op'a çevrilsin diye net diff
|
|
@@ -267,7 +273,8 @@ export function registerWorkflowTools(server, platform) {
|
|
|
267
273
|
...evaluatePolicy(config, policyRules, 'workflow', definition, { operation: 'preview', workflowKind: definition.type }, policyOverride),
|
|
268
274
|
...await microfunctionStepFindings(platform, project, environment, definition, definition.type, policyOverride),
|
|
269
275
|
...await workflowStepFindings(platform, project, environment, applicationId, definition, definition.type, policyOverride),
|
|
270
|
-
...await undefinedInputFieldFindings(platform, project, environment, definition, definition.type, policyOverride)
|
|
276
|
+
...await undefinedInputFieldFindings(platform, project, environment, definition, definition.type, policyOverride),
|
|
277
|
+
...await responseDtoFieldFindings(platform, project, environment, definition, definition.type, policyOverride)
|
|
271
278
|
]);
|
|
272
279
|
const payload = await platform.tenant('POST', project, `/workflows/${applicationId}/preview`, { environment, body: definition, headers: languageHeader(language, normalized) });
|
|
273
280
|
return attachFindings(withNormalization(payload, normalized), findings);
|
package/package.json
CHANGED