@xrmforge/typegen 0.1.0 → 0.3.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/dist/index.d.ts CHANGED
@@ -574,6 +574,92 @@ interface EntityTypeInfo {
574
574
  manyToManyRelationships: ManyToManyRelationshipMetadata[];
575
575
  }
576
576
 
577
+ /**
578
+ * @xrmforge/typegen - Custom API Metadata Types
579
+ *
580
+ * TypeScript interfaces for Dataverse Custom API definitions.
581
+ * These types model the JSON structures from the customapi,
582
+ * customapirequestparameter, and customapiresponseproperty tables.
583
+ *
584
+ * Used by the action-generator to produce typed Action/Function executors.
585
+ */
586
+ /**
587
+ * Custom API parameter type (picklist values from customapirequestparameter.type).
588
+ *
589
+ * Maps to TypeScript types and OData metadata for getMetadata().
590
+ */
591
+ declare const enum CustomApiParameterType {
592
+ Boolean = 0,
593
+ DateTime = 1,
594
+ Decimal = 2,
595
+ Entity = 3,
596
+ EntityCollection = 4,
597
+ EntityReference = 5,
598
+ Float = 6,
599
+ Integer = 7,
600
+ Money = 8,
601
+ Picklist = 9,
602
+ String = 10,
603
+ StringArray = 11,
604
+ Guid = 12
605
+ }
606
+ /**
607
+ * Custom API binding type (picklist values from customapi.bindingtype).
608
+ */
609
+ declare const enum CustomApiBindingType {
610
+ /** Nicht an eine Entity gebunden (global aufrufbar) */
611
+ Global = 0,
612
+ /** An einen einzelnen Entity-Datensatz gebunden */
613
+ Entity = 1,
614
+ /** An eine Entity-Collection gebunden */
615
+ EntityCollection = 2
616
+ }
617
+ /** Custom API definition (from the customapi table) */
618
+ interface CustomApiMetadata {
619
+ /** Unique message name (e.g. "markant_NormalizePhone") */
620
+ uniquename: string;
621
+ /** 0=Global, 1=Entity, 2=EntityCollection */
622
+ bindingtype: CustomApiBindingType;
623
+ /** true = Function (GET), false = Action (POST) */
624
+ isfunction: boolean;
625
+ /** Bound entity logical name (null for unbound) */
626
+ boundentitylogicalname: string | null;
627
+ /** Display name for documentation */
628
+ displayname?: string;
629
+ /** Description for JSDoc */
630
+ description?: string;
631
+ }
632
+ /** Custom API request parameter (from the customapirequestparameter table) */
633
+ interface CustomApiRequestParameter {
634
+ /** Parameter name (e.g. "Input", "TargetId") */
635
+ uniquename: string;
636
+ /** Parameter type (0-12, see CustomApiParameterType) */
637
+ type: CustomApiParameterType;
638
+ /** Whether the parameter is optional */
639
+ isoptional: boolean;
640
+ /** Entity logical name (for Entity/EntityReference types) */
641
+ logicalentityname?: string | null;
642
+ /** Description for JSDoc */
643
+ description?: string;
644
+ }
645
+ /** Custom API response property (from the customapiresponseproperty table) */
646
+ interface CustomApiResponseProperty {
647
+ /** Property name (e.g. "Normalized", "IsValid") */
648
+ uniquename: string;
649
+ /** Property type (0-12, see CustomApiParameterType) */
650
+ type: CustomApiParameterType;
651
+ /** Entity logical name (for Entity/EntityReference types) */
652
+ logicalentityname?: string | null;
653
+ /** Description for JSDoc */
654
+ description?: string;
655
+ }
656
+ /** Complete Custom API definition with parameters and response */
657
+ interface CustomApiTypeInfo {
658
+ api: CustomApiMetadata;
659
+ requestParameters: CustomApiRequestParameter[];
660
+ responseProperties: CustomApiResponseProperty[];
661
+ }
662
+
577
663
  /**
578
664
  * @xrmforge/typegen - Metadata Client
579
665
  *
@@ -668,6 +754,16 @@ declare class MetadataClient {
668
754
  * Respects the HTTP client's concurrency limit automatically.
669
755
  */
670
756
  getMultipleEntityTypeInfos(logicalNames: string[]): Promise<EntityTypeInfo[]>;
