@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
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import { guid, projectParam, environmentParam, readOnly, writes, updates, destructive } from './common.js';
|
|
2
|
+
import { PlatformApiError } from '../platform/errors.js';
|
|
3
|
+
import { handle } from '../platform/responses.js';
|
|
4
|
+
import { assertProcessNotProduction } from './bpm.js';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
const credentialKinds = ['api-key', 'basic', 'bearer', 'oauth2-client', 'oauth2-auth-code', 'webhook'];
|
|
7
|
+
const eventSourceKinds = ['http', 'rabbitmq', 'kafka', 'service-bus'];
|
|
8
|
+
const mailSourceKinds = ['imap', 'graph'];
|
|
9
|
+
const credentialFields = {
|
|
10
|
+
name: z.string().min(1).max(100).describe("kasa adı (tekil); düğümde credentialRef, kanal kimliklerinde sabit ad: notification-sms · notification-teams · notification-slack"),
|
|
11
|
+
connectorName: z.string().min(1).max(50).describe('connector_list adı; kaydedildikten sonra değişmez'),
|
|
12
|
+
kind: z.enum(credentialKinds),
|
|
13
|
+
baseUrl: z.string().max(500).optional().describe('instance/taban URL (Salesforce instance, Jira site, Camunda REST kökü)'),
|
|
14
|
+
tokenUrl: z.string().max(500).optional().describe('oauth2 belirteç ucu'),
|
|
15
|
+
clientId: z.string().max(200).optional(),
|
|
16
|
+
username: z.string().max(200).optional(),
|
|
17
|
+
scopes: z.array(z.string().max(200)).max(50).optional(),
|
|
18
|
+
apiKeyHeader: z.string().max(100).optional().describe("api-key başlığı; yoksa Authorization"),
|
|
19
|
+
clientSecret: z.string().max(4000).optional(),
|
|
20
|
+
password: z.string().max(4000).optional(),
|
|
21
|
+
apiKey: z.string().max(4000).optional().describe('webhook türünde webhook URL\'si buraya yazılır'),
|
|
22
|
+
refreshToken: z.string().max(4000).optional(),
|
|
23
|
+
accessToken: z.string().max(4000).optional()
|
|
24
|
+
};
|
|
25
|
+
function catalogOf(payload) {
|
|
26
|
+
const data = payload?.data ?? payload;
|
|
27
|
+
return Array.isArray(data) ? data : [];
|
|
28
|
+
}
|
|
29
|
+
export function registerConnectorTools(server, platform) {
|
|
30
|
+
const config = platform.config;
|
|
31
|
+
server.registerTool('connector_list', {
|
|
32
|
+
title: 'Bağlayıcı kataloğu',
|
|
33
|
+
description: "Kayıtlı bağlayıcıları listeler (GET bpm/connectors): ad, kategori (ai | process-engine | productivity | messaging | business-app | rpa), başlık, sürüm, desteklenen kimlik türleri ve işlem adları. category verilirse yalnız o kategori döner (süzme gateway'de). İşlem girdi/çıktı şemaları için connector_get. Süreçte kullanım: service düğümü connector { name, operation, credentialRef, input } ya da dış motor için externalEngine { engine: camunda8 | camunda7 | flowable, processKey, credentialRef, input }.",
|
|
34
|
+
inputSchema: {
|
|
35
|
+
project: projectParam,
|
|
36
|
+
environment: environmentParam,
|
|
37
|
+
category: z.enum(['ai', 'process-engine', 'productivity', 'messaging', 'business-app', 'rpa']).optional().describe('yalnız bu kategorideki bağlayıcılar')
|
|
38
|
+
},
|
|
39
|
+
annotations: readOnly
|
|
40
|
+
}, handle(config, async ({ project, environment, category }) => catalogOf(await platform.tenant('GET', project, '/bpm/connectors', { environment }))
|
|
41
|
+
.filter(connector => !category || connector.category === category)
|
|
42
|
+
.map(connector => ({
|
|
43
|
+
name: connector.name,
|
|
44
|
+
category: connector.category,
|
|
45
|
+
title: connector.title,
|
|
46
|
+
version: connector.version,
|
|
47
|
+
credentialKinds: connector.credentialKinds,
|
|
48
|
+
operations: (Array.isArray(connector.operations) ? connector.operations : []).map(operation => operation.name)
|
|
49
|
+
}))));
|
|
50
|
+
server.registerTool('connector_get', {
|
|
51
|
+
title: 'Bağlayıcıyı getir',
|
|
52
|
+
description: 'Bağlayıcının işlemlerini girdi ve çıktı şemalarıyla döner (katalogdan adla). Girdi doğrulaması zorunlu alanlar ve temel türlerle sınırlıdır; düğümde input değerleri Jint ifadesidir.',
|
|
53
|
+
inputSchema: { project: projectParam, environment: environmentParam, name: z.string().min(1).max(50) },
|
|
54
|
+
annotations: readOnly
|
|
55
|
+
}, handle(config, async ({ project, environment, name }) => {
|
|
56
|
+
const catalog = catalogOf(await platform.tenant('GET', project, '/bpm/connectors', { environment }));
|
|
57
|
+
const connector = catalog.find(candidate => candidate.name === name);
|
|
58
|
+
if (!connector)
|
|
59
|
+
throw new PlatformApiError(`connector_get: '${name}' diye bağlayıcı yok. Mevcutlar: ${catalog.map(candidate => String(candidate.name)).join(', ')}.`, 404);
|
|
60
|
+
return connector;
|
|
61
|
+
}));
|
|
62
|
+
server.registerTool('connector_credential_list', {
|
|
63
|
+
title: 'Kimlik kasasını listele',
|
|
64
|
+
description: "Kasa kayıtlarını listeler (GET bpm/connector-credentials): ad, bağlayıcı, tür, taban/belirteç URL'si, istemci kimliği, kapsamlar, secretFields (yalnız saklı sırların ADLARI) ve anahtar sürümü. Platform sırrı hiç döndürmez; gateway sır ya da belirteç adlı alanları ayrıca *** ile maskeler (BPM-017). Yetki process.manage.",
|
|
65
|
+
inputSchema: { project: projectParam, environment: environmentParam },
|
|
66
|
+
annotations: readOnly
|
|
67
|
+
}, handle(config, ({ project, environment }) => platform.tenant('GET', project, '/bpm/connector-credentials', { environment })));
|
|
68
|
+
server.registerTool('connector_credential_create', {
|
|
69
|
+
title: 'Kasaya kimlik yaz',
|
|
70
|
+
description: "Bağlayıcı kimliği oluşturur (POST bpm/connector-credentials). Sırlar (clientSecret, password, apiKey, refreshToken, accessToken) proje veri anahtarıyla şifrelenir; yanıtta ve gateway günlüğünde görünmez (BPM-017). Türler: basic · api-key (apiKeyHeader) · bearer · oauth2-client (tokenUrl, clientId, clientSecret, scopes) · oauth2-auth-code (refreshToken elle) · webhook (URL apiKey'de; teams-webhook, slack). Yazdıktan sonra connector_credential_update { operation: 'test' }.",
|
|
71
|
+
inputSchema: { project: projectParam, environment: environmentParam, ...credentialFields },
|
|
72
|
+
annotations: writes
|
|
73
|
+
}, handle(config, async ({ project, environment, ...credential }) => {
|
|
74
|
+
assertProcessNotProduction('connector_credential_create', environment, config);
|
|
75
|
+
return platform.tenant('POST', project, '/bpm/connector-credentials', { environment, body: credential });
|
|
76
|
+
}));
|
|
77
|
+
server.registerTool('connector_credential_update', {
|
|
78
|
+
title: 'Kasa kimliğini güncelle / test et / döndür',
|
|
79
|
+
description: "operation save (varsayılan; PUT bpm/connector-credentials/{id}, tam gövde — bütün sır alanları boşsa saklı sırlar korunur; TEK bir sır alanı bile gönderilirse saklı sırların tamamı gönderilenle değişir, o türün bütün sırlarını birlikte verin: oauth2-client clientSecret · oauth2-auth-code clientSecret + refreshToken · basic password · api-key/webhook apiKey · bearer accessToken) · test (POST …/{id}/test-connection; bağlayıcının bağlantı denemesi, hata 502 ConnectorFailed) · rotate (POST …/rotate; bütün sırları en yeni proje anahtar sürümüyle yeniden şifreler, id almaz, değişen sayısını döner; şifreleme anahtarı yapılandırılmamışsa kasa boş olsa bile ProtectionKeyUnavailable hatası döner — 0 başarı değildir).",
|
|
80
|
+
inputSchema: {
|
|
81
|
+
project: projectParam,
|
|
82
|
+
environment: environmentParam,
|
|
83
|
+
id: guid.optional().describe('save ve test için zorunlu'),
|
|
84
|
+
operation: z.enum(['save', 'test', 'rotate']).optional(),
|
|
85
|
+
...z.object(credentialFields).partial().shape
|
|
86
|
+
},
|
|
87
|
+
annotations: updates
|
|
88
|
+
}, handle(config, async ({ project, environment, id, operation, ...credential }) => {
|
|
89
|
+
assertProcessNotProduction('connector_credential_update', environment, config);
|
|
90
|
+
const resolvedOperation = operation ?? 'save';
|
|
91
|
+
if (resolvedOperation === 'rotate')
|
|
92
|
+
return platform.tenant('POST', project, '/bpm/connector-credentials/rotate', { environment });
|
|
93
|
+
if (!id)
|
|
94
|
+
throw new PlatformApiError(`connector_credential_update: operation '${resolvedOperation}' id ister (istek gönderilmedi).`, 400);
|
|
95
|
+
if (resolvedOperation === 'test')
|
|
96
|
+
return platform.tenant('POST', project, `/bpm/connector-credentials/${id}/test-connection`, { environment });
|
|
97
|
+
if (!credential.name || !credential.connectorName || !credential.kind)
|
|
98
|
+
throw new PlatformApiError("connector_credential_update: save tam gövde ister — name, connectorName, kind (connector_credential_list çıktısından) (istek gönderilmedi).", 400);
|
|
99
|
+
return platform.tenant('PUT', project, `/bpm/connector-credentials/${id}`, { environment, body: credential });
|
|
100
|
+
}));
|
|
101
|
+
server.registerTool('connector_credential_delete', {
|
|
102
|
+
title: 'Kasa kimliğini sil',
|
|
103
|
+
description: 'Kimliği siler (DELETE bpm/connector-credentials/{id}). Bir süreç düğümü kullanıyorsa 422 ReferencedByProcess, bir olay ya da e-posta kaynağı kullanıyorsa 400 RowHasExistingRelation döner; önce başvuruları değiştirin.',
|
|
104
|
+
inputSchema: { project: projectParam, environment: environmentParam, id: guid },
|
|
105
|
+
annotations: destructive
|
|
106
|
+
}, handle(config, async ({ project, environment, id }) => {
|
|
107
|
+
assertProcessNotProduction('connector_credential_delete', environment, config);
|
|
108
|
+
return platform.tenant('DELETE', project, `/bpm/connector-credentials/${id}`, { environment });
|
|
109
|
+
}));
|
|
110
|
+
server.registerTool('process_event_source_list', {
|
|
111
|
+
title: 'Olay kaynaklarını listele',
|
|
112
|
+
description: 'Olay kaynaklarını listeler (GET bpm/event-sources): ad, tür, adres, mesaj adı, korelasyon anahtarı ifadesi, tampon süresi, etkinlik ve son olay zamanı.',
|
|
113
|
+
inputSchema: { project: projectParam, environment: environmentParam },
|
|
114
|
+
annotations: readOnly
|
|
115
|
+
}, handle(config, ({ project, environment }) => platform.tenant('GET', project, '/bpm/event-sources', { environment })));
|
|
116
|
+
server.registerTool('process_event_source_create', {
|
|
117
|
+
title: 'Olay kaynağı yaz',
|
|
118
|
+
description: "Dış olayı BPM mesajına çeviren kaynak oluşturur (POST bpm/event-sources) ya da id verilirse tam gövdeyle günceller (PUT …/{id}). Olay girişi process_trigger { kind: 'event-source', name, eventId, payload }: payload korelasyon anahtarı Jint ifadesiyle (ör. 'payload.siparisNo') mesaja dönüşür, aynı eventId ikinci kez işlenmez. kind http taşımadan bağımsızdır; kafka/service-bus tüketicisi henüz yok (NuGet), rabbitmq dinleyicisi borç.",
|
|
119
|
+
inputSchema: {
|
|
120
|
+
project: projectParam,
|
|
121
|
+
environment: environmentParam,
|
|
122
|
+
id: guid.optional().describe('verilirse güncelleme'),
|
|
123
|
+
name: z.string().min(1).max(100),
|
|
124
|
+
kind: z.enum(eventSourceKinds),
|
|
125
|
+
address: z.string().max(500).optional().describe('konu/kuyruk adresi'),
|
|
126
|
+
credentialRef: z.string().max(100).optional().describe('kasadaki kaydın adı (connector_credential_list); olmayan ad 404'),
|
|
127
|
+
messageName: z.string().min(1).max(100),
|
|
128
|
+
correlationKey: z.string().max(500).optional().describe("Jint ifadesi, ör. 'payload.siparisNo'"),
|
|
129
|
+
bufferSeconds: z.number().int().min(0).max(86400).optional(),
|
|
130
|
+
isActive: z.boolean().optional()
|
|
131
|
+
},
|
|
132
|
+
annotations: writes
|
|
133
|
+
}, handle(config, async ({ project, environment, id, ...source }) => {
|
|
134
|
+
assertProcessNotProduction('process_event_source_create', environment, config);
|
|
135
|
+
return id
|
|
136
|
+
? platform.tenant('PUT', project, `/bpm/event-sources/${id}`, { environment, body: source })
|
|
137
|
+
: platform.tenant('POST', project, '/bpm/event-sources', { environment, body: source });
|
|
138
|
+
}));
|
|
139
|
+
server.registerTool('process_event_source_delete', {
|
|
140
|
+
title: 'Olay kaynağını sil',
|
|
141
|
+
description: 'Olay kaynağını siler (DELETE bpm/event-sources/{id}); o ada gelen olaylar 404 alır.',
|
|
142
|
+
inputSchema: { project: projectParam, environment: environmentParam, id: guid },
|
|
143
|
+
annotations: destructive
|
|
144
|
+
}, handle(config, async ({ project, environment, id }) => {
|
|
145
|
+
assertProcessNotProduction('process_event_source_delete', environment, config);
|
|
146
|
+
return platform.tenant('DELETE', project, `/bpm/event-sources/${id}`, { environment });
|
|
147
|
+
}));
|
|
148
|
+
server.registerTool('process_mail_source_list', {
|
|
149
|
+
title: 'E-posta kaynaklarını listele',
|
|
150
|
+
description: 'E-posta kaynaklarını listeler (GET bpm/mail-sources): tür (imap | graph), sunucu, posta kutusu, klasör, kurallar, son UID ve son yoklama zamanı.',
|
|
151
|
+
inputSchema: { project: projectParam, environment: environmentParam },
|
|
152
|
+
annotations: readOnly
|
|
153
|
+
}, handle(config, ({ project, environment }) => platform.tenant('GET', project, '/bpm/mail-sources', { environment })));
|
|
154
|
+
server.registerTool('process_mail_source_create', {
|
|
155
|
+
title: 'E-posta kaynağı yaz',
|
|
156
|
+
description: "Gelen e-postayı kurallarla BPM mesajına çeviren kaynak oluşturur (POST bpm/mail-sources) ya da id verilirse günceller (PUT …/{id}). Kural { subjectPattern, fromPattern (regex), messageName, correlationKey (Jint; mail.subject, mail.from, match.groups) }; ekler files'a yazılır, aynı Message-ID ikinci kez işlenmez. credentialRef kasadaki bir kaydın adıdır (connector_credential_list): kayıtta kimliğe çözülür, olmayan ad 404 (connector-credential: <ad>) döner; kasa kaydının adı sonradan değişirse kaynak yeni adı gösterir. imap kimliği 'imap' bağlayıcısının kasa kaydıdır (basic), graph kimliği 'microsoft-graph' (oauth2-client). Zamanlanmış yoklama yok: process_trigger { kind: 'mail-source', sourceId }.",
|
|
157
|
+
inputSchema: {
|
|
158
|
+
project: projectParam,
|
|
159
|
+
environment: environmentParam,
|
|
160
|
+
id: guid.optional().describe('verilirse güncelleme'),
|
|
161
|
+
name: z.string().min(1).max(100),
|
|
162
|
+
kind: z.enum(mailSourceKinds),
|
|
163
|
+
host: z.string().max(200).optional(),
|
|
164
|
+
port: z.number().int().min(1).max(65535).optional(),
|
|
165
|
+
useSsl: z.boolean().optional(),
|
|
166
|
+
mailbox: z.string().max(200).optional(),
|
|
167
|
+
folder: z.string().max(200).optional(),
|
|
168
|
+
credentialRef: z.string().min(1).max(100).describe('kasadaki kaydın adı (connector_credential_list); olmayan ad 404'),
|
|
169
|
+
rules: z.array(z.object({
|
|
170
|
+
subjectPattern: z.string().max(500).optional(),
|
|
171
|
+
fromPattern: z.string().max(500).optional(),
|
|
172
|
+
messageName: z.string().min(1).max(100),
|
|
173
|
+
correlationKey: z.string().max(500).optional()
|
|
174
|
+
})).min(1).max(50),
|
|
175
|
+
isActive: z.boolean().optional()
|
|
176
|
+
},
|
|
177
|
+
annotations: writes
|
|
178
|
+
}, handle(config, async ({ project, environment, id, ...source }) => {
|
|
179
|
+
assertProcessNotProduction('process_mail_source_create', environment, config);
|
|
180
|
+
return id
|
|
181
|
+
? platform.tenant('PUT', project, `/bpm/mail-sources/${id}`, { environment, body: source })
|
|
182
|
+
: platform.tenant('POST', project, '/bpm/mail-sources', { environment, body: source });
|
|
183
|
+
}));
|
|
184
|
+
server.registerTool('process_mail_source_delete', {
|
|
185
|
+
title: 'E-posta kaynağını sil',
|
|
186
|
+
description: 'E-posta kaynağını siler (DELETE bpm/mail-sources/{id}).',
|
|
187
|
+
inputSchema: { project: projectParam, environment: environmentParam, id: guid },
|
|
188
|
+
annotations: destructive
|
|
189
|
+
}, handle(config, async ({ project, environment, id }) => {
|
|
190
|
+
assertProcessNotProduction('process_mail_source_delete', environment, config);
|
|
191
|
+
return platform.tenant('DELETE', project, `/bpm/mail-sources/${id}`, { environment });
|
|
192
|
+
}));
|
|
193
|
+
}
|
|
@@ -118,7 +118,7 @@ export function registerDatasourceTools(server, platform) {
|
|
|
118
118
|
}, handle(config, ({ project, environment }) => platform.tenant('GET', project, '/datasources/resources', { environment })));
|
|
119
119
|
server.registerTool('datasource_configuration_options', {
|
|
120
120
|
title: 'Yapılandırma seçenekleri',
|
|
121
|
-
description: "Datasource'un alan tipi kataloğunu döner: commonType başına dbType listesi, varsayılan tip, tipin kabul ettiği seçenek anahtarları (length/precision/collation/...) ve dönüştürülebilir tipler; ayrıca ilişki kuralları (onUpdate/onDelete) ve identity generation tipleri. VARSAYILAN YANIT ÖZETTİR (~5 KB): collation DEĞER listesi (816 kayıt, tam yanıtın %79'u) dışarıdadır — tipin collation kabul edip etmediği zaten options'ta yazar. Collation değerleri gerçekten gerekiyorsa includeCollations: true ile tam yanıtı isteyin (~45 KB).",
|
|
121
|
+
description: "Datasource'un alan tipi kataloğunu döner: commonType başına dbType listesi, varsayılan tip, tipin kabul ettiği seçenek anahtarları (length/precision/collation/...) ve dönüştürülebilir tipler; ayrıca ilişki kuralları (onUpdate/onDelete) ve identity generation tipleri. İlişki alanına yazarken kuralı SAYI olarak verin (`None` 0 · `Cascade` 1 · `SetNull` 2 · `SetDefault` 3 — `Rule` sırası): her backend sürümünde çalışır. Katalog adı listeler; `onDelete` adı (`Cascade`) 2026-09-27'den sonraki backend'de de kabul edilir, `onUpdate` adı hâlâ reddedilir (500). VARSAYILAN YANIT ÖZETTİR (~5 KB): collation DEĞER listesi (816 kayıt, tam yanıtın %79'u) dışarıdadır — tipin collation kabul edip etmediği zaten options'ta yazar. Collation değerleri gerçekten gerekiyorsa includeCollations: true ile tam yanıtı isteyin (~45 KB).",
|
|
122
122
|
inputSchema: {
|
|
123
123
|
project: projectParam,
|
|
124
124
|
environment: environmentParam,
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { guid, projectParam, environmentParam, pagingParams, readOnly, writes, updates, destructive, microOps } from './common.js';
|
|
2
|
+
import { applyPolicyMode, attachFindings, PolicyBlockError } from '../knowledge/policy.js';
|
|
3
|
+
import { assertInline, writeLocalFile } from './bpmGovernance.js';
|
|
4
|
+
import { assertProcessNotProduction, dataOf } from './bpm.js';
|
|
5
|
+
import { unmappedMembers, withUnmappedMembers } from '../knowledge/schemaGuard.js';
|
|
6
|
+
import { resolvePatchOperations } from '../knowledge/outlines.js';
|
|
7
|
+
import { decisionFindings } from '../knowledge/decision.js';
|
|
8
|
+
import { withNormalization } from '../knowledge/normalize.js';
|
|
9
|
+
import { PlatformApiError } from '../platform/errors.js';
|
|
10
|
+
import { handle } from '../platform/responses.js';
|
|
11
|
+
import { readFile } from 'node:fs/promises';
|
|
12
|
+
import fastJsonPatch from 'fast-json-patch';
|
|
13
|
+
import { resolve } from 'node:path';
|
|
14
|
+
import { z } from 'zod';
|
|
15
|
+
const maxInlineXmlBytes = 256_000;
|
|
16
|
+
const maxDmnBytes = 5_000_000;
|
|
17
|
+
const decisionParam = z.record(z.unknown())
|
|
18
|
+
.describe("Karar modeli: { slug, name, kind: table | literal, hitPolicy: unique | any | first | priority | collect | rule-order | output-order, aggregation?, inputs[{ id, label, expression, typeRef, allowedValues }], outputs[{ id, name, typeRef, allowedValues, defaultOutputEntry }], rules[{ id, description, inputEntries[], outputEntries[] }], requires[], inputData[], literalExpression?, typeRef? }. Hücreler FEEL; '-' joker. Ayrıntı platform_guide('decision').");
|
|
19
|
+
const policyOverrideParam = z.boolean().optional()
|
|
20
|
+
.describe("true: politika block bulgularını warn'a indirir (bilinçli istisna; yanıtta işaretlenir)");
|
|
21
|
+
const patchOperationsParam = z.array(z.record(z.unknown())).min(1)
|
|
22
|
+
.describe("RFC 6902 JSON Patch işlemleri, yollar karar modeline göre. Kural ve sütun hedeflerken İNDEKS YERİNE SEÇİCİ: { op: 'replace', path: '/rules[id=buyuk]/outputEntries/0', value: '3' }; yeni kural '/rules/-'.");
|
|
23
|
+
function lintDecision(config, decision, policyOverride) {
|
|
24
|
+
if (config.policyMode === 'off')
|
|
25
|
+
return [];
|
|
26
|
+
const findings = applyPolicyMode(config, decisionFindings(decision), policyOverride === true);
|
|
27
|
+
const blocking = findings.filter(finding => finding.severity === 'block');
|
|
28
|
+
if (blocking.length > 0)
|
|
29
|
+
throw new PolicyBlockError(blocking);
|
|
30
|
+
return findings;
|
|
31
|
+
}
|
|
32
|
+
export function registerDecisionTools(server, platform) {
|
|
33
|
+
const config = platform.config;
|
|
34
|
+
server.registerTool('decision_list', {
|
|
35
|
+
title: 'Kararları listele',
|
|
36
|
+
description: "DMN karar tablolarını ve literal kararları listeler (GET bpm/decisions): slug, ad, kind, hitPolicy, aktif ve taslak sürüm numarası. Süreçte 'decision' düğümü decisionSlug ile başvurur.",
|
|
37
|
+
inputSchema: { project: projectParam, environment: environmentParam, searchTerm: z.string().max(200).optional(), applicationId: guid.optional(), ...pagingParams },
|
|
38
|
+
annotations: readOnly
|
|
39
|
+
}, handle(config, ({ project, environment, ...query }) => platform.tenant('GET', project, '/bpm/decisions', { environment, query })));
|
|
40
|
+
server.registerTool('decision_get', {
|
|
41
|
+
title: 'Kararı getir',
|
|
42
|
+
description: "Kararı getirir (GET bpm/decisions/{id}): decision güncel model (taslak varsa taslak), activeDecision yayındaki model, versions[] (draft → active → retiring → retired). Değerlendirme için decision_preview.",
|
|
43
|
+
inputSchema: { project: projectParam, environment: environmentParam, id: guid },
|
|
44
|
+
annotations: readOnly
|
|
45
|
+
}, handle(config, ({ project, environment, id }) => platform.tenant('GET', project, `/bpm/decisions/${id}`, { environment })));
|
|
46
|
+
server.registerTool('decision_create', {
|
|
47
|
+
title: 'Karar oluştur',
|
|
48
|
+
description: "Yeni karar yazar (POST bpm/decisions; taslak sürüm). İlk kullanımdan önce platform_guide('decision') okuyun. Gateway yazmadan önce denetler: DMN-001 (unique tabloda aynı girdiyi eşleyen iki kural, block) ve DMN-002 (FEEL alt kümesinde olmayan işlev, warn — backend yine de yazımı 422 ile reddeder). Yayın decision_publish; süreçte kullanım 'decision' düğümü { decisionSlug, input, output }.",
|
|
49
|
+
inputSchema: { project: projectParam, environment: environmentParam, applicationId: guid.optional(), decision: decisionParam, policyOverride: policyOverrideParam },
|
|
50
|
+
annotations: writes
|
|
51
|
+
}, handle(config, async ({ project, environment, applicationId, decision, policyOverride }) => {
|
|
52
|
+
assertProcessNotProduction('decision_create', environment, config);
|
|
53
|
+
const findings = lintDecision(config, decision, policyOverride);
|
|
54
|
+
const saved = await platform.tenant('POST', project, '/bpm/decisions', { environment, body: { applicationId, decision } });
|
|
55
|
+
return withUnmappedMembers(attachFindings(dataOf(saved), findings), unmappedMembers('CreateDecisionCommand', { applicationId, decision }));
|
|
56
|
+
}));
|
|
57
|
+
server.registerTool('decision_update', {
|
|
58
|
+
title: 'Kararı güncelle',
|
|
59
|
+
description: "Kararın taslağını tam modelle yazar (PUT bpm/decisions/{id}; taslak yoksa açılır) ya da retireVersion ile aktif/emekliye ayrılan sürümü emekliye ayırır (POST …/versions/{n}/retire). İkisinden biri. Backend sürüm denetimi yapmaz: aynı kararı iki ajan yazıyorsa son yazan kazanır; hedefli değişiklik için decision_patch. Yayından sonra slug değişmez. DMN-001/002 denetimi decision_create ile aynı.",
|
|
60
|
+
inputSchema: {
|
|
61
|
+
project: projectParam,
|
|
62
|
+
environment: environmentParam,
|
|
63
|
+
id: guid,
|
|
64
|
+
decision: decisionParam.optional(),
|
|
65
|
+
retireVersion: z.number().int().min(1).optional().describe('emekliye ayrılacak sürüm numarası (decision yerine)'),
|
|
66
|
+
policyOverride: policyOverrideParam
|
|
67
|
+
},
|
|
68
|
+
annotations: updates
|
|
69
|
+
}, handle(config, async ({ project, environment, id, decision, retireVersion, policyOverride }) => {
|
|
70
|
+
assertProcessNotProduction('decision_update', environment, config);
|
|
71
|
+
if (Boolean(decision) === (retireVersion !== undefined))
|
|
72
|
+
throw new PlatformApiError("decision_update: 'decision' ya da 'retireVersion' — yalnız biri (istek gönderilmedi).", 400);
|
|
73
|
+
if (retireVersion !== undefined)
|
|
74
|
+
return dataOf(await platform.tenant('POST', project, `/bpm/decisions/${id}/versions/${retireVersion}/retire`, { environment }));
|
|
75
|
+
const findings = lintDecision(config, decision, policyOverride);
|
|
76
|
+
return withUnmappedMembers(attachFindings(dataOf(await platform.tenant('PUT', project, `/bpm/decisions/${id}`, { environment, body: { decision } })), findings), unmappedMembers('UpdateDecisionCommand', { decision }));
|
|
77
|
+
}));
|
|
78
|
+
server.registerTool('decision_patch', {
|
|
79
|
+
title: 'Karara patch uygula',
|
|
80
|
+
description: "Tam modeli bağlama almadan hedefli değişiklik: gateway güncel modeli okur (GET), seçicileri (/rules[id=x], /inputs[id=x]) çözer, yamayı yerelde uygular, DMN-001/002 denetiminden geçirir ve tam modeli taslağa yazar (PUT). Backend sürüm denetimi yok: okuma ile yazma arasında başka yazan olursa değişikliği ezilir. Yanıt { patchTargets, decision }.",
|
|
81
|
+
inputSchema: {
|
|
82
|
+
project: projectParam,
|
|
83
|
+
environment: environmentParam,
|
|
84
|
+
id: guid,
|
|
85
|
+
operations: patchOperationsParam.optional(),
|
|
86
|
+
ops: patchOperationsParam.optional().describe("'operations' ile aynı alan (eşanlamlı)"),
|
|
87
|
+
policyOverride: policyOverrideParam
|
|
88
|
+
},
|
|
89
|
+
annotations: updates
|
|
90
|
+
}, handle(config, async ({ project, environment, id, operations: givenOperations, ops, policyOverride }) => {
|
|
91
|
+
assertProcessNotProduction('decision_patch', environment, config);
|
|
92
|
+
const operations = microOps('decision_patch', ops, givenOperations);
|
|
93
|
+
const current = dataOf(await platform.tenant('GET', project, `/bpm/decisions/${id}`, { environment }));
|
|
94
|
+
const model = structuredClone((current.decision ?? {}));
|
|
95
|
+
const resolved = resolvePatchOperations(model, operations, 'decision_get');
|
|
96
|
+
let patched;
|
|
97
|
+
try {
|
|
98
|
+
patched = fastJsonPatch.applyPatch(model, resolved.operations, true, false).newDocument;
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
throw new PlatformApiError(`decision_patch: yama uygulanamadı — ${error instanceof Error ? error.message : String(error)} (istek gönderilmedi). Yolları decision_get çıktısına göre kurun.`, 400);
|
|
102
|
+
}
|
|
103
|
+
const findings = lintDecision(config, patched, policyOverride);
|
|
104
|
+
const saved = dataOf(await platform.tenant('PUT', project, `/bpm/decisions/${id}`, { environment, body: { decision: patched } }));
|
|
105
|
+
return withNormalization(attachFindings({ patchTargets: resolved.targets, decision: saved.decision ?? patched }, findings), resolved.notes);
|
|
106
|
+
}));
|
|
107
|
+
server.registerTool('decision_delete', {
|
|
108
|
+
title: 'Kararı sil',
|
|
109
|
+
description: "Kararı ve bütün sürümlerini siler (DELETE bpm/decisions/{id}). Bir süreç tanımı decisionSlug ile başvuruyorsa 422 ReferencedByProcess, başka karar requires ile başvuruyorsa 422 DecisionInvalid.",
|
|
110
|
+
inputSchema: { project: projectParam, environment: environmentParam, id: guid },
|
|
111
|
+
annotations: destructive
|
|
112
|
+
}, handle(config, async ({ project, environment, id }) => {
|
|
113
|
+
assertProcessNotProduction('decision_delete', environment, config);
|
|
114
|
+
return platform.tenant('DELETE', project, `/bpm/decisions/${id}`, { environment });
|
|
115
|
+
}));
|
|
116
|
+
server.registerTool('decision_clone', {
|
|
117
|
+
title: 'Kararı klonla',
|
|
118
|
+
description: 'Kararın güncel modelinden yeni slug ile taslak kopya oluşturur (GET + POST bpm/decisions). variable verilmemişse slug\'dan türetildiği için üst kararlar yeni adı görür; requires başvuruları kopyalanır.',
|
|
119
|
+
inputSchema: { project: projectParam, environment: environmentParam, id: guid, slug: z.string().min(1).max(100) },
|
|
120
|
+
annotations: writes
|
|
121
|
+
}, handle(config, async ({ project, environment, id, slug }) => {
|
|
122
|
+
assertProcessNotProduction('decision_clone', environment, config);
|
|
123
|
+
const current = dataOf(await platform.tenant('GET', project, `/bpm/decisions/${id}`, { environment }));
|
|
124
|
+
const decision = { ...structuredClone((current.decision ?? {})), slug };
|
|
125
|
+
return dataOf(await platform.tenant('POST', project, '/bpm/decisions', { environment, body: { applicationId: current.applicationId ?? undefined, decision } }));
|
|
126
|
+
}));
|
|
127
|
+
server.registerTool('decision_preview', {
|
|
128
|
+
title: 'Kararı değerlendir (kuru)',
|
|
129
|
+
description: "Kararı verilen girdilerle YAN ETKİSİZ değerlendirir (POST bpm/decisions/{id}/evaluate; transaction açmaz, defter yazmaz — tablo tasarımını denemenin yolu, platform_guide('decision') §Deneme): version verilmezse taslak (yoksa aktif). DRD'deki alt kararlar (requires) önce değerlendirilir. Yanıt { value, outputs, matchedRules, decisions[] (her karar için inputs, value, matchedRules) }. unique'te birden çok kural eşleşirse 422 DecisionHitPolicyViolated (eşleşen kural kimlikleriyle); hiçbiri eşleşmezse defaultOutputEntry ya da null.",
|
|
130
|
+
inputSchema: {
|
|
131
|
+
project: projectParam,
|
|
132
|
+
environment: environmentParam,
|
|
133
|
+
id: guid,
|
|
134
|
+
inputs: z.record(z.unknown()).describe("girdi adları → değerler, ör. { tutar: 180000, kategori: 'makine' }; tarih '2026-09-17', süre 'P3D'"),
|
|
135
|
+
version: z.number().int().min(1).optional()
|
|
136
|
+
},
|
|
137
|
+
annotations: readOnly
|
|
138
|
+
}, handle(config, ({ project, environment, id, inputs, version }) => platform.tenant('POST', project, `/bpm/decisions/${id}/evaluate`, { environment, query: { version }, body: { inputs } })));
|
|
139
|
+
server.registerTool('decision_publish', {
|
|
140
|
+
title: 'Kararı yayınla',
|
|
141
|
+
description: "Taslağı aktif sürüm yapar (POST bpm/decisions/{id}/publish); önceki aktif sürüm retiring olur. requires içindeki her kararın aktif sürümü olmalı (422 DecisionUnknown) ve döngü olmamalı (422 DecisionInvalid). Gateway yayından önce taslağı DMN-001/002 ile denetler. production hedefi durur (BPM-001).",
|
|
142
|
+
inputSchema: { project: projectParam, environment: environmentParam, id: guid, policyOverride: policyOverrideParam },
|
|
143
|
+
annotations: writes
|
|
144
|
+
}, handle(config, async ({ project, environment, id, policyOverride }) => {
|
|
145
|
+
assertProcessNotProduction('decision_publish', environment, config);
|
|
146
|
+
const current = dataOf(await platform.tenant('GET', project, `/bpm/decisions/${id}`, { environment }));
|
|
147
|
+
const findings = lintDecision(config, (current.decision ?? {}), policyOverride);
|
|
148
|
+
return attachFindings(dataOf(await platform.tenant('POST', project, `/bpm/decisions/${id}/publish`, { environment })), findings);
|
|
149
|
+
}));
|
|
150
|
+
server.registerTool('decision_dmn_get', {
|
|
151
|
+
title: 'Kararı DMN 1.3 XML olarak dışa aktar',
|
|
152
|
+
description: "Kararı ve requires ile bağlı alt kararlarını DMN 1.3 XML'e çevirir (GET bpm/decisions/{id}/dmn; zeyrek: uzantısı kaynak ve kategori bilgisini taşır). version verilmezse taslak (yoksa aktif). Yanıt { decisionId, versionNumber, state, sizeBytes, xml }; 256 KB üstü için outPath verin.",
|
|
153
|
+
inputSchema: {
|
|
154
|
+
project: projectParam,
|
|
155
|
+
environment: environmentParam,
|
|
156
|
+
id: guid,
|
|
157
|
+
version: z.number().int().min(1).optional(),
|
|
158
|
+
outPath: z.string().min(1).optional().describe('verilirse XML bu yerel yola yazılır ve yanıt yalnız özet döner')
|
|
159
|
+
},
|
|
160
|
+
annotations: readOnly
|
|
161
|
+
}, handle(config, async ({ project, environment, id, version, outPath }) => {
|
|
162
|
+
const response = await platform.tenantWithHeaders('GET', project, `/bpm/decisions/${id}/dmn`, { environment, query: { version }, expectBinary: true });
|
|
163
|
+
const payload = response.body;
|
|
164
|
+
const xml = payload.bytes.toString('utf8').replace(/^\uFEFF/, '');
|
|
165
|
+
const summary = {
|
|
166
|
+
decisionId: id,
|
|
167
|
+
versionNumber: Number(response.headers['x-decision-version']) || null,
|
|
168
|
+
state: response.headers['x-decision-version-state'] ?? null,
|
|
169
|
+
sizeBytes: payload.bytes.byteLength
|
|
170
|
+
};
|
|
171
|
+
if (outPath)
|
|
172
|
+
return { ...summary, path: await writeLocalFile('decision_dmn_get', outPath, xml) };
|
|
173
|
+
const inline = { ...summary, xml };
|
|
174
|
+
assertInline('decision_dmn_get', config, inline);
|
|
175
|
+
return inline;
|
|
176
|
+
}));
|
|
177
|
+
server.registerTool('decision_dmn_update', {
|
|
178
|
+
title: 'DMN 1.3 XML içe aktar',
|
|
179
|
+
description: "DMN 1.3 XML'deki kararları içe aktarır (POST bpm/decisions/import-dmn): slug'ı (decision id) mevcut karar taslağına yazılır, yoksa yeni karar oluşur; DRD bilgi gereksinimleri requires olur. xml (≤ 256 KB) ya da filePath (≤ 5 MB) — biri. Camunda/Trisotech tablolarında desteklenmeyen FEEL işlevi değerlendirmede 422 ExpressionInvalid döner; içe aktardıktan sonra decision_preview ile deneyin. DTD/dış varlık içeren XML 400.",
|
|
180
|
+
inputSchema: {
|
|
181
|
+
project: projectParam,
|
|
182
|
+
environment: environmentParam,
|
|
183
|
+
applicationId: guid.optional(),
|
|
184
|
+
xml: z.string().min(1).max(maxInlineXmlBytes).optional(),
|
|
185
|
+
filePath: z.string().min(1).optional().describe('yerel .dmn dosyası')
|
|
186
|
+
},
|
|
187
|
+
annotations: updates
|
|
188
|
+
}, handle(config, async ({ project, environment, applicationId, xml, filePath }) => {
|
|
189
|
+
assertProcessNotProduction('decision_dmn_update', environment, config);
|
|
190
|
+
if (Boolean(xml) === Boolean(filePath))
|
|
191
|
+
throw new PlatformApiError("decision_dmn_update: 'xml' ya da 'filePath' — yalnız biri (istek gönderilmedi).", 400);
|
|
192
|
+
let content = xml ?? '';
|
|
193
|
+
if (filePath) {
|
|
194
|
+
try {
|
|
195
|
+
content = await readFile(resolve(filePath), 'utf8');
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
throw new PlatformApiError(`decision_dmn_update: dosya okunamadı — ${resolve(filePath)} (${error instanceof Error ? error.message : String(error)}). Yol gateway sürecinin çalıştığı makineye göre çözülür (istek gönderilmedi).`, 400);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
content = content.replace(/^/, '');
|
|
202
|
+
if (Buffer.byteLength(content, 'utf8') > maxDmnBytes)
|
|
203
|
+
throw new PlatformApiError(`decision_dmn_update: XML en çok ${maxDmnBytes} B (istek gönderilmedi).`, 413);
|
|
204
|
+
return platform.tenant('POST', project, '/bpm/decisions/import-dmn', { environment, body: { applicationId, xml: content } });
|
|
205
|
+
}));
|
|
206
|
+
}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { orphanedFlowWarnings, orphanedFlowPlan, orphanedFlowMessage, boundEventOps, stripGatewayEventFields, staleSetterWarnings, normalizeSchemaOps, validationNote, componentDefaultsNote, replacePropNote, flexSizeWarnings, nestedRepeaterNodes, nestedRepeaterMessage, stringStyleNodes, stringStyleWarning, inertFlexPropNodes, inertFlexPropWarning, verticalGapWarnings, withNormalization, FLEX_LAYOUT_PROP_NAMES } from '../knowledge/normalize.js';
|
|
2
|
-
import { opsParam, writeViewParam, outlineWriteResponse, unknownEventOps, collectTypes, simulateLayoutOps, removeNodeFromTree, planEventRemovals, planResizes, planPropTypes, assertOpBodies } from './schemaOps.js';
|
|
2
|
+
import { opsParam, writeViewParam, outlineWriteResponse, unknownEventOps, collectTypes, simulateLayoutOps, removeNodeFromTree, planEventRemovals, planResizes, planPropTypes, assertOpBodies, applySkeletonOps, reshapesSkeleton } from './schemaOps.js';
|
|
3
3
|
import { guid, projectParam, environmentParam, updates, microOps } from './common.js';
|
|
4
4
|
import { fetchHost, hostPath } from './screens.js';
|
|
5
5
|
import { assertScreenWriteGuards, screenCatalogNotes } from './screenWrite.js';
|
|
6
6
|
import { emptyWriteDiff, schemaOpDrops, withWriteDiff } from '../platform/writeDiff.js';
|
|
7
7
|
import { fetchComponentEventNames } from './components.js';
|
|
8
|
-
import { boxSectionNote, collectIds, ensureBoxSections, expandSectionToggles } from '../knowledge/boxSections.js';
|
|
9
8
|
import { PlatformApiError } from '../platform/errors.js';
|
|
10
9
|
import { handle } from '../platform/responses.js';
|
|
11
10
|
import { slotWarning } from './layouts.js';
|
|
11
|
+
import { applicationTypeField, resolveProfile } from '../knowledge/platform/resolve.js';
|
|
12
|
+
import { boundFlowSteps, layoutPatchWarnings, screenProfileWarnings } from './profileWrite.js';
|
|
12
13
|
import { z } from 'zod';
|
|
13
14
|
const HOSTS = {
|
|
14
15
|
layout: {
|
|
@@ -68,13 +69,6 @@ export function registerDesignSchemaPatchTool(server, platform, host) {
|
|
|
68
69
|
throw new PlatformApiError(`component_schema_patch yalnız widget kaydına yazar; '${String(record.slug ?? id)}' bir widget değil (kind: ${String(record.kind ?? 'yok')}). Komponent kaydını component_update ile güncelleyin.`, 400);
|
|
69
70
|
}
|
|
70
71
|
const nodes = (record[spec.tree] ?? []);
|
|
71
|
-
// BX-002: bölge anahtarı Studio'da düğüm kurar; layout ve widget ağaçlarında da aynısı.
|
|
72
|
-
const sectionIds = collectIds(nodes, new Set());
|
|
73
|
-
const addedBodies = opRecords.filter(entry => entry.op === 'add_component').map(entry => entry.component);
|
|
74
|
-
collectIds(addedBodies, sectionIds);
|
|
75
|
-
const createdSections = ensureBoxSections(addedBodies, sectionIds);
|
|
76
|
-
const sectionToggles = expandSectionToggles(opRecords, nodes, sectionIds);
|
|
77
|
-
const sectionNotes = boxSectionNote([...createdSections, ...sectionToggles.created], sectionToggles.removed);
|
|
78
72
|
const events = host === 'layout' ? record.events : undefined;
|
|
79
73
|
if (opRecords.some(entry => entry.op === 'set_event' || entry.op === 'add_event')) {
|
|
80
74
|
const bound = boundEventOps(nodes, opRecords);
|
|
@@ -93,7 +87,8 @@ export function registerDesignSchemaPatchTool(server, platform, host) {
|
|
|
93
87
|
if (deletedFlows.length > 0 && allowFlowDeletion !== true)
|
|
94
88
|
throw new PlatformApiError(orphanedFlowMessage(deletedFlows), 400);
|
|
95
89
|
const added = opRecords.filter(entry => entry.op === 'add_component').map(entry => entry.component);
|
|
96
|
-
|
|
90
|
+
const resolved = await resolveProfile(platform, applicationId);
|
|
91
|
+
assertScreenWriteGuards(spec.kind, { schema: added }, resolved.profile.platform);
|
|
97
92
|
const catalogNotes = await screenCatalogNotes(platform, project, environment, applicationId, added);
|
|
98
93
|
const flowWarnings = opRecords.some(entry => entry.op === 'remove_component')
|
|
99
94
|
? [...orphanedFlowWarnings(nodes, events, opRecords), ...staleSetterWarnings(Array.isArray(record.flows) ? record.flows : [], opRecords, nodes)]
|
|
@@ -108,17 +103,28 @@ export function registerDesignSchemaPatchTool(server, platform, host) {
|
|
|
108
103
|
|| (entry.op === 'replace_prop' && FLEX_LAYOUT_PROP_NAMES.has(String(entry.prop ?? ''))));
|
|
109
104
|
const nested = simulatable ? nestedRepeaterNodes(simulated) : [];
|
|
110
105
|
if (nested.length > 0)
|
|
111
|
-
throw new PlatformApiError(nestedRepeaterMessage(nested), 400);
|
|
106
|
+
throw new PlatformApiError(nestedRepeaterMessage(nested, resolved.profile.platform), 400);
|
|
112
107
|
const reshaped = simulatable || opRecords.some(entry => entry.op === 'remove_component');
|
|
108
|
+
const profileWarnings = await screenProfileWarnings(platform, resolved, project, environment, applicationId, {
|
|
109
|
+
kind: spec.kind,
|
|
110
|
+
ops: [...opRecords, ...propTypeOps],
|
|
111
|
+
savedNodes: nodes,
|
|
112
|
+
steps: await boundFlowSteps(platform, resolved, project, environment, host, applicationId, id, opRecords)
|
|
113
|
+
});
|
|
113
114
|
const layoutWarnings = reshaped
|
|
114
115
|
? [
|
|
115
|
-
...verticalGapWarnings(simulated, spec.codes.gap, touched),
|
|
116
|
+
...(resolved.profile.layout.blocksMeaningful ? verticalGapWarnings(simulated, spec.codes.gap, touched) : []),
|
|
116
117
|
...stringStyleWarning(stringStyleNodes(simulated)),
|
|
117
|
-
...inertFlexPropWarning(inertFlexPropNodes(simulated)),
|
|
118
|
+
...(resolved.profile.layout.modes.has('grid') ? inertFlexPropWarning(inertFlexPropNodes(simulated)) : []),
|
|
118
119
|
...flexSizeWarnings(simulated, spec.codes.flexMismatch, spec.codes.flexInvalid),
|
|
119
120
|
...(host === 'layout' ? slotWarning(simulated) : [])
|
|
120
121
|
]
|
|
121
122
|
: [];
|
|
123
|
+
if (host === 'layout' && reshapesSkeleton(opRecords)) {
|
|
124
|
+
const skeleton = structuredClone(simulated);
|
|
125
|
+
applySkeletonOps(skeleton, opRecords);
|
|
126
|
+
layoutWarnings.push(...layoutPatchWarnings(resolved, nodes, skeleton));
|
|
127
|
+
}
|
|
122
128
|
const removedEvents = planEventRemovals(removeEventOps);
|
|
123
129
|
const resized = resizeOps.length > 0 ? planResizes(nodes, resizeOps, spec.readTool) : { serverOps: [], applied: [], warnings: [] };
|
|
124
130
|
const propTypes = propTypeOps.length > 0 ? planPropTypes(nodes, propTypeOps, spec.readTool) : { serverOps: [], applied: [] };
|
|
@@ -141,8 +147,9 @@ export function registerDesignSchemaPatchTool(server, platform, host) {
|
|
|
141
147
|
response.deletedFlows = deletedFlows;
|
|
142
148
|
if (flowWarnings.length > 0)
|
|
143
149
|
response.flowWarnings = flowWarnings;
|
|
144
|
-
if (layoutWarnings.length > 0)
|
|
145
|
-
response.layoutWarnings = layoutWarnings;
|
|
150
|
+
if (layoutWarnings.length > 0 || profileWarnings.length > 0)
|
|
151
|
+
response.layoutWarnings = [...layoutWarnings, ...profileWarnings];
|
|
152
|
+
Object.assign(response, applicationTypeField(resolved));
|
|
146
153
|
const contentOps = opRecords.filter(entry => entry.op === 'add_component' || entry.op === 'replace_prop');
|
|
147
154
|
let opDrops = emptyWriteDiff();
|
|
148
155
|
if (contentOps.length > 0) {
|
|
@@ -155,7 +162,6 @@ export function registerDesignSchemaPatchTool(server, platform, host) {
|
|
|
155
162
|
}
|
|
156
163
|
}
|
|
157
164
|
return withWriteDiff(withNormalization(response, [
|
|
158
|
-
...sectionNotes,
|
|
159
165
|
...componentDefaultsNote(normalized.components),
|
|
160
166
|
...validationNote(normalized.validations),
|
|
161
167
|
...catalogNotes,
|
|
@@ -7,6 +7,23 @@ import { z } from 'zod';
|
|
|
7
7
|
import { evaluatePolicy, enforcePolicy } from '../knowledge/policy.js';
|
|
8
8
|
import { policyRules } from '../knowledge/rules.js';
|
|
9
9
|
import { EXTERNAL_COMPONENT_PROTOCOL_VERSION } from '../knowledge/backendConstraints.js';
|
|
10
|
+
import { resolveProfile } from '../knowledge/platform/resolve.js';
|
|
11
|
+
import { findingLine } from '../knowledge/platform/profile.js';
|
|
12
|
+
/**
|
|
13
|
+
* MOB-006 — harici bileşen protokolü v1 tarayıcıda koşan `.mjs` custom element'tir; mobil
|
|
14
|
+
* uygulamanın native çizeri onu yükleyemez (mobil protokol v2 Faz 3). Profil kapalı derse çağrı
|
|
15
|
+
* platforma GİTMEZ: yüklenen paket hiçbir ekranda çizilmeyecekti.
|
|
16
|
+
*/
|
|
17
|
+
async function assertExternalComponentsAllowed(platform, applicationId, tool) {
|
|
18
|
+
const resolved = await resolveProfile(platform, applicationId);
|
|
19
|
+
if (resolved.profile.externalComponents)
|
|
20
|
+
return;
|
|
21
|
+
throw new PlatformApiError(`${tool}: ${findingLine({
|
|
22
|
+
code: 'MOB-006',
|
|
23
|
+
severity: 'warn',
|
|
24
|
+
message: "harici bileşen mobil uygulamada desteklenmiyor — protokol v1 tarayıcıda koşan .mjs custom element'tir, native çizer onu yükleyemez (mobil protokol v2 Faz 3). Çağrı platforma gönderilmedi; mobil ekranı katalog bileşenleriyle kurun (component_list). Katalogda karşılığı olmayan küçük görünüm için geçici yol 'html' bileşenidir: içerik korumalı belgede tema değişkenleriyle çizilir, fireEvent/ngApps.emit ile akışa bağlanır (component_get('html'))."
|
|
25
|
+
})}`, 400);
|
|
26
|
+
}
|
|
10
27
|
/** Platformun köprü protokolü; scaffold ve publish bu sürüme göre üretir/doğrular (backend ExternalComponentRules.CurrentProtocolVersion) */
|
|
11
28
|
const PROTOCOL_VERSION = EXTERNAL_COMPONENT_PROTOCOL_VERSION;
|
|
12
29
|
/** Backend `ExternalComponentRules.MaxBundleSizeBytes` ile aynı sınır */
|
|
@@ -199,6 +216,7 @@ export function registerExternalComponentTools(server, platform) {
|
|
|
199
216
|
},
|
|
200
217
|
annotations: writes
|
|
201
218
|
}, handle(config, async ({ project, environment, applicationId, bundlePath, manifestPath, version }) => {
|
|
219
|
+
await assertExternalComponentsAllowed(platform, applicationId, 'external_component_publish');
|
|
202
220
|
const manifestFile = resolve(manifestPath);
|
|
203
221
|
const bundleFile = resolve(bundlePath);
|
|
204
222
|
let manifest;
|
|
@@ -262,10 +280,13 @@ export function registerExternalComponentTools(server, platform) {
|
|
|
262
280
|
acknowledgeWarnings: z.boolean().optional().describe('Doğrulama uyarılarını okuyup kabul ettiğinizi bildirir; uyarısı olan sürümlerde zorunlu')
|
|
263
281
|
},
|
|
264
282
|
annotations: updates
|
|
265
|
-
}, handle(config, ({ project, environment, applicationId, slug, version, acknowledgeWarnings }) =>
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
283
|
+
}, handle(config, async ({ project, environment, applicationId, slug, version, acknowledgeWarnings }) => {
|
|
284
|
+
await assertExternalComponentsAllowed(platform, applicationId, 'external_component_activate');
|
|
285
|
+
return platform.tenant('POST', project, `/components/${applicationId}/external/${slug}/activate`, {
|
|
286
|
+
environment,
|
|
287
|
+
body: { version, acknowledgeWarnings: acknowledgeWarnings === true }
|
|
288
|
+
});
|
|
289
|
+
}));
|
|
269
290
|
server.registerTool('external_component_versions', {
|
|
270
291
|
title: 'Paket sürümlerini listele',
|
|
271
292
|
description: 'Bir harici komponentin yayınlanmış paket sürümlerini, hangisinin aktif olduğunu ve her sürümün doğrulama raporunu listeler. Geri alınacak sürümü buradan seçin.',
|