@copado/agentia-cli 0.56.0-alpha.0 → 0.58.0-alpha.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/README.md +1180 -117
- package/dist/commands/cicd/data/commit/create.d.ts +11 -0
- package/dist/commands/cicd/data/commit/create.js +41 -0
- package/dist/commands/cicd/data/commit/create.js.map +1 -0
- package/dist/commands/cicd/data/commit/list.d.ts +10 -0
- package/dist/commands/cicd/data/commit/list.js +42 -0
- package/dist/commands/cicd/data/commit/list.js.map +1 -0
- package/dist/commands/cicd/data/dataset-file/content.d.ts +10 -0
- package/dist/commands/cicd/data/dataset-file/content.js +53 -0
- package/dist/commands/cicd/data/dataset-file/content.js.map +1 -0
- package/dist/commands/cicd/data/dataset-file/list.d.ts +10 -0
- package/dist/commands/cicd/data/dataset-file/list.js +42 -0
- package/dist/commands/cicd/data/dataset-file/list.js.map +1 -0
- package/dist/commands/cicd/data/filter/add.d.ts +13 -0
- package/dist/commands/cicd/data/filter/add.js +42 -0
- package/dist/commands/cicd/data/filter/add.js.map +1 -0
- package/dist/commands/cicd/data/filter/delete.d.ts +10 -0
- package/dist/commands/cicd/data/filter/delete.js +33 -0
- package/dist/commands/cicd/data/filter/delete.js.map +1 -0
- package/dist/commands/cicd/data/filter/list.d.ts +10 -0
- package/dist/commands/cicd/data/filter/list.js +42 -0
- package/dist/commands/cicd/data/filter/list.js.map +1 -0
- package/dist/commands/cicd/data/filter/update.d.ts +14 -0
- package/dist/commands/cicd/data/filter/update.js +46 -0
- package/dist/commands/cicd/data/filter/update.js.map +1 -0
- package/dist/commands/cicd/data/formula/create.d.ts +16 -0
- package/dist/commands/cicd/data/formula/create.js +62 -0
- package/dist/commands/cicd/data/formula/create.js.map +1 -0
- package/dist/commands/cicd/data/formula/list.d.ts +10 -0
- package/dist/commands/cicd/data/formula/list.js +42 -0
- package/dist/commands/cicd/data/formula/list.js.map +1 -0
- package/dist/commands/cicd/data/formula/update.d.ts +18 -0
- package/dist/commands/cicd/data/formula/update.js +78 -0
- package/dist/commands/cicd/data/formula/update.js.map +1 -0
- package/dist/commands/cicd/data/records/match.d.ts +11 -0
- package/dist/commands/cicd/data/records/match.js +39 -0
- package/dist/commands/cicd/data/records/match.js.map +1 -0
- package/dist/commands/cicd/data/records/search.d.ts +14 -0
- package/dist/commands/cicd/data/records/search.js +65 -0
- package/dist/commands/cicd/data/records/search.js.map +1 -0
- package/dist/commands/cicd/data/sobject/fields.d.ts +13 -0
- package/dist/commands/cicd/data/sobject/fields.js +56 -0
- package/dist/commands/cicd/data/sobject/fields.js.map +1 -0
- package/dist/commands/cicd/data/sobject/relationships.d.ts +13 -0
- package/dist/commands/cicd/data/sobject/relationships.js +66 -0
- package/dist/commands/cicd/data/sobject/relationships.js.map +1 -0
- package/dist/commands/cicd/data/sync/apply.d.ts +11 -0
- package/dist/commands/cicd/data/sync/apply.js +40 -0
- package/dist/commands/cicd/data/sync/apply.js.map +1 -0
- package/dist/commands/cicd/data/sync/preview-updates.d.ts +11 -0
- package/dist/commands/cicd/data/sync/preview-updates.js +58 -0
- package/dist/commands/cicd/data/sync/preview-updates.js.map +1 -0
- package/dist/commands/cicd/data/template/convert-old.d.ts +9 -0
- package/dist/commands/cicd/data/template/convert-old.js +29 -0
- package/dist/commands/cicd/data/template/convert-old.js.map +1 -0
- package/dist/commands/cicd/data/template/create.d.ts +13 -0
- package/dist/commands/cicd/data/template/create.js +56 -0
- package/dist/commands/cicd/data/template/create.js.map +1 -0
- package/dist/commands/cicd/data/template/delete.d.ts +9 -0
- package/dist/commands/cicd/data/template/delete.js +29 -0
- package/dist/commands/cicd/data/template/delete.js.map +1 -0
- package/dist/commands/cicd/data/template/get-detail.d.ts +10 -0
- package/dist/commands/cicd/data/template/get-detail.js +29 -0
- package/dist/commands/cicd/data/template/get-detail.js.map +1 -0
- package/dist/commands/cicd/data/template/get.d.ts +10 -0
- package/dist/commands/cicd/data/template/get.js +29 -0
- package/dist/commands/cicd/data/template/get.js.map +1 -0
- package/dist/commands/cicd/data/template/list.d.ts +11 -0
- package/dist/commands/cicd/data/template/list.js +44 -0
- package/dist/commands/cicd/data/template/list.js.map +1 -0
- package/dist/commands/cicd/data/template/save-detail.d.ts +13 -0
- package/dist/commands/cicd/data/template/save-detail.js +42 -0
- package/dist/commands/cicd/data/template/save-detail.js.map +1 -0
- package/dist/commands/cicd/function/defaults.d.ts +12 -0
- package/dist/commands/cicd/function/defaults.js +31 -0
- package/dist/commands/cicd/function/defaults.js.map +1 -0
- package/dist/commands/cicd/function/delete.d.ts +11 -0
- package/dist/commands/cicd/function/delete.js +29 -0
- package/dist/commands/cicd/function/delete.js.map +1 -0
- package/dist/commands/cicd/function/get.d.ts +10 -0
- package/dist/commands/cicd/function/get.js +30 -0
- package/dist/commands/cicd/function/get.js.map +1 -0
- package/dist/commands/cicd/function/list.d.ts +10 -0
- package/dist/commands/cicd/function/list.js +36 -0
- package/dist/commands/cicd/function/list.js.map +1 -0
- package/dist/commands/cicd/function/result/get.d.ts +10 -0
- package/dist/commands/cicd/function/result/get.js +30 -0
- package/dist/commands/cicd/function/result/get.js.map +1 -0
- package/dist/commands/cicd/function/result/log/get.d.ts +17 -0
- package/dist/commands/cicd/function/result/log/get.js +41 -0
- package/dist/commands/cicd/function/result/log/get.js.map +1 -0
- package/dist/commands/cicd/function/run-local.d.ts +17 -0
- package/dist/commands/cicd/function/run-local.js +64 -0
- package/dist/commands/cicd/function/run-local.js.map +1 -0
- package/dist/commands/cicd/function/run.d.ts +16 -0
- package/dist/commands/cicd/function/run.js +42 -0
- package/dist/commands/cicd/function/run.js.map +1 -0
- package/dist/commands/cicd/function/upsert.d.ts +27 -0
- package/dist/commands/cicd/function/upsert.js +45 -0
- package/dist/commands/cicd/function/upsert.js.map +1 -0
- package/dist/commands/cicd/promotion/run.d.ts +23 -0
- package/dist/commands/cicd/promotion/run.js +137 -0
- package/dist/commands/cicd/promotion/run.js.map +1 -0
- package/dist/commands/cicd/work/promote.d.ts +25 -0
- package/dist/commands/cicd/work/promote.js +141 -0
- package/dist/commands/cicd/work/promote.js.map +1 -0
- package/dist/lib/cicd-gateway.js +3 -2
- package/dist/lib/cicd-gateway.js.map +1 -1
- package/dist/lib/data-flags.d.ts +14 -0
- package/dist/lib/data-flags.js +61 -0
- package/dist/lib/data-flags.js.map +1 -0
- package/dist/lib/data-types.d.ts +322 -0
- package/dist/lib/data-types.js +176 -0
- package/dist/lib/data-types.js.map +1 -0
- package/dist/lib/function-flags.d.ts +69 -0
- package/dist/lib/function-flags.js +199 -0
- package/dist/lib/function-flags.js.map +1 -0
- package/dist/lib/function-local-run.d.ts +64 -0
- package/dist/lib/function-local-run.js +148 -0
- package/dist/lib/function-local-run.js.map +1 -0
- package/dist/lib/function-types.d.ts +106 -0
- package/dist/lib/function-types.js +171 -0
- package/dist/lib/function-types.js.map +1 -0
- package/dist/lib/mcp/data-tools.d.ts +159 -0
- package/dist/lib/mcp/data-tools.js +547 -0
- package/dist/lib/mcp/data-tools.js.map +1 -0
- package/dist/lib/mcp/tools.d.ts +231 -0
- package/dist/lib/mcp/tools.js +288 -0
- package/dist/lib/mcp/tools.js.map +1 -1
- package/dist/lib/mcp/work-tools.d.ts +29 -0
- package/dist/lib/mcp/work-tools.js +62 -0
- package/dist/lib/mcp/work-tools.js.map +1 -1
- package/dist/lib/promotion-run.d.ts +105 -0
- package/dist/lib/promotion-run.js +481 -0
- package/dist/lib/promotion-run.js.map +1 -0
- package/dist/lib/salesforce-id.d.ts +9 -0
- package/dist/lib/salesforce-id.js +30 -0
- package/dist/lib/salesforce-id.js.map +1 -1
- package/dist/lib/sf-org-context.js +5 -5
- package/dist/lib/sf-org-context.js.map +1 -1
- package/oclif.manifest.json +4818 -2752
- package/package.json +28 -1
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { access } from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { FUNCTION_RUNTIMES, parseParameterAssignments } from './function-types.js';
|
|
5
|
+
/** Default Copado Function image; partners can override when the Copado registry is unavailable. */
|
|
6
|
+
export const DEFAULT_FUNCTION_LOCAL_IMAGE = 'copado-function-core:v1';
|
|
7
|
+
/** Container working directory (matches Copado Function runtime). */
|
|
8
|
+
export const FUNCTION_LOCAL_CONTAINER_APP_DIR = '/app';
|
|
9
|
+
/** Fixed container path for the function script (matches Copado Function runtime). */
|
|
10
|
+
export const FUNCTION_LOCAL_CONTAINER_SCRIPT_PATH = '/tmp/cf_function.sh';
|
|
11
|
+
export function runtimeFromFunctionScriptPath(scriptPath) {
|
|
12
|
+
const normalized = scriptPath.replaceAll('\\', '/').toLowerCase();
|
|
13
|
+
if (normalized.endsWith('.js')) {
|
|
14
|
+
return 'node';
|
|
15
|
+
}
|
|
16
|
+
if (normalized.endsWith('.py')) {
|
|
17
|
+
return 'python';
|
|
18
|
+
}
|
|
19
|
+
return 'bash';
|
|
20
|
+
}
|
|
21
|
+
export function runtimeInterpreter(runtime) {
|
|
22
|
+
if (runtime === 'node') {
|
|
23
|
+
return 'node';
|
|
24
|
+
}
|
|
25
|
+
if (runtime === 'python') {
|
|
26
|
+
return 'python3';
|
|
27
|
+
}
|
|
28
|
+
return 'bash';
|
|
29
|
+
}
|
|
30
|
+
export function resolveLocalFunctionRuntime(scriptPath, runtimeFlag) {
|
|
31
|
+
if (runtimeFlag === undefined) {
|
|
32
|
+
return runtimeFromFunctionScriptPath(scriptPath);
|
|
33
|
+
}
|
|
34
|
+
if (!FUNCTION_RUNTIMES.includes(runtimeFlag)) {
|
|
35
|
+
throw new Error(`Unsupported runtime "${runtimeFlag}". Expected one of: ${FUNCTION_RUNTIMES.join(', ')}.`);
|
|
36
|
+
}
|
|
37
|
+
return runtimeFlag;
|
|
38
|
+
}
|
|
39
|
+
export async function assertLocalFunctionScriptReadable(scriptPath) {
|
|
40
|
+
const resolved = path.resolve(scriptPath);
|
|
41
|
+
try {
|
|
42
|
+
await access(resolved);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
throw new Error(`Function script not found or unreadable: ${resolved}`);
|
|
46
|
+
}
|
|
47
|
+
return resolved;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Host directory bind-mounted at `/app`.
|
|
51
|
+
* Defaults to the current process working directory (workspace root when invoked from a project).
|
|
52
|
+
*/
|
|
53
|
+
export function resolveLocalFunctionHostAppDir(cwdFlag) {
|
|
54
|
+
if (cwdFlag === undefined || cwdFlag.trim().length === 0) {
|
|
55
|
+
return process.cwd();
|
|
56
|
+
}
|
|
57
|
+
return path.resolve(cwdFlag);
|
|
58
|
+
}
|
|
59
|
+
export function buildDockerLocalFunctionRunInvocation(options) {
|
|
60
|
+
const image = options.image.trim();
|
|
61
|
+
if (image.length === 0) {
|
|
62
|
+
throw new Error('Docker image must not be empty. Pass --image to override the default Copado Function image.');
|
|
63
|
+
}
|
|
64
|
+
const args = ['run', '--rm'];
|
|
65
|
+
if (options.platform !== undefined && options.platform.trim().length > 0) {
|
|
66
|
+
args.push('--platform', options.platform.trim());
|
|
67
|
+
}
|
|
68
|
+
for (const [key, value] of Object.entries(options.env ?? {})) {
|
|
69
|
+
args.push('-e', `${key}=${value}`);
|
|
70
|
+
}
|
|
71
|
+
args.push('-v', `${options.hostAppDir}:${FUNCTION_LOCAL_CONTAINER_APP_DIR}`, '-v', `${options.scriptPath}:${FUNCTION_LOCAL_CONTAINER_SCRIPT_PATH}`, '-w', FUNCTION_LOCAL_CONTAINER_APP_DIR, image, runtimeInterpreter(options.runtime), FUNCTION_LOCAL_CONTAINER_SCRIPT_PATH);
|
|
72
|
+
return {
|
|
73
|
+
args,
|
|
74
|
+
command: 'docker',
|
|
75
|
+
display: `docker ${args.join(' ')}`,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export function runLocalFunctionProcess(invocation, options) {
|
|
79
|
+
return new Promise((resolve, reject) => {
|
|
80
|
+
const child = spawn(invocation.command, invocation.args, {
|
|
81
|
+
cwd: options.cwd,
|
|
82
|
+
env: process.env,
|
|
83
|
+
});
|
|
84
|
+
let stdout = '';
|
|
85
|
+
let stderr = '';
|
|
86
|
+
child.stdout.on('data', (chunk) => {
|
|
87
|
+
stdout += String(chunk);
|
|
88
|
+
});
|
|
89
|
+
child.stderr.on('data', (chunk) => {
|
|
90
|
+
stderr += String(chunk);
|
|
91
|
+
});
|
|
92
|
+
child.on('error', (error) => {
|
|
93
|
+
reject(error);
|
|
94
|
+
});
|
|
95
|
+
child.on('close', (code) => {
|
|
96
|
+
resolve({ exitCode: code, stderr, stdout });
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
export async function executeLocalFunctionRun(options) {
|
|
101
|
+
const script = await assertLocalFunctionScriptReadable(options.script);
|
|
102
|
+
const runtime = resolveLocalFunctionRuntime(script, options.runtime);
|
|
103
|
+
const hostAppDir = resolveLocalFunctionHostAppDir(options.cwd);
|
|
104
|
+
const image = options.image === undefined || options.image.trim().length === 0
|
|
105
|
+
? DEFAULT_FUNCTION_LOCAL_IMAGE
|
|
106
|
+
: options.image.trim();
|
|
107
|
+
const env = parseParameterAssignments(options.parameter);
|
|
108
|
+
const invocation = buildDockerLocalFunctionRunInvocation({
|
|
109
|
+
hostAppDir,
|
|
110
|
+
image,
|
|
111
|
+
runtime,
|
|
112
|
+
scriptPath: script,
|
|
113
|
+
...(env === undefined ? {} : { env }),
|
|
114
|
+
...(options.platform === undefined ? {} : { platform: options.platform }),
|
|
115
|
+
});
|
|
116
|
+
const runProcess = options.runProcess ?? runLocalFunctionProcess;
|
|
117
|
+
const processResult = await runProcess(invocation, { cwd: hostAppDir });
|
|
118
|
+
return {
|
|
119
|
+
args: invocation.args,
|
|
120
|
+
command: invocation.command,
|
|
121
|
+
cwd: hostAppDir,
|
|
122
|
+
exitCode: processResult.exitCode,
|
|
123
|
+
image,
|
|
124
|
+
runtime,
|
|
125
|
+
script,
|
|
126
|
+
stderr: processResult.stderr,
|
|
127
|
+
stdout: processResult.stdout,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
export function formatLocalFunctionRunResult(result) {
|
|
131
|
+
const lines = [
|
|
132
|
+
`Script: ${result.script}`,
|
|
133
|
+
`Runtime: ${result.runtime}`,
|
|
134
|
+
`Image: ${result.image}`,
|
|
135
|
+
`Command: ${result.command} ${result.args.join(' ')}`,
|
|
136
|
+
`App mount (/app): ${result.cwd}`,
|
|
137
|
+
`Container script: ${FUNCTION_LOCAL_CONTAINER_SCRIPT_PATH}`,
|
|
138
|
+
`Exit code: ${result.exitCode ?? 'null'}`,
|
|
139
|
+
];
|
|
140
|
+
if (result.stdout.trim().length > 0) {
|
|
141
|
+
lines.push('', 'stdout:', result.stdout.endsWith('\n') ? result.stdout.slice(0, -1) : result.stdout);
|
|
142
|
+
}
|
|
143
|
+
if (result.stderr.trim().length > 0) {
|
|
144
|
+
lines.push('', 'stderr:', result.stderr.endsWith('\n') ? result.stderr.slice(0, -1) : result.stderr);
|
|
145
|
+
}
|
|
146
|
+
return lines.join('\n');
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=function-local-run.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-local-run.js","sourceRoot":"","sources":["../../src/lib/function-local-run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,oBAAoB,CAAA;AACxC,OAAO,EAAC,MAAM,EAAC,MAAM,kBAAkB,CAAA;AACvC,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAC,iBAAiB,EAAwB,yBAAyB,EAAC,MAAM,qBAAqB,CAAA;AAEtG,oGAAoG;AACpG,MAAM,CAAC,MAAM,4BAA4B,GAAG,yBAAyB,CAAA;AAErE,qEAAqE;AACrE,MAAM,CAAC,MAAM,gCAAgC,GAAG,MAAM,CAAA;AAEtD,sFAAsF;AACtF,MAAM,CAAC,MAAM,oCAAoC,GAAG,qBAAqB,CAAA;AA2BzE,MA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106 @@
|
|
|
1
|
+
export declare const FUNCTION_LIST_TYPES: readonly ["custom", "all"];
|
|
2
|
+
export type FunctionListType = (typeof FUNCTION_LIST_TYPES)[number];
|
|
3
|
+
export declare const FUNCTION_RUNTIMES: readonly ["bash", "node", "python"];
|
|
4
|
+
export type FunctionRuntime = (typeof FUNCTION_RUNTIMES)[number];
|
|
5
|
+
export declare const FUNCTION_EXTENSIONS: readonly ["sh", "js", "py"];
|
|
6
|
+
export type FunctionExtension = (typeof FUNCTION_EXTENSIONS)[number];
|
|
7
|
+
export declare const FUNCTION_RUNTIME_EXTENSION: Record<FunctionRuntime, FunctionExtension>;
|
|
8
|
+
export type FunctionParameter = {
|
|
9
|
+
defaultValue?: string;
|
|
10
|
+
name: string;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type FunctionScript = {
|
|
14
|
+
content?: string;
|
|
15
|
+
extension?: FunctionExtension;
|
|
16
|
+
runtime?: FunctionRuntime;
|
|
17
|
+
};
|
|
18
|
+
export type CopadoFunction = {
|
|
19
|
+
apexClass?: null | string;
|
|
20
|
+
apiName: string;
|
|
21
|
+
callback?: null | string;
|
|
22
|
+
description?: null | string;
|
|
23
|
+
flowHandler?: null | string;
|
|
24
|
+
id?: null | string;
|
|
25
|
+
imageName?: null | string;
|
|
26
|
+
name: string;
|
|
27
|
+
options?: null | Record<string, unknown>[];
|
|
28
|
+
ownerName?: null | string;
|
|
29
|
+
parameters?: FunctionParameter[];
|
|
30
|
+
script?: FunctionScript | null;
|
|
31
|
+
size?: null | string;
|
|
32
|
+
timeout?: null | number;
|
|
33
|
+
type?: null | string;
|
|
34
|
+
version?: null | string;
|
|
35
|
+
};
|
|
36
|
+
export type FunctionUpsertPayload = {
|
|
37
|
+
apexClass?: null | string;
|
|
38
|
+
apiName: string;
|
|
39
|
+
callback?: null | string;
|
|
40
|
+
description?: null | string;
|
|
41
|
+
flowHandler?: null | string;
|
|
42
|
+
imageName?: string;
|
|
43
|
+
name: string;
|
|
44
|
+
parameters?: FunctionParameter[];
|
|
45
|
+
script: FunctionScript;
|
|
46
|
+
size?: string;
|
|
47
|
+
timeout?: null | number;
|
|
48
|
+
type?: string;
|
|
49
|
+
version?: string;
|
|
50
|
+
};
|
|
51
|
+
export type FunctionUpsertInput = Omit<Partial<FunctionUpsertPayload>, 'script'> & {
|
|
52
|
+
script?: Partial<FunctionScript>;
|
|
53
|
+
};
|
|
54
|
+
export type FunctionCreateDefaultsPayload = {
|
|
55
|
+
imageName?: string;
|
|
56
|
+
name: string;
|
|
57
|
+
runtime?: FunctionRuntime;
|
|
58
|
+
};
|
|
59
|
+
export type FunctionRunPayload = {
|
|
60
|
+
contextId?: null | string;
|
|
61
|
+
deployFirst?: boolean;
|
|
62
|
+
function?: FunctionUpsertPayload | null;
|
|
63
|
+
parameters?: null | Record<string, string>;
|
|
64
|
+
showValidationErrors?: boolean;
|
|
65
|
+
};
|
|
66
|
+
export type FunctionRunResult = {
|
|
67
|
+
apiName: string;
|
|
68
|
+
resultId: string;
|
|
69
|
+
status: string;
|
|
70
|
+
};
|
|
71
|
+
export type FunctionResultStatus = {
|
|
72
|
+
messages?: null | string[];
|
|
73
|
+
resultData?: unknown;
|
|
74
|
+
resultId: string;
|
|
75
|
+
status: string;
|
|
76
|
+
};
|
|
77
|
+
export type FunctionsListResponse = CopadoFunction[] | {
|
|
78
|
+
data?: CopadoFunction[];
|
|
79
|
+
};
|
|
80
|
+
export type FunctionResponse = CopadoFunction | {
|
|
81
|
+
data?: CopadoFunction;
|
|
82
|
+
};
|
|
83
|
+
export type FunctionRunResponse = FunctionRunResult | {
|
|
84
|
+
data?: FunctionRunResult;
|
|
85
|
+
};
|
|
86
|
+
export type FunctionResultStatusResponse = FunctionResultStatus | {
|
|
87
|
+
data?: FunctionResultStatus;
|
|
88
|
+
};
|
|
89
|
+
export type FunctionListFilters = {
|
|
90
|
+
type?: FunctionListType;
|
|
91
|
+
};
|
|
92
|
+
export declare function functionsEndpoint(filters?: FunctionListFilters): string;
|
|
93
|
+
export declare function functionEndpoint(apiName: string): string;
|
|
94
|
+
export declare function functionRunEndpoint(apiName: string): string;
|
|
95
|
+
export declare function functionResultEndpoint(resultId: string): string;
|
|
96
|
+
export declare function functionResultLogEndpoint(resultId: string, fileType?: string): string;
|
|
97
|
+
export declare function normalizeFunctionUpsertPayload(apiNameValue: string, input: FunctionUpsertInput): FunctionUpsertPayload;
|
|
98
|
+
export declare function normalizeFunctionsList(response: FunctionsListResponse): CopadoFunction[];
|
|
99
|
+
export declare function normalizeFunction(response: FunctionResponse): CopadoFunction;
|
|
100
|
+
export declare function normalizeFunctionRunResult(response: FunctionRunResponse): FunctionRunResult;
|
|
101
|
+
export declare function normalizeFunctionResultStatus(response: FunctionResultStatusResponse): FunctionResultStatus;
|
|
102
|
+
export declare function formatFunctionTable(functions: CopadoFunction[]): string;
|
|
103
|
+
export declare function formatFunctionDetail(fn: CopadoFunction): string;
|
|
104
|
+
export declare function formatFunctionRunResult(result: FunctionRunResult): string;
|
|
105
|
+
export declare function formatFunctionResultStatus(result: FunctionResultStatus): string;
|
|
106
|
+
export declare function parseParameterAssignments(values: string[] | undefined): Record<string, string> | undefined;
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { cellValue, table } from './format.js';
|
|
2
|
+
export const FUNCTION_LIST_TYPES = ['custom', 'all'];
|
|
3
|
+
export const FUNCTION_RUNTIMES = ['bash', 'node', 'python'];
|
|
4
|
+
export const FUNCTION_EXTENSIONS = ['sh', 'js', 'py'];
|
|
5
|
+
export const FUNCTION_RUNTIME_EXTENSION = {
|
|
6
|
+
bash: 'sh',
|
|
7
|
+
node: 'js',
|
|
8
|
+
python: 'py',
|
|
9
|
+
};
|
|
10
|
+
export function functionsEndpoint(filters = {}) {
|
|
11
|
+
const params = new URLSearchParams();
|
|
12
|
+
if (filters.type !== undefined) {
|
|
13
|
+
params.set('type', filters.type);
|
|
14
|
+
}
|
|
15
|
+
const query = params.toString();
|
|
16
|
+
return query.length > 0 ? `/functions?${query}` : '/functions';
|
|
17
|
+
}
|
|
18
|
+
export function functionEndpoint(apiName) {
|
|
19
|
+
return `/functions/${encodeURIComponent(apiName)}`;
|
|
20
|
+
}
|
|
21
|
+
export function functionRunEndpoint(apiName) {
|
|
22
|
+
return `${functionEndpoint(apiName)}/run`;
|
|
23
|
+
}
|
|
24
|
+
export function functionResultEndpoint(resultId) {
|
|
25
|
+
return `/functions/results/${encodeURIComponent(resultId)}`;
|
|
26
|
+
}
|
|
27
|
+
export function functionResultLogEndpoint(resultId, fileType) {
|
|
28
|
+
const base = `${functionResultEndpoint(resultId)}/log-file`;
|
|
29
|
+
if (fileType === undefined || fileType.trim().length === 0) {
|
|
30
|
+
return base;
|
|
31
|
+
}
|
|
32
|
+
const params = new URLSearchParams({ type: fileType.trim() });
|
|
33
|
+
return `${base}?${params.toString()}`;
|
|
34
|
+
}
|
|
35
|
+
export function normalizeFunctionUpsertPayload(apiNameValue, input) {
|
|
36
|
+
const apiName = apiNameValue.trim();
|
|
37
|
+
if (apiName.length === 0) {
|
|
38
|
+
throw new Error('Function API name is required.');
|
|
39
|
+
}
|
|
40
|
+
if (input === null || typeof input !== 'object' || Array.isArray(input)) {
|
|
41
|
+
throw new TypeError('Function upsert payload must be a JSON object.');
|
|
42
|
+
}
|
|
43
|
+
if (input.script === null || typeof input.script !== 'object' || Array.isArray(input.script)) {
|
|
44
|
+
throw new TypeError('Function upsert payload must include a script object.');
|
|
45
|
+
}
|
|
46
|
+
if (typeof input.script.content !== 'string') {
|
|
47
|
+
throw new TypeError('Function upsert payload script must include string content.');
|
|
48
|
+
}
|
|
49
|
+
const runtime = input.script.runtime ?? 'bash';
|
|
50
|
+
if (!FUNCTION_RUNTIMES.includes(runtime)) {
|
|
51
|
+
throw new Error(`Unsupported function runtime "${runtime}".`);
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
...input,
|
|
55
|
+
apiName,
|
|
56
|
+
imageName: input.imageName ?? 'copado-function-core:v1',
|
|
57
|
+
name: input.name?.trim() || apiName,
|
|
58
|
+
script: {
|
|
59
|
+
content: input.script.content,
|
|
60
|
+
extension: input.script.extension ?? FUNCTION_RUNTIME_EXTENSION[runtime],
|
|
61
|
+
runtime,
|
|
62
|
+
},
|
|
63
|
+
size: input.size ?? 'S',
|
|
64
|
+
type: input.type ?? 'Custom',
|
|
65
|
+
version: input.version ?? '1',
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export function normalizeFunctionsList(response) {
|
|
69
|
+
if (Array.isArray(response)) {
|
|
70
|
+
return response;
|
|
71
|
+
}
|
|
72
|
+
if (response.data !== undefined && Array.isArray(response.data)) {
|
|
73
|
+
return response.data;
|
|
74
|
+
}
|
|
75
|
+
return [];
|
|
76
|
+
}
|
|
77
|
+
export function normalizeFunction(response) {
|
|
78
|
+
if ('data' in response && response.data !== undefined && typeof response.data === 'object' && !Array.isArray(response.data)) {
|
|
79
|
+
return response.data;
|
|
80
|
+
}
|
|
81
|
+
return response;
|
|
82
|
+
}
|
|
83
|
+
export function normalizeFunctionRunResult(response) {
|
|
84
|
+
if ('data' in response && response.data !== undefined && typeof response.data === 'object' && !Array.isArray(response.data)) {
|
|
85
|
+
return response.data;
|
|
86
|
+
}
|
|
87
|
+
return response;
|
|
88
|
+
}
|
|
89
|
+
export function normalizeFunctionResultStatus(response) {
|
|
90
|
+
if ('data' in response &&
|
|
91
|
+
response.data !== undefined &&
|
|
92
|
+
typeof response.data === 'object' &&
|
|
93
|
+
!Array.isArray(response.data)) {
|
|
94
|
+
return response.data;
|
|
95
|
+
}
|
|
96
|
+
return response;
|
|
97
|
+
}
|
|
98
|
+
export function formatFunctionTable(functions) {
|
|
99
|
+
return table([
|
|
100
|
+
{ alias: 'API NAME', value: 'apiName' },
|
|
101
|
+
{ alias: 'NAME', value: 'name' },
|
|
102
|
+
{ alias: 'TYPE', value: 'type' },
|
|
103
|
+
{ alias: 'RUNTIME', value: 'runtime' },
|
|
104
|
+
{ alias: 'SIZE', value: 'size' },
|
|
105
|
+
{ alias: 'OWNER', value: 'ownerName' },
|
|
106
|
+
], functions.map((fn) => ({
|
|
107
|
+
apiName: cellValue(fn.apiName),
|
|
108
|
+
name: cellValue(fn.name),
|
|
109
|
+
ownerName: cellValue(fn.ownerName),
|
|
110
|
+
runtime: cellValue(fn.script?.runtime),
|
|
111
|
+
size: cellValue(fn.size),
|
|
112
|
+
type: cellValue(fn.type),
|
|
113
|
+
})));
|
|
114
|
+
}
|
|
115
|
+
export function formatFunctionDetail(fn) {
|
|
116
|
+
return [
|
|
117
|
+
`ID: ${cellValue(fn.id)}`,
|
|
118
|
+
`Name: ${cellValue(fn.name)}`,
|
|
119
|
+
`API Name: ${cellValue(fn.apiName)}`,
|
|
120
|
+
`Type: ${cellValue(fn.type)}`,
|
|
121
|
+
`Image: ${cellValue(fn.imageName)}`,
|
|
122
|
+
`Size: ${cellValue(fn.size)}`,
|
|
123
|
+
`Version: ${cellValue(fn.version)}`,
|
|
124
|
+
`Timeout: ${cellValue(fn.timeout)}`,
|
|
125
|
+
`Owner: ${cellValue(fn.ownerName)}`,
|
|
126
|
+
`Description: ${cellValue(fn.description)}`,
|
|
127
|
+
`Runtime: ${cellValue(fn.script?.runtime)}`,
|
|
128
|
+
`Extension: ${cellValue(fn.script?.extension)}`,
|
|
129
|
+
`Parameters: ${cellValue(fn.parameters?.length)}`,
|
|
130
|
+
`Callback: ${cellValue(fn.callback)}`,
|
|
131
|
+
`Apex Class: ${cellValue(fn.apexClass)}`,
|
|
132
|
+
`Flow Handler: ${cellValue(fn.flowHandler)}`,
|
|
133
|
+
].join('\n');
|
|
134
|
+
}
|
|
135
|
+
export function formatFunctionRunResult(result) {
|
|
136
|
+
return [
|
|
137
|
+
`API Name: ${cellValue(result.apiName)}`,
|
|
138
|
+
`Result ID: ${cellValue(result.resultId)}`,
|
|
139
|
+
`Status: ${cellValue(result.status)}`,
|
|
140
|
+
].join('\n');
|
|
141
|
+
}
|
|
142
|
+
export function formatFunctionResultStatus(result) {
|
|
143
|
+
const lines = [
|
|
144
|
+
`Result ID: ${cellValue(result.resultId)}`,
|
|
145
|
+
`Status: ${cellValue(result.status)}`,
|
|
146
|
+
];
|
|
147
|
+
if (result.messages !== undefined && result.messages !== null && result.messages.length > 0) {
|
|
148
|
+
lines.push(`Messages: ${result.messages.join('; ')}`);
|
|
149
|
+
}
|
|
150
|
+
return lines.join('\n');
|
|
151
|
+
}
|
|
152
|
+
export function parseParameterAssignments(values) {
|
|
153
|
+
if (values === undefined || values.length === 0) {
|
|
154
|
+
return undefined;
|
|
155
|
+
}
|
|
156
|
+
const parameters = {};
|
|
157
|
+
for (const value of values) {
|
|
158
|
+
const separator = value.indexOf('=');
|
|
159
|
+
if (separator <= 0) {
|
|
160
|
+
throw new Error(`Invalid --parameter value "${value}". Expected key=value.`);
|
|
161
|
+
}
|
|
162
|
+
const key = value.slice(0, separator).trim();
|
|
163
|
+
const paramValue = value.slice(separator + 1);
|
|
164
|
+
if (key.length === 0) {
|
|
165
|
+
throw new Error(`Invalid --parameter value "${value}". Expected key=value.`);
|
|
166
|
+
}
|
|
167
|
+
parameters[key] = paramValue;
|
|
168
|
+
}
|
|
169
|
+
return parameters;
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=function-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"function-types.js","sourceRoot":"","sources":["../../src/lib/function-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAE5C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAU,CAAA;AAG7D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAU,CAAA;AAGpE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,CAAA;AAG9D,MAAM,CAAC,MAAM,0BA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CAAC;QAED,UAAU,CAAC,GAAG,CAAC,GAAG,UAAU,CAAA;IAC9B,CAAC;IAED,OAAO,UAAU,CAAA;AACnB,CAAC"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { type AdvancedFilter, type AdvancedFilterRequest, type DataCommitApiRequest, type DataCommitResponse, type DataRecord, type DataRecordRequest, type DataRecordSearchResult, type DatasetFileContentResult, type DatasetFileMetadata, type DataTemplate, type DataTemplateSyncEntryRequest, type DataTemplateSyncResponseEntry, type DataTemplateUpdatePreview, type DataTemplateUpdatePreviewRequest, type MatchDataRecordRequest, type RecordMatchingFormulaRequest, type RecordMatchingFormulaVm, type SObjectFields, type SObjectRelationships, type UserStoryDataCommitRecord, type V2Template, type V2TemplateDetail } from '../data-types.js';
|
|
3
|
+
declare function dataTemplateList(args?: {
|
|
4
|
+
active?: boolean;
|
|
5
|
+
fetchRelated?: boolean;
|
|
6
|
+
}): Promise<{
|
|
7
|
+
result: DataTemplate[];
|
|
8
|
+
}>;
|
|
9
|
+
declare function dataTemplateGet(args: {
|
|
10
|
+
id: string;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
result: Record<string, V2TemplateDetail>;
|
|
13
|
+
}>;
|
|
14
|
+
declare function dataTemplateGetDetail(args: {
|
|
15
|
+
id: string;
|
|
16
|
+
}): Promise<{
|
|
17
|
+
result: V2Template;
|
|
18
|
+
}>;
|
|
19
|
+
declare function dataTemplateCreate(args: {
|
|
20
|
+
apiName: string;
|
|
21
|
+
credentialId: string;
|
|
22
|
+
mainObjectApiName: string;
|
|
23
|
+
mainObjectLabel: string;
|
|
24
|
+
templateName: string;
|
|
25
|
+
}): Promise<{
|
|
26
|
+
result: string;
|
|
27
|
+
}>;
|
|
28
|
+
declare function dataTemplateSaveDetail(args: {
|
|
29
|
+
body: V2Template;
|
|
30
|
+
id: string;
|
|
31
|
+
}): Promise<{
|
|
32
|
+
result: boolean;
|
|
33
|
+
}>;
|
|
34
|
+
declare function dataTemplateDelete(args: {
|
|
35
|
+
id: string;
|
|
36
|
+
}): Promise<{
|
|
37
|
+
result: boolean;
|
|
38
|
+
}>;
|
|
39
|
+
declare function dataTemplateConvertOld(args: {
|
|
40
|
+
id: string;
|
|
41
|
+
}): Promise<{
|
|
42
|
+
result: string;
|
|
43
|
+
}>;
|
|
44
|
+
declare function dataRecordsSearch(args: DataRecordRequest): Promise<{
|
|
45
|
+
result: DataRecordSearchResult;
|
|
46
|
+
}>;
|
|
47
|
+
declare function dataRecordsMatch(args: MatchDataRecordRequest): Promise<{
|
|
48
|
+
result: DataRecord | null;
|
|
49
|
+
}>;
|
|
50
|
+
declare function dataCommitCreate(args: DataCommitApiRequest): Promise<{
|
|
51
|
+
result: DataCommitResponse;
|
|
52
|
+
}>;
|
|
53
|
+
declare function dataCommitList(args: {
|
|
54
|
+
userStoryId: string;
|
|
55
|
+
}): Promise<{
|
|
56
|
+
result: UserStoryDataCommitRecord[];
|
|
57
|
+
}>;
|
|
58
|
+
declare function dataDatasetFileList(args: {
|
|
59
|
+
userStoryDataCommitId: string;
|
|
60
|
+
}): Promise<{
|
|
61
|
+
result: DatasetFileMetadata[];
|
|
62
|
+
}>;
|
|
63
|
+
declare function dataDatasetFileContent(args: {
|
|
64
|
+
contentVersionId: string;
|
|
65
|
+
}): Promise<{
|
|
66
|
+
result: DatasetFileContentResult[];
|
|
67
|
+
}>;
|
|
68
|
+
declare function dataFilterList(args: {
|
|
69
|
+
dataTemplateId: string;
|
|
70
|
+
}): Promise<{
|
|
71
|
+
result: AdvancedFilter[];
|
|
72
|
+
}>;
|
|
73
|
+
declare function dataFilterAdd(args: {
|
|
74
|
+
body: AdvancedFilterRequest;
|
|
75
|
+
dataTemplateId: string;
|
|
76
|
+
}): Promise<{
|
|
77
|
+
result: string;
|
|
78
|
+
}>;
|
|
79
|
+
declare function dataFilterUpdate(args: {
|
|
80
|
+
body: AdvancedFilterRequest;
|
|
81
|
+
dataTemplateId: string;
|
|
82
|
+
uuid: string;
|
|
83
|
+
}): Promise<{
|
|
84
|
+
result: string;
|
|
85
|
+
}>;
|
|
86
|
+
declare function dataFilterDelete(args: {
|
|
87
|
+
dataTemplateId: string;
|
|
88
|
+
uuid: string;
|
|
89
|
+
}): Promise<{
|
|
90
|
+
result: string;
|
|
91
|
+
}>;
|
|
92
|
+
declare function dataFormulaList(args: {
|
|
93
|
+
objectApiName: string;
|
|
94
|
+
}): Promise<{
|
|
95
|
+
result: RecordMatchingFormulaVm[];
|
|
96
|
+
}>;
|
|
97
|
+
declare function dataFormulaCreate(args: {
|
|
98
|
+
dataTemplateId: string;
|
|
99
|
+
fields: string[];
|
|
100
|
+
hashFormula?: boolean;
|
|
101
|
+
name: string;
|
|
102
|
+
objectApiName: string;
|
|
103
|
+
}): Promise<{
|
|
104
|
+
result: RecordMatchingFormulaVm;
|
|
105
|
+
}>;
|
|
106
|
+
declare function dataFormulaUpdate(args: {
|
|
107
|
+
body: RecordMatchingFormulaRequest;
|
|
108
|
+
formulaId: string;
|
|
109
|
+
}): Promise<{
|
|
110
|
+
result: RecordMatchingFormulaVm;
|
|
111
|
+
}>;
|
|
112
|
+
declare function dataSobjectFields(args: {
|
|
113
|
+
credentialId: string;
|
|
114
|
+
sobjectApiName: string;
|
|
115
|
+
}): Promise<{
|
|
116
|
+
result: SObjectFields;
|
|
117
|
+
}>;
|
|
118
|
+
declare function dataSobjectRelationships(args: {
|
|
119
|
+
credentialId: string;
|
|
120
|
+
sobjectApiName: string;
|
|
121
|
+
}): Promise<{
|
|
122
|
+
result: SObjectRelationships;
|
|
123
|
+
}>;
|
|
124
|
+
declare function dataSyncApply(args: {
|
|
125
|
+
entries: DataTemplateSyncEntryRequest[];
|
|
126
|
+
}): Promise<{
|
|
127
|
+
result: DataTemplateSyncResponseEntry[];
|
|
128
|
+
}>;
|
|
129
|
+
declare function dataSyncPreviewUpdates(args: DataTemplateUpdatePreviewRequest): Promise<{
|
|
130
|
+
result: DataTemplateUpdatePreview[];
|
|
131
|
+
}>;
|
|
132
|
+
export declare const agentiaMcpDataToolHandlers: {
|
|
133
|
+
dataCommitCreate: typeof dataCommitCreate;
|
|
134
|
+
dataCommitList: typeof dataCommitList;
|
|
135
|
+
dataDatasetFileContent: typeof dataDatasetFileContent;
|
|
136
|
+
dataDatasetFileList: typeof dataDatasetFileList;
|
|
137
|
+
dataFilterAdd: typeof dataFilterAdd;
|
|
138
|
+
dataFilterDelete: typeof dataFilterDelete;
|
|
139
|
+
dataFilterList: typeof dataFilterList;
|
|
140
|
+
dataFilterUpdate: typeof dataFilterUpdate;
|
|
141
|
+
dataFormulaCreate: typeof dataFormulaCreate;
|
|
142
|
+
dataFormulaList: typeof dataFormulaList;
|
|
143
|
+
dataFormulaUpdate: typeof dataFormulaUpdate;
|
|
144
|
+
dataRecordsMatch: typeof dataRecordsMatch;
|
|
145
|
+
dataRecordsSearch: typeof dataRecordsSearch;
|
|
146
|
+
dataSobjectFields: typeof dataSobjectFields;
|
|
147
|
+
dataSobjectRelationships: typeof dataSobjectRelationships;
|
|
148
|
+
dataSyncApply: typeof dataSyncApply;
|
|
149
|
+
dataSyncPreviewUpdates: typeof dataSyncPreviewUpdates;
|
|
150
|
+
dataTemplateConvertOld: typeof dataTemplateConvertOld;
|
|
151
|
+
dataTemplateCreate: typeof dataTemplateCreate;
|
|
152
|
+
dataTemplateDelete: typeof dataTemplateDelete;
|
|
153
|
+
dataTemplateGet: typeof dataTemplateGet;
|
|
154
|
+
dataTemplateGetDetail: typeof dataTemplateGetDetail;
|
|
155
|
+
dataTemplateList: typeof dataTemplateList;
|
|
156
|
+
dataTemplateSaveDetail: typeof dataTemplateSaveDetail;
|
|
157
|
+
};
|
|
158
|
+
export declare function registerAgentiaMcpDataTools(server: McpServer): void;
|
|
159
|
+
export {};
|