757
+ /**
758
+ * Fetch all Custom APIs with their request parameters and response properties.
759
+ *
760
+ * Queries the customapi, customapirequestparameter, and customapiresponseproperty
761
+ * tables and joins them into CustomApiTypeInfo objects.
762
+ *
763
+ * @param solutionFilter - Optional: filter by solution unique name
764
+ * @returns Array of complete Custom API definitions
765
+ */
766
+ getCustomApis(solutionFilter?: string): Promise<CustomApiTypeInfo[]>;
671
767
  private getRelationships;
672
768
  }
673
769
 
@@ -913,6 +1009,14 @@ declare function getFormAttributeType(attributeType: string): string;
913
1009
  * @returns Fully qualified Xrm control type string
914
1010
  */
915
1011
  declare function getFormControlType(attributeType: string): string;
1012
+ /**
1013
+ * Map Dataverse AttributeType to JavaScript value type for mock objects.
1014
+ * Used by the form generator to create MockValues types for @xrmforge/testing.
1015
+ *
1016
+ * @param attributeType - The AttributeType from Dataverse metadata
1017
+ * @returns TypeScript value type string (e.g. "string | null", "number | null")
1018
+ */
1019
+ declare function getFormMockValueType(attributeType: string): string;
916
1020
  /**
917
1021
  * Convert a Dataverse LogicalName to a safe TypeScript identifier.
918
1022
  * Validates that the result is a valid identifier.
@@ -945,6 +1049,12 @@ declare function toLookupValueProperty(logicalName: string): string;
945
1049
  * not a single _fieldname_value property in the Web API.
946
1050
  */
947
1051
  declare function isLookupType(attributeType: string): boolean;
1052
+ /**
1053
+ * Determine if an attribute is a PartyList (ActivityParty collection).
1054
+ * PartyList fields (to, from, cc, bcc, requiredattendees, optionalattendees)
1055
+ * are navigation properties in the Web API, not flat lookup properties.
1056
+ */
1057
+ declare function isPartyListType(attributeType: string): boolean;
948
1058
  /**
949
1059
  * Determine if an attribute should be included in entity interfaces.
950
1060
  * Excludes virtual/calculated fields that are not readable via Web API.
@@ -958,6 +1068,29 @@ declare function isLookupType(attributeType: string): boolean;
958
1068
  */
959
1069
  declare function shouldIncludeInEntityInterface(attr: AttributeMetadata): boolean;
960
1070
 
