@xrmforge/typegen 0.8.5 → 0.8.7
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/dist/index.d.ts +7 -0
- package/dist/index.js +43 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1654,6 +1654,13 @@ declare class TypeGenerationOrchestrator {
|
|
|
1654
1654
|
* Maps the raw EntityTypeInfo data to the format expected by the OptionSet generator.
|
|
1655
1655
|
*/
|
|
1656
1656
|
private getPicklistAttributes;
|
|
1657
|
+
/**
|
|
1658
|
+
* Generate a form-mapping.json that maps entity names to their generated
|
|
1659
|
+
* form interface names, fields enums, and tabs enums.
|
|
1660
|
+
*
|
|
1661
|
+
* This helps AI agents find the correct interface names without guessing.
|
|
1662
|
+
*/
|
|
1663
|
+
private generateFormMapping;
|
|
1657
1664
|
}
|
|
1658
1665
|
|
|
1659
1666
|
export { type ActionGeneratorOptions, ApiRequestError, type AttributeMetadata, type AuthConfig, type AuthMethod, AuthenticationError, type CacheStats, type ChangeDetectionResult, ChangeDetector, type ClientCredentialsAuth, ConfigError, ConsoleLogSink, type CustomApiTypeInfo, DEFAULT_LABEL_CONFIG, DataverseHttpClient, type DateTimeAttributeMetadata, type DecimalAttributeMetadata, type DeviceCodeAuth, type EntityFieldsGeneratorOptions, type EntityGenerationResult, type EntityGeneratorOptions, type EntityMetadata, type EntityNamesGeneratorOptions, type EntityTypeInfo, ErrorCode, FastXmlParser, type FormControl, type FormGeneratorOptions, type FormSection, type FormTab, type GenerateConfig, type GeneratedFile, GenerationError, type GenerationResult, type GroupedCustomApis, type HttpClientOptions, type IntegerAttributeMetadata, type InteractiveAuth, JsonLogSink, type Label, type LabelConfig, type LocalizedLabel, type LogEntry, LogLevel, type LogSink, Logger, type LookupAttributeMetadata, type ManyToManyRelationshipMetadata, MetadataCache, MetadataClient, MetadataError, type MoneyAttributeMetadata, type OneToManyRelationshipMetadata, type OptionMetadata, type OptionSetGeneratorOptions, type OptionSetMetadata, type ParsedForm, type PicklistAttributeMetadata, SilentLogSink, type SolutionComponent, type StateAttributeMetadata, type StatusAttributeMetadata, type StringAttributeMetadata, type SystemFormMetadata, TypeGenerationOrchestrator, type XmlElement, type XmlParser, XrmForgeError, configureLogging, createCredential, createLogger, defaultXmlParser, disambiguateEnumMembers, extractControlFields, getJSDocLabel as formatDualLabel, generateActionDeclarations, generateActionModule, generateActivityPartyInterface, generateEntityFieldsEnum, generateEntityForms, generateEntityInterface, generateEntityNamesEnum, generateEntityNavigationProperties, generateEntityOptionSets, generateEnumMembers, generateFormInterface, generateOptionSetEnum, getEntityPropertyType, getFormAttributeType, getFormControlType, getFormMockValueType, getJSDocLabel, getLabelLanguagesParam, getPrimaryLabel, getSecondaryLabel, groupCustomApis, isLookupType, isPartyListType, isRateLimitError, isXrmForgeError, labelToIdentifier, parseForm, shouldIncludeInEntityInterface, toLookupValueProperty, toPascalCase, toSafeIdentifier };
|
package/dist/index.js
CHANGED
|
@@ -2610,7 +2610,7 @@ function toImportSpecifier(relativePath) {
|
|
|
2610
2610
|
}
|
|
2611
2611
|
function generateBarrelIndex(files) {
|
|
2612
2612
|
const lines = [GENERATED_HEADER];
|
|
2613
|
-
const entities = files.filter((f) => f.type === "entity");
|
|
2613
|
+
const entities = files.filter((f) => f.type === "entity" && !f.relativePath.endsWith(".json"));
|
|
2614
2614
|
const optionsets = files.filter((f) => f.type === "optionset");
|
|
2615
2615
|
const forms = files.filter((f) => f.type === "form");
|
|
2616
2616
|
const fields = files.filter((f) => f.type === "fields");
|
|
@@ -2806,6 +2806,15 @@ var TypeGenerationOrchestrator = class {
|
|
|
2806
2806
|
type: "entity"
|
|
2807
2807
|
});
|
|
2808
2808
|
}
|
|
2809
|
+
const formFiles = allFiles.filter((f) => f.type === "form");
|
|
2810
|
+
if (formFiles.length > 0) {
|
|
2811
|
+
const formMapping = this.generateFormMapping(formFiles);
|
|
2812
|
+
allFiles.push({
|
|
2813
|
+
relativePath: "form-mapping.json",
|
|
2814
|
+
content: JSON.stringify(formMapping, null, 2) + "\n",
|
|
2815
|
+
type: "entity"
|
|
2816
|
+
});
|
|
2817
|
+
}
|
|
2809
2818
|
if (allFiles.length > 0) {
|
|
2810
2819
|
const indexContent = generateBarrelIndex(allFiles);
|
|
2811
2820
|
const indexFile = {
|
|
@@ -3094,6 +3103,39 @@ ${navPropsContent}` : fieldsEnumContent;
|
|
|
3094
3103
|
}
|
|
3095
3104
|
return result;
|
|
3096
3105
|
}
|
|
3106
|
+
/**
|
|
3107
|
+
* Generate a form-mapping.json that maps entity names to their generated
|
|
3108
|
+
* form interface names, fields enums, and tabs enums.
|
|
3109
|
+
*
|
|
3110
|
+
* This helps AI agents find the correct interface names without guessing.
|
|
3111
|
+
*/
|
|
3112
|
+
generateFormMapping(formFiles) {
|
|
3113
|
+
const mapping = {};
|
|
3114
|
+
for (const file of formFiles) {
|
|
3115
|
+
const match = file.relativePath.match(/^forms\/(.+)\.ts$/);
|
|
3116
|
+
if (!match) continue;
|
|
3117
|
+
const entityName = match[1];
|
|
3118
|
+
const interfaces = [...file.content.matchAll(/export\s+interface\s+(\w+Form)\s+extends/g)].map((m) => m[1]);
|
|
3119
|
+
const fieldsEnums = [...file.content.matchAll(/export\s+const\s+enum\s+(\w+FormFieldsEnum)\s*\{/g)].map((m) => m[1]);
|
|
3120
|
+
const tabsEnums = [...file.content.matchAll(/export\s+const\s+enum\s+(\w+FormTabs)\s*\{/g)].map((m) => m[1]);
|
|
3121
|
+
const forms = [];
|
|
3122
|
+
for (let i = 0; i < interfaces.length; i++) {
|
|
3123
|
+
const interfaceName = interfaces[i];
|
|
3124
|
+
const jsdocMatch = file.content.match(new RegExp(`/\\*\\*\\s*(.+?)\\s*\\*/\\s*export\\s+interface\\s+${interfaceName}`));
|
|
3125
|
+
const formName = jsdocMatch?.[1] ?? interfaceName.replace(/Form$/, "");
|
|
3126
|
+
forms.push({
|
|
3127
|
+
formName,
|
|
3128
|
+
interface: interfaceName,
|
|
3129
|
+
fieldsEnum: fieldsEnums[i] ?? "",
|
|
3130
|
+
tabsEnum: tabsEnums[i] ?? ""
|
|
3131
|
+
});
|
|
3132
|
+
}
|
|
3133
|
+
if (forms.length > 0) {
|
|
3134
|
+
mapping[entityName] = forms;
|
|
3135
|
+
}
|
|
3136
|
+
}
|
|
3137
|
+
return mapping;
|
|
3138
|
+
}
|
|
3097
3139
|
};
|
|
3098
3140
|
export {
|
|
3099
3141
|
ApiRequestError,
|