@acquis-consulting/asm 1.0.5
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 +0 -0
- package/dist/apps/gitDiffReview/gitDiffParser.d.ts +6 -0
- package/dist/apps/gitDiffReview/gitDiffParser.js +1 -0
- package/dist/apps/gitDiffReview/packageXml.d.ts +8 -0
- package/dist/apps/gitDiffReview/packageXml.js +1 -0
- package/dist/apps/gitDiffReview/tools.d.ts +42 -0
- package/dist/apps/gitDiffReview/tools.js +1 -0
- package/dist/apps/gitDiffReview/types.d.ts +19 -0
- package/dist/apps/gitDiffReview/types.js +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +193 -0
- package/dist/index.js.map +1 -0
- package/dist/metadata-diff.html +98 -0
- package/dist/tools/aggregateQuery.d.ts +85 -0
- package/dist/tools/aggregateQuery.js +110 -0
- package/dist/tools/aggregateQuery.js.map +1 -0
- package/dist/tools/bulkExportAbort.d.ts +37 -0
- package/dist/tools/bulkExportAbort.js +44 -0
- package/dist/tools/bulkExportAbort.js.map +1 -0
- package/dist/tools/bulkExportResults.d.ts +51 -0
- package/dist/tools/bulkExportResults.js +76 -0
- package/dist/tools/bulkExportResults.js.map +1 -0
- package/dist/tools/bulkExportStart.d.ts +61 -0
- package/dist/tools/bulkExportStart.js +68 -0
- package/dist/tools/bulkExportStart.js.map +1 -0
- package/dist/tools/bulkExportStatus.d.ts +37 -0
- package/dist/tools/bulkExportStatus.js +54 -0
- package/dist/tools/bulkExportStatus.js.map +1 -0
- package/dist/tools/crossObjectSearch.d.ts +155 -0
- package/dist/tools/crossObjectSearch.js +145 -0
- package/dist/tools/crossObjectSearch.js.map +1 -0
- package/dist/tools/debugLogs.d.ts +106 -0
- package/dist/tools/debugLogs.js +189 -0
- package/dist/tools/debugLogs.js.map +1 -0
- package/dist/tools/deployMetadata.d.ts +60 -0
- package/dist/tools/deployMetadata.js +106 -0
- package/dist/tools/deployMetadata.js.map +1 -0
- package/dist/tools/deployPackage.d.ts +49 -0
- package/dist/tools/deployPackage.js +1 -0
- package/dist/tools/dml.d.ts +70 -0
- package/dist/tools/dml.js +105 -0
- package/dist/tools/dml.js.map +1 -0
- package/dist/tools/dmlDelete.d.ts +51 -0
- package/dist/tools/dmlDelete.js +71 -0
- package/dist/tools/dmlDelete.js.map +1 -0
- package/dist/tools/executeAnonymous.d.ts +63 -0
- package/dist/tools/executeAnonymous.js +77 -0
- package/dist/tools/executeAnonymous.js.map +1 -0
- package/dist/tools/fieldManagement.d.ts +222 -0
- package/dist/tools/fieldManagement.js +234 -0
- package/dist/tools/fieldManagement.js.map +1 -0
- package/dist/tools/fieldPermissions.d.ts +94 -0
- package/dist/tools/fieldPermissions.js +191 -0
- package/dist/tools/fieldPermissions.js.map +1 -0
- package/dist/tools/getDependencies.d.ts +58 -0
- package/dist/tools/getDependencies.js +105 -0
- package/dist/tools/getDependencies.js.map +1 -0
- package/dist/tools/listUserPermissions.d.ts +36 -0
- package/dist/tools/listUserPermissions.js +59 -0
- package/dist/tools/listUserPermissions.js.map +1 -0
- package/dist/tools/metadataDescribe.d.ts +37 -0
- package/dist/tools/metadataDescribe.js +35 -0
- package/dist/tools/metadataDescribe.js.map +1 -0
- package/dist/tools/metadataDiff.d.ts +66 -0
- package/dist/tools/metadataDiff.js +215 -0
- package/dist/tools/metadataDiff.js.map +1 -0
- package/dist/tools/metadataDiffFileDetail.d.ts +44 -0
- package/dist/tools/metadataDiffFileDetail.js +84 -0
- package/dist/tools/metadataDiffFileDetail.js.map +1 -0
- package/dist/tools/metadataDiffFiles.d.ts +37 -0
- package/dist/tools/metadataDiffFiles.js +72 -0
- package/dist/tools/metadataDiffFiles.js.map +1 -0
- package/dist/tools/metadataDiffGeneratePackage.d.ts +73 -0
- package/dist/tools/metadataDiffGeneratePackage.js +122 -0
- package/dist/tools/metadataDiffGeneratePackage.js.map +1 -0
- package/dist/tools/metadataImport.d.ts +63 -0
- package/dist/tools/metadataImport.js +122 -0
- package/dist/tools/metadataImport.js.map +1 -0
- package/dist/tools/metadataJobStatus.d.ts +44 -0
- package/dist/tools/metadataJobStatus.js +101 -0
- package/dist/tools/metadataJobStatus.js.map +1 -0
- package/dist/tools/metadataList.d.ts +44 -0
- package/dist/tools/metadataList.js +49 -0
- package/dist/tools/metadataList.js.map +1 -0
- package/dist/tools/metadataRead.d.ts +47 -0
- package/dist/tools/metadataRead.js +52 -0
- package/dist/tools/metadataRead.js.map +1 -0
- package/dist/tools/metadataTypeSchema.d.ts +44 -0
- package/dist/tools/metadataTypeSchema.js +101 -0
- package/dist/tools/metadataTypeSchema.js.map +1 -0
- package/dist/tools/metadataWsdl.d.ts +19 -0
- package/dist/tools/metadataWsdl.js +1 -0
- package/dist/tools/objectManagement.d.ts +107 -0
- package/dist/tools/objectManagement.js +123 -0
- package/dist/tools/objectManagement.js.map +1 -0
- package/dist/tools/objectPermissions.d.ts +101 -0
- package/dist/tools/objectPermissions.js +157 -0
- package/dist/tools/objectPermissions.js.map +1 -0
- package/dist/tools/objectSchema.d.ts +37 -0
- package/dist/tools/objectSchema.js +66 -0
- package/dist/tools/objectSchema.js.map +1 -0
- package/dist/tools/objectSearch.d.ts +37 -0
- package/dist/tools/objectSearch.js +44 -0
- package/dist/tools/objectSearch.js.map +1 -0
- package/dist/tools/packageStatus.d.ts +24 -0
- package/dist/tools/packageStatus.js +1 -0
- package/dist/tools/permissionSetAssignment.d.ts +39 -0
- package/dist/tools/permissionSetAssignment.js +1 -0
- package/dist/tools/readApexClasses.d.ts +50 -0
- package/dist/tools/readApexClasses.js +83 -0
- package/dist/tools/readApexClasses.js.map +1 -0
- package/dist/tools/readApexTriggers.d.ts +50 -0
- package/dist/tools/readApexTriggers.js +82 -0
- package/dist/tools/readApexTriggers.js.map +1 -0
- package/dist/tools/recordPicker.d.ts +48 -0
- package/dist/tools/recordPicker.js +1 -0
- package/dist/tools/recordQuery.d.ts +68 -0
- package/dist/tools/recordQuery.js +131 -0
- package/dist/tools/recordQuery.js.map +1 -0
- package/dist/tools/retrieveJobStatus.d.ts +51 -0
- package/dist/tools/retrieveJobStatus.js +192 -0
- package/dist/tools/retrieveJobStatus.js.map +1 -0
- package/dist/tools/retrieveMetadata.d.ts +79 -0
- package/dist/tools/retrieveMetadata.js +225 -0
- package/dist/tools/retrieveMetadata.js.map +1 -0
- package/dist/tools/retrievePackage.d.ts +37 -0
- package/dist/tools/retrievePackage.js +1 -0
- package/dist/tools/salesforceLogin.d.ts +36 -0
- package/dist/tools/salesforceLogin.js +75 -0
- package/dist/tools/salesforceLogin.js.map +1 -0
- package/dist/tools/selectOrg.d.ts +25 -0
- package/dist/tools/selectOrg.js +91 -0
- package/dist/tools/selectOrg.js.map +1 -0
- package/dist/tools/toolingQuery.d.ts +37 -0
- package/dist/tools/toolingQuery.js +54 -0
- package/dist/tools/toolingQuery.js.map +1 -0
- package/dist/tools/userPermissions.d.ts +76 -0
- package/dist/tools/userPermissions.js +130 -0
- package/dist/tools/userPermissions.js.map +1 -0
- package/dist/tools/versionMetadataComplete.d.ts +45 -0
- package/dist/tools/versionMetadataComplete.js +1 -0
- package/dist/tools/versionMetadataStart.d.ts +25 -0
- package/dist/tools/versionMetadataStart.js +1 -0
- package/dist/tools/versionMetadataStatus.d.ts +25 -0
- package/dist/tools/versionMetadataStatus.js +1 -0
- package/dist/tools/writeApexClasses.d.ts +64 -0
- package/dist/tools/writeApexClasses.js +79 -0
- package/dist/tools/writeApexClasses.js.map +1 -0
- package/dist/tools/writeApexTriggers.d.ts +71 -0
- package/dist/tools/writeApexTriggers.js +96 -0
- package/dist/tools/writeApexTriggers.js.map +1 -0
- package/dist/types/connection.d.ts +20 -0
- package/dist/types/connection.js +9 -0
- package/dist/types/connection.js.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/metadata.d.ts +44 -0
- package/dist/types/metadata.js +2 -0
- package/dist/types/metadata.js.map +1 -0
- package/dist/types/salesforce.d.ts +38 -0
- package/dist/types/salesforce.js +2 -0
- package/dist/types/salesforce.js.map +1 -0
- package/dist/utils/apexContainer.d.ts +18 -0
- package/dist/utils/apexContainer.js +79 -0
- package/dist/utils/apexContainer.js.map +1 -0
- package/dist/utils/connection.d.ts +3 -0
- package/dist/utils/connection.js +135 -0
- package/dist/utils/connection.js.map +1 -0
- package/dist/utils/decomposePermissions.d.ts +16 -0
- package/dist/utils/decomposePermissions.js +188 -0
- package/dist/utils/decomposePermissions.js.map +1 -0
- package/dist/utils/dxPathMapper.d.ts +16 -0
- package/dist/utils/dxPathMapper.js +217 -0
- package/dist/utils/dxPathMapper.js.map +1 -0
- package/dist/utils/errors.d.ts +8 -0
- package/dist/utils/errors.js +40 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/oauthWebFlow.d.ts +8 -0
- package/dist/utils/oauthWebFlow.js +172 -0
- package/dist/utils/oauthWebFlow.js.map +1 -0
- package/dist/utils/packageJobs.d.ts +17 -0
- package/dist/utils/packageJobs.js +1 -0
- package/dist/utils/packageXml.d.ts +18 -0
- package/dist/utils/packageXml.js +1 -0
- package/dist/utils/permissionSetResolver.d.ts +14 -0
- package/dist/utils/permissionSetResolver.js +1 -0
- package/dist/utils/preSelectMatcher.d.ts +18 -0
- package/dist/utils/preSelectMatcher.js +1 -0
- package/dist/utils/profileCleanup.d.ts +18 -0
- package/dist/utils/profileCleanup.js +1 -0
- package/dist/utils/retrieveStore.d.ts +12 -0
- package/dist/utils/retrieveStore.js +1 -0
- package/dist/utils/sfCli.d.ts +18 -0
- package/dist/utils/sfCli.js +130 -0
- package/dist/utils/sfCli.js.map +1 -0
- package/dist/utils/tokenBroker.d.ts +13 -0
- package/dist/utils/tokenBroker.js +73 -0
- package/dist/utils/tokenBroker.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { toolResponse } from '../utils/index.js';
|
|
3
|
+
export const metadataReadTool = {
|
|
4
|
+
name: 'salesforce_read_metadata',
|
|
5
|
+
description: 'Read full metadata for specific components by their full API names. Essential for deep org analysis — retrieve complete definitions including formulas, logic, field mappings, and configurations. Automatically batches large requests to handle orgs with hundreds of components.',
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {
|
|
9
|
+
metadataType: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
description: 'The metadata type to read (e.g. "ValidationRule", "Flow").',
|
|
12
|
+
},
|
|
13
|
+
fullNames: {
|
|
14
|
+
type: 'array',
|
|
15
|
+
items: { type: 'string' },
|
|
16
|
+
description: 'Array of full API names to read (e.g. ["Account.My_Rule", "Contact.Other_Rule"]).',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
required: ['metadataType', 'fullNames'],
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
const BATCH_SIZE = 10;
|
|
23
|
+
export async function handleMetadataRead(conn, args) {
|
|
24
|
+
const { metadataType, fullNames } = args;
|
|
25
|
+
try {
|
|
26
|
+
const allResults = [];
|
|
27
|
+
for (let i = 0; i < fullNames.length; i += BATCH_SIZE) {
|
|
28
|
+
const chunk = fullNames.slice(i, i + BATCH_SIZE);
|
|
29
|
+
const result = await conn.metadata.read(metadataType, chunk);
|
|
30
|
+
const items = Array.isArray(result) ? result : [result];
|
|
31
|
+
allResults.push(...items);
|
|
32
|
+
}
|
|
33
|
+
if (allResults.length === 0) {
|
|
34
|
+
return toolResponse(`No metadata found for type ${metadataType} with the given names.`);
|
|
35
|
+
}
|
|
36
|
+
return toolResponse(`${allResults.length} component(s) read for type ${metadataType}:\n\n${JSON.stringify(allResults, null, 2)}`);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
return toolResponse(`Metadata read failed: ${error.message}`, true);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export const metadataReadSchema = {
|
|
43
|
+
metadataType: z.string().describe('The metadata type to read (e.g. "ValidationRule", "Flow").'),
|
|
44
|
+
fullNames: z.array(z.string()).describe('Array of full API names to read (e.g. ["Account.My_Rule", "Contact.Other_Rule"]).'),
|
|
45
|
+
};
|
|
46
|
+
export const metadataReadDescriptor = {
|
|
47
|
+
name: 'salesforce_read_metadata',
|
|
48
|
+
description: metadataReadTool.description,
|
|
49
|
+
schema: metadataReadSchema,
|
|
50
|
+
handler: handleMetadataRead,
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=metadataRead.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadataRead.js","sourceRoot":"","sources":["../../src/tools/metadataRead.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE,qRAAqR;IAClS,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,YAAY,EAAE;gBACZ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,4DAA4D;aAC1E;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,OAAO;gBACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACzB,WAAW,EAAE,mFAAmF;aACjG;SACF;QACD,QAAQ,EAAE,CAAC,cAAc,EAAE,WAAW,CAAC;KACxC;CACF,CAAC;AAOF,MAAM,UAAU,GAAG,EAAE,CAAC;AAEtB,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAAgB,EAAE,IAAsB;IAC/E,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAEzC,IAAI,CAAC;QACH,MAAM,UAAU,GAAU,EAAE,CAAC;QAE7B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AC,WAAW;IACzC,MAAM,EAAE,kBAAkB;IAC1B,OAAO,EAAE,kBAAkB;CAC5B,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Connection } from 'jsforce';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
export declare const metadataTypeSchemaTool: {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: "object";
|
|
8
|
+
properties: {
|
|
9
|
+
metadataType: {
|
|
10
|
+
type: string;
|
|
11
|
+
description: string;
|
|
12
|
+
};
|
|
13
|
+
maxDepth: {
|
|
14
|
+
type: string;
|
|
15
|
+
description: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
required: string[];
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export interface MetadataTypeSchemaArgs {
|
|
22
|
+
metadataType: string;
|
|
23
|
+
maxDepth?: number;
|
|
24
|
+
}
|
|
25
|
+
export declare function handleMetadataTypeSchema(_conn: Connection, args: MetadataTypeSchemaArgs): Promise<{
|
|
26
|
+
content: {
|
|
27
|
+
type: "text";
|
|
28
|
+
text: string;
|
|
29
|
+
}[];
|
|
30
|
+
isError: boolean;
|
|
31
|
+
}>;
|
|
32
|
+
export declare const metadataTypeSchemaSchema: {
|
|
33
|
+
metadataType: z.ZodString;
|
|
34
|
+
maxDepth: z.ZodOptional<z.ZodNumber>;
|
|
35
|
+
};
|
|
36
|
+
export declare const metadataTypeSchemaDescriptor: {
|
|
37
|
+
name: string;
|
|
38
|
+
description: string;
|
|
39
|
+
schema: {
|
|
40
|
+
metadataType: z.ZodString;
|
|
41
|
+
maxDepth: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
};
|
|
43
|
+
handler: typeof handleMetadataTypeSchema;
|
|
44
|
+
};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { ApiSchemas } from 'jsforce/lib/api/metadata/schema.js';
|
|
3
|
+
import { toolResponse } from '../utils/index.js';
|
|
4
|
+
export const metadataTypeSchemaTool = {
|
|
5
|
+
name: 'salesforce_get_metadata_type_schema',
|
|
6
|
+
description: 'Returns the structure/schema for a Salesforce metadata type, showing all properties, their types, and whether they are required or optional. Use this before constructing metadata payloads for create/upsert operations to understand what fields are available. Recursively resolves nested type definitions.',
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
metadataType: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'The metadata type name, e.g. "CustomObject", "Flow", "ValidationRule"',
|
|
13
|
+
},
|
|
14
|
+
maxDepth: {
|
|
15
|
+
type: 'number',
|
|
16
|
+
description: 'How deep to resolve nested types. Limits output size for complex types. Default: 3',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
required: ['metadataType'],
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
const schemas = ApiSchemas;
|
|
23
|
+
function resolveType(typeName, maxDepth, currentDepth, visited) {
|
|
24
|
+
const schema = schemas[typeName];
|
|
25
|
+
if (!schema)
|
|
26
|
+
return null;
|
|
27
|
+
const properties = {};
|
|
28
|
+
// Merge parent props first
|
|
29
|
+
if (schema.extends && schemas[schema.extends]) {
|
|
30
|
+
const parent = resolveType(schema.extends, maxDepth, currentDepth, visited);
|
|
31
|
+
if (parent) {
|
|
32
|
+
Object.assign(properties, parent.properties);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
for (const [key, value] of Object.entries(schema.props)) {
|
|
36
|
+
if (Array.isArray(value)) {
|
|
37
|
+
// Array type: ["CustomField"]
|
|
38
|
+
const refType = value[0];
|
|
39
|
+
const prop = { type: refType, required: false, isArray: true };
|
|
40
|
+
if (!isPrimitive(refType) && currentDepth < maxDepth && !visited.has(refType)) {
|
|
41
|
+
visited.add(refType);
|
|
42
|
+
const nested = resolveType(refType, maxDepth, currentDepth + 1, visited);
|
|
43
|
+
visited.delete(refType);
|
|
44
|
+
if (nested) {
|
|
45
|
+
prop.properties = nested.properties;
|
|
46
|
+
if (nested.extends)
|
|
47
|
+
prop.extends = nested.extends;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
properties[key] = prop;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
const raw = value;
|
|
54
|
+
const optional = raw.startsWith('?');
|
|
55
|
+
const typeName = optional ? raw.slice(1) : raw;
|
|
56
|
+
const prop = { type: typeName, required: !optional };
|
|
57
|
+
if (!isPrimitive(typeName) && currentDepth < maxDepth && !visited.has(typeName)) {
|
|
58
|
+
visited.add(typeName);
|
|
59
|
+
const nested = resolveType(typeName, maxDepth, currentDepth + 1, visited);
|
|
60
|
+
visited.delete(typeName);
|
|
61
|
+
if (nested) {
|
|
62
|
+
prop.properties = nested.properties;
|
|
63
|
+
if (nested.extends)
|
|
64
|
+
prop.extends = nested.extends;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
properties[key] = prop;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const result = { type: schema.type, properties };
|
|
71
|
+
if (schema.extends)
|
|
72
|
+
result.extends = schema.extends;
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
function isPrimitive(type) {
|
|
76
|
+
return ['string', 'boolean', 'number', 'integer'].includes(type);
|
|
77
|
+
}
|
|
78
|
+
export async function handleMetadataTypeSchema(_conn, args) {
|
|
79
|
+
try {
|
|
80
|
+
const { metadataType, maxDepth = 3 } = args;
|
|
81
|
+
if (!schemas[metadataType]) {
|
|
82
|
+
return toolResponse(`Unknown metadata type: "${metadataType}". Use the salesforce_list_metadata_types tool to discover valid metadata type names.`, true);
|
|
83
|
+
}
|
|
84
|
+
const resolved = resolveType(metadataType, maxDepth, 0, new Set([metadataType]));
|
|
85
|
+
return toolResponse(JSON.stringify(resolved, null, 2));
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
return toolResponse(`Failed to resolve metadata type schema: ${error.message}`, true);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
export const metadataTypeSchemaSchema = {
|
|
92
|
+
metadataType: z.string().describe('The metadata type name, e.g. "CustomObject", "Flow", "ValidationRule"'),
|
|
93
|
+
maxDepth: z.number().describe('How deep to resolve nested types. Limits output size for complex types. Default: 3').optional(),
|
|
94
|
+
};
|
|
95
|
+
export const metadataTypeSchemaDescriptor = {
|
|
96
|
+
name: 'salesforce_get_metadata_type_schema',
|
|
97
|
+
description: metadataTypeSchemaTool.description,
|
|
98
|
+
schema: metadataTypeSchemaSchema,
|
|
99
|
+
handler: handleMetadataTypeSchema,
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=metadataTypeSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadataTypeSchema.js","sourceRoot":"","sources":["../../src/tools/metadataTypeSchema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,IAAI,EAAE,qCAAqC;IAC3C,WAAW,EACT,iTAAiT;IACnT,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,YAAY,EAAE;gBACZ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,uEAAuE;aACrF;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,oFAAoF;aAClG;SACF;QACD,QAAQ,EAAE,CAAC,cAAc,CAAC;KAC3B;CACF,CAAC;AAqBF,MAAM,OAAO,GAAG,UAA4F,CAAC;AAE7G,SAAS,WAAW,CAClB,QAAgB,EAChB,QAAgB,EAChB,YAAoB,EACpB,OAAoB;IAEpB,MAAM,MAAM,GAAG,OAAO,CAAC,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AO,EAAE,wBAAwB;CAClC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Connection } from 'jsforce';
|
|
2
|
+
export declare const metadataWsdlTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
properties: {};
|
|
8
|
+
required: never[];
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export interface MetadataWsdlArgs {
|
|
12
|
+
}
|
|
13
|
+
export declare function handleMetadataWsdl(conn: Connection, _args: MetadataWsdlArgs): Promise<{
|
|
14
|
+
content: {
|
|
15
|
+
type: "text";
|
|
16
|
+
text: string;
|
|
17
|
+
}[];
|
|
18
|
+
isError: boolean;
|
|
19
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"fs";import e from"path";import a from"os";import{toolResponse as o}from"../utils/index.js";export const metadataWsdlTool={name:"salesforce_download_metadata_wsdl",description:"Downloads the Metadata WSDL file from the connected Salesforce org and saves it to the temp directory. Checks if the file already exists before downloading. The WSDL describes all metadata types and their structure, useful for understanding metadata operations.",inputSchema:{type:"object",properties:{},required:[]}};export async function handleMetadataWsdl(s,d){try{const d=s.version,r=e.join(a.tmpdir(),`metadata_${d}.wsdl`);if(t.existsSync(r))return o(`Metadata WSDL already cached at: ${r}`);const n=await fetch(`${s.instanceUrl}/services/wsdl/metadata`,{headers:{Authorization:`Bearer ${s.accessToken}`}});if(!n.ok)return o(`Failed to download Metadata WSDL: HTTP ${n.status} ${n.statusText}`,!0);const i=await n.text();return t.writeFileSync(r,i,"utf-8"),o(`Metadata WSDL downloaded and saved to: ${r}`)}catch(t){return o(`Metadata WSDL download failed: ${t.message}`,!0)}}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Connection } from 'jsforce';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
export declare const objectManagementTool: {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: "object";
|
|
8
|
+
properties: {
|
|
9
|
+
operation: {
|
|
10
|
+
type: string;
|
|
11
|
+
enum: string[];
|
|
12
|
+
description: string;
|
|
13
|
+
};
|
|
14
|
+
objectName: {
|
|
15
|
+
type: string;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
label: {
|
|
19
|
+
type: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
|
22
|
+
pluralLabel: {
|
|
23
|
+
type: string;
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
description: {
|
|
27
|
+
type: string;
|
|
28
|
+
description: string;
|
|
29
|
+
};
|
|
30
|
+
nameFieldLabel: {
|
|
31
|
+
type: string;
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
nameFieldType: {
|
|
35
|
+
type: string;
|
|
36
|
+
enum: string[];
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
39
|
+
nameFieldFormat: {
|
|
40
|
+
type: string;
|
|
41
|
+
description: string;
|
|
42
|
+
};
|
|
43
|
+
sharingModel: {
|
|
44
|
+
type: string;
|
|
45
|
+
description: string;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
required: string[];
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
export interface ObjectManagementArgs {
|
|
52
|
+
operation: 'create' | 'update';
|
|
53
|
+
objectName: string;
|
|
54
|
+
label?: string;
|
|
55
|
+
pluralLabel?: string;
|
|
56
|
+
description?: string;
|
|
57
|
+
nameFieldLabel?: string;
|
|
58
|
+
nameFieldType?: 'Text' | 'AutoNumber';
|
|
59
|
+
nameFieldFormat?: string;
|
|
60
|
+
sharingModel?: string;
|
|
61
|
+
}
|
|
62
|
+
export declare function handleObjectManagement(conn: Connection, args: ObjectManagementArgs): Promise<{
|
|
63
|
+
content: {
|
|
64
|
+
type: "text";
|
|
65
|
+
text: string;
|
|
66
|
+
}[];
|
|
67
|
+
isError: boolean;
|
|
68
|
+
}>;
|
|
69
|
+
export declare const objectManagementSchema: {
|
|
70
|
+
operation: z.ZodEnum<{
|
|
71
|
+
update: "update";
|
|
72
|
+
create: "create";
|
|
73
|
+
}>;
|
|
74
|
+
objectName: z.ZodString;
|
|
75
|
+
label: z.ZodOptional<z.ZodString>;
|
|
76
|
+
pluralLabel: z.ZodOptional<z.ZodString>;
|
|
77
|
+
description: z.ZodOptional<z.ZodString>;
|
|
78
|
+
nameFieldLabel: z.ZodOptional<z.ZodString>;
|
|
79
|
+
nameFieldType: z.ZodOptional<z.ZodEnum<{
|
|
80
|
+
Text: "Text";
|
|
81
|
+
AutoNumber: "AutoNumber";
|
|
82
|
+
}>>;
|
|
83
|
+
nameFieldFormat: z.ZodOptional<z.ZodString>;
|
|
84
|
+
sharingModel: z.ZodOptional<z.ZodString>;
|
|
85
|
+
};
|
|
86
|
+
export declare const objectManagementDescriptor: {
|
|
87
|
+
name: string;
|
|
88
|
+
description: string;
|
|
89
|
+
schema: {
|
|
90
|
+
operation: z.ZodEnum<{
|
|
91
|
+
update: "update";
|
|
92
|
+
create: "create";
|
|
93
|
+
}>;
|
|
94
|
+
objectName: z.ZodString;
|
|
95
|
+
label: z.ZodOptional<z.ZodString>;
|
|
96
|
+
pluralLabel: z.ZodOptional<z.ZodString>;
|
|
97
|
+
description: z.ZodOptional<z.ZodString>;
|
|
98
|
+
nameFieldLabel: z.ZodOptional<z.ZodString>;
|
|
99
|
+
nameFieldType: z.ZodOptional<z.ZodEnum<{
|
|
100
|
+
Text: "Text";
|
|
101
|
+
AutoNumber: "AutoNumber";
|
|
102
|
+
}>>;
|
|
103
|
+
nameFieldFormat: z.ZodOptional<z.ZodString>;
|
|
104
|
+
sharingModel: z.ZodOptional<z.ZodString>;
|
|
105
|
+
};
|
|
106
|
+
handler: typeof handleObjectManagement;
|
|
107
|
+
};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { toolResponse, formatMetadataErrors } from '../utils/index.js';
|
|
3
|
+
export const objectManagementTool = {
|
|
4
|
+
name: 'salesforce_manage_object',
|
|
5
|
+
description: 'Create or update custom Salesforce objects via Metadata API. Object name should not include the __c suffix — it is added automatically.',
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {
|
|
9
|
+
operation: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
enum: ['create', 'update'],
|
|
12
|
+
description: 'Create a new custom object or update an existing one.',
|
|
13
|
+
},
|
|
14
|
+
objectName: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'Object name without __c suffix.',
|
|
17
|
+
},
|
|
18
|
+
label: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: 'Object label (required for create).',
|
|
21
|
+
},
|
|
22
|
+
pluralLabel: {
|
|
23
|
+
type: 'string',
|
|
24
|
+
description: 'Plural label (required for create).',
|
|
25
|
+
},
|
|
26
|
+
description: {
|
|
27
|
+
type: 'string',
|
|
28
|
+
description: 'Object description.',
|
|
29
|
+
},
|
|
30
|
+
nameFieldLabel: {
|
|
31
|
+
type: 'string',
|
|
32
|
+
description: 'Label for the name field (default: object label + " Name").',
|
|
33
|
+
},
|
|
34
|
+
nameFieldType: {
|
|
35
|
+
type: 'string',
|
|
36
|
+
enum: ['Text', 'AutoNumber'],
|
|
37
|
+
description: 'Name field type. Default: Text.',
|
|
38
|
+
},
|
|
39
|
+
nameFieldFormat: {
|
|
40
|
+
type: 'string',
|
|
41
|
+
description: 'Display format for AutoNumber name fields. Example: "INV-{0000}"',
|
|
42
|
+
},
|
|
43
|
+
sharingModel: {
|
|
44
|
+
type: 'string',
|
|
45
|
+
description: 'Sharing model. Default: ReadWrite.',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
required: ['operation', 'objectName'],
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
export async function handleObjectManagement(conn, args) {
|
|
52
|
+
const { operation, objectName } = args;
|
|
53
|
+
const fullName = objectName.endsWith('__c') ? objectName : `${objectName}__c`;
|
|
54
|
+
try {
|
|
55
|
+
if (operation === 'create') {
|
|
56
|
+
if (!args.label || !args.pluralLabel) {
|
|
57
|
+
return toolResponse('Create requires "label" and "pluralLabel" parameters.', true);
|
|
58
|
+
}
|
|
59
|
+
const nameField = {
|
|
60
|
+
label: args.nameFieldLabel || `${args.label} Name`,
|
|
61
|
+
type: args.nameFieldType || 'Text',
|
|
62
|
+
};
|
|
63
|
+
if (nameField.type === 'AutoNumber' && args.nameFieldFormat) {
|
|
64
|
+
nameField.displayFormat = args.nameFieldFormat;
|
|
65
|
+
}
|
|
66
|
+
const metadata = {
|
|
67
|
+
fullName,
|
|
68
|
+
label: args.label,
|
|
69
|
+
pluralLabel: args.pluralLabel,
|
|
70
|
+
nameField,
|
|
71
|
+
deploymentStatus: 'Deployed',
|
|
72
|
+
sharingModel: args.sharingModel || 'ReadWrite',
|
|
73
|
+
description: args.description,
|
|
74
|
+
};
|
|
75
|
+
const result = await conn.metadata.create('CustomObject', metadata);
|
|
76
|
+
if (result.success) {
|
|
77
|
+
return toolResponse(`Custom object "${fullName}" created successfully.`);
|
|
78
|
+
}
|
|
79
|
+
return toolResponse(`Failed to create object: ${formatMetadataErrors(result)}`, true);
|
|
80
|
+
}
|
|
81
|
+
// Update
|
|
82
|
+
const existing = await conn.metadata.read('CustomObject', [fullName]);
|
|
83
|
+
if (!existing || (Array.isArray(existing) && existing.length === 0)) {
|
|
84
|
+
return toolResponse(`Object "${fullName}" not found.`, true);
|
|
85
|
+
}
|
|
86
|
+
const current = Array.isArray(existing) ? existing[0] : existing;
|
|
87
|
+
const updated = { ...current };
|
|
88
|
+
if (args.label)
|
|
89
|
+
updated.label = args.label;
|
|
90
|
+
if (args.pluralLabel)
|
|
91
|
+
updated.pluralLabel = args.pluralLabel;
|
|
92
|
+
if (args.description !== undefined)
|
|
93
|
+
updated.description = args.description;
|
|
94
|
+
if (args.sharingModel)
|
|
95
|
+
updated.sharingModel = args.sharingModel;
|
|
96
|
+
const result = await conn.metadata.update('CustomObject', updated);
|
|
97
|
+
if (result.success) {
|
|
98
|
+
return toolResponse(`Custom object "${fullName}" updated successfully.`);
|
|
99
|
+
}
|
|
100
|
+
return toolResponse(`Failed to update object: ${formatMetadataErrors(result)}`, true);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
return toolResponse(`Object ${operation} failed: ${error.message}`, true);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export const objectManagementSchema = {
|
|
107
|
+
operation: z.enum(['create', 'update']).describe('Create a new custom object or update an existing one.'),
|
|
108
|
+
objectName: z.string().describe('Object name without __c suffix.'),
|
|
109
|
+
label: z.string().describe('Object label (required for create).').optional(),
|
|
110
|
+
pluralLabel: z.string().describe('Plural label (required for create).').optional(),
|
|
111
|
+
description: z.string().describe('Object description.').optional(),
|
|
112
|
+
nameFieldLabel: z.string().describe('Label for the name field (default: object label + " Name").').optional(),
|
|
113
|
+
nameFieldType: z.enum(['Text', 'AutoNumber']).describe('Name field type. Default: Text.').optional(),
|
|
114
|
+
nameFieldFormat: z.string().describe('Display format for AutoNumber name fields. Example: "INV-{0000}"').optional(),
|
|
115
|
+
sharingModel: z.string().describe('Sharing model. Default: ReadWrite.').optional(),
|
|
116
|
+
};
|
|
117
|
+
export const objectManagementDescriptor = {
|
|
118
|
+
name: 'salesforce_manage_object',
|
|
119
|
+
description: objectManagementTool.description,
|
|
120
|
+
schema: objectManagementSchema,
|
|
121
|
+
handler: handleObjectManagement,
|
|
122
|
+
};
|
|
123
|
+
//# sourceMappingURL=objectManagement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectManagement.js","sourceRoot":"","sources":["../../src/tools/objectManagement.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEvE,MAAM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All"];
|
|
4
|
+
type PermKey = typeof PERMISSION_KEYS[number];
|
|
5
|
+
export declare const objectPermissionsTool: {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
inputSchema: {
|
|
9
|
+
type: "object";
|
|
10
|
+
properties: {
|
|
11
|
+
operation: {
|
|
12
|
+
type: string;
|
|
13
|
+
enum: string[];
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
objectName: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
profileNames: {
|
|
21
|
+
type: string;
|
|
22
|
+
items: {
|
|
23
|
+
type: string;
|
|
24
|
+
};
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
permissionSetNames: {
|
|
28
|
+
type: string;
|
|
29
|
+
items: {
|
|
30
|
+
type: string;
|
|
31
|
+
};
|
|
32
|
+
description: string;
|
|
33
|
+
};
|
|
34
|
+
permissions: {
|
|
35
|
+
type: string;
|
|
36
|
+
items: {
|
|
37
|
+
type: string;
|
|
38
|
+
enum: string[];
|
|
39
|
+
};
|
|
40
|
+
description: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
required: string[];
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
export interface ObjectPermissionsArgs {
|
|
47
|
+
operation: 'grant' | 'revoke' | 'list';
|
|
48
|
+
objectName: string;
|
|
49
|
+
profileNames?: string[];
|
|
50
|
+
permissionSetNames?: string[];
|
|
51
|
+
permissions?: PermKey[];
|
|
52
|
+
}
|
|
53
|
+
export declare function handleObjectPermissions(conn: Connection, args: ObjectPermissionsArgs): Promise<{
|
|
54
|
+
content: {
|
|
55
|
+
type: "text";
|
|
56
|
+
text: string;
|
|
57
|
+
}[];
|
|
58
|
+
isError: boolean;
|
|
59
|
+
}>;
|
|
60
|
+
export declare const objectPermissionsSchema: {
|
|
61
|
+
operation: z.ZodEnum<{
|
|
62
|
+
grant: "grant";
|
|
63
|
+
revoke: "revoke";
|
|
64
|
+
list: "list";
|
|
65
|
+
}>;
|
|
66
|
+
objectName: z.ZodString;
|
|
67
|
+
profileNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
68
|
+
permissionSetNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
69
|
+
permissions: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
70
|
+
create: "create";
|
|
71
|
+
delete: "delete";
|
|
72
|
+
read: "read";
|
|
73
|
+
edit: "edit";
|
|
74
|
+
viewAll: "viewAll";
|
|
75
|
+
modifyAll: "modifyAll";
|
|
76
|
+
}>>>;
|
|
77
|
+
};
|
|
78
|
+
export declare const objectPermissionsDescriptor: {
|
|
79
|
+
name: string;
|
|
80
|
+
description: string;
|
|
81
|
+
schema: {
|
|
82
|
+
operation: z.ZodEnum<{
|
|
83
|
+
grant: "grant";
|
|
84
|
+
revoke: "revoke";
|
|
85
|
+
list: "list";
|
|
86
|
+
}>;
|
|
87
|
+
objectName: z.ZodString;
|
|
88
|
+
profileNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
89
|
+
permissionSetNames: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
90
|
+
permissions: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
91
|
+
create: "create";
|
|
92
|
+
delete: "delete";
|
|
93
|
+
read: "read";
|
|
94
|
+
edit: "edit";
|
|
95
|
+
viewAll: "viewAll";
|
|
96
|
+
modifyAll: "modifyAll";
|
|
97
|
+
}>>>;
|
|
98
|
+
};
|
|
99
|
+
handler: typeof handleObjectPermissions;
|
|
100
|
+
};
|
|
101
|
+
export {};
|