1071
+ /**
1072
+ * @xrmforge/typegen - ActivityParty Base Interface
1073
+ *
1074
+ * ActivityParty is a Dataverse system entity that represents participants
1075
+ * in activities (email, appointment, phonecall, fax, etc.).
1076
+ *
1077
+ * PartyList fields (to, from, cc, bcc, requiredattendees, optionalattendees)
1078
+ * are collection-valued navigation properties that return ActivityParty arrays.
1079
+ *
1080
+ * This interface is generated once and referenced by all Activity entities
1081
+ * that have PartyList fields.
1082
+ *
1083
+ * @see https://learn.microsoft.com/en-us/power-apps/developer/data-platform/reference/entities/activityparty
1084
+ */
1085
+ /**
1086
+ * Generate the ActivityParty base interface declaration.
1087
+ * This is a fixed structure (system entity, never customized).
1088
+ *
1089
+ * @param namespace - Namespace for the interface (default: "XrmForge.Entities")
1090
+ * @returns TypeScript declaration string
1091
+ */
1092
+ declare function generateActivityPartyInterface(namespace?: string): string;
1093
+
961
1094
  /**
962
1095
  * @xrmforge/typegen - Generator-specific Label Utilities
963
1096
  *
@@ -1169,6 +1302,489 @@ declare function generateEntityForms(forms: ParsedForm[], entityLogicalName: str
1169
1302
  content: string;
1170
1303
  }>;
1171
1304
 
1305
+ /**
1306
+ * @xrmforge/typegen - Entity Fields Enum Generator
1307
+ *
1308
+ * Generates a const enum with ALL entity fields for use with Xrm.WebApi.
1309
+ * Unlike form-specific Fields enums, this contains every readable attribute.
1310
+ *
1311
+ * Output pattern:
1312
+ * ```typescript
1313
+ * declare namespace XrmForge.Entities {
1314
+ * const enum AccountFields {
1315
+ * /** Account Name | Firmenname *\/
1316
+ * Name = 'name',
1317
+ * /** Main Phone | Haupttelefon *\/
1318
+ * Telephone1 = 'telephone1',
1319
+ * }
1320
+ * }
1321
+ * ```
1322
+ */
1323
+
1324
+ /** Options for entity fields enum generation */
1325
+ interface EntityFieldsGeneratorOptions {
1326
+ /** Label configuration for dual-language JSDoc comments */
1327
+ labelConfig?: LabelConfig;
1328
+ /** Namespace for generated enums (default: "XrmForge.Entities") */
1329
+ namespace?: string;
1330
+ }
1331
+ /**
1332
+ * Generate a const enum with all entity fields for Web API usage.
1333
+ * Includes ALL readable fields (not form-specific).
1334
+ *
1335
+ * @param info - Complete entity metadata
1336
+ * @param options - Generator options
1337
+ * @returns TypeScript declaration string
1338
+ */
1339
+ declare function generateEntityFieldsEnum(info: EntityTypeInfo, options?: EntityFieldsGeneratorOptions): string;
1340
+ /**
1341
+ * Generate a const enum with navigation property names for all lookup fields.
1342
+ * Used with parseLookup() and $expand queries.
1343
+ *
1344
+ * Unlike EntityFields (which uses _fieldname_value format), this enum
1345
+ * contains the plain LogicalName (= navigation property name for non-polymorphic lookups).
1346
+ *
1347
+ * @param info - Complete entity metadata
1348
+ * @param options - Generator options
1349
+ * @returns TypeScript declaration string
1350
+ *
1351
+ * @example
1352
+ * ```typescript
1353
+ * // Generated:
1354
+ * const enum AccountNavigationProperties {
1355
+ * Country = 'markant_address1_countryid',
1356
+ * PrimaryContact = 'primarycontactid',
1357
+ * }
1358
+ *
1359
+ * // Usage:
1360
+ * parseLookup(response, AccountNav.Country);
1361
+ * ```
1362
+ */
1363
+ declare function generateEntityNavigationProperties(info: EntityTypeInfo, options?: EntityFieldsGeneratorOptions): string;
1364
+
1365
+ /**
1366
+ * @xrmforge/typegen - Entity Names Enum Generator
1367
+ *
1368
+ * Generates a single const enum with all entity logical names.
1369
+ * Eliminates raw strings in Xrm.WebApi calls.
1370
+ *
1371
+ * Output pattern:
1372
+ * ```typescript
1373
+ * declare namespace XrmForge {
1374
+ * const enum EntityNames {
1375
+ * Account = 'account',
1376
+ * Contact = 'contact',
1377
+ * Lead = 'lead',
1378
+ * }
1379
+ * }
1380
+ * ```
1381
+ */
1382
+ interface EntityNamesGeneratorOptions {
1383
+ /** Namespace (default: "XrmForge") */
1384
+ namespace?: string;
1385
+ }
1386
+ /**
1387
+ * Generate a const enum mapping entity PascalCase names to logical names.
1388
+ *
1389
+ * @param entityNames - Array of entity logical names
1390
+ * @param options - Generator options
1391
+ * @returns TypeScript declaration string
1392
+ */
1393
+ declare function generateEntityNamesEnum(entityNames: string[], options?: EntityNamesGeneratorOptions): string;
1394
+
1395
+ /**
1396
+ * @xrmforge/typegen - Web API Helper Functions
1397
+ *
1398
+ * Lightweight utility functions for building OData query strings
1399
+ * with type-safe field names from generated Fields enums.
1400
+ *
1401
+ * Zero runtime overhead when used with const enums (values are inlined).
1402
+ *
1403
+ * @example
1404
+ * ```typescript
1405
+ * import { select } from '@xrmforge/typegen';
1406
+ *
1407
+ * Xrm.WebApi.retrieveRecord(ref.entityType, ref.id, select(
1408
+ * AccountFields.Name,
1409
+ * AccountFields.WebsiteUrl,
1410
+ * AccountFields.Address1Line1,
1411
+ * ));
1412
+ * ```
1413
+ */
1414
+ /**
1415
+ * Build an OData $select query string from field names.
1416
+ *
1417
+ * @param fields - Field names (use generated Fields enum for type safety)
1418
+ * @returns OData query string (e.g. "?$select=name,websiteurl,address1_line1")
1419
+ */
1420
+ declare function select(...fields: string[]): string;
1421
+ /**
1422
+ * Parse a lookup field from a Dataverse Web API response into a LookupValue.
1423
+ *
1424
+ * Dataverse returns lookups as `_fieldname_value` with OData annotations:
1425
+ * - `_fieldname_value` (GUID)
1426
+ * - `_fieldname_value@OData.Community.Display.V1.FormattedValue` (display name)
1427
+ * - `_fieldname_value@Microsoft.Dynamics.CRM.lookuplogicalname` (entity type)
1428
+ *
1429
+ * This function extracts all three into an `Xrm.LookupValue` object.
1430
+ *
1431
+ * @param response - The raw Web API response object
1432
+ * @param navigationProperty - Navigation property name (use NavigationProperties enum for type safety)
1433
+ * @returns Xrm.LookupValue or null if the lookup is empty
1434
+ *
1435
+ * @example
1436
+ * ```typescript
1437
+ * // Mit NavigationProperties-Enum (empfohlen, keine Raw-Strings):
1438
+ * parseLookup(result, AccountNav.Country);
1439
+ *
1440
+ * // Oder mit Navigation Property Name direkt:
1441
+ * parseLookup(result, 'markant_address1_countryid');
1442
+ * ```
1443
+ */
1444
+ declare function parseLookup(response: Record<string, unknown>, navigationProperty: string): {
1445
+ id: string;
1446
+ name: string;
1447
+ entityType: string;
1448
+ } | null;
1449
+ /**
1450
+ * Parse multiple lookup fields from a Dataverse Web API response at once.
1451
+ *
1452
+ * @param response - The raw Web API response object
1453
+ * @param navigationProperties - Navigation property names to parse
1454
+ * @returns Map of navigation property name to LookupValue (null entries omitted)
1455
+ *
1456
+ * @example
1457
+ * ```typescript
1458
+ * const lookups = parseLookups(result, ['markant_address1_countryid', 'parentaccountid']);
1459
+ * formContext.getAttribute(Fields.Country).setValue(
1460
+ * lookups.markant_address1_countryid ? [lookups.markant_address1_countryid] : null
1461
+ * );
1462
+ * ```
1463
+ */
1464
+ declare function parseLookups(response: Record<string, unknown>, navigationProperties: string[]): Record<string, {
1465
+ id: string;
1466
+ name: string;
1467
+ entityType: string;
1468
+ } | null>;
1469
+ /**
1470
+ * Get the formatted (display) value of any field from a Web API response.
1471
+ *
1472
+ * Works for OptionSets, Lookups, DateTimes, Money, and other formatted fields.
1473
+ *
1474
+ * @param response - The raw Web API response object
1475
+ * @param fieldName - The field logical name (e.g. "statecode", "createdon")
1476
+ * @returns The formatted string value, or null if not available
1477
+ *
1478
+ * @example
1479
+ * ```typescript
1480
+ * const status = parseFormattedValue(result, 'statecode');
1481
+ * // "Active" (statt 0)
1482
+ * ```
1483
+ */
1484
+ declare function parseFormattedValue(response: Record<string, unknown>, fieldName: string): string | null;
1485
+ /**
1486
+ * Build an OData $select and $expand query string.
1487
+ *
1488
+ * @param fields - Field names to select
1489
+ * @param expand - Navigation property to expand (optional)
1490
+ * @returns OData query string
1491
+ *
1492
+ * @example
1493
+ * ```typescript
1494
+ * Xrm.WebApi.retrieveRecord("account", id, selectExpand(
1495
+ * [AccountFields.Name, AccountFields.WebsiteUrl],
1496
+ * "primarycontactid($select=fullname,emailaddress1)"
1497
+ * ));
1498
+ * ```
1499
+ */
1500
+ declare function selectExpand(fields: string[], expand: string): string;
1501
+
1502
+ /**
1503
+ * @xrmforge/typegen - Xrm API Constants
1504
+ *
1505
+ * Const enums for all common Xrm string/number constants.
1506
+ * Eliminates raw strings in D365 form scripts.
1507
+ *
1508
+ * @types/xrm defines these as string literal types for compile-time checking,
1509
+ * but does NOT provide runtime constants (XrmEnum is not available at runtime).
1510
+ * These const enums are erased at compile time (zero runtime overhead).
1511
+ *
1512
+ * @example
1513
+ * ```typescript
1514
+ * // Statt Raw-String:
1515
+ * if (tab.getDisplayState() === 'expanded') { ... }
1516
+ *
1517
+ * // Mit XrmForge-Konstante:
1518
+ * if (tab.getDisplayState() === XrmConstants.DisplayState.Expanded) { ... }
1519
+ * ```
1520
+ */
1521
+ /** Tab/Section display state */
1522
+ declare const enum DisplayState {
1523
+ Expanded = "expanded",
1524
+ Collapsed = "collapsed"
1525
+ }
1526
+ /** Form notification level (formContext.ui.setFormNotification) */
1527
+ declare const enum FormNotificationLevel {
1528
+ Error = "ERROR",
1529
+ Warning = "WARNING",
1530
+ Info = "INFO"
1531
+ }
1532
+ /** Attribute required level (attribute.setRequiredLevel) */
1533
+ declare const enum RequiredLevel {
1534
+ None = "none",
1535
+ Required = "required",
1536
+ Recommended = "recommended"
1537
+ }
1538
+ /** Attribute submit mode (attribute.setSubmitMode) */
1539
+ declare const enum SubmitMode {
1540
+ Always = "always",
1541
+ Never = "never",
1542
+ Dirty = "dirty"
1543
+ }
1544
+ /** Save mode (eventArgs.getSaveMode()) */
1545
+ declare const enum SaveMode {
1546
+ Save = 1,
1547
+ SaveAndClose = 2,
1548
+ Deactivate = 5,
1549
+ Reactivate = 6,
1550
+ Send = 7,
1551
+ Disqualify = 15,
1552
+ Qualify = 16,
1553
+ Assign = 47,
1554
+ SaveAsCompleted = 58,
1555
+ SaveAndNew = 59,
1556
+ AutoSave = 70
1557
+ }
1558
+ /** Client type (Xrm.Utility.getGlobalContext().client.getClient()) */
1559
+ declare const enum ClientType {
1560
+ Web = "Web",
1561
+ Outlook = "Outlook",
1562
+ Mobile = "Mobile"
1563
+ }
1564
+ /** Client state (Xrm.Utility.getGlobalContext().client.getClientState()) */
1565
+ declare const enum ClientState {
1566
+ Online = "Online",
1567
+ Offline = "Offline"
1568
+ }
1569
+ /** Operation type for Xrm.WebApi.execute getMetadata().operationType */
1570
+ declare const enum OperationType {
1571
+ /** Custom Action or OOB Action (POST) */
1572
+ Action = 0,
1573
+ /** Custom Function or OOB Function (GET) */
1574
+ Function = 1,
1575
+ /** CRUD operation (Create, Retrieve, Update, Delete) */
1576
+ CRUD = 2
1577
+ }
1578
+ /** Structural property for getMetadata().parameterTypes[].structuralProperty */
1579
+ declare const enum StructuralProperty {
1580
+ Unknown = 0,
1581
+ PrimitiveType = 1,
1582
+ ComplexType = 2,
1583
+ EnumerationType = 3,
1584
+ Collection = 4,
1585
+ EntityType = 5
1586
+ }
1587
+ /** Binding type for Custom API definitions */
1588
+ declare const enum BindingType {
1589
+ /** Nicht an eine Entity gebunden (global aufrufbar) */
1590
+ Global = 0,
1591
+ /** An einen einzelnen Entity-Datensatz gebunden */
1592
+ Entity = 1,
1593
+ /** An eine Entity-Collection gebunden */
1594
+ EntityCollection = 2
1595
+ }
1596
+
1597
+ /**
1598
+ * @xrmforge/typegen - Action/Function Runtime Helpers
1599
+ *
1600
+ * Factory functions for type-safe Custom API execution.
1601
+ * These are imported by generated action/function modules.
1602
+ *
1603
+ * Design:
1604
+ * - `createBoundAction` / `createUnboundAction`: Produce executor objects
1605
+ * with `.execute()` (calls Xrm.WebApi) and `.request()` (for executeMultiple)
1606
+ * - `executeRequest`: Central execute wrapper (single place for the `as any` cast)
1607
+ * - `withProgress`: Convenience wrapper with progress indicator + error dialog
1608
+ *
1609
+ * @example
1610
+ * ```typescript
1611
+ * // Generated code (in generated/actions/quote.ts):
1612
+ * export const WinQuote = createBoundAction('markant_winquote', 'quote');
1613
+ *
1614
+ * // Developer code (in quote-form.ts):
1615
+ * import { WinQuote } from '../generated/actions/quote';
1616
+ * const response = await WinQuote.execute(recordId);
1617
+ * ```
1618
+ */
1619
+ /** Parameter metadata for getMetadata().parameterTypes */
1620
+ interface ParameterMeta {
1621
+ typeName: string;
1622
+ structuralProperty: number;
1623
+ }
1624
+ /** Map of parameter names to their OData metadata */
1625
+ type ParameterMetaMap = Record<string, ParameterMeta>;
1626
+ /** Executor for a bound action without additional parameters */
1627
+ interface BoundActionExecutor {
1628
+ execute(recordId: string): Promise<Response>;
1629
+ request(recordId: string): Record<string, unknown>;
1630
+ }
1631
+ /** Executor for a bound action with typed parameters */
1632
+ interface BoundActionWithParamsExecutor<TParams> {
1633
+ execute(recordId: string, params: TParams): Promise<Response>;
1634
+ request(recordId: string, params: TParams): Record<string, unknown>;
1635
+ }
1636
+ /** Executor for an unbound action without parameters */
1637
+ interface UnboundActionExecutor {
1638
+ execute(): Promise<Response>;
1639
+ request(): Record<string, unknown>;
1640
+ }
1641
+ /** Executor for an unbound action with typed parameters and optional typed response */
1642
+ interface UnboundActionWithParamsExecutor<TParams, TResult = void> {
1643
+ execute(params: TParams): Promise<TResult extends void ? Response : TResult>;
1644
+ request(params: TParams): Record<string, unknown>;
1645
+ }
1646
+ /** Executor for an unbound function with typed response */
1647
+ interface UnboundFunctionExecutor<TResult> {
1648
+ execute(): Promise<TResult>;
1649
+ request(): Record<string, unknown>;
1650
+ }
1651
+ /** Executor for a bound function with typed response */
1652
+ interface BoundFunctionExecutor<TResult> {
1653
+ execute(recordId: string): Promise<TResult>;
1654
+ request(recordId: string): Record<string, unknown>;
1655
+ }
1656
+ /**
1657
+ * Execute a single request via Xrm.WebApi.online.execute().
1658
+ *
1659
+ * This is the ONLY place in the entire framework where the `as any` cast happens.
1660
+ * All generated executors call this function internally.
1661
+ */
1662
+ declare function executeRequest(request: Record<string, unknown>): Promise<Response>;
1663
+ /**
1664
+ * Execute multiple requests via Xrm.WebApi.online.executeMultiple().
1665
+ *
1666
+ * @param requests - Array of request objects (from `.request()` factories).
1667
+ * Wrap a subset in an inner array for transactional changeset execution.
1668
+ */
1669
+ declare function executeMultiple(requests: Array<Record<string, unknown> | Array<Record<string, unknown>>>): Promise<Response[]>;
1670
+ /**
1671
+ * Create an executor for a bound action (entity-bound).
1672
+ *
1673
+ * @param operationName - Custom API unique name (e.g. "markant_winquote")
1674
+ * @param entityLogicalName - Entity logical name (e.g. "quote")
1675
+ */
1676
+ declare function createBoundAction(operationName: string, entityLogicalName: string): BoundActionExecutor;
1677
+ /**
1678
+ * Create an executor for a bound action with typed parameters.
1679
+ *
1680
+ * @param operationName - Custom API unique name
1681
+ * @param entityLogicalName - Entity logical name
1682
+ * @param paramMeta - Parameter metadata map (parameter name to OData type info)
1683
+ */
1684
+ declare function createBoundAction<TParams extends Record<string, unknown>>(operationName: string, entityLogicalName: string, paramMeta: ParameterMetaMap): BoundActionWithParamsExecutor<TParams>;
1685
+ /**
1686
+ * Create an executor for an unbound (global) action without parameters.
1687
+ *
1688
+ * @param operationName - Custom API unique name
1689
+ */
1690
+ declare function createUnboundAction(operationName: string): UnboundActionExecutor;
1691
+ /**
1692
+ * Create an executor for an unbound action with typed parameters and response.
1693
+ *
1694
+ * @param operationName - Custom API unique name
1695
+ * @param paramMeta - Parameter metadata map
1696
+ */
1697
+ declare function createUnboundAction<TParams extends Record<string, unknown>, TResult = void>(operationName: string, paramMeta: ParameterMetaMap): UnboundActionWithParamsExecutor<TParams, TResult>;
1698
+ /**
1699
+ * Create an executor for an unbound (global) function with typed response.
1700
+ *
1701
+ * @param operationName - Function name (e.g. "WhoAmI")
1702
+ */
1703
+ declare function createUnboundFunction<TResult>(operationName: string): UnboundFunctionExecutor<TResult>;
1704
+ /**
1705
+ * Create an executor for a bound function with typed response.
1706
+ *
1707
+ * @param operationName - Function name
1708
+ * @param entityLogicalName - Entity logical name
1709
+ */
1710
+ declare function createBoundFunction<TResult>(operationName: string, entityLogicalName: string): BoundFunctionExecutor<TResult>;
1711
+ /**
1712
+ * Execute an async operation with Xrm progress indicator.
1713
+ *
1714
+ * Shows a progress spinner before the operation, closes it after,
1715
+ * and shows an error dialog on failure.
1716
+ *
1717
+ * @param message - Progress indicator message (e.g. "Angebot wird gewonnen...")
1718
+ * @param operation - Async function to execute
1719
+ * @returns The result of the operation
1720
+ *
1721
+ * @example
1722
+ * ```typescript
1723
+ * await withProgress('Angebot wird gewonnen...', () => WinQuote.execute(recordId));
1724
+ * ```
1725
+ */
1726
+ declare function withProgress<T>(message: string, operation: () => Promise<T>): Promise<T>;
1727
+
1728
+ /**
1729
+ * @xrmforge/typegen - Action/Function Generator
1730
+ *
1731
+ * Generates TypeScript files for type-safe Custom API execution:
1732
+ * - .d.ts: Parameter/Response interfaces and executor types
1733
+ * - .ts: Runtime modules that import factory functions from @xrmforge/typegen
1734
+ *
1735
+ * Input: CustomApiTypeInfo[] (from fixture JSON or live Dataverse query)
1736
+ * Output: Grouped by entity (bound) or "global" (unbound)
1737
+ *
1738
+ * @example Generated output for markant_NormalizePhone (unbound action):
1739
+ * ```typescript
1740
+ * // global.d.ts
1741
+ * declare namespace XrmForge.Actions {
1742
+ * interface NormalizePhoneParams { Input: string; AllowSuspicious?: boolean; }
1743
+ * interface NormalizePhoneResult { Normalized: string; Status: number; Message: string; }
1744
+ * }
1745
+ *
1746
+ * // global.ts
1747
+ * import { createUnboundAction } from '@xrmforge/typegen';
1748
+ * export const NormalizePhone = createUnboundAction<...>('markant_NormalizePhone', { ... });
1749
+ * ```
1750
+ */
1751
+
1752
+ /** Options for action/function generation */
1753
+ interface ActionGeneratorOptions {
1754
+ /** Import path for @xrmforge/typegen (default: "@xrmforge/typegen") */
1755
+ importPath?: string;
1756
+ /** Namespace for generated types (default: "XrmForge.Actions" / "XrmForge.Functions") */
1757
+ actionsNamespace?: string;
1758
+ functionsNamespace?: string;
1759
+ }
1760
+ /**
1761
+ * Generate .d.ts content for a group of Custom APIs.
1762
+ *
1763
+ * @param apis - Custom APIs to generate (all in the same group: same entity or all global)
1764
+ * @param isFunction - true for functions namespace, false for actions
1765
+ * @param entityName - Entity name for bound APIs, undefined for global
1766
+ * @param options - Generator options
1767
+ */
1768
+ declare function generateActionDeclarations(apis: CustomApiTypeInfo[], isFunction: boolean, entityName?: string, options?: ActionGeneratorOptions): string;
1769
+ /**
1770
+ * Generate .ts content with runtime executors for a group of Custom APIs.
1771
+ *
1772
+ * @param apis - Custom APIs to generate
1773
+ * @param isFunction - true for functions, false for actions
1774
+ * @param options - Generator options
1775
+ */
1776
+ declare function generateActionModule(apis: CustomApiTypeInfo[], isFunction: boolean, options?: ActionGeneratorOptions): string;
1777
+ /** Group result: key is entity logical name or "global" for unbound */
1778
+ interface GroupedCustomApis {
1779
+ actions: Map<string, CustomApiTypeInfo[]>;
1780
+ functions: Map<string, CustomApiTypeInfo[]>;
1781
+ }
1782
+ /**
1783
+ * Group Custom APIs by entity (bound) or "global" (unbound),
1784
+ * and separate actions from functions.
1785
+ */
1786
+ declare function groupCustomApis(apis: CustomApiTypeInfo[]): GroupedCustomApis;
1787
+
1172
1788
  /**
1173
1789
  * @xrmforge/typegen - Orchestrator Types
1174
1790
  *
@@ -1193,6 +1809,10 @@ interface GenerateConfig {
1193
1809
  generateForms?: boolean;
1194
1810
  /** Whether to generate OptionSet enums (default: true) */
