Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as yaml from 'js-yaml';
import * as vscode from 'vscode';

import { Logger, injectable } from '@vlocode/core';
import { filterAsyncParallel, getErrorMessage, getObjectProperty, singleFlight } from '@vlocode/util';
import { filterAsyncParallel, getErrorMessage, getObjectProperty, removeNamespacePrefix, singleFlight } from '@vlocode/util';
import { QueryConditionBuilder, QueryParser, type SalesforceQueryData } from '@vlocode/salesforce';
import { DatapackInfoService, DatapackTypeDefinition, DatapackTypeDefinitions } from '@vlocode/vlocity';
import {
Expand Down Expand Up @@ -132,9 +132,26 @@ export class DatapackDefinitionRegistry {
private getDatapackTypeDefinitions(definitions: Record<string, DatapackExportDefinition>): DatapackTypeDefinition[] {
return Object.entries(definitions)
.filter(([, definition]) => !definition.dependent)
.map(([datapackType, definition]) => {
return this.toDatapackTypeDefinition(datapackType, definition);
});
.map(([datapackType, definition]) => this.resolveDatapackTypeDefinition(datapackType, definition));
}

/**
* Resolves a DatapackTypeDefinition for the given datapack type and export definition.
* Uses the static DatapackTypeDefinitions when a match exists (preserving grouping,
* displayName, matchingKey, and full field list), falling back to YAML-derived definition.
*/
private resolveDatapackTypeDefinition(datapackType: string, exportDefinition: DatapackExportDefinition): DatapackTypeDefinition {
const staticEntry = DatapackTypeDefinitions[datapackType];
if (staticEntry) {
const allStatic = Array.isArray(staticEntry) ? staticEntry : [staticEntry];
const match = allStatic.find(def =>
removeNamespacePrefix(def.source.sobjectType) === removeNamespacePrefix(exportDefinition.objectType)
);
if (match) {
return { ...match, exportMode: 'direct' };
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve custom export definition queries

When a custom datapack-definitions.yaml reuses a built-in datapack type/object pair, this branch returns the static definition and drops the YAML-derived source built from the custom file. Because loadCustomDefinitionFile() also calls getDatapackTypeDefinitions(), a custom OmniScript/OmniProcess definition with its own filter, limit, name, or matchingKeyFields will be listed in the explorer using the built-in query instead of the user's configured query, so records outside the custom definition can appear or intended records can be omitted. The static fallback should be limited to the bundled definitions or merged without discarding the custom source settings.

Useful? React with 👍 / 👎.

}
Comment on lines +150 to +152
}
return this.toDatapackTypeDefinition(datapackType, exportDefinition);
}
Comment on lines +143 to 155

private async loadCustomDefinitions() {
Expand Down
Loading