@antonytm/mcp-sitecore-server 0.20.4 → 0.21.0
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/LICENSE +1 -1
- package/README.md +11 -0
- package/dist/bundle.js +909 -61
- package/dist/config.d.ts +1 -0
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/register.js +23 -1
- package/dist/register.js.map +1 -1
- package/dist/tools/powershell/client.d.ts +1 -0
- package/dist/tools/powershell/client.js +3 -14
- package/dist/tools/powershell/client.js.map +1 -1
- package/dist/tools/powershell/command-builder.d.ts +6 -0
- package/dist/tools/powershell/command-builder.js +60 -0
- package/dist/tools/powershell/command-builder.js.map +1 -0
- package/dist/tools/powershell/composite/presentation/add-rendering-by-id.d.ts +3 -0
- package/dist/tools/powershell/composite/presentation/add-rendering-by-id.js +36 -0
- package/dist/tools/powershell/composite/presentation/add-rendering-by-id.js.map +1 -0
- package/dist/tools/powershell/composite/presentation/add-rendering-by-path.d.ts +3 -0
- package/dist/tools/powershell/composite/presentation/add-rendering-by-path.js +34 -0
- package/dist/tools/powershell/composite/presentation/add-rendering-by-path.js.map +1 -0
- package/dist/tools/powershell/composite/presentation/set-rendering-by-id.d.ts +3 -0
- package/dist/tools/powershell/composite/presentation/set-rendering-by-id.js +42 -0
- package/dist/tools/powershell/composite/presentation/set-rendering-by-id.js.map +1 -0
- package/dist/tools/powershell/composite/presentation/set-rendering-by-path.d.ts +3 -0
- package/dist/tools/powershell/composite/presentation/set-rendering-by-path.js +39 -0
- package/dist/tools/powershell/composite/presentation/set-rendering-by-path.js.map +1 -0
- package/dist/tools/powershell/composite/presentation/switch-rendering-by-id.d.ts +3 -0
- package/dist/tools/powershell/composite/presentation/switch-rendering-by-id.js +42 -0
- package/dist/tools/powershell/composite/presentation/switch-rendering-by-id.js.map +1 -0
- package/dist/tools/powershell/composite/presentation/switch-rendering-by-path.d.ts +3 -0
- package/dist/tools/powershell/composite/presentation/switch-rendering-by-path.js +39 -0
- package/dist/tools/powershell/composite/presentation/switch-rendering-by-path.js.map +1 -0
- package/dist/tools/powershell/composite/presentation/switch-rendering-by-unique-id.d.ts +3 -0
- package/dist/tools/powershell/composite/presentation/switch-rendering-by-unique-id.js +32 -0
- package/dist/tools/powershell/composite/presentation/switch-rendering-by-unique-id.js.map +1 -0
- package/dist/tools/powershell/simple/presentation/get-layout-by-id.js +3 -6
- package/dist/tools/powershell/simple/presentation/get-layout-by-id.js.map +1 -1
- package/dist/tools/powershell/simple/presentation/get-layout-by-path.js +3 -6
- package/dist/tools/powershell/simple/presentation/get-layout-by-path.js.map +1 -1
- package/dist/tools/powershell/simple/presentation/get-rendering-by-id.d.ts +3 -0
- package/dist/tools/powershell/simple/presentation/get-rendering-by-id.js +29 -0
- package/dist/tools/powershell/simple/presentation/get-rendering-by-id.js.map +1 -0
- package/dist/tools/powershell/simple/presentation/get-rendering-by-path.d.ts +3 -0
- package/dist/tools/powershell/simple/presentation/get-rendering-by-path.js +27 -0
- package/dist/tools/powershell/simple/presentation/get-rendering-by-path.js.map +1 -0
- package/dist/tools/powershell/simple/presentation/merge-layout-by-id.js +2 -6
- package/dist/tools/powershell/simple/presentation/merge-layout-by-id.js.map +1 -1
- package/dist/tools/powershell/simple/presentation/merge-layout-by-path.js +1 -3
- package/dist/tools/powershell/simple/presentation/merge-layout-by-path.js.map +1 -1
- package/dist/tools/powershell/simple/presentation/remove-rendering-by-id.d.ts +3 -0
- package/dist/tools/powershell/simple/presentation/remove-rendering-by-id.js +29 -0
- package/dist/tools/powershell/simple/presentation/remove-rendering-by-id.js.map +1 -0
- package/dist/tools/powershell/simple/presentation/remove-rendering-by-path.d.ts +3 -0
- package/dist/tools/powershell/simple/presentation/remove-rendering-by-path.js +27 -0
- package/dist/tools/powershell/simple/presentation/remove-rendering-by-path.js.map +1 -0
- package/dist/tools/powershell/simple/presentation/reset-layout-by-id.js +3 -6
- package/dist/tools/powershell/simple/presentation/reset-layout-by-id.js.map +1 -1
- package/dist/tools/powershell/simple/presentation/reset-layout-by-path.js +3 -6
- package/dist/tools/powershell/simple/presentation/reset-layout-by-path.js.map +1 -1
- package/dist/tools/powershell/utils.d.ts +2 -0
- package/dist/tools/powershell/utils.js +12 -0
- package/dist/tools/powershell/utils.js.map +1 -1
- package/package.json +6 -5
package/dist/bundle.js
CHANGED
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
4
|
import fs from 'node:fs';
|
|
5
|
+
import require$$0$1 from 'fs';
|
|
6
|
+
import require$$1$1 from 'path';
|
|
7
|
+
import require$$2$1 from 'os';
|
|
8
|
+
import require$$3$1 from 'crypto';
|
|
5
9
|
import process$1 from 'node:process';
|
|
6
|
-
import 'fs';
|
|
7
|
-
import require$$0$1 from 'path';
|
|
8
10
|
import 'http';
|
|
9
11
|
import { randomUUID } from 'node:crypto';
|
|
10
|
-
import require$$2$
|
|
12
|
+
import require$$2$2 from 'statuses';
|
|
11
13
|
import require$$0$2 from 'buffer';
|
|
12
|
-
import require$$1$
|
|
14
|
+
import require$$1$2 from 'string_decoder';
|
|
13
15
|
import contentType from 'content-type';
|
|
14
16
|
import { URL as URL$1 } from 'url';
|
|
15
17
|
import express from 'express';
|
|
@@ -3980,6 +3982,491 @@ ZodPromise.create;
|
|
|
3980
3982
|
const optionalType = ZodOptional.create;
|
|
3981
3983
|
ZodNullable.create;
|
|
3982
3984
|
|
|
3985
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
3986
|
+
|
|
3987
|
+
function getDefaultExportFromCjs (x) {
|
|
3988
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
3989
|
+
}
|
|
3990
|
+
|
|
3991
|
+
var config$1 = {};
|
|
3992
|
+
|
|
3993
|
+
var main = {exports: {}};
|
|
3994
|
+
|
|
3995
|
+
var version$1 = "16.6.0";
|
|
3996
|
+
var require$$4$1 = {
|
|
3997
|
+
version: version$1};
|
|
3998
|
+
|
|
3999
|
+
var hasRequiredMain;
|
|
4000
|
+
|
|
4001
|
+
function requireMain () {
|
|
4002
|
+
if (hasRequiredMain) return main.exports;
|
|
4003
|
+
hasRequiredMain = 1;
|
|
4004
|
+
const fs = require$$0$1;
|
|
4005
|
+
const path = require$$1$1;
|
|
4006
|
+
const os = require$$2$1;
|
|
4007
|
+
const crypto = require$$3$1;
|
|
4008
|
+
const packageJson = require$$4$1;
|
|
4009
|
+
|
|
4010
|
+
const version = packageJson.version;
|
|
4011
|
+
|
|
4012
|
+
const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
|
|
4013
|
+
|
|
4014
|
+
// Parse src into an Object
|
|
4015
|
+
function parse (src) {
|
|
4016
|
+
const obj = {};
|
|
4017
|
+
|
|
4018
|
+
// Convert buffer to string
|
|
4019
|
+
let lines = src.toString();
|
|
4020
|
+
|
|
4021
|
+
// Convert line breaks to same format
|
|
4022
|
+
lines = lines.replace(/\r\n?/mg, '\n');
|
|
4023
|
+
|
|
4024
|
+
let match;
|
|
4025
|
+
while ((match = LINE.exec(lines)) != null) {
|
|
4026
|
+
const key = match[1];
|
|
4027
|
+
|
|
4028
|
+
// Default undefined or null to empty string
|
|
4029
|
+
let value = (match[2] || '');
|
|
4030
|
+
|
|
4031
|
+
// Remove whitespace
|
|
4032
|
+
value = value.trim();
|
|
4033
|
+
|
|
4034
|
+
// Check if double quoted
|
|
4035
|
+
const maybeQuote = value[0];
|
|
4036
|
+
|
|
4037
|
+
// Remove surrounding quotes
|
|
4038
|
+
value = value.replace(/^(['"`])([\s\S]*)\1$/mg, '$2');
|
|
4039
|
+
|
|
4040
|
+
// Expand newlines if double quoted
|
|
4041
|
+
if (maybeQuote === '"') {
|
|
4042
|
+
value = value.replace(/\\n/g, '\n');
|
|
4043
|
+
value = value.replace(/\\r/g, '\r');
|
|
4044
|
+
}
|
|
4045
|
+
|
|
4046
|
+
// Add to object
|
|
4047
|
+
obj[key] = value;
|
|
4048
|
+
}
|
|
4049
|
+
|
|
4050
|
+
return obj
|
|
4051
|
+
}
|
|
4052
|
+
|
|
4053
|
+
function _parseVault (options) {
|
|
4054
|
+
const vaultPath = _vaultPath(options);
|
|
4055
|
+
|
|
4056
|
+
// Parse .env.vault
|
|
4057
|
+
options.path = vaultPath;
|
|
4058
|
+
const result = DotenvModule.configDotenv(options);
|
|
4059
|
+
if (!result.parsed) {
|
|
4060
|
+
const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
|
|
4061
|
+
err.code = 'MISSING_DATA';
|
|
4062
|
+
throw err
|
|
4063
|
+
}
|
|
4064
|
+
|
|
4065
|
+
// handle scenario for comma separated keys - for use with key rotation
|
|
4066
|
+
// example: DOTENV_KEY="dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenvx.com/vault/.env.vault?environment=prod"
|
|
4067
|
+
const keys = _dotenvKey(options).split(',');
|
|
4068
|
+
const length = keys.length;
|
|
4069
|
+
|
|
4070
|
+
let decrypted;
|
|
4071
|
+
for (let i = 0; i < length; i++) {
|
|
4072
|
+
try {
|
|
4073
|
+
// Get full key
|
|
4074
|
+
const key = keys[i].trim();
|
|
4075
|
+
|
|
4076
|
+
// Get instructions for decrypt
|
|
4077
|
+
const attrs = _instructions(result, key);
|
|
4078
|
+
|
|
4079
|
+
// Decrypt
|
|
4080
|
+
decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
|
|
4081
|
+
|
|
4082
|
+
break
|
|
4083
|
+
} catch (error) {
|
|
4084
|
+
// last key
|
|
4085
|
+
if (i + 1 >= length) {
|
|
4086
|
+
throw error
|
|
4087
|
+
}
|
|
4088
|
+
// try next key
|
|
4089
|
+
}
|
|
4090
|
+
}
|
|
4091
|
+
|
|
4092
|
+
// Parse decrypted .env string
|
|
4093
|
+
return DotenvModule.parse(decrypted)
|
|
4094
|
+
}
|
|
4095
|
+
|
|
4096
|
+
function _warn (message) {
|
|
4097
|
+
console.log(`[dotenv@${version}][WARN] ${message}`);
|
|
4098
|
+
}
|
|
4099
|
+
|
|
4100
|
+
function _debug (message) {
|
|
4101
|
+
console.log(`[dotenv@${version}][DEBUG] ${message}`);
|
|
4102
|
+
}
|
|
4103
|
+
|
|
4104
|
+
function _log (message) {
|
|
4105
|
+
console.log(`[dotenv@${version}] ${message}`);
|
|
4106
|
+
}
|
|
4107
|
+
|
|
4108
|
+
function _dotenvKey (options) {
|
|
4109
|
+
// prioritize developer directly setting options.DOTENV_KEY
|
|
4110
|
+
if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) {
|
|
4111
|
+
return options.DOTENV_KEY
|
|
4112
|
+
}
|
|
4113
|
+
|
|
4114
|
+
// secondary infra already contains a DOTENV_KEY environment variable
|
|
4115
|
+
if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
|
|
4116
|
+
return process.env.DOTENV_KEY
|
|
4117
|
+
}
|
|
4118
|
+
|
|
4119
|
+
// fallback to empty string
|
|
4120
|
+
return ''
|
|
4121
|
+
}
|
|
4122
|
+
|
|
4123
|
+
function _instructions (result, dotenvKey) {
|
|
4124
|
+
// Parse DOTENV_KEY. Format is a URI
|
|
4125
|
+
let uri;
|
|
4126
|
+
try {
|
|
4127
|
+
uri = new URL(dotenvKey);
|
|
4128
|
+
} catch (error) {
|
|
4129
|
+
if (error.code === 'ERR_INVALID_URL') {
|
|
4130
|
+
const err = new Error('INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development');
|
|
4131
|
+
err.code = 'INVALID_DOTENV_KEY';
|
|
4132
|
+
throw err
|
|
4133
|
+
}
|
|
4134
|
+
|
|
4135
|
+
throw error
|
|
4136
|
+
}
|
|
4137
|
+
|
|
4138
|
+
// Get decrypt key
|
|
4139
|
+
const key = uri.password;
|
|
4140
|
+
if (!key) {
|
|
4141
|
+
const err = new Error('INVALID_DOTENV_KEY: Missing key part');
|
|
4142
|
+
err.code = 'INVALID_DOTENV_KEY';
|
|
4143
|
+
throw err
|
|
4144
|
+
}
|
|
4145
|
+
|
|
4146
|
+
// Get environment
|
|
4147
|
+
const environment = uri.searchParams.get('environment');
|
|
4148
|
+
if (!environment) {
|
|
4149
|
+
const err = new Error('INVALID_DOTENV_KEY: Missing environment part');
|
|
4150
|
+
err.code = 'INVALID_DOTENV_KEY';
|
|
4151
|
+
throw err
|
|
4152
|
+
}
|
|
4153
|
+
|
|
4154
|
+
// Get ciphertext payload
|
|
4155
|
+
const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
|
|
4156
|
+
const ciphertext = result.parsed[environmentKey]; // DOTENV_VAULT_PRODUCTION
|
|
4157
|
+
if (!ciphertext) {
|
|
4158
|
+
const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
|
|
4159
|
+
err.code = 'NOT_FOUND_DOTENV_ENVIRONMENT';
|
|
4160
|
+
throw err
|
|
4161
|
+
}
|
|
4162
|
+
|
|
4163
|
+
return { ciphertext, key }
|
|
4164
|
+
}
|
|
4165
|
+
|
|
4166
|
+
function _vaultPath (options) {
|
|
4167
|
+
let possibleVaultPath = null;
|
|
4168
|
+
|
|
4169
|
+
if (options && options.path && options.path.length > 0) {
|
|
4170
|
+
if (Array.isArray(options.path)) {
|
|
4171
|
+
for (const filepath of options.path) {
|
|
4172
|
+
if (fs.existsSync(filepath)) {
|
|
4173
|
+
possibleVaultPath = filepath.endsWith('.vault') ? filepath : `${filepath}.vault`;
|
|
4174
|
+
}
|
|
4175
|
+
}
|
|
4176
|
+
} else {
|
|
4177
|
+
possibleVaultPath = options.path.endsWith('.vault') ? options.path : `${options.path}.vault`;
|
|
4178
|
+
}
|
|
4179
|
+
} else {
|
|
4180
|
+
possibleVaultPath = path.resolve(process.cwd(), '.env.vault');
|
|
4181
|
+
}
|
|
4182
|
+
|
|
4183
|
+
if (fs.existsSync(possibleVaultPath)) {
|
|
4184
|
+
return possibleVaultPath
|
|
4185
|
+
}
|
|
4186
|
+
|
|
4187
|
+
return null
|
|
4188
|
+
}
|
|
4189
|
+
|
|
4190
|
+
function _resolveHome (envPath) {
|
|
4191
|
+
return envPath[0] === '~' ? path.join(os.homedir(), envPath.slice(1)) : envPath
|
|
4192
|
+
}
|
|
4193
|
+
|
|
4194
|
+
function _configVault (options) {
|
|
4195
|
+
const debug = Boolean(options && options.debug);
|
|
4196
|
+
const quiet = Boolean(options && options.quiet);
|
|
4197
|
+
|
|
4198
|
+
if (debug || !quiet) {
|
|
4199
|
+
_log('Loading env from encrypted .env.vault');
|
|
4200
|
+
}
|
|
4201
|
+
|
|
4202
|
+
const parsed = DotenvModule._parseVault(options);
|
|
4203
|
+
|
|
4204
|
+
let processEnv = process.env;
|
|
4205
|
+
if (options && options.processEnv != null) {
|
|
4206
|
+
processEnv = options.processEnv;
|
|
4207
|
+
}
|
|
4208
|
+
|
|
4209
|
+
DotenvModule.populate(processEnv, parsed, options);
|
|
4210
|
+
|
|
4211
|
+
return { parsed }
|
|
4212
|
+
}
|
|
4213
|
+
|
|
4214
|
+
function configDotenv (options) {
|
|
4215
|
+
const dotenvPath = path.resolve(process.cwd(), '.env');
|
|
4216
|
+
let encoding = 'utf8';
|
|
4217
|
+
const debug = Boolean(options && options.debug);
|
|
4218
|
+
const quiet = Boolean(options && options.quiet);
|
|
4219
|
+
|
|
4220
|
+
if (options && options.encoding) {
|
|
4221
|
+
encoding = options.encoding;
|
|
4222
|
+
} else {
|
|
4223
|
+
if (debug) {
|
|
4224
|
+
_debug('No encoding is specified. UTF-8 is used by default');
|
|
4225
|
+
}
|
|
4226
|
+
}
|
|
4227
|
+
|
|
4228
|
+
let optionPaths = [dotenvPath]; // default, look for .env
|
|
4229
|
+
if (options && options.path) {
|
|
4230
|
+
if (!Array.isArray(options.path)) {
|
|
4231
|
+
optionPaths = [_resolveHome(options.path)];
|
|
4232
|
+
} else {
|
|
4233
|
+
optionPaths = []; // reset default
|
|
4234
|
+
for (const filepath of options.path) {
|
|
4235
|
+
optionPaths.push(_resolveHome(filepath));
|
|
4236
|
+
}
|
|
4237
|
+
}
|
|
4238
|
+
}
|
|
4239
|
+
|
|
4240
|
+
// Build the parsed data in a temporary object (because we need to return it). Once we have the final
|
|
4241
|
+
// parsed data, we will combine it with process.env (or options.processEnv if provided).
|
|
4242
|
+
let lastError;
|
|
4243
|
+
const parsedAll = {};
|
|
4244
|
+
for (const path of optionPaths) {
|
|
4245
|
+
try {
|
|
4246
|
+
// Specifying an encoding returns a string instead of a buffer
|
|
4247
|
+
const parsed = DotenvModule.parse(fs.readFileSync(path, { encoding }));
|
|
4248
|
+
|
|
4249
|
+
DotenvModule.populate(parsedAll, parsed, options);
|
|
4250
|
+
} catch (e) {
|
|
4251
|
+
if (debug) {
|
|
4252
|
+
_debug(`Failed to load ${path} ${e.message}`);
|
|
4253
|
+
}
|
|
4254
|
+
lastError = e;
|
|
4255
|
+
}
|
|
4256
|
+
}
|
|
4257
|
+
|
|
4258
|
+
let processEnv = process.env;
|
|
4259
|
+
if (options && options.processEnv != null) {
|
|
4260
|
+
processEnv = options.processEnv;
|
|
4261
|
+
}
|
|
4262
|
+
|
|
4263
|
+
DotenvModule.populate(processEnv, parsedAll, options);
|
|
4264
|
+
|
|
4265
|
+
if (debug || !quiet) {
|
|
4266
|
+
const keysCount = Object.keys(parsedAll).length;
|
|
4267
|
+
const shortPaths = [];
|
|
4268
|
+
for (const filePath of optionPaths) {
|
|
4269
|
+
try {
|
|
4270
|
+
const relative = path.relative(process.cwd(), filePath);
|
|
4271
|
+
shortPaths.push(relative);
|
|
4272
|
+
} catch {}
|
|
4273
|
+
}
|
|
4274
|
+
|
|
4275
|
+
_log(`injecting env (${keysCount}) from ${shortPaths.join(',')}`);
|
|
4276
|
+
}
|
|
4277
|
+
|
|
4278
|
+
if (lastError) {
|
|
4279
|
+
return { parsed: parsedAll, error: lastError }
|
|
4280
|
+
} else {
|
|
4281
|
+
return { parsed: parsedAll }
|
|
4282
|
+
}
|
|
4283
|
+
}
|
|
4284
|
+
|
|
4285
|
+
// Populates process.env from .env file
|
|
4286
|
+
function config (options) {
|
|
4287
|
+
// fallback to original dotenv if DOTENV_KEY is not set
|
|
4288
|
+
if (_dotenvKey(options).length === 0) {
|
|
4289
|
+
return DotenvModule.configDotenv(options)
|
|
4290
|
+
}
|
|
4291
|
+
|
|
4292
|
+
const vaultPath = _vaultPath(options);
|
|
4293
|
+
|
|
4294
|
+
// dotenvKey exists but .env.vault file does not exist
|
|
4295
|
+
if (!vaultPath) {
|
|
4296
|
+
_warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
|
|
4297
|
+
|
|
4298
|
+
return DotenvModule.configDotenv(options)
|
|
4299
|
+
}
|
|
4300
|
+
|
|
4301
|
+
return DotenvModule._configVault(options)
|
|
4302
|
+
}
|
|
4303
|
+
|
|
4304
|
+
function decrypt (encrypted, keyStr) {
|
|
4305
|
+
const key = Buffer.from(keyStr.slice(-64), 'hex');
|
|
4306
|
+
let ciphertext = Buffer.from(encrypted, 'base64');
|
|
4307
|
+
|
|
4308
|
+
const nonce = ciphertext.subarray(0, 12);
|
|
4309
|
+
const authTag = ciphertext.subarray(-16);
|
|
4310
|
+
ciphertext = ciphertext.subarray(12, -16);
|
|
4311
|
+
|
|
4312
|
+
try {
|
|
4313
|
+
const aesgcm = crypto.createDecipheriv('aes-256-gcm', key, nonce);
|
|
4314
|
+
aesgcm.setAuthTag(authTag);
|
|
4315
|
+
return `${aesgcm.update(ciphertext)}${aesgcm.final()}`
|
|
4316
|
+
} catch (error) {
|
|
4317
|
+
const isRange = error instanceof RangeError;
|
|
4318
|
+
const invalidKeyLength = error.message === 'Invalid key length';
|
|
4319
|
+
const decryptionFailed = error.message === 'Unsupported state or unable to authenticate data';
|
|
4320
|
+
|
|
4321
|
+
if (isRange || invalidKeyLength) {
|
|
4322
|
+
const err = new Error('INVALID_DOTENV_KEY: It must be 64 characters long (or more)');
|
|
4323
|
+
err.code = 'INVALID_DOTENV_KEY';
|
|
4324
|
+
throw err
|
|
4325
|
+
} else if (decryptionFailed) {
|
|
4326
|
+
const err = new Error('DECRYPTION_FAILED: Please check your DOTENV_KEY');
|
|
4327
|
+
err.code = 'DECRYPTION_FAILED';
|
|
4328
|
+
throw err
|
|
4329
|
+
} else {
|
|
4330
|
+
throw error
|
|
4331
|
+
}
|
|
4332
|
+
}
|
|
4333
|
+
}
|
|
4334
|
+
|
|
4335
|
+
// Populate process.env with parsed values
|
|
4336
|
+
function populate (processEnv, parsed, options = {}) {
|
|
4337
|
+
const debug = Boolean(options && options.debug);
|
|
4338
|
+
const override = Boolean(options && options.override);
|
|
4339
|
+
|
|
4340
|
+
if (typeof parsed !== 'object') {
|
|
4341
|
+
const err = new Error('OBJECT_REQUIRED: Please check the processEnv argument being passed to populate');
|
|
4342
|
+
err.code = 'OBJECT_REQUIRED';
|
|
4343
|
+
throw err
|
|
4344
|
+
}
|
|
4345
|
+
|
|
4346
|
+
// Set process.env
|
|
4347
|
+
for (const key of Object.keys(parsed)) {
|
|
4348
|
+
if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
|
|
4349
|
+
if (override === true) {
|
|
4350
|
+
processEnv[key] = parsed[key];
|
|
4351
|
+
}
|
|
4352
|
+
|
|
4353
|
+
if (debug) {
|
|
4354
|
+
if (override === true) {
|
|
4355
|
+
_debug(`"${key}" is already defined and WAS overwritten`);
|
|
4356
|
+
} else {
|
|
4357
|
+
_debug(`"${key}" is already defined and was NOT overwritten`);
|
|
4358
|
+
}
|
|
4359
|
+
}
|
|
4360
|
+
} else {
|
|
4361
|
+
processEnv[key] = parsed[key];
|
|
4362
|
+
}
|
|
4363
|
+
}
|
|
4364
|
+
}
|
|
4365
|
+
|
|
4366
|
+
const DotenvModule = {
|
|
4367
|
+
configDotenv,
|
|
4368
|
+
_configVault,
|
|
4369
|
+
_parseVault,
|
|
4370
|
+
config,
|
|
4371
|
+
decrypt,
|
|
4372
|
+
parse,
|
|
4373
|
+
populate
|
|
4374
|
+
};
|
|
4375
|
+
|
|
4376
|
+
main.exports.configDotenv = DotenvModule.configDotenv;
|
|
4377
|
+
main.exports._configVault = DotenvModule._configVault;
|
|
4378
|
+
main.exports._parseVault = DotenvModule._parseVault;
|
|
4379
|
+
main.exports.config = DotenvModule.config;
|
|
4380
|
+
main.exports.decrypt = DotenvModule.decrypt;
|
|
4381
|
+
main.exports.parse = DotenvModule.parse;
|
|
4382
|
+
main.exports.populate = DotenvModule.populate;
|
|
4383
|
+
|
|
4384
|
+
main.exports = DotenvModule;
|
|
4385
|
+
return main.exports;
|
|
4386
|
+
}
|
|
4387
|
+
|
|
4388
|
+
var envOptions;
|
|
4389
|
+
var hasRequiredEnvOptions;
|
|
4390
|
+
|
|
4391
|
+
function requireEnvOptions () {
|
|
4392
|
+
if (hasRequiredEnvOptions) return envOptions;
|
|
4393
|
+
hasRequiredEnvOptions = 1;
|
|
4394
|
+
// ../config.js accepts options via environment variables
|
|
4395
|
+
const options = {};
|
|
4396
|
+
|
|
4397
|
+
if (process.env.DOTENV_CONFIG_ENCODING != null) {
|
|
4398
|
+
options.encoding = process.env.DOTENV_CONFIG_ENCODING;
|
|
4399
|
+
}
|
|
4400
|
+
|
|
4401
|
+
if (process.env.DOTENV_CONFIG_PATH != null) {
|
|
4402
|
+
options.path = process.env.DOTENV_CONFIG_PATH;
|
|
4403
|
+
}
|
|
4404
|
+
|
|
4405
|
+
if (process.env.DOTENV_CONFIG_QUIET != null) {
|
|
4406
|
+
options.quiet = process.env.DOTENV_CONFIG_QUIET;
|
|
4407
|
+
}
|
|
4408
|
+
|
|
4409
|
+
if (process.env.DOTENV_CONFIG_DEBUG != null) {
|
|
4410
|
+
options.debug = process.env.DOTENV_CONFIG_DEBUG;
|
|
4411
|
+
}
|
|
4412
|
+
|
|
4413
|
+
if (process.env.DOTENV_CONFIG_OVERRIDE != null) {
|
|
4414
|
+
options.override = process.env.DOTENV_CONFIG_OVERRIDE;
|
|
4415
|
+
}
|
|
4416
|
+
|
|
4417
|
+
if (process.env.DOTENV_CONFIG_DOTENV_KEY != null) {
|
|
4418
|
+
options.DOTENV_KEY = process.env.DOTENV_CONFIG_DOTENV_KEY;
|
|
4419
|
+
}
|
|
4420
|
+
|
|
4421
|
+
envOptions = options;
|
|
4422
|
+
return envOptions;
|
|
4423
|
+
}
|
|
4424
|
+
|
|
4425
|
+
var cliOptions;
|
|
4426
|
+
var hasRequiredCliOptions;
|
|
4427
|
+
|
|
4428
|
+
function requireCliOptions () {
|
|
4429
|
+
if (hasRequiredCliOptions) return cliOptions;
|
|
4430
|
+
hasRequiredCliOptions = 1;
|
|
4431
|
+
const re = /^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/;
|
|
4432
|
+
|
|
4433
|
+
cliOptions = function optionMatcher (args) {
|
|
4434
|
+
const options = args.reduce(function (acc, cur) {
|
|
4435
|
+
const matches = cur.match(re);
|
|
4436
|
+
if (matches) {
|
|
4437
|
+
acc[matches[1]] = matches[2];
|
|
4438
|
+
}
|
|
4439
|
+
return acc
|
|
4440
|
+
}, {});
|
|
4441
|
+
|
|
4442
|
+
if (!('quiet' in options)) {
|
|
4443
|
+
options.quiet = 'true';
|
|
4444
|
+
}
|
|
4445
|
+
|
|
4446
|
+
return options
|
|
4447
|
+
};
|
|
4448
|
+
return cliOptions;
|
|
4449
|
+
}
|
|
4450
|
+
|
|
4451
|
+
var hasRequiredConfig;
|
|
4452
|
+
|
|
4453
|
+
function requireConfig () {
|
|
4454
|
+
if (hasRequiredConfig) return config$1;
|
|
4455
|
+
hasRequiredConfig = 1;
|
|
4456
|
+
(function () {
|
|
4457
|
+
requireMain().config(
|
|
4458
|
+
Object.assign(
|
|
4459
|
+
{},
|
|
4460
|
+
requireEnvOptions(),
|
|
4461
|
+
requireCliOptions()(process.argv)
|
|
4462
|
+
)
|
|
4463
|
+
);
|
|
4464
|
+
})();
|
|
4465
|
+
return config$1;
|
|
4466
|
+
}
|
|
4467
|
+
|
|
4468
|
+
requireConfig();
|
|
4469
|
+
|
|
3983
4470
|
objectType({
|
|
3984
4471
|
name: stringType().default("mcp-sitecore-server"),
|
|
3985
4472
|
version: stringType().optional(),
|
|
@@ -5802,12 +6289,6 @@ function mergeCapabilities(base, additional) {
|
|
|
5802
6289
|
}, { ...base });
|
|
5803
6290
|
}
|
|
5804
6291
|
|
|
5805
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
5806
|
-
|
|
5807
|
-
function getDefaultExportFromCjs (x) {
|
|
5808
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
5809
|
-
}
|
|
5810
|
-
|
|
5811
6292
|
var uri_all$1 = {exports: {}};
|
|
5812
6293
|
|
|
5813
6294
|
/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
|
|
@@ -31969,12 +32450,73 @@ const parseXMLString = function (xmlString) {
|
|
|
31969
32450
|
return parser.parse(xmlString);
|
|
31970
32451
|
};
|
|
31971
32452
|
|
|
32453
|
+
class PowershellCommandBuilder {
|
|
32454
|
+
buildCommandString(script, parameters = {}) {
|
|
32455
|
+
return `${script}${this.buildParametersString(parameters)}`;
|
|
32456
|
+
}
|
|
32457
|
+
buildParametersString(parameters = {}) {
|
|
32458
|
+
let parametersString = '';
|
|
32459
|
+
if (parameters) {
|
|
32460
|
+
for (const parameter in parameters) {
|
|
32461
|
+
if (parameters[parameter] === undefined || parameters[parameter] === null) {
|
|
32462
|
+
continue;
|
|
32463
|
+
}
|
|
32464
|
+
if (parameters[parameter] === "") {
|
|
32465
|
+
parametersString += ` -${parameter}`;
|
|
32466
|
+
}
|
|
32467
|
+
else if (Array.isArray(parameters[parameter])) {
|
|
32468
|
+
parametersString += ` -${parameter} "${parameters[parameter].join('","')}"`;
|
|
32469
|
+
}
|
|
32470
|
+
else if (this.isRecord(parameters[parameter])) {
|
|
32471
|
+
// Check whether the record has any keys
|
|
32472
|
+
if (Object.getOwnPropertyNames(parameters[parameter]).length > 0) {
|
|
32473
|
+
parametersString += ` -${parameter} ${this.buildPowershellHashtableString(parameters[parameter])}`;
|
|
32474
|
+
}
|
|
32475
|
+
}
|
|
32476
|
+
else {
|
|
32477
|
+
parametersString += ` -${parameter} "${parameters[parameter]}"`;
|
|
32478
|
+
}
|
|
32479
|
+
}
|
|
32480
|
+
}
|
|
32481
|
+
return parametersString;
|
|
32482
|
+
}
|
|
32483
|
+
buildPowershellHashtableString(parameters) {
|
|
32484
|
+
let result = "@{ ";
|
|
32485
|
+
let first = true;
|
|
32486
|
+
for (const parameter in parameters) {
|
|
32487
|
+
if (!first) {
|
|
32488
|
+
result += "; ";
|
|
32489
|
+
}
|
|
32490
|
+
result += `"${parameter}" = "${parameters[parameter]}"`;
|
|
32491
|
+
first = false;
|
|
32492
|
+
}
|
|
32493
|
+
result += " }";
|
|
32494
|
+
return result;
|
|
32495
|
+
}
|
|
32496
|
+
isRecord(value) {
|
|
32497
|
+
if (!value) {
|
|
32498
|
+
return false;
|
|
32499
|
+
}
|
|
32500
|
+
if (typeof value !== "object") {
|
|
32501
|
+
return false;
|
|
32502
|
+
}
|
|
32503
|
+
if (Array.isArray(value)) {
|
|
32504
|
+
return false;
|
|
32505
|
+
}
|
|
32506
|
+
if (Object.getOwnPropertySymbols(value).length > 0) {
|
|
32507
|
+
return false;
|
|
32508
|
+
}
|
|
32509
|
+
return Object.getOwnPropertyNames(value).every(prop => typeof value[prop] === "string");
|
|
32510
|
+
}
|
|
32511
|
+
}
|
|
32512
|
+
|
|
31972
32513
|
class PowershellClient {
|
|
31973
32514
|
serverUrl;
|
|
31974
32515
|
username;
|
|
31975
32516
|
password;
|
|
31976
32517
|
domain;
|
|
31977
32518
|
bearertoken = null;
|
|
32519
|
+
commandBuilder = new PowershellCommandBuilder();
|
|
31978
32520
|
constructor(serverUrl, username, password, domain = 'sitecore') {
|
|
31979
32521
|
this.serverUrl = serverUrl;
|
|
31980
32522
|
this.username = username;
|
|
@@ -31991,20 +32533,7 @@ class PowershellClient {
|
|
|
31991
32533
|
'Authorization': this.bearertoken || '',
|
|
31992
32534
|
'Content-Type': 'application/json',
|
|
31993
32535
|
};
|
|
31994
|
-
|
|
31995
|
-
if (parameters) {
|
|
31996
|
-
for (const parameter in parameters) {
|
|
31997
|
-
if (parameters[parameter] === "") {
|
|
31998
|
-
scriptWithParameters += ` -${parameter}`;
|
|
31999
|
-
}
|
|
32000
|
-
else if (Array.isArray(parameters[parameter])) {
|
|
32001
|
-
scriptWithParameters += ` -${parameter} "${parameters[parameter].join('","')}"`;
|
|
32002
|
-
}
|
|
32003
|
-
else {
|
|
32004
|
-
scriptWithParameters += ` -${parameter} "${parameters[parameter]}"`;
|
|
32005
|
-
}
|
|
32006
|
-
}
|
|
32007
|
-
}
|
|
32536
|
+
const scriptWithParameters = this.commandBuilder.buildCommandString(script, parameters);
|
|
32008
32537
|
const body = `${scriptWithParameters}\r\n <#${uuid}#>\r\n`;
|
|
32009
32538
|
const response = await fetch(url, {
|
|
32010
32539
|
method: 'POST',
|
|
@@ -33113,6 +33642,18 @@ function prepareArgsString(parameters) {
|
|
|
33113
33642
|
}
|
|
33114
33643
|
return scriptWithParameters;
|
|
33115
33644
|
}
|
|
33645
|
+
function getSwitchParameterValue(value) {
|
|
33646
|
+
if (value === true) {
|
|
33647
|
+
return "";
|
|
33648
|
+
}
|
|
33649
|
+
return undefined;
|
|
33650
|
+
}
|
|
33651
|
+
function getNumberParameterValue(value) {
|
|
33652
|
+
if (value || value === 0) {
|
|
33653
|
+
return value;
|
|
33654
|
+
}
|
|
33655
|
+
return undefined;
|
|
33656
|
+
}
|
|
33116
33657
|
|
|
33117
33658
|
function setItemAclByIdPowerShellTool(server, config) {
|
|
33118
33659
|
server.tool("security-set-item-acl-by-id", "Sets an access control entry to a Sitecore item by its ID.", {
|
|
@@ -33565,12 +34106,8 @@ function getLayoutByIdPowershellTool(server, config) {
|
|
|
33565
34106
|
const command = `Get-Layout`;
|
|
33566
34107
|
const options = {};
|
|
33567
34108
|
options["Id"] = params.id;
|
|
33568
|
-
|
|
33569
|
-
|
|
33570
|
-
}
|
|
33571
|
-
if (params.language) {
|
|
33572
|
-
options["Language"] = params.language;
|
|
33573
|
-
}
|
|
34109
|
+
options["FinalLayout"] = getSwitchParameterValue(params.finalLayout);
|
|
34110
|
+
options["Language"] = params.language;
|
|
33574
34111
|
return safeMcpResponse(runGenericPowershellCommand(config, command, options));
|
|
33575
34112
|
});
|
|
33576
34113
|
}
|
|
@@ -33588,12 +34125,8 @@ function getLayoutByPathPowershellTool(server, config) {
|
|
|
33588
34125
|
const command = `Get-Layout`;
|
|
33589
34126
|
const options = {};
|
|
33590
34127
|
options["Path"] = params.path;
|
|
33591
|
-
|
|
33592
|
-
|
|
33593
|
-
}
|
|
33594
|
-
if (params.language) {
|
|
33595
|
-
options["Language"] = params.language;
|
|
33596
|
-
}
|
|
34128
|
+
options["FinalLayout"] = getSwitchParameterValue(params.finalLayout);
|
|
34129
|
+
options["Language"] = params.language;
|
|
33597
34130
|
return safeMcpResponse(runGenericPowershellCommand(config, command, options));
|
|
33598
34131
|
});
|
|
33599
34132
|
}
|
|
@@ -33646,12 +34179,8 @@ function resetLayoutByIdPowershellTool(server, config) {
|
|
|
33646
34179
|
const command = `Reset-Layout`;
|
|
33647
34180
|
const options = {};
|
|
33648
34181
|
options["Id"] = params.id;
|
|
33649
|
-
|
|
33650
|
-
|
|
33651
|
-
}
|
|
33652
|
-
if (params.language) {
|
|
33653
|
-
options["Language"] = params.language;
|
|
33654
|
-
}
|
|
34182
|
+
options["FinalLayout"] = getSwitchParameterValue(params.finalLayout);
|
|
34183
|
+
options["Language"] = params.language;
|
|
33655
34184
|
return safeMcpResponse(runGenericPowershellCommand(config, command, options));
|
|
33656
34185
|
});
|
|
33657
34186
|
}
|
|
@@ -33665,12 +34194,8 @@ function resetLayoutByPathPowershellTool(server, config) {
|
|
|
33665
34194
|
const command = `Reset-Layout`;
|
|
33666
34195
|
const options = {};
|
|
33667
34196
|
options["Path"] = params.path;
|
|
33668
|
-
|
|
33669
|
-
|
|
33670
|
-
}
|
|
33671
|
-
if (params.language) {
|
|
33672
|
-
options["Language"] = params.language;
|
|
33673
|
-
}
|
|
34197
|
+
options["FinalLayout"] = getSwitchParameterValue(params.finalLayout);
|
|
34198
|
+
options["Language"] = params.language;
|
|
33674
34199
|
return safeMcpResponse(runGenericPowershellCommand(config, command, options));
|
|
33675
34200
|
});
|
|
33676
34201
|
}
|
|
@@ -33684,12 +34209,8 @@ function mergeLayoutByIdPowershellTool(server, config) {
|
|
|
33684
34209
|
const command = `Merge-Layout`;
|
|
33685
34210
|
const options = {};
|
|
33686
34211
|
options["Id"] = params.id;
|
|
33687
|
-
|
|
33688
|
-
|
|
33689
|
-
}
|
|
33690
|
-
if (params.language) {
|
|
33691
|
-
options["Language"] = params.language;
|
|
33692
|
-
}
|
|
34212
|
+
options["Database"] = params.database;
|
|
34213
|
+
options["Language"] = params.language;
|
|
33693
34214
|
return safeMcpResponse(runGenericPowershellCommand(config, command, options));
|
|
33694
34215
|
});
|
|
33695
34216
|
}
|
|
@@ -33702,9 +34223,7 @@ function mergeLayoutByPathPowershellTool(server, config) {
|
|
|
33702
34223
|
const command = `Merge-Layout`;
|
|
33703
34224
|
const options = {};
|
|
33704
34225
|
options["Path"] = params.path;
|
|
33705
|
-
|
|
33706
|
-
options["Language"] = params.language;
|
|
33707
|
-
}
|
|
34226
|
+
options["Language"] = params.language;
|
|
33708
34227
|
return safeMcpResponse(runGenericPowershellCommand(config, command, options));
|
|
33709
34228
|
});
|
|
33710
34229
|
}
|
|
@@ -33727,6 +34246,324 @@ function getDefaultLayoutDevicePowershellTool(server, config) {
|
|
|
33727
34246
|
});
|
|
33728
34247
|
}
|
|
33729
34248
|
|
|
34249
|
+
function getRenderingByIdPowershellTool(server, config) {
|
|
34250
|
+
server.tool("presentation-get-rendering-by-id", "Gets rendering definition by item id.", {
|
|
34251
|
+
itemId: stringType().describe("The id of the item to retrieve rendering for."),
|
|
34252
|
+
database: stringType().describe("The context database.").optional(),
|
|
34253
|
+
dataSource: stringType().describe("The rendering data source filter.").optional(),
|
|
34254
|
+
placeholder: stringType().describe("The rendering datasource filter.").optional(),
|
|
34255
|
+
language: stringType().describe("The item language filter.").optional(),
|
|
34256
|
+
finalLayout: booleanType()
|
|
34257
|
+
.describe("Specifies layout holding the rendering definition. If 'true', the final layout is used, otherwise - shared layout.")
|
|
34258
|
+
.optional(),
|
|
34259
|
+
uniqueId: stringType().describe("The rendering definition unique id.").optional(),
|
|
34260
|
+
}, async (params) => {
|
|
34261
|
+
const command = `Get-Rendering`;
|
|
34262
|
+
const options = {};
|
|
34263
|
+
options["Id"] = params.itemId;
|
|
34264
|
+
options["Database"] = params.database;
|
|
34265
|
+
options["DataSource"] = params.dataSource;
|
|
34266
|
+
options["Placeholder"] = params.placeholder;
|
|
34267
|
+
options["Language"] = params.language;
|
|
34268
|
+
options["FinalLayout"] = getSwitchParameterValue(params.finalLayout);
|
|
34269
|
+
options["UniqueId"] = params.uniqueId;
|
|
34270
|
+
return safeMcpResponse(runGenericPowershellCommand(config, command, options));
|
|
34271
|
+
});
|
|
34272
|
+
}
|
|
34273
|
+
|
|
34274
|
+
function getRenderingByPathPowershellTool(server, config) {
|
|
34275
|
+
server.tool("presentation-get-rendering-by-path", "Gets rendering definition by item path.", {
|
|
34276
|
+
path: stringType().describe("The id of the item to retrieve rendering for."),
|
|
34277
|
+
dataSource: stringType().describe("The rendering data source filter.").optional(),
|
|
34278
|
+
placeholder: stringType().describe("The rendering datasource filter.").optional(),
|
|
34279
|
+
language: stringType().describe("The item language.").optional(),
|
|
34280
|
+
finalLayout: booleanType()
|
|
34281
|
+
.describe("Specifies layout holding the rendering definition. If 'true', the final layout is used, otherwise - shared layout.")
|
|
34282
|
+
.optional(),
|
|
34283
|
+
uniqueId: stringType().describe("The rendering definition unique id.").optional(),
|
|
34284
|
+
}, async (params) => {
|
|
34285
|
+
const command = `Get-Rendering`;
|
|
34286
|
+
const options = {};
|
|
34287
|
+
options["Path"] = params.path;
|
|
34288
|
+
options["DataSource"] = params.dataSource;
|
|
34289
|
+
options["Placeholder"] = params.placeholder;
|
|
34290
|
+
options["Language"] = params.language;
|
|
34291
|
+
options["FinalLayout"] = getSwitchParameterValue(params.finalLayout);
|
|
34292
|
+
options["UniqueId"] = params.uniqueId;
|
|
34293
|
+
return safeMcpResponse(runGenericPowershellCommand(config, command, options));
|
|
34294
|
+
});
|
|
34295
|
+
}
|
|
34296
|
+
|
|
34297
|
+
function removeRenderingByPathPowershellTool(server, config) {
|
|
34298
|
+
server.tool("presentation-remove-rendering-by-path", "Removes renderings from an item by owners item path.", {
|
|
34299
|
+
path: stringType().describe("The path of the item to remove rendering from."),
|
|
34300
|
+
uniqueId: stringType().describe("The rendering definition unique id."),
|
|
34301
|
+
dataSource: stringType().describe("The rendering data source filter.").optional(),
|
|
34302
|
+
placeholder: stringType().describe("The rendering placeholder filter.").optional(),
|
|
34303
|
+
language: stringType().describe("The item language filter.").optional(),
|
|
34304
|
+
finalLayout: booleanType()
|
|
34305
|
+
.describe("Specifies layout holding the rendering definition. If 'true', the final layout is used, otherwise - shared layout.")
|
|
34306
|
+
.optional(),
|
|
34307
|
+
}, async (params) => {
|
|
34308
|
+
const command = `Remove-Rendering`;
|
|
34309
|
+
const options = {};
|
|
34310
|
+
options["Path"] = params.path;
|
|
34311
|
+
options["UniqueId"] = params.uniqueId;
|
|
34312
|
+
options["DataSource"] = params.dataSource;
|
|
34313
|
+
options["Placeholder"] = params.placeholder;
|
|
34314
|
+
options["Language"] = params.language;
|
|
34315
|
+
options["FinalLayout"] = getSwitchParameterValue(params.finalLayout);
|
|
34316
|
+
return safeMcpResponse(runGenericPowershellCommand(config, command, options));
|
|
34317
|
+
});
|
|
34318
|
+
}
|
|
34319
|
+
|
|
34320
|
+
function removeRenderingByIdPowershellTool(server, config) {
|
|
34321
|
+
server.tool("presentation-remove-rendering-by-id", "Removes renderings from an item by owners item ID.", {
|
|
34322
|
+
itemId: stringType().describe("The ID of the item to remove rendering from."),
|
|
34323
|
+
uniqueId: stringType().describe("The rendering definition unique id."),
|
|
34324
|
+
database: stringType().describe("The database of the item to remove rendering from.").optional(),
|
|
34325
|
+
dataSource: stringType().describe("The rendering data source filter.").optional(),
|
|
34326
|
+
placeholder: stringType().describe("The rendering placeholder filter.").optional(),
|
|
34327
|
+
language: stringType().describe("The item language filter.").optional(),
|
|
34328
|
+
finalLayout: booleanType()
|
|
34329
|
+
.describe("Specifies layout holding the rendering definition. If 'true', the final layout is used, otherwise - shared layout.")
|
|
34330
|
+
.optional(),
|
|
34331
|
+
}, async (params) => {
|
|
34332
|
+
const command = `Remove-Rendering`;
|
|
34333
|
+
const options = {};
|
|
34334
|
+
options["Id"] = params.itemId;
|
|
34335
|
+
options["UniqueId"] = params.uniqueId;
|
|
34336
|
+
options["Database"] = params.database;
|
|
34337
|
+
options["DataSource"] = params.dataSource;
|
|
34338
|
+
options["Placeholder"] = params.placeholder;
|
|
34339
|
+
options["Language"] = params.language;
|
|
34340
|
+
options["FinalLayout"] = getSwitchParameterValue(params.finalLayout);
|
|
34341
|
+
return safeMcpResponse(runGenericPowershellCommand(config, command, options));
|
|
34342
|
+
});
|
|
34343
|
+
}
|
|
34344
|
+
|
|
34345
|
+
function addRenderingByPathPowershellTool(server, config) {
|
|
34346
|
+
server.tool("presentation-add-rendering-by-path", "Adds a rendering to presentation of an item specified by path.", {
|
|
34347
|
+
itemPath: stringType().describe("The path of the item to add the rendering to."),
|
|
34348
|
+
renderingPath: stringType().describe("The path of the rendering to add."),
|
|
34349
|
+
placeHolder: stringType().describe("The placeholder to add the rendering to.").optional(),
|
|
34350
|
+
dataSource: stringType().describe("The rendering data source.").optional(),
|
|
34351
|
+
finalLayout: booleanType()
|
|
34352
|
+
.describe("Specifies layout to add the rendering to. If 'true', the final layout is used, otherwise - shared layout.")
|
|
34353
|
+
.optional(),
|
|
34354
|
+
language: stringType().describe("The language version of the item to add the rendering to.").optional(),
|
|
34355
|
+
index: numberType().describe("The index at which the Rendering should be inserted.").optional(),
|
|
34356
|
+
}, async (params) => {
|
|
34357
|
+
const commandBuilder = new PowershellCommandBuilder();
|
|
34358
|
+
const addRenderingParameters = {};
|
|
34359
|
+
addRenderingParameters["Path"] = params.itemPath;
|
|
34360
|
+
addRenderingParameters["Placeholder"] = params.placeHolder;
|
|
34361
|
+
addRenderingParameters["DataSource"] = params.dataSource;
|
|
34362
|
+
addRenderingParameters["FinalLayout"] = getSwitchParameterValue(params.finalLayout);
|
|
34363
|
+
addRenderingParameters["Language"] = params.language;
|
|
34364
|
+
addRenderingParameters["Index"] = getNumberParameterValue(params.index);
|
|
34365
|
+
const command = `
|
|
34366
|
+
$rendering = New-Rendering -Path "${params.renderingPath}";
|
|
34367
|
+
Add-Rendering -Instance $rendering ${commandBuilder.buildParametersString(addRenderingParameters)};
|
|
34368
|
+
`;
|
|
34369
|
+
return safeMcpResponse(runGenericPowershellCommand(config, command, {}));
|
|
34370
|
+
});
|
|
34371
|
+
}
|
|
34372
|
+
|
|
34373
|
+
function addRenderingByIdPowershellTool(server, config) {
|
|
34374
|
+
server.tool("presentation-add-rendering-by-id", "Adds a rendering to presentation of an item specified by item ID.", {
|
|
34375
|
+
itemId: stringType().describe("The ID of the item to add the rendering to."),
|
|
34376
|
+
renderingId: stringType().describe("The ID of the rendering to add."),
|
|
34377
|
+
database: stringType().describe("The context database.").default("master").optional(),
|
|
34378
|
+
placeHolder: stringType().describe("The placeholder to add the rendering to.").optional(),
|
|
34379
|
+
dataSource: stringType().describe("The rendering data source.").optional(),
|
|
34380
|
+
finalLayout: booleanType()
|
|
34381
|
+
.describe("Specifies layout to add the rendering to. If 'true', the final layout is used, otherwise - shared layout.")
|
|
34382
|
+
.optional(),
|
|
34383
|
+
language: stringType().describe("The language version of the item to add the rendering to.").optional(),
|
|
34384
|
+
index: numberType().describe("The index at which the Rendering should be inserted.").optional(),
|
|
34385
|
+
}, async (params) => {
|
|
34386
|
+
const commandBuilder = new PowershellCommandBuilder();
|
|
34387
|
+
const addRenderingParameters = {};
|
|
34388
|
+
addRenderingParameters["Id"] = params.itemId;
|
|
34389
|
+
addRenderingParameters["Placeholder"] = params.placeHolder;
|
|
34390
|
+
addRenderingParameters["DataSource"] = params.dataSource;
|
|
34391
|
+
addRenderingParameters["FinalLayout"] = getSwitchParameterValue(params.finalLayout);
|
|
34392
|
+
addRenderingParameters["Database"] = params.database;
|
|
34393
|
+
addRenderingParameters["Language"] = params.language;
|
|
34394
|
+
addRenderingParameters["Index"] = getNumberParameterValue(params.index);
|
|
34395
|
+
const command = `
|
|
34396
|
+
$rendering = New-Rendering -Id ${params.renderingId} -Database ${params.database};
|
|
34397
|
+
Add-Rendering -Instance $rendering ${commandBuilder.buildParametersString(addRenderingParameters)};
|
|
34398
|
+
`;
|
|
34399
|
+
return safeMcpResponse(runGenericPowershellCommand(config, command, {}));
|
|
34400
|
+
});
|
|
34401
|
+
}
|
|
34402
|
+
|
|
34403
|
+
function setRenderingByPathPowershellTool(server, config) {
|
|
34404
|
+
server.tool("presentation-set-rendering-by-path", "Updates rendering specified by item path with new values.", {
|
|
34405
|
+
itemPath: stringType().describe("The path of the item holding the rendering."),
|
|
34406
|
+
uniqueId: stringType().describe("The unique ID of the rendering."),
|
|
34407
|
+
placeholder: stringType().describe("New rendering placeholder value if specified.").optional(),
|
|
34408
|
+
dataSource: stringType().describe("New rendering data source if specified.").optional(),
|
|
34409
|
+
finalLayout: booleanType()
|
|
34410
|
+
.describe("Specifies the layout to update the rendering. If 'true', the final layout is used, otherwise - shared layout.")
|
|
34411
|
+
.optional(),
|
|
34412
|
+
language: stringType().describe("The language version of the item holding the rendering.").optional(),
|
|
34413
|
+
index: numberType().describe("New index of the rendering in the layout.").optional(),
|
|
34414
|
+
parameter: recordType(stringType(), stringType()).describe("New rendering parameters if specified.").optional(),
|
|
34415
|
+
}, async (params) => {
|
|
34416
|
+
const commandBuilder = new PowershellCommandBuilder();
|
|
34417
|
+
const getRenderingParameters = {};
|
|
34418
|
+
getRenderingParameters["Path"] = params.itemPath;
|
|
34419
|
+
getRenderingParameters["UniqueId"] = params.uniqueId;
|
|
34420
|
+
const setRenderingParameters = {};
|
|
34421
|
+
setRenderingParameters["Path"] = params.itemPath;
|
|
34422
|
+
setRenderingParameters["Placeholder"] = params.placeholder;
|
|
34423
|
+
setRenderingParameters["DataSource"] = params.dataSource;
|
|
34424
|
+
setRenderingParameters["FinalLayout"] = getSwitchParameterValue(params.finalLayout);
|
|
34425
|
+
setRenderingParameters["Language"] = params.language;
|
|
34426
|
+
setRenderingParameters["Index"] = getNumberParameterValue(params.index);
|
|
34427
|
+
setRenderingParameters["Parameter"] = params.parameter;
|
|
34428
|
+
const command = `
|
|
34429
|
+
$rendering = Get-Rendering ${commandBuilder.buildParametersString(getRenderingParameters)};
|
|
34430
|
+
Set-Rendering -Instance $rendering ${commandBuilder.buildParametersString(setRenderingParameters)};
|
|
34431
|
+
`;
|
|
34432
|
+
return safeMcpResponse(runGenericPowershellCommand(config, command, {}));
|
|
34433
|
+
});
|
|
34434
|
+
}
|
|
34435
|
+
|
|
34436
|
+
function setRenderingByIdPowershellTool(server, config) {
|
|
34437
|
+
server.tool("presentation-set-rendering-by-id", "Updates rendering specified by item ID with new values.", {
|
|
34438
|
+
itemId: stringType().describe("The ID of the item holding the rendering."),
|
|
34439
|
+
uniqueId: stringType().describe("The unique ID of the rendering."),
|
|
34440
|
+
database: stringType().describe("The context database.").default("master").optional(),
|
|
34441
|
+
placeholder: stringType().describe("New rendering placeholder value if specified.").optional(),
|
|
34442
|
+
dataSource: stringType().describe("New rendering data source if specified.").optional(),
|
|
34443
|
+
finalLayout: booleanType()
|
|
34444
|
+
.describe("Specifies the layout to update the rendering. If 'true', the final layout is used, otherwise - shared layout.")
|
|
34445
|
+
.optional(),
|
|
34446
|
+
language: stringType().describe("The language version of the item holding the rendering.").optional(),
|
|
34447
|
+
index: numberType().describe("New index of the rendering in the layout.").optional(),
|
|
34448
|
+
parameter: recordType(stringType(), stringType()).describe("New rendering parameters if specified.").optional(),
|
|
34449
|
+
}, async (params) => {
|
|
34450
|
+
const commandBuilder = new PowershellCommandBuilder();
|
|
34451
|
+
const getRenderingParameters = {};
|
|
34452
|
+
getRenderingParameters["Id"] = params.itemId;
|
|
34453
|
+
getRenderingParameters["UniqueId"] = params.uniqueId;
|
|
34454
|
+
getRenderingParameters["Database"] = params.database;
|
|
34455
|
+
const setRenderingParameters = {};
|
|
34456
|
+
setRenderingParameters["Id"] = params.itemId;
|
|
34457
|
+
setRenderingParameters["Database"] = params.database;
|
|
34458
|
+
setRenderingParameters["Placeholder"] = params.placeholder;
|
|
34459
|
+
setRenderingParameters["DataSource"] = params.dataSource;
|
|
34460
|
+
setRenderingParameters["FinalLayout"] = getSwitchParameterValue(params.finalLayout);
|
|
34461
|
+
setRenderingParameters["Language"] = params.language;
|
|
34462
|
+
setRenderingParameters["Index"] = getNumberParameterValue(params.index);
|
|
34463
|
+
setRenderingParameters["Parameter"] = params.parameter;
|
|
34464
|
+
const command = `
|
|
34465
|
+
$rendering = Get-Rendering ${commandBuilder.buildParametersString(getRenderingParameters)};
|
|
34466
|
+
Set-Rendering -Instance $rendering ${commandBuilder.buildParametersString(setRenderingParameters)};
|
|
34467
|
+
`;
|
|
34468
|
+
return safeMcpResponse(runGenericPowershellCommand(config, command, {}));
|
|
34469
|
+
});
|
|
34470
|
+
}
|
|
34471
|
+
|
|
34472
|
+
function switchRenderingByIdPowershellTool(server, config) {
|
|
34473
|
+
server.tool("presentation-switch-rendering-by-id", "Switches an existing rendering specified by item ID with an alternate one for the item specified by item ID.", {
|
|
34474
|
+
itemId: stringType().describe("The ID of the item holding the renderings."),
|
|
34475
|
+
oldRenderingId: stringType().describe("The ID of the rendering to switch."),
|
|
34476
|
+
newRenderingId: stringType().describe("The ID of the new rendering."),
|
|
34477
|
+
database: stringType().describe("The context database.").default("master").optional(),
|
|
34478
|
+
finalLayout: booleanType()
|
|
34479
|
+
.describe("Specifies the layout to update the rendering. If 'true', the final layout is used, otherwise - shared layout.")
|
|
34480
|
+
.optional(),
|
|
34481
|
+
language: stringType().describe("The language version of the item holding the renderings.").optional(),
|
|
34482
|
+
}, async (params) => {
|
|
34483
|
+
const commandBuilder = new PowershellCommandBuilder();
|
|
34484
|
+
const getRenderingParameters = {};
|
|
34485
|
+
getRenderingParameters["Id"] = params.itemId;
|
|
34486
|
+
getRenderingParameters["Database"] = params.database;
|
|
34487
|
+
getRenderingParameters["Language"] = params.language;
|
|
34488
|
+
getRenderingParameters["FinalLayout"] = getSwitchParameterValue(params.finalLayout);
|
|
34489
|
+
const newRenderingParameters = {};
|
|
34490
|
+
newRenderingParameters["Id"] = params.newRenderingId;
|
|
34491
|
+
newRenderingParameters["Database"] = params.database;
|
|
34492
|
+
const switchRenderingParameters = {};
|
|
34493
|
+
switchRenderingParameters["Id"] = params.itemId;
|
|
34494
|
+
switchRenderingParameters["Database"] = params.database;
|
|
34495
|
+
switchRenderingParameters["Language"] = params.language;
|
|
34496
|
+
switchRenderingParameters["FinalLayout"] = getSwitchParameterValue(params.finalLayout);
|
|
34497
|
+
const command = `
|
|
34498
|
+
$sourceRenderings = Get-Rendering ${commandBuilder.buildParametersString(getRenderingParameters)} | Where-Object { $_.ItemID -ceq "${params.oldRenderingId}" };
|
|
34499
|
+
$targetRendering = New-Rendering ${commandBuilder.buildParametersString(newRenderingParameters)}
|
|
34500
|
+
foreach($sourceRendering in $sourceRenderings) {
|
|
34501
|
+
Switch-Rendering -Instance $sourceRendering -NewRendering $targetRendering ${commandBuilder.buildParametersString(switchRenderingParameters)}
|
|
34502
|
+
}
|
|
34503
|
+
`;
|
|
34504
|
+
return safeMcpResponse(runGenericPowershellCommand(config, command, {}));
|
|
34505
|
+
});
|
|
34506
|
+
}
|
|
34507
|
+
|
|
34508
|
+
function switchRenderingByPathPowershellTool(server, config) {
|
|
34509
|
+
server.tool("presentation-switch-rendering-by-path", "Switches an existing rendering specified by path with an alternate one for the item specified by path.", {
|
|
34510
|
+
itemPath: stringType().describe("The path of the item holding the renderings."),
|
|
34511
|
+
oldRenderingPath: stringType().describe("The path of the rendering to switch."),
|
|
34512
|
+
newRenderingPath: stringType().describe("The path of the new rendering."),
|
|
34513
|
+
finalLayout: booleanType()
|
|
34514
|
+
.describe("Specifies the layout to update the rendering. If 'true', the final layout is used, otherwise - shared layout.")
|
|
34515
|
+
.optional(),
|
|
34516
|
+
language: stringType().describe("The language version of the item holding the renderings.").optional(),
|
|
34517
|
+
}, async (params) => {
|
|
34518
|
+
const commandBuilder = new PowershellCommandBuilder();
|
|
34519
|
+
const getRenderingParameters = {};
|
|
34520
|
+
getRenderingParameters["Path"] = params.itemPath;
|
|
34521
|
+
getRenderingParameters["Language"] = params.language;
|
|
34522
|
+
getRenderingParameters["FinalLayout"] = getSwitchParameterValue(params.finalLayout);
|
|
34523
|
+
const newRenderingParameters = {};
|
|
34524
|
+
newRenderingParameters["Path"] = params.newRenderingPath;
|
|
34525
|
+
const switchRenderingParameters = {};
|
|
34526
|
+
switchRenderingParameters["Path"] = params.itemPath;
|
|
34527
|
+
switchRenderingParameters["Language"] = params.language;
|
|
34528
|
+
switchRenderingParameters["FinalLayout"] = getSwitchParameterValue(params.finalLayout);
|
|
34529
|
+
const command = `
|
|
34530
|
+
$oldRendering = Get-Item -Path "${params.oldRenderingPath}"
|
|
34531
|
+
$sourceRenderings = Get-Rendering ${commandBuilder.buildParametersString(getRenderingParameters)} | Where-Object { $_.ItemID -ceq $oldRendering.ID.ToString() };
|
|
34532
|
+
$targetRendering = New-Rendering ${commandBuilder.buildParametersString(newRenderingParameters)}
|
|
34533
|
+
foreach($sourceRendering in $sourceRenderings) {
|
|
34534
|
+
Switch-Rendering -Instance $sourceRendering -NewRendering $targetRendering ${commandBuilder.buildParametersString(switchRenderingParameters)}
|
|
34535
|
+
}
|
|
34536
|
+
`;
|
|
34537
|
+
return safeMcpResponse(runGenericPowershellCommand(config, command, {}));
|
|
34538
|
+
});
|
|
34539
|
+
}
|
|
34540
|
+
|
|
34541
|
+
function switchRenderingByUniqueIdPowershellTool(server, config) {
|
|
34542
|
+
server.tool("presentation-switch-rendering-by-unique-id", "Switches an existing rendering specified by unique ID with an alternate one for the item specified by item ID.", {
|
|
34543
|
+
itemId: stringType().describe("The ID of the item holding the rendering."),
|
|
34544
|
+
uniqueId: stringType().describe("The unique ID of the rendering to switch."),
|
|
34545
|
+
newRenderingId: stringType().describe("The ID of the new rendering."),
|
|
34546
|
+
database: stringType().describe("The context database.").default("master").optional(),
|
|
34547
|
+
finalLayout: booleanType()
|
|
34548
|
+
.describe("Specifies the layout to update the rendering. If 'true', the final layout is used, otherwise - shared layout.")
|
|
34549
|
+
.optional(),
|
|
34550
|
+
language: stringType().describe("The language version of the item holding the renderings.").optional(),
|
|
34551
|
+
}, async (params) => {
|
|
34552
|
+
const commandBuilder = new PowershellCommandBuilder();
|
|
34553
|
+
const switchRenderingParameters = {};
|
|
34554
|
+
switchRenderingParameters["Id"] = params.itemId;
|
|
34555
|
+
switchRenderingParameters["UniqueId"] = params.uniqueId;
|
|
34556
|
+
switchRenderingParameters["Database"] = params.database;
|
|
34557
|
+
switchRenderingParameters["FinalLayout"] = getSwitchParameterValue(params.finalLayout);
|
|
34558
|
+
switchRenderingParameters["Language"] = params.language;
|
|
34559
|
+
const command = `
|
|
34560
|
+
$targetRendering = New-Rendering -Id "${params.newRenderingId}" -Database "${params.database}"
|
|
34561
|
+
Switch-Rendering -NewRendering $targetRendering ${commandBuilder.buildParametersString(switchRenderingParameters)}
|
|
34562
|
+
`;
|
|
34563
|
+
return safeMcpResponse(runGenericPowershellCommand(config, command, {}));
|
|
34564
|
+
});
|
|
34565
|
+
}
|
|
34566
|
+
|
|
33730
34567
|
var LogLevel;
|
|
33731
34568
|
(function (LogLevel) {
|
|
33732
34569
|
LogLevel["DEBUG"] = "DEBUG";
|
|
@@ -33926,9 +34763,20 @@ async function registerAll(server, config) {
|
|
|
33926
34763
|
mergeLayoutByPathPowershellTool,
|
|
33927
34764
|
getLayoutDevicePowershellTool,
|
|
33928
34765
|
getDefaultLayoutDevicePowershellTool,
|
|
33929
|
-
|
|
34766
|
+
getRenderingByIdPowershellTool,
|
|
34767
|
+
getRenderingByPathPowershellTool,
|
|
34768
|
+
removeRenderingByPathPowershellTool,
|
|
34769
|
+
removeRenderingByIdPowershellTool,
|
|
34770
|
+
//Composite Presentation PowerShell Tools
|
|
33930
34771
|
setLayoutIdPowershellTool,
|
|
33931
34772
|
setLayoutByPathPowershellTool,
|
|
34773
|
+
addRenderingByPathPowershellTool,
|
|
34774
|
+
addRenderingByIdPowershellTool,
|
|
34775
|
+
setRenderingByPathPowershellTool,
|
|
34776
|
+
setRenderingByIdPowershellTool,
|
|
34777
|
+
switchRenderingByIdPowershellTool,
|
|
34778
|
+
switchRenderingByPathPowershellTool,
|
|
34779
|
+
switchRenderingByUniqueIdPowershellTool,
|
|
33932
34780
|
//Logging
|
|
33933
34781
|
getLogsPowerShellTool,
|
|
33934
34782
|
//Provider
|
|
@@ -34180,7 +35028,7 @@ function requireDepd () {
|
|
|
34180
35028
|
* Module dependencies.
|
|
34181
35029
|
*/
|
|
34182
35030
|
|
|
34183
|
-
var relative = require$$
|
|
35031
|
+
var relative = require$$1$1.relative;
|
|
34184
35032
|
|
|
34185
35033
|
/**
|
|
34186
35034
|
* Module exports.
|
|
@@ -34853,7 +35701,7 @@ function requireHttpErrors () {
|
|
|
34853
35701
|
|
|
34854
35702
|
var deprecate = requireDepd()('http-errors');
|
|
34855
35703
|
var setPrototypeOf = requireSetprototypeof();
|
|
34856
|
-
var statuses = require$$2$
|
|
35704
|
+
var statuses = require$$2$2;
|
|
34857
35705
|
var inherits = requireInherits();
|
|
34858
35706
|
var toIdentifier = requireToidentifier();
|
|
34859
35707
|
|
|
@@ -35332,7 +36180,7 @@ function requireInternal () {
|
|
|
35332
36180
|
//------------------------------------------------------------------------------
|
|
35333
36181
|
|
|
35334
36182
|
// We use node.js internal decoder. Its signature is the same as ours.
|
|
35335
|
-
var StringDecoder = require$$1$
|
|
36183
|
+
var StringDecoder = require$$1$2.StringDecoder;
|
|
35336
36184
|
|
|
35337
36185
|
if (!StringDecoder.prototype.end) // Node v0.8 doesn't have this method.
|
|
35338
36186
|
StringDecoder.prototype.end = function() {};
|