@appaflytech/wappa-mcp 0.0.10 → 0.0.11

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.
Files changed (66) hide show
  1. package/README.md +40 -0
  2. package/dist/auth.d.ts +25 -0
  3. package/dist/auth.d.ts.map +1 -1
  4. package/dist/auth.js +35 -0
  5. package/dist/auth.js.map +1 -1
  6. package/dist/client.d.ts +33 -2
  7. package/dist/client.d.ts.map +1 -1
  8. package/dist/client.js +107 -6
  9. package/dist/client.js.map +1 -1
  10. package/dist/factory.d.ts +32 -0
  11. package/dist/factory.d.ts.map +1 -0
  12. package/dist/factory.js +248 -0
  13. package/dist/factory.js.map +1 -0
  14. package/dist/http/auth.d.ts +33 -0
  15. package/dist/http/auth.d.ts.map +1 -0
  16. package/dist/http/auth.js +55 -0
  17. package/dist/http/auth.js.map +1 -0
  18. package/dist/http/session.d.ts +30 -0
  19. package/dist/http/session.d.ts.map +1 -0
  20. package/dist/http/session.js +56 -0
  21. package/dist/http/session.js.map +1 -0
  22. package/dist/http/transport.d.ts +21 -0
  23. package/dist/http/transport.d.ts.map +1 -0
  24. package/dist/http/transport.js +101 -0
  25. package/dist/http/transport.js.map +1 -0
  26. package/dist/index.d.ts +5 -3
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +26 -262
  29. package/dist/index.js.map +1 -1
  30. package/dist/server.d.ts +25 -0
  31. package/dist/server.d.ts.map +1 -0
  32. package/dist/server.js +94 -0
  33. package/dist/server.js.map +1 -0
  34. package/dist/tools/dynamic-entities.d.ts.map +1 -1
  35. package/dist/tools/dynamic-entities.js +9 -0
  36. package/dist/tools/dynamic-entities.js.map +1 -1
  37. package/dist/tools/entities.d.ts.map +1 -1
  38. package/dist/tools/entities.js +297 -4
  39. package/dist/tools/entities.js.map +1 -1
  40. package/dist/tools/layouts.d.ts.map +1 -1
  41. package/dist/tools/layouts.js +1 -2
  42. package/dist/tools/layouts.js.map +1 -1
  43. package/dist/tools/organizations.d.ts +178 -0
  44. package/dist/tools/organizations.d.ts.map +1 -0
  45. package/dist/tools/organizations.js +158 -0
  46. package/dist/tools/organizations.js.map +1 -0
  47. package/dist/tools/pages.d.ts.map +1 -1
  48. package/dist/tools/pages.js +279 -17
  49. package/dist/tools/pages.js.map +1 -1
  50. package/dist/tools/plans.d.ts +293 -0
  51. package/dist/tools/plans.d.ts.map +1 -0
  52. package/dist/tools/plans.js +213 -0
  53. package/dist/tools/plans.js.map +1 -0
  54. package/dist/tools/push-notifications.d.ts +261 -0
  55. package/dist/tools/push-notifications.d.ts.map +1 -0
  56. package/dist/tools/push-notifications.js +246 -0
  57. package/dist/tools/push-notifications.js.map +1 -0
  58. package/dist/tools/queries.d.ts +8 -0
  59. package/dist/tools/queries.d.ts.map +1 -1
  60. package/dist/tools/queries.js +31 -17
  61. package/dist/tools/queries.js.map +1 -1
  62. package/dist/tools/subscriptions.d.ts +166 -0
  63. package/dist/tools/subscriptions.d.ts.map +1 -0
  64. package/dist/tools/subscriptions.js +144 -0
  65. package/dist/tools/subscriptions.js.map +1 -0
  66. package/package.json +11 -2