1195
1811
  generateOptionSets?: boolean;
1812
+ /** Whether to generate Custom API Action/Function executors (default: false) */
1813
+ generateActions?: boolean;
1814
+ /** Filter Custom APIs by uniquename prefix (e.g. "markant_"). Only APIs matching the prefix are generated. */
1815
+ actionsFilter?: string;
1196
1816
  /**
1197
1817
  * Whether to use metadata cache for faster re-generation.
1198
1818
  * @alpha Not yet implemented. Setting this to true will throw a ConfigError.
@@ -1226,7 +1846,7 @@ interface GeneratedFile {
1226
1846
  /** File content */
1227
1847
  content: string;
1228
1848
  /** Type of generated content */
1229
- type: 'entity' | 'optionset' | 'form';
1849
+ type: 'entity' | 'optionset' | 'form' | 'action';
1230
1850
  }
1231
1851
  /** Overall result of the generation process */
1232
1852
  interface GenerationResult {
@@ -1292,4 +1912,4 @@ declare class TypeGenerationOrchestrator {
1292
1912
  private getPicklistAttributes;
1293
1913
  }
1294
1914
 
1295
- export { ApiRequestError, type AttributeMetadata, type AuthConfig, type AuthMethod, AuthenticationError, type ClientCredentialsAuth, ConfigError, ConsoleLogSink, DEFAULT_LABEL_CONFIG, DataverseHttpClient, type DateTimeAttributeMetadata, type DecimalAttributeMetadata, type DeviceCodeAuth, type EntityGenerationResult, type EntityGeneratorOptions, type EntityMetadata, type EntityTypeInfo, ErrorCode, FastXmlParser, type FormControl, type FormGeneratorOptions, type FormSection, type FormTab, type GenerateConfig, type GeneratedFile, GenerationError, type GenerationResult, 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, generateEntityForms, generateEntityInterface, generateEntityOptionSets, generateEnumMembers, generateFormInterface, generateOptionSetEnum, getEntityPropertyType, getFormAttributeType, getFormControlType, getJSDocLabel, getLabelLanguagesParam, getPrimaryLabel, getSecondaryLabel, isLookupType, isRateLimitError, isXrmForgeError, labelToIdentifier, parseForm, shouldIncludeInEntityInterface, toLookupValueProperty, toPascalCase, toSafeIdentifier };
1915
+ export { type ActionGeneratorOptions, ApiRequestError, type AttributeMetadata, type AuthConfig, type AuthMethod, AuthenticationError, BindingType, type BoundActionExecutor, type BoundActionWithParamsExecutor, type BoundFunctionExecutor, type ClientCredentialsAuth, ClientState, ClientType, ConfigError, ConsoleLogSink, type CustomApiTypeInfo, DEFAULT_LABEL_CONFIG, DataverseHttpClient, type DateTimeAttributeMetadata, type DecimalAttributeMetadata, type DeviceCodeAuth, DisplayState, type EntityFieldsGeneratorOptions, type EntityGenerationResult, type EntityGeneratorOptions, type EntityMetadata, type EntityNamesGeneratorOptions, type EntityTypeInfo, ErrorCode, FastXmlParser, type FormControl, type FormGeneratorOptions, FormNotificationLevel, 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, OperationType, type OptionMetadata, type OptionSetGeneratorOptions, type OptionSetMetadata, type ParameterMeta, type ParameterMetaMap, type ParsedForm, type PicklistAttributeMetadata, RequiredLevel, SaveMode, SilentLogSink, type SolutionComponent, type StateAttributeMetadata, type StatusAttributeMetadata, type StringAttributeMetadata, StructuralProperty, SubmitMode, type SystemFormMetadata, TypeGenerationOrchestrator, type UnboundActionExecutor, type UnboundActionWithParamsExecutor, type UnboundFunctionExecutor, type XmlElement, type XmlParser, XrmForgeError, configureLogging, createBoundAction, createBoundFunction, createCredential, createLogger, createUnboundAction, createUnboundFunction, defaultXmlParser, disambiguateEnumMembers, executeMultiple, executeRequest, 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, parseFormattedValue, parseLookup, parseLookups, select, selectExpand, shouldIncludeInEntityInterface, toLookupValueProperty, toPascalCase, toSafeIdentifier, withProgress };