Skip to content
Magnus Gether Sørensen edited this page Aug 29, 2017 · 1 revision

XrmDefinitelyTyped works by querying CRM for metadata, which it can then generate typings for. The end point is located in XrmDefinitelyTyped.fs. Here two functions are called, retrieveRawState and generateFromRaw. The first fetches metadata from CRM, and the second generates typings based upon the metadata. These two methods can be stepped through, as to see what is called.

The rest of this section will describe the contents of each folder in the project.

Resources

This folder contains all typescript files used to generate the typings. These include the definitions of the API functions, which CRM defines.

Extensions

A general xrm.d.ts is defined, which contains common functions in the API, while the Extensions folder contains extensions to this general typings file. Interfaces are merged in TypeScript, thus a single interface can have multiple disjoint interfaces. This way each extension can be appended to the general file as needed.

Each extension has a name, which defines which version range i belongs to. The format is xrm_ext_FROM-TO.d.ts, where FROM and TO are version numbers. If either is left empty, it indicates that there is no limit to the number, thus it corresponds to everything below or above. Thus an extension is appended if the CRM version is in the range of the extension.

TypeScript

Contains helper methods and declarations, which help with the generation of the typescript files.

Crm

This folder contains helper methods. CrmAuth helps with authentication, CrmBaseHelper helps with querying CRM and CrmDataHelper extends CrmBaseHelper.

Interpretation

Contains interpreters, which translate the actual type into an intermediate type, which the rest of the program uses.

CreateTypeScript

Contains more elaborate functions than interpretation. Still translates the actual types into intermediate types.

Generation

Contains a mix of functions, will be renamed to logic. Uses the functions to actually get the metadata and generate the typings.

Commandline

Contains the functions necessary to handle commandline arguments in a maintainable fashion.