@mcp-consultant-tools/powerplatform-core 26.0.0-beta.2

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.
Files changed (153) hide show
  1. package/build/auth/index.d.ts +64 -0
  2. package/build/auth/index.d.ts.map +1 -0
  3. package/build/auth/index.js +39 -0
  4. package/build/auth/index.js.map +1 -0
  5. package/build/auth/interactive-auth.d.ts +60 -0
  6. package/build/auth/interactive-auth.d.ts.map +1 -0
  7. package/build/auth/interactive-auth.js +429 -0
  8. package/build/auth/interactive-auth.js.map +1 -0
  9. package/build/auth/service-principal-auth.d.ts +26 -0
  10. package/build/auth/service-principal-auth.d.ts.map +1 -0
  11. package/build/auth/service-principal-auth.js +60 -0
  12. package/build/auth/service-principal-auth.js.map +1 -0
  13. package/build/auth/token-cache.d.ts +40 -0
  14. package/build/auth/token-cache.d.ts.map +1 -0
  15. package/build/auth/token-cache.js +108 -0
  16. package/build/auth/token-cache.js.map +1 -0
  17. package/build/client/PowerPlatformClient.d.ts +78 -0
  18. package/build/client/PowerPlatformClient.d.ts.map +1 -0
  19. package/build/client/PowerPlatformClient.js +198 -0
  20. package/build/client/PowerPlatformClient.js.map +1 -0
  21. package/build/client/index.d.ts +6 -0
  22. package/build/client/index.d.ts.map +1 -0
  23. package/build/client/index.js +6 -0
  24. package/build/client/index.js.map +1 -0
  25. package/build/client/types.d.ts +300 -0
  26. package/build/client/types.d.ts.map +1 -0
  27. package/build/client/types.js +5 -0
  28. package/build/client/types.js.map +1 -0
  29. package/build/index.d.ts +36 -0
  30. package/build/index.d.ts.map +1 -0
  31. package/build/index.js +55 -0
  32. package/build/index.js.map +1 -0
  33. package/build/services/AppManagementService.d.ts +95 -0
  34. package/build/services/AppManagementService.d.ts.map +1 -0
  35. package/build/services/AppManagementService.js +322 -0
  36. package/build/services/AppManagementService.js.map +1 -0
  37. package/build/services/AppService.d.ts +39 -0
  38. package/build/services/AppService.d.ts.map +1 -0
  39. package/build/services/AppService.js +173 -0
  40. package/build/services/AppService.js.map +1 -0
  41. package/build/services/AttributeService.d.ts +28 -0
  42. package/build/services/AttributeService.d.ts.map +1 -0
  43. package/build/services/AttributeService.js +86 -0
  44. package/build/services/AttributeService.js.map +1 -0
  45. package/build/services/BusinessRuleService.d.ts +22 -0
  46. package/build/services/BusinessRuleService.d.ts.map +1 -0
  47. package/build/services/BusinessRuleService.js +85 -0
  48. package/build/services/BusinessRuleService.js.map +1 -0
  49. package/build/services/DataService.d.ts +53 -0
  50. package/build/services/DataService.d.ts.map +1 -0
  51. package/build/services/DataService.js +204 -0
  52. package/build/services/DataService.js.map +1 -0
  53. package/build/services/DependencyService.d.ts +27 -0
  54. package/build/services/DependencyService.d.ts.map +1 -0
  55. package/build/services/DependencyService.js +47 -0
  56. package/build/services/DependencyService.js.map +1 -0
  57. package/build/services/EntityService.d.ts +42 -0
  58. package/build/services/EntityService.d.ts.map +1 -0
  59. package/build/services/EntityService.js +132 -0
  60. package/build/services/EntityService.js.map +1 -0
  61. package/build/services/FlowService.d.ts +55 -0
  62. package/build/services/FlowService.d.ts.map +1 -0
  63. package/build/services/FlowService.js +608 -0
  64. package/build/services/FlowService.js.map +1 -0
  65. package/build/services/FormService.d.ts +36 -0
  66. package/build/services/FormService.d.ts.map +1 -0
  67. package/build/services/FormService.js +55 -0
  68. package/build/services/FormService.js.map +1 -0
  69. package/build/services/MetadataService.d.ts +63 -0
  70. package/build/services/MetadataService.d.ts.map +1 -0
  71. package/build/services/MetadataService.js +176 -0
  72. package/build/services/MetadataService.js.map +1 -0
  73. package/build/services/OptionSetService.d.ts +40 -0
  74. package/build/services/OptionSetService.d.ts.map +1 -0
  75. package/build/services/OptionSetService.js +91 -0
  76. package/build/services/OptionSetService.js.map +1 -0
  77. package/build/services/PluginDeploymentService.d.ts +102 -0
  78. package/build/services/PluginDeploymentService.d.ts.map +1 -0
  79. package/build/services/PluginDeploymentService.js +412 -0
  80. package/build/services/PluginDeploymentService.js.map +1 -0
  81. package/build/services/PluginService.d.ts +61 -0
  82. package/build/services/PluginService.d.ts.map +1 -0
  83. package/build/services/PluginService.js +289 -0
  84. package/build/services/PluginService.js.map +1 -0
  85. package/build/services/PublishingService.d.ts +37 -0
  86. package/build/services/PublishingService.d.ts.map +1 -0
  87. package/build/services/PublishingService.js +65 -0
  88. package/build/services/PublishingService.js.map +1 -0
  89. package/build/services/RelationshipService.d.ts +29 -0
  90. package/build/services/RelationshipService.d.ts.map +1 -0
  91. package/build/services/RelationshipService.js +46 -0
  92. package/build/services/RelationshipService.js.map +1 -0
  93. package/build/services/SolutionService.d.ts +60 -0
  94. package/build/services/SolutionService.d.ts.map +1 -0
  95. package/build/services/SolutionService.js +125 -0
  96. package/build/services/SolutionService.js.map +1 -0
  97. package/build/services/ValidationService.d.ts +31 -0
  98. package/build/services/ValidationService.d.ts.map +1 -0
  99. package/build/services/ValidationService.js +391 -0
  100. package/build/services/ValidationService.js.map +1 -0
  101. package/build/services/ViewService.d.ts +36 -0
  102. package/build/services/ViewService.d.ts.map +1 -0
  103. package/build/services/ViewService.js +55 -0
  104. package/build/services/ViewService.js.map +1 -0
  105. package/build/services/WebResourceService.d.ts +40 -0
  106. package/build/services/WebResourceService.d.ts.map +1 -0
  107. package/build/services/WebResourceService.js +64 -0
  108. package/build/services/WebResourceService.js.map +1 -0
  109. package/build/services/WorkflowManagementService.d.ts +157 -0
  110. package/build/services/WorkflowManagementService.d.ts.map +1 -0
  111. package/build/services/WorkflowManagementService.js +567 -0
  112. package/build/services/WorkflowManagementService.js.map +1 -0
  113. package/build/services/WorkflowService.d.ts +28 -0
  114. package/build/services/WorkflowService.d.ts.map +1 -0
  115. package/build/services/WorkflowService.js +285 -0
  116. package/build/services/WorkflowService.js.map +1 -0
  117. package/build/services/index.d.ts +29 -0
  118. package/build/services/index.d.ts.map +1 -0
  119. package/build/services/index.js +31 -0
  120. package/build/services/index.js.map +1 -0
  121. package/build/utils/auditLogger.d.ts +76 -0
  122. package/build/utils/auditLogger.d.ts.map +1 -0
  123. package/build/utils/auditLogger.js +110 -0
  124. package/build/utils/auditLogger.js.map +1 -0
  125. package/build/utils/best-practices-formatters.d.ts +26 -0
  126. package/build/utils/best-practices-formatters.d.ts.map +1 -0
  127. package/build/utils/best-practices-formatters.js +238 -0
  128. package/build/utils/best-practices-formatters.js.map +1 -0
  129. package/build/utils/bestPractices.d.ts +150 -0
  130. package/build/utils/bestPractices.d.ts.map +1 -0
  131. package/build/utils/bestPractices.js +324 -0
  132. package/build/utils/bestPractices.js.map +1 -0
  133. package/build/utils/iconManager.d.ts +84 -0
  134. package/build/utils/iconManager.d.ts.map +1 -0
  135. package/build/utils/iconManager.js +338 -0
  136. package/build/utils/iconManager.js.map +1 -0
  137. package/build/utils/index.d.ts +11 -0
  138. package/build/utils/index.d.ts.map +1 -0
  139. package/build/utils/index.js +18 -0
  140. package/build/utils/index.js.map +1 -0
  141. package/build/utils/prompt-templates.d.ts +9 -0
  142. package/build/utils/prompt-templates.d.ts.map +1 -0
  143. package/build/utils/prompt-templates.js +31 -0
  144. package/build/utils/prompt-templates.js.map +1 -0
  145. package/build/utils/publisherConfig.d.ts +33 -0
  146. package/build/utils/publisherConfig.d.ts.map +1 -0
  147. package/build/utils/publisherConfig.js +54 -0
  148. package/build/utils/publisherConfig.js.map +1 -0
  149. package/build/utils/rate-limiter.d.ts +108 -0
  150. package/build/utils/rate-limiter.d.ts.map +1 -0
  151. package/build/utils/rate-limiter.js +242 -0
  152. package/build/utils/rate-limiter.js.map +1 -0
  153. package/package.json +65 -0
@@ -0,0 +1,86 @@
1
+ /**
2
+ * AttributeService
3
+ *
4
+ * Service for attribute (column) customization operations.
5
+ * Note: This service should only be used by powerplatform-customization package.
6
+ */
7
+ import { bestPracticesValidator } from '../utils/bestPractices.js';
8
+ import { rateLimiter } from '../utils/rate-limiter.js';
9
+ export class AttributeService {
10
+ client;
11
+ constructor(client) {
12
+ this.client = client;
13
+ }
14
+ /**
15
+ * Create a new attribute on an entity
16
+ */
17
+ async createAttribute(entityLogicalName, attributeDefinition, solutionUniqueName) {
18
+ // Validate attribute name against best practices
19
+ const schemaName = attributeDefinition.SchemaName ||
20
+ attributeDefinition.LogicalName;
21
+ const isLookup = attributeDefinition['@odata.type'] ===
22
+ 'Microsoft.Dynamics.CRM.LookupAttributeMetadata';
23
+ const nameValidation = bestPracticesValidator.validateAttributeName(schemaName, isLookup);
24
+ if (!nameValidation.isValid) {
25
+ throw new Error(`Attribute name validation failed: ${nameValidation.issues.join(', ')}`);
26
+ }
27
+ // Validate boolean usage (best practice is to avoid booleans)
28
+ const isBoolean = attributeDefinition['@odata.type'] ===
29
+ 'Microsoft.Dynamics.CRM.BooleanAttributeMetadata';
30
+ if (isBoolean) {
31
+ bestPracticesValidator.validateBooleanUsage('Boolean', schemaName);
32
+ }
33
+ const headers = {};
34
+ if (solutionUniqueName) {
35
+ headers['MSCRM.SolutionUniqueName'] = solutionUniqueName;
36
+ }
37
+ // Execute with rate limiting
38
+ return rateLimiter.execute(async () => {
39
+ return this.client.makeRequest(`api/data/v9.2/EntityDefinitions(LogicalName='${entityLogicalName}')/Attributes`, 'POST', attributeDefinition, headers);
40
+ });
41
+ }
42
+ /**
43
+ * Update an existing attribute
44
+ */
45
+ async updateAttribute(entityLogicalName, attributeLogicalName, updates, getEntityAttribute, solutionUniqueName) {
46
+ const headers = {
47
+ 'MSCRM.MergeLabels': 'true',
48
+ };
49
+ if (solutionUniqueName) {
50
+ headers['MSCRM.SolutionUniqueName'] = solutionUniqueName;
51
+ }
52
+ // First, get the existing attribute to retrieve its @odata.type and merge updates
53
+ const existingAttribute = await getEntityAttribute(entityLogicalName, attributeLogicalName);
54
+ // Merge the updates with required fields
55
+ const payload = {
56
+ ...updates,
57
+ '@odata.type': existingAttribute['@odata.type'],
58
+ LogicalName: attributeLogicalName,
59
+ AttributeType: existingAttribute.AttributeType,
60
+ };
61
+ await this.client.makeRequest(`api/data/v9.2/EntityDefinitions(LogicalName='${entityLogicalName}')/Attributes(LogicalName='${attributeLogicalName}')`, 'PUT', payload, headers);
62
+ }
63
+ /**
64
+ * Delete an attribute
65
+ */
66
+ async deleteAttribute(entityLogicalName, attributeMetadataId) {
67
+ await this.client.makeRequest(`api/data/v9.2/EntityDefinitions(LogicalName='${entityLogicalName}')/Attributes(${attributeMetadataId})`, 'DELETE');
68
+ }
69
+ /**
70
+ * Create a picklist attribute using a global option set
71
+ */
72
+ async createGlobalOptionSetAttribute(entityLogicalName, attributeDefinition, solutionUniqueName) {
73
+ const headers = {};
74
+ if (solutionUniqueName) {
75
+ headers['MSCRM.SolutionUniqueName'] = solutionUniqueName;
76
+ }
77
+ // Ensure the attribute is of type PicklistAttributeMetadata with GlobalOptionSet
78
+ const definition = { ...attributeDefinition };
79
+ if (!definition['@odata.type']) {
80
+ definition['@odata.type'] =
81
+ 'Microsoft.Dynamics.CRM.PicklistAttributeMetadata';
82
+ }
83
+ return this.client.makeRequest(`api/data/v9.2/EntityDefinitions(LogicalName='${entityLogicalName}')/Attributes`, 'POST', definition, headers);
84
+ }
85
+ }
86
+ //# sourceMappingURL=AttributeService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AttributeService.js","sourceRoot":"","sources":["../../src/services/AttributeService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,OAAO,gBAAgB;IACP;IAApB,YAAoB,MAA2B;QAA3B,WAAM,GAAN,MAAM,CAAqB;IAAG,CAAC;IAEnD;;OAEG;IACH,KAAK,CAAC,eAAe,CACnB,iBAAyB,EACzB,mBAA4C,EAC5C,kBAA2B;QAE3B,iDAAiD;QACjD,MAAM,UAAU,GACb,mBAAmB,CAAC,UAAqB;YACzC,mBAAmB,CAAC,WAAsB,CAAC;QAC9C,MAAM,QAAQ,GACZ,mBAAmB,CAAC,aAAa,CAAC;YAClC,gDAAgD,CA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EAAE,iBAAiB,CAAC,aAAa,CAAC;YAC/C,WAAW,EAAE,oBAAoB;YACjC,aAAa,EAAE,iBAAiB,CAAC,aAAa;SAC/C,CAAC;QAEF,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAC3B,gDAAgD,iBAAiB,8BAA8B,oBAAoB,IAAI,EACvH,KAAK,EACL,OAAO,EACP,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,eAAe,CACnB,iBAAyB,EACzB,mBAA2B;QAE3B,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAC3B,gDAAgD,iBAAiB,iBAAiB,mBAAmB,GAAG,EACxG,QAAQ,CACT,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,8BAA8B,CAClC,iBAAyB,EACzB,mBAA4C,EAC5C,kBAA2B;QAE3B,MAAM,OAAO,GAA2B,EAAE,CAAC;QAC3C,IAAI,kBAAkB,EAAE,CAAC;YACvB,OAAO,CAAC,0BAA0B,CAAC,GAAG,kBAAkB,CAAC;QAC3D,CAAC;QAED,iFAAiF;QACjF,MAAM,UAAU,GAAG,EAAE,GAAG,mBAAmB,EAAE,CAAC;QAC9C,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;YAC/B,UAAU,CAAC,aAAa,CAAC;gBACvB,kDAAkD,CAAC;QACvD,CAAC;QAED,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAC5B,gDAAgD,iBAAiB,eAAe,EAChF,MAAM,EACN,UAAU,EACV,OAAO,CACR,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * BusinessRuleService
3
+ *
4
+ * Read-only service for business rules in Dynamics 365.
5
+ */
6
+ import type { PowerPlatformClient } from '../client/PowerPlatformClient.js';
7
+ export declare class BusinessRuleService {
8
+ private client;
9
+ constructor(client: PowerPlatformClient);
10
+ /**
11
+ * Get all business rules in the environment
12
+ */
13
+ getBusinessRules(activeOnly?: boolean, maxRecords?: number): Promise<{
14
+ totalCount: number;
15
+ businessRules: unknown[];
16
+ }>;
17
+ /**
18
+ * Get a specific business rule with its complete XAML definition
19
+ */
20
+ getBusinessRule(workflowId: string): Promise<unknown>;
21
+ }
22
+ //# sourceMappingURL=BusinessRuleService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BusinessRuleService.d.ts","sourceRoot":"","sources":["../../src/services/BusinessRuleService.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAG5E,qBAAa,mBAAmB;IAClB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,mBAAmB;IAE/C;;OAEG;IACG,gBAAgB,CACpB,UAAU,GAAE,OAAe,EAC3B,UAAU,GAAE,MAAY,GACvB,OAAO,CAAC;QACT,UAAU,EAAE,MAAM,CAAC;QACnB,aAAa,EAAE,OAAO,EAAE,CAAC;KAC1B,CAAC;IA4CF;;OAEG;IACG,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAyC5D"}
@@ -0,0 +1,85 @@
1
+ /**
2
+ * BusinessRuleService
3
+ *
4
+ * Read-only service for business rules in Dynamics 365.
5
+ */
6
+ export class BusinessRuleService {
7
+ client;
8
+ constructor(client) {
9
+ this.client = client;
10
+ }
11
+ /**
12
+ * Get all business rules in the environment
13
+ */
14
+ async getBusinessRules(activeOnly = false, maxRecords = 100) {
15
+ // Category 2 = Business Rule
16
+ // StateCode: 0=Draft, 1=Activated, 2=Suspended
17
+ // Type: 1=Definition
18
+ const stateFilter = activeOnly ? ' and statecode eq 1' : '';
19
+ const businessRules = await this.client.makeRequest(`api/data/v9.2/workflows?$filter=category eq 2${stateFilter}&$select=workflowid,name,statecode,statuscode,description,createdon,modifiedon,type,ismanaged,primaryentity&$expand=ownerid($select=fullname),modifiedby($select=fullname)&$orderby=modifiedon desc&$top=${maxRecords}`);
20
+ const formattedBusinessRules = businessRules.value.map((rule) => ({
21
+ workflowid: rule.workflowid,
22
+ name: rule.name,
23
+ description: rule.description,
24
+ state: rule.statecode === 0
25
+ ? 'Draft'
26
+ : rule.statecode === 1
27
+ ? 'Activated'
28
+ : 'Suspended',
29
+ statecode: rule.statecode,
30
+ statuscode: rule.statuscode,
31
+ type: rule.type === 1
32
+ ? 'Definition'
33
+ : rule.type === 2
34
+ ? 'Activation'
35
+ : 'Template',
36
+ primaryEntity: rule.primaryentity,
37
+ isManaged: rule.ismanaged,
38
+ owner: rule.ownerid?.fullname,
39
+ modifiedOn: rule.modifiedon,
40
+ modifiedBy: rule.modifiedby?.fullname,
41
+ createdOn: rule.createdon,
42
+ }));
43
+ return {
44
+ totalCount: formattedBusinessRules.length,
45
+ businessRules: formattedBusinessRules,
46
+ };
47
+ }
48
+ /**
49
+ * Get a specific business rule with its complete XAML definition
50
+ */
51
+ async getBusinessRule(workflowId) {
52
+ const businessRule = await this.client.makeRequest(`api/data/v9.2/workflows(${workflowId})?$select=workflowid,name,statecode,statuscode,description,createdon,modifiedon,type,category,ismanaged,primaryentity,xaml&$expand=ownerid($select=fullname),modifiedby($select=fullname),createdby($select=fullname)`);
53
+ // Verify it's actually a business rule
54
+ if (businessRule.category !== 2) {
55
+ throw new Error(`Workflow ${workflowId} is not a business rule (category: ${businessRule.category})`);
56
+ }
57
+ return {
58
+ workflowid: businessRule.workflowid,
59
+ name: businessRule.name,
60
+ description: businessRule.description,
61
+ state: businessRule.statecode === 0
62
+ ? 'Draft'
63
+ : businessRule.statecode === 1
64
+ ? 'Activated'
65
+ : 'Suspended',
66
+ statecode: businessRule.statecode,
67
+ statuscode: businessRule.statuscode,
68
+ type: businessRule.type === 1
69
+ ? 'Definition'
70
+ : businessRule.type === 2
71
+ ? 'Activation'
72
+ : 'Template',
73
+ category: businessRule.category,
74
+ primaryEntity: businessRule.primaryentity,
75
+ isManaged: businessRule.ismanaged,
76
+ owner: businessRule.ownerid?.fullname,
77
+ createdOn: businessRule.createdon,
78
+ createdBy: businessRule.createdby?.fullname,
79
+ modifiedOn: businessRule.modifiedon,
80
+ modifiedBy: businessRule.modifiedby?.fullname,
81
+ xaml: businessRule.xaml,
82
+ };
83
+ }
84
+ }
85
+ //# sourceMappingURL=BusinessRuleService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BusinessRuleService.js","sourceRoot":"","sources":["../../src/services/BusinessRuleService.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,MAAM,OAAO,mBAAmB;IACV;IAApB,YAAoB,MAA2B;QAA3B,WAAM,GAAN,MAAM,CAAqB;IAAG,CAAC;IAEnD;;OAEG;IACH,KAAK,CAAC,gBAAgB,CACpB,aAAsB,KAAK,EAC3B,aAAqB,GAAG;QAKxB,6BAA6B;QAC7B,+CAA+C;QAC/C,qBAAqB;QACrB,MAAM,WAAW,GAAG,UAAU,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC;QAE5D,MAAM,aAAa,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,WAAW,CAGjD,gDAAgD,WAAW,4MAA4M,UAAU,EAAE,CACpR,CAAC;QAEF,MAAM,sBAAsB,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAChE,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,KAAK,EACH,IAAI,CAAC,SAAS,KAAK,CAAC;gBAClB,CAAC,CAAC,OAAO;gBACT,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC;oBACpB,CAAC,CAAC,WAAW;oBACb,CAAC,CAAC,WAAW;YACnB,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,IAAI,EACF,IAAI,CAAC,IAAI,KAAK,CAAC;gBACb,C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,YAAY;gBACd,CAAC,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC;oBACvB,CAAC,CAAC,YAAY;oBACd,CAAC,CAAC,UAAU;YAClB,QAAQ,EAAE,YAAY,CAAC,QAAQ;YAC/B,aAAa,EAAE,YAAY,CAAC,aAAa;YACzC,SAAS,EAAE,YAAY,CAAC,SAAS;YACjC,KAAK,EAAG,YAAY,CAAC,OAAiC,EAAE,QAAQ;YAChE,SAAS,EAAE,YAAY,CAAC,SAAS;YACjC,SAAS,EAAG,YAAY,CAAC,SAAmC,EAAE,QAAQ;YACtE,UAAU,EAAE,YAAY,CAAC,UAAU;YACnC,UAAU,EAAG,YAAY,CAAC,UAAoC,EAAE,QAAQ;YACxE,IAAI,EAAE,YAAY,CAAC,IAAI;SACxB,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * DataService
3
+ *
4
+ * Service for data CRUD operations in Dataverse.
5
+ * Note: This service should only be used by powerplatform-data package for security isolation.
6
+ */
7
+ import type { PowerPlatformClient } from '../client/PowerPlatformClient.js';
8
+ export declare class DataService {
9
+ private client;
10
+ constructor(client: PowerPlatformClient);
11
+ /**
12
+ * Get a specific record by entity name (plural) and ID
13
+ */
14
+ getRecord(entityNamePlural: string, recordId: string): Promise<unknown>;
15
+ /**
16
+ * Query records using entity name (plural) and a filter expression
17
+ */
18
+ queryRecords(entityNamePlural: string, filter: string, maxRecords?: number, select?: string[]): Promise<{
19
+ value: unknown[];
20
+ hasMore: boolean;
21
+ returnedCount: number;
22
+ requestedMax: number;
23
+ }>;
24
+ /**
25
+ * Create a new record in Dataverse
26
+ */
27
+ createRecord(entityNamePlural: string, data: Record<string, unknown>): Promise<unknown>;
28
+ /**
29
+ * Update an existing record in Dataverse
30
+ */
31
+ updateRecord(entityNamePlural: string, recordId: string, data: Record<string, unknown>): Promise<unknown>;
32
+ /**
33
+ * Delete a record from Dataverse
34
+ */
35
+ deleteRecord(entityNamePlural: string, recordId: string): Promise<void>;
36
+ /**
37
+ * Execute a Custom API or Action in Dataverse
38
+ */
39
+ executeAction(actionName: string, parameters?: Record<string, unknown>, boundTo?: {
40
+ entityNamePlural: string;
41
+ recordId: string;
42
+ }): Promise<unknown>;
43
+ /**
44
+ * Get the navigation property name for a lookup attribute
45
+ */
46
+ getLookupNavigationPropertyName(entityLogicalName: string, lookupAttributeName: string, targetEntityLogicalName: string): Promise<string | null>;
47
+ /**
48
+ * Convert lookup field names from logical names to SchemaNames for @odata.bind properties
49
+ * Supports both single and polymorphic lookups
50
+ */
51
+ private convertLookupNamesToSchemaNames;
52
+ }
53
+ //# sourceMappingURL=DataService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataService.d.ts","sourceRoot":"","sources":["../../src/services/DataService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAG5E,qBAAa,WAAW;IACV,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,mBAAmB;IAE/C;;OAEG;IACG,SAAS,CACb,gBAAgB,EAAE,MAAM,EACxB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC;IAMnB;;OAEG;IACG,YAAY,CAChB,gBAAgB,EAAE,MAAM,EACxB,MAAM,EAAE,MAAM,EACd,UAAU,GAAE,MAAW,EACvB,MAAM,CAAC,EAAE,MAAM,EAAE,GAChB,OAAO,CAAC;QACT,KAAK,EAAE,OAAO,EAAE,CAAC;QACjB,OAAO,EAAE,OAAO,CAAC;QACjB,aAAa,EAAE,MAAM,CAAC;QACtB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IA8BF;;OAEG;IACG,YAAY,CAChB,gBAAgB,EAAE,MAAM,EACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,OAAO,CAAC;IAuBnB;;OAEG;IACG,YAAY,CAChB,gBAAgB,EAAE,MAAM,EACxB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,OAAO,CAAC,OAAO,CAAC;IAgCnB;;OAEG;IACG,YAAY,CAAC,gBAAgB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB7E;;OAEG;IACG,aAAa,CACjB,UAAU,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACpC,OAAO,CAAC,EAAE;QAAE,gBAAgB,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GACvD,OAAO,CAAC,OAAO,CAAC;IA2CnB;;OAEG;IACG,+BAA+B,CACnC,iBAAiB,EAAE,MAAM,EACzB,mBAAmB,EAAE,MAAM,EAC3B,uBAAuB,EAAE,MAAM,GAC9B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAyBzB;;;OAGG;YACW,+BAA+B;CA6D9C"}
@@ -0,0 +1,204 @@
1
+ /**
2
+ * DataService
3
+ *
4
+ * Service for data CRUD operations in Dataverse.
5
+ * Note: This service should only be used by powerplatform-data package for security isolation.
6
+ */
7
+ export class DataService {
8
+ client;
9
+ constructor(client) {
10
+ this.client = client;
11
+ }
12
+ /**
13
+ * Get a specific record by entity name (plural) and ID
14
+ */
15
+ async getRecord(entityNamePlural, recordId) {
16
+ return this.client.makeRequest(`api/data/v9.2/${entityNamePlural}(${recordId})`);
17
+ }
18
+ /**
19
+ * Query records using entity name (plural) and a filter expression
20
+ */
21
+ async queryRecords(entityNamePlural, filter, maxRecords = 50, select) {
22
+ // Request one extra record to detect if there are more
23
+ const requestLimit = maxRecords + 1;
24
+ let url = `api/data/v9.2/${entityNamePlural}?$filter=${encodeURIComponent(filter)}&$top=${requestLimit}`;
25
+ // Add $select if columns specified
26
+ if (select && select.length > 0) {
27
+ url += `&$select=${select.join(',')}`;
28
+ }
29
+ const response = await this.client.makeRequest(url);
30
+ // Check if there are more records than requested
31
+ const hasMore = response.value.length > maxRecords;
32
+ // Trim to the requested max
33
+ const trimmedValue = hasMore
34
+ ? response.value.slice(0, maxRecords)
35
+ : response.value;
36
+ return {
37
+ value: trimmedValue,
38
+ hasMore,
39
+ returnedCount: trimmedValue.length,
40
+ requestedMax: maxRecords,
41
+ };
42
+ }
43
+ /**
44
+ * Create a new record in Dataverse
45
+ */
46
+ async createRecord(entityNamePlural, data) {
47
+ // Validate data is not empty
48
+ if (!data || Object.keys(data).length === 0) {
49
+ throw new Error('Record data cannot be empty');
50
+ }
51
+ // Convert lookup field names from logical names to SchemaNames
52
+ const transformedData = await this.convertLookupNamesToSchemaNames(entityNamePlural, data);
53
+ // Make POST request to create record
54
+ return this.client.makeRequest(`api/data/v9.2/${entityNamePlural}`, 'POST', transformedData, {
55
+ Prefer: 'return=representation', // Return the created record
56
+ });
57
+ }
58
+ /**
59
+ * Update an existing record in Dataverse
60
+ */
61
+ async updateRecord(entityNamePlural, recordId, data) {
62
+ // Validate data is not empty
63
+ if (!data || Object.keys(data).length === 0) {
64
+ throw new Error('Update data cannot be empty');
65
+ }
66
+ // Validate recordId is a valid GUID
67
+ const guidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
68
+ if (!guidRegex.test(recordId)) {
69
+ throw new Error(`Invalid record ID format: ${recordId}. Must be a valid GUID.`);
70
+ }
71
+ // Convert lookup field names from logical names to SchemaNames
72
+ const transformedData = await this.convertLookupNamesToSchemaNames(entityNamePlural, data);
73
+ // Make PATCH request to update record
74
+ return this.client.makeRequest(`api/data/v9.2/${entityNamePlural}(${recordId})`, 'PATCH', transformedData, {
75
+ Prefer: 'return=representation', // Return the updated record
76
+ });
77
+ }
78
+ /**
79
+ * Delete a record from Dataverse
80
+ */
81
+ async deleteRecord(entityNamePlural, recordId) {
82
+ // Validate recordId is a valid GUID
83
+ const guidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
84
+ if (!guidRegex.test(recordId)) {
85
+ throw new Error(`Invalid record ID format: ${recordId}. Must be a valid GUID.`);
86
+ }
87
+ // Make DELETE request
88
+ await this.client.makeRequest(`api/data/v9.2/${entityNamePlural}(${recordId})`, 'DELETE');
89
+ }
90
+ /**
91
+ * Execute a Custom API or Action in Dataverse
92
+ */
93
+ async executeAction(actionName, parameters, boundTo) {
94
+ // Validate action name
95
+ if (!actionName || actionName.trim().length === 0) {
96
+ throw new Error('Action name cannot be empty');
97
+ }
98
+ // If bound action, validate the bound parameters
99
+ if (boundTo) {
100
+ if (!boundTo.entityNamePlural || boundTo.entityNamePlural.trim().length === 0) {
101
+ throw new Error('Bound action requires entityNamePlural');
102
+ }
103
+ if (!boundTo.recordId || boundTo.recordId.trim().length === 0) {
104
+ throw new Error('Bound action requires recordId');
105
+ }
106
+ // Validate recordId is a valid GUID
107
+ const guidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
108
+ if (!guidRegex.test(boundTo.recordId)) {
109
+ throw new Error(`Invalid record ID format: ${boundTo.recordId}. Must be a valid GUID.`);
110
+ }
111
+ }
112
+ // Build endpoint URL
113
+ // Unbound: POST api/data/v9.2/actionName
114
+ // Bound: POST api/data/v9.2/entityNamePlural(recordId)/Microsoft.Dynamics.CRM.actionName
115
+ let endpoint;
116
+ if (boundTo) {
117
+ // For bound actions, need to use fully qualified name with Microsoft.Dynamics.CRM prefix
118
+ const qualifiedActionName = actionName.startsWith('Microsoft.Dynamics.CRM.')
119
+ ? actionName
120
+ : `Microsoft.Dynamics.CRM.${actionName}`;
121
+ endpoint = `api/data/v9.2/${boundTo.entityNamePlural}(${boundTo.recordId})/${qualifiedActionName}`;
122
+ }
123
+ else {
124
+ endpoint = `api/data/v9.2/${actionName}`;
125
+ }
126
+ // Make POST request to execute action
127
+ return this.client.makeRequest(endpoint, 'POST', parameters || {});
128
+ }
129
+ /**
130
+ * Get the navigation property name for a lookup attribute
131
+ */
132
+ async getLookupNavigationPropertyName(entityLogicalName, lookupAttributeName, targetEntityLogicalName) {
133
+ try {
134
+ // Query the target entity's OneToManyRelationships to find the relationship
135
+ const selectProperties = [
136
+ 'ReferencingAttribute',
137
+ 'ReferencingEntity',
138
+ 'ReferencingEntityNavigationPropertyName',
139
+ ].join(',');
140
+ const response = await this.client.makeRequest(`api/data/v9.2/EntityDefinitions(LogicalName='${targetEntityLogicalName}')/OneToManyRelationships?$select=${selectProperties}&$filter=ReferencingEntity eq '${entityLogicalName}' and ReferencingAttribute eq '${lookupAttributeName}'`);
141
+ if (response && response.value && response.value.length > 0) {
142
+ return response.value[0].ReferencingEntityNavigationPropertyName;
143
+ }
144
+ return null;
145
+ }
146
+ catch {
147
+ return null;
148
+ }
149
+ }
150
+ /**
151
+ * Convert lookup field names from logical names to SchemaNames for @odata.bind properties
152
+ * Supports both single and polymorphic lookups
153
+ */
154
+ async convertLookupNamesToSchemaNames(entityNamePlural, data) {
155
+ // Extract entity logical name from plural (rough approximation)
156
+ // e.g., 'contacts' -> 'contact', 'accounts' -> 'account'
157
+ const entityLogicalName = entityNamePlural.replace(/s$/, '');
158
+ const transformedData = {};
159
+ const processedKeys = new Set();
160
+ for (const [key, value] of Object.entries(data)) {
161
+ // Check if this is a lookup binding property
162
+ if (key.endsWith('@odata.bind')) {
163
+ // Extract the base field name (before @odata.bind)
164
+ const fullPropertyName = key.replace('@odata.bind', '');
165
+ // Handle polymorphic lookups (e.g., 'si_customerid_contact')
166
+ let lookupLogicalName = fullPropertyName;
167
+ let entitySuffix = '';
168
+ // Check if there's an entity type suffix (for polymorphic lookups)
169
+ const parts = fullPropertyName.split('_');
170
+ if (parts.length > 1) {
171
+ // Assume the last part might be an entity suffix (contact, account, etc.)
172
+ const potentialSuffix = parts[parts.length - 1];
173
+ // Common polymorphic target entities
174
+ const commonTargets = ['account', 'contact', 'systemuser', 'team'];
175
+ if (commonTargets.includes(potentialSuffix)) {
176
+ entitySuffix = `_${potentialSuffix}`;
177
+ lookupLogicalName = parts.slice(0, -1).join('_');
178
+ }
179
+ }
180
+ try {
181
+ // Get the attribute metadata to find the SchemaName
182
+ const attribute = await this.client.makeRequest(`api/data/v9.2/EntityDefinitions(LogicalName='${entityLogicalName}')/Attributes(LogicalName='${lookupLogicalName}')`);
183
+ const schemaName = attribute.SchemaName;
184
+ // Construct the correct key with SchemaName
185
+ const correctKey = `${schemaName}${entitySuffix}@odata.bind`;
186
+ transformedData[correctKey] = value;
187
+ processedKeys.add(key);
188
+ }
189
+ catch {
190
+ // If we can't find the attribute, try the key as-is (might already be SchemaName)
191
+ // This provides backward compatibility
192
+ transformedData[key] = value;
193
+ processedKeys.add(key);
194
+ }
195
+ }
196
+ else if (!processedKeys.has(key)) {
197
+ // Non-lookup field, copy as-is
198
+ transformedData[key] = value;
199
+ }
200
+ }
201
+ return transformedData;
202
+ }
203
+ }
204
+ //# sourceMappingURL=DataService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataService.js","sourceRoot":"","sources":["../../src/services/DataService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,MAAM,OAAO,WAAW;IACF;IAApB,YAAoB,MAA2B;QAA3B,WAAM,GAAN,MAAM,CAAqB;IAAG,CAAC;IAEnD;;OAEG;IACH,KAAK,CAAC,SAAS,CACb,gBAAwB,EACxB,QAAgB;QAEhB,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAC5B,iBAAiB,gBAAgB,IAAI,QAAQ,GAAG,CACjD,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY,CAChB,gBAAwB,EACxB,MAAc,EACd,aAAqB,EAAE,EACvB,MAAiB;QAOjB,uDAAuD;QACvD,MAAM,YAAY,GAAG,UAAU,GAAG,CAAC,CAAC;QAEpC,IAAI,GAAG,GAAG,iBAAiB,gBAAgB,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CAAuC;oBACvC,eAAe,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;oBAC7B,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;gBACzB,CAAC;YACH,CAAC;iBAAM,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;gBACnC,+BAA+B;gBAC/B,eAAe,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;YAC/B,CAAC;QACH,CAAC;QAED,OAAO,eAAe,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * DependencyService
3
+ *
4
+ * Service for checking component dependencies.
5
+ * Note: This service should only be used by powerplatform-customization package.
6
+ */
7
+ import type { PowerPlatformClient } from '../client/PowerPlatformClient.js';
8
+ export declare class DependencyService {
9
+ private client;
10
+ constructor(client: PowerPlatformClient);
11
+ /**
12
+ * Check component dependencies
13
+ */
14
+ checkDependencies(componentId: string, componentType: number): Promise<unknown>;
15
+ /**
16
+ * Check if component can be deleted
17
+ */
18
+ checkDeleteEligibility(componentId: string, componentType: number): Promise<{
19
+ canDelete: boolean;
20
+ dependencies: unknown[];
21
+ }>;
22
+ /**
23
+ * Check dependencies for a specific component (alias for checkDependencies)
24
+ */
25
+ checkComponentDependencies(componentId: string, componentType: number): Promise<unknown>;
26
+ }
27
+ //# sourceMappingURL=DependencyService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DependencyService.d.ts","sourceRoot":"","sources":["../../src/services/DependencyService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,qBAAa,iBAAiB;IAChB,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,mBAAmB;IAE/C;;OAEG;IACG,iBAAiB,CACrB,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,OAAO,CAAC;IAWnB;;OAEG;IACG,sBAAsB,CAC1B,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC;QAAE,SAAS,EAAE,OAAO,CAAC;QAAC,YAAY,EAAE,OAAO,EAAE,CAAA;KAAE,CAAC;IAoB3D;;OAEG;IACG,0BAA0B,CAC9B,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,OAAO,CAAC;CAGpB"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * DependencyService
3
+ *
4
+ * Service for checking component dependencies.
5
+ * Note: This service should only be used by powerplatform-customization package.
6
+ */
7
+ export class DependencyService {
8
+ client;
9
+ constructor(client) {
10
+ this.client = client;
11
+ }
12
+ /**
13
+ * Check component dependencies
14
+ */
15
+ async checkDependencies(componentId, componentType) {
16
+ return this.client.makeRequest('api/data/v9.2/RetrieveDependenciesForDelete', 'POST', {
17
+ ObjectId: componentId,
18
+ ComponentType: componentType,
19
+ });
20
+ }
21
+ /**
22
+ * Check if component can be deleted
23
+ */
24
+ async checkDeleteEligibility(componentId, componentType) {
25
+ try {
26
+ const result = (await this.checkDependencies(componentId, componentType));
27
+ const dependencies = result.EntityCollection?.Entities || [];
28
+ return {
29
+ canDelete: dependencies.length === 0,
30
+ dependencies: dependencies,
31
+ };
32
+ }
33
+ catch {
34
+ return {
35
+ canDelete: false,
36
+ dependencies: [],
37
+ };
38
+ }
39
+ }
40
+ /**
41
+ * Check dependencies for a specific component (alias for checkDependencies)
42
+ */
43
+ async checkComponentDependencies(componentId, componentType) {
44
+ return this.checkDependencies(componentId, componentType);
45
+ }
46
+ }
47
+ //# sourceMappingURL=DependencyService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DependencyService.js","sourceRoot":"","sources":["../../src/services/DependencyService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,OAAO,iBAAiB;IACR;IAApB,YAAoB,MAA2B;QAA3B,WAAM,GAAN,MAAM,CAAqB;IAAG,CAAC;IAEnD;;OAEG;IACH,KAAK,CAAC,iBAAiB,CACrB,WAAmB,EACnB,aAAqB;QAErB,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAC5B,6CAA6C,EAC7C,MAAM,EACN;YACE,QAAQ,EAAE,WAAW;YACrB,aAAa,EAAE,aAAa;SAC7B,CACF,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,sBAAsB,CAC1B,WAAmB,EACnB,aAAqB;QAErB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,CAAC,MAAM,IAAI,CAAC,iBAAiB,CAC1C,WAAW,EACX,aAAa,CACd,CAAoD,CAAC;YACtD,MAAM,YAAY,GAAG,MAAM,CAAC,gBAAgB,EAAE,QAAQ,IAAI,EAAE,CAAC;YAE7D,OAAO;gBACL,SAAS,EAAE,YAAY,CAAC,MAAM,KAAK,CAAC;gBACpC,YAAY,EAAE,YAAY;aAC3B,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;gBACL,SAAS,EAAE,KAAK;gBAChB,YAAY,EAAE,EAAE;aACjB,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,0BAA0B,CAC9B,WAAmB,EACnB,aAAqB;QAErB,OAAO,IAAI,CAAC,iBAAiB,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IAC5D,CAAC;CACF"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * EntityService
3
+ *
4
+ * Service for entity (table) customization operations.
5
+ * Note: This service should only be used by powerplatform-customization package.
6
+ */
7
+ import type { PowerPlatformClient } from '../client/PowerPlatformClient.js';
8
+ export declare class EntityService {
9
+ private client;
10
+ constructor(client: PowerPlatformClient);
11
+ /**
12
+ * Create a new custom entity (table)
13
+ */
14
+ createEntity(entityDefinition: Record<string, unknown>, solutionUniqueName?: string): Promise<unknown>;
15
+ /**
16
+ * Update an existing entity
17
+ */
18
+ updateEntity(metadataId: string, updates: Record<string, unknown>, solutionUniqueName?: string): Promise<void>;
19
+ /**
20
+ * Delete a custom entity
21
+ */
22
+ deleteEntity(metadataId: string): Promise<void>;
23
+ /**
24
+ * Update entity icon using Fluent UI System Icon
25
+ */
26
+ updateEntityIcon(entityLogicalName: string, iconFileName: string, dependencies: {
27
+ getEntityMetadata: (name: string) => Promise<Record<string, unknown>>;
28
+ createWebResource: (resource: Record<string, unknown>, solution?: string) => Promise<Record<string, unknown>>;
29
+ updateWebResource: (id: string, updates: Record<string, unknown>, solution?: string) => Promise<void>;
30
+ publishComponent: (id: string, componentType: number) => Promise<void>;
31
+ }, solutionUniqueName?: string): Promise<{
32
+ success: boolean;
33
+ entityLogicalName: string;
34
+ entitySchemaName: string;
35
+ iconFileName: string;
36
+ webResourceId: string;
37
+ webResourceName: string;
38
+ iconVectorName: string;
39
+ message: string;
40
+ }>;
41
+ }
42
+ //# sourceMappingURL=EntityService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EntityService.d.ts","sourceRoot":"","sources":["../../src/services/EntityService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAM5E,qBAAa,aAAa;IACZ,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,mBAAmB;IAE/C;;OAEG;IACG,YAAY,CAChB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzC,kBAAkB,CAAC,EAAE,MAAM,GAC1B,OAAO,CAAC,OAAO,CAAC;IAuCnB;;OAEG;IACG,YAAY,CAChB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,kBAAkB,CAAC,EAAE,MAAM,GAC1B,OAAO,CAAC,IAAI,CAAC;IAgBhB;;OAEG;IACG,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAOrD;;OAEG;IACG,gBAAgB,CACpB,iBAAiB,EAAE,MAA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