@@ -0,0 +1,261 @@
1
+ /**
2
+ * MCP Tools for WAPPA Push Notification operations
3
+ *
4
+ * Covers admin push: device-token stats/listing, sending notifications,
5
+ * delivery history, and per-tenant push provider credentials
6
+ * (Firebase/FCM for Android, APNs for iOS).
7
+ *
8
+ * These endpoints are global (not scoped to the active {site}); a `siteKey`
9
+ * query param / body field is used to target a specific tenant.
10
+ */
11
+ import { WapClient } from "../client.js";
12
+ export declare function getPushNotificationTools(client: WapClient): {
13
+ get_push_token_stats: {
14
+ description: string;
15
+ inputSchema: {
16
+ type: "object";
17
+ properties: {};
18
+ };
19
+ handler: () => Promise<{
20
+ content: {
21
+ type: "text";
22
+ text: string;
23
+ }[];
24
+ }>;
25
+ };
26
+ list_push_tokens: {
27
+ description: string;
28
+ inputSchema: {
29
+ type: "object";
30
+ properties: {
31
+ siteKey: {
32
+ type: string;
33
+ description: string;
34
+ };
35
+ };
36
+ };
37
+ handler: (args: {
38
+ siteKey?: string;
39
+ }) => Promise<{
40
+ content: {
41
+ type: "text";
42
+ text: string;
43
+ }[];
44
+ }>;
45
+ };
46
+ get_notification_history: {
47
+ description: string;
48
+ inputSchema: {
49
+ type: "object";
50
+ properties: {
51
+ siteKey: {
52
+ type: string;
53
+ description: string;
54
+ };
55
+ page: {
56
+ type: string;
57
+ description: string;
58
+ };
59
+ pageSize: {
60
+ type: string;
61
+ description: string;
62
+ };
63
+ };
64
+ };
65
+ handler: (args: {
66
+ siteKey?: string;
67
+ page?: number;
68
+ pageSize?: number;
69
+ }) => Promise<{
70
+ content: {
71
+ type: "text";
72
+ text: string;
73
+ }[];
74
+ }>;
75
+ };
76
+ send_notification: {
77
+ description: string;
78
+ inputSchema: {
79
+ type: "object";
80
+ properties: {
81
+ title: {
82
+ type: string;
83
+ description: string;
84
+ };
85
+ body: {
86
+ type: string;
87
+ description: string;
88
+ };
89
+ target: {
90
+ type: string;
91
+ description: string;
92
+ };
93
+ data: {
94
+ type: string;
95
+ description: string;
96
+ };
97
+ sound: {
98
+ type: string;
99
+ description: string;
100
+ };
101
+ };
102
+ required: string[];
103
+ };
104
+ handler: (args: Record<string, unknown>) => Promise<{
105
+ content: {
106
+ type: "text";
107
+ text: string;
108
+ }[];
109
+ }>;
110
+ };
111
+ get_firebase_credential: {
112
+ description: string;
113
+ inputSchema: {
114
+ type: "object";
115
+ properties: {
116
+ siteKey: {
117
+ type: string;
118
+ description: string;
119
+ };
120
+ };
121
+ required: string[];
122
+ };
123
+ handler: (args: {
124
+ siteKey: string;
125
+ }) => Promise<{
126
+ content: {
127
+ type: "text";
128
+ text: string;
129
+ }[];
130
+ }>;
131
+ };
132
+ set_firebase_credential: {
133
+ description: string;
134
+ inputSchema: {
135
+ type: "object";
136
+ properties: {
137
+ siteKey: {
138
+ type: string;
139
+ description: string;
140
+ };
141
+ serviceAccountJson: {
142
+ type: string;
143
+ description: string;
144
+ };
145
+ };
146
+ required: string[];
147
+ };
148
+ handler: (args: {
149
+ siteKey: string;
150
+ serviceAccountJson: string;
151
+ }) => Promise<{
152
+ content: {
153
+ type: "text";
154
+ text: string;
155
+ }[];
156
+ }>;
157
+ };
158
+ delete_firebase_credential: {
159
+ description: string;
160
+ inputSchema: {
161
+ type: "object";
162
+ properties: {
163
+ siteKey: {
164
+ type: string;
165
+ description: string;
166
+ };
167
+ };
168
+ required: string[];
169
+ };
170
+ handler: (args: {
171
+ siteKey: string;
172
+ }) => Promise<{
173
+ content: {
174
+ type: "text";
175
+ text: string;
176
+ }[];
177
+ }>;
178
+ };
179
+ get_apns_credential: {
180
+ description: string;
181
+ inputSchema: {
182
+ type: "object";
183
+ properties: {
184
+ siteKey: {
185
+ type: string;
186
+ description: string;
187
+ };
188
+ };
189
+ required: string[];
190
+ };
191
+ handler: (args: {
192
+ siteKey: string;
193
+ }) => Promise<{
194
+ content: {
195
+ type: "text";
196
+ text: string;
197
+ }[];
198
+ }>;
199
+ };
200
+ set_apns_credential: {
201
+ description: string;
202
+ inputSchema: {
203
+ type: "object";
204
+ properties: {
205
+ siteKey: {
206
+ type: string;
207
+ description: string;
208
+ };
209
+ keyId: {
210
+ type: string;
211
+ description: string;
212
+ };
213
+ teamId: {
214
+ type: string;
215
+ description: string;
216
+ };
217
+ bundleId: {
218
+ type: string;
219
+ description: string;
220
+ };
221
+ privateKey: {
222
+ type: string;
223
+ description: string;
224
+ };
225
+ useSandbox: {
226
+ type: string;
227
+ description: string;
228
+ };
229
+ };
230
+ required: string[];
231
+ };
232
+ handler: (args: Record<string, unknown>) => Promise<{
233
+ content: {
234
+ type: "text";
235
+ text: string;
236
+ }[];
237
+ }>;
238
+ };
239
+ delete_apns_credential: {
240
+ description: string;
241
+ inputSchema: {
242
+ type: "object";
243
+ properties: {
244
+ siteKey: {
245
+ type: string;
246
+ description: string;
247
+ };
248
+ };
249
+ required: string[];
250
+ };
251
+ handler: (args: {
252
+ siteKey: string;
253
+ }) => Promise<{
254
+ content: {
255
+ type: "text";
256
+ text: string;
257
+ }[];
258
+ }>;
259
+ };
260
+ };
261
+ //# sourceMappingURL=push-notifications.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push-notifications.d.ts","sourceRoot":"","sources":["../../src/tools/push-notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAazC,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;wBAiC9B;YAAE,OAAO,CAAC,EAAE,MAAM,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;;;;;;;wBAyBpB;YACpB,OAAO,CAAC,EAAE,MAAM,CAAC;YACjB,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,QAAQ,CAAC,EAAE,MAAM,CAAC;SACnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAiCqB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;wBAqBvB;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;;;;wBAwBnB;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,kBAAkB,EAAE,MAAM,CAAA;SAAE;;;;;;;;;;;;;;;;;;;wBAmB/C;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE;;;;;;;;;;;;;;;;;;;wBAqBnB;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAgCnB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;wBAmBvB;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE;;;;;;;EAU9C"}
@@ -0,0 +1,246 @@
1
+ /**
2
+ * MCP Tools for WAPPA Push Notification operations
3
+ *
4
+ * Covers admin push: device-token stats/listing, sending notifications,
5
+ * delivery history, and per-tenant push provider credentials
6
+ * (Firebase/FCM for Android, APNs for iOS).
7
+ *
8
+ * These endpoints are global (not scoped to the active {site}); a `siteKey`
9
+ * query param / body field is used to target a specific tenant.
10
+ */
11
+ const TARGET_HINT = `Hedef kitle. Temel hedefler:
12
+ - "all" — tüm cihazlar (varsayılan)
13
+ - "site:<siteKey>" — belirli bir sitenin cihazları
14
+ - "user:<publicUserId>" — belirli bir kullanıcının cihazları
15
+ - "token:<token>" — tek bir cihaz (kayıt token'ı ile)
16
+ Ek filtreler temel hedefe eklenebilir: ":platform:ios" / ":platform:android" ve ":lang:<kod>" (örn. ":lang:tr-tr").
17
+ Örnek: "site:glomil:platform:ios" veya "all:lang:tr-tr".`;
18
+ const SOUND_HINT = 'Bildirim sesi: "default" (varsayılan OS sesi), "" veya "none" (sessiz), ya da pakete gömülü özel ses dosyası adı. Varsayılan: "default".';
19
+ export function getPushNotificationTools(client) {
20
+ return {
21
+ // ─── Token Stats ──────────────────────────────────────
22
+ get_push_token_stats: {
23
+ description: "Kayıtlı push cihaz token'larının istatistiklerini getirir (toplam, ios, android ve site bazında dağılım).",
24
+ inputSchema: {
25
+ type: "object",
26
+ properties: {},
27
+ },
28
+ handler: async () => {
29
+ const result = await client.getPushTokenStats();
30
+ return {
31
+ content: [
32
+ { type: "text", text: JSON.stringify(result, null, 2) },
33
+ ],
34
+ };
35
+ },
36
+ },
37
+ // ─── List Tokens ──────────────────────────────────────
38
+ list_push_tokens: {
39
+ description: "Kayıtlı cihaz token'larını listeler. Opsiyonel olarak siteKey ile bir siteye göre filtrelenebilir.",
40
+ inputSchema: {
41
+ type: "object",
42
+ properties: {
43
+ siteKey: {
44
+ type: "string",
45
+ description: "Filtrelenecek site anahtarı (opsiyonel)",
46
+ },
47
+ },
48
+ },
49
+ handler: async (args) => {
50
+ const result = await client.getPushTokens(args.siteKey);
51
+ return {
52
+ content: [
53
+ { type: "text", text: JSON.stringify(result, null, 2) },
54
+ ],
55
+ };
56
+ },
57
+ },
58
+ // ─── Notification History ─────────────────────────────
59
+ get_notification_history: {
60
+ description: "Geçmiş bildirim gönderimlerini sayfalı olarak getirir (başarılı/başarısız sayıları ve hata kırılımı dahil). siteKey ile filtrelenebilir.",
61
+ inputSchema: {
62
+ type: "object",
63
+ properties: {
64
+ siteKey: {
65
+ type: "string",
66
+ description: "Filtrelenecek site anahtarı (opsiyonel)",
67
+ },
68
+ page: { type: "number", description: "Sayfa numarası (1-based, varsayılan 1)" },
69
+ pageSize: { type: "number", description: "Sayfa boyutu (varsayılan 20)" },
70
+ },
71
+ },
72
+ handler: async (args) => {
73
+ const params = {};
74
+ if (args.siteKey !== undefined)
75
+ params.siteKey = args.siteKey;
76
+ if (args.page !== undefined)
77
+ params.page = String(args.page);
78
+ if (args.pageSize !== undefined)
79
+ params.pageSize = String(args.pageSize);
80
+ const result = await client.getNotificationHistory(params);
81
+ return {
82
+ content: [
83
+ { type: "text", text: JSON.stringify(result, null, 2) },
84
+ ],
85
+ };
86
+ },
87
+ },
88
+ // ─── Send Notification ────────────────────────────────
89
+ send_notification: {
90
+ description: `Mobil cihazlara push bildirimi gönderir.
91
+ Hedefin push sağlayıcı kimlik bilgileri (Firebase/APNs) yapılandırılmış olmalıdır.
92
+ 'data': Bildirimle taşınacak isteğe bağlı özel veri (key/value).`,
93
+ inputSchema: {
94
+ type: "object",
95
+ properties: {
96
+ title: { type: "string", description: "Bildirim başlığı" },
97
+ body: { type: "string", description: "Bildirim metni" },
98
+ target: { type: "string", description: TARGET_HINT },
99
+ data: {
100
+ type: "object",
101
+ description: "Bildirimle taşınacak özel veri (opsiyonel)",
102
+ },
103
+ sound: { type: "string", description: SOUND_HINT },
104
+ },
105
+ required: ["title", "body"],
106
+ },
107
+ handler: async (args) => {
108
+ const result = await client.sendNotification(args);
109
+ return {
110
+ content: [
111
+ { type: "text", text: JSON.stringify(result, null, 2) },
112
+ ],
113
+ };
114
+ },
115
+ },
116
+ // ─── Firebase (Android/FCM) Credential ────────────────
117
+ get_firebase_credential: {
118
+ description: "Bir sitenin Firebase (FCM) servis hesabı yapılandırma durumunu getirir. Gizli anahtar döndürülmez.",
119
+ inputSchema: {
120
+ type: "object",
121
+ properties: {
122
+ siteKey: { type: "string", description: "Site anahtarı" },
123
+ },
124
+ required: ["siteKey"],
125
+ },
126
+ handler: async (args) => {
127
+ const result = await client.getFirebaseCredential(args.siteKey);
128
+ return {
129
+ content: [
130
+ { type: "text", text: JSON.stringify(result, null, 2) },
131
+ ],
132
+ };
133
+ },
134
+ },
135
+ set_firebase_credential: {
136
+ description: `Bir sitenin Firebase (FCM, Android) servis hesabını bağlar veya değiştirir.
137
+ 'serviceAccountJson': Firebase konsolundan indirilen tam servis-hesabı JSON içeriği (string). Şifrelenmiş saklanır.`,
138
+ inputSchema: {
139
+ type: "object",
140
+ properties: {
141
+ siteKey: { type: "string", description: "Site anahtarı" },
142
+ serviceAccountJson: {
143
+ type: "string",
144
+ description: "Firebase servis-hesabı JSON içeriği (tam JSON, string olarak)",
145
+ },
146
+ },
147
+ required: ["siteKey", "serviceAccountJson"],
148
+ },
149
+ handler: async (args) => {
150
+ const result = await client.setFirebaseCredential(args);
151
+ return {
152
+ content: [
153
+ { type: "text", text: JSON.stringify(result, null, 2) },
154
+ ],
155
+ };
156
+ },
157
+ },
158
+ delete_firebase_credential: {
159
+ description: "Bir sitenin Firebase (FCM) servis hesabı bağlantısını kaldırır.",
160
+ inputSchema: {
161
+ type: "object",
162
+ properties: {
163
+ siteKey: { type: "string", description: "Site anahtarı" },
164
+ },
165
+ required: ["siteKey"],
166
+ },
167
+ handler: async (args) => {
168
+ const result = await client.deleteFirebaseCredential(args.siteKey);
169
+ return {
170
+ content: [
171
+ { type: "text", text: JSON.stringify(result, null, 2) },
172
+ ],
173
+ };
174
+ },
175
+ },
176
+ // ─── APNs (iOS) Credential ────────────────────────────
177
+ get_apns_credential: {
178
+ description: "Bir sitenin Apple APNs (iOS) Auth Key yapılandırma durumunu getirir. Gizli anahtar döndürülmez.",
179
+ inputSchema: {
180
+ type: "object",
181
+ properties: {
182
+ siteKey: { type: "string", description: "Site anahtarı" },
183
+ },
184
+ required: ["siteKey"],
185
+ },
186
+ handler: async (args) => {
187
+ const result = await client.getApnsCredential(args.siteKey);
188
+ return {
189
+ content: [
190
+ { type: "text", text: JSON.stringify(result, null, 2) },
191
+ ],
192
+ };
193
+ },
194
+ },
195
+ set_apns_credential: {
196
+ description: `Bir sitenin Apple APNs (iOS) Auth Key'ini bağlar veya değiştirir.
197
+ 'privateKey': .p8 Auth Key dosyasının PEM içeriği (string). Şifrelenmiş saklanır.
198
+ 'useSandbox': dev/Xcode derlemeleri için true (sandbox APNs); TestFlight/App Store için false.`,
199
+ inputSchema: {
200
+ type: "object",
201
+ properties: {
202
+ siteKey: { type: "string", description: "Site anahtarı" },
203
+ keyId: { type: "string", description: "APNs Key ID" },
204
+ teamId: { type: "string", description: "Apple Team ID" },
205
+ bundleId: { type: "string", description: "Uygulama Bundle ID" },
206
+ privateKey: {
207
+ type: "string",
208
+ description: ".p8 Auth Key PEM içeriği (string olarak)",
209
+ },
210
+ useSandbox: {
211
+ type: "boolean",
212
+ description: "Sandbox APNs kullanılsın mı? (dev için true)",
213
+ },
214
+ },
215
+ required: ["siteKey", "keyId", "teamId", "bundleId", "privateKey"],
216
+ },
217
+ handler: async (args) => {
218
+ const result = await client.setApnsCredential(args);
219
+ return {
220
+ content: [
221
+ { type: "text", text: JSON.stringify(result, null, 2) },
222
+ ],
223
+ };
224
+ },
225
+ },
226
+ delete_apns_credential: {
227
+ description: "Bir sitenin Apple APNs (iOS) Auth Key bağlantısını kaldırır.",
228
+ inputSchema: {
229
+ type: "object",
230
+ properties: {
231
+ siteKey: { type: "string", description: "Site anahtarı" },
232
+ },
233
+ required: ["siteKey"],
234
+ },
235
+ handler: async (args) => {
236
+ const result = await client.deleteApnsCredential(args.siteKey);
237
+ return {
238
+ content: [
239
+ { type: "text", text: JSON.stringify(result, null, 2) },
240
+ ],
241
+ };
242
+ },
243
+ },
244
+ };
245
+ }
246
+ //# sourceMappingURL=push-notifications.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push-notifications.js","sourceRoot":"","sources":["../../src/tools/push-notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,MAAM,WAAW,GAAG;;;;;;yDAMqC,CAAC;AAE1D,MAAM,UAAU,GACd,0IAA0I,CAAC;AAE7I,MAAM,UAAU,wBAAwB,CAAC,MAAiB;IACxD,OAAO;QACL,yDAAyD;QACzD,oBAAoB,EAAE;YACpB,WAAW,EACT,2GAA2G;YAC7G,WAAW,EAAE;gBACX,IAAI,EAAE,QAAiB;gBACvB,UAAU,EAAE,EAAE;aACf;YACD,OAAO,EAAE,KAAK,IAAI,EAAE;gBAClB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,iBAAiB,EAAE,CAAC;gBAChD,OAAO;oBACL,OAAO,EAAE;wBACP,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;qBACjE;iBACF,CAAC;YACJ,CAAC;SACF;QAED,yDAAyD;QACzD,gBAAgB,EAAE;YAChB,WAAW,EACT,oGAAoG;YACtG,WAAW,EAAE;gBACX,IAAI,EAAE,QAAiB;gBACvB,UAAU,EAAE;oBACV,OAAO,EAAE;wBACP,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,yCAAyC;qBACvD;iBACF;aACF;YACD,OAAO,EAAE,KAAK,EAAE,IAA0B,EAAE,EAAE;gBAC5C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBACxD,OAAO;oBACL,OAAO,EAAE;wBACP,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;qBACjE;iBACF,CAAC;YACJ,CAAC;SACF;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AAE,KAAK,EAAE,IAA6B,EAAE,EAAE;gBAC/C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;gBACpD,OAAO;oBACL,OAAO,EAAE;wBACP,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;qBACjE;iBACF,CAAC;YACJ,CAAC;SACF;QAED,sBAAsB,EAAE;YACtB,WAAW,EAAE,8DAA8D;YAC3E,WAAW,EAAE;gBACX,IAAI,EAAE,QAAiB;gBACvB,UAAU,EAAE;oBACV,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,eAAe,EAAE;iBAC1D;gBACD,QAAQ,EAAE,CAAC,SAAS,CAAC;aACtB;YACD,OAAO,EAAE,KAAK,EAAE,IAAyB,EAAE,EAAE;gBAC3C,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAC/D,OAAO;oBACL,OAAO,EAAE;wBACP,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;qBACjE;iBACF,CAAC;YACJ,CAAC;SACF;KACF,CAAC;AACJ,CAAC"}
@@ -126,6 +126,10 @@ export declare function getQueryTools(client: WapClient): {
126
126
  type: string;
127
127
  description: string;
128
128
  };
129
+ queryMaps: {
130
+ type: string;
131
+ description: string;
132
+ };
129
133
  cache: {
130
134
  type: string;
131
135
  description: string;
@@ -195,6 +199,10 @@ export declare function getQueryTools(client: WapClient): {
195
199
  type: string;
196
200
  description: string;
197
201
  };
202
+ queryMaps: {
203
+ type: string;
204
+ description: string;
205
+ };
198
206
  cache: {
199
207
  type: string;
200
208
  description: string;
@@ -1 +1 @@
1
- {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/tools/queries.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAsBnB;YACpB,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,UAAU,CAAC,EAAE,MAAM,CAAC;SACrB;;;;;;;;;;;;;;;;;;;wBA6BqB;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;;;;wBA6Bd;YACpB,IAAI,EAAE,MAAM,CAAC;YACb,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;SACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAiFqB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA6DvB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;wBA2DvB;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE;;;;;;;EAUzC"}
1
+ {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/tools/queries.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAsBnB;YACpB,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,KAAK,CAAC,EAAE,MAAM,CAAC;YACf,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,UAAU,CAAC,EAAE,MAAM,CAAC;SACrB;;;;;;;;;;;;;;;;;;;wBA4BqB;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;;;;wBA6Bd;YACpB,IAAI,EAAE,MAAM,CAAC;YACb,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;SACtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAqFqB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA+DvB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;wBAsEvB;YAAE,EAAE,EAAE,MAAM,CAAA;SAAE;;;;;;;EAUzC"}
@@ -34,8 +34,7 @@ export function getQueryTools(client) {
34
34
  params.type = args.type;
35
35
  if (args.pageIndex !== undefined)
36
36
  params.pageIndex = String(args.pageIndex);
37
- if (args.pageLength !== undefined)
38
- params.pageLength = String(args.pageLength);
37
+ params.pageLength = String(args.pageLength ?? 200);
39
38
  const result = await client.getQueries(params);
40
39
  return {
41
40
  content: [
@@ -132,6 +131,10 @@ export function getQueryTools(client) {
132
131
  type: "array",
133
132
  description: "Query parametre tanımları: [{ name, type, defaultValue }]",
134
133
  },
134
+ queryMaps: {
135
+ type: "array",
136
+ description: "Mevcut query sonuç kolonlarının alias ve type eşleştirmeleri. Örn: [{ name: 'Image', type: 'image', alias: 'img', path: 'img', isMultiple: false }]"
137
+ },
135
138
  cache: {
136
139
  type: "object",
137
140
  description: "Önbellekleme: { enabled: bool, durationSeconds: number }",
@@ -164,6 +167,7 @@ export function getQueryTools(client) {
164
167
  // tolerates empty lists better than nulls
165
168
  httpMethod: "get",
166
169
  parameters: [],
170
+ queryMaps: [],
167
171
  rawQueryMap: [],
168
172
  ...incoming,
169
173
  type,
@@ -206,6 +210,7 @@ export function getQueryTools(client) {
206
210
  description: 'Yanıt biçimi (non-raw): { type: "single" | "multiple" }',
207
211
  },
208
212
  parameters: { type: "array", description: "Parametre tanımları" },
213
+ queryMaps: { type: "array", description: "Query kolon eşleştirmeleri" },
209
214
  cache: { type: "object", description: "Önbellekleme ayarları" },
210
215
  transformTemplate: {
211
216
  type: "string",
@@ -229,21 +234,30 @@ export function getQueryTools(client) {
229
234
  catch {
230
235
  /* fall through with empty base */
231
236
  }
232
- const data = {
233
- name: current.name ?? current.Name,
234
- title: current.title ?? current.Title,
235
- type: current.type ?? current.Type,
236
- rawQuery: current.rawQuery ?? current.RawQuery,
237
- schema: current.schema ?? current.Schema,
238
- response: current.response ?? current.Response,
239
- parameters: current.parameters ?? current.Parameters ?? [],
240
- rawQueryMap: current.rawQueryMap ?? current.RawQueryMap ?? [],
241
- cache: current.cache ?? current.Cache,
242
- transformTemplate: current.transformTemplate ?? current.TransformTemplate,
243
- httpMethod: current.httpMethod ?? current.HttpMethod ?? "get",
244
- categoryId: current.categoryId ?? current.CategoryId,
245
- ...patch,
246
- };
237
+ const hasCurrent = current &&
238
+ typeof current === "object" &&
239
+ Object.keys(current).length > 0;
240
+ const data = hasCurrent
241
+ ? {
242
+ name: current.name ?? current.Name,
243
+ title: current.title ?? current.Title,
244
+ type: current.type ?? current.Type,
245
+ rawQuery: current.rawQuery ?? current.RawQuery,
246
+ schema: current.schema ?? current.Schema,
247
+ response: current.response ?? current.Response,
248
+ parameters: current.parameters ?? current.Parameters,
249
+ rawQueryMap: current.rawQueryMap ?? current.RawQueryMap,
250
+ cache: current.cache ?? current.Cache,
251
+ transformTemplate: current.transformTemplate ?? current.TransformTemplate,
252
+ httpMethod: current.httpMethod ?? current.HttpMethod,
253
+ categoryId: current.categoryId ?? current.CategoryId,
254
+ ...patch,
255
+ }
256
+ : { ...patch };
257
+ for (const key of Object.keys(data)) {
258
+ if (data[key] === undefined)
259
+ delete data[key];
260
+ }
247
261
  // Apply the same raw-query defaults used by create_query so the
248
262
  // backend's QueryAggregate constructor doesn't blow up on nulls.
249
263
  if (data.type === "raw") {