@appaflytech/zeyrek-ai-mcp 0.0.32 → 0.0.33
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/.env.example +15 -0
- package/dist/config.js +11 -0
- package/dist/index.js +2 -0
- package/dist/knowledge/access.js +802 -0
- package/dist/knowledge/case.js +41 -0
- package/dist/knowledge/componentCatalog.js +82 -213
- package/dist/knowledge/componentEvents.js +21 -19
- package/dist/knowledge/connectDataBind.js +819 -0
- package/dist/knowledge/connectDataDefinition.js +341 -0
- package/dist/knowledge/connectDataExecute.js +93 -0
- package/dist/knowledge/connectDataRules.js +128 -0
- package/dist/knowledge/decision.js +121 -0
- package/dist/knowledge/expressionPrelude.js +59 -0
- package/dist/knowledge/layoutSummary.js +140 -2
- package/dist/knowledge/microserviceParameters.js +58 -0
- package/dist/knowledge/mining.js +94 -0
- package/dist/knowledge/mobileComponentCatalog.js +864 -0
- package/dist/knowledge/mobileComponentEvents.js +239 -0
- package/dist/knowledge/mobileStore.js +227 -0
- package/dist/knowledge/normalize.js +121 -35
- package/dist/knowledge/platform/lint.js +385 -0
- package/dist/knowledge/platform/mobile.js +142 -0
- package/dist/knowledge/platform/mobileLayoutLint.js +324 -0
- package/dist/knowledge/platform/mobileRules.js +231 -0
- package/dist/knowledge/platform/mobileSpacing.js +82 -0
- package/dist/knowledge/platform/mobileTabs.js +108 -0
- package/dist/knowledge/platform/nativeBoxModel.js +44 -0
- package/dist/knowledge/platform/profile.js +25 -0
- package/dist/knowledge/platform/resolve.js +122 -0
- package/dist/knowledge/platform/web.js +39 -0
- package/dist/knowledge/process.js +510 -0
- package/dist/knowledge/rowFilter.js +43 -0
- package/dist/knowledge/rules.js +291 -19
- package/dist/knowledge/styleResolve.js +55 -38
- package/dist/knowledge/styleResolveNative.js +527 -0
- package/dist/knowledge/themeResolve.js +3 -3
- package/dist/observability/trace.js +1 -1
- package/dist/platform/argumentAliases.js +128 -0
- package/dist/platform/bodyFile.js +103 -0
- package/dist/platform/capture/actions.js +333 -0
- package/dist/platform/capture/browser.js +1 -0
- package/dist/platform/{screenshot.js → capture/capture.js} +81 -519
- package/dist/platform/capture/console-log.js +122 -0
- package/dist/platform/capture/index.js +11 -0
- package/dist/platform/capture/readiness.js +103 -0
- package/dist/platform/capture/summary.js +77 -0
- package/dist/platform/capture/target.js +5 -0
- package/dist/platform/capture/targets/studio-mobile.js +15 -0
- package/dist/platform/capture/targets/studio-web.js +5 -0
- package/dist/platform/diagnostics.js +10 -4
- package/dist/platform/domSummary.js +1 -1
- package/dist/platform/http.js +23 -7
- package/dist/platform/impersonation.js +45 -0
- package/dist/platform/jsonArray.js +24 -0
- package/dist/platform/responses.js +6 -2
- package/dist/platform/schemaReadMemory.js +60 -0
- package/dist/platform/secrets.js +9 -0
- package/dist/platform/strictArguments.js +68 -12
- package/dist/platform/tokenVault.js +187 -4
- package/dist/resources/examples/bpm-gorev-kontrol.json +294 -0
- package/dist/resources/examples/bpm-iso-dokuman.json +228 -0
- package/dist/resources/examples/bpm-satinalma.json +376 -0
- package/dist/resources/examples/connect-data-convert-verify.json +107 -0
- package/dist/resources/examples/connect-data-dropdown-roles.json +66 -0
- package/dist/resources/examples/connect-data-edit-m2m.json +73 -0
- package/dist/resources/examples/connect-data-query-params.json +50 -0
- package/dist/resources/examples/connect-data-table-entity.json +147 -0
- package/dist/resources/examples/connect-data-workflow-microservice.json +65 -0
- package/dist/resources/examples/layout-app-shell.json +229 -707
- package/dist/resources/examples/mobile-app-shell-drawer.json +244 -0
- package/dist/resources/examples/mobile-app-shell-stack.json +157 -0
- package/dist/resources/examples/mobile-app-shell-tab.json +208 -0
- package/dist/resources/examples/mobile-form-screen.json +365 -0
- package/dist/resources/examples/mobile-list-detail-form.json +703 -0
- package/dist/resources/examples/page-flex-sections.json +1 -1
- package/dist/resources/guides/access.md +796 -0
- package/dist/resources/guides/bpm.md +686 -0
- package/dist/resources/guides/case.md +153 -0
- package/dist/resources/guides/component.md +10 -2
- package/dist/resources/guides/decision.md +185 -0
- package/dist/resources/guides/expressions.md +14 -5
- package/dist/resources/guides/functions.md +1 -1
- package/dist/resources/guides/layout.md +55 -58
- package/dist/resources/guides/microservice.md +9 -2
- package/dist/resources/guides/middleware.md +34 -2
- package/dist/resources/guides/mobile-layout.md +193 -0
- package/dist/resources/guides/mobile.md +578 -0
- package/dist/resources/guides/page.md +221 -92
- package/dist/resources/guides/theme.md +8 -2
- package/dist/resources/guides/translation.md +1 -1
- package/dist/resources/guides/workflow.md +7 -1
- package/dist/resources/read.js +41 -0
- package/dist/resources/schema-fingerprint.json +4 -4
- package/dist/resources/schemas/AccessExplanationDto.json +144 -0
- package/dist/resources/schemas/AccessMatrixDto.json +170 -0
- package/dist/resources/schemas/AccessPermissionDto.json +57 -0
- package/dist/resources/schemas/AccessPolicyDto.json +223 -0
- package/dist/resources/schemas/AccessResourceDto.json +86 -0
- package/dist/resources/schemas/AppSessionDto.json +53 -0
- package/dist/resources/schemas/ConnectDataDescribeDto.json +344 -0
- package/dist/resources/schemas/ConnectDataRequestModel.json +202 -0
- package/dist/resources/schemas/ConnectDataResultDto.json +421 -0
- package/dist/resources/schemas/ConnectorCredentialDto.json +70 -0
- package/dist/resources/schemas/ConvertConnectDataToMicroserviceCommand.json +37 -0
- package/dist/resources/schemas/CreateAccessPolicyCommand.json +209 -0
- package/dist/resources/schemas/CreateDecisionCommand.json +221 -0
- package/dist/resources/schemas/CreateProcessDefinitionCommand.json +1337 -0
- package/dist/resources/schemas/DecisionDto.json +302 -0
- package/dist/resources/schemas/DetachConnectDataMicroserviceCommand.json +28 -0
- package/dist/resources/schemas/ExplainAccessQuery.json +33 -0
- package/dist/resources/schemas/GenerateProcessDocumentCommand.json +116 -0
- package/dist/resources/schemas/GlobalFunctionUpdateResultDto.json +3 -1
- package/dist/resources/schemas/MicroserviceDto.json +2 -2
- package/dist/resources/schemas/OrganizationProjectDto.json +335 -0
- package/dist/resources/schemas/OrganizationSchemaDto.json +196 -0
- package/dist/resources/schemas/OrganizationSchemaVersionDto.json +207 -0
- package/dist/resources/schemas/PatchProcessDefinitionCommand.json +76 -0
- package/dist/resources/schemas/ProcessDefinitionDto.json +1480 -0
- package/dist/resources/schemas/ProcessSimulationDto.json +96 -0
- package/dist/resources/schemas/SaveConnectorCredentialCommand.json +90 -0
- package/dist/resources/schemas/SaveProcessEventSourceCommand.json +61 -0
- package/dist/resources/schemas/SaveProcessMailSourceCommand.json +89 -0
- package/dist/resources/schemas/SignProcessTaskCommand.json +73 -0
- package/dist/resources/schemas/SimulateProcessDefinitionQuery.json +92 -0
- package/dist/resources/schemas/StartMobileBuildCommand.json +54 -0
- package/dist/resources/schemas/UpdateAccessPolicyCommand.json +209 -0
- package/dist/resources/schemas/UpdateDecisionCommand.json +216 -0
- package/dist/resources/schemas/UpdateProcessDefinitionCommand.json +1357 -0
- package/dist/resources/schemas/UpsertMobileStoreSettingsCommand.json +259 -0
- package/dist/resources/schemas/ValidateProcessDefinitionQuery.json +1339 -0
- package/dist/server.js +7 -1
- package/dist/tools/accessOperations.js +135 -0
- package/dist/tools/accessPolicies.js +170 -0
- package/dist/tools/accessRuntime.js +203 -0
- package/dist/tools/applications.js +60 -3
- package/dist/tools/bpm.js +343 -0
- package/dist/tools/bpmGovernance.js +266 -0
- package/dist/tools/bpmOperations.js +230 -0
- package/dist/tools/bpmReporting.js +154 -0
- package/dist/tools/bpmRouting.js +150 -0
- package/dist/tools/bpmRuntime.js +396 -0
- package/dist/tools/case.js +178 -0
- package/dist/tools/caseRuntime.js +89 -0
- package/dist/tools/components.js +103 -12
- package/dist/tools/connectData.js +449 -0
- package/dist/tools/connectors.js +193 -0
- package/dist/tools/datasources.js +1 -1
- package/dist/tools/decisions.js +206 -0
- package/dist/tools/designSchemaPatch.js +22 -16
- package/dist/tools/externalComponents.js +25 -4
- package/dist/tools/flows.js +79 -6
- package/dist/tools/layouts.js +44 -12
- package/dist/tools/microservices.js +32 -10
- package/dist/tools/mobile.js +221 -0
- package/dist/tools/mobileStore.js +268 -0
- package/dist/tools/modules.js +48 -0
- package/dist/tools/organizationStructure.js +137 -0
- package/dist/tools/pages.js +391 -92
- package/dist/tools/platformInfo.js +7 -2
- package/dist/tools/profileWrite.js +92 -0
- package/dist/tools/rows.js +7 -1
- package/dist/tools/schemaOps.js +33 -1
- package/dist/tools/screenWrite.js +15 -7
- package/dist/tools/screens.js +90 -3
- package/dist/tools/variables.js +11 -5
- package/package.json +2 -2
- package/dist/knowledge/boxSections.js +0 -184
package/dist/tools/flows.js
CHANGED
|
@@ -13,6 +13,7 @@ import { policyRules, flowExpressionSites } from '../knowledge/rules.js';
|
|
|
13
13
|
import { functionCallRefs } from '../knowledge/functionGuards.js';
|
|
14
14
|
import { existingMatch, ifExistsParam, platformRename, withRename } from '../platform/ifExists.js';
|
|
15
15
|
import { randomUUID } from 'node:crypto';
|
|
16
|
+
import { flowProfileWarnings } from './profileWrite.js';
|
|
16
17
|
import { z } from 'zod';
|
|
17
18
|
/**
|
|
18
19
|
* Akış yazması yanıtında gövdeyi geri döndürmüyor, bu yüzden diff için akışı bir kez okuruz.
|
|
@@ -274,7 +275,7 @@ async function functionWarnings(platform, host, project, environment, applicatio
|
|
|
274
275
|
}
|
|
275
276
|
const missing = fn.parameters.filter(parameter => parameter.required && !given.includes(parameter.name)).map(parameter => parameter.name);
|
|
276
277
|
if (missing.length > 0) {
|
|
277
|
-
warnings.add(`FLOW-024: '${label(step)}' adımında '${fn.name}' fonksiyonunun zorunlu parametresi eksik: ${missing.join(', ')} — çağrı 'Functions.${fn.name}: "${missing[0]}" is required' ile düşer, Steps.${String(step.name ?? label(step))}.error dolar ve
|
|
278
|
+
warnings.add(`FLOW-024: '${label(step)}' adımında '${fn.name}' fonksiyonunun zorunlu parametresi eksik: ${missing.join(', ')} — çağrı 'Functions.${fn.name}: "${missing[0]}" is required' ile düşer, Steps.${String(step.name ?? label(step))}.error.message dolar ve .data null'dur; errorSteps yoksa akış 'always' dalından devam eder.`);
|
|
278
279
|
}
|
|
279
280
|
}
|
|
280
281
|
for (const { step, origin, ref } of callSites) {
|
|
@@ -295,6 +296,60 @@ async function functionWarnings(platform, host, project, environment, applicatio
|
|
|
295
296
|
}
|
|
296
297
|
return [...warnings];
|
|
297
298
|
}
|
|
299
|
+
/**
|
|
300
|
+
* FLOW-028 (g-02, ADR 0004 — ZM-07). `microservice.ts` `.finally` üç yoldan birini dener: adımın
|
|
301
|
+
* kendi `error` dalı bağlıysa oradan sürer, yoksa flow `errorSteps`'i (`engine.onError`) devralır,
|
|
302
|
+
* ikisi de yoksa `always` koşar ve storage artık `{ data: null, headers: null, error }`'dır — hata
|
|
303
|
+
* gövdesi ARTIK `data`'da DEĞİL. İkisi de bağlı değilken bu adımın `.data`'sını okuyan bir
|
|
304
|
+
* setter/condition varsa hata anında NULL üzerinden koşar ve yazar hiç fark etmez. Aynı yürüyüş
|
|
305
|
+
* FLOW-024/025'in kullandığı `flowExpressionSites` taramasıdır; setter'ın STORAGE (kod olmayan)
|
|
306
|
+
* referansı ayrıca kendi düz alanından okunur (FLOW-008/009 deseni, `rowsTargetsByStepName`).
|
|
307
|
+
*/
|
|
308
|
+
function microserviceAlwaysDataWarnings(steps, errorSteps) {
|
|
309
|
+
const mainSteps = (Array.isArray(steps) ? steps : []).filter(isRecord);
|
|
310
|
+
const hasErrorFlow = (Array.isArray(errorSteps) ? errorSteps : []).filter(isRecord).some(step => String(step.type ?? '') !== 'start');
|
|
311
|
+
const label = (step) => String(step.stepId ?? step.name ?? '?');
|
|
312
|
+
const escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
313
|
+
const warnings = new Set();
|
|
314
|
+
for (const step of mainSteps) {
|
|
315
|
+
if (String(step.type ?? '') !== 'microservice')
|
|
316
|
+
continue;
|
|
317
|
+
const name = String(step.name ?? step.stepId ?? '');
|
|
318
|
+
if (name === '')
|
|
319
|
+
continue;
|
|
320
|
+
const hasErrorBranch = (Array.isArray(step.branches) ? step.branches : [])
|
|
321
|
+
.filter(isRecord)
|
|
322
|
+
.some(branch => String(branch.name ?? '') === 'error' && Boolean(branch.nextStepId));
|
|
323
|
+
if (hasErrorBranch || hasErrorFlow)
|
|
324
|
+
continue;
|
|
325
|
+
const pattern = new RegExp(`Steps\\s*(?:\\.\\s*${escapeRegExp(name)}\\b|\\[\\s*['"]${escapeRegExp(name)}['"]\\s*\\])\\s*\\??\\.\\s*data\\b`);
|
|
326
|
+
const message = (other) => `FLOW-028: '${label(other)}' adımı 'always' dalında '${name}.data' okuyor ama '${name}' adımının ne bağlı bir 'error' dalı ne akışın 'errorSteps'i var — uç hata dönerse bu adımın 'data'sı NULL olur (eskiden hata gövdesiydi, ADR 0004) ve '${label(other)}' boş/null veriyle koşar. '${name}' adımına 'error' dalı bağlayın ya da flow'a errorSteps verin.`;
|
|
327
|
+
for (const other of mainSteps) {
|
|
328
|
+
if (other === step)
|
|
329
|
+
continue;
|
|
330
|
+
if (String(other.type ?? '') === 'setter') {
|
|
331
|
+
const iteratees = Array.isArray(other.args?.iteratees)
|
|
332
|
+
? other.args.iteratees.filter(isRecord)
|
|
333
|
+
: [];
|
|
334
|
+
for (const iteratee of iteratees) {
|
|
335
|
+
const mapping = (iteratee.mapping ?? {});
|
|
336
|
+
const value = (iteratee.value ?? {});
|
|
337
|
+
const reference = typeof mapping.source === 'string' && mapping.source.length > 0
|
|
338
|
+
? mapping.source
|
|
339
|
+
: typeof value.ref === 'string' ? value.ref : '';
|
|
340
|
+
if (value.type === 'storage' && (reference === `${name}.data` || reference.startsWith(`${name}.data.`) || reference.startsWith(`${name}.data[`))) {
|
|
341
|
+
warnings.add(message(other));
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
for (const site of flowExpressionSites(other)) {
|
|
346
|
+
if (pattern.test(site.expression))
|
|
347
|
+
warnings.add(message(other));
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
return [...warnings];
|
|
352
|
+
}
|
|
298
353
|
export function registerFlowTools(server, platform) {
|
|
299
354
|
const config = platform.config;
|
|
300
355
|
server.registerTool('flow_list', {
|
|
@@ -368,7 +423,8 @@ export function registerFlowTools(server, platform) {
|
|
|
368
423
|
...await requiredParameterWarnings(platform, project, environment, applicationId, steps),
|
|
369
424
|
...await functionWarnings(platform, host, project, environment, applicationId, hostId, steps),
|
|
370
425
|
...flowBodyWarnings(steps),
|
|
371
|
-
...unknownSetterTargetWarnings(steps, errorSteps ?? [], hostNodes(hostRecord))
|
|
426
|
+
...unknownSetterTargetWarnings(steps, errorSteps ?? [], hostNodes(hostRecord)),
|
|
427
|
+
...microserviceAlwaysDataWarnings(steps, errorSteps ?? [])
|
|
372
428
|
];
|
|
373
429
|
// Gövde yalnız akıştır (designer-partial-update K1): barındırıcı zarfı platformda hâlâ isteğe bağlı
|
|
374
430
|
// ama gönderilirse okunan tam kaydı yeniden yazar, açık Studio designer'ının kayıtlı tabanını
|
|
@@ -382,6 +438,7 @@ export function registerFlowTools(server, platform) {
|
|
|
382
438
|
// Diff YALNIZ çağıranın yazdığı alanları kapsar; `id` ve barındırıcı bağı (`pageId` vb.)
|
|
383
439
|
// gövdeye gateway koyar, kullanıcının düzeltebileceği bir şey değildir.
|
|
384
440
|
const drops = await flowWriteDrops(platform, host, project, environment, applicationId, hostId, writtenFlowId, { name: flow.name, slug: flow.slug, steps: flow.steps, errorSteps: flow.errorSteps }, ifExists === 'duplicate');
|
|
441
|
+
const platformWarnings = await flowProfileWarnings(platform, applicationId, [...(flow.steps ?? []), ...(flow.errorSteps ?? [])]);
|
|
385
442
|
return attachFindings(withWriteDiff(withRename(withNormalization({
|
|
386
443
|
host,
|
|
387
444
|
hostId,
|
|
@@ -393,6 +450,7 @@ export function registerFlowTools(server, platform) {
|
|
|
393
450
|
steps: steps.length
|
|
394
451
|
},
|
|
395
452
|
...(parameterWarnings.length > 0 ? { parameterWarnings } : {}),
|
|
453
|
+
...(platformWarnings.length > 0 ? { platformWarnings } : {}),
|
|
396
454
|
hint: "Akışı bir olaya bağlamak için: page_schema_patch (layout'ta layout_schema_patch, widget'ta component_schema_patch) ops:[{op:'set_event', target:<elementId>, event:'<component_get events listesindeki ad>', eventValue:<flow id>}]; olayda zaten akış bağlıysa ikinciyi add_event ile ekleyin (set_event bağlı akışı değiştirir, PAGE-034). Olay adları komponente özeldir ve 'on' ÖNEKİ ALMAZ (button → 'click', form → 'submit', table → 'mount'/'select'/'sort'…); uydurma ad 200 döner ama bağ sessizce ölü kalır — gateway PAGE-008 ile yakalar."
|
|
397
455
|
}, normalized), drops.renamed), drops), findings);
|
|
398
456
|
}));
|
|
@@ -435,7 +493,8 @@ export function registerFlowTools(server, platform) {
|
|
|
435
493
|
...await requiredParameterWarnings(platform, project, environment, applicationId, flow.steps),
|
|
436
494
|
...await functionWarnings(platform, host, project, environment, applicationId, hostId, flow.steps),
|
|
437
495
|
...flowBodyWarnings(flow.steps),
|
|
438
|
-
...unknownSetterTargetWarnings(flow.steps, flow.errorSteps, hostNodes(hostRecord))
|
|
496
|
+
...unknownSetterTargetWarnings(flow.steps, flow.errorSteps, hostNodes(hostRecord)),
|
|
497
|
+
...microserviceAlwaysDataWarnings(flow.steps, flow.errorSteps)
|
|
439
498
|
];
|
|
440
499
|
await platform.tenant('PUT', project, flowPath(host, applicationId, hostId, flowId), { environment, body: { flow } });
|
|
441
500
|
// Kısmi güncellemede yalnız GÖNDERİLEN alanlar karşılaştırılır; verilmeyen alan için
|
|
@@ -446,7 +505,9 @@ export function registerFlowTools(server, platform) {
|
|
|
446
505
|
...(steps === undefined ? {} : { steps }),
|
|
447
506
|
...(errorSteps === undefined ? {} : { errorSteps })
|
|
448
507
|
});
|
|
449
|
-
|
|
508
|
+
const platformWarnings = await flowProfileWarnings(platform, applicationId, [...(flow.steps ?? []), ...(flow.errorSteps ?? [])]);
|
|
509
|
+
return attachFindings(withWriteDiff(withNormalization({ host, hostId, flow: flowSummary(flow), ...(parameterWarnings.length > 0 ? { parameterWarnings } : {}),
|
|
510
|
+
...(platformWarnings.length > 0 ? { platformWarnings } : {}) }, normalized), drops), findings);
|
|
450
511
|
}));
|
|
451
512
|
server.registerTool('flow_patch', {
|
|
452
513
|
title: "Akışa patch uygula",
|
|
@@ -485,7 +546,8 @@ export function registerFlowTools(server, platform) {
|
|
|
485
546
|
...await requiredParameterWarnings(platform, project, environment, applicationId, flow.steps),
|
|
486
547
|
...await functionWarnings(platform, host, project, environment, applicationId, hostId, flow.steps),
|
|
487
548
|
...flowBodyWarnings(flow.steps),
|
|
488
|
-
...unknownSetterTargetWarnings(flow.steps, flow.errorSteps, hostNodes(hostRecord))
|
|
549
|
+
...unknownSetterTargetWarnings(flow.steps, flow.errorSteps, hostNodes(hostRecord)),
|
|
550
|
+
...microserviceAlwaysDataWarnings(flow.steps, flow.errorSteps)
|
|
489
551
|
];
|
|
490
552
|
// Gövde değil FARK gönderilir; platform PATCH ucu akışı tek başına yazar. Net diff okunan kayıt ile son hâl arasından hesaplanır.
|
|
491
553
|
const netOps = fastJsonPatch.compare(current, flow);
|
|
@@ -495,6 +557,7 @@ export function registerFlowTools(server, platform) {
|
|
|
495
557
|
});
|
|
496
558
|
const written = patchResult(saved, flow);
|
|
497
559
|
const drops = await flowWriteDrops(platform, host, project, environment, applicationId, hostId, flowId, { steps: flow.steps, errorSteps: flow.errorSteps });
|
|
560
|
+
const platformWarnings = await flowProfileWarnings(platform, applicationId, [...(flow.steps ?? []), ...(flow.errorSteps ?? [])]);
|
|
498
561
|
return attachFindings(withWriteDiff(withNormalization({
|
|
499
562
|
host,
|
|
500
563
|
hostId,
|
|
@@ -502,7 +565,8 @@ export function registerFlowTools(server, platform) {
|
|
|
502
565
|
newVersion: written.newVersion,
|
|
503
566
|
patchTargets: resolved.targets,
|
|
504
567
|
flow: flowSummary(written.data),
|
|
505
|
-
...(parameterWarnings.length > 0 ? { parameterWarnings } : {})
|
|
568
|
+
...(parameterWarnings.length > 0 ? { parameterWarnings } : {}),
|
|
569
|
+
...(platformWarnings.length > 0 ? { platformWarnings } : {})
|
|
506
570
|
}, [...normalized, ...resolved.notes.map(note => `patch yolu seçiciden indekse çözüldü: ${note}`)]), drops), findings);
|
|
507
571
|
}));
|
|
508
572
|
server.registerTool('flow_delete', {
|
|
@@ -514,4 +578,13 @@ export function registerFlowTools(server, platform) {
|
|
|
514
578
|
await platform.tenant('DELETE', project, flowPath(host, applicationId, hostId, flowId), { environment, body: { id: flowId } });
|
|
515
579
|
return { deleted: flowId, host, hostId };
|
|
516
580
|
}));
|
|
581
|
+
server.registerTool('flow_restore', {
|
|
582
|
+
title: 'Silinen akışı geri yükle',
|
|
583
|
+
description: "Silinmiş bir akışı revizyon defterindeki son içeriğiyle (ad, slug, adımlar, barındırıcı) AYNI id ile yeniden kurar. Sayfa kaydı bağı kalmayan akışı kalıcı siler (FLOW-002, allowFlowDeletion) — Studio'nun eski sekmesi boş şema kaydettiğinde de (ZM-27). Akışı olaya YENİDEN BAĞLAMAZ: geri geldikten sonra set_event ile bağlayın. SINIR: adımları sayfanın bir komponentini hedefliyorsa (tetikleyen element, iterate/parametre komponenti) o komponent de şemada olmalıdır, yoksa geri yükleme reddedilir — sayfa boşaldıysa (ZM-27) page_restore kullanın: sayfayı ve akışlarını birlikte geri kurar. Akış hâlâ varsa 409, saklama süresi dolup revizyonu budanmışsa 404 döner. Silinen akışı revision_list(module: 'flow') satırlarında operation: delete olarak bulun; recordId akış id'sidir.",
|
|
584
|
+
inputSchema: { project: projectParam, environment: environmentParam, flowId: flowIdParam },
|
|
585
|
+
annotations: writes
|
|
586
|
+
}, handle(config, async ({ project, environment, flowId }) => {
|
|
587
|
+
const restored = unwrap(await platform.tenant('POST', project, `/flows/${flowId}/restore`, { environment }));
|
|
588
|
+
return { restored: flowId, flow: restored };
|
|
589
|
+
}));
|
|
517
590
|
}
|
package/dist/tools/layouts.js
CHANGED
|
@@ -9,6 +9,8 @@ import { applyPropTypesToSchema, isSetPropTypeOp, setPropTypeErrors } from '../k
|
|
|
9
9
|
import { writeDiff, withWriteDiff } from '../platform/writeDiff.js';
|
|
10
10
|
import { PlatformApiError } from '../platform/errors.js';
|
|
11
11
|
import { handle } from '../platform/responses.js';
|
|
12
|
+
import { applicationTypeField, resolveProfile } from '../knowledge/platform/resolve.js';
|
|
13
|
+
import { screenProfileWarnings } from './profileWrite.js';
|
|
12
14
|
import { z } from 'zod';
|
|
13
15
|
const patchOperationsParam = z.array(z.record(z.unknown())).min(1)
|
|
14
16
|
.describe("JSON Patch listesi (RFC 6902): { op, path, value }. Yol seçici alabilir — '/views/0/children[elementId=baslik]/props/content/data'.");
|
|
@@ -46,7 +48,13 @@ export function registerLayoutTools(server, platform) {
|
|
|
46
48
|
description: "Layout'u komponent ağacı (views), widget'ları, akışları ve olaylarıyla getirir.",
|
|
47
49
|
inputSchema: { project: projectParam, environment: environmentParam, applicationId: guid, id: guid },
|
|
48
50
|
annotations: readOnly
|
|
49
|
-
}, handle(config, ({ project, environment, applicationId, id }) =>
|
|
51
|
+
}, handle(config, async ({ project, environment, applicationId, id }) => {
|
|
52
|
+
const response = await platform.tenant('GET', project, `/layouts/${applicationId}/${id}`, { environment });
|
|
53
|
+
const typeField = applicationTypeField(await resolveProfile(platform, applicationId));
|
|
54
|
+
return response && typeof response === 'object' && !Array.isArray(response) && Object.keys(typeField).length > 0
|
|
55
|
+
? { ...response, ...typeField }
|
|
56
|
+
: response;
|
|
57
|
+
}));
|
|
50
58
|
server.registerTool('layout_schema_get', {
|
|
51
59
|
title: "Layout komponent ağacını oku",
|
|
52
60
|
description: "Layout'un komponent ağacını (views) okur — page_schema_get'in layout karşılığı. Ağaçta hedefli değişiklik için layout_schema_patch (sayfa ile aynı micro-op sözlüğü, PATCH /layouts/{app}/{id}/schema). Ad/parametre/olay alanlarında ya da düz JSON Patch yolu gerektiğinde layout_patch — o araç buradaki updatedAt'i expectedUpdatedAt olarak kabul eder. Tam ağacı kendiniz yazacaksanız layout_update.",
|
|
@@ -61,20 +69,21 @@ export function registerLayoutTools(server, platform) {
|
|
|
61
69
|
annotations: readOnly
|
|
62
70
|
}, handle(config, async ({ project, environment, applicationId, id, mode, componentId }) => {
|
|
63
71
|
const layout = await fetchHost(platform, 'layout', project, environment, applicationId, id);
|
|
72
|
+
const typeField = applicationTypeField(await resolveProfile(platform, applicationId));
|
|
64
73
|
const audit = layout.audit;
|
|
65
74
|
const updatedAt = audit?.updatedAt ?? audit?.createdAt;
|
|
66
75
|
const views = (layout.views ?? []);
|
|
67
76
|
if (mode === 'full')
|
|
68
|
-
return { updatedAt, views };
|
|
77
|
+
return { updatedAt, ...typeField, views };
|
|
69
78
|
if (mode === 'subtree') {
|
|
70
79
|
if (!componentId)
|
|
71
80
|
throw new PlatformApiError("mode='subtree' için componentId zorunludur.");
|
|
72
81
|
const subtree = findNode(views, componentId);
|
|
73
82
|
if (!subtree)
|
|
74
83
|
throw new PlatformApiError(`Layout'ta '${componentId}' id'li bir komponent yok; layout_schema_get'i summary kipinde çağırıp hedefi doğrulayın.`);
|
|
75
|
-
return { updatedAt, views: subtree };
|
|
84
|
+
return { updatedAt, ...typeField, views: subtree };
|
|
76
85
|
}
|
|
77
|
-
return { updatedAt, views: views.map(node => summarize(node)) };
|
|
86
|
+
return { updatedAt, ...typeField, views: views.map(node => summarize(node)) };
|
|
78
87
|
}));
|
|
79
88
|
server.registerTool('layout_create', {
|
|
80
89
|
title: 'Layout oluştur',
|
|
@@ -90,19 +99,28 @@ export function registerLayoutTools(server, platform) {
|
|
|
90
99
|
},
|
|
91
100
|
annotations: writes
|
|
92
101
|
}, handle(config, async ({ project, environment, applicationId, name, views, events, parameters }) => {
|
|
93
|
-
|
|
102
|
+
const resolved = await resolveProfile(platform, applicationId);
|
|
103
|
+
assertScreenWriteGuards('layout', { schema: views, events }, resolved.profile.platform);
|
|
94
104
|
const fixed = normalizeComponentDefaults(views);
|
|
95
105
|
const catalogNotes = await screenCatalogNotes(platform, project, environment, applicationId, views);
|
|
96
|
-
const gaps = [
|
|
106
|
+
const gaps = [
|
|
107
|
+
...(resolved.profile.layout.blocksMeaningful ? verticalGapWarnings(views ?? [], 'LAY-003 (uyarı)') : []),
|
|
108
|
+
...flexSizeWarnings(views ?? [], 'LAY-007 (uyarı)', 'LAY-008 (uyarı)'),
|
|
109
|
+
...spacingLayerWarnings(views ?? [], 'LAY-010 (uyarı)', 'LAY-011 (uyarı)'),
|
|
110
|
+
...await screenProfileWarnings(platform, resolved, project, environment, applicationId, { kind: 'layout', nodes: views ?? [] })
|
|
111
|
+
];
|
|
97
112
|
const response = await platform.tenant('POST', project, `/layouts/${applicationId}`, {
|
|
98
113
|
environment,
|
|
99
114
|
body: { name, views: views ?? [], events: events ?? [], parameters: parameters ?? null }
|
|
100
115
|
});
|
|
101
116
|
const drops = writeDiff({ name, views: views ?? [], events: events ?? [] }, response);
|
|
102
117
|
const normalized = withWriteDiff(withNormalization(response, [...componentDefaultsNote(fixed), ...catalogNotes, ...slotWarning(views)]), drops);
|
|
103
|
-
|
|
118
|
+
const typeField = applicationTypeField(resolved);
|
|
119
|
+
if (!normalized || typeof normalized !== 'object')
|
|
104
120
|
return normalized;
|
|
105
|
-
|
|
121
|
+
if (gaps.length === 0)
|
|
122
|
+
return Object.keys(typeField).length === 0 ? normalized : { ...normalized, ...typeField };
|
|
123
|
+
return { ...normalized, ...typeField, layoutWarnings: gaps };
|
|
106
124
|
}));
|
|
107
125
|
server.registerTool('layout_update', {
|
|
108
126
|
title: 'Layout güncelle',
|
|
@@ -120,13 +138,21 @@ export function registerLayoutTools(server, platform) {
|
|
|
120
138
|
annotations: updates
|
|
121
139
|
}, handle(config, async ({ project, environment, applicationId, id, ...changes }) => {
|
|
122
140
|
const overrides = Object.fromEntries(Object.entries(changes).filter(([, value]) => value !== undefined));
|
|
123
|
-
|
|
141
|
+
const resolved = overrides.views === undefined ? undefined : await resolveProfile(platform, applicationId);
|
|
142
|
+
assertScreenWriteGuards('layout', { schema: overrides.views, events: overrides.events }, resolved?.profile.platform);
|
|
124
143
|
const current = await fetchHost(platform, 'layout', project, environment, applicationId, id);
|
|
125
144
|
const fixed = normalizeComponentDefaults(overrides.views);
|
|
126
145
|
const catalogNotes = await screenCatalogNotes(platform, project, environment, applicationId, overrides.views);
|
|
127
146
|
const body = layoutUpdateBody({ ...current, applicationId }, overrides);
|
|
128
147
|
await platform.tenant('PUT', project, `/layouts/${applicationId}/${id}`, { environment, body });
|
|
129
|
-
const gaps = overrides.views === undefined
|
|
148
|
+
const gaps = overrides.views === undefined || !resolved
|
|
149
|
+
? []
|
|
150
|
+
: [
|
|
151
|
+
...(resolved.profile.layout.blocksMeaningful ? verticalGapWarnings(body.views, 'LAY-003 (uyarı)') : []),
|
|
152
|
+
...flexSizeWarnings(body.views, 'LAY-007 (uyarı)', 'LAY-008 (uyarı)'),
|
|
153
|
+
...spacingLayerWarnings(body.views, 'LAY-010 (uyarı)', 'LAY-011 (uyarı)'),
|
|
154
|
+
...await screenProfileWarnings(platform, resolved, project, environment, applicationId, { kind: 'layout', nodes: body.views })
|
|
155
|
+
];
|
|
130
156
|
const summary = { id, changed: Object.keys(overrides), preserved: { viewNodes: body.views.length } };
|
|
131
157
|
if (gaps.length > 0)
|
|
132
158
|
summary.layoutWarnings = gaps;
|
|
@@ -180,7 +206,8 @@ export function registerLayoutTools(server, platform) {
|
|
|
180
206
|
const overrides = Object.fromEntries(['name', 'views', 'events', 'parameters']
|
|
181
207
|
.filter(key => patched[key] !== undefined)
|
|
182
208
|
.map(key => [key, patched[key]]));
|
|
183
|
-
|
|
209
|
+
const profile = await resolveProfile(platform, applicationId);
|
|
210
|
+
assertScreenWriteGuards('layout', { schema: overrides.views, events: overrides.events }, profile.profile.platform);
|
|
184
211
|
const fixed = normalizeComponentDefaults(overrides.views);
|
|
185
212
|
const catalogNotes = await screenCatalogNotes(platform, project, environment, applicationId, overrides.views);
|
|
186
213
|
const body = layoutUpdateBody({ ...current, applicationId }, overrides);
|
|
@@ -193,7 +220,12 @@ export function registerLayoutTools(server, platform) {
|
|
|
193
220
|
body: { baseVersion: baseVersionOf(document, 'layout_get'), ops: netOps }
|
|
194
221
|
});
|
|
195
222
|
const written = patchResult(saved, finalDocument);
|
|
196
|
-
const gaps = [
|
|
223
|
+
const gaps = [
|
|
224
|
+
...(profile.profile.layout.blocksMeaningful ? verticalGapWarnings(body.views, 'LAY-003 (uyarı)') : []),
|
|
225
|
+
...flexSizeWarnings(body.views, 'LAY-007 (uyarı)', 'LAY-008 (uyarı)'),
|
|
226
|
+
...spacingLayerWarnings(body.views, 'LAY-010 (uyarı)', 'LAY-011 (uyarı)'),
|
|
227
|
+
...await screenProfileWarnings(platform, profile, project, environment, applicationId, { kind: 'layout', nodes: body.views })
|
|
228
|
+
];
|
|
197
229
|
const summary = {
|
|
198
230
|
id,
|
|
199
231
|
applied: patchOps.length,
|
|
@@ -6,13 +6,14 @@ import { normalizeMicroserviceDefinition, normalizeMicroservicePatchOps, withNor
|
|
|
6
6
|
import { evaluatePolicy, enforcePolicy, attachFindings } from '../knowledge/policy.js';
|
|
7
7
|
import { microserviceOutline, workflowOutline, resolvePart, resolvePatchOperations } from '../knowledge/outlines.js';
|
|
8
8
|
import { patchResult, baseVersionOf } from '../platform/patch.js';
|
|
9
|
-
import { policyRules } from '../knowledge/rules.js';
|
|
9
|
+
import { filterOperatorError, policyRules } from '../knowledge/rules.js';
|
|
10
10
|
import { writeDiff, withWriteDiff } from '../platform/writeDiff.js';
|
|
11
|
-
import { identityHeaders } from '../platform/tokenVault.js';
|
|
11
|
+
import { identityHeaders, resolveIdentity } from '../platform/tokenVault.js';
|
|
12
12
|
import { PlatformApiError } from '../platform/errors.js';
|
|
13
13
|
import { existingMatch, ifExistsParam, listAll, platformRename, withOutcome, withRename } from '../platform/ifExists.js';
|
|
14
14
|
import { outlineWrite, recordWriteViewParam } from '../platform/writeView.js';
|
|
15
15
|
import { handle } from '../platform/responses.js';
|
|
16
|
+
import { headersForMode } from '../platform/http.js';
|
|
16
17
|
import fastJsonPatch from 'fast-json-patch';
|
|
17
18
|
import { z } from 'zod';
|
|
18
19
|
import { constraintSummary } from '../knowledge/backendConstraints.js';
|
|
@@ -68,7 +69,7 @@ async function queryScopeFindings(platform, project, environment, definition) {
|
|
|
68
69
|
}
|
|
69
70
|
const patchOperationsParam = z.array(z.record(z.unknown())).min(1)
|
|
70
71
|
.describe("RFC 6902 JSON Patch işlemleri; path'leri view:'outline'/'part' ile keşfedin. Dizi öğelerinde indeks yerine seçici kullanılabilir: '/sourceParameters/joins[alias=customers]/path' — seçici gövde platforma gitmeden indekse çevrilir, çözülemezse istek hiç gönderilmez.");
|
|
71
|
-
const asUserParam = z.string().min(1).optional().describe("Uygulama üyesinin kimliği: istek gateway'in servis jetonu yerine bu kimlikle gider. Jeton HEM Authorization başlığında HEM NG_AccessToken çerezinde taşınır, böylece jetonu ÇEREZDEN okuyan middleware de geçer — uca middleware bağlandığı anda bu alan olmadan çağrı 401 döner (09-05 koşusu S-21).
|
|
72
|
+
const asUserParam = z.string().min(1).optional().describe("Uygulama üyesinin kimliği: istek gateway'in servis jetonu yerine bu kimlikle gider. Jeton HEM Authorization başlığında HEM NG_AccessToken çerezinde taşınır, böylece jetonu ÇEREZDEN okuyan middleware de geçer — uca middleware bağlandığı anda bu alan olmadan çağrı 401 döner (09-05 koşusu S-21). ÜÇ ŞEKİL kabul edilir: (1) TERCİH EDİLEN `test:<ad>` — gateway kök .env'deki MCP_TEST_USER_<AD> satırıyla giriş ucunu kendisi çağırır, jetonu kasadan yeniden kullanır (satırı insan yazar), (2) `tok_…` referansı (giriş ucunu çağırdığınızda yanıtın tokenRefs alanında döner; ömür MCP_TOKEN_TTL_MINUTES, MCP_STATE_DIR varsa gateway yeniden başlayınca da çözülür), (3) ham JWT. anonymous ile birlikte verilemez.");
|
|
72
73
|
const cookiesParam = z.record(z.string()).optional().describe("İsteğe eklenecek çerezler (ad → değer): uygulamanın KENDİ oturum çerezi buraya verilir (ör. { CORE_Token: '<jwt>' }). asUser verildiğinde gateway NG_AccessToken çerezini zaten kendisi kurar; bu alan yalnız uygulama başka bir çerez adı okuyorsa gerekir. anonymous ile birlikte verilemez.");
|
|
73
74
|
const executeInput = {
|
|
74
75
|
project: projectParam,
|
|
@@ -189,6 +190,13 @@ function unboundQueryParameters(value, into = []) {
|
|
|
189
190
|
unboundQueryParameters(entry, into);
|
|
190
191
|
return into;
|
|
191
192
|
}
|
|
193
|
+
/** Çağrının dinamik filtresi (`filters`, sorguda ya da gövdede) bilinen işleçlerle mi — değilse istek gitmez (g-03). */
|
|
194
|
+
function assertFilterOperators(tool, bound) {
|
|
195
|
+
const bodyFilters = bound.body && !Array.isArray(bound.body) ? bound.body.filters : undefined;
|
|
196
|
+
const error = filterOperatorError(tool, bound.query?.filters) ?? filterOperatorError(tool, bodyFilters);
|
|
197
|
+
if (error)
|
|
198
|
+
throw new PlatformApiError(error, 400);
|
|
199
|
+
}
|
|
192
200
|
function executePath(prefix, application, microservice, routeParams) {
|
|
193
201
|
const routeSuffix = routeParams && routeParams.length > 0
|
|
194
202
|
? `/${routeParams.map(encodeURIComponent).join('/')}`
|
|
@@ -241,6 +249,12 @@ async function resolveRuntimeUrl(platform, project, environment, applicationId,
|
|
|
241
249
|
}
|
|
242
250
|
export function registerMicroserviceTools(server, platform) {
|
|
243
251
|
const config = platform.config;
|
|
252
|
+
server.registerTool('microservice_system_operation_list', {
|
|
253
|
+
title: 'Sistem operasyonlarını listele',
|
|
254
|
+
description: "Bir microservice'in systemOperation alanına konabilecek hazır platform operasyonlarının kataloğunu döner (GET /{project}/microservices/system-operations): operasyon adı, karar motorunun soracağı izin, kaynak tipi, beklediği parametreler ve açıklaması. Sistem operasyonlu uç kendi adımlarını yazmaz — platformun hazır davranışını (ör. satır sahibini değiştirme, maskeli alan açma, uygulama girişi) uygulamanın kendi ucu gibi yayınlar. Her satırın 'guard' alanı korumayı söyler: 'permission' → oturum + buradaki permission karara bağlanır; permission BOŞ olan 'permission' satırında izni işlemin çağırdığı servis verir (ADR-0004): süreç çalışma zamanı işlemleri (process.* — görev kutusu ve eylemleri, process.task.sign dahil; örnek, vekalet, devir, bildirim, tercih, rapor) kişiye ve kayda göre karar verir, REST bpm/* ucuyla aynı görünürlüğü ve aynı alan adlarını döner; yalnız process.override.* process.manage ister; 'session' → operasyon izin sormaz, yalnız oturum ister (ör. access.session.get: oturumdaki kullanıcı · access.session.delete: çıkış; refresh ailesini iptal eder ve üç oturum çerezini yanıtla siler, erişim jetonu dolmuşsa 401 AppSessionRequired döner ve runtime yenileyip tekrarlar — akışın cookie/storage adımları bu HttpOnly çerezlere ulaşmaz, FLOW-037, uç isAnonymous:true kalır; uç anonim değilse microservice.execute kararı yine uygulanır); 'anonymous' → oturum da izin de sorulmaz (access.session.create: giriş; girdi yalnız gövdeden okunur, çerezler yalnız application/json istekte yazılır, gövdede jeton dönmez) ve uç isAnonymous:true olmak zorundadır, önizlemede çalışmaz. Süreç ekranı process.* işlemleriyle kurulur, Page.bpm ile değil (BPM-022); kod adımından platform ucuna ham fetch yerine bu uçlar kullanılır (FLOW-028). Katalog sabittir, projeye göre değişmez.",
|
|
255
|
+
inputSchema: { project: projectParam, environment: environmentParam },
|
|
256
|
+
annotations: readOnly
|
|
257
|
+
}, handle(config, ({ project, environment }) => platform.tenant('GET', project, '/microservices/system-operations', { environment })));
|
|
244
258
|
server.registerTool('microservice_list', {
|
|
245
259
|
title: 'Microservice listele',
|
|
246
260
|
description: 'Application altındaki microservice\'leri listeler.',
|
|
@@ -406,14 +420,20 @@ export function registerMicroserviceTools(server, platform) {
|
|
|
406
420
|
}, handle(config, ({ project, environment, id }) => platform.tenant('POST', project, `/microservices/${id}/clone`, { environment })));
|
|
407
421
|
server.registerTool('microservice_execute', {
|
|
408
422
|
title: 'Microservice çalıştır',
|
|
409
|
-
description: "Kayıtlı microservice'i gerçek runtime yolundan çalıştırır (POST /{project}/m/{application}/{microservice SLUG'ı}). Dönen httpStatus microservice'in kendi sonucudur (hata da geçerli çıktıdır); beklenmedik sonuçta microservice_debug ile adım adım inceleyin. Anonim erişim testi için anonymous: true. Yanıt 'headers'
|
|
410
|
-
inputSchema:
|
|
423
|
+
description: "Kayıtlı microservice'i gerçek runtime yolundan çalıştırır (POST /{project}/m/{application}/{microservice SLUG'ı}). Dönen httpStatus microservice'in kendi sonucudur (hata da geçerli çıktıdır); beklenmedik sonuçta microservice_debug ile adım adım inceleyin. Anonim erişim testi için anonymous: true. Yanıt 'headers' alanı VARSAYILAN OLARAK yalnız iş başlıklarını taşır (küçük harf): content-type, content-length, content-disposition, location, total-count (sayfalı tablo akışlarının okuduğu sözleşme), x-request-id, traceparent. Ucun response adımında kendi yazdığı başlıkları ya da sunucu başlıklarını görmek için includeHeaders:'all'; hiç başlık istemiyorsanız 'none'. set-cookie/authorization her kipte elenir.",
|
|
424
|
+
inputSchema: {
|
|
425
|
+
...executeInput,
|
|
426
|
+
includeHeaders: z.enum(['none', 'essential', 'all']).optional().describe("Yanıttaki 'headers' alanı. essential (varsayılan): content-type, content-length, content-disposition, location, total-count, x-request-id, traceparent. all: platformun döndüğü bütün başlıklar (gizliler hariç) — ucun kendi yazdığı başlığı doğrulamak için. none: başlık yok")
|
|
427
|
+
},
|
|
411
428
|
annotations: writes
|
|
412
|
-
}, handle(config, async ({ project, environment, application, microservice, method, routeParams, query, body, parameters, headers, anonymous, asUser, cookies, language }) => {
|
|
429
|
+
}, handle(config, async ({ project, environment, application, microservice, method, routeParams, query, body, parameters, headers, anonymous, asUser, cookies, language, includeHeaders }) => {
|
|
413
430
|
const notes = [];
|
|
414
|
-
const
|
|
431
|
+
const member = anonymous === true ? asUser : await resolveIdentity(asUser, platform, project, environment);
|
|
432
|
+
const requestHeaders = { ...runIdentity(anonymous, member, cookies, headers), ...languageHeader(language, notes) };
|
|
415
433
|
const bound = bindCallParameters(method, parameters, query, body, notes);
|
|
416
|
-
|
|
434
|
+
assertFilterOperators('microservice_execute', bound);
|
|
435
|
+
const raw = await platform.tenantRaw(method, project, executePath('m', application, microservice, routeParams), { environment, query: bound.query, body: bound.body, headers: requestHeaders, anonymous, mirrorAuthorizationCookie: true });
|
|
436
|
+
return withNormalization({ ...raw, headers: headersForMode(raw.headers, includeHeaders ?? 'essential') }, notes);
|
|
417
437
|
}));
|
|
418
438
|
server.registerTool('microservice_debug', {
|
|
419
439
|
title: 'Microservice debug',
|
|
@@ -422,8 +442,10 @@ export function registerMicroserviceTools(server, platform) {
|
|
|
422
442
|
annotations: writes
|
|
423
443
|
}, handle(config, async ({ project, environment, application, microservice, method, routeParams, query, body, parameters, headers, anonymous, asUser, cookies, language }) => {
|
|
424
444
|
const notes = [];
|
|
425
|
-
const
|
|
445
|
+
const member = anonymous === true ? asUser : await resolveIdentity(asUser, platform, project, environment);
|
|
446
|
+
const requestHeaders = { ...runIdentity(anonymous, member, cookies, headers), ...languageHeader(language, notes) };
|
|
426
447
|
const bound = bindCallParameters(method, parameters, query, body, notes);
|
|
448
|
+
assertFilterOperators('microservice_debug', bound);
|
|
427
449
|
const payload = await platform.tenantRaw(method, project, executePath('debug', application, microservice, routeParams), { environment, query: bound.query, body: bound.body, headers: requestHeaders, anonymous, mirrorAuthorizationCookie: true });
|
|
428
450
|
const unbound = unboundQueryParameters(payload.body);
|
|
429
451
|
return withNormalization({
|
|
@@ -474,7 +496,7 @@ export function registerMicroserviceTools(server, platform) {
|
|
|
474
496
|
const findings = enforcePolicy(evaluatePolicy(config, policyRules, 'microservice', definition, { operation: 'preview' }, policyOverride));
|
|
475
497
|
// Önizleme de ucun middleware'lerini koşturur: kimlik verilmezse korumalı uç 401 döner ve kuru
|
|
476
498
|
// koşu aracı tam gerektiği anda kullanılamaz hâle gelir (09-05 koşusu S-21).
|
|
477
|
-
const payload = await platform.tenantRaw('POST', project, `/microservices/${resolvedApplicationId}/preview`, { environment, body: definition, headers: { ...identityHeaders(asUser, cookies, undefined), ...languageHeader(language, normalized) }, mirrorAuthorizationCookie: true });
|
|
499
|
+
const payload = await platform.tenantRaw('POST', project, `/microservices/${resolvedApplicationId}/preview`, { environment, body: definition, headers: { ...identityHeaders(await resolveIdentity(asUser, platform, project, environment), cookies, undefined), ...languageHeader(language, normalized) }, mirrorAuthorizationCookie: true });
|
|
478
500
|
return attachFindings(withResolved(withNormalization(payload, normalized), [...resolver.resolved, ...hydrated]), findings);
|
|
479
501
|
}));
|
|
480
502
|
server.registerTool('microservice_job_history', {
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { environmentParam, guid, projectParam, writes } from './common.js';
|
|
3
|
+
import { fetchHost, pageUpdateBody, unwrap } from './screens.js';
|
|
4
|
+
import { fetchCatalogSlugs } from './components.js';
|
|
5
|
+
import { mobileTabsWarnings } from './applications.js';
|
|
6
|
+
import { PlatformApiError } from '../platform/errors.js';
|
|
7
|
+
import { handle } from '../platform/responses.js';
|
|
8
|
+
import { PAGE_CONTAINER_ELEMENT_ID, ensurePageContainer } from '../knowledge/normalize.js';
|
|
9
|
+
import { mobileProfile, shellLessPageSkeleton } from '../knowledge/platform/mobile.js';
|
|
10
|
+
import { MAX_MOBILE_TABS } from '../knowledge/platform/mobileTabs.js';
|
|
11
|
+
import { forgetApplication } from '../knowledge/platform/resolve.js';
|
|
12
|
+
import { readKnowledgeFile } from '../resources/knowledge.js';
|
|
13
|
+
/** Ana sayfa: açıkça verilen, yoksa ilk sekme, yoksa ilk sayfa. */
|
|
14
|
+
function homepageSlug(input) {
|
|
15
|
+
return input.homepage ?? input.tabs?.[0]?.pageSlug ?? input.pages[0].pageSlug;
|
|
16
|
+
}
|
|
17
|
+
export function mobileAppInputErrors(input) {
|
|
18
|
+
const errors = [];
|
|
19
|
+
const slugs = input.pages.map(page => page.pageSlug);
|
|
20
|
+
const repeated = slugs.filter((slug, index) => slugs.indexOf(slug) !== index);
|
|
21
|
+
if (input.pages.length === 0)
|
|
22
|
+
errors.push('pages en az bir sayfa ister');
|
|
23
|
+
if (repeated.length > 0)
|
|
24
|
+
errors.push(`pages içinde tekrar eden slug var: ${[...new Set(repeated)].join(', ')}`);
|
|
25
|
+
if (input.tabs !== undefined) {
|
|
26
|
+
const tabSlugs = input.tabs.map(tab => tab.pageSlug);
|
|
27
|
+
if (input.tabs.length === 0)
|
|
28
|
+
errors.push("tabs verildiyse en az bir öğe taşır; sekme istemiyorsan alanı hiç gönderme (yığın)");
|
|
29
|
+
if (input.tabs.length > MAX_MOBILE_TABS)
|
|
30
|
+
errors.push(`tabs en fazla ${MAX_MOBILE_TABS} öğe taşır (${input.tabs.length} verildi) — fazlası yığına açılan sayfa olarak kalmalı`);
|
|
31
|
+
for (const slug of tabSlugs.filter(slug => !slugs.includes(slug)))
|
|
32
|
+
errors.push(`tabs '${slug}' pages içinde yok — sekme yalnız kurulan bir sayfayı gösterebilir`);
|
|
33
|
+
if (tabSlugs.some((slug, index) => tabSlugs.indexOf(slug) !== index))
|
|
34
|
+
errors.push('tabs içinde tekrar eden sayfa var');
|
|
35
|
+
}
|
|
36
|
+
if (input.homepage !== undefined && !slugs.includes(input.homepage))
|
|
37
|
+
errors.push(`homepage '${input.homepage}' pages içinde yok`);
|
|
38
|
+
return errors;
|
|
39
|
+
}
|
|
40
|
+
export function buildMobileAppPlan(input) {
|
|
41
|
+
const home = homepageSlug(input);
|
|
42
|
+
const others = input.pages.filter(page => page.pageSlug !== home);
|
|
43
|
+
return [
|
|
44
|
+
{ step: 'application_create', tool: 'application_create', summary: "type:'mobile' uygulama; backend ana sayfayı kendisi açar" },
|
|
45
|
+
{ step: 'layout_create', tool: 'layout_create', summary: `kabuk: app-bar + slot${input.drawer ? ' + drawer widget (app-bar.menuTarget)' : ''}` },
|
|
46
|
+
...others.map((page, index) => ({ step: `page_create#${index + 1}`, tool: 'page_create', summary: `'${page.pageSlug}' (${page.pageName}), layoutId ile` })),
|
|
47
|
+
{ step: 'page_update#homepage', tool: 'page_update', summary: `backend'in ana sayfası → '${home}' (ad, slug, layoutId)` },
|
|
48
|
+
...(input.tabs ? [{ step: 'application_update', tool: 'application_update', summary: `properties.mobile.tabs: ${input.tabs.map(tab => tab.pageSlug).join(' · ')}` }] : [])
|
|
49
|
+
];
|
|
50
|
+
}
|
|
51
|
+
/** Kabuk ağacı örnek dosyasından okunur — örnek ile aracın kurduğu layout tek kaynaktır. */
|
|
52
|
+
function shellViews(input) {
|
|
53
|
+
const example = JSON.parse(readKnowledgeFile('examples', input.drawer ? 'mobile-app-shell-drawer.json' : 'mobile-app-shell-stack.json'));
|
|
54
|
+
const views = structuredClone(example.layoutCreate.views);
|
|
55
|
+
// app-bar kabukta üst güvenli alanın içindedir (mizanpaj S1); ağaçta derinlikten bağımsız aranır.
|
|
56
|
+
const findAppBar = (nodes) => nodes.find(node => node.type === 'app-bar') ?? nodes.map(node => findAppBar(node.children ?? [])).find(Boolean);
|
|
57
|
+
const appBar = findAppBar(views);
|
|
58
|
+
if (appBar && input.title)
|
|
59
|
+
appBar.props.title = { type: 'static', ref: null, data: input.title };
|
|
60
|
+
return views;
|
|
61
|
+
}
|
|
62
|
+
const SHELL_TYPES = ['app-bar', 'slot'];
|
|
63
|
+
/** Boş sayfanın şeması: kabuklu sayfada kök şablonu, kabuksuzda iskeletiyle (üst pay + kenar boşluğu). */
|
|
64
|
+
function mobilePageSchema(shell) {
|
|
65
|
+
const schema = ensurePageContainer([], mobileProfile.layout.rootContainer).schema;
|
|
66
|
+
if (!shell && schema[0])
|
|
67
|
+
shellLessPageSkeleton(schema[0]);
|
|
68
|
+
return schema;
|
|
69
|
+
}
|
|
70
|
+
export function registerMobileTools(server, platform) {
|
|
71
|
+
const config = platform.config;
|
|
72
|
+
server.registerTool('mobile_app_create', {
|
|
73
|
+
title: 'Mobil uygulamayı kabuğuyla kur',
|
|
74
|
+
description: "Mobil uygulamayı (type:'mobile'), kabuk layout'unu (app-bar + slot; drawer:true ise çekmece widget'ı), sayfalarını ve isteğe bağlı sekme ayarını (properties.mobile.tabs) TEK çağrıda kurar. Sıra: application_create → layout_create → page_create (sayfalar layoutId ile doğar) → backend'in açtığı ana sayfa seçilen ana sayfaya dönüştürülür (yetim sayfa kalmaz) → application_update (yalnız tabs verildiyse). tabs yoksa gezinme yığındır. dryRun:true planı döner, hiçbir şey yazmaz. Platformda işlem yoktur: hata olursa yanıt completed (kurulanlar), failed (düşen adım) ve remaining (kalanlar) taşır — kalanları tekil araçlarla tamamlayın. Kabuk bileşenleri (app-bar, slot) mobil katalogda yoksa layout atlanır ve uyarı döner. Rehber: platform_guide('mobile').",
|
|
75
|
+
inputSchema: {
|
|
76
|
+
project: projectParam,
|
|
77
|
+
environment: environmentParam,
|
|
78
|
+
projectId: guid,
|
|
79
|
+
slug: z.string().min(1),
|
|
80
|
+
name: z.string().min(1),
|
|
81
|
+
color: z.string().optional(),
|
|
82
|
+
pages: z.array(z.object({ pageSlug: z.string().min(1), pageName: z.string().min(1) })).min(1),
|
|
83
|
+
tabs: z.array(z.object({ pageSlug: z.string().min(1), label: z.string().optional(), icon: z.string().optional() })).optional()
|
|
84
|
+
.describe(`1-${MAX_MOBILE_TABS} sekme; her pageSlug pages içinden. Verilmezse sekme çubuğu yok (yığın). label 't:<anahtar>' ile yazılırsa çeviri sözlüğünden çözülür (platform_guide('mobile') §Çok dil).`),
|
|
85
|
+
drawer: z.boolean().optional().describe("true: layout'a drawer widget'ı + app-bar.menuTarget (çekmece)"),
|
|
86
|
+
title: z.string().optional().describe('app-bar başlığı (bütün sayfalar için sabit metin). Boşsa çubuk başlıksız çizilir — sayfa adına düşen bir yedek YOKTUR; sayfaya göre değişen başlık için title\'ı bir değişkene bağlayın ya da başlığı sayfanın içine text olarak koyun'),
|
|
87
|
+
homepage: z.string().optional().describe('Ana sayfanın pageSlug\'ı; varsayılan ilk sekme, sekme yoksa ilk sayfa'),
|
|
88
|
+
dryRun: z.boolean().optional()
|
|
89
|
+
},
|
|
90
|
+
annotations: writes
|
|
91
|
+
}, handle(config, async ({ project, environment, projectId, slug, name, color, pages, tabs, drawer, title, homepage, dryRun }) => {
|
|
92
|
+
const input = { pages, ...(tabs ? { tabs } : {}), ...(drawer ? { drawer } : {}), ...(homepage ? { homepage } : {}), ...(title ? { title } : {}) };
|
|
93
|
+
const errors = mobileAppInputErrors(input);
|
|
94
|
+
if (errors.length > 0)
|
|
95
|
+
throw new PlatformApiError(`mobile_app_create: ${errors.join(' · ')}. Hiçbir şey yazılmadı.`, 400);
|
|
96
|
+
const plan = buildMobileAppPlan(input);
|
|
97
|
+
if (dryRun)
|
|
98
|
+
return { dryRun: true, plan };
|
|
99
|
+
const completed = [];
|
|
100
|
+
const skipped = new Set();
|
|
101
|
+
const warnings = [];
|
|
102
|
+
const home = homepageSlug(input);
|
|
103
|
+
const pageIds = new Map();
|
|
104
|
+
let applicationId;
|
|
105
|
+
let homepageId;
|
|
106
|
+
let layoutId;
|
|
107
|
+
let current = 'application_create';
|
|
108
|
+
try {
|
|
109
|
+
const created = unwrap(await platform.org('POST', `/applications/${projectId}`, {
|
|
110
|
+
environment,
|
|
111
|
+
body: { slug, name, type: 'mobile', ...(color ? { color } : {}) }
|
|
112
|
+
}));
|
|
113
|
+
applicationId = String(created.id ?? '');
|
|
114
|
+
homepageId = typeof created.homepageId === 'string'
|
|
115
|
+
? created.homepageId
|
|
116
|
+
: String(created.homepage?.id ?? '');
|
|
117
|
+
forgetApplication(platform);
|
|
118
|
+
if (!applicationId || !homepageId)
|
|
119
|
+
throw new PlatformApiError('application_create yanıtı uygulama ya da ana sayfa kimliği taşımıyor — application_get ile kontrol edin.');
|
|
120
|
+
completed.push({ step: 'application_create', id: applicationId });
|
|
121
|
+
current = 'layout_create';
|
|
122
|
+
const catalog = await fetchCatalogSlugs(platform, project, environment, applicationId);
|
|
123
|
+
const missing = SHELL_TYPES.filter(type => !catalog.has(type));
|
|
124
|
+
if (missing.length > 0) {
|
|
125
|
+
skipped.add('layout_create');
|
|
126
|
+
warnings.push(`MOB-003 (uyarı) — kabuk bileşenleri mobil katalogda yok (${missing.join(', ')}): layout KURULMADI, sayfalar layout'suz açıldı. Katalog yazıldıktan sonra kabuğu ngapps://examples/mobile-app-shell-${input.drawer ? 'drawer' : input.tabs ? 'tab' : 'stack'} ile layout_create + page_update(layoutId) olarak kurun.`);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
const layout = unwrap(await platform.tenant('POST', project, `/layouts/${applicationId}`, {
|
|
130
|
+
environment,
|
|
131
|
+
body: { name: `${name} kabuğu`, views: shellViews(input), events: [], parameters: null }
|
|
132
|
+
}));
|
|
133
|
+
layoutId = String(layout.id ?? '');
|
|
134
|
+
completed.push({ step: 'layout_create', id: layoutId });
|
|
135
|
+
}
|
|
136
|
+
const others = pages.filter(page => page.pageSlug !== home);
|
|
137
|
+
for (const [index, page] of others.entries()) {
|
|
138
|
+
current = `page_create#${index + 1}`;
|
|
139
|
+
const saved = unwrap(await platform.tenant('POST', project, `/pages/${applicationId}`, {
|
|
140
|
+
environment,
|
|
141
|
+
body: {
|
|
142
|
+
name: page.pageName,
|
|
143
|
+
slug: page.pageSlug,
|
|
144
|
+
browserTitle: '',
|
|
145
|
+
browserTitleKey: '',
|
|
146
|
+
layoutId: layoutId ?? null,
|
|
147
|
+
roleIds: [],
|
|
148
|
+
middlewareIds: [],
|
|
149
|
+
events: [],
|
|
150
|
+
schema: mobilePageSchema(layoutId !== undefined)
|
|
151
|
+
}
|
|
152
|
+
}));
|
|
153
|
+
pageIds.set(page.pageSlug, String(saved.id ?? ''));
|
|
154
|
+
completed.push({ step: current, id: String(saved.id ?? '') });
|
|
155
|
+
}
|
|
156
|
+
current = 'page_update#homepage';
|
|
157
|
+
const homePage = pages.find(page => page.pageSlug === home);
|
|
158
|
+
const existing = await fetchHost(platform, 'page', project, environment, applicationId, homepageId);
|
|
159
|
+
// Backend'in açtığı ana sayfanın kökü sözleşme dışıdır (`size: grow`, S-16). Sayfa henüz boşsa kök
|
|
160
|
+
// öteki sayfalarla aynı şablonla yeniden yazılır; içerik varsa dokunulmaz.
|
|
161
|
+
const homeSchema = existing.schema;
|
|
162
|
+
const blankHome = Array.isArray(homeSchema) && homeSchema.length === 1 && homeSchema[0]?.elementId === PAGE_CONTAINER_ELEMENT_ID && (homeSchema[0].children ?? []).length === 0;
|
|
163
|
+
await platform.tenant('PUT', project, `/pages/${applicationId}/${homepageId}`, {
|
|
164
|
+
environment,
|
|
165
|
+
body: pageUpdateBody(existing, {
|
|
166
|
+
name: homePage.pageName,
|
|
167
|
+
slug: homePage.pageSlug,
|
|
168
|
+
layoutId: layoutId ?? null,
|
|
169
|
+
...(blankHome ? { schema: mobilePageSchema(layoutId !== undefined) } : {})
|
|
170
|
+
})
|
|
171
|
+
});
|
|
172
|
+
pageIds.set(home, homepageId);
|
|
173
|
+
completed.push({ step: current, id: homepageId });
|
|
174
|
+
if (tabs) {
|
|
175
|
+
current = 'application_update';
|
|
176
|
+
const properties = {
|
|
177
|
+
mobile: {
|
|
178
|
+
tabs: {
|
|
179
|
+
enabled: true,
|
|
180
|
+
style: 'default',
|
|
181
|
+
showLabels: true,
|
|
182
|
+
items: tabs.map(tab => ({ page: pageIds.get(tab.pageSlug), ...(tab.label ? { label: tab.label } : {}), ...(tab.icon ? { icon: tab.icon } : {}) }))
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
warnings.push(...await mobileTabsWarnings(platform, applicationId, platform.resolveProject(project), homepageId, properties));
|
|
187
|
+
await platform.org('PUT', `/applications/${applicationId}`, {
|
|
188
|
+
environment,
|
|
189
|
+
body: { slug, name, homepageId, ...(color ? { color } : {}), properties }
|
|
190
|
+
});
|
|
191
|
+
forgetApplication(platform, applicationId);
|
|
192
|
+
completed.push({ step: current });
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
if (completed.length === 0)
|
|
197
|
+
throw error;
|
|
198
|
+
const done = new Set(completed.map(entry => entry.step));
|
|
199
|
+
return {
|
|
200
|
+
applicationId,
|
|
201
|
+
...(layoutId ? { layoutId } : {}),
|
|
202
|
+
completed,
|
|
203
|
+
failed: { step: current, error: error instanceof Error ? error.message : String(error) },
|
|
204
|
+
remaining: plan.map(step => step.step).filter(step => !done.has(step) && !skipped.has(step) && step !== current),
|
|
205
|
+
...(warnings.length > 0 ? { warnings } : {}),
|
|
206
|
+
note: 'Kurulum yarıda kaldı: completed kurulanları, remaining eksik adımları söyler. Kalanları tekil araçlarla tamamlayın (page_create, page_update, application_update) — mobile_app_create aynı slug ile tekrar çağrılırsa uygulamayı ikinci kez açmaya çalışır.'
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
return {
|
|
210
|
+
applicationId,
|
|
211
|
+
homepageId,
|
|
212
|
+
...(layoutId ? { layoutId } : {}),
|
|
213
|
+
applicationType: 'mobile',
|
|
214
|
+
pages: pages.map(page => ({ slug: page.pageSlug, name: page.pageName, id: pageIds.get(page.pageSlug), ...(page.pageSlug === home ? { homepage: true } : {}) })),
|
|
215
|
+
...(tabs ? { tabs: tabs.map(tab => tab.pageSlug) } : {}),
|
|
216
|
+
completed,
|
|
217
|
+
...(warnings.length > 0 ? { warnings } : {}),
|
|
218
|
+
next: "Ekranları page_schema_patch ile doldurun; doğrulama page_screenshot (mobilde varsayılan device: 'phone'). platform_guide('mobile')."
|
|
219
|
+
};
|
|
220
|
+
}));
|
|
221
|
+
}
|