@xrmforge/typegen 0.5.1 → 0.6.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/LICENSE +21 -0
- package/MIGRATION.md +2 -2
- package/dist/helpers.d.ts +203 -0
- package/dist/helpers.js +120 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +2 -203
- package/package.json +70 -65
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 XrmForge Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/MIGRATION.md
CHANGED
|
@@ -87,7 +87,7 @@ var value = formContext.getAttribute("primarycontactid").getValue();
|
|
|
87
87
|
var id = value[0].id.replace("{","").replace("}","");
|
|
88
88
|
|
|
89
89
|
// After: use parseLookup from @xrmforge/typegen
|
|
90
|
-
import { parseLookup } from '@xrmforge/typegen';
|
|
90
|
+
import { parseLookup } from '@xrmforge/typegen/helpers';
|
|
91
91
|
const contact = parseLookup(form.getAttribute(Fields.PrimaryContactId));
|
|
92
92
|
if (contact) {
|
|
93
93
|
console.log(contact.id); // already clean GUID
|
|
@@ -102,7 +102,7 @@ Xrm.WebApi.retrieveMultipleRecords("account",
|
|
|
102
102
|
"?$select=name,revenue&$filter=statecode eq 0");
|
|
103
103
|
|
|
104
104
|
// After: use Fields enum for $select
|
|
105
|
-
import { select } from '@xrmforge/typegen';
|
|
105
|
+
import { select } from '@xrmforge/typegen/helpers';
|
|
106
106
|
import { AccountFields } from '../../typings/entities/account';
|
|
107
107
|
Xrm.WebApi.retrieveMultipleRecords("account",
|
|
108
108
|
`?$select=${select(AccountFields.Name, AccountFields.Revenue)}&$filter=statecode eq 0`);
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @xrmforge/typegen - Web API Helper Functions
|
|
3
|
+
*
|
|
4
|
+
* Lightweight utility functions for building OData query strings
|
|
5
|
+
* with type-safe field names from generated Fields enums.
|
|
6
|
+
*
|
|
7
|
+
* Zero runtime overhead when used with const enums (values are inlined).
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { select } from '@xrmforge/typegen';
|
|
12
|
+
*
|
|
13
|
+
* Xrm.WebApi.retrieveRecord(ref.entityType, ref.id, select(
|
|
14
|
+
* AccountFields.Name,
|
|
15
|
+
* AccountFields.WebsiteUrl,
|
|
16
|
+
* AccountFields.Address1Line1,
|
|
17
|
+
* ));
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Build an OData $select query string from field names.
|
|
22
|
+
*
|
|
23
|
+
* @param fields - Field names (use generated Fields enum for type safety)
|
|
24
|
+
* @returns OData query string (e.g. "?$select=name,websiteurl,address1_line1")
|
|
25
|
+
*/
|
|
26
|
+
declare function select(...fields: string[]): string;
|
|
27
|
+
/**
|
|
28
|
+
* Parse a lookup field from a Dataverse Web API response into a LookupValue.
|
|
29
|
+
*
|
|
30
|
+
* Dataverse returns lookups as `_fieldname_value` with OData annotations:
|
|
31
|
+
* - `_fieldname_value` (GUID)
|
|
32
|
+
* - `_fieldname_value@OData.Community.Display.V1.FormattedValue` (display name)
|
|
33
|
+
* - `_fieldname_value@Microsoft.Dynamics.CRM.lookuplogicalname` (entity type)
|
|
34
|
+
*
|
|
35
|
+
* This function extracts all three into an `Xrm.LookupValue` object.
|
|
36
|
+
*
|
|
37
|
+
* @param response - The raw Web API response object
|
|
38
|
+
* @param navigationProperty - Navigation property name (use NavigationProperties enum for type safety)
|
|
39
|
+
* @returns Xrm.LookupValue or null if the lookup is empty
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```typescript
|
|
43
|
+
* // Mit NavigationProperties-Enum (empfohlen, keine Raw-Strings):
|
|
44
|
+
* parseLookup(result, AccountNav.Country);
|
|
45
|
+
*
|
|
46
|
+
* // Oder mit Navigation Property Name direkt:
|
|
47
|
+
* parseLookup(result, 'markant_address1_countryid');
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
declare function parseLookup(response: Record<string, unknown>, navigationProperty: string): {
|
|
51
|
+
id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
entityType: string;
|
|
54
|
+
} | null;
|
|
55
|
+
/**
|
|
56
|
+
* Parse multiple lookup fields from a Dataverse Web API response at once.
|
|
57
|
+
*
|
|
58
|
+
* @param response - The raw Web API response object
|
|
59
|
+
* @param navigationProperties - Navigation property names to parse
|
|
60
|
+
* @returns Map of navigation property name to LookupValue (null entries omitted)
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const lookups = parseLookups(result, ['markant_address1_countryid', 'parentaccountid']);
|
|
65
|
+
* formContext.getAttribute(Fields.Country).setValue(
|
|
66
|
+
* lookups.markant_address1_countryid ? [lookups.markant_address1_countryid] : null
|
|
67
|
+
* );
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
declare function parseLookups(response: Record<string, unknown>, navigationProperties: string[]): Record<string, {
|
|
71
|
+
id: string;
|
|
72
|
+
name: string;
|
|
73
|
+
entityType: string;
|
|
74
|
+
} | null>;
|
|
75
|
+
/**
|
|
76
|
+
* Get the formatted (display) value of any field from a Web API response.
|
|
77
|
+
*
|
|
78
|
+
* Works for OptionSets, Lookups, DateTimes, Money, and other formatted fields.
|
|
79
|
+
*
|
|
80
|
+
* @param response - The raw Web API response object
|
|
81
|
+
* @param fieldName - The field logical name (e.g. "statecode", "createdon")
|
|
82
|
+
* @returns The formatted string value, or null if not available
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* const status = parseFormattedValue(result, 'statecode');
|
|
87
|
+
* // "Active" (statt 0)
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
declare function parseFormattedValue(response: Record<string, unknown>, fieldName: string): string | null;
|
|
91
|
+
/**
|
|
92
|
+
* Build an OData $select and $expand query string.
|
|
93
|
+
*
|
|
94
|
+
* @param fields - Field names to select
|
|
95
|
+
* @param expand - Navigation property to expand (optional)
|
|
96
|
+
* @returns OData query string
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* Xrm.WebApi.retrieveRecord("account", id, selectExpand(
|
|
101
|
+
* [AccountFields.Name, AccountFields.WebsiteUrl],
|
|
102
|
+
* "primarycontactid($select=fullname,emailaddress1)"
|
|
103
|
+
* ));
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
declare function selectExpand(fields: string[], expand: string): string;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @xrmforge/typegen - Xrm API Constants
|
|
110
|
+
*
|
|
111
|
+
* Const enums for all common Xrm string/number constants.
|
|
112
|
+
* Eliminates raw strings in D365 form scripts.
|
|
113
|
+
*
|
|
114
|
+
* @types/xrm defines these as string literal types for compile-time checking,
|
|
115
|
+
* but does NOT provide runtime constants (XrmEnum is not available at runtime).
|
|
116
|
+
* These const enums are erased at compile time (zero runtime overhead).
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* // Statt Raw-String:
|
|
121
|
+
* if (tab.getDisplayState() === 'expanded') { ... }
|
|
122
|
+
*
|
|
123
|
+
* // Mit XrmForge-Konstante:
|
|
124
|
+
* if (tab.getDisplayState() === XrmConstants.DisplayState.Expanded) { ... }
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
/** Tab/Section display state */
|
|
128
|
+
declare const enum DisplayState {
|
|
129
|
+
Expanded = "expanded",
|
|
130
|
+
Collapsed = "collapsed"
|
|
131
|
+
}
|
|
132
|
+
/** Form notification level (formContext.ui.setFormNotification) */
|
|
133
|
+
declare const enum FormNotificationLevel {
|
|
134
|
+
Error = "ERROR",
|
|
135
|
+
Warning = "WARNING",
|
|
136
|
+
Info = "INFO"
|
|
137
|
+
}
|
|
138
|
+
/** Attribute required level (attribute.setRequiredLevel) */
|
|
139
|
+
declare const enum RequiredLevel {
|
|
140
|
+
None = "none",
|
|
141
|
+
Required = "required",
|
|
142
|
+
Recommended = "recommended"
|
|
143
|
+
}
|
|
144
|
+
/** Attribute submit mode (attribute.setSubmitMode) */
|
|
145
|
+
declare const enum SubmitMode {
|
|
146
|
+
Always = "always",
|
|
147
|
+
Never = "never",
|
|
148
|
+
Dirty = "dirty"
|
|
149
|
+
}
|
|
150
|
+
/** Save mode (eventArgs.getSaveMode()) */
|
|
151
|
+
declare const enum SaveMode {
|
|
152
|
+
Save = 1,
|
|
153
|
+
SaveAndClose = 2,
|
|
154
|
+
Deactivate = 5,
|
|
155
|
+
Reactivate = 6,
|
|
156
|
+
Send = 7,
|
|
157
|
+
Disqualify = 15,
|
|
158
|
+
Qualify = 16,
|
|
159
|
+
Assign = 47,
|
|
160
|
+
SaveAsCompleted = 58,
|
|
161
|
+
SaveAndNew = 59,
|
|
162
|
+
AutoSave = 70
|
|
163
|
+
}
|
|
164
|
+
/** Client type (Xrm.Utility.getGlobalContext().client.getClient()) */
|
|
165
|
+
declare const enum ClientType {
|
|
166
|
+
Web = "Web",
|
|
167
|
+
Outlook = "Outlook",
|
|
168
|
+
Mobile = "Mobile"
|
|
169
|
+
}
|
|
170
|
+
/** Client state (Xrm.Utility.getGlobalContext().client.getClientState()) */
|
|
171
|
+
declare const enum ClientState {
|
|
172
|
+
Online = "Online",
|
|
173
|
+
Offline = "Offline"
|
|
174
|
+
}
|
|
175
|
+
/** Operation type for Xrm.WebApi.execute getMetadata().operationType */
|
|
176
|
+
declare const enum OperationType {
|
|
177
|
+
/** Custom Action or OOB Action (POST) */
|
|
178
|
+
Action = 0,
|
|
179
|
+
/** Custom Function or OOB Function (GET) */
|
|
180
|
+
Function = 1,
|
|
181
|
+
/** CRUD operation (Create, Retrieve, Update, Delete) */
|
|
182
|
+
CRUD = 2
|
|
183
|
+
}
|
|
184
|
+
/** Structural property for getMetadata().parameterTypes[].structuralProperty */
|
|
185
|
+
declare const enum StructuralProperty {
|
|
186
|
+
Unknown = 0,
|
|
187
|
+
PrimitiveType = 1,
|
|
188
|
+
ComplexType = 2,
|
|
189
|
+
EnumerationType = 3,
|
|
190
|
+
Collection = 4,
|
|
191
|
+
EntityType = 5
|
|
192
|
+
}
|
|
193
|
+
/** Binding type for Custom API definitions */
|
|
194
|
+
declare const enum BindingType {
|
|
195
|
+
/** Nicht an eine Entity gebunden (global aufrufbar) */
|
|
196
|
+
Global = 0,
|
|
197
|
+
/** An einen einzelnen Entity-Datensatz gebunden */
|
|
198
|
+
Entity = 1,
|
|
199
|
+
/** An eine Entity-Collection gebunden */
|
|
200
|
+
EntityCollection = 2
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export { BindingType, ClientState, ClientType, DisplayState, FormNotificationLevel, OperationType, RequiredLevel, SaveMode, StructuralProperty, SubmitMode, parseFormattedValue, parseLookup, parseLookups, select, selectExpand };
|
package/dist/helpers.js
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// src/generators/webapi-helpers.ts
|
|
2
|
+
function select(...fields) {
|
|
3
|
+
if (fields.length === 0) return "";
|
|
4
|
+
return `?$select=${fields.join(",")}`;
|
|
5
|
+
}
|
|
6
|
+
function parseLookup(response, navigationProperty) {
|
|
7
|
+
const key = `_${navigationProperty}_value`;
|
|
8
|
+
const id = response[key];
|
|
9
|
+
if (!id) return null;
|
|
10
|
+
return {
|
|
11
|
+
id,
|
|
12
|
+
name: response[`${key}@OData.Community.Display.V1.FormattedValue`] ?? "",
|
|
13
|
+
entityType: response[`${key}@Microsoft.Dynamics.CRM.lookuplogicalname`] ?? ""
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function parseLookups(response, navigationProperties) {
|
|
17
|
+
const result = {};
|
|
18
|
+
for (const prop of navigationProperties) {
|
|
19
|
+
result[prop] = parseLookup(response, prop);
|
|
20
|
+
}
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
function parseFormattedValue(response, fieldName) {
|
|
24
|
+
return response[`${fieldName}@OData.Community.Display.V1.FormattedValue`] ?? null;
|
|
25
|
+
}
|
|
26
|
+
function selectExpand(fields, expand) {
|
|
27
|
+
const parts = [];
|
|
28
|
+
if (fields.length > 0) parts.push(`$select=${fields.join(",")}`);
|
|
29
|
+
if (expand) parts.push(`$expand=${expand}`);
|
|
30
|
+
return parts.length > 0 ? `?${parts.join("&")}` : "";
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// src/generators/xrm-constants.ts
|
|
34
|
+
var DisplayState = /* @__PURE__ */ ((DisplayState2) => {
|
|
35
|
+
DisplayState2["Expanded"] = "expanded";
|
|
36
|
+
DisplayState2["Collapsed"] = "collapsed";
|
|
37
|
+
return DisplayState2;
|
|
38
|
+
})(DisplayState || {});
|
|
39
|
+
var FormNotificationLevel = /* @__PURE__ */ ((FormNotificationLevel2) => {
|
|
40
|
+
FormNotificationLevel2["Error"] = "ERROR";
|
|
41
|
+
FormNotificationLevel2["Warning"] = "WARNING";
|
|
42
|
+
FormNotificationLevel2["Info"] = "INFO";
|
|
43
|
+
return FormNotificationLevel2;
|
|
44
|
+
})(FormNotificationLevel || {});
|
|
45
|
+
var RequiredLevel = /* @__PURE__ */ ((RequiredLevel2) => {
|
|
46
|
+
RequiredLevel2["None"] = "none";
|
|
47
|
+
RequiredLevel2["Required"] = "required";
|
|
48
|
+
RequiredLevel2["Recommended"] = "recommended";
|
|
49
|
+
return RequiredLevel2;
|
|
50
|
+
})(RequiredLevel || {});
|
|
51
|
+
var SubmitMode = /* @__PURE__ */ ((SubmitMode2) => {
|
|
52
|
+
SubmitMode2["Always"] = "always";
|
|
53
|
+
SubmitMode2["Never"] = "never";
|
|
54
|
+
SubmitMode2["Dirty"] = "dirty";
|
|
55
|
+
return SubmitMode2;
|
|
56
|
+
})(SubmitMode || {});
|
|
57
|
+
var SaveMode = /* @__PURE__ */ ((SaveMode2) => {
|
|
58
|
+
SaveMode2[SaveMode2["Save"] = 1] = "Save";
|
|
59
|
+
SaveMode2[SaveMode2["SaveAndClose"] = 2] = "SaveAndClose";
|
|
60
|
+
SaveMode2[SaveMode2["Deactivate"] = 5] = "Deactivate";
|
|
61
|
+
SaveMode2[SaveMode2["Reactivate"] = 6] = "Reactivate";
|
|
62
|
+
SaveMode2[SaveMode2["Send"] = 7] = "Send";
|
|
63
|
+
SaveMode2[SaveMode2["Disqualify"] = 15] = "Disqualify";
|
|
64
|
+
SaveMode2[SaveMode2["Qualify"] = 16] = "Qualify";
|
|
65
|
+
SaveMode2[SaveMode2["Assign"] = 47] = "Assign";
|
|
66
|
+
SaveMode2[SaveMode2["SaveAsCompleted"] = 58] = "SaveAsCompleted";
|
|
67
|
+
SaveMode2[SaveMode2["SaveAndNew"] = 59] = "SaveAndNew";
|
|
68
|
+
SaveMode2[SaveMode2["AutoSave"] = 70] = "AutoSave";
|
|
69
|
+
return SaveMode2;
|
|
70
|
+
})(SaveMode || {});
|
|
71
|
+
var ClientType = /* @__PURE__ */ ((ClientType2) => {
|
|
72
|
+
ClientType2["Web"] = "Web";
|
|
73
|
+
ClientType2["Outlook"] = "Outlook";
|
|
74
|
+
ClientType2["Mobile"] = "Mobile";
|
|
75
|
+
return ClientType2;
|
|
76
|
+
})(ClientType || {});
|
|
77
|
+
var ClientState = /* @__PURE__ */ ((ClientState2) => {
|
|
78
|
+
ClientState2["Online"] = "Online";
|
|
79
|
+
ClientState2["Offline"] = "Offline";
|
|
80
|
+
return ClientState2;
|
|
81
|
+
})(ClientState || {});
|
|
82
|
+
var OperationType = /* @__PURE__ */ ((OperationType2) => {
|
|
83
|
+
OperationType2[OperationType2["Action"] = 0] = "Action";
|
|
84
|
+
OperationType2[OperationType2["Function"] = 1] = "Function";
|
|
85
|
+
OperationType2[OperationType2["CRUD"] = 2] = "CRUD";
|
|
86
|
+
return OperationType2;
|
|
87
|
+
})(OperationType || {});
|
|
88
|
+
var StructuralProperty = /* @__PURE__ */ ((StructuralProperty2) => {
|
|
89
|
+
StructuralProperty2[StructuralProperty2["Unknown"] = 0] = "Unknown";
|
|
90
|
+
StructuralProperty2[StructuralProperty2["PrimitiveType"] = 1] = "PrimitiveType";
|
|
91
|
+
StructuralProperty2[StructuralProperty2["ComplexType"] = 2] = "ComplexType";
|
|
92
|
+
StructuralProperty2[StructuralProperty2["EnumerationType"] = 3] = "EnumerationType";
|
|
93
|
+
StructuralProperty2[StructuralProperty2["Collection"] = 4] = "Collection";
|
|
94
|
+
StructuralProperty2[StructuralProperty2["EntityType"] = 5] = "EntityType";
|
|
95
|
+
return StructuralProperty2;
|
|
96
|
+
})(StructuralProperty || {});
|
|
97
|
+
var BindingType = /* @__PURE__ */ ((BindingType2) => {
|
|
98
|
+
BindingType2[BindingType2["Global"] = 0] = "Global";
|
|
99
|
+
BindingType2[BindingType2["Entity"] = 1] = "Entity";
|
|
100
|
+
BindingType2[BindingType2["EntityCollection"] = 2] = "EntityCollection";
|
|
101
|
+
return BindingType2;
|
|
102
|
+
})(BindingType || {});
|
|
103
|
+
export {
|
|
104
|
+
BindingType,
|
|
105
|
+
ClientState,
|
|
106
|
+
ClientType,
|
|
107
|
+
DisplayState,
|
|
108
|
+
FormNotificationLevel,
|
|
109
|
+
OperationType,
|
|
110
|
+
RequiredLevel,
|
|
111
|
+
SaveMode,
|
|
112
|
+
StructuralProperty,
|
|
113
|
+
SubmitMode,
|
|
114
|
+
parseFormattedValue,
|
|
115
|
+
parseLookup,
|
|
116
|
+
parseLookups,
|
|
117
|
+
select,
|
|
118
|
+
selectExpand
|
|
119
|
+
};
|
|
120
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/generators/webapi-helpers.ts","../src/generators/xrm-constants.ts"],"sourcesContent":["/**\r\n * @xrmforge/typegen - Web API Helper Functions\r\n *\r\n * Lightweight utility functions for building OData query strings\r\n * with type-safe field names from generated Fields enums.\r\n *\r\n * Zero runtime overhead when used with const enums (values are inlined).\r\n *\r\n * @example\r\n * ```typescript\r\n * import { select } from '@xrmforge/typegen';\r\n *\r\n * Xrm.WebApi.retrieveRecord(ref.entityType, ref.id, select(\r\n * AccountFields.Name,\r\n * AccountFields.WebsiteUrl,\r\n * AccountFields.Address1Line1,\r\n * ));\r\n * ```\r\n */\r\n\r\n/**\r\n * Build an OData $select query string from field names.\r\n *\r\n * @param fields - Field names (use generated Fields enum for type safety)\r\n * @returns OData query string (e.g. \"?$select=name,websiteurl,address1_line1\")\r\n */\r\nexport function select(...fields: string[]): string {\r\n if (fields.length === 0) return '';\r\n return `?$select=${fields.join(',')}`;\r\n}\r\n\r\n/**\r\n * Parse a lookup field from a Dataverse Web API response into a LookupValue.\r\n *\r\n * Dataverse returns lookups as `_fieldname_value` with OData annotations:\r\n * - `_fieldname_value` (GUID)\r\n * - `_fieldname_value@OData.Community.Display.V1.FormattedValue` (display name)\r\n * - `_fieldname_value@Microsoft.Dynamics.CRM.lookuplogicalname` (entity type)\r\n *\r\n * This function extracts all three into an `Xrm.LookupValue` object.\r\n *\r\n * @param response - The raw Web API response object\r\n * @param navigationProperty - Navigation property name (use NavigationProperties enum for type safety)\r\n * @returns Xrm.LookupValue or null if the lookup is empty\r\n *\r\n * @example\r\n * ```typescript\r\n * // Mit NavigationProperties-Enum (empfohlen, keine Raw-Strings):\r\n * parseLookup(result, AccountNav.Country);\r\n *\r\n * // Oder mit Navigation Property Name direkt:\r\n * parseLookup(result, 'markant_address1_countryid');\r\n * ```\r\n */\r\nexport function parseLookup(\r\n response: Record<string, unknown>,\r\n navigationProperty: string,\r\n): { id: string; name: string; entityType: string } | null {\r\n const key = `_${navigationProperty}_value`;\r\n const id = response[key] as string | undefined;\r\n if (!id) return null;\r\n\r\n return {\r\n id,\r\n name: (response[`${key}@OData.Community.Display.V1.FormattedValue`] as string) ?? '',\r\n entityType: (response[`${key}@Microsoft.Dynamics.CRM.lookuplogicalname`] as string) ?? '',\r\n };\r\n}\r\n\r\n/**\r\n * Parse multiple lookup fields from a Dataverse Web API response at once.\r\n *\r\n * @param response - The raw Web API response object\r\n * @param navigationProperties - Navigation property names to parse\r\n * @returns Map of navigation property name to LookupValue (null entries omitted)\r\n *\r\n * @example\r\n * ```typescript\r\n * const lookups = parseLookups(result, ['markant_address1_countryid', 'parentaccountid']);\r\n * formContext.getAttribute(Fields.Country).setValue(\r\n * lookups.markant_address1_countryid ? [lookups.markant_address1_countryid] : null\r\n * );\r\n * ```\r\n */\r\nexport function parseLookups(\r\n response: Record<string, unknown>,\r\n navigationProperties: string[],\r\n): Record<string, { id: string; name: string; entityType: string } | null> {\r\n const result: Record<string, { id: string; name: string; entityType: string } | null> = {};\r\n for (const prop of navigationProperties) {\r\n result[prop] = parseLookup(response, prop);\r\n }\r\n return result;\r\n}\r\n\r\n/**\r\n * Get the formatted (display) value of any field from a Web API response.\r\n *\r\n * Works for OptionSets, Lookups, DateTimes, Money, and other formatted fields.\r\n *\r\n * @param response - The raw Web API response object\r\n * @param fieldName - The field logical name (e.g. \"statecode\", \"createdon\")\r\n * @returns The formatted string value, or null if not available\r\n *\r\n * @example\r\n * ```typescript\r\n * const status = parseFormattedValue(result, 'statecode');\r\n * // \"Active\" (statt 0)\r\n * ```\r\n */\r\nexport function parseFormattedValue(\r\n response: Record<string, unknown>,\r\n fieldName: string,\r\n): string | null {\r\n return (response[`${fieldName}@OData.Community.Display.V1.FormattedValue`] as string) ?? null;\r\n}\r\n\r\n/**\r\n * Build an OData $select and $expand query string.\r\n *\r\n * @param fields - Field names to select\r\n * @param expand - Navigation property to expand (optional)\r\n * @returns OData query string\r\n *\r\n * @example\r\n * ```typescript\r\n * Xrm.WebApi.retrieveRecord(\"account\", id, selectExpand(\r\n * [AccountFields.Name, AccountFields.WebsiteUrl],\r\n * \"primarycontactid($select=fullname,emailaddress1)\"\r\n * ));\r\n * ```\r\n */\r\nexport function selectExpand(fields: string[], expand: string): string {\r\n const parts: string[] = [];\r\n if (fields.length > 0) parts.push(`$select=${fields.join(',')}`);\r\n if (expand) parts.push(`$expand=${expand}`);\r\n return parts.length > 0 ? `?${parts.join('&')}` : '';\r\n}\r\n","/**\r\n * @xrmforge/typegen - Xrm API Constants\r\n *\r\n * Const enums for all common Xrm string/number constants.\r\n * Eliminates raw strings in D365 form scripts.\r\n *\r\n * @types/xrm defines these as string literal types for compile-time checking,\r\n * but does NOT provide runtime constants (XrmEnum is not available at runtime).\r\n * These const enums are erased at compile time (zero runtime overhead).\r\n *\r\n * @example\r\n * ```typescript\r\n * // Statt Raw-String:\r\n * if (tab.getDisplayState() === 'expanded') { ... }\r\n *\r\n * // Mit XrmForge-Konstante:\r\n * if (tab.getDisplayState() === XrmConstants.DisplayState.Expanded) { ... }\r\n * ```\r\n */\r\n\r\n/** Tab/Section display state */\r\nexport const enum DisplayState {\r\n Expanded = 'expanded',\r\n Collapsed = 'collapsed',\r\n}\r\n\r\n// FormType: verwende XrmEnum.FormType aus @types/xrm (dort bereits als const enum definiert)\r\n\r\n/** Form notification level (formContext.ui.setFormNotification) */\r\nexport const enum FormNotificationLevel {\r\n Error = 'ERROR',\r\n Warning = 'WARNING',\r\n Info = 'INFO',\r\n}\r\n\r\n/** Attribute required level (attribute.setRequiredLevel) */\r\nexport const enum RequiredLevel {\r\n None = 'none',\r\n Required = 'required',\r\n Recommended = 'recommended',\r\n}\r\n\r\n/** Attribute submit mode (attribute.setSubmitMode) */\r\nexport const enum SubmitMode {\r\n Always = 'always',\r\n Never = 'never',\r\n Dirty = 'dirty',\r\n}\r\n\r\n/** Save mode (eventArgs.getSaveMode()) */\r\nexport const enum SaveMode {\r\n Save = 1,\r\n SaveAndClose = 2,\r\n Deactivate = 5,\r\n Reactivate = 6,\r\n Send = 7,\r\n Disqualify = 15,\r\n Qualify = 16,\r\n Assign = 47,\r\n SaveAsCompleted = 58,\r\n SaveAndNew = 59,\r\n AutoSave = 70,\r\n}\r\n\r\n/** Client type (Xrm.Utility.getGlobalContext().client.getClient()) */\r\nexport const enum ClientType {\r\n Web = 'Web',\r\n Outlook = 'Outlook',\r\n Mobile = 'Mobile',\r\n}\r\n\r\n/** Client state (Xrm.Utility.getGlobalContext().client.getClientState()) */\r\nexport const enum ClientState {\r\n Online = 'Online',\r\n Offline = 'Offline',\r\n}\r\n\r\n// ─── WebApi Execute Constants ───────────────────────────────────────────────\r\n\r\n/** Operation type for Xrm.WebApi.execute getMetadata().operationType */\r\nexport const enum OperationType {\r\n /** Custom Action or OOB Action (POST) */\r\n Action = 0,\r\n /** Custom Function or OOB Function (GET) */\r\n Function = 1,\r\n /** CRUD operation (Create, Retrieve, Update, Delete) */\r\n CRUD = 2,\r\n}\r\n\r\n/** Structural property for getMetadata().parameterTypes[].structuralProperty */\r\nexport const enum StructuralProperty {\r\n Unknown = 0,\r\n PrimitiveType = 1,\r\n ComplexType = 2,\r\n EnumerationType = 3,\r\n Collection = 4,\r\n EntityType = 5,\r\n}\r\n\r\n/** Binding type for Custom API definitions */\r\nexport const enum BindingType {\r\n /** Nicht an eine Entity gebunden (global aufrufbar) */\r\n Global = 0,\r\n /** An einen einzelnen Entity-Datensatz gebunden */\r\n Entity = 1,\r\n /** An eine Entity-Collection gebunden */\r\n EntityCollection = 2,\r\n}\r\n"],"mappings":"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","names":["DisplayState","FormNotificationLevel","RequiredLevel","SubmitMode","SaveMode","ClientType","ClientState","OperationType","StructuralProperty","BindingType"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TokenCredential } from '@azure/identity';
|
|
2
|
+
export { BindingType, ClientState, ClientType, DisplayState, FormNotificationLevel, OperationType, RequiredLevel, SaveMode, StructuralProperty, SubmitMode, parseFormattedValue, parseLookup, parseLookups, select, selectExpand } from './helpers.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* @xrmforge/typegen - Error Types
|
|
@@ -1451,208 +1452,6 @@ interface EntityNamesGeneratorOptions {
|
|
|
1451
1452
|
*/
|
|
1452
1453
|
declare function generateEntityNamesEnum(entityNames: string[], options?: EntityNamesGeneratorOptions): string;
|
|
1453
1454
|
|
|
1454
|
-
/**
|
|
1455
|
-
* @xrmforge/typegen - Web API Helper Functions
|
|
1456
|
-
*
|
|
1457
|
-
* Lightweight utility functions for building OData query strings
|
|
1458
|
-
* with type-safe field names from generated Fields enums.
|
|
1459
|
-
*
|
|
1460
|
-
* Zero runtime overhead when used with const enums (values are inlined).
|
|
1461
|
-
*
|
|
1462
|
-
* @example
|
|
1463
|
-
* ```typescript
|
|
1464
|
-
* import { select } from '@xrmforge/typegen';
|
|
1465
|
-
*
|
|
1466
|
-
* Xrm.WebApi.retrieveRecord(ref.entityType, ref.id, select(
|
|
1467
|
-
* AccountFields.Name,
|
|
1468
|
-
* AccountFields.WebsiteUrl,
|
|
1469
|
-
* AccountFields.Address1Line1,
|
|
1470
|
-
* ));
|
|
1471
|
-
* ```
|
|
1472
|
-
*/
|
|
1473
|
-
/**
|
|
1474
|
-
* Build an OData $select query string from field names.
|
|
1475
|
-
*
|
|
1476
|
-
* @param fields - Field names (use generated Fields enum for type safety)
|
|
1477
|
-
* @returns OData query string (e.g. "?$select=name,websiteurl,address1_line1")
|
|
1478
|
-
*/
|
|
1479
|
-
declare function select(...fields: string[]): string;
|
|
1480
|
-
/**
|
|
1481
|
-
* Parse a lookup field from a Dataverse Web API response into a LookupValue.
|
|
1482
|
-
*
|
|
1483
|
-
* Dataverse returns lookups as `_fieldname_value` with OData annotations:
|
|
1484
|
-
* - `_fieldname_value` (GUID)
|
|
1485
|
-
* - `_fieldname_value@OData.Community.Display.V1.FormattedValue` (display name)
|
|
1486
|
-
* - `_fieldname_value@Microsoft.Dynamics.CRM.lookuplogicalname` (entity type)
|
|
1487
|
-
*
|
|
1488
|
-
* This function extracts all three into an `Xrm.LookupValue` object.
|
|
1489
|
-
*
|
|
1490
|
-
* @param response - The raw Web API response object
|
|
1491
|
-
* @param navigationProperty - Navigation property name (use NavigationProperties enum for type safety)
|
|
1492
|
-
* @returns Xrm.LookupValue or null if the lookup is empty
|
|
1493
|
-
*
|
|
1494
|
-
* @example
|
|
1495
|
-
* ```typescript
|
|
1496
|
-
* // Mit NavigationProperties-Enum (empfohlen, keine Raw-Strings):
|
|
1497
|
-
* parseLookup(result, AccountNav.Country);
|
|
1498
|
-
*
|
|
1499
|
-
* // Oder mit Navigation Property Name direkt:
|
|
1500
|
-
* parseLookup(result, 'markant_address1_countryid');
|
|
1501
|
-
* ```
|
|
1502
|
-
*/
|
|
1503
|
-
declare function parseLookup(response: Record<string, unknown>, navigationProperty: string): {
|
|
1504
|
-
id: string;
|
|
1505
|
-
name: string;
|
|
1506
|
-
entityType: string;
|
|
1507
|
-
} | null;
|
|
1508
|
-
/**
|
|
1509
|
-
* Parse multiple lookup fields from a Dataverse Web API response at once.
|
|
1510
|
-
*
|
|
1511
|
-
* @param response - The raw Web API response object
|
|
1512
|
-
* @param navigationProperties - Navigation property names to parse
|
|
1513
|
-
* @returns Map of navigation property name to LookupValue (null entries omitted)
|
|
1514
|
-
*
|
|
1515
|
-
* @example
|
|
1516
|
-
* ```typescript
|
|
1517
|
-
* const lookups = parseLookups(result, ['markant_address1_countryid', 'parentaccountid']);
|
|
1518
|
-
* formContext.getAttribute(Fields.Country).setValue(
|
|
1519
|
-
* lookups.markant_address1_countryid ? [lookups.markant_address1_countryid] : null
|
|
1520
|
-
* );
|
|
1521
|
-
* ```
|
|
1522
|
-
*/
|
|
1523
|
-
declare function parseLookups(response: Record<string, unknown>, navigationProperties: string[]): Record<string, {
|
|
1524
|
-
id: string;
|
|
1525
|
-
name: string;
|
|
1526
|
-
entityType: string;
|
|
1527
|
-
} | null>;
|
|
1528
|
-
/**
|
|
1529
|
-
* Get the formatted (display) value of any field from a Web API response.
|
|
1530
|
-
*
|
|
1531
|
-
* Works for OptionSets, Lookups, DateTimes, Money, and other formatted fields.
|
|
1532
|
-
*
|
|
1533
|
-
* @param response - The raw Web API response object
|
|
1534
|
-
* @param fieldName - The field logical name (e.g. "statecode", "createdon")
|
|
1535
|
-
* @returns The formatted string value, or null if not available
|
|
1536
|
-
*
|
|
1537
|
-
* @example
|
|
1538
|
-
* ```typescript
|
|
1539
|
-
* const status = parseFormattedValue(result, 'statecode');
|
|
1540
|
-
* // "Active" (statt 0)
|
|
1541
|
-
* ```
|
|
1542
|
-
*/
|
|
1543
|
-
declare function parseFormattedValue(response: Record<string, unknown>, fieldName: string): string | null;
|
|
1544
|
-
/**
|
|
1545
|
-
* Build an OData $select and $expand query string.
|
|
1546
|
-
*
|
|
1547
|
-
* @param fields - Field names to select
|
|
1548
|
-
* @param expand - Navigation property to expand (optional)
|
|
1549
|
-
* @returns OData query string
|
|
1550
|
-
*
|
|
1551
|
-
* @example
|
|
1552
|
-
* ```typescript
|
|
1553
|
-
* Xrm.WebApi.retrieveRecord("account", id, selectExpand(
|
|
1554
|
-
* [AccountFields.Name, AccountFields.WebsiteUrl],
|
|
1555
|
-
* "primarycontactid($select=fullname,emailaddress1)"
|
|
1556
|
-
* ));
|
|
1557
|
-
* ```
|
|
1558
|
-
*/
|
|
1559
|
-
declare function selectExpand(fields: string[], expand: string): string;
|
|
1560
|
-
|
|
1561
|
-
/**
|
|
1562
|
-
* @xrmforge/typegen - Xrm API Constants
|
|
1563
|
-
*
|
|
1564
|
-
* Const enums for all common Xrm string/number constants.
|
|
1565
|
-
* Eliminates raw strings in D365 form scripts.
|
|
1566
|
-
*
|
|
1567
|
-
* @types/xrm defines these as string literal types for compile-time checking,
|
|
1568
|
-
* but does NOT provide runtime constants (XrmEnum is not available at runtime).
|
|
1569
|
-
* These const enums are erased at compile time (zero runtime overhead).
|
|
1570
|
-
*
|
|
1571
|
-
* @example
|
|
1572
|
-
* ```typescript
|
|
1573
|
-
* // Statt Raw-String:
|
|
1574
|
-
* if (tab.getDisplayState() === 'expanded') { ... }
|
|
1575
|
-
*
|
|
1576
|
-
* // Mit XrmForge-Konstante:
|
|
1577
|
-
* if (tab.getDisplayState() === XrmConstants.DisplayState.Expanded) { ... }
|
|
1578
|
-
* ```
|
|
1579
|
-
*/
|
|
1580
|
-
/** Tab/Section display state */
|
|
1581
|
-
declare const enum DisplayState {
|
|
1582
|
-
Expanded = "expanded",
|
|
1583
|
-
Collapsed = "collapsed"
|
|
1584
|
-
}
|
|
1585
|
-
/** Form notification level (formContext.ui.setFormNotification) */
|
|
1586
|
-
declare const enum FormNotificationLevel {
|
|
1587
|
-
Error = "ERROR",
|
|
1588
|
-
Warning = "WARNING",
|
|
1589
|
-
Info = "INFO"
|
|
1590
|
-
}
|
|
1591
|
-
/** Attribute required level (attribute.setRequiredLevel) */
|
|
1592
|
-
declare const enum RequiredLevel {
|
|
1593
|
-
None = "none",
|
|
1594
|
-
Required = "required",
|
|
1595
|
-
Recommended = "recommended"
|
|
1596
|
-
}
|
|
1597
|
-
/** Attribute submit mode (attribute.setSubmitMode) */
|
|
1598
|
-
declare const enum SubmitMode {
|
|
1599
|
-
Always = "always",
|
|
1600
|
-
Never = "never",
|
|
1601
|
-
Dirty = "dirty"
|
|
1602
|
-
}
|
|
1603
|
-
/** Save mode (eventArgs.getSaveMode()) */
|
|
1604
|
-
declare const enum SaveMode {
|
|
1605
|
-
Save = 1,
|
|
1606
|
-
SaveAndClose = 2,
|
|
1607
|
-
Deactivate = 5,
|
|
1608
|
-
Reactivate = 6,
|
|
1609
|
-
Send = 7,
|
|
1610
|
-
Disqualify = 15,
|
|
1611
|
-
Qualify = 16,
|
|
1612
|
-
Assign = 47,
|
|
1613
|
-
SaveAsCompleted = 58,
|
|
1614
|
-
SaveAndNew = 59,
|
|
1615
|
-
AutoSave = 70
|
|
1616
|
-
}
|
|
1617
|
-
/** Client type (Xrm.Utility.getGlobalContext().client.getClient()) */
|
|
1618
|
-
declare const enum ClientType {
|
|
1619
|
-
Web = "Web",
|
|
1620
|
-
Outlook = "Outlook",
|
|
1621
|
-
Mobile = "Mobile"
|
|
1622
|
-
}
|
|
1623
|
-
/** Client state (Xrm.Utility.getGlobalContext().client.getClientState()) */
|
|
1624
|
-
declare const enum ClientState {
|
|
1625
|
-
Online = "Online",
|
|
1626
|
-
Offline = "Offline"
|
|
1627
|
-
}
|
|
1628
|
-
/** Operation type for Xrm.WebApi.execute getMetadata().operationType */
|
|
1629
|
-
declare const enum OperationType {
|
|
1630
|
-
/** Custom Action or OOB Action (POST) */
|
|
1631
|
-
Action = 0,
|
|
1632
|
-
/** Custom Function or OOB Function (GET) */
|
|
1633
|
-
Function = 1,
|
|
1634
|
-
/** CRUD operation (Create, Retrieve, Update, Delete) */
|
|
1635
|
-
CRUD = 2
|
|
1636
|
-
}
|
|
1637
|
-
/** Structural property for getMetadata().parameterTypes[].structuralProperty */
|
|
1638
|
-
declare const enum StructuralProperty {
|
|
1639
|
-
Unknown = 0,
|
|
1640
|
-
PrimitiveType = 1,
|
|
1641
|
-
ComplexType = 2,
|
|
1642
|
-
EnumerationType = 3,
|
|
1643
|
-
Collection = 4,
|
|
1644
|
-
EntityType = 5
|
|
1645
|
-
}
|
|
1646
|
-
/** Binding type for Custom API definitions */
|
|
1647
|
-
declare const enum BindingType {
|
|
1648
|
-
/** Nicht an eine Entity gebunden (global aufrufbar) */
|
|
1649
|
-
Global = 0,
|
|
1650
|
-
/** An einen einzelnen Entity-Datensatz gebunden */
|
|
1651
|
-
Entity = 1,
|
|
1652
|
-
/** An eine Entity-Collection gebunden */
|
|
1653
|
-
EntityCollection = 2
|
|
1654
|
-
}
|
|
1655
|
-
|
|
1656
1455
|
/**
|
|
1657
1456
|
* @xrmforge/typegen - Action/Function Runtime Helpers
|
|
1658
1457
|
*
|
|
@@ -2001,4 +1800,4 @@ declare class TypeGenerationOrchestrator {
|
|
|
2001
1800
|
private getPicklistAttributes;
|
|
2002
1801
|
}
|
|
2003
1802
|
|
|
2004
|
-
export { type ActionGeneratorOptions, ApiRequestError, type AttributeMetadata, type AuthConfig, type AuthMethod, AuthenticationError,
|
|
1803
|
+
export { type ActionGeneratorOptions, ApiRequestError, type AttributeMetadata, type AuthConfig, type AuthMethod, AuthenticationError, type BoundActionExecutor, type BoundActionWithParamsExecutor, type BoundFunctionExecutor, 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 ParameterMeta, type ParameterMetaMap, type ParsedForm, type PicklistAttributeMetadata, SilentLogSink, type SolutionComponent, type StateAttributeMetadata, type StatusAttributeMetadata, type StringAttributeMetadata, 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, shouldIncludeInEntityInterface, toLookupValueProperty, toPascalCase, toSafeIdentifier, withProgress };
|
package/package.json
CHANGED
|
@@ -1,65 +1,70 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@xrmforge/typegen",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "TypeScript declaration generator for Dynamics 365 / Dataverse",
|
|
5
|
-
"keywords": [
|
|
6
|
-
"dynamics-365",
|
|
7
|
-
"typescript",
|
|
8
|
-
"xrm",
|
|
9
|
-
"dataverse",
|
|
10
|
-
"type-generator",
|
|
11
|
-
"declaration-files"
|
|
12
|
-
],
|
|
13
|
-
"license": "MIT",
|
|
14
|
-
"author": "XrmForge Contributors",
|
|
15
|
-
"homepage": "https://github.com/juergenbeck/XrmForge/tree/main/packages/typegen",
|
|
16
|
-
"repository": {
|
|
17
|
-
"type": "git",
|
|
18
|
-
"url": "https://github.com/juergenbeck/XrmForge.git",
|
|
19
|
-
"directory": "packages/typegen"
|
|
20
|
-
},
|
|
21
|
-
"bugs": {
|
|
22
|
-
"url": "https://github.com/juergenbeck/XrmForge/issues"
|
|
23
|
-
},
|
|
24
|
-
"type": "module",
|
|
25
|
-
"main": "./dist/index.js",
|
|
26
|
-
"types": "./dist/index.d.ts",
|
|
27
|
-
"exports": {
|
|
28
|
-
".": {
|
|
29
|
-
"types": "./dist/index.d.ts",
|
|
30
|
-
"import": "./dist/index.js",
|
|
31
|
-
"default": "./dist/index.js"
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
},
|
|
48
|
-
"
|
|
49
|
-
"@
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@xrmforge/typegen",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "TypeScript declaration generator for Dynamics 365 / Dataverse",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"dynamics-365",
|
|
7
|
+
"typescript",
|
|
8
|
+
"xrm",
|
|
9
|
+
"dataverse",
|
|
10
|
+
"type-generator",
|
|
11
|
+
"declaration-files"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": "XrmForge Contributors",
|
|
15
|
+
"homepage": "https://github.com/juergenbeck/XrmForge/tree/main/packages/typegen",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/juergenbeck/XrmForge.git",
|
|
19
|
+
"directory": "packages/typegen"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/juergenbeck/XrmForge/issues"
|
|
23
|
+
},
|
|
24
|
+
"type": "module",
|
|
25
|
+
"main": "./dist/index.js",
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
30
|
+
"import": "./dist/index.js",
|
|
31
|
+
"default": "./dist/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./helpers": {
|
|
34
|
+
"types": "./dist/helpers.d.ts",
|
|
35
|
+
"import": "./dist/helpers.js",
|
|
36
|
+
"default": "./dist/helpers.js"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"dist",
|
|
41
|
+
"MIGRATION.md"
|
|
42
|
+
],
|
|
43
|
+
"sideEffects": false,
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@azure/identity": "^4.6.0",
|
|
46
|
+
"fast-xml-parser": "^5.5.9"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/node": "^22.0.0",
|
|
50
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
51
|
+
"tsup": "^8.3.0",
|
|
52
|
+
"typescript": "^5.7.0",
|
|
53
|
+
"vitest": "^3.0.0"
|
|
54
|
+
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"@types/xrm": ">=9.0.0"
|
|
57
|
+
},
|
|
58
|
+
"engines": {
|
|
59
|
+
"node": ">=20.0.0"
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "tsup",
|
|
63
|
+
"dev": "tsup --watch",
|
|
64
|
+
"test": "vitest run",
|
|
65
|
+
"test:watch": "vitest",
|
|
66
|
+
"typecheck": "tsc --noEmit",
|
|
67
|
+
"lint": "eslint src/",
|
|
68
|
+
"clean": "rm -rf dist"
|
|
69
|
+
}
|
|
70
|
+
}
|