@antonytm/mcp-sitecore-server 1.2.1 → 1.2.3-verbose-logging

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 (33) hide show
  1. package/dist/bundle.js +321 -27
  2. package/dist/config.d.ts +6 -0
  3. package/dist/config.js +5 -1
  4. package/dist/config.js.map +1 -1
  5. package/dist/logLevel.d.ts +7 -0
  6. package/dist/logLevel.js +9 -0
  7. package/dist/logLevel.js.map +1 -0
  8. package/dist/tools/item-service/client.d.ts +2 -1
  9. package/dist/tools/item-service/client.js +298 -15
  10. package/dist/tools/item-service/client.js.map +1 -1
  11. package/dist/tools/item-service/logic/composite/get-item-descendants.js +1 -1
  12. package/dist/tools/item-service/logic/composite/get-item-descendants.js.map +1 -1
  13. package/dist/tools/item-service/logic/composite/get-languages.js +1 -1
  14. package/dist/tools/item-service/logic/composite/get-languages.js.map +1 -1
  15. package/dist/tools/item-service/logic/simple/create-item.js +1 -1
  16. package/dist/tools/item-service/logic/simple/create-item.js.map +1 -1
  17. package/dist/tools/item-service/logic/simple/delete-item.js +1 -1
  18. package/dist/tools/item-service/logic/simple/delete-item.js.map +1 -1
  19. package/dist/tools/item-service/logic/simple/edit-item.js +2 -1
  20. package/dist/tools/item-service/logic/simple/edit-item.js.map +1 -1
  21. package/dist/tools/item-service/logic/simple/get-item-by-path.js +1 -1
  22. package/dist/tools/item-service/logic/simple/get-item-by-path.js.map +1 -1
  23. package/dist/tools/item-service/logic/simple/get-item-children.js +1 -1
  24. package/dist/tools/item-service/logic/simple/get-item-children.js.map +1 -1
  25. package/dist/tools/item-service/logic/simple/get-item.js +1 -1
  26. package/dist/tools/item-service/logic/simple/get-item.js.map +1 -1
  27. package/dist/tools/item-service/logic/simple/run-stored-query.js +1 -1
  28. package/dist/tools/item-service/logic/simple/run-stored-query.js.map +1 -1
  29. package/dist/tools/item-service/logic/simple/run-stored-search.js +1 -1
  30. package/dist/tools/item-service/logic/simple/run-stored-search.js.map +1 -1
  31. package/dist/tools/item-service/logic/simple/search-items.js +1 -1
  32. package/dist/tools/item-service/logic/simple/search-items.js.map +1 -1
  33. package/package.json +5 -5
package/dist/config.d.ts CHANGED
@@ -52,6 +52,7 @@ declare const ConfigSchema: z.ZodObject<{
52
52
  serverUrl: string;
53
53
  }>>;
54
54
  authorizationHeader: z.ZodDefault<z.ZodString>;
