@xrmforge/typegen 0.8.0 → 0.8.1

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.js CHANGED
@@ -2013,25 +2013,37 @@ function generateFormInterface(form, entityLogicalName, attributeMap, options =
2013
2013
  }
2014
2014
  const lines = [];
2015
2015
  lines.push(`/** Valid field names for the "${form.name}" form */`);
2016
- lines.push(`export type ${fieldsTypeName} =`);
2017
- for (let i = 0; i < fields.length; i++) {
2018
- const separator = i === fields.length - 1 ? ";" : "";
2019
- lines.push(` | "${fields[i].logicalName}"${separator}`);
2016
+ if (fields.length === 0) {
2017
+ lines.push(`export type ${fieldsTypeName} = never;`);
2018
+ } else {
2019
+ lines.push(`export type ${fieldsTypeName} =`);
2020
+ for (let i = 0; i < fields.length; i++) {
2021
+ const separator = i === fields.length - 1 ? ";" : "";
2022
+ lines.push(` | "${fields[i].logicalName}"${separator}`);
2023
+ }
2020
2024
  }
2021
2025
  lines.push("");
2022
2026
  lines.push(`/** Attribute type map for "${form.name}" */`);
2023
- lines.push(`export type ${attrMapName} = {`);
2024
- for (const field of fields) {
2025
- lines.push(` ${field.logicalName}: ${field.formAttributeType};`);
2027
+ if (fields.length === 0) {
2028
+ lines.push(`export type ${attrMapName} = Record<string, never>;`);
2029
+ } else {
2030
+ lines.push(`export type ${attrMapName} = {`);
2031
+ for (const field of fields) {
2032
+ lines.push(` ${field.logicalName}: ${field.formAttributeType};`);
2033
+ }
2034
+ lines.push("};");
2026
2035
  }
2027
- lines.push("};");
2028
2036
  lines.push("");
2029
2037
  lines.push(`/** Control type map for "${form.name}" */`);
2030
- lines.push(`export type ${ctrlMapName} = {`);
2031
- for (const field of fields) {
2032
- lines.push(` ${field.logicalName}: ${field.formControlType};`);
2038
+ if (fields.length === 0) {
2039
+ lines.push(`export type ${ctrlMapName} = Record<string, never>;`);
2040
+ } else {
2041
+ lines.push(`export type ${ctrlMapName} = {`);
2042
+ for (const field of fields) {
2043
+ lines.push(` ${field.logicalName}: ${field.formControlType};`);
2044
+ }
2045
+ lines.push("};");
2033
2046
  }
2034
- lines.push("};");
2035
2047
  lines.push("");
2036
2048
  lines.push(`/** Field constants for "${form.name}" (compile-time only, zero runtime) */`);
2037
2049
  lines.push(`export const enum ${fieldsTypeName}Enum {`);
@@ -2867,9 +2879,9 @@ function generateBarrelIndex(files) {
2867
2879
  lines.push("");
2868
2880
  }
2869
2881
  if (optionsets.length > 0) {
2870
- lines.push("// OptionSet Enums");
2882
+ lines.push("// OptionSet Enums - import directly from individual files to avoid name conflicts:");
2871
2883
  for (const f of optionsets) {
2872
- lines.push(`export * from '${toImportSpecifier(f.relativePath)}';`);
2884
+ lines.push(`// import { ... } from '${toImportSpecifier(f.relativePath)}';`);
2873
2885
  }
2874
2886
  lines.push("");
2875
2887
  }
@@ -2881,9 +2893,9 @@ function generateBarrelIndex(files) {
2881
2893
  lines.push("");
2882
2894
  }
2883
2895
  if (fields.length > 0) {
2884
- lines.push("// Entity Fields & Navigation Properties");
2896
+ lines.push("// Entity Fields & Navigation Properties - import directly from individual files to avoid name conflicts:");
2885
2897
  for (const f of fields) {
2886
- lines.push(`export * from '${toImportSpecifier(f.relativePath)}';`);
2898
+ lines.push(`// import { ... } from '${toImportSpecifier(f.relativePath)}';`);
2887
2899
  }
2888
2900
  lines.push("");
2889
2901
  }
@@ -3007,6 +3019,19 @@ var TypeGenerationOrchestrator = class {
3007
3019
  }
3008
3020
  }
3009
3021
  }
3022
+ if (this.config.generateEntities) {
3023
+ const hasPartyList = Object.values(cachedEntityInfos).some(
3024
+ (info) => info.attributes.some((a) => isPartyListType(a.AttributeType))
3025
+ );
3026
+ if (hasPartyList) {
3027
+ const activityPartyContent = generateActivityPartyInterface();
3028
+ allFiles.push({
3029
+ relativePath: "entities/_activity-party.ts",
3030
+ content: addGeneratedHeader(activityPartyContent),
3031
+ type: "entity"
3032
+ });
3033
+ }
3034
+ }
3010
3035
  this.logger.info(`Generating types for ${this.config.entities.length - failedEntities.size} entities`);
3011
3036
  for (const entityName of this.config.entities) {
3012
3037
  if (signal?.aborted) break;
@@ -3272,7 +3297,7 @@ ${navPropsContent}` : fieldsEnumContent;
3272
3297
  this.logger.info(`Filtered Custom APIs by prefix "${this.config.actionsFilter}": ${before} -> ${customApis.length}`);
3273
3298
  }
3274
3299
  if (customApis.length > 0) {
3275
- const importPath = "@xrmforge/typegen";
3300
+ const importPath = "@xrmforge/helpers";
3276
3301
  const grouped = groupCustomApis(customApis);
3277
3302
  for (const [key, apis] of grouped.actions) {
3278
3303
  const entityName = key === "global" ? void 0 : key;