@xrmforge/devkit 0.7.16 → 0.7.17

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.
@@ -21,7 +21,7 @@ functions with domain-specific names, not in anonymous chains of API calls.
21
21
  ## Packages
22
22
 
23
23
  - `@xrmforge/typegen` - Generates typed declarations from Dataverse metadata (Node.js CLI only, NEVER import in browser code)
24
- - `@xrmforge/helpers` - Browser-safe runtime: typedForm(), select(), parseLookup(), formLookup(), Xrm constants, Action executors
24
+ - `@xrmforge/helpers` - Browser-safe runtime: typedForm(), select(), parseLookup(), formLookup(), Xrm constants, Action executors, callCloudFlow()
25
25
  - `@xrmforge/testing` - Type-safe form mocks: createFormMock(), fireOnChange(), setupXrmMock()
26
26
  - `@xrmforge/devkit` - esbuild IIFE bundles via xrmforge build
27
27
  - `@xrmforge/eslint-plugin` - D365-specific ESLint rules
@@ -379,6 +379,7 @@ Xrm.Navigation.openForm({ entityName: EntityNames.Account, entityId: id }); //
379
379
  **Code quality:**
380
380
  - Never `Xrm.Page` (deprecated since D365 v9.0)
381
381
  - Never `eval()`, never synchronous XMLHttpRequest
382
+ - Never hand-write `fetch`/`XMLHttpRequest` for Power Automate cloud-flow HTTP-trigger calls (use `callCloudFlow(flowUrl, body)` from `@xrmforge/helpers`)
382
383
  - Never `window.X = ...` (use module exports)
383
384
  - Never `console.log/warn/error` in form scripts (use shared logger)
384
385
  - Never export handlers without `wrapHandler()`
@@ -409,6 +410,7 @@ Copy these MANDATORY rules into every sub-agent prompt:
409
410
  13. NOTIFICATION_IDS from constants.ts for all notification unique IDs
410
411
  14. Named constants for non-obvious values (never magic numbers like 86400000)
411
412
  15. pickLang() for all user-visible strings (never hardcoded German/English)
413
+ 16. callCloudFlow(flowUrl, body) for Power Automate cloud-flow HTTP-trigger calls (never hand-rolled fetch/XHR)
412
414
  ```
413
415
 
414
416
  ## Mandatory Shared Utilities
@@ -517,6 +519,29 @@ const result = await withProgress(
517
519
  );
518
520
  ```
519
521
 
522
+ ### Cloud Flow Call (Power Automate HTTP trigger)
523
+ ```typescript
524
+ // BEFORE (hand-rolled XMLHttpRequest/fetch against the flow trigger URL):
525
+ const req = new XMLHttpRequest();
526
+ req.open('POST', flowUrl, true);
527
+ req.setRequestHeader('Content-Type', 'application/json');
528
+ req.onreadystatechange = () => { /* manual status checks + JSON.parse */ };
529
+ req.send(JSON.stringify(payload));
530
+
531
+ // AFTER (callCloudFlow: typed body/response, JSON + non-2xx handling built in):
532
+ import { callCloudFlow } from '@xrmforge/helpers';
533
+
534
+ interface PriceRequest { quoteId: string; }
535
+ interface PriceResponse { total: number; }
536
+
537
+ // flowUrl comes from configuration (e.g. a Dataverse environment variable); it
538
+ // contains a SAS signature, so never hard-code it in source.
539
+ const price = await callCloudFlow<PriceRequest, PriceResponse>(flowUrl, { quoteId });
540
+
541
+ // Compose with withProgress for a spinner:
542
+ // await withProgress(lang.calculatingPrice, () => callCloudFlow(flowUrl, { quoteId }));
543
+ ```
544
+
520
545
  ### Date Calculation
521
546
  ```typescript
522
547
  // BEFORE: new Date(date.getTime() + nettotage * 86400000)
@@ -577,6 +602,7 @@ each attribute to its control. `mock.getControl(Fields.Name)` works out of the b
577
602
  | `getValue() === 595300000` | `form.statuscode.getValue() === StatusCode.Active` |
578
603
  | `86400000` | `const MS_PER_DAY = 24 * 60 * 60 * 1000` |
579
604
  | `'[Kurzbeschreibung]'` | `pickLang(languageId, MESSAGES).placeholder` |
605
+ | `XMLHttpRequest`/`fetch` to a Power Automate flow URL | `callCloudFlow(flowUrl, body)` (from `@xrmforge/helpers`) |
580
606
 
581
607
  ### Legacy Helper Functions (DO NOT recreate, use typedForm instead)
582
608
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xrmforge/devkit",
3
- "version": "0.7.16",
3
+ "version": "0.7.17",
4
4
  "description": "Build orchestration and project tooling for Dynamics 365 WebResources",
5
5
  "keywords": [
6
6
  "dynamics-365",