55
+ logLevel: z.ZodDefault<z.ZodString>;
55
56
  }, "strip", z.ZodTypeAny, {
56
57
  name: string;
57
58
  graphQL: {
@@ -73,6 +74,7 @@ declare const ConfigSchema: z.ZodObject<{
73
74
  serverUrl: string;
74
75
  };
75
76
  authorizationHeader: string;
77
+ logLevel: string;
76
78
  version?: string | undefined;
77
79
  }, {
78
80
  name?: string | undefined;
@@ -96,6 +98,7 @@ declare const ConfigSchema: z.ZodObject<{
96
98
  serverUrl: string;
97
99
  } | undefined;
98
100
  authorizationHeader?: string | undefined;
101
+ logLevel?: string | undefined;
99
102
  }>;
100
103
  export declare const envSchema: z.ZodObject<{
101
104
  GRAPHQL_ENDPOINT: z.ZodOptional<z.ZodString>;
@@ -111,6 +114,7 @@ export declare const envSchema: z.ZodObject<{
111
114
  POWERSHELL_PASSWORD: z.ZodOptional<z.ZodString>;
112
115
  POWERSHELL_SERVER_URL: z.ZodOptional<z.ZodString>;
113
116
  AUTORIZATION_HEADER: z.ZodOptional<z.ZodString>;
117
+ LOG_LEVEL: z.ZodOptional<z.ZodString>;
114
118
  }, "strip", z.ZodTypeAny, {
115
119
  GRAPHQL_ENDPOINT?: string | undefined;
116
120
  GRAPHQL_SCHEMAS?: string | undefined;
@@ -125,6 +129,7 @@ export declare const envSchema: z.ZodObject<{
125
129
  POWERSHELL_PASSWORD?: string | undefined;
126
130
  POWERSHELL_SERVER_URL?: string | undefined;
127
131
  AUTORIZATION_HEADER?: string | undefined;
132
+ LOG_LEVEL?: string | undefined;
128
133
  }, {
129
134
  GRAPHQL_ENDPOINT?: string | undefined;
130
135
  GRAPHQL_SCHEMAS?: string | undefined;
@@ -139,6 +144,7 @@ export declare const envSchema: z.ZodObject<{
139
144
  POWERSHELL_PASSWORD?: string | undefined;
140
145
  POWERSHELL_SERVER_URL?: string | undefined;
141
146
  AUTORIZATION_HEADER?: string | undefined;
147
+ LOG_LEVEL?: string | undefined;
142
148
  }>;
143
149
  export declare const envStartSchema: z.ZodObject<{
144
150
  TRANSPORT: z.ZodEffects<z.ZodOptional<z.ZodDefault<z.ZodString>>, "stdio" | "sse" | "streamable-http", string | undefined>;
package/dist/config.js CHANGED
@@ -3,6 +3,7 @@ import { fileURLToPath } from "node:url";
3
3
  import { z } from "zod";
4
4
  import fs from "node:fs";
5
5
  import 'dotenv/config.js';
6
+ import { LogLevel } from "./logLevel.js";
6
7
  const ConfigSchema = z.object({
7
8
  name: z.string().default("mcp-sitecore-server"),
8
9
  version: z.string().optional(),
@@ -39,7 +40,8 @@ const ConfigSchema = z.object({
39
40
  password: "b",
40
41
  serverUrl: "https://xmcloudcm.localhost/",
41
42
  }),
42
- authorizationHeader: z.string().default("")
43
+ authorizationHeader: z.string().default(""),
44
+ logLevel: z.string().default(LogLevel.INFO),
43
45
  });
44
46
  export const envSchema = z.object({
45
47
  GRAPHQL_ENDPOINT: z.string().url().optional(),
@@ -55,6 +57,7 @@ export const envSchema = z.object({
55
57
  POWERSHELL_PASSWORD: z.string().optional(),
56
58
  POWERSHELL_SERVER_URL: z.string().url().optional(),
57
59
  AUTORIZATION_HEADER: z.string().optional(),
60
+ LOG_LEVEL: z.string().optional(),
58
61
  });
59
62
  export const envStartSchema = z.object({
60
63
  //* The transport to use for the server. Can be one of 'stdio' or 'sse'.
@@ -98,6 +101,7 @@ const config = {
98
101
  serverUrl: ENV.POWERSHELL_SERVER_URL || "https://xmcloudcm.localhost/",
99
102
  },
100
103
  authorizationHeader: ENV.AUTORIZATION_HEADER || "",
104
+ logLevel: ENV.LOG_LEVEL || LogLevel.INFO,
101
105
  };
102
106
  export { config };
103
107
  //# sourceMappingURL=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AS,EAAE,GAAG,CAAC,qBAAqB,IAAI,8BAA8B;KACzE;IACD,mBAAmB,EAAE,GAAG,CAAC,mBAAmB,IAAI,EAAE;IAClD,QAAQ,EAAE,GAAG,CAAC,SAAS,IAAI,QAAQ,CAAC,IAAI;CAC3C,CAAC;AAEF,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare enum LogLevel {
2
+ DEBUG = "DEBUG",
3
+ INFO = "INFO",
4
+ WARN = "WARN",
5
+ ERROR = "ERROR",
6
+ FATAL = "FATAL"
7
+ }
@@ -0,0 +1,9 @@
1
+ export var LogLevel;
2
+ (function (LogLevel) {
3
+ LogLevel["DEBUG"] = "DEBUG";
4
+ LogLevel["INFO"] = "INFO";
5
+ LogLevel["WARN"] = "WARN";
6
+ LogLevel["ERROR"] = "ERROR";
7
+ LogLevel["FATAL"] = "FATAL";
8
+ })(LogLevel || (LogLevel = {}));
9
+ //# sourceMappingURL=logLevel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logLevel.js","sourceRoot":"","sources":["../src/logLevel.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,QAMX;AAND,WAAY,QAAQ;IAChB,2BAAe,CAAA;IACf,yBAAa,CAAA;IACb,yBAAa,CAAA;IACb,2BAAe,CAAA;IACf,2BAAe,CAAA;AACnB,CAAC,EANW,QAAQ,KAAR,QAAQ,QAMnB"}
@@ -5,7 +5,8 @@ declare class RestfulItemServiceClient {
5
5
  private domain;
6
6
  private authCookie;
7
7
  private isInitialized;
8
- constructor(serverUrl: string, username: string, password: string, domain?: string);
8
+ private logLevel;
9
+ constructor(serverUrl: string, username: string, password: string, domain?: string, logLevel?: string);
9
10
  /**
10
11
  * Initializes the client by logging in and setting the authentication cookie.
11
12
  * @returns {Promise<void>} - Resolves if initialization is successful.
@@ -1,3 +1,4 @@
1
+ import { LogLevel } from "../../logLevel.js";
1
2
  class RestfulItemServiceClient {
2
3
  serverUrl;
3
4
  username;
@@ -5,11 +6,13 @@ class RestfulItemServiceClient {
5
6
  domain;
6
7
  authCookie = null;
7
8
  isInitialized = false;
8
- constructor(serverUrl, username, password, domain = 'sitecore') {
9
+ logLevel;
10
+ constructor(serverUrl, username, password, domain = 'sitecore', logLevel = LogLevel.INFO) {
9
11
  this.serverUrl = serverUrl;
10
12
  this.username = username;
11
13
  this.password = password;
12
14
  this.domain = domain;
15
+ this.logLevel = logLevel;
13
16
  }
14
17
  /**
15
18
  * Initializes the client by logging in and setting the authentication cookie.
@@ -17,15 +20,28 @@ class RestfulItemServiceClient {
17
20
  */
18
21
  async initialize() {
19
22
  if (!this.isInitialized) {
23
+ if (this.logLevel === LogLevel.DEBUG) {
24
+ console.log('Item Service Client: Initializing client...', JSON.stringify({
25
+ serverUrl: this.serverUrl,
26
+ username: this.username,
27
+ domain: this.domain
28
+ }, null, '\t'));
29
+ }
20
30
  try {
21
31
  await this.login();
22
32
  this.isInitialized = true;
33
+ if (this.logLevel === LogLevel.DEBUG) {
34
+ console.log('Item Service Client: Successfully initialized');
35
+ }
23
36
  }
24
37
  catch (error) {
25
38
  console.error('Failed to initialize client:', error);
26
39
  throw error;
27
40
  }
28
41
  }
42
+ else if (this.logLevel === LogLevel.DEBUG) {
43
+ console.log('Item Service Client: Already initialized, skipping initialization');
44
+ }
29
45
  }
30
46
  /**
31
47
  * Logs in to the Sitecore server and sets the authentication cookie.
@@ -33,16 +49,31 @@ class RestfulItemServiceClient {
33
49
  */
34
50
  async login() {
35
51
  const url = `${this.serverUrl}/sitecore/api/ssc/auth/login`;
52
+ const loginData = {
53
+ username: this.username,
54
+ password: this.password,
55
+ domain: this.domain
56
+ };
57
+ if (this.logLevel === LogLevel.DEBUG) {
58
+ console.log('Item Service Client: Attempting login...', JSON.stringify({
59
+ url,
60
+ username: this.username,
61
+ domain: this.domain
62
+ }, null, '\t'));
63
+ }
36
64
  try {
37
65
  const response = await fetch(url, {
38
66
  method: 'POST',
39
67
  headers: { 'Content-Type': 'application/json' },
40
- body: JSON.stringify({
41
- username: this.username,
42
- password: this.password,
43
- domain: this.domain
44
- })
68
+ body: JSON.stringify(loginData)
45
69
  });
70
+ if (this.logLevel === LogLevel.DEBUG) {
71
+ console.log('Item Service Client: Login response received', JSON.stringify({
72
+ status: response.status,
73
+ statusText: response.statusText,
74
+ headers: Object.fromEntries(response.headers.entries())
75
+ }, null, '\t'));
76
+ }
46
77
  if (!response.ok) {
47
78
  throw new Error('Login failed');
48
79
  }
@@ -51,6 +82,9 @@ class RestfulItemServiceClient {
51
82
  const match = cookies.match(/\.AspNet\.Cookies=([^;]+);/);
52
83
  if (match) {
53
84
  this.authCookie = match[1];
85
+ if (this.logLevel === LogLevel.DEBUG) {
86
+ console.log('Item Service Client: Authentication cookie retrieved successfully');
87
+ }
54
88
  }
55
89
  }
56
90
  else {
@@ -61,6 +95,9 @@ class RestfulItemServiceClient {
61
95
  }
62
96
  }
63
97
  catch (error) {
98
+ if (this.logLevel === LogLevel.DEBUG) {
99
+ console.error('Item Service Client: Login failed', error);
100
+ }
64
101
  if (error instanceof Error) {
65
102
  throw new Error(`Failed to log in: ${error.message}`);
66
103
  }
@@ -84,16 +121,42 @@ class RestfulItemServiceClient {
84
121
  params.set('fields', options.fields.join(','));
85
122
  }
86
123
  const url = `${this.serverUrl}/sitecore/api/ssc/item/${id}?${params.toString()}`;
124
+ if (this.logLevel === LogLevel.DEBUG) {
125
+ console.log('Item Service Client: Getting item by ID...', JSON.stringify({
126
+ id,
127
+ options,
128
+ url
129
+ }, null, '\t'));
130
+ }
87
131
  try {
88
132
  const response = await fetch(url, {
89
133
  headers: { 'Cookie': `.AspNet.Cookies=${this.authCookie}` }
90
134
  });
135
+ if (this.logLevel === LogLevel.DEBUG) {
136
+ console.log('Item Service Client: Get item by ID response received', JSON.stringify({
137
+ status: response.status,
138
+ statusText: response.statusText
139
+ }, null, '\t'));
140
+ }
91
141
  if (!response.ok) {
92
142
  throw new Error(`HTTP error! status: ${response.status}`);
93
143
  }
94
- return await response.json();
144
+ const result = await response.json();
145
+ if (this.logLevel === LogLevel.DEBUG) {
146
+ console.log('Item Service Client: Item retrieved successfully', JSON.stringify({
147
+ itemId: id,
148
+ resultKeys: Object.keys(result)
149
+ }, null, '\t'));
150
+ }
151
+ return result;
95
152
  }
96
153
  catch (error) {
154
+ if (this.logLevel === LogLevel.DEBUG) {
155
+ console.error('Item Service Client: Failed to get item by ID', JSON.stringify({
156
+ id,
157
+ error
158
+ }, null, '\t'));
159
+ }
97
160
  if (error instanceof Error) {
98
161
  throw new Error(`Failed to retrieve item by ID: ${error.message}`);
99
162
  }
@@ -117,16 +180,42 @@ class RestfulItemServiceClient {
117
180
  params.set('fields', options.fields.join(','));
118
181
  }
119
182
  const url = `${this.serverUrl}/sitecore/api/ssc/item/${id}/children?${params.toString()}`;
183
+ if (this.logLevel === LogLevel.DEBUG) {
184
+ console.log('Item Service Client: Getting item children...', JSON.stringify({
185
+ id,
186
+ options,
187
+ url
188
+ }, null, '\t'));
189
+ }
120
190
  try {
121
191
  const response = await fetch(url, {
122
192
  headers: { 'Cookie': `.AspNet.Cookies=${this.authCookie}` }
123
193
  });
194
+ if (this.logLevel === LogLevel.DEBUG) {
195
+ console.log('Item Service Client: Get item children response received', JSON.stringify({
196
+ status: response.status,
197
+ statusText: response.statusText
198
+ }, null, '\t'));
199
+ }
124
200
  if (!response.ok) {
125
201
  throw new Error(`HTTP error! status: ${response.status}`);
126
202
  }
127
- return await response.json();
203
+ const result = await response.json();
204
+ if (this.logLevel === LogLevel.DEBUG) {
205
+ console.log('Item Service Client: Item children retrieved successfully', JSON.stringify({
206
+ parentId: id,
207
+ resultKeys: Object.keys(result)
208
+ }, null, '\t'));
209
+ }
210
+ return result;
128
211
  }
129
212
  catch (error) {
213
+ if (this.logLevel === LogLevel.DEBUG) {
214
+ console.error('Item Service Client: Failed to get item children', JSON.stringify({
215
+ id,
216
+ error
217
+ }, null, '\t'));
218
+ }
130
219
  if (error instanceof Error) {
131
220
  throw new Error(`Failed to retrieve item children: ${error.message}`);
132
221
  }
@@ -152,16 +241,43 @@ class RestfulItemServiceClient {
152
241
  params.set('fields', options.fields.join(','));
153
242
  }
154
243
  const url = `${this.serverUrl}/sitecore/api/ssc/item?path=${encodedPath}&${params.toString()}`;
244
+ if (this.logLevel === LogLevel.DEBUG) {
245
+ console.log('Item Service Client: Getting item by path...', JSON.stringify({
246
+ path,
247
+ encodedPath,
248
+ options,
249
+ url
250
+ }, null, '\t'));
251
+ }
155
252
  try {
156
253
  const response = await fetch(url, {
157
254
  headers: { 'Cookie': `.AspNet.Cookies=${this.authCookie}` }
158
255
  });
256
+ if (this.logLevel === LogLevel.DEBUG) {
257
+ console.log('Item Service Client: Get item by path response received', JSON.stringify({
258
+ status: response.status,
259
+ statusText: response.statusText
260
+ }, null, '\t'));
261
+ }
159
262
  if (!response.ok) {
160
263
  throw new Error(`HTTP error! status: ${response.status}`);
161
264
  }
162
- return await response.json();
265
+ const result = await response.json();
266
+ if (this.logLevel === LogLevel.DEBUG) {
267
+ console.log('Item Service Client: Item retrieved by path successfully', JSON.stringify({
268
+ path,
269
+ resultKeys: Object.keys(result)
270
+ }, null, '\t'));
271
+ }
272
+ return result;
163
273
  }
164
274
  catch (error) {
275
+ if (this.logLevel === LogLevel.DEBUG) {
276
+ console.error('Item Service Client: Failed to get item by path', JSON.stringify({
277
+ path,
278
+ error
279
+ }, null, '\t'));
280
+ }
165
281
  if (error instanceof Error) {
166
282
  throw new Error(`Failed to retrieve item by path: ${error.message}`);
167
283
  }
@@ -185,6 +301,15 @@ class RestfulItemServiceClient {
185
301
  const encodedPath = encodeURIComponent(parentPath);
186
302
  const params = new URLSearchParams(options);
187
303
  const url = `${this.serverUrl}/sitecore/api/ssc/item/${encodedPath}?${params.toString()}`;
304
+ if (this.logLevel === LogLevel.DEBUG) {
305
+ console.log('Item Service Client: Creating item...', JSON.stringify({
306
+ parentPath,
307
+ encodedPath,
308
+ data,
309
+ options,
310
+ url
311
+ }, null, '\t'));
312
+ }
188
313
  try {
189
314
  const response = await fetch(url, {
190
315
  method: 'POST',
@@ -194,16 +319,38 @@ class RestfulItemServiceClient {
194
319
  },
195
320
  body: JSON.stringify(data)
196
321
  });
322
+ if (this.logLevel === LogLevel.DEBUG) {
323
+ console.log('Item Service Client: Create item response received', JSON.stringify({
324
+ status: response.status,
325
+ statusText: response.statusText
326
+ }, null, '\t'));
327
+ }
197
328
  if (!response.ok) {
198
329
  throw new Error(`HTTP error! status: ${response.status}`);
199
330
  }
200
- return {
331
+ const result = {
201
332
  "Status": "Success",
202
333
  "Code": response.status,
203
334
  "Message": "Item created successfully",
204
335
  };
336
+ if (this.logLevel === LogLevel.DEBUG) {
337
+ console.log('Item Service Client: Item created successfully', JSON.stringify({
338
+ parentPath,
339
+ itemName: data.ItemName,
340
+ templateId: data.TemplateID,
341
+ result
342
+ }, null, '\t'));
343
+ }
344
+ return result;
205
345
  }
206
346
  catch (error) {
347
+ if (this.logLevel === LogLevel.DEBUG) {
348
+ console.error('Item Service Client: Failed to create item', JSON.stringify({
349
+ parentPath,
350
+ data,
351
+ error
352
+ }, null, '\t'));
353
+ }
207
354
  if (error instanceof Error) {
208
355
  throw new Error(`Failed to create item: ${error.message}`);
209
356
  }
@@ -225,6 +372,14 @@ class RestfulItemServiceClient {
225
372
  }
226
373
  const params = new URLSearchParams(options);
227
374
  const url = `${this.serverUrl}/sitecore/api/ssc/item/${id}?${params.toString()}`;
375
+ if (this.logLevel === LogLevel.DEBUG) {
376
+ console.log('Item Service Client: Editing item...', JSON.stringify({
377
+ id,
378
+ data,
379
+ options,
380
+ url
381
+ }, null, '\t'));
382
+ }
228
383
  try {
229
384
  const response = await fetch(url, {
230
385
  method: 'PATCH',
@@ -234,16 +389,36 @@ class RestfulItemServiceClient {
234
389
  },
235
390
  body: JSON.stringify(data)
236
391
  });
392
+ if (this.logLevel === LogLevel.DEBUG) {
393
+ console.log('Item Service Client: Edit item response received', JSON.stringify({
394
+ status: response.status,
395
+ statusText: response.statusText
396
+ }, null, '\t'));
397
+ }
237
398
  if (!response.ok) {
238
399
  throw new Error(`HTTP error! status: ${response.status}`);
239
400
  }
240
- return {
401
+ const result = {
241
402
  "Status": "Success",
242
403
  "Code": response.status,
243
404
  "Message": "Item updated successfully",
244
405
  };
406
+ if (this.logLevel === LogLevel.DEBUG) {
407
+ console.log('Item Service Client: Item edited successfully', JSON.stringify({
408
+ id,
409
+ result
410
+ }, null, '\t'));
411
+ }
412
+ return result;
245
413
  }
246
414
  catch (error) {
415
+ if (this.logLevel === LogLevel.DEBUG) {
416
+ console.error('Item Service Client: Failed to edit item', JSON.stringify({
417
+ id,
418
+ data,
419
+ error
420
+ }, null, '\t'));
421
+ }
247
422
  if (error instanceof Error) {
248
423
  throw new Error(`Failed to edit item: ${error.message}`);
249
424
  }
@@ -264,6 +439,13 @@ class RestfulItemServiceClient {
264
439
  }
265
440
  const params = new URLSearchParams(options);
266
441
  const url = `${this.serverUrl}/sitecore/api/ssc/item/${id}?${params.toString()}`;
442
+ if (this.logLevel === LogLevel.DEBUG) {
443
+ console.log('Item Service Client: Deleting item...', JSON.stringify({
444
+ id,
445
+ options,
446
+ url
447
+ }, null, '\t'));
448
+ }
267
449
  try {
268
450
  const response = await fetch(url, {
269
451
  method: 'DELETE',
@@ -271,16 +453,35 @@ class RestfulItemServiceClient {
271
453
  'Cookie': `.AspNet.Cookies=${this.authCookie}`
272
454
  }
273
455
  });
456
+ if (this.logLevel === LogLevel.DEBUG) {
457
+ console.log('Item Service Client: Delete item response received', JSON.stringify({
458
+ status: response.status,
459
+ statusText: response.statusText
460
+ }, null, '\t'));
461
+ }
274
462
  if (!response.ok) {
275
463
  throw new Error(`HTTP error! status: ${response.status}`);
276
464
  }
277
- return {
465
+ const result = {
278
466
  "Status": "Success",
279
467
  "Code": response.status,
280
468
  "Message": "Item deleted successfully",
281
469
  };
470
+ if (this.logLevel === LogLevel.DEBUG) {
471
+ console.log('Item Service Client: Item deleted successfully', JSON.stringify({
472
+ id,
473
+ result
474
+ }, null, '\t'));
475
+ }
476
+ return result;
282
477
  }
283
478
  catch (error) {
479
+ if (this.logLevel === LogLevel.DEBUG) {
480
+ console.error('Item Service Client: Failed to delete item', JSON.stringify({
481
+ id,
482
+ error
483
+ }, null, '\t'));
484
+ }
284
485
  if (error instanceof Error) {
285
486
  throw new Error(`Failed to delete item: ${error.message}`);
286
487
  }
@@ -314,16 +515,41 @@ class RestfulItemServiceClient {
314
515
  if (options.includeStandardTemplateFields !== undefined)
315
516
  params.set('includeStandardTemplateFields', String(options.includeStandardTemplateFields));
316
517
  const url = `${this.serverUrl}/sitecore/api/ssc/item/search?${params.toString()}`;
518
+ if (this.logLevel === LogLevel.DEBUG) {
519
+ console.log('Item Service Client: Searching items...', JSON.stringify({
520
+ options,
521
+ url
522
+ }, null, '\t'));
523
+ }
317
524
  try {
318
525
  const response = await fetch(url, {
319
526
  headers: { 'Cookie': `.AspNet.Cookies=${this.authCookie}` }
320
527
  });
528
+ if (this.logLevel === LogLevel.DEBUG) {
529
+ console.log('Item Service Client: Search items response received', JSON.stringify({
530
+ status: response.status,
531
+ statusText: response.statusText
532
+ }, null, '\t'));
533
+ }
321
534
  if (!response.ok) {
322
535
  throw new Error(`HTTP error! status: ${response.status}`);
323
536
  }
324
- return await response.json();
537
+ const result = await response.json();
538
+ if (this.logLevel === LogLevel.DEBUG) {
539
+ console.log('Item Service Client: Search completed successfully', JSON.stringify({
540
+ searchTerm: options.term,
541
+ resultKeys: Object.keys(result)
542
+ }, null, '\t'));
543
+ }
544
+ return result;
325
545
  }
326
546
  catch (error) {
547
+ if (this.logLevel === LogLevel.DEBUG) {
548
+ console.error('Item Service Client: Failed to search items', JSON.stringify({
549
+ options,
550
+ error
551
+ }, null, '\t'));
552
+ }
327
553
  if (error instanceof Error) {
328
554
  throw new Error(`Failed to search items: ${error.message}`);
329
555
  }
@@ -358,16 +584,43 @@ class RestfulItemServiceClient {
358
584
  if (options.includeStandardTemplateFields !== undefined)
359
585
  params.set('includeStandardTemplateFields', String(options.includeStandardTemplateFields));
360
586
  const url = `${this.serverUrl}/sitecore/api/ssc/item/${id}/query?${params.toString()}`;
587
+ if (this.logLevel === LogLevel.DEBUG) {
588
+ console.log('Item Service Client: Running stored query...', JSON.stringify({
589
+ id,
590
+ options,
591
+ url
592
+ }, null, '\t'));
593
+ }
361
594
  try {
362
595
  const response = await fetch(url, {
363
596
  headers: { 'Cookie': `.AspNet.Cookies=${this.authCookie}` }
364
597
  });
598
+ if (this.logLevel === LogLevel.DEBUG) {
599
+ console.log('Item Service Client: Stored query response received', JSON.stringify({
600
+ status: response.status,
601
+ statusText: response.statusText
602
+ }, null, '\t'));
603
+ }
365
604
  if (!response.ok) {
366
605
  throw new Error(`HTTP error! status: ${response.status}`);
367
606
  }
368
- return await response.json();
607
+ const result = await response.json();
608
+ if (this.logLevel === LogLevel.DEBUG) {
609
+ console.log('Item Service Client: Stored query completed successfully', JSON.stringify({
610
+ queryId: id,
611
+ resultKeys: Object.keys(result)
612
+ }, null, '\t'));
613
+ }
614
+ return result;
369
615
  }
370
616
  catch (error) {
617
+ if (this.logLevel === LogLevel.DEBUG) {
618
+ console.error('Item Service Client: Failed to run stored query', JSON.stringify({
619
+ id,
620
+ options,
621
+ error
622
+ }, null, '\t'));
623
+ }
371
624
  if (error instanceof Error) {
372
625
  throw new Error(`Failed to run stored query: ${error.message}`);
373
626
  }
@@ -405,16 +658,46 @@ class RestfulItemServiceClient {
405
658
  if (options.sorting)
406
659
  params.set('sorting', options.sorting);
407
660
  const url = `${this.serverUrl}/sitecore/api/ssc/item/${id}/search?${params.toString()}`;
661
+ if (this.logLevel === LogLevel.DEBUG) {
662
+ console.log('Item Service Client: Running stored search...', JSON.stringify({
663
+ id,
664
+ term,
665
+ options,
666
+ url
667
+ }, null, '\t'));
668
+ }
408
669
  try {
409
670
  const response = await fetch(url, {
410
671
  headers: { 'Cookie': `.AspNet.Cookies=${this.authCookie}` }
411
672
  });
673
+ if (this.logLevel === LogLevel.DEBUG) {
674
+ console.log('Item Service Client: Stored search response received', JSON.stringify({
675
+ status: response.status,
676
+ statusText: response.statusText
677
+ }, null, '\t'));
678
+ }
412
679
  if (!response.ok) {
413
680
  throw new Error(`HTTP error! status: ${response.status}`);
414
681
  }
415
- return await response.json();
682
+ const result = await response.json();
683
+ if (this.logLevel === LogLevel.DEBUG) {
684
+ console.log('Item Service Client: Stored search completed successfully', JSON.stringify({
685
+ searchId: id,
686
+ term,
687
+ resultKeys: Object.keys(result)
688
+ }, null, '\t'));
689
+ }
690
+ return result;
416
691
  }
417
692
  catch (error) {
693
+ if (this.logLevel === LogLevel.DEBUG) {
694
+ console.error('Item Service Client: Failed to run stored search', JSON.stringify({
695
+ id,
696
+ term,
697
+ options,
698
+ error
699
+ }, null, '\t'));
700
+ }
418
701
  if (error instanceof Error) {
419
702
  throw new Error(`Failed to run stored search: ${error.message}`);
420
703
  }