@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.
- package/build/auth/index.d.ts +64 -0
- package/build/auth/index.d.ts.map +1 -0
- package/build/auth/index.js +39 -0
- package/build/auth/index.js.map +1 -0
- package/build/auth/interactive-auth.d.ts +60 -0
- package/build/auth/interactive-auth.d.ts.map +1 -0
- package/build/auth/interactive-auth.js +429 -0
- package/build/auth/interactive-auth.js.map +1 -0
- package/build/auth/service-principal-auth.d.ts +26 -0
- package/build/auth/service-principal-auth.d.ts.map +1 -0
- package/build/auth/service-principal-auth.js +60 -0
- package/build/auth/service-principal-auth.js.map +1 -0
- package/build/auth/token-cache.d.ts +40 -0
- package/build/auth/token-cache.d.ts.map +1 -0
- package/build/auth/token-cache.js +108 -0
- package/build/auth/token-cache.js.map +1 -0
- package/build/client/PowerPlatformClient.d.ts +78 -0
- package/build/client/PowerPlatformClient.d.ts.map +1 -0
- package/build/client/PowerPlatformClient.js +198 -0
- package/build/client/PowerPlatformClient.js.map +1 -0
- package/build/client/index.d.ts +6 -0
- package/build/client/index.d.ts.map +1 -0
- package/build/client/index.js +6 -0
- package/build/client/index.js.map +1 -0
- package/build/client/types.d.ts +300 -0
- package/build/client/types.d.ts.map +1 -0
- package/build/client/types.js +5 -0
- package/build/client/types.js.map +1 -0
- package/build/index.d.ts +36 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +55 -0
- package/build/index.js.map +1 -0
- package/build/services/AppManagementService.d.ts +95 -0
- package/build/services/AppManagementService.d.ts.map +1 -0
- package/build/services/AppManagementService.js +322 -0
- package/build/services/AppManagementService.js.map +1 -0
- package/build/services/AppService.d.ts +39 -0
- package/build/services/AppService.d.ts.map +1 -0
- package/build/services/AppService.js +173 -0
- package/build/services/AppService.js.map +1 -0
- package/build/services/AttributeService.d.ts +28 -0
- package/build/services/AttributeService.d.ts.map +1 -0
- package/build/services/AttributeService.js +86 -0
- package/build/services/AttributeService.js.map +1 -0
- package/build/services/BusinessRuleService.d.ts +22 -0
- package/build/services/BusinessRuleService.d.ts.map +1 -0
- package/build/services/BusinessRuleService.js +85 -0
- package/build/services/BusinessRuleService.js.map +1 -0
- package/build/services/DataService.d.ts +53 -0
- package/build/services/DataService.d.ts.map +1 -0
- package/build/services/DataService.js +204 -0
- package/build/services/DataService.js.map +1 -0
- package/build/services/DependencyService.d.ts +27 -0
- package/build/services/DependencyService.d.ts.map +1 -0
- package/build/services/DependencyService.js +47 -0
- package/build/services/DependencyService.js.map +1 -0
- package/build/services/EntityService.d.ts +42 -0
- package/build/services/EntityService.d.ts.map +1 -0
- package/build/services/EntityService.js +132 -0
- package/build/services/EntityService.js.map +1 -0
- package/build/services/FlowService.d.ts +55 -0
- package/build/services/FlowService.d.ts.map +1 -0
- package/build/services/FlowService.js +608 -0
- package/build/services/FlowService.js.map +1 -0
- package/build/services/FormService.d.ts +36 -0
- package/build/services/FormService.d.ts.map +1 -0
- package/build/services/FormService.js +55 -0
- package/build/services/FormService.js.map +1 -0
- package/build/services/MetadataService.d.ts +63 -0
- package/build/services/MetadataService.d.ts.map +1 -0
- package/build/services/MetadataService.js +176 -0
- package/build/services/MetadataService.js.map +1 -0
- package/build/services/OptionSetService.d.ts +40 -0
- package/build/services/OptionSetService.d.ts.map +1 -0
- package/build/services/OptionSetService.js +91 -0
- package/build/services/OptionSetService.js.map +1 -0
- package/build/services/PluginDeploymentService.d.ts +102 -0
- package/build/services/PluginDeploymentService.d.ts.map +1 -0
- package/build/services/PluginDeploymentService.js +412 -0
- package/build/services/PluginDeploymentService.js.map +1 -0
- package/build/services/PluginService.d.ts +61 -0
- package/build/services/PluginService.d.ts.map +1 -0
- package/build/services/PluginService.js +289 -0
- package/build/services/PluginService.js.map +1 -0
- package/build/services/PublishingService.d.ts +37 -0
- package/build/services/PublishingService.d.ts.map +1 -0
- package/build/services/PublishingService.js +65 -0
- package/build/services/PublishingService.js.map +1 -0
- package/build/services/RelationshipService.d.ts +29 -0
- package/build/services/RelationshipService.d.ts.map +1 -0
- package/build/services/RelationshipService.js +46 -0
- package/build/services/RelationshipService.js.map +1 -0
- package/build/services/SolutionService.d.ts +60 -0
- package/build/services/SolutionService.d.ts.map +1 -0
- package/build/services/SolutionService.js +125 -0
- package/build/services/SolutionService.js.map +1 -0
- package/build/services/ValidationService.d.ts +31 -0
- package/build/services/ValidationService.d.ts.map +1 -0
- package/build/services/ValidationService.js +391 -0
- package/build/services/ValidationService.js.map +1 -0
- package/build/services/ViewService.d.ts +36 -0
- package/build/services/ViewService.d.ts.map +1 -0
- package/build/services/ViewService.js +55 -0
- package/build/services/ViewService.js.map +1 -0
- package/build/services/WebResourceService.d.ts +40 -0
- package/build/services/WebResourceService.d.ts.map +1 -0
- package/build/services/WebResourceService.js +64 -0
- package/build/services/WebResourceService.js.map +1 -0
- package/build/services/WorkflowManagementService.d.ts +157 -0
- package/build/services/WorkflowManagementService.d.ts.map +1 -0
- package/build/services/WorkflowManagementService.js +567 -0
- package/build/services/WorkflowManagementService.js.map +1 -0
- package/build/services/WorkflowService.d.ts +28 -0
- package/build/services/WorkflowService.d.ts.map +1 -0
- package/build/services/WorkflowService.js +285 -0
- package/build/services/WorkflowService.js.map +1 -0
- package/build/services/index.d.ts +29 -0
- package/build/services/index.d.ts.map +1 -0
- package/build/services/index.js +31 -0
- package/build/services/index.js.map +1 -0
- package/build/utils/auditLogger.d.ts +76 -0
- package/build/utils/auditLogger.d.ts.map +1 -0
- package/build/utils/auditLogger.js +110 -0
- package/build/utils/auditLogger.js.map +1 -0
- package/build/utils/best-practices-formatters.d.ts +26 -0
- package/build/utils/best-practices-formatters.d.ts.map +1 -0
- package/build/utils/best-practices-formatters.js +238 -0
- package/build/utils/best-practices-formatters.js.map +1 -0
- package/build/utils/bestPractices.d.ts +150 -0
- package/build/utils/bestPractices.d.ts.map +1 -0
- package/build/utils/bestPractices.js +324 -0
- package/build/utils/bestPractices.js.map +1 -0
- package/build/utils/iconManager.d.ts +84 -0
- package/build/utils/iconManager.d.ts.map +1 -0
- package/build/utils/iconManager.js +338 -0
- package/build/utils/iconManager.js.map +1 -0
- package/build/utils/index.d.ts +11 -0
- package/build/utils/index.d.ts.map +1 -0
- package/build/utils/index.js +18 -0
- package/build/utils/index.js.map +1 -0
- package/build/utils/prompt-templates.d.ts +9 -0
- package/build/utils/prompt-templates.d.ts.map +1 -0
- package/build/utils/prompt-templates.js +31 -0
- package/build/utils/prompt-templates.js.map +1 -0
- package/build/utils/publisherConfig.d.ts +33 -0
- package/build/utils/publisherConfig.d.ts.map +1 -0
- package/build/utils/publisherConfig.js +54 -0
- package/build/utils/publisherConfig.js.map +1 -0
- package/build/utils/rate-limiter.d.ts +108 -0
- package/build/utils/rate-limiter.d.ts.map +1 -0
- package/build/utils/rate-limiter.js +242 -0
- package/build/utils/rate-limiter.js.map +1 -0
- package/package.json +65 -0
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Icon Management Module
|
|
3
|
+
*
|
|
4
|
+
* Integrates with Fluent UI System Icons for entity icon management.
|
|
5
|
+
* Fetches SVG icons from GitHub and uploads them as web resources.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Fluent UI System Icons configuration
|
|
9
|
+
*/
|
|
10
|
+
const FLUENT_ICONS_CONFIG = {
|
|
11
|
+
baseUrl: 'https://raw.githubusercontent.com/microsoft/fluentui-system-icons/main/assets',
|
|
12
|
+
defaultSize: 24,
|
|
13
|
+
defaultStyle: 'filled',
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Icon suggestions based on entity type/name
|
|
17
|
+
*/
|
|
18
|
+
const ICON_SUGGESTIONS = {
|
|
19
|
+
// People & Organizations
|
|
20
|
+
contact: [
|
|
21
|
+
{ name: 'Person', fileName: 'person_24_filled.svg', url: '', category: 'people' },
|
|
22
|
+
{ name: 'People', fileName: 'people_24_filled.svg', url: '', category: 'people' },
|
|
23
|
+
],
|
|
24
|
+
account: [
|
|
25
|
+
{ name: 'Building', fileName: 'building_24_filled.svg', url: '', category: 'places' },
|
|
26
|
+
{ name: 'Organization', fileName: 'organization_24_filled.svg', url: '', category: 'people' },
|
|
27
|
+
],
|
|
28
|
+
customer: [
|
|
29
|
+
{ name: 'Person Circle', fileName: 'person_circle_24_filled.svg', url: '', category: 'people' },
|
|
30
|
+
],
|
|
31
|
+
// Business
|
|
32
|
+
opportunity: [
|
|
33
|
+
{ name: 'Money', fileName: 'money_24_filled.svg', url: '', category: 'commerce' },
|
|
34
|
+
{ name: 'Target', fileName: 'target_24_filled.svg', url: '', category: 'general' },
|
|
35
|
+
],
|
|
36
|
+
quote: [
|
|
37
|
+
{ name: 'Document', fileName: 'document_24_filled.svg', url: '', category: 'document' },
|
|
38
|
+
{ name: 'Document Text', fileName: 'document_text_24_filled.svg', url: '', category: 'document' },
|
|
39
|
+
],
|
|
40
|
+
order: [
|
|
41
|
+
{ name: 'Cart', fileName: 'cart_24_filled.svg', url: '', category: 'commerce' },
|
|
42
|
+
{ name: 'Receipt', fileName: 'receipt_24_filled.svg', url: '', category: 'commerce' },
|
|
43
|
+
],
|
|
44
|
+
invoice: [
|
|
45
|
+
{ name: 'Receipt Money', fileName: 'receipt_money_24_filled.svg', url: '', category: 'commerce' },
|
|
46
|
+
],
|
|
47
|
+
product: [
|
|
48
|
+
{ name: 'Box', fileName: 'box_24_filled.svg', url: '', category: 'commerce' },
|
|
49
|
+
{ name: 'Cube', fileName: 'cube_24_filled.svg', url: '', category: 'general' },
|
|
50
|
+
],
|
|
51
|
+
// Cases & Service
|
|
52
|
+
case: [
|
|
53
|
+
{ name: 'Question Circle', fileName: 'question_circle_24_filled.svg', url: '', category: 'general' },
|
|
54
|
+
{ name: 'Chat Help', fileName: 'chat_help_24_filled.svg', url: '', category: 'communication' },
|
|
55
|
+
],
|
|
56
|
+
incident: [
|
|
57
|
+
{ name: 'Alert', fileName: 'alert_24_filled.svg', url: '', category: 'general' },
|
|
58
|
+
{ name: 'Warning', fileName: 'warning_24_filled.svg', url: '', category: 'general' },
|
|
59
|
+
],
|
|
60
|
+
ticket: [{ name: 'Ticket', fileName: 'ticket_24_filled.svg', url: '', category: 'general' }],
|
|
61
|
+
// Tasks & Activities
|
|
62
|
+
task: [
|
|
63
|
+
{ name: 'Task List', fileName: 'task_list_24_filled.svg', url: '', category: 'productivity' },
|
|
64
|
+
{ name: 'Checkmark', fileName: 'checkmark_24_filled.svg', url: '', category: 'general' },
|
|
65
|
+
],
|
|
66
|
+
appointment: [
|
|
67
|
+
{ name: 'Calendar', fileName: 'calendar_24_filled.svg', url: '', category: 'productivity' },
|
|
68
|
+
{
|
|
69
|
+
name: 'Calendar Clock',
|
|
70
|
+
fileName: 'calendar_clock_24_filled.svg',
|
|
71
|
+
url: '',
|
|
72
|
+
category: 'productivity',
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
email: [
|
|
76
|
+
{ name: 'Mail', fileName: 'mail_24_filled.svg', url: '', category: 'communication' },
|
|
77
|
+
{ name: 'Mail Inbox', fileName: 'mail_inbox_24_filled.svg', url: '', category: 'communication' },
|
|
78
|
+
],
|
|
79
|
+
phonecall: [
|
|
80
|
+
{ name: 'Call', fileName: 'call_24_filled.svg', url: '', category: 'communication' },
|
|
81
|
+
{ name: 'Phone', fileName: 'phone_24_filled.svg', url: '', category: 'communication' },
|
|
82
|
+
],
|
|
83
|
+
// Reference Data
|
|
84
|
+
category: [
|
|
85
|
+
{ name: 'Tag', fileName: 'tag_24_filled.svg', url: '', category: 'general' },
|
|
86
|
+
{ name: 'Grid', fileName: 'grid_24_filled.svg', url: '', category: 'general' },
|
|
87
|
+
],
|
|
88
|
+
status: [
|
|
89
|
+
{ name: 'Status', fileName: 'status_24_filled.svg', url: '', category: 'general' },
|
|
90
|
+
{ name: 'Circle', fileName: 'circle_24_filled.svg', url: '', category: 'shapes' },
|
|
91
|
+
],
|
|
92
|
+
type: [{ name: 'Options', fileName: 'options_24_filled.svg', url: '', category: 'general' }],
|
|
93
|
+
reason: [{ name: 'Info', fileName: 'info_24_filled.svg', url: '', category: 'general' }],
|
|
94
|
+
// Documents & Files
|
|
95
|
+
document: [
|
|
96
|
+
{ name: 'Document', fileName: 'document_24_filled.svg', url: '', category: 'document' },
|
|
97
|
+
{ name: 'Document Text', fileName: 'document_text_24_filled.svg', url: '', category: 'document' },
|
|
98
|
+
],
|
|
99
|
+
file: [{ name: 'Document', fileName: 'document_24_filled.svg', url: '', category: 'document' }],
|
|
100
|
+
attachment: [{ name: 'Attach', fileName: 'attach_24_filled.svg', url: '', category: 'document' }],
|
|
101
|
+
note: [
|
|
102
|
+
{ name: 'Note', fileName: 'note_24_filled.svg', url: '', category: 'document' },
|
|
103
|
+
{ name: 'Document Edit', fileName: 'document_edit_24_filled.svg', url: '', category: 'document' },
|
|
104
|
+
],
|
|
105
|
+
// Locations
|
|
106
|
+
location: [
|
|
107
|
+
{ name: 'Location', fileName: 'location_24_filled.svg', url: '', category: 'places' },
|
|
108
|
+
{ name: 'Pin', fileName: 'pin_24_filled.svg', url: '', category: 'places' },
|
|
109
|
+
],
|
|
110
|
+
address: [
|
|
111
|
+
{ name: 'Location', fileName: 'location_24_filled.svg', url: '', category: 'places' },
|
|
112
|
+
{ name: 'Home', fileName: 'home_24_filled.svg', url: '', category: 'places' },
|
|
113
|
+
],
|
|
114
|
+
// Projects & Work
|
|
115
|
+
project: [
|
|
116
|
+
{ name: 'Briefcase', fileName: 'briefcase_24_filled.svg', url: '', category: 'productivity' },
|
|
117
|
+
{ name: 'Folder', fileName: 'folder_24_filled.svg', url: '', category: 'document' },
|
|
118
|
+
],
|
|
119
|
+
application: [
|
|
120
|
+
{ name: 'Apps', fileName: 'apps_24_filled.svg', url: '', category: 'general' },
|
|
121
|
+
{ name: 'Window', fileName: 'window_24_filled.svg', url: '', category: 'general' },
|
|
122
|
+
],
|
|
123
|
+
// Default fallback
|
|
124
|
+
default: [
|
|
125
|
+
{ name: 'Circle', fileName: 'circle_24_filled.svg', url: '', category: 'shapes' },
|
|
126
|
+
{ name: 'Square', fileName: 'square_24_filled.svg', url: '', category: 'shapes' },
|
|
127
|
+
{ name: 'Star', fileName: 'star_24_filled.svg', url: '', category: 'shapes' },
|
|
128
|
+
],
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Icon Manager Class
|
|
132
|
+
*/
|
|
133
|
+
export class IconManager {
|
|
134
|
+
baseUrl;
|
|
135
|
+
cache = new Map();
|
|
136
|
+
constructor() {
|
|
137
|
+
this.baseUrl = FLUENT_ICONS_CONFIG.baseUrl;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Suggest icons based on entity name or type
|
|
141
|
+
*/
|
|
142
|
+
suggestIcons(entityName) {
|
|
143
|
+
const lowerName = entityName
|
|
144
|
+
.toLowerCase()
|
|
145
|
+
.replace(/^sic_/, '') // Remove publisher prefix
|
|
146
|
+
.replace(/^ref_/, ''); // Remove ref data infix
|
|
147
|
+
// Try exact match first
|
|
148
|
+
if (ICON_SUGGESTIONS[lowerName]) {
|
|
149
|
+
return this.populateUrls(ICON_SUGGESTIONS[lowerName]);
|
|
150
|
+
}
|
|
151
|
+
// Try partial match
|
|
152
|
+
for (const [key, suggestions] of Object.entries(ICON_SUGGESTIONS)) {
|
|
153
|
+
if (lowerName.includes(key) || key.includes(lowerName)) {
|
|
154
|
+
return this.populateUrls(suggestions);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// Return default suggestions
|
|
158
|
+
return this.populateUrls(ICON_SUGGESTIONS.default);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Populate full URLs for icon suggestions
|
|
162
|
+
*/
|
|
163
|
+
populateUrls(suggestions) {
|
|
164
|
+
return suggestions.map((s) => {
|
|
165
|
+
try {
|
|
166
|
+
const iconPath = this.constructFluentIconPath(s.fileName);
|
|
167
|
+
return {
|
|
168
|
+
...s,
|
|
169
|
+
url: `${this.baseUrl}/${iconPath}`,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
catch {
|
|
173
|
+
// If path construction fails, return suggestion with empty URL
|
|
174
|
+
return {
|
|
175
|
+
...s,
|
|
176
|
+
url: '',
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Parse icon filename and construct GitHub path
|
|
183
|
+
* Converts: people_community_24_filled.svg
|
|
184
|
+
* To: assets/People Community/SVG/ic_fluent_people_community_24_filled.svg
|
|
185
|
+
*/
|
|
186
|
+
constructFluentIconPath(fileName) {
|
|
187
|
+
// Remove .svg extension
|
|
188
|
+
const base = fileName.replace('.svg', '');
|
|
189
|
+
// Split into parts
|
|
190
|
+
const parts = base.split('_');
|
|
191
|
+
// Extract size (e.g., '24') and style (e.g., 'filled' or 'regular')
|
|
192
|
+
const size = parts[parts.length - 2];
|
|
193
|
+
const style = parts[parts.length - 1];
|
|
194
|
+
// Validate size and style
|
|
195
|
+
if (!size || !style || isNaN(parseInt(size))) {
|
|
196
|
+
throw new Error(`Invalid icon filename format: ${fileName}. Expected format: {icon_name}_{size}_{style}.svg (e.g., people_community_24_filled.svg)`);
|
|
197
|
+
}
|
|
198
|
+
// Icon name is everything before size and style
|
|
199
|
+
const iconNameParts = parts.slice(0, -2);
|
|
200
|
+
if (iconNameParts.length === 0) {
|
|
201
|
+
throw new Error(`Invalid icon filename format: ${fileName}. Missing icon name.`);
|
|
202
|
+
}
|
|
203
|
+
// Folder name: capitalize each word, join with space
|
|
204
|
+
const folderName = iconNameParts
|
|
205
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
206
|
+
.join(' ');
|
|
207
|
+
// Full filename with ic_fluent_ prefix
|
|
208
|
+
const fullFileName = `ic_fluent_${base}.svg`;
|
|
209
|
+
// Construct the full path
|
|
210
|
+
const path = `${folderName}/SVG/${fullFileName}`;
|
|
211
|
+
return path;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Fetch SVG icon from Fluent UI GitHub repository
|
|
215
|
+
*/
|
|
216
|
+
async fetchIcon(fileName) {
|
|
217
|
+
// Check cache first
|
|
218
|
+
if (this.cache.has(fileName)) {
|
|
219
|
+
return this.cache.get(fileName);
|
|
220
|
+
}
|
|
221
|
+
try {
|
|
222
|
+
// Construct the correct GitHub path
|
|
223
|
+
const iconPath = this.constructFluentIconPath(fileName);
|
|
224
|
+
const url = `${this.baseUrl}/${iconPath}`;
|
|
225
|
+
// Use global fetch if available (Node 18+)
|
|
226
|
+
const response = await global.fetch(url);
|
|
227
|
+
if (!response.ok) {
|
|
228
|
+
throw new Error(`Failed to fetch icon from GitHub: ${response.status} ${response.statusText}. URL: ${url}`);
|
|
229
|
+
}
|
|
230
|
+
const svg = await response.text();
|
|
231
|
+
// Validate it's an SVG
|
|
232
|
+
if (!svg.includes('<svg')) {
|
|
233
|
+
throw new Error('Fetched content is not a valid SVG');
|
|
234
|
+
}
|
|
235
|
+
// Cache the result
|
|
236
|
+
this.cache.set(fileName, svg);
|
|
237
|
+
return svg;
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
throw new Error(`Failed to fetch icon '${fileName}': ${error instanceof Error ? error.message : String(error)}\n\nExpected format: {icon_name}_{size}_{style}.svg (e.g., people_community_24_filled.svg)\nBrowse icons at: https://github.com/microsoft/fluentui-system-icons`);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Generate web resource name for icon
|
|
245
|
+
*/
|
|
246
|
+
generateWebResourceName(entitySchemaName, iconName) {
|
|
247
|
+
const prefix = 'sic_';
|
|
248
|
+
const cleanEntityName = entitySchemaName.toLowerCase().replace(/^sic_/, '');
|
|
249
|
+
const cleanIconName = iconName.toLowerCase().replace(/\s+/g, '_');
|
|
250
|
+
return `${prefix}${cleanEntityName}_icon_${cleanIconName}`;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Generate icon vector name for EntityMetadata
|
|
254
|
+
* Uses $webresource: directive which is the correct syntax for Dynamics 365
|
|
255
|
+
* This creates a solution dependency and tells the system to look up the web resource by name
|
|
256
|
+
*/
|
|
257
|
+
generateIconVectorName(webResourceName) {
|
|
258
|
+
return `$webresource:${webResourceName}`;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Validate icon SVG content
|
|
262
|
+
*/
|
|
263
|
+
validateIconSvg(svg) {
|
|
264
|
+
if (!svg.includes('<svg')) {
|
|
265
|
+
return { valid: false, error: 'Content is not a valid SVG' };
|
|
266
|
+
}
|
|
267
|
+
if (svg.length > 100000) {
|
|
268
|
+
return { valid: false, error: 'SVG file is too large (max 100KB)' };
|
|
269
|
+
}
|
|
270
|
+
// Check for script tags (security)
|
|
271
|
+
if (svg.includes('<script')) {
|
|
272
|
+
return { valid: false, error: 'SVG contains script tags (security risk)' };
|
|
273
|
+
}
|
|
274
|
+
return { valid: true };
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Get all available icon categories
|
|
278
|
+
*/
|
|
279
|
+
getCategories() {
|
|
280
|
+
const categories = new Set();
|
|
281
|
+
for (const suggestions of Object.values(ICON_SUGGESTIONS)) {
|
|
282
|
+
suggestions.forEach((s) => categories.add(s.category));
|
|
283
|
+
}
|
|
284
|
+
return Array.from(categories).sort();
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Search icons by name
|
|
288
|
+
*/
|
|
289
|
+
searchIcons(searchTerm) {
|
|
290
|
+
const results = [];
|
|
291
|
+
const lowerSearch = searchTerm.toLowerCase();
|
|
292
|
+
for (const suggestions of Object.values(ICON_SUGGESTIONS)) {
|
|
293
|
+
for (const suggestion of suggestions) {
|
|
294
|
+
if (suggestion.name.toLowerCase().includes(lowerSearch) ||
|
|
295
|
+
suggestion.fileName.toLowerCase().includes(lowerSearch)) {
|
|
296
|
+
results.push(this.populateUrls([suggestion])[0]);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return results;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Get icons by category
|
|
304
|
+
*/
|
|
305
|
+
getIconsByCategory(category) {
|
|
306
|
+
const results = [];
|
|
307
|
+
for (const suggestions of Object.values(ICON_SUGGESTIONS)) {
|
|
308
|
+
for (const suggestion of suggestions) {
|
|
309
|
+
if (suggestion.category === category) {
|
|
310
|
+
results.push(this.populateUrls([suggestion])[0]);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return results;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Build custom icon URL for specific size/style
|
|
318
|
+
*/
|
|
319
|
+
buildIconUrl(iconName, size = 24, style = 'filled') {
|
|
320
|
+
const fileName = `${iconName}_${size}_${style}.svg`;
|
|
321
|
+
try {
|
|
322
|
+
const iconPath = this.constructFluentIconPath(fileName);
|
|
323
|
+
return `${this.baseUrl}/${iconPath}`;
|
|
324
|
+
}
|
|
325
|
+
catch (error) {
|
|
326
|
+
throw new Error(`Failed to build icon URL for '${iconName}': ${error instanceof Error ? error.message : String(error)}`);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Clear icon cache
|
|
331
|
+
*/
|
|
332
|
+
clearCache() {
|
|
333
|
+
this.cache.clear();
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
// Export singleton instance
|
|
337
|
+
export const iconManager = new IconManager();
|
|
338
|
+
//# sourceMappingURL=iconManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iconManager.js","sourceRoot":"","sources":["../../src/utils/iconManager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiBH;;GAEG;AACH,MAAM,mBAAmB,GAAG;IAC1B,OAAO,EAAE,+EAA+E;IACxF,WAAW,EAAE,EAAE;IACf,YAAY,EAAE,QAAQ;CACvB,CAAC;AAEF;;GAEG;AACH,MAAM,gBAAgB,GAAqC;IACzD,yBAAyB;IACzB,OAAO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BEST_PRACTICES, BestPracticesValidator, bestPracticesValidator, type RequiredColumn, type ValidationResult, } from './bestPractices.js';
|
|
6
|
+
export { formatBestPracticesReport, formatCompliantEntities, formatExecutionStats, formatQuickSummary, formatViolationsBySeverity, } from './best-practices-formatters.js';
|
|
7
|
+
export { IconManager, iconManager, type IconSuggestion, type IconUploadResult, } from './iconManager.js';
|
|
8
|
+
export { batchExecute, RateLimiter, rateLimiter, type RateLimiterOptions, type RequestQueueItem, withRateLimit, } from './rate-limiter.js';
|
|
9
|
+
export { ATTRIBUTE_DETAILS, ENTITY_OVERVIEW, QUERY_TEMPLATE, RELATIONSHIP_MAP, } from './prompt-templates.js';
|
|
10
|
+
export { getPublisherPrefix, initializePublisherPrefix, isPublisherPrefixConfigured, normalizePrefix, resetPublisherPrefix, } from './publisherConfig.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACL,WAAW,EACX,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,eAAe,GACrB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACtB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,gCAAgC,CAAC;AAGxC,OAAO,EACL,WAAW,EACX,WAAW,EACX,KAAK,cAAc,EACnB,KAAK,gBAAgB,GACtB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,YAAY,EACZ,WAAW,EACX,WAAW,EACX,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,aAAa,GACd,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,2BAA2B,EAC3B,eAAe,EACf,oBAAoB,GACrB,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utils module exports
|
|
3
|
+
*/
|
|
4
|
+
// Audit logging
|
|
5
|
+
export { AuditLogger, auditLogger, } from './auditLogger.js';
|
|
6
|
+
// Best practices validation
|
|
7
|
+
export { BEST_PRACTICES, BestPracticesValidator, bestPracticesValidator, } from './bestPractices.js';
|
|
8
|
+
// Best practices formatters
|
|
9
|
+
export { formatBestPracticesReport, formatCompliantEntities, formatExecutionStats, formatQuickSummary, formatViolationsBySeverity, } from './best-practices-formatters.js';
|
|
10
|
+
// Icon management
|
|
11
|
+
export { IconManager, iconManager, } from './iconManager.js';
|
|
12
|
+
// Rate limiting
|
|
13
|
+
export { batchExecute, RateLimiter, rateLimiter, withRateLimit, } from './rate-limiter.js';
|
|
14
|
+
// Prompt templates
|
|
15
|
+
export { ATTRIBUTE_DETAILS, ENTITY_OVERVIEW, QUERY_TEMPLATE, RELATIONSHIP_MAP, } from './prompt-templates.js';
|
|
16
|
+
// Publisher configuration
|
|
17
|
+
export { getPublisherPrefix, initializePublisherPrefix, isPublisherPrefixConfigured, normalizePrefix, resetPublisherPrefix, } from './publisherConfig.js';
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,gBAAgB;AAChB,OAAO,EACL,WAAW,EACX,WAAW,GAGZ,MAAM,kBAAkB,CAAC;AAE1B,4BAA4B;AAC5B,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,sBAAsB,GAGvB,MAAM,oBAAoB,CAAC;AAE5B,4BAA4B;AAC5B,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,gCAAgC,CAAC;AAExC,kBAAkB;AAClB,OAAO,EACL,WAAW,EACX,WAAW,GAGZ,MAAM,kBAAkB,CAAC;AAE1B,gBAAgB;AAChB,OAAO,EACL,YAAY,EACZ,WAAW,EACX,WAAW,EAGX,aAAa,GACd,MAAM,mBAAmB,CAAC;AAE3B,mBAAmB;AACnB,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,gBAAgB,GACjB,MAAM,uBAAuB,CAAC;AAE/B,0BAA0B;AAC1B,OAAO,EACL,kBAAkB,EAClB,yBAAyB,EACzB,2BAA2B,EAC3B,eAAe,EACf,oBAAoB,GACrB,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PowerPlatform Prompt Templates
|
|
3
|
+
* Template functions for formatted prompt responses
|
|
4
|
+
*/
|
|
5
|
+
export declare const ENTITY_OVERVIEW: (entityName: string) => string;
|
|
6
|
+
export declare const ATTRIBUTE_DETAILS: (entityName: string, attributeName: string) => string;
|
|
7
|
+
export declare const QUERY_TEMPLATE: (entityNamePlural: string) => string;
|
|
8
|
+
export declare const RELATIONSHIP_MAP: (entityName: string) => string;
|
|
9
|
+
//# sourceMappingURL=prompt-templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-templates.d.ts","sourceRoot":"","sources":["../../src/utils/prompt-templates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,eAAe,GAAI,YAAY,MAAM,WAMwB,CAAC;AAE3E,eAAO,MAAM,iBAAiB,GAAI,YAAY,MAAM,EAAE,eAAe,MAAM,WAO3C,CAAC;AAEjC,eAAO,MAAM,cAAc,GAAI,kBAAkB,MAAM,WAQY,CAAC;AAEpE,eAAO,MAAM,gBAAgB,GAAI,YAAY,MAAM,WAKK,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PowerPlatform Prompt Templates
|
|
3
|
+
* Template functions for formatted prompt responses
|
|
4
|
+
*/
|
|
5
|
+
export const ENTITY_OVERVIEW = (entityName) => `## Power Platform Entity: ${entityName}\n\n` +
|
|
6
|
+
`This is an overview of the '${entityName}' entity in Microsoft Power Platform/Dataverse:\n\n` +
|
|
7
|
+
`### Entity Details\n{{entity_details}}\n\n` +
|
|
8
|
+
`### Attributes\n{{key_attributes}}\n\n` +
|
|
9
|
+
`### Relationships\n{{relationships}}\n\n` +
|
|
10
|
+
`You can query this entity using OData filters against the plural name.`;
|
|
11
|
+
export const ATTRIBUTE_DETAILS = (entityName, attributeName) => `## Attribute: ${attributeName}\n\n` +
|
|
12
|
+
`Details for the '${attributeName}' attribute of the '${entityName}' entity:\n\n` +
|
|
13
|
+
`{{attribute_details}}\n\n` +
|
|
14
|
+
`### Usage Notes\n` +
|
|
15
|
+
`- Data Type: {{data_type}}\n` +
|
|
16
|
+
`- Required: {{required}}\n` +
|
|
17
|
+
`- Max Length: {{max_length}}`;
|
|
18
|
+
export const QUERY_TEMPLATE = (entityNamePlural) => `## OData Query Template for ${entityNamePlural}\n\n` +
|
|
19
|
+
`Use this template to build queries against the ${entityNamePlural} entity:\n\n` +
|
|
20
|
+
`\`\`\`\n${entityNamePlural}?$select={{selected_fields}}&$filter={{filter_conditions}}&$orderby={{order_by}}&$top={{max_records}}\n\`\`\`\n\n` +
|
|
21
|
+
`### Common Filter Examples\n` +
|
|
22
|
+
`- Equals: \`name eq 'Contoso'\`\n` +
|
|
23
|
+
`- Contains: \`contains(name, 'Contoso')\`\n` +
|
|
24
|
+
`- Greater than date: \`createdon gt 2023-01-01T00:00:00Z\`\n` +
|
|
25
|
+
`- Multiple conditions: \`name eq 'Contoso' and statecode eq 0\``;
|
|
26
|
+
export const RELATIONSHIP_MAP = (entityName) => `## Relationship Map for ${entityName}\n\n` +
|
|
27
|
+
`This shows all relationships for the '${entityName}' entity:\n\n` +
|
|
28
|
+
`### One-to-Many Relationships (${entityName} as Primary)\n{{one_to_many_primary}}\n\n` +
|
|
29
|
+
`### One-to-Many Relationships (${entityName} as Related)\n{{one_to_many_related}}\n\n` +
|
|
30
|
+
`### Many-to-Many Relationships\n{{many_to_many}}\n\n`;
|
|
31
|
+
//# sourceMappingURL=prompt-templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-templates.js","sourceRoot":"","sources":["../../src/utils/prompt-templates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,UAAkB,EAAE,EAAE,CACpD,6BAA6B,UAAU,MAAM;IAC7C,+BAA+B,UAAU,qDAAqD;IAC9F,4CAA4C;IAC5C,wCAAwC;IACxC,0CAA0C;IAC1C,wEAAwE,CAAC;AAE3E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,UAAkB,EAAE,aAAqB,EAAE,EAAE,CAC7E,iBAAiB,aAAa,MAAM;IACpC,oBAAoB,aAAa,uBAAuB,UAAU,eAAe;IACjF,2BAA2B;IAC3B,mBAAmB;IACnB,8BAA8B;IAC9B,4BAA4B;IAC5B,8BAA8B,CAAC;AAEjC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,gBAAwB,EAAE,EAAE,CACzD,+BAA+B,gBAAgB,MAAM;IACrD,kDAAkD,gBAAgB,cAAc;IAChF,WAAW,gBAAgB,mHAAmH;IAC9I,8BAA8B;IAC9B,mCAAmC;IACnC,6CAA6C;IAC7C,8DAA8D;IAC9D,iEAAiE,CAAC;AAEpE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,UAAkB,EAAE,EAAE,CACrD,2BAA2B,UAAU,MAAM;IAC3C,yCAAyC,UAAU,eAAe;IAClE,kCAAkC,UAAU,2CAA2C;IACvF,kCAAkC,UAAU,2CAA2C;IACvF,sDAAsD,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Publisher Configuration Module
|
|
3
|
+
*
|
|
4
|
+
* Manages the configurable publisher prefix for PowerPlatform customization.
|
|
5
|
+
* The prefix is required and must be set via PUBLISHER_PREFIX environment variable.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Normalize the publisher prefix to ensure it ends with underscore
|
|
9
|
+
* @param prefix - The raw prefix value (e.g., 'sic' or 'sic_')
|
|
10
|
+
* @returns Normalized prefix with trailing underscore (e.g., 'sic_')
|
|
11
|
+
*/
|
|
12
|
+
export declare function normalizePrefix(prefix: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Initialize the publisher prefix from environment variable.
|
|
15
|
+
* Must be called before using getPublisherPrefix().
|
|
16
|
+
* @throws Error if PUBLISHER_PREFIX is not set
|
|
17
|
+
*/
|
|
18
|
+
export declare function initializePublisherPrefix(): void;
|
|
19
|
+
/**
|
|
20
|
+
* Get the normalized publisher prefix.
|
|
21
|
+
* @returns The publisher prefix with trailing underscore (e.g., 'sic_')
|
|
22
|
+
* @throws Error if prefix has not been initialized
|
|
23
|
+
*/
|
|
24
|
+
export declare function getPublisherPrefix(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Check if publisher prefix is configured (without throwing)
|
|
27
|
+
*/
|
|
28
|
+
export declare function isPublisherPrefixConfigured(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Reset the publisher prefix (for testing purposes)
|
|
31
|
+
*/
|
|
32
|
+
export declare function resetPublisherPrefix(): void;
|
|
33
|
+
//# sourceMappingURL=publisherConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publisherConfig.d.ts","sourceRoot":"","sources":["../../src/utils/publisherConfig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAGtD;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAShD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,CAM3C;AAED;;GAEG;AACH,wBAAgB,2BAA2B,IAAI,OAAO,CAErD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Publisher Configuration Module
|
|
3
|
+
*
|
|
4
|
+
* Manages the configurable publisher prefix for PowerPlatform customization.
|
|
5
|
+
* The prefix is required and must be set via PUBLISHER_PREFIX environment variable.
|
|
6
|
+
*/
|
|
7
|
+
let _publisherPrefix = null;
|
|
8
|
+
/**
|
|
9
|
+
* Normalize the publisher prefix to ensure it ends with underscore
|
|
10
|
+
* @param prefix - The raw prefix value (e.g., 'sic' or 'sic_')
|
|
11
|
+
* @returns Normalized prefix with trailing underscore (e.g., 'sic_')
|
|
12
|
+
*/
|
|
13
|
+
export function normalizePrefix(prefix) {
|
|
14
|
+
const trimmed = prefix.trim().toLowerCase();
|
|
15
|
+
return trimmed.endsWith('_') ? trimmed : `${trimmed}_`;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Initialize the publisher prefix from environment variable.
|
|
19
|
+
* Must be called before using getPublisherPrefix().
|
|
20
|
+
* @throws Error if PUBLISHER_PREFIX is not set
|
|
21
|
+
*/
|
|
22
|
+
export function initializePublisherPrefix() {
|
|
23
|
+
const rawPrefix = process.env.PUBLISHER_PREFIX;
|
|
24
|
+
if (!rawPrefix) {
|
|
25
|
+
throw new Error('Missing required configuration: PUBLISHER_PREFIX. ' +
|
|
26
|
+
'Set this to your PowerPlatform publisher prefix (e.g., "sic" or "sic_").');
|
|
27
|
+
}
|
|
28
|
+
_publisherPrefix = normalizePrefix(rawPrefix);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Get the normalized publisher prefix.
|
|
32
|
+
* @returns The publisher prefix with trailing underscore (e.g., 'sic_')
|
|
33
|
+
* @throws Error if prefix has not been initialized
|
|
34
|
+
*/
|
|
35
|
+
export function getPublisherPrefix() {
|
|
36
|
+
if (_publisherPrefix === null) {
|
|
37
|
+
// Try to initialize on first access
|
|
38
|
+
initializePublisherPrefix();
|
|
39
|
+
}
|
|
40
|
+
return _publisherPrefix;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Check if publisher prefix is configured (without throwing)
|
|
44
|
+
*/
|
|
45
|
+
export function isPublisherPrefixConfigured() {
|
|
46
|
+
return !!process.env.PUBLISHER_PREFIX;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Reset the publisher prefix (for testing purposes)
|
|
50
|
+
*/
|
|
51
|
+
export function resetPublisherPrefix() {
|
|
52
|
+
_publisherPrefix = null;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=publisherConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publisherConfig.js","sourceRoot":"","sources":["../../src/utils/publisherConfig.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,IAAI,gBAAgB,GAAkB,IAAI,CAAC;AAE3C;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC5C,OAAO,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC;AACzD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,yBAAyB;IACvC,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;IAC/C,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,oDAAoD;YACpD,0EAA0E,CAC3E,CAAC;IACJ,CAAC;IACD,gBAAgB,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;AAChD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB;IAChC,IAAI,gBAAgB,KAAK,IAAI,EAAE,CAAC;QAC9B,oCAAoC;QACpC,yBAAyB,EAAE,CAAC;IAC9B,CAAC;IACD,OAAO,gBAAiB,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2BAA2B;IACzC,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC;AACxC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAClC,gBAAgB,GAAG,IAAI,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rate Limiter Module
|
|
3
|
+
*
|
|
4
|
+
* Implements rate limiting with exponential backoff for PowerPlatform API calls.
|
|
5
|
+
* Prevents API throttling errors (429) and manages concurrent request limits.
|
|
6
|
+
*/
|
|
7
|
+
export interface RateLimiterOptions {
|
|
8
|
+
maxRequestsPerMinute?: number;
|
|
9
|
+
maxConcurrentRequests?: number;
|
|
10
|
+
retryAttempts?: number;
|
|
11
|
+
initialBackoffMs?: number;
|
|
12
|
+
maxBackoffMs?: number;
|
|
13
|
+
backoffMultiplier?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface RequestQueueItem<T> {
|
|
16
|
+
fn: () => Promise<T>;
|
|
17
|
+
resolve: (value: T) => void;
|
|
18
|
+
reject: (error: unknown) => void;
|
|
19
|
+
retryCount: number;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Rate Limiter Class
|
|
23
|
+
*/
|
|
24
|
+
export declare class RateLimiter {
|
|
25
|
+
private options;
|
|
26
|
+
private requestTimestamps;
|
|
27
|
+
private activeRequests;
|
|
28
|
+
private queue;
|
|
29
|
+
private processing;
|
|
30
|
+
constructor(options?: RateLimiterOptions);
|
|
31
|
+
/**
|
|
32
|
+
* Execute a function with rate limiting
|
|
33
|
+
*/
|
|
34
|
+
execute<T>(fn: () => Promise<T>): Promise<T>;
|
|
35
|
+
/**
|
|
36
|
+
* Process the request queue
|
|
37
|
+
*/
|
|
38
|
+
private processQueue;
|
|
39
|
+
/**
|
|
40
|
+
* Execute a single request with retry logic
|
|
41
|
+
*/
|
|
42
|
+
private executeRequest;
|
|
43
|
+
/**
|
|
44
|
+
* Check if we can make a request without exceeding rate limits
|
|
45
|
+
*/
|
|
46
|
+
private canMakeRequest;
|
|
47
|
+
/**
|
|
48
|
+
* Record a request timestamp
|
|
49
|
+
*/
|
|
50
|
+
private recordRequest;
|
|
51
|
+
/**
|
|
52
|
+
* Remove timestamps older than 1 minute
|
|
53
|
+
*/
|
|
54
|
+
private cleanupOldTimestamps;
|
|
55
|
+
/**
|
|
56
|
+
* Calculate backoff time for retry
|
|
57
|
+
*/
|
|
58
|
+
private calculateBackoff;
|
|
59
|
+
/**
|
|
60
|
+
* Check if error is a rate limit error
|
|
61
|
+
*/
|
|
62
|
+
private isRateLimitError;
|
|
63
|
+
/**
|
|
64
|
+
* Sleep helper
|
|
65
|
+
*/
|
|
66
|
+
private sleep;
|
|
67
|
+
/**
|
|
68
|
+
* Get current rate limiter stats
|
|
69
|
+
*/
|
|
70
|
+
getStats(): {
|
|
71
|
+
activeRequests: number;
|
|
72
|
+
queuedRequests: number;
|
|
73
|
+
requestsLastMinute: number;
|
|
74
|
+
maxRequestsPerMinute: number;
|
|
75
|
+
maxConcurrentRequests: number;
|
|
76
|
+
utilizationPercentage: number;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Wait until rate limiter has capacity
|
|
80
|
+
*/
|
|
81
|
+
waitForCapacity(): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Clear the queue
|
|
84
|
+
*/
|
|
85
|
+
clearQueue(): void;
|
|
86
|
+
/**
|
|
87
|
+
* Reset rate limiter
|
|
88
|
+
*/
|
|
89
|
+
reset(): void;
|
|
90
|
+
/**
|
|
91
|
+
* Update rate limiter options
|
|
92
|
+
*/
|
|
93
|
+
updateOptions(options: Partial<RateLimiterOptions>): void;
|
|
94
|
+
}
|
|
95
|
+
export declare const rateLimiter: RateLimiter;
|
|
96
|
+
/**
|
|
97
|
+
* Helper function to wrap API calls with rate limiting
|
|
98
|
+
*/
|
|
99
|
+
export declare function withRateLimit<T>(fn: () => Promise<T>): Promise<T>;
|
|
100
|
+
/**
|
|
101
|
+
* Batch execution with rate limiting
|
|
102
|
+
* Processes an array of functions with rate limiting
|
|
103
|
+
*/
|
|
104
|
+
export declare function batchExecute<T>(fns: (() => Promise<T>)[], options?: {
|
|
105
|
+
onProgress?: (completed: number, total: number) => void;
|
|
106
|
+
onError?: (error: unknown, index: number) => void;
|
|
107
|
+
}): Promise<T[]>;
|
|
108
|
+
//# sourceMappingURL=rate-limiter.d.ts